(self.webpackChunkInstiKit=self.webpackChunkInstiKit||[]).push([[2779],{50797:(t,o,s)=>{"use strict";s.r(o),s.d(o,{default:()=>i});const e={components:{bloodGroupForm:s(78193).Z},data:function(){return{id:this.$route.params.id}},mounted:function(){helper.hasPermission("access-configuration")||(helper.notAccessibleMsg(),this.$router.push("/dashboard"))}};const i=(0,s(51900).Z)(e,(function(){var t=this,o=t.$createElement,s=t._self._c||o;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("misc.edit_blood_group")))])]),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(o){return t.$router.push("/configuration/misc/blood/group")}}},[s("i",{staticClass:"fas fa-list"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("misc.blood_group")))])])])])])]),t._v(" "),s("div",{staticClass:"container-fluid"},[s("div",{staticClass:"card card-form"},[s("div",{staticClass:"card-body p-t-20"},[s("blood-group-form",{attrs:{id:t.id}})],1)])])])}),[],!1,null,null,null).exports},78193:(t,o,s)=>{"use strict";s.d(o,{Z:()=>i});const e={data:function(){return{bloodGroup: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,o=this.$loading.show();this.bloodGroup.post("/api/misc/blood/group").then((function(s){toastr.success(s.message),t.$emit("completed"),o.hide()})).catch((function(t){o.hide(),helper.showErrorMsg(t)}))},get:function(){var t=this,o=this.$loading.show();axios.get("/api/misc/blood/group/"+this.id).then((function(s){t.bloodGroup.name=s.name,t.bloodGroup.description=s.description,o.hide()})).catch((function(s){o.hide(),helper.showErrorMsg(s),t.$router.push("/configuration/misc/blood/group")}))},update:function(){var t=this,o=this.$loading.show();this.bloodGroup.patch("/api/misc/blood/group/"+this.id).then((function(s){toastr.success(s.message),o.hide(),t.$router.push("/configuration/misc/blood/group")})).catch((function(t){o.hide(),helper.showErrorMsg(t)}))}}};const i=(0,s(51900).Z)(e,(function(){var t=this,o=t.$createElement,s=t._self._c||o;return s("form",{on:{submit:function(o){return o.preventDefault(),t.proceed.apply(null,arguments)},keydown:function(o){return t.bloodGroup.errors.clear(o.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("misc.blood_group_name")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.bloodGroup.name,expression:"bloodGroup.name"}],staticClass:"form-control",attrs:{type:"text",name:"name",placeholder:t.trans("misc.blood_group_name")},domProps:{value:t.bloodGroup.name},on:{input:function(o){o.target.composing||t.$set(t.bloodGroup,"name",o.target.value)}}}),t._v(" "),s("show-error",{attrs:{"form-name":t.bloodGroup,"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("misc.blood_group_description")))]),t._v(" "),s("input",{directives:[{name:"model",rawName:"v-model",value:t.bloodGroup.description,expression:"bloodGroup.description"}],staticClass:"form-control",attrs:{type:"text",name:"description",placeholder:t.trans("misc.blood_group_description")},domProps:{value:t.bloodGroup.description},on:{input:function(o){o.target.composing||t.$set(t.bloodGroup,"description",o.target.value)}}}),t._v(" "),s("show-error",{attrs:{"form-name":t.bloodGroup,"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/misc/blood/group"}},[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(o){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=fe1f548fd1840d8eda49