(self.webpackChunkInstiKit=self.webpackChunkInstiKit||[]).push([[41],{30686:(t,i,s)=>{"use strict";s.r(i),s.d(i,{default:()=>n});const e={components:{visitingPurposeForm:s(75578).Z},data:function(){return{id:this.$route.params.id}},mounted:function(){helper.hasPermission("access-configuration")||(helper.notAccessibleMsg(),this.$router.push("/dashboard"))}};const n=(0,s(51900).Z)(e,(function(){var t=this,i=t.$createElement,s=t._self._c||i;return s("div",[s("div",{staticClass:"page-titles"},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12 col-sm-6"},[s("h3",{staticClass:"text-themecolor"},[t._v(t._s(t.trans("reception.edit_visiting_purpose")))])]),t._v(" "),s("div",{staticClass:"col-12 col-sm-6"},[s("div",{staticClass:"action-buttons pull-right"},[s("button",{staticClass:"btn btn-info btn-sm",on:{click:function(i){return t.$router.push("/configuration/reception/visiting/purpose")}}},[s("i",{staticClass:"fas fa-list"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("reception.visiting_purpose")))])])])])])]),t._v(" "),s("div",{staticClass:"container-fluid"},[s("div",{staticClass:"card card-form"},[s("div",{staticClass:"card-body p-t-20"},[s("visiting-purpose-form",{attrs:{id:t.id}})],1)])])])}),[],!1,null,null,null).exports},75578:(t,i,s)=>{"use strict";s.d(i,{Z:()=>n});const e={data:function(){return{visitingPurposeForm:new Form({name:"",description:""})}},props:["id"],mounted:function(){this.id&&this.get()},methods:{proceed:function(){this.id?this.update():this.store()},store:function(){var t=this,i=this.$loading.show();this.visitingPurposeForm.post("/api/reception/visiting/purpose").then((function(s){toastr.success(s.message),t.$emit("completed"),i.hide()})).catch((function(t){i.hide(),helper.showErrorMsg(t)}))},get:function(){var t=this,i=this.$loading.show();axios.get("/api/reception/visiting/purpose/"+this.id).then((function(s){t.visitingPurposeForm.name=s.name,t.visitingPurposeForm.description=s.description,i.hide()})).catch((function(s){i.hide(),helper.showErrorMsg(s),t.$router.push("/configuration/reception/visiting/purpose")}))},update:function(){var t=this,i=this.$loading.show();this.visitingPurposeForm.patch("/api/reception/visiting/purpose/"+this.id).then((function(s){toastr.success(s.message),i.hide(),t.$router.push("/configuration/reception/visiting/purpose")})).catch((function(t){i.hide(),helper.showErrorMsg(t)}))}}};const n=(0,s(51900).Z)(e,(function(){var t=this,i=t.$createElement,s=t._self._c||i;return s("form",{on:{submit:function(i){return i.preventDefault(),t.proceed.apply(null,arguments)},keydown:function(i){return t.visitingPurposeForm.errors.clear(i.target.name)}}},[s("div",{staticClass:"row"},[s("div",{staticClass:"col-12 col-sm-6"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("reception.visiting_purpose_name")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.visitingPurposeForm.name,expression:"visitingPurposeForm.name"}],staticClass:"form-control",attrs:{type:"text",name:"name",placeholder:t.trans("reception.visiting_purpose_name")},domProps:{value:t.visitingPurposeForm.name},on:{input:function(i){i.target.composing||t.$set(t.visitingPurposeForm,"name",i.target.value)}}}),t._v(" "),s("show-error",{attrs:{"form-name":t.visitingPurposeForm,"prop-name":"name"}})],1)]),t._v(" "),s("div",{staticClass:"col-12 col-sm-6"},[s("div",{staticClass:"form-group"},[s("label",{attrs:{for:""}},[t._v(t._s(t.trans("reception.visiting_purpose_description")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.visitingPurposeForm.description,expression:"visitingPurposeForm.description"}],staticClass:"form-control",attrs:{type:"text",name:"description",placeholder:t.trans("reception.visiting_purpose_description")},domProps:{value:t.visitingPurposeForm.description},on:{input:function(i){i.target.composing||t.$set(t.visitingPurposeForm,"description",i.target.value)}}}),t._v(" "),s("show-error",{attrs:{"form-name":t.visitingPurposeForm,"prop-name":"description"}})],1)])]),t._v(" "),s("div",{staticClass:"card-footer text-right"},[s("router-link",{directives:[{name:"show",rawName:"v-show",value:t.id,expression:"id"}],staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/configuration/reception/visiting/purpose"}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),t.id?t._e():s("button",{staticClass:"btn btn-danger waves-effect waves-light ",attrs:{type:"button"},on:{click:function(i){return t.$emit("cancel")}}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),s("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[t.id?s("span",[t._v(t._s(t.trans("general.update")))]):s("span",[t._v(t._s(t.trans("general.save")))])])],1)])}),[],!1,null,null,null).exports}}]);
//# sourceMappingURL=edit.js.map?id=d28a44c75edc8f1908b6