(window.webpackJsonp=window.webpackJsonp||[]).push([[5],{"8b92":function(t,e,n){(e=t.exports=n("I1BE")(!1)).i(n("DQ5Z"),""),e.i(n("BetG"),""),e.i(n("cqcM"),""),e.i(n("Jy1V"),""),e.i(n("yZtI"),""),e.push([t.i,"\n",""])},BHuX:function(t,e,n){"use strict";n.r(e);var a=n("3Am6"),s=(n("f7zv"),n("iOEq")),i=n("p8AH"),o=n("+Izv"),r=n("Gbwi"),l=n("lwpT"),c=n("/qL9"),d={components:{VueTimepicker:c.a},data:function(){return{event:{date:this.selected_date,assign_id:null,time_start:{HH:"00",mm:"00"},time_end:{HH:"00",mm:"00"},reason:"",amount:0}}},methods:{changeEvent:function(){this.event.amount=this.event.time_end.HH-this.event.time_start.HH,this.event.amount<0&&this.$notify({group:"notify",title:"<h6>Thông báo</h6>",text:"Giờ bắt đầu và kết thúc không hợp lệ",type:"error"})},handleOk:function(){var t=this,e=this;axios.post("/v1/calendar",{date:e.selected_date,assign_id:e.event.assign_id,time_start:e.event.time_start.HH+":"+e.event.time_start.mm,time_end:e.event.time_end.HH+":"+e.event.time_end.mm,reason:e.event.reason,amount:e.event.amount}).then((function(e){t.$notify({group:"notify",title:"<h6>Thông báo</h6>",text:e.data.message,type:e.data.status})})).then((function(t){e.$store.dispatch("fetch_events")}))}},computed:{selected_date:function(){return this.$store.getters.selected_date},my_assignments:function(){return this.$store.getters.my_assignments},my_class_options:function(){return this.$store.getters.my_class_options}}},m=n("KHd+"),u=Object(m.a)(d,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-modal",{ref:"add-calendar",attrs:{size:"lg",id:"add-calendar",title:"Đăng ký lịch nghỉ","header-bg-variant":"primary","header-text-variant":"light","ok-title":"Lưu thông tin","ok-variant":"outline-primary","cancel-title":"Hủy","cancel-variant":"outline-secondary"},on:{ok:function(e){return t.handleOk()}}},[n("b-form-row",[n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-1",label:"Ngày đăng ký:","label-for":"date",description:"Ngày không thể thay đổi"}},[n("b-form-input",{attrs:{id:"date",type:"text",readonly:""},model:{value:t.selected_date,callback:function(e){t.selected_date=e},expression:"selected_date"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12",lg:"6"}},[n("b-form-group",{attrs:{id:"input-group-2",label:"Từ","label-for":"time_start",description:"Chọn giờ bắt đầu"}},[n("vue-timepicker",{attrs:{format:"HH:mm"},on:{change:t.changeEvent},model:{value:t.event.time_start,callback:function(e){t.$set(t.event,"time_start",e)},expression:"event.time_start"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12",lg:"6"}},[n("b-form-group",{attrs:{id:"input-group-2",label:"Đến","label-for":"time_end",description:"Chọn giờ kết thúc"}},[n("vue-timepicker",{attrs:{format:"HH:mm"},on:{change:t.changeEvent},model:{value:t.event.time_end,callback:function(e){t.$set(t.event,"time_end",e)},expression:"event.time_end"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-4",label:"Số giờ","label-for":"amount",description:"Bắt buộc"}},[n("b-form-input",{model:{value:t.event.amount,callback:function(e){t.$set(t.event,"amount",e)},expression:"event.amount"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-3",label:"Lớp","label-for":"classroom",description:"Chọn lớp dạy"}},[n("b-form-select",{attrs:{options:t.my_class_options},model:{value:t.event.assign_id,callback:function(e){t.$set(t.event,"assign_id",e)},expression:"event.assign_id"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-4",label:"Lý do","label-for":"reason",description:"Bắt buộc"}},[n("b-form-input",{model:{value:t.event.reason,callback:function(e){t.$set(t.event,"reason",e)},expression:"event.reason"}})],1)],1)],1)],1)}),[],!1,null,null,null).exports,p={components:{VueTimepicker:c.a},props:["event"],methods:{changeEvent:function(){this.event.amount=this.event.time_end.HH-this.event.time_start.HH,this.event.amount<0&&this.$notify({group:"notify",title:"<h6>Thông báo</h6>",text:"Giờ bắt đầu và kết thúc không hợp lệ",type:"error"})},handleOk:function(){var t=this,e=this;axios.put("/v1/calendar/"+e.event.id,{assign_id:e.event.assign_id,time_start:e.event.time_start.HH+":"+e.event.time_start.mm,time_end:e.event.time_end.HH+":"+e.event.time_end.mm,reason:e.event.reason,amount:e.event.amount,date:e.event.date}).then((function(e){t.$notify({group:"notify",title:"<h6>Thông báo</h6>",text:e.data.message,type:e.data.status})})).then((function(t){e.$store.dispatch("fetch_events")}))}},computed:{my_assignments:function(){return this.$store.getters.my_assignments},my_class_options:function(){return this.$store.getters.my_class_options}}},v=Object(m.a)(p,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-modal",{ref:"edit-calender",attrs:{id:"edit-calendar",size:"lg",title:"Thay đổi lịch nghỉ","header-bg-variant":"primary","header-text-variant":"light","ok-title":"Lưu thông tin","ok-variant":"outline-primary","cancel-title":"Hủy","cancel-variant":"outline-secondary"},on:{ok:function(e){return t.handleOk()}}},[n("b-form-row",[n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-1",label:"Ngày đăng ký:","label-for":"date",description:"Ngày không thể thay đổi"}},[n("b-form-input",{attrs:{id:"date",type:"text",readonly:""},model:{value:t.event.date,callback:function(e){t.$set(t.event,"date",e)},expression:"event.date"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12",lg:"6"}},[n("b-form-group",{attrs:{id:"input-group-2",label:"Từ","label-for":"time_start",description:"Chọn giờ bắt đầu"}},[n("vue-timepicker",{attrs:{format:"HH:mm"},on:{change:t.changeEvent},model:{value:t.event.time_start,callback:function(e){t.$set(t.event,"time_start",e)},expression:"event.time_start"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12",lg:"6"}},[n("b-form-group",{attrs:{id:"input-group-2",label:"Đến","label-for":"time_end",description:"Chọn giờ kết thúc"}},[n("vue-timepicker",{attrs:{format:"HH:mm"},on:{change:t.changeEvent},model:{value:t.event.time_end,callback:function(e){t.$set(t.event,"time_end",e)},expression:"event.time_end"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-4",label:"Số giờ","label-for":"amount",description:"Bắt buộc"}},[n("b-form-input",{model:{value:t.event.amount,callback:function(e){t.$set(t.event,"amount",e)},expression:"event.amount"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-3",label:"Lớp","label-for":"classroom",description:"Chọn lớp dạy"}},[n("b-form-select",{attrs:{options:t.my_class_options},model:{value:t.event.assign_id,callback:function(e){t.$set(t.event,"assign_id",e)},expression:"event.assign_id"}})],1)],1),t._v(" "),n("b-col",{attrs:{cols:"12"}},[n("b-form-group",{attrs:{id:"input-group-4",label:"Lý do","label-for":"reason",description:"Bắt buộc"}},[n("b-form-input",{model:{value:t.event.reason,callback:function(e){t.$set(t.event,"reason",e)},expression:"event.reason"}})],1)],1)],1)],1)}),[],!1,null,null,null).exports,h={components:{FullCalendar:a.a,AddModalComponent:u,EditModalComponent:v},data:function(){return{calendarPlugins:[s.d,i.a,o.a,r.a,l.a],calendarHeader:{left:"prev,next today",center:"title",right:"dayGridMonth,timeGridWeek,timeGridDay,listWeek"},selected_event:{}}},methods:{eventClickHandle:function(t){var e=t.event,n=e.extendedProps.properties,a=new Date(e.start),s=new Date(e.end);a=a.toLocaleTimeString("en-GB").slice(0,5),s=s.toLocaleTimeString("en-GB").slice(0,5),this.$store.dispatch("fetchMyAssignments",e.start.toISOString().slice(0,7));var i={date:e.start.toISOString().slice(0,10),assignment:n.assignment,time_start:{HH:a.slice(0,2),mm:a.slice(3,5)},time_end:{HH:s.slice(0,2),mm:s.slice(3,5)},reason:n.reason,amount:n.amount,id:n.id,assign_id:n.assignment.id};this.selected_event=i,this.$bvModal.show("edit-calendar")},dateClickHandle:function(t){this.$store.dispatch("set_selected_date",t.dateStr),this.$store.dispatch("fetchMyAssignments",t.dateStr.slice(0,7)),this.$bvModal.show("add-calendar")}},computed:{user:function(){return this.$store.getters.user},selected_date:function(){return this.$store.getters.selected_date},my_events:function(){return this.$store.getters.my_events}}},g=(n("u9V9"),Object(m.a)(h,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-container",{attrs:{fluid:""}},[n("h1",{staticClass:"h3 mb-4 text-gray-800"},[t._v("Sắp xếp lịch nghỉ bù của "+t._s(t.user.name))]),t._v(" "),n("b-card",{attrs:{"header-bg-variant":"primary","header-tag":"header","header-class":"py-3 d-flex flex-row align-items-center justify-content-between"}},[n("h6",{staticClass:"m0 font-weight-bold text-light",attrs:{slot:"header"},slot:"header"},[t._v("Lịch nghỉ bù")]),t._v(" "),n("FullCalendar",{attrs:{plugins:t.calendarPlugins,header:t.calendarHeader,events:t.my_events,navLink:!0,eventLimit:!0,locale:"vi",themeSystem:"bootstrap"},on:{dateClick:t.dateClickHandle}})],1),t._v(" "),n("add-modal-component"),t._v(" "),n("edit-modal-component",{attrs:{event:t.selected_event}})],1)}),[],!1,null,null,null));e.default=g.exports},J45N:function(t,e,n){var a=n("8b92");"string"==typeof a&&(a=[[t.i,a,""]]);var s={hmr:!0,transform:void 0,insertInto:void 0};n("aET+")(a,s);a.locals&&(t.exports=a.locals)},u9V9:function(t,e,n){"use strict";var a=n("J45N");n.n(a).a}}]);