(self.webpackChunkInstiKit=self.webpackChunkInstiKit||[]).push([[9865],{68441:(t,a,s)=>{"use strict";s.r(a),s.d(a,{default:()=>e});const i={components:{},data:function(){return{id:this.$route.params.id,holidayForm:new Form({date:"",description:""}),existing_holidays:[],disabled:{dates:[]}}},mounted:function(){helper.hasPermission("edit-holiday")||(helper.notAccessibleMsg(),this.$router.push("/dashboard")),this.getHoliday()},methods:{getHoliday:function(){var t=this,a=this.$loading.show();axios.get("/api/holiday/"+this.id).then((function(s){t.holidayForm.date=s.holiday.date,t.holidayForm.description=s.holiday.description,t.existing_holidays=s.existing_holidays,t.existing_holidays.forEach((function(a){a!=t.holidayForm.date&&t.disabled.dates.push(new Date(a))})),a.hide()})).catch((function(t){a.hide(),helper.showErrorMsg(t)}))},update:function(){var t=this,a=this.$loading.show();this.holidayForm.patch("/api/holiday/"+this.id).then((function(s){toastr.success(s.message),t.$router.push("/calendar/holiday"),a.hide()})).catch((function(t){a.hide(),helper.showErrorMsg(t)}))}}};const e=(0,s(51900).Z)(i,(function(){var t=this,a=t.$createElement,s=t._self._c||a;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("calendar.edit_holiday")))])]),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(a){return t.$router.push("/calendar/holiday")}}},[s("i",{staticClass:"fas fa-list"}),t._v(" "),s("span",{staticClass:"d-none d-sm-inline"},[t._v(t._s(t.trans("calendar.holiday")))])])])])])]),t._v(" "),s("div",{staticClass:"container-fluid"},[s("div",{staticClass:"card card-form"},[s("div",{staticClass:"card-body p-t-20"},[s("form",{on:{submit:function(a){return a.preventDefault(),t.update.apply(null,arguments)},keydown:function(a){return t.holidayForm.errors.clear(a.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("calendar.holiday_date")))]),t._v(" "),s("datepicker",{attrs:{bootstrapStyling:!0,placeholder:t.trans("calendar.holiday_date"),disabledDates:t.disabled},on:{selected:function(a){return t.holidayForm.errors.clear("date")}},model:{value:t.holidayForm.date,callback:function(a){t.$set(t.holidayForm,"date",a)},expression:"holidayForm.date"}}),t._v(" "),s("show-error",{attrs:{"form-name":t.holidayForm,"prop-name":"date"}})],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("calendar.holiday_description")))]),t._v(" "),s("autosize-textarea",{attrs:{rows:"1",name:"description",placeholder:t.trans("calendar.holiday_description")},model:{value:t.holidayForm.description,callback:function(a){t.$set(t.holidayForm,"description",a)},expression:"holidayForm.description"}}),t._v(" "),s("show-error",{attrs:{"form-name":t.holidayForm,"prop-name":"description"}})],1)])]),t._v(" "),s("div",{staticClass:"card-footer text-right"},[s("router-link",{staticClass:"btn btn-danger waves-effect waves-light ",attrs:{to:"/calendar/holiday"}},[t._v(t._s(t.trans("general.cancel")))]),t._v(" "),s("button",{staticClass:"btn btn-info waves-effect waves-light",attrs:{type:"submit"}},[t._v(t._s(t.trans("general.update")))])],1)])])])])])}),[],!1,null,null,null).exports}}]);
//# sourceMappingURL=edit.js.map?id=9420ebc940acf60f2bfb