(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3804b461"],{7679:function(e,t,a){"use strict";a("c79c");var n=a("e4d3"),r=a("7560"),s=a("80d2"),l=a("afdd"),i=a("326d"),o=a("58df");t["a"]=Object(o["a"])(n["a"],r["a"]).extend({name:"v-edit-dialog",props:{cancelText:{default:"Cancel"},large:Boolean,eager:Boolean,persistent:Boolean,saveText:{default:"Save"},transition:{type:String,default:"slide-x-reverse-transition"}},data(){return{isActive:!1}},watch:{isActive(e){e?(this.$emit("open"),setTimeout(this.focus,50)):this.$emit("close")}},methods:{cancel(){this.isActive=!1,this.$emit("cancel")},focus(){const e=this.$refs.content.querySelector("input");e&&e.focus()},genButton(e,t){return this.$createElement(l["a"],{props:{text:!0,color:"primary",light:!0},on:{click:e}},t)},genActions(){return this.$createElement("div",{class:"v-small-dialog__actions"},[this.genButton(this.cancel,this.cancelText),this.genButton(()=>{this.save(this.returnValue),this.$emit("save")},this.saveText)])},genContent(){return this.$createElement("div",{staticClass:"v-small-dialog__content",on:{keydown:e=>{e.keyCode===s["A"].esc&&this.cancel(),e.keyCode===s["A"].enter&&(this.save(this.returnValue),this.$emit("save"))}},ref:"content"},[this.$slots.input])}},render(e){return e(i["a"],{staticClass:"v-small-dialog",class:this.themeClasses,props:{contentClass:"v-small-dialog__menu-content",transition:this.transition,origin:"top right",right:!0,value:this.isActive,closeOnClick:!this.persistent,closeOnContentClick:!1,eager:this.eager,light:this.light,dark:this.dark},on:{input:e=>this.isActive=e},scopedSlots:{activator:({on:t})=>e("div",{staticClass:"v-small-dialog__activator",on:t},[e("span",{staticClass:"v-small-dialog__activator__content"},this.$slots.default)])}},[this.genContent(),this.large?this.genActions():null])}})},a5a2:function(e,t,a){"use strict";a.r(t);var n=a("8336"),r=a("b0af"),s=a("99d9"),l=a("62ad"),i=a("8fea"),o=a("169a"),c=a("7679"),u=a("4bd4"),d=a("132d"),p=a("0fd9"),m=a("b974"),f=a("2fa4"),h=a("8654"),v=a("3a2f"),b=function(){var e=this,t=e._self._c;return t(p["a"],{staticClass:"mainCardHeight row-eq-height",attrs:{id:"systemtableEditor","no-gutters":""}},[t(l["a"],{staticClass:"py-0"},[t(r["a"],{staticClass:"screen-height-container flex-content"},[t(s["d"],[t("h2",[e._v(e._s(e.title))]),t(f["a"]),t("r-button",{staticClass:"mr-1",attrs:{outlined:!0,icon:"add",color:"primary",label:"Create"},on:{onclick:e.onAddNew}}),t("r-button",{attrs:{outlined:!0,icon:"refresh",color:"primary",label:"Refresh"},on:{onclick:e.onRefresh}})],1),t(s["c"],{staticClass:"d-flex flex-column"},[t(p["a"],{attrs:{justify:"center"}},[t(l["a"],{attrs:{md:"4"}},[t(m["a"],{attrs:{items:e.systemtables,"return-object":"","item-text":"pluralName",label:"Table",dense:""},model:{value:e.selectedTable,callback:function(t){e.selectedTable=t},expression:"selectedTable"}})],1)],1),t(i["a"],{staticClass:"flex-grow-auto",attrs:{"fixed-header":"",options:e.pagination,height:"100%",headers:e.headers,items:e.dataset,"hide-default-footer":""},scopedSlots:e._u([{key:"item.actions",fn:function(a){var r=a.item;return[t(v["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(a){var s=a.on;return[t(n["a"],e._g({attrs:{icon:""},on:{click:function(t){return e.confirmDelete(r)}}},s),[t(d["a"],[e._v("delete")])],1)]}}],null,!0)},[t("span",[e._v("Delete this record")])])]}},{key:"item.label",fn:function(a){var n=a.item;return[t(c["a"],{attrs:{"return-value":n.label,lazy:""},on:{"update:returnValue":function(t){return e.$set(n,"label",t)},"update:return-value":function(t){return e.$set(n,"label",t)}}},[e._v("\n              "+e._s(n.label)+"\n              "),t(h["a"],{attrs:{slot:"input",label:"Label","single-line":"",counter:"45",rules:[e.rules.requiredNoblanks]},on:{change:function(t){return e.onChangeLabel(n)}},slot:"input",model:{value:n.label,callback:function(t){e.$set(n,"label",t)},expression:"item.label"}})],1)]}},{key:"item.updatedate",fn:function(a){var n=a.item;return[t("span",{staticStyle:{"white-space":"nowrap"},domProps:{innerHTML:e._s(e.formatDateWithHTML(n.updatedate))}})]}}])})],1)],1),e.addNew?t(o["a"],{attrs:{width:"500",persistent:""},model:{value:e.addNew,callback:function(t){e.addNew=t},expression:"addNew"}},[t(r["a"],[t(s["d"],[t("h2",[e._v("Add New "+e._s(e.selectedTable.name))]),t(f["a"]),t(n["a"],{attrs:{icon:""},on:{click:function(t){e.addNew=!1}}},[t(d["a"],[e._v("close")])],1)],1),t(s["c"],[t(u["a"],{model:{value:e.valid,callback:function(t){e.valid=t},expression:"valid"}},[t(h["a"],{attrs:{label:"Label",counter:"45",rules:[e.rules.requiredNoblanks],autofocus:""},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSaveNew.apply(null,arguments)}},model:{value:e.label,callback:function(t){e.label=t},expression:"label"}})],1)],1),t(s["a"],{staticClass:"justify-center"},[t(n["a"],{attrs:{text:"",color:"primary",disabled:!e.valid},on:{click:e.onSaveNew}},[e._v("Save")])],1)],1)],1):e._e(),e.selectedRec?t(o["a"],{attrs:{width:"400"},model:{value:e.showConfirmDelete,callback:function(t){e.showConfirmDelete=t},expression:"showConfirmDelete"}},[t(r["a"],[t(s["d"],[t("h2",[e._v("Confirm Delete")])]),t(s["c"],[e._v("Delete "+e._s(e.selectedRec.label)+"?")]),t(s["a"],{staticClass:"justify-center"},[t(n["a"],{attrs:{text:"",color:"error"},on:{click:e.onConfirmDelete}},[e._v("Confirm Delete")])],1)],1)],1):e._e()],1)],1)},y=[],g=a("d0eb"),T=a("d67f"),w=a("a9b3"),_=a("2f62");function k(e){return k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k(e)}function C(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function N(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?C(Object(a),!0).forEach((function(t){P(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):C(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function P(e,t,a){return(t=U(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function U(e){var t=x(e,"string");return"symbol"==k(t)?t:t+""}function x(e,t){if("object"!=k(e)||!e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var n=a.call(e,t||"default");if("object"!=k(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var S={name:"SystemTables",mixins:[w["a"]],props:[],components:{},beforeMount:function(){this.selectedTable=this.systemtables[0]},mounted:function(){},data:function(){return{Trimaster:g["a"],pagination:{itemsPerPage:-1,sortBy:["label"]},addNew:!1,showConfirmDelete:!1,doUpdate:!0,selectedRec:null,label:"",valid:!1,title:"Manage System Tables",rules:{requiredNoblanks:function(e){return!!e&&null!=e.match(/^(?!\s*$).+/g)||"Required."}},systemtables:[{pluralName:"Brands",name:"Brand  ",serviceUrl:"ag_brands"},{pluralName:"Camera PTZ Position Labels",name:"Camera PTZ Position Label",serviceUrl:"cameraPtzPositionLabels"},{pluralName:"Control loop Diagram Types",name:"Control loop diagram type",serviceUrl:"ag_controlLoopDiagramTypes"},{pluralName:"Destroy Plant Reasons",name:"Destroy Plant Reason",serviceUrl:"DestroyPlantReasons"},{pluralName:"Emergency Contact Types",name:"Emergency Contact Type",serviceUrl:"ag_emergencyContactTypes"},{pluralName:"Exception Statuses",name:"Exception Status",serviceUrl:"ExceptionStatuses"},{pluralName:"Extraction Equipment Types",name:"Extraction Equipment Type",serviceUrl:"ag_extractionEquipmentTypes"},{pluralName:"Extraction Equipment Manufacturers",name:"Extraction Manufacturer",serviceUrl:"ag_extractionEquipmentManufacturers"},{pluralName:"Extraction Raw Materials",name:"Extraction Raw Materials",serviceUrl:"ag_rawMaterials"},{pluralName:"Extraction Final Products",name:"Extraction Final Products",serviceUrl:"ag_extractedProducts"},{pluralName:"Knowledge, Skills, Abilities",name:"Knowledge, Skill, Ability",serviceUrl:"KSAs"},{pluralName:"Light Types",name:"Light Type",serviceUrl:"ag_lightTypes"},{pluralName:"Pests",name:"Pest",serviceUrl:"pestTypes"},{pluralName:"Photo Tags",name:"Photo Tag",serviceUrl:"imageTags"},{pluralName:"Plant Types",name:"Plant Type",serviceUrl:"ag_plantTypes"},{pluralName:"Plant Licence Types",name:"Plant Licence Type",serviceUrl:"ag_plantLicenseTypes"},{pluralName:"Plant Nutrient Deficiencies",name:"Deficiency",serviceUrl:"ag_nutrientDeficiencies"},{pluralName:"Post-Harvest Task Types",name:"Post-Harvest Task Type",serviceUrl:"ag_postHarvestWorkflowTaskTypes"},{pluralName:"Product Inventory Types",name:"Product Inventory Type",serviceUrl:"ag_productInventoryTypes"},{pluralName:"Root Colors",name:"Root Color",serviceUrl:"ag_rootColors"},{pluralName:"Plant Colors",name:"Plant Color",serviceUrl:"ag_plantColors"},{pluralName:"Plant Diseases",name:"Plant Disease",serviceUrl:"ag_plantDiseases"},{pluralName:"Unwanted Plants",name:"Unwanted Plant",serviceUrl:"ag_unwantedPlants"},{pluralName:"Plant Nutrient Deficiency Symptoms",name:"Nutrient Deficiency Symptom",serviceUrl:"ag_nutrientDeficiencySymptoms"},{pluralName:"Software Service Levels",name:"Service Level",serviceUrl:"ag_serviceLevels"},{pluralName:"Task Types",name:"Task Type",serviceUrl:"task_type"},{pluralName:"Training Resource Types",name:"Task Resource",serviceUrl:"TrainingResourceTypes"}],selectedTable:null,dataset:[],headers:[{text:"Actions",value:"actions",sortable:!1,width:50},{text:"Label",align:"left",sortable:!0,value:"label"},{text:"Updated By",value:"updateuser",width:180},{text:"Updated On",value:"updatedate",width:120}]}},computed:N({},Object(_["c"])(["getUser"])),watch:{selectedTable:function(e){this.onRefresh()}},methods:{confirmDelete:function(e){this.selectedRec=e,this.showConfirmDelete=!0},onChangeLabel:function(e){var t=this;""!=e.label?this.doUpdate&&(this.doUpdate=!1,setTimeout((function(){t.doUpdate=!0}),500),this.isLoading=!0,g["a"].put(this.selectedTable.serviceUrl,e.id,this.getUser.apitoken,e).then((function(e){1==e.length?(t.onRefresh(),T["a"].success("Record updated")):T["a"].error("Error - "+e[1].message)}))):(this.onRefresh(),T["a"].error("Error - Empty Label"))},onRefresh:function(){var e=this;this.isLoading=!0,g["a"].get(this.selectedTable.serviceUrl,this.getUser.apitoken).then((function(t){e.isLoading=!1,e.dataset=t[0]}))},onSaveNew:function(){if(this.valid){var e=this;this.isLoading=!0,g["a"].post(this.selectedTable.serviceUrl,this.getUser.apitoken,{label:this.label}).then((function(t){e.isLoading=!1,t.length&&t[0].id?(e.addNew=!1,T["a"].success("Record Saved"),e.onRefresh()):T["a"].error("Error - Failed to save. Please try again later.")}))}else T["a"].error("Form entries incomplete or invalid.")},onAddNew:function(){this.label="",this.addNew=!0},onConfirmDelete:function(){var e=this;g["a"].destroy(this.selectedTable.serviceUrl,this.selectedRec.id,this.getUser.apitoken).then((function(t){1==t.length?(T["a"].success("Record deleted."),e.showConfirmDelete=!1,e.onRefresh()):T["a"].error("Error - "+t[1].message)}))}}},D=S,E=a("2877"),R=Object(E["a"])(D,b,y,!1,null,null,null);t["default"]=R.exports},c79c:function(e,t,a){}}]);
//# sourceMappingURL=chunk-3804b461.fc0be300.js.map