(self.webpackChunkInstiKit=self.webpackChunkInstiKit||[]).push([[9082],{93680:(t,o,r)=>{"use strict";r.r(o),r.d(o,{default:()=>a});const s={components:{bookAuthorForm:r(58199).Z},data:function(){return{id:this.$route.params.id}},mounted:function(){helper.hasPermission("access-configuration")||(helper.notAccessibleMsg(),this.$router.push("/dashboard"))}};const a=(0,r(51900).Z)(s,(function(){var t=this,o=t.$createElement,r=t._self._c||o;return r("div",[r("div",{staticClass:"page-titles"},[r("div",{staticClass:"row"},[r("div",{staticClass:"col-12 col-sm-6"},[r("h3",{staticClass:"text-themecolor"},[t._v(t._s(t.trans("library.edit_book_author")))])]),t._v(" "),r("div",{staticClass:"col-12 col-sm-6"},[r("div",{staticClass:"action-buttons pull-right"},[r("button",{staticClass:"btn btn-info btn-sm",on:{click:function(o){return t.$router.push("/configuration/library/book/author")}}},[r("i",{staticClass:"fas fa-list"}),t._v(" "),r("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("library.book_author")))])])])])])]),t._v(" "),r("div",{staticClass:"container-fluid"},[r("div",{staticClass:"card card-form"},[r("div",{staticClass:"card-body p-t-20"},[r("book-author-form",{attrs:{id:t.id}})],1)])])])}),[],!1,null,null,null).exports},58199:(t,o,r)=>{"use strict";r.d(o,{Z:()=>a});const s={data:function(){return{bookAuthorForm: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.bookAuthorForm.post("/api/library/book/author").then((function(r){toastr.success(r.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/library/book/author/"+this.id).then((function(r){t.bookAuthorForm.name=r.name,t.bookAuthorForm.description=r.description,o.hide()})).catch((function(r){o.hide(),helper.showErrorMsg(r),t.$router.push("/configuration/library/book/author")}))},update:function(){var t=this,o=this.$loading.show();this.bookAuthorForm.patch("/api/library/book/author/"+this.id).then((function(r){toastr.success(r.message),o.hide(),t.$router.push("/configuration/library/book/author")})).catch((function(t){o.hide(),helper.showErrorMsg(t)}))}}};const a=(0,r(51900).Z)(s,(function(){var t=this,o=t.$createElement,r=t._self._c||o;return r("form",{on:{submit:function(o){return o.preventDefault(),t.proceed.apply(null,arguments)},keydown:function(o){return t.bookAuthorForm.errors.clear(o.target.name)}}},[r("div",{staticClass:"row"},[r("div",{staticClass:"col-12 col-sm-6"},[r("div",{staticClass:"form-group"},[r("label",{attrs:{for:""}},[t._v(t._s(t.trans("library.book_author_name")))]),t._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:t.bookAuthorForm.name,expression:"bookAuthorForm.name"}],staticClass:"form-control",attrs:{type:"text",name:"name",placeholder:t.trans("library.book_author_name")},domProps:{value:t.bookAuthorForm.name},on:{input:function(o){o.target.composing||t.$set(t.bookAuthorForm,"name",o.target.value)}}}),t._v(" "),r("show-error",{attrs:{"form-name":t.bookAuthorForm,"prop-name":"name"}})],1)]),t._v(" "),r("div",{staticClass:"col-12 col-sm-6"},[r("div",{staticClass:"form-group"},[r("label",{attrs:{for:""}},[t._v(t._s(t.trans("library.book_author_description")))]),t._v(" "),r("input",{directives:[{name:"model",rawName:"v-model",value:t.bookAuthorForm.description,expression:"bookAuthorForm.description"}],staticClass:"form-control",attrs:{type:"text",name:"description",placeholder:t.trans("library.book_author_description")},domProps:{value:t.bookAuthorForm.description},on:{input:function(o){o.target.composing||t.$set(t.bookAuthorForm,"description",o.target.value)}}}),t._v(" "),r("show-error",{attrs:{"form-name":t.bookAuthorForm,"prop-name":"description"}})],1)])]),t._v(" "),r("div",{staticClass:"card-footer text-right"},[r("router-link",{directives:[{name:"show",rawName:"v-show",value:t.id,expression:"id"}],staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/configuration/library/book/author"}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),t.id?t._e():r("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(" "),r("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[t.id?r("span",[t._v(t._s(t.trans("general.update")))]):r("span",[t._v(t._s(t.trans("general.save")))])])],1)])}),[],!1,null,null,null).exports}}]);
//# sourceMappingURL=edit.js.map?id=7f15593c7fefc5870694