(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-3aa7b152"],{"2c64":function(e,t,r){},"3d86":function(e,t,r){},"43a6":function(e,t,r){"use strict";r("ec29"),r("3d86");var i=r("c37a"),n=r("604c"),a=r("58df");const o=Object(a["a"])(n["a"],i["a"]);t["a"]=o.extend({name:"v-radio-group",provide(){return{radioGroup:this}},props:{column:{type:Boolean,default:!0},height:{type:[Number,String],default:"auto"},name:String,row:Boolean,value:null},computed:{classes(){return{...i["a"].options.computed.classes.call(this),"v-input--selection-controls v-input--radio-group":!0,"v-input--radio-group--column":this.column&&!this.row,"v-input--radio-group--row":this.row}}},methods:{genDefaultSlot(){return this.$createElement("div",{staticClass:"v-input--radio-group__input",attrs:{id:this.id,role:"radiogroup","aria-labelledby":this.computedId}},i["a"].options.methods.genDefaultSlot.call(this))},genInputSlot(){const e=i["a"].options.methods.genInputSlot.call(this);return delete e.data.on.click,e},genLabel(){const e=i["a"].options.methods.genLabel.call(this);return e?(e.data.attrs.id=this.computedId,delete e.data.attrs.for,e.tag="legend",e):null},onClick:n["a"].options.methods.onClick},render(e){const t=i["a"].options.render.call(this,e);return this._b(t.data,"div",this.attrs$),t}})},"67b6":function(e,t,r){"use strict";r("2c64");var i=r("ba87"),n=r("9d26"),a=r("c37a"),o=r("7e2b"),s=r("a9ad"),l=r("4e82"),c=r("5311"),u=r("7560"),d=r("fe09"),p=r("80d2"),f=r("58df"),h=r("d9f7");const y=Object(f["a"])(o["a"],s["a"],c["a"],Object(l["a"])("radioGroup"),u["a"]);t["a"]=y.extend().extend({name:"v-radio",inheritAttrs:!1,props:{disabled:Boolean,id:String,label:String,name:String,offIcon:{type:String,default:"$radioOff"},onIcon:{type:String,default:"$radioOn"},readonly:Boolean,value:{default:null}},data:()=>({isFocused:!1}),computed:{classes(){return{"v-radio--is-disabled":this.isDisabled,"v-radio--is-focused":this.isFocused,...this.themeClasses,...this.groupClasses}},computedColor(){return d["a"].options.computed.computedColor.call(this)},computedIcon(){return this.isActive?this.onIcon:this.offIcon},computedId(){return a["a"].options.computed.computedId.call(this)},hasLabel:a["a"].options.computed.hasLabel,hasState(){return(this.radioGroup||{}).hasState},isDisabled(){return this.disabled||!!this.radioGroup&&this.radioGroup.isDisabled},isReadonly(){return this.readonly||!!this.radioGroup&&this.radioGroup.isReadonly},computedName(){return this.name||!this.radioGroup?this.name:this.radioGroup.name||"radio-"+this.radioGroup._uid},rippleState(){return d["a"].options.computed.rippleState.call(this)},validationState(){return(this.radioGroup||{}).validationState||this.computedColor}},methods:{genInput(e){return d["a"].options.methods.genInput.call(this,"radio",e)},genLabel(){return this.hasLabel?this.$createElement(i["a"],{on:{click:d["b"]},attrs:{for:this.computedId},props:{color:this.validationState,focused:this.hasState}},Object(p["u"])(this,"label")||this.label):null},genRadio(){const{title:e,...t}=this.attrs$;return this.$createElement("div",{staticClass:"v-input--selection-controls__input"},[this.$createElement(n["a"],this.setTextColor(this.validationState,{props:{dense:this.radioGroup&&this.radioGroup.dense}}),this.computedIcon),this.genInput({name:this.computedName,value:this.value,...t}),this.genRipple(this.setTextColor(this.rippleState))])},onFocus(e){this.isFocused=!0,this.$emit("focus",e)},onBlur(e){this.isFocused=!1,this.$emit("blur",e)},onChange(){this.isDisabled||this.isReadonly||this.isActive||this.toggle()},onKeydown:()=>{}},render(e){const t={staticClass:"v-radio",class:this.classes,on:Object(h["c"])({click:this.onChange},this.listeners$),attrs:{title:this.attrs$.title}};return e("div",t,[this.genRadio(),this.genLabel()])}})},ba20:function(e,t,r){"use strict";r.r(t);var i=r("8336"),n=r("b0af"),a=r("99d9"),o=r("62ad"),s=r("8fea"),l=r("169a"),c=r("132d"),u=r("0fd9"),d=r("2fa4"),p=r("3a2f"),f=function(){var e=this,t=e._self._c;return t(u["a"],{staticClass:"mainCardHeight row-eq-height",attrs:{id:"vpdProfileEditor","no-gutters":""}},[t(o["a"],{staticClass:"py-0"},[t(n["a"],{staticClass:"screen-height-container flex-content"},[t(a["d"],[t("h2",[e._v("VPD Profiles")]),t(d["a"]),t("r-button",{staticClass:"mr-2",attrs:{outlined:!0,icon:"add",color:"primary",label:"Create"},on:{onclick:function(t){return e.onAddNew()}}}),t("r-button",{attrs:{outlined:!0,icon:"refresh",color:"primary",label:"Refresh"},on:{onclick:e.getVpdProfiles}})],1),t(a["c"],[t(s["a"],{attrs:{"fixed-header":"",height:"100%",headers:e.headers,items:e.vpdProfiles,"hide-default-footer":"",loading:e.isLoading,options:e.pagination},scopedSlots:e._u([{key:"item.actions",fn:function(r){var n=r.item;return[t("span",{staticStyle:{"white-space":"nowrap"}},[e.isAdmin?e._e():t(p["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(r){var a=r.on;return[t(i["a"],e._g({attrs:{icon:""},on:{click:function(t){e.selectedRec=n,e.addNew=!0}}},a),[t(c["a"],[e._v("visibility")])],1)]}}],null,!0)},[t("span",[e._v("View this record")])]),e.isAdmin?t(p["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(r){var a=r.on;return[t(i["a"],e._g({attrs:{icon:""},on:{click:function(t){e.selectedRec=n,e.addNew=!0}}},a),[t(c["a"],[e._v("edit")])],1)]}}],null,!0)},[t("span",[e._v("Edit this record")])]):e._e(),e.isAdmin?t(p["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(r){var a=r.on;return[t(i["a"],e._g({attrs:{icon:""},on:{click:function(t){return e.deleteRecord(n)}}},a),[t(c["a"],[e._v("delete")])],1)]}}],null,!0)},[t("span",[e._v("Delete this record")])]):e._e()],1)]}},{key:"item.updatedate",fn:function(r){var i=r.item;return[t("span",{domProps:{innerHTML:e._s(e.formatDateWithHTML(i.updatedate))}})]}}])})],1)],1),e.addNew?t(l["a"],{attrs:{width:"800",persistent:""},model:{value:e.addNew,callback:function(t){e.addNew=t},expression:"addNew"}},[e.selectedRec?t("edit-vpd-profile",{class:{vh90:e.selectedRec.id},attrs:{profile:e.selectedRec},on:{save:e.onChangeRec,close:function(t){e.addNew=!1}}}):e._e()],1):e._e()],1)],1)},h=[],y=r("d0eb"),m=r("d67f"),b=r("2f62"),g=r("ac7c"),v=r("4bd4"),w=r("67b6"),S=r("43a6"),_=r("8654"),k=function(){var e=this,t=e._self._c;return t(u["a"],{staticClass:"mainCardHeight row-eq-height",attrs:{id:"vpdProfileEditor","no-gutters":""}},[t(o["a"],{staticClass:"py-0"},[t(n["a"],{staticClass:"screen-height-container flex-content"},[t(a["d"],[t("h2",[e._v(e._s(e.rec&&e.rec.id?"Edit":"Create")+" VPD Profile")]),t(d["a"]),e.canAddNewRange?t("r-button",{staticClass:"mr-2",attrs:{outlined:!0,icon:"add",color:"primary",label:"Create VPD Range"},on:{onclick:function(t){return e.onAddNew()}}}):e._e(),e.rec&&e.rec.id?t("r-button",{staticClass:"mr-2",attrs:{outlined:!0,icon:"refresh",color:"primary",label:"Refresh"},on:{onclick:e.getVpdRanges}}):e._e(),t("r-button",{attrs:{outlined:!0,icon:"close",color:"primary",label:"Close"},on:{onclick:e.onClose}})],1),e.rec?t(a["c"],{staticClass:"d-flex flex-column"},[t(v["a"],{model:{value:e.valid,callback:function(t){e.valid=t},expression:"valid"}},[t(_["a"],{attrs:{disabled:!e.canEdit,label:"Label",counter:"255",maxlength:"255",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.onSave.apply(null,arguments)}},model:{value:e.rec.label,callback:function(t){e.$set(e.rec,"label",t)},expression:"rec.label"}}),e.isAdmin?t(u["a"],{attrs:{"no-gutters":""}},[t(o["a"],{attrs:{cols:"3"}},[t(g["a"],{attrs:{label:"Facility-Specific"},model:{value:e.isForFacility,callback:function(t){e.isForFacility=t},expression:"isForFacility"}})],1),e.isForFacility?e._e():t(o["a"],{attrs:{cols:"6"}},[t(S["a"],{attrs:{row:""},model:{value:e.plantType,callback:function(t){e.plantType=t},expression:"plantType"}},[t(w["a"],{attrs:{label:"Cannabis",value:"isCannabis"}}),t(w["a"],{attrs:{label:"Hemp",value:"isHemp"}}),t(w["a"],{attrs:{label:"Leafy Greens",value:"isLeafyGreens"}})],1)],1)],1):e._e()],1),e.rec&&e.rec.id?t("div",{staticClass:"flex-grow-auto d-flex flex-column"},[t(s["a"],{staticClass:"flex-grow-auto",staticStyle:{border:"1px solid silver"},attrs:{"fixed-header":"",height:"100%",headers:e.headers,items:e.vpdRanges,"hide-default-footer":"",loading:e.isLoading,options:e.pagination},scopedSlots:e._u([{key:"item.actions",fn:function(r){var n=r.item;return[t("span",{staticStyle:{"white-space":"nowrap"}},[e.canEdit?t(p["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(r){var a=r.on;return[t(i["a"],e._g({attrs:{icon:""},on:{click:function(t){e.selectedRec=n,e.addNew=!0}}},a),[t(c["a"],[e._v("edit")])],1)]}}],null,!0)},[t("span",[e._v("Edit this record")])]):e._e(),e.canEdit?t(p["a"],{attrs:{top:""},scopedSlots:e._u([{key:"activator",fn:function(r){var a=r.on;return[t(i["a"],e._g({attrs:{icon:""},on:{click:function(t){return e.deleteRecord(n)}}},a),[t(c["a"],[e._v("delete")])],1)]}}],null,!0)},[t("span",[e._v("Delete this record")])]):e._e()],1)]}},{key:"item.updatedate",fn:function(r){var i=r.item;return[t("span",{domProps:{innerHTML:e._s(e.formatDateWithHTML(i.updatedate))}})]}}],null,!1,138143740)})],1):e._e()],1):e._e(),t(a["a"],{staticClass:"justify-center"},[e.canEdit?t(i["a"],{attrs:{text:"",color:"primary"},on:{click:e.onSave}},[e._v("Save")]):e._e()],1)],1),t(l["a"],{attrs:{width:"500",persistent:""},model:{value:e.addNew,callback:function(t){e.addNew=t},expression:"addNew"}},[e.selectedRec?t("edit-vpd-range",{staticStyle:{height:"300px"},on:{save:e.onChangeRec,close:function(t){e.addNew=!1}},model:{value:e.selectedRec,callback:function(t){e.selectedRec=t},expression:"selectedRec"}}):e._e()],1)],1)],1)},O=[],P=function(){var e=this,t=e._self._c;return t(u["a"],{staticClass:"mainCardHeight row-eq-height",attrs:{id:"vpdRangeEditor","no-gutters":""}},[t(o["a"],{staticClass:"py-0"},[t(n["a"],{staticClass:"screen-height-container flex-content"},[t(a["d"],[t("h2",[e._v(e._s(e.value.id?"Edit ":"New ")+" VPD Range")]),t(d["a"]),t(i["a"],{attrs:{icon:""},on:{click:e.onClose}},[t(c["a"],[e._v("close")])],1)],1),t(a["c"],{staticClass:"overflow-auto"},[e.rec?t(v["a"],{ref:"form",model:{value:e.valid,callback:function(t){e.valid=t},expression:"valid"}},[t(u["a"],{attrs:{"no-gutters":""}},[t(o["a"],{staticClass:"pr-2",attrs:{cols:"6"}},[t(_["a"],{attrs:{label:"Lifecycle Start Day",counter:"3",maxlength:"3",rules:[e.rules.requiredNumber]},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSave.apply(null,arguments)}},model:{value:e.rec.lifecycleStartDay,callback:function(t){e.$set(e.rec,"lifecycleStartDay",t)},expression:"rec.lifecycleStartDay"}})],1),t(o["a"],{staticClass:"pl-2",attrs:{cols:"6"}},[t(_["a"],{attrs:{label:"Lifecycle End Day",counter:"3",maxlength:"3",rules:[e.rules.requiredNumber]},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSave.apply(null,arguments)}},model:{value:e.rec.lifecycleEndDay,callback:function(t){e.$set(e.rec,"lifecycleEndDay",t)},expression:"rec.lifecycleEndDay"}})],1)],1),t(u["a"],{attrs:{"no-gutters":""}},[t(o["a"],{staticClass:"pr-2",attrs:{cols:"6"}},[t(_["a"],{attrs:{label:"Min VPD",counter:"4",maxlength:"4",rules:[e.rules.requiredNumber],suffix:"kPa"},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSave.apply(null,arguments)}},model:{value:e.rec.min,callback:function(t){e.$set(e.rec,"min",t)},expression:"rec.min"}})],1),t(o["a"],{staticClass:"pl-2",attrs:{cols:"6"}},[t(_["a"],{attrs:{label:"Max VPD",counter:"4",maxlength:"4",rules:[e.rules.requiredNumber],suffix:"kPa"},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.onSave.apply(null,arguments)}},model:{value:e.rec.max,callback:function(t){e.$set(e.rec,"max",t)},expression:"rec.max"}})],1)],1)],1):e._e()],1),t(a["a"],{staticClass:"justify-center"},[t(i["a"],{attrs:{text:"",color:"primary",disabled:!e.valid},on:{click:e.onSave}},[e._v("Save")])],1)],1)],1)],1)},C=[];function x(e){return x="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},x(e)}function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){D(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e,t,r){return(t=E(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function E(e){var t=L(e,"string");return"symbol"==x(t)?t:t+""}function L(e,t){if("object"!=x(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=x(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var N={name:"EditVpdRange",props:["value"],components:{},beforeMount:function(){this.rec=R({},this.value)},mounted:function(){},data:function(){return{rec:null,valid:!1,rules:{requiredNumber:function(e){return!isNaN(parseFloat(e))&&parseFloat(e)>0||"Required."}}}},computed:R({},Object(b["c"])(["getUser"])),watch:{value:function(e,t){this.rec=R({},this.value),this.$refs.form.resetValidation()}},methods:{onClose:function(){this.$emit("close")},onSave:function(){this.valid?(this.$emit("input",this.rec),this.$emit("save")):m["a"].error("Form Entries Incomplete or Invalid")}}},A=N,T=r("2877"),V=Object(T["a"])(A,P,C,!1,null,null,null),F=V.exports,U=r("a9b3"),I=r("ea10");function $(e){return $="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},$(e)}function G(e,t){return W(e)||B(e,t)||q(e,t)||H()}function H(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function q(e,t){if(e){if("string"==typeof e)return M(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(e,t):void 0}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function B(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return s}}function W(e){if(Array.isArray(e))return e}function J(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function K(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?J(Object(r),!0).forEach((function(t){z(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):J(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function z(e,t,r){return(t=Q(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q(e){var t=X(e,"string");return"symbol"==$(t)?t:t+""}function X(e,t){if("object"!=$(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=$(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var Y={name:"EditVpdProfile",mixins:[U["a"]],props:{profile:{type:Object,required:!0}},components:{EditVpdRange:F},data:function(){return{pagination:{itemsPerPage:-1,sortBy:["lifecycleStartDay"]},isAdmin:!1,isLoading:!1,Trimaster:y["a"],addNew:!1,doUpdate:!0,rec:{id:null,label:""},selectedRec:null,valid:!1,rules:{requiredNoblanks:function(e){return!!e&&null!=e.match(/^(?!\s*$).+/g)||"Required."}},isForFacility:!1,plantType:null,vpdRanges:[],headers:[{text:"Actions",sortable:!1,value:"actions",align:"center",width:80},{text:"Lifecycle Start Day",align:"center",sortable:!0,value:"lifecycleStartDay"},{text:"Lifecycle End Day",align:"center",sortable:!0,value:"lifecycleEndDay"},{text:"Min VPD (kPa)",align:"right",sortable:!0,value:"min"},{text:"Max VPD (kPa)",align:"right",sortable:!0,value:"max"}]}},computed:K(K({},Object(b["c"])(["getUser"])),{},{canAddNewRange:function(){return this.rec&&this.rec.id&&(this.isForFacility||this.isAdmin)},canEdit:function(){return this.isForFacility||this.isAdmin}}),beforeMount:function(){this.isAdmin=y["a"].isAdmin(this.getUser)},mounted:function(){this.buildRecord()},methods:{buildRecord:function(){this.rec=K({},this.profile),this.isForFacility=!!this.profile.facility_id,this.profile.isCannabis?this.plantType="isCannabis":this.profile.isHemp?this.plantType="isHemp":this.profile.isLeafyGreens&&(this.plantType="isLeafyGreens"),this.plantType||(this.getUser.facility.growsCannabis?this.plantType="isCannabis":this.getUser.facility.growsHemp?this.plantType="isHemp":this.getUser.facility.growsLeafyGreens&&(this.plantType="isLeafyGreens")),this.getVpdRanges()},upsertVpdProfile:function(){var e=this;this.isLoading=!0;var t=K({},this.rec);t.isCannabis=!1,t.isHemp=!1,t.isLeafyGreens=!1,this.isForFacility?(this.getUser.facility.growsCannabis?t.isCannabis=!0:this.getUser.facility.growsHemp?t.isHemp=!0:this.getUser.facility.growsLeafyGreens&&(t.isLeafyGreens=!0),t.facility_id=this.getUser.facility_id):(t[this.plantType]=!0,t.facility_id=null),y["a"].upsert("ag_vpdProfiles",this.getUser.apitoken,t).then((function(t){1===t.length?(e.rec=t[0],e.getVpdRanges(),m["a"].success("Record updated"),e.$emit("input",e.rec),e.$emit("save",e.rec)):m["a"].error("Error - "+t[1].message)}))},getVpdRanges:function(){var e=this;this.isLoading=!0,y["a"].get("ag_vpdRanges",this.getUser.apitoken,{filter:{order:"lifecycleStartDay",where:{vpdProfile_id:this.rec.id},limit:1e3}}).then((function(t){var r=G(t,2),i=r[0];r[1];e.vpdRanges=i,e.isLoading=!1}))},onChangeRec:function(e){var t=this;e||(e=this.selectedRec),this.doUpdate&&(this.doUpdate=!1,setTimeout((function(){t.doUpdate=!0}),500),this.upsertVpdRange(e))},upsertVpdRange:function(e){var t=this;this.isLoading=!0,y["a"].upsert("ag_vpdRanges",this.getUser.apitoken,e).then((function(e){1===e.length?(t.getVpdRanges(),m["a"].success("Record updated"),t.addNew=!1):m["a"].error("Error - "+e[1].message)}))},onAddNew:function(){this.selectedRec={id:null,vpdProfile_id:this.rec.id,lifecycleStartDay:"",lifecycleEndDay:"",min:"",max:""},this.addNew=!0},deleteRecord:function(e){var t=this;I["a"].confirm("Confirm Delete","Delete range for days "+e.lifecycleStartDay+" - "+e.lifecycleEndDay+"?",(function(r){r&&y["a"].destroy("ag_vpdRanges",e.id,t.getUser.apitoken).then((function(e){1===e.length?(m["a"].success("Record deleted."),t.getVpdRanges()):m["a"].error("Error - "+e[1].message)}))}))},onClose:function(){this.$emit("close")},onSave:function(){this.canEdit&&(this.valid?this.upsertVpdProfile():m["a"].error("Form Entries Incomplete or Invalid"))}},watch:{profile:function(e,t){this.buildRecord()}}},Z=Y,ee=Object(T["a"])(Z,k,O,!1,null,null,null),te=ee.exports,re=r("c1df"),ie=r.n(re);function ne(e){return ne="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},ne(e)}function ae(e,t){return ue(e)||ce(e,t)||se(e,t)||oe()}function oe(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function se(e,t){if(e){if("string"==typeof e)return le(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?le(e,t):void 0}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function ce(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],l=!0,c=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return s}}function ue(e){if(Array.isArray(e))return e}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function pe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach((function(t){fe(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function fe(e,t,r){return(t=he(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function he(e){var t=ye(e,"string");return"symbol"==ne(t)?t:t+""}function ye(e,t){if("object"!=ne(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=ne(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}var me={name:"VpdProfiles",mixins:[U["a"]],props:[],components:{EditVpdProfile:te},data:function(){return{pagination:{itemsPerPage:-1,sortBy:["label"]},isLoading:!1,Trimaster:y["a"],addNew:!1,doUpdate:!0,selectedRec:null,isAdmin:!1,vpdProfiles:[],headers:[{text:"Actions",sortable:!1,value:"actions",align:"center",width:80},{text:"Label",align:"left",sortable:!0,value:"label"},{text:"Facility ID",align:"left",sortable:!0,value:"facility_id"},{text:"Plant Type",align:"left",sortable:!0,value:"plantType"},{text:"Updated By",value:"updateuser",width:150},{text:"Updated On",value:"updatedate",width:170}]}},computed:pe({},Object(b["c"])(["getUser"])),beforeMount:function(){this.isAdmin=y["a"].isAdmin(this.getUser),this.getVpdProfiles()},methods:{getPlantType:function(e){return e.isCannabis?"Cannabis":e.isHemp?"Hemp":e.isLeafyGreens?"LeafyGreens":""},getVpdProfiles:function(){var e=this;return this.isLoading=!0,y["a"].get("ag_vpdProfiles",this.getUser.apitoken,{filter:{where:{and:[{or:[{facility_id:null},{facility_id:this.getUser.facility_id}]},{endtime:null}]},limit:1e3}}).then((function(t){var r=ae(t,2),i=r[0];r[1];e.vpdProfiles=i.map((function(t){return t.plantType=e.getPlantType(t),t})),e.isLoading=!1}))},onChangeRec:function(e){this.getVpdProfiles(),this.selectedRec=e},onAddNew:function(){this.selectedRec={id:null,label:"",facility_id:null,isCannabis:0,isHemp:0,isLeafyGreens:0},this.addNew=!0},deleteRecord:function(e){var t=this;I["a"].confirm("Confirm Delete","Are you sure that you want to delete "+e.label+"?",(function(r){r&&(y["a"].upsertWithWhere("ag_vpdRanges",t.getUser.apitoken,{vpdProfile_id:e.id},{endtime:ie()()}),y["a"].destroy("ag_vpdProfiles",e.id,t.getUser.apitoken).then((function(e){1===e.length?(m["a"].success("Record deleted."),t.getVpdProfiles()):m["a"].error("Error - "+e[1].message)})))}))}}},be=me,ge=Object(T["a"])(be,f,h,!1,null,null,null);t["default"]=ge.exports}}]);
//# sourceMappingURL=chunk-3aa7b152.0a3765bc.js.map