mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 14:29:34 +00:00
2 lines
293 KiB
JavaScript
2 lines
293 KiB
JavaScript
(function(){var e={1030:function(e,t,s){"use strict";e.exports=s.p+"img/home.a9495a95.svg"},1914:function(e,t,s){"use strict";e.exports=s.p+"img/checkmark.76754510.svg"},8322:function(e,t,s){"use strict";e.exports=s.p+"img/icon-prev.22ba0fa6.svg"},8782:function(e,t,s){"use strict";s(83725),s(51339);var i=s(13086);t.A={parseErrors(e){return Object.values(e).map(e=>(0,i.$t)(e?.$message)).join(". ")}}},10347:function(e){"use strict";e.exports=JSON.parse('{"Value is not a valid email address":"Zadali ste neplatný email","error":"chyba","Value is required":"Pole je povinné","This field should be at least 8 characters long":"Pole musí obsahovať aspoň 8 znakov","This field should be at least 6 characters long":"Pole musí obsahovať aspoň 6 znakov","This maximum length allowed is 6":"Pole musí obsahovať 6 znakov","The value must be equal to the other value":"Heslá sa nezhodujú"}')},13086:function(e,t,s){"use strict";s.d(t,{$t:function(){return nu}});var i=s(45130),a=s(71253);async function l(){const e=await s.e(8874).then(s.t.bind(s,48874,23));e.load({google:{families:["Roboto:100,300,400,500,700,900&display=swap"]}})}var n=s(17420),o=(s(35524),(0,n.$N)()),r=(s(28743),s(83725),s(59229),s(71955));function d(){const e=r._D.import("formats/link");e.PROTOCOL_WHITELIST.push("smb","fmp","radar","rdar","sms","\\");class t extends e{static sanitize(t){const s=super.sanitize(t);if(!s||"about:blank"===s)return s;const i=e.PROTOCOL_WHITELIST,a=i.some(e=>s.startsWith(e));return a?s:`https://${s}`}}r._D.register("formats/link",t,!0)}var u=s(95452),c=s.n(u),m=s(56768),h=s(96450),p=s(41051);function k(e,t,s,i,a,l){const n=(0,m.g2)("router-view"),o=(0,m.g2)("Z-team-modal"),r=(0,m.g2)("Z-delete-team-modal"),d=(0,m.g2)("Z-task-modal"),u=(0,m.g2)("Z-delete-task-modal"),c=(0,m.g2)("Z-delete-timeBlock-modal"),k=(0,m.g2)("Z-delete-blocker-modal"),v=(0,m.g2)("Z-delete-master-task-modal"),b=(0,m.g2)("Z-complete-task-modal"),f=(0,m.g2)("Z-complete-master-task-modal"),_=(0,m.g2)("Z-task-add-time-modal"),g=(0,m.g2)("Z-blocker-modal"),y=(0,m.g2)("Z-master-task-modal"),w=(0,m.g2)("Z-delete-team-member-modal"),D=(0,m.g2)("Z-show-menu-modal"),T=(0,m.g2)("Z-unable-to-edit-office-task-modal"),E=(0,m.g2)("Z-unable-to-complete-task-modal");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(h.E,null,{default:(0,m.k6)(()=>[(0,m.bF)(p.Y,null,{default:(0,m.k6)(()=>[(0,m.bF)(n)]),_:1})]),_:1}),(0,m.bF)(o,{ref:"z-team-modal",onUpdate:l.onTeamUpdate},null,8,["onUpdate"]),(0,m.bF)(r,{ref:"z-delete-team-modal",onUpdate:l.onTeamUpdate},null,8,["onUpdate"]),(0,m.bF)(d,{ref:"z-task-modal",onOnSubtaskEdited:l.onTaskEdited},null,8,["onOnSubtaskEdited"]),(0,m.bF)(u,{ref:"z-delete-task-modal",onOnSubtaskDeleted:l.onTaskDeleted},null,8,["onOnSubtaskDeleted"]),(0,m.bF)(c,{ref:"z-delete-timeblock-modal",onOnSubtaskEdited:l.onTaskEdited},null,8,["onOnSubtaskEdited"]),(0,m.bF)(k,{ref:"z-delete-blocker-modal",onOnBlockerDeleted:l.onBlockerDeleted},null,8,["onOnBlockerDeleted"]),(0,m.bF)(v,{ref:"z-delete-master-task-modal",onOnMastertaskDeleted:l.onMasterTaskDeleted},null,8,["onOnMastertaskDeleted"]),(0,m.bF)(b,{ref:"z-complete-task-modal",onOnSubtaskEdited:l.onTaskEdited},null,8,["onOnSubtaskEdited"]),(0,m.bF)(f,{ref:"z-complete-master-task-modal",onMasterTaskEdited:l.onMasterTaskEdited},null,8,["onMasterTaskEdited"]),(0,m.bF)(_,{ref:"z-task-add-time-modal"},null,512),(0,m.bF)(g,{ref:"z-blocker-modal"},null,512),(0,m.bF)(y,{ref:"z-master-task-modal",onMasterTaskEdited:l.onMasterTaskEdited},null,8,["onMasterTaskEdited"]),(0,m.bF)(w,{ref:"z-delete-team-member-modal"},null,512),(0,m.bF)(D,{ref:"z-show-menu-modal"},null,512),(0,m.bF)(T,{ref:"z-unable-to-edit-office-task-modal"},null,512),(0,m.bF)(E,{ref:"z-unable-to-complete-task-modal"},null,512)],64)}var v=s(24232),b=s(42807),f=s(27960),_=s(93745),g=s(91772);const y={class:"d-flex justify-space-between align-center"},w={class:"d-flex align-start"};function D(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",y,[(0,m.Lk)("h1",null,[t[4]||(t[4]=(0,m.eW)(" Ste si istý, že chcete zmazať tím ",-1)),(0,m.Lk)("b",null,(0,v.v_)(l.team.name),1),t[5]||(t[5]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",w,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",disabled:l.isDeleting,onClick:t[1]||(t[1]=e=>n.deleteTeam())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ÁNO",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[7]||(t[7]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}s(30959);var T=s(94348);const E=768,M={small:{width:600,height:"auto",maxWidth:600},medium:{width:900,height:"auto",maxWidth:900},large:{width:"75%",height:"90%",maxWidth:"85%"}};var C={isMobile(){return window.innerWidth<=E},getDefaultSize(e="medium"){if(this.isMobile())return{width:"100%",height:"100%"};const t=M[e];return{width:t.width,height:t.height}},getStoredSize(e){try{const t=`modal-size-${e}`,s=localStorage.getItem(t);if(!s)return null;const i=JSON.parse(s);return i&&"number"===typeof i.width&&"number"===typeof i.height?{width:i.width,height:i.height}:null}catch(t){return T.error("Error reading stored modal size:",t),null}},saveSize(e,t,s){try{const i=`modal-size-${e}`,a={width:t,height:s,timestamp:Date.now()};localStorage.setItem(i,JSON.stringify(a))}catch(i){T.error("Error saving modal size:",i)}},resetSize(e){try{const t=`modal-size-${e}`;localStorage.removeItem(t)}catch(t){T.error("Error resetting modal size:",t)}},getModalSize(e,t="medium"){if(this.isMobile())return{width:"100%",height:"100%"};const s=this.getStoredSize(e);return s||this.getDefaultSize(t)},normalizeSize(e){if("number"===typeof e)return e;if(e.includes("%")){const t=parseFloat(e);return window.innerWidth*t/100}return parseFloat(e)},constrainSize(e,t){const s=400,i=300,a=window.innerWidth,l=window.innerHeight;return{width:Math.max(s,Math.min(e,a)),height:Math.max(i,Math.min(t,l))}}},$=s(94348),x={data(){return{modalWidth:void 0,modalHeight:void 0,modalName:"",modalSize:"medium"}},computed:{modalWidthPx(){return this.modalWidth},modalHeightPx(){return this.modalHeight}},mounted(){window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("resize",this.handleWindowResize),this.initModalSize()},beforeUnmount(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("resize",this.handleWindowResize)},methods:{handleKeyDown(e){27===e.keyCode&&(this.visible=!1)},initModalSize(){if(!this.modalName)return void $.warn("Modal name not set for resize functionality");const e=C.getModalSize(this.modalName,this.modalSize);this.modalWidth="number"===typeof e.width?`${e.width}px`:e.width,this.modalHeight="number"===typeof e.height?`${e.height}px`:e.height},handleWindowResize(){C.isMobile()?(this.modalWidth="100%",this.modalHeight="100%"):this.initModalSize()},handleModalResize({width:e,height:t}){if(C.isMobile())return;const s=C.constrainSize(e,t);this.modalWidth=`${s.width}px`,this.modalHeight=`${s.height}px`},handleResizeEnd(){if(!this.modalName||C.isMobile())return;const e=parseFloat(this.modalWidth),t=parseFloat(this.modalHeight);isNaN(e)||isNaN(t)||C.saveSize(this.modalName,e,t)},resetModalSize(){this.modalName&&(C.resetSize(this.modalName),this.initModalSize())}}},S=s(79669);function F(e,t,s,i,a,l){return(0,m.uX)(),(0,m.CE)("div",{class:"modal-resize-handle",onMousedown:t[0]||(t[0]=(...e)=>l.startResize&&l.startResize(...e)),onTouchstart:t[1]||(t[1]=(...e)=>l.startResize&&l.startResize(...e))},[(0,m.bF)(S.w,{icon:"mdi-resize-bottom-right",size:"small"})],32)}var z={name:"AResizeHandle",props:{currentWidth:{type:[String,Number],default:"100%"},currentHeight:{type:[String,Number],default:"100%"}},emits:["resize","resize-end"],data(){return{isResizing:!1,startX:0,startY:0,startWidth:0,startHeight:0}},beforeUnmount(){this.isResizing&&this.stopResize()},methods:{startResize(e){e.preventDefault(),this.isResizing=!0,"touchstart"===e.type?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.parseToPixels(this.currentWidth,"width"),this.startHeight=this.parseToPixels(this.currentHeight,"height"),document.addEventListener("mousemove",this.handleResize),document.addEventListener("mouseup",this.stopResize),document.addEventListener("touchmove",this.handleResize),document.addEventListener("touchend",this.stopResize),document.body.style.cursor="nwse-resize"},handleResize(e){if(!this.isResizing)return;let t,s;"touchmove"===e.type?(t=e.touches[0].clientX,s=e.touches[0].clientY):(t=e.clientX,s=e.clientY);const i=t-this.startX,a=s-this.startY,l=this.startWidth+i,n=this.startHeight+a;this.$emit("resize",{width:l,height:n})},stopResize(){this.isResizing&&(this.isResizing=!1,document.removeEventListener("mousemove",this.handleResize),document.removeEventListener("mouseup",this.stopResize),document.removeEventListener("touchmove",this.handleResize),document.removeEventListener("touchend",this.stopResize),document.body.style.cursor="",this.$emit("resize-end"))},parseToPixels(e,t){if("number"===typeof e)return e;const s=parseFloat(e);if("string"===typeof e&&e.includes("%")){const e=s;return"height"===t?window.innerHeight*e/100:window.innerWidth*e/100}return s||600}}},A=s(71241);const L=(0,A.A)(z,[["render",F],["__scopeId","data-v-b6dde214"]]);var R=L,j=s(51161);function W(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(b.D,{icon:"",size:"small",variant:"text",class:"reset-size-button",onClick:l.handleReset},{default:(0,m.k6)(()=>[(0,m.bF)(S.w,{icon:"mdi-arrow-expand-all",size:"small"}),(0,m.bF)(j.y,{activator:"parent",location:"bottom"},{default:(0,m.k6)(()=>[...t[0]||(t[0]=[(0,m.eW)(" Reset modal size ",-1)])]),_:1})]),_:1},8,["onClick"])}var V={name:"AResetSizeButton",emits:["reset"],methods:{handleReset(){this.$emit("reset")}}};const O=(0,A.A)(V,[["render",W],["__scopeId","data-v-d9409162"]]);var I=O;function H(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(b.D,{icon:"",size:"small",variant:"text",class:"close-button",onClick:l.handleClose},{default:(0,m.k6)(()=>[(0,m.bF)(S.w,{icon:"mdi-close",size:"large"}),(0,m.bF)(j.y,{activator:"parent",location:"bottom"},{default:(0,m.k6)(()=>[...t[0]||(t[0]=[(0,m.eW)(" Close ",-1)])]),_:1})]),_:1},8,["onClick"])}var Y={name:"ACloseButton",emits:["close"],methods:{handleClose(){this.$emit("close")}}};const B=(0,A.A)(Y,[["render",H],["__scopeId","data-v-96ab7ce2"]]);var X=B,N={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["update"],data(){return{visible:!1,team:null,isDeleting:!1,modalName:"z-delete-team-modal",modalSize:"small"}},methods:{async showModal({team:e}){this.team=e,this.visible=!0},closeModal(){this.visible=!1},async deleteTeam(){if(!this.isDeleting){this.isDeleting=!0;try{await this.$axios.delete_auth(`v1/teams/${this.team.id}`),this.visible=!1,this.$emit("update",this.team),this.$store.commit("tm/delete_team",this.team)}catch(e){this.$toast.error(this.$parseError(e))}finally{this.isDeleting=!1}}}}};const P=(0,A.A)(N,[["render",D]]);var U=P,q=s(67290),K=s(15728);const Z={class:"d-flex justify-space-between align-center modal-header"},Q={class:"d-flex align-center"};function J(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle"),u=(0,m.g2)("W-loadable");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[4]||(t[4]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(u,{content:l.team,class:"h-100"},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{class:"d-flex flex-column",style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Z,[(0,m.Lk)("h1",null,(0,v.v_)(l.team.id?"Upraviť tím":"Vytvoriť tím"),1),(0,m.Lk)("div",Q,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{ref:"modalContent",class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.bF)(K.Wx,{modelValue:l.team.name,"onUpdate:modelValue":t[1]||(t[1]=e=>l.team.name=e),class:(0,v.C4)(["modal-input",{error:l.v$.team.name.$errors.length}]),label:"Názov tímu",variant:"solo",hint:l.v$.team.name.$errors?l.errorUtils.parseErrors(l.v$.team.name.$errors):null},null,8,["modelValue","class","hint"]),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.team.employees,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"relative w-100"},[(0,m.bF)(K.Wx,{modelValue:l.team.employees[t]._fullName,"onUpdate:modelValue":e=>l.team.employees[t]._fullName=e,class:"modal-input",disabled:"",label:"Zamestanec",variant:"solo"},null,8,["modelValue","onUpdate:modelValue"]),(0,m.bF)(S.w,{class:"remove-input",icon:"mdi-close",size:"small",onClick:(0,i.D$)(e=>l.team.employees.splice(t,1),["stop"])},null,8,["onClick"])]))),128)),(0,m.bF)(q.V,{ref:"autocomplete",modelValue:l.employeeSelect,"onUpdate:modelValue":t[2]||(t[2]=e=>l.employeeSelect=e),"custom-filter":e.customFilter,"match-any":!0,label:"Priradený",class:(0,v.C4)([{error:l.v$.team.employees.$errors.length},"modal-input"]),items:n.employeesOptions,"item-title":"_fullName","item-value":"id",variant:"solo",clearable:""},null,8,["modelValue","custom-filter","class","items"])]),_:1},512),(0,m.bF)(b.D,{class:"button primary block",onClick:t[3]||(t[3]=e=>n.save())},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(l.team.id?"UPRAVIŤ":"VYTVORIŤ"),1)]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["content"])]),_:1},8,["modelValue","width","height"])}s(35019),s(52598),s(51339);var G=s(63883),ee=s(77175),te=s(8782),se=s(55884),ie=s(60782),ae=s(54860);const le=e=>e.length;var ne={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[ae.A,x],emits:["close","update"],data(){return{visible:!1,v$:(0,G.Ay)(),errorUtils:te.A,employeeSelect:null,team:null,modalName:"z-team-modal",modalSize:"medium"}},computed:{...(0,ie.L8)("tm",["enrichedEmployees"]),employeesOptions(){const e=this.team.employees.map(e=>e.id);return this.enrichedEmployees.filter(t=>!e.includes(t.id))}},validations(){return{team:{name:{required:ee.mw},employees:{atLeastOne:le}}}},watch:{employeeSelect(e){if(!e)return;const t=this.enrichedEmployees.find(t=>t.id==e);this.team.employees.push(t),this.employeeSelect=null,this.$refs.autocomplete.search="",this.$nextTick(()=>{this.$refs.modalContent&&this.$refs.modalContent.$el.scrollTo({top:this.$refs.modalContent.$el.scrollHeight,behavior:"smooth"})})}},methods:{async showModal({team:e=null}){this.visible=!0,this.team=null,this.$nextTick(()=>this.v$.$reset());try{if(e?.id){const t=await this.$axios.get_auth_data(`v1/teams/${e.id}`);this.team=this._enrichTeam(t)}else this.team={employees:[]}}catch(t){this.$toast.error(this.$parseError(t))}},closeModal(){this.visible=!1,this.$emit("close",this.team)},async save(){if(await this.v$.$validate())try{if(this.team.id){const{team:e}=await this.$axios.put_auth(`v1/teams/${this.team.id}`,this.team),t=await this.$axios.get_auth_data(`v1/teams/${e.id}`);this.$store.commit("tm/update_team",t)}else{const{team:e}=await this.$axios.post_auth("v1/teams",this.team),t=await this.$axios.get_auth_data(`v1/teams/${e.id}`);this.$store.commit("tm/save_team",t)}this.closeModal()}catch(e){this.$toast.error(this.$parseError(e))}},_enrichTeam(e){return e.employees=se.A.enrichEmployees(e.employees),e}}};const oe=(0,A.A)(ne,[["render",J]]);var re=oe;const de={class:"d-flex justify-space-between align-center"},ue={class:"d-flex align-start"};function ce(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",de,[(0,m.Lk)("h1",null,[t[4]||(t[4]=(0,m.eW)(" Ste si istý, že chcete zmazať sub task z mastertasku ",-1)),(0,m.Lk)("b",null,(0,v.v_)(l.subtask.project_code),1),t[5]||(t[5]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",ue,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{class:"mb-15",onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",disabled:l.isDeleting,onClick:t[1]||(t[1]=e=>n.deleteTask())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ÁNO",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[7]||(t[7]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var me={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["on-subtask-deleted"],data(){return{visible:!1,subtask:null,isDeleting:!1,modalName:"z-delete-task-modal",modalSize:"small"}},methods:{async showModal({subtask:e}){this.subtask=e,this.visible=!0},closeModal(){this.visible=!1},async deleteTask(){if(!this.isDeleting){this.isDeleting=!0;try{await this.$axios.delete_auth(`v1/subtasks/${this.subtask.id}`),this.$store.commit("tm/delete_subtask",this.subtask),this.closeModal(),this.$emit("on-subtask-deleted",this.subtask)}catch(e){this.$toast.error(this.$parseError(e))}finally{this.isDeleting=!1}}}}};const he=(0,A.A)(me,[["render",ce]]);var pe=he;const ke={class:"d-flex justify-space-between align-center"},ve={class:"d-flex align-start"};function be(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[1]||(t[1]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ke,[t[2]||(t[2]=(0,m.Lk)("h4",{class:"mt-3"},"Vyberte časový úsek, ktorý chcete odstrániť",-1)),(0,m.Lk)("div",ve,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.subtask.timeblocks,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"d-flex align-center justify-center mb-3 mt-3"},[(0,m.Lk)("p",{class:(0,v.C4)(["task-badge rounded-pill",{"strike-through":e.is_finished}])},(0,v.v_)(l.tmUtils.formatDateTime(e.start))+" - "+(0,v.v_)(l.tmUtils.formatDateTime(e.end)),3),(0,m.bF)(S.w,{class:"close-icon circle-border cursor-pointer ml-3 text-red",icon:"mdi-close",size:"medium",onClick:(0,i.D$)(s=>l.subtask.id?n.deleteTimeblock(e):n.deleteTimeblockWithoutId(t),["stop"])},null,8,["onClick"])]))),128)),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var fe=s(49148),_e=s.n(fe),ge={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["on-subtask-edited"],data(){return{visible:!1,subtask:null,isDeleting:!1,tmUtils:se.A,modalName:"z-delete-timeblock-modal",modalSize:"medium"}},methods:{async showModal({subtask:e}){this.subtask=e,this.visible=!0},closeModal(){this.visible=!1},async deleteTimeblock({id:e}){const t=JSON.parse(JSON.stringify(this.subtask));t.timeblocks=t.timeblocks.filter(t=>t.id!=e),t.deadline&&(t.deadline=se.A.formatDateTimeForBackend(t.deadline)),this._update(t)},deleteTimeblockWithoutId(e){this.subtask.timeblocks.splice(e,1),this._update(this.subtask)},async _update(e){try{const t=e.timesheets.map(e=>(delete e.employee_name,e)),s=(e.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),{subtask:i}=await this.$axios.put_auth(`v1/subtasks/${e.id}`,{...e,timesheets:t,timeblocks:s});this.closeModal(),this.$events.emit("on-subtask-edited",i)}catch(t){this.$toast.error(t.message||t)}}}};const ye=(0,A.A)(ge,[["render",be],["__scopeId","data-v-bf3e02a8"]]);var we=ye;const De={class:"d-flex justify-space-between align-center modal-header"},Te={class:"d-flex align-center"},Ee={class:"splitted-inputs"},Me={class:"left"},Ce={class:"w-100 modal-input quill-editor-wrapper"},$e={class:"d-flex justify-space-between align-center"},xe={class:"d-flex align-center"},Se={class:"d-flex justify-space-between align-center modal-header border-bottom pb-4"},Fe={class:"d-flex justify-start"},ze=["src"],Ae=["src"],Le={class:"w-100"},Re={class:"d-flex justify-start align-center mt-8"};function je(e,t,a,l,n,o){const r=(0,m.g2)("z-remove-employee-modal"),d=(0,m.g2)("z-remove-timeblock-modal"),u=(0,m.g2)("a-reset-size-button"),c=(0,m.g2)("a-close-button"),h=(0,m.g2)("Z-datepicker"),p=(0,m.g2)("A-employee"),k=(0,m.g2)("QuillEditor"),y=(0,m.g2)("Z-files-upload"),w=(0,m.g2)("a-resize-handle"),D=(0,m.g2)("Z-task-readonly-info"),T=(0,m.g2)("W-loadable");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(r,{ref:"removeEmployeeModal",onConfirm:o.confirmRemoveEmployee},null,8,["onConfirm"]),(0,m.bF)(d,{ref:"removeTimeblockModal"},null,512),(0,m.bF)(g.p,{modelValue:n.visible,"onUpdate:modelValue":t[22]||(t[22]=e=>n.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(T,{content:n.subtask,class:"h-100"},{default:(0,m.k6)(()=>[n.editMode?((0,m.uX)(),(0,m.Wv)(f.J,{key:0,height:"100%",class:"d-flex flex-column scrolling",style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",De,[(0,m.Lk)("h1",null,(0,v.v_)(n.subtask?.id?"Upraviť sub task":"Vytvoriť sub task"),1),(0,m.Lk)("div",Te,[(0,m.bF)(u,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(c,{onClose:t[0]||(t[0]=e=>o.closeModal())})])]),(0,m.bF)(_.S,{class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.bF)(K.Wx,{modelValue:n.subtask.project_code,"onUpdate:modelValue":t[1]||(t[1]=e=>n.subtask.project_code=e),label:"Kód projektu",value:n.subtask.project_code,class:"modal-input",variant:"solo",disabled:""},null,8,["modelValue","value"]),(0,m.bF)(q.V,{modelValue:n.subtask.master_task_id,"onUpdate:modelValue":t[2]||(t[2]=e=>n.subtask.master_task_id=e),"custom-filter":e.customFilter,"match-any":!0,label:"Master task",class:(0,v.C4)([{error:n.v$.subtask.master_task_id.$errors.length},"modal-input"]),items:o.enrichedMastertasks,"item-title":e=>e._fullName||e.name,"item-value":"id",variant:"solo",clearable:""},null,8,["modelValue","custom-filter","class","items","item-title"]),(0,m.bF)(K.Wx,{modelValue:n.subtask.title,"onUpdate:modelValue":t[3]||(t[3]=e=>n.subtask.title=e),class:"modal-input",label:"Názov subtasku",variant:"solo"},null,8,["modelValue"]),(0,m.Lk)("div",Ee,[(0,m.Lk)("div",Me,[(0,m.bF)(h,{ref:"datepicker-01",modelValue:n.subtask.deadline,"onUpdate:modelValue":t[4]||(t[4]=e=>n.subtask.deadline=e),label:"Deadline","auto-apply":!0,"min-date":new Date,class:(0,v.C4)(["modal-input",{error:n.v$.subtask.deadline.$errors?.length}]),format:"dd.MM.yyyy",locale:"sk","select-text":"Vybrať","cancel-text":"Zrušiť",placeholder:"Deadline",validations:n.v$.subtask.deadline},null,8,["modelValue","min-date","class","validations"])]),(0,m.bF)(K.Wx,{modelValue:n.subtask._deadline_time,"onUpdate:modelValue":t[5]||(t[5]=e=>n.subtask._deadline_time=e),class:(0,v.C4)(["modal-input right",{error:n.v$.subtask._deadline_time.$errors.length}]),variant:"solo",label:"Čas","append-inner-icon":"mdi-clock-outline",type:"time",hint:n.v$.subtask._deadline_time.$errors?n.errorUtils.parseErrors(n.v$.subtask._deadline_time.$errors):null},null,8,["modelValue","class","hint"])]),n.subtask.id&&!o.isDraftWithMultipleEmployees?((0,m.uX)(),(0,m.Wv)(p,{key:0,"employee-data":o.editModeEmployee,"onUpdate:employeeData":t[6]||(t[6]=e=>o.editModeEmployee=e),timeblocks:o.getEmployeeTimeblocks(n.subtask.employee_id),"all-timeblocks":n.timeblocks,"deleted-timeblock-ids":n.deletedTimeblockIds,"custom-filter":o.customFilterWithEmployeeFilter,"onUpdate:timeblocks":t[7]||(t[7]=e=>o.updateEmployeeTimeblocks(e,n.subtask.employee_id)),onClearEmployee:o.handleRemoveEmployee,onAddTimeblock:t[8]||(t[8]=e=>o.addTimeblock(n.subtask.employee_id,e))},null,8,["employee-data","timeblocks","all-timeblocks","deleted-timeblock-ids","custom-filter","onClearEmployee"])):((0,m.uX)(!0),(0,m.CE)(m.FK,{key:1},(0,m.pI)(n.subtask.employees,(e,t)=>((0,m.uX)(),(0,m.Wv)(p,{key:`employee-${e.id||t}`,ref_for:!0,ref:e=>o.setEmployeeRef(e,t),"employee-data":n.subtask.employees[t],"onUpdate:employeeData":e=>n.subtask.employees[t]=e,timeblocks:o.getEmployeeTimeblocks(e.id),"all-timeblocks":n.timeblocks,"deleted-timeblock-ids":n.deletedTimeblockIds,"custom-filter":o.customFilterWithEmployeeFilter,required:0===t,"onUpdate:timeblocks":t=>o.updateEmployeeTimeblocks(t,e.id),onClearEmployee:()=>o.removeEmployeeAtIndex(t),onAddTimeblock:t=>o.addTimeblock(e.id,t)},null,8,["employee-data","onUpdate:employeeData","timeblocks","all-timeblocks","deleted-timeblock-ids","custom-filter","required","onUpdate:timeblocks","onClearEmployee","onAddTimeblock"]))),128)),(0,m.Lk)("div",Ce,[(0,m.bF)(k,{ref:"description",modelValue:n.subtask.description,"onUpdate:modelValue":t[9]||(t[9]=e=>n.subtask.description=e),placeholder:"Popis",theme:"snow",class:"rich-text-editor",onInput:t[10]||(t[10]=e=>n.subtask.description=e.srcElement.innerHTML)},null,8,["modelValue"])]),(0,m.bF)(y,{class:"mt-15 files",files:n.subtask.files,"is-saving":n.isSaving,onFilesUploaded:o.filesUploaded},null,8,["files","is-saving","onFilesUploaded"])]),_:1}),n.subtask.id?((0,m.uX)(),(0,m.CE)(m.FK,{key:1},[n.subtask.is_draft?((0,m.uX)(),(0,m.CE)(m.FK,{key:0},[(0,m.bF)(b.D,{class:"button primary",disabled:n.isSaving,onClick:t[13]||(t[13]=e=>o.save())},{default:(0,m.k6)(()=>[...t[25]||(t[25]=[(0,m.eW)("ULOŽIŤ A PUBLIKOVAŤ",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary outline mt-2",disabled:n.isSaving,onClick:t[14]||(t[14]=e=>o.save(!0))},{default:(0,m.k6)(()=>[...t[26]||(t[26]=[(0,m.eW)("ULOŽIŤ KONCEPT",-1)])]),_:1},8,["disabled"])],64)):((0,m.uX)(),(0,m.Wv)(b.D,{key:1,class:"button primary",disabled:n.isSaving,onClick:t[15]||(t[15]=e=>o.save())},{default:(0,m.k6)(()=>[...t[27]||(t[27]=[(0,m.eW)("UPRAVIŤ",-1)])]),_:1},8,["disabled"]))],64)):((0,m.uX)(),(0,m.CE)(m.FK,{key:0},[(0,m.bF)(b.D,{class:"button primary",disabled:n.isSaving,onClick:t[11]||(t[11]=e=>o.save())},{default:(0,m.k6)(()=>[...t[23]||(t[23]=[(0,m.eW)("VYTVORIŤ",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary outline mt-2",disabled:n.isSaving,onClick:t[12]||(t[12]=e=>o.save(!0))},{default:(0,m.k6)(()=>[...t[24]||(t[24]=[(0,m.eW)("ULOŽIŤ KONCEPT",-1)])]),_:1},8,["disabled"])],64)),(0,m.bF)(w,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})):((0,m.uX)(),(0,m.Wv)(f.J,{key:1,height:"100%",class:"d-flex flex-column scrolling",style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",$e,[(0,m.Lk)("div",null,[(0,m.Lk)("p",null,(0,v.v_)(n.subtask._master_task.project_code),1),(0,m.Lk)("h1",null,(0,v.v_)(n.subtask._master_task.name),1)]),(0,m.Lk)("div",xe,[(0,m.bF)(u,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(c,{onClose:t[16]||(t[16]=e=>o.closeModal())})])]),(0,m.Lk)("div",Se,[(0,m.Lk)("h1",null,(0,v.v_)(n.subtask.title),1),(0,m.Lk)("div",Fe,[(0,m.Lk)("img",{class:"icon",src:s(63120),alt:"pencil-icon",onClick:t[17]||(t[17]=(0,i.D$)((...e)=>o.toggleEditMode&&o.toggleEditMode(...e),["stop"]))},null,8,ze),(0,m.Lk)("img",{class:"icon trash",src:s(74366),alt:"trash-icon",onClick:t[18]||(t[18]=(0,i.D$)(e=>o.openDeleteTaskModal(n.subtask),["stop"]))},null,8,Ae)])]),(0,m.bF)(_.S,{class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Le,[(0,m.bF)(D,{subtask:n.subtask,onCloseModal:o.closeModal,onUpdateSubtask:o.updateSubtask},null,8,["subtask","onCloseModal","onUpdateSubtask"]),(0,m.Lk)("div",Re,[n.subtask.is_finished?((0,m.uX)(),(0,m.Wv)(b.D,{key:1,class:"button secondary",onClick:t[20]||(t[20]=(0,i.D$)(e=>o.showCompleteTaskModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[29]||(t[29]=[(0,m.eW)("Znovu otvoriť",-1)])]),_:1})):((0,m.uX)(),(0,m.Wv)(b.D,{key:0,class:"done-btn",onClick:t[19]||(t[19]=(0,i.D$)(e=>o.showCompleteTaskModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[28]||(t[28]=[(0,m.eW)("Dokončiť",-1)])]),_:1})),(0,m.bF)(b.D,{class:"button secondary",onClick:t[21]||(t[21]=e=>o.closeModal())},{default:(0,m.k6)(()=>[...t[30]||(t[30]=[(0,m.eW)("Uložiť zmeny",-1)])]),_:1})])])]),_:1}),(0,m.bF)(w,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1}))]),_:1},8,["content"])]),_:1},8,["modelValue","width","height"])],64)}s(29838);const We=["data-datepicker-id"],Ve={key:0,class:"z-datepicker-label"};function Oe(e,t,s,i,a,l){const n=(0,m.g2)("Datepicker");return(0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["z-datepicker-wrapper",{"has-value":l.hasValue}]),"data-datepicker-id":a.uniqueId,onClick:t[0]||(t[0]=(...e)=>l.handleClick&&l.handleClick(...e))},[s.label?((0,m.uX)(),(0,m.CE)("label",Ve,(0,v.v_)(s.label),1)):(0,m.Q3)("",!0),(0,m.bF)(n,(0,m.v6)({ref:"datepickerRef","model-value":s.modelValue},e.$attrs,{placeholder:l.hasValue?" ":s.placeholder,uid:a.uniqueId,"onUpdate:modelValue":l.handleUpdate,onOpen:l.handleOpen,onClosed:l.handleClose}),null,16,["model-value","placeholder","uid","onUpdate:modelValue","onOpen","onClosed"])],10,We)}var Ie=s(39360),He={name:"ZDatepicker",components:{Datepicker:Ie.A},props:{modelValue:{type:[Date,String,null],default:null},label:{type:String,default:""},placeholder:{type:String,default:""}},emits:["update:modelValue","open","closed"],data(){return{uniqueId:`z-datepicker-${crypto.randomUUID()}`}},computed:{hasValue(){return null!=this.modelValue&&""!==this.modelValue}},methods:{handleUpdate(e){this.$emit("update:modelValue",e)},handleOpen(e){this.$emit("open",e)},handleClose(e){this.$emit("closed",e)},handleClick(e){e.target.closest(".dp__clear_icon")||this.$refs.datepickerRef?.openMenu&&this.$refs.datepickerRef.openMenu()},openMenu(){this.$refs.datepickerRef?.openMenu&&this.$refs.datepickerRef.openMenu()}}};const Ye=(0,A.A)(He,[["render",Oe],["__scopeId","data-v-708f5b45"]]);var Be=Ye,Xe=s(95523);const Ne={class:"w-100 d-flex align-center"},Pe={key:0,class:"m-2 d-flex align-center flex-wrap"},Ue={key:0,class:"d-flex align-center"},qe=["src"];function Ke(e,t,a,l,n,o){return(0,m.uX)(),(0,m.CE)("div",Ne,[(0,m.Lk)("input",{id:"fileInput",ref:"fileUpload",type:"file",multiple:"",name:"file",class:"hidden-input",accept:"*",onChange:t[0]||(t[0]=(...e)=>o.onChange&&o.onChange(...e))},null,544),(0,m.bF)(b.D,{class:"upload-btn",onClick:t[1]||(t[1]=t=>e.$refs.fileUpload.click())},{default:(0,m.k6)(()=>[(0,m.bF)(S.w,{class:"mx-1",icon:"mdi-cloud-upload-outline"}),t[2]||(t[2]=(0,m.eW)("NAHRAŤ ",-1))]),_:1}),n.uploadedFiles?((0,m.uX)(),(0,m.CE)("div",Pe,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.uploadedFiles,e=>((0,m.uX)(),(0,m.CE)("div",{key:e.name,class:"mx-2"},[(0,m.bF)(Xe.x,{class:"mt-2"},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(e.name)+" ",1),(0,m.bF)(S.w,{class:"mx-1",icon:"mdi-paperclip"}),(0,m.Lk)("p",null,(0,v.v_)((e.size/1048576).toFixed(2))+" MB",1),(0,m.bF)(S.w,{size:"small",icon:"mdi-close",onClick:(0,i.D$)(t=>o.remove(n.uploadedFiles.indexOf(e)),["stop"])},null,8,["onClick"])]),_:2},1024)]))),128)),a.isSaving?((0,m.uX)(),(0,m.CE)("div",Ue,[a.isSaving?((0,m.uX)(),(0,m.CE)("img",{key:0,class:"gif-loader",src:s(28206),alt:"Loading..."},null,8,qe)):(0,m.Q3)("",!0)])):(0,m.Q3)("",!0)])):(0,m.Q3)("",!0)])}var Ze={emit:["files-uploaded"],props:{files:{type:Array,default:()=>[]},isSaving:{type:Boolean,required:!1}},data(){return{uploadedFiles:[]}},created(){this.uploadedFiles=this.files},methods:{onChange(){const e=[...this.$refs.fileUpload.files],t=52428800,s=e.filter(e=>e.size>t);s.length>0?this.$toast.error("File is too large. Maximum file size is 50 MB."):(this.uploadedFiles=[...this.uploadedFiles,...e],this.$emit("files-uploaded",this.uploadedFiles),this.$refs.fileUpload.value="")},remove(e){this.uploadedFiles.splice(e,1)}}};const Qe=(0,A.A)(Ze,[["render",Ke],["__scopeId","data-v-e2f2ad28"]]);var Je=Qe,Ge={computed:{employeesOptions(){const e=[...this.mastertask.employees].map(e=>e.id);return this.enrichedEmployees.filter(t=>!e.includes(t.id))||[]},projectsOptions(){const e=/[^a-zA-Z0-9 ]/g,t=this.projectCodeSearch?this.projectCodeSearch.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(e,""):"",s=this.projects.filter(s=>{const i=s.code.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(e,"");return i.toLowerCase().includes(t.toLowerCase())});let i=s?.length?s.slice(0,10):this.projects.slice(0,10);if(!this.mastertask?.project_id)return i;const a=this.projects.find(e=>e.id==this.mastertask?.project_id);return i=i.filter(e=>e.id!=a.id),[...i,a]}},methods:{onEmployeeSelected(e){const t=this.enrichedEmployees.find(t=>t.id==e);this.mastertask.employees.push(t),this.showAddEmployeeInput=!1},onEmployeeDurationChanged(){let e=0;this.mastertask.employees=this.mastertask.employees.map(t=>("string"==typeof t.duration?(e+=parseFloat(t.duration),t.duration=parseFloat(t.duration),t.invalid=!1):"number"==typeof t.duration&&(e+=t.duration,t.invalid=!1),t)),this.mastertask.duration=e}},watch:{"mastertask.team_id"(e){if(!e)return;const t=this.teams.find(t=>t.id==e);t&&(this.mastertask.team=JSON.parse(JSON.stringify(t)),this.mastertask.employees=[...this.mastertask.team.employees])}}};function et(e,t,s,i,a,l){const n=(0,m.g2)("A-mastertask-name"),o=(0,m.g2)("A-mastertask-status"),r=(0,m.g2)("A-task-deadline"),d=(0,m.g2)("Z-created-by"),u=(0,m.g2)("A-task-assigned-employee"),c=(0,m.g2)("A-task-planned-time"),h=(0,m.g2)("A-task-timeblocks"),p=(0,m.g2)("A-task-remaining-time"),k=(0,m.g2)("A-task-spent-time"),b=(0,m.g2)("A-task-description"),f=(0,m.g2)("Z-files");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(n,{id:s.subtask.master_task_id,name:s.subtask._master_task.name,color:s.subtask._master_task.color,onCloseModal:t[0]||(t[0]=t=>e.$emit("close-modal"))},null,8,["id","name","color"]),(0,m.bF)(o,{"is-finished":s.subtask.is_finished},null,8,["is-finished"]),(0,m.bF)(r,{subtask:s.subtask},null,8,["subtask"]),(0,m.bF)(d,{"employee-id":s.subtask.created_by},null,8,["employee-id"]),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.normalizedEmployees,(i,a)=>((0,m.uX)(),(0,m.CE)("div",{key:`employee-${i.id||a}`,class:(0,v.C4)({"employee-section":l.hasMultipleEmployees,"border-top":l.hasMultipleEmployees,"border-bottom":l.hasMultipleEmployees&&a===l.normalizedEmployees.length-1})},[(0,m.bF)(u,{employee:i._employee},null,8,["employee"]),(0,m.bF)(c,{hours:i.duration},null,8,["hours"]),(0,m.bF)(h,{timeblocks:i.timeblocks,"is-draft":!!s.subtask.is_draft,subtask:{...s.subtask,employee_id:i.id,_employee:i._employee,timeblocks:i.timeblocks},onUpdateSubtask:t[1]||(t[1]=t=>e.$emit("update-subtask",t))},null,8,["timeblocks","is-draft","subtask"])],2))),128)),l.hasMultipleEmployees?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)(m.FK,{key:0},[(0,m.bF)(p,{hours:s.subtask.duration-s.subtask.spent_time},null,8,["hours"]),(0,m.bF)(k,{hours:s.subtask.spent_time,subtask:s.subtask},null,8,["hours","subtask"])],64)),(0,m.bF)(b,{description:s.subtask.description,"mastertask-description":s.subtask.master_task_description},null,8,["description","mastertask-description"]),(0,m.bF)(f,{files:s.subtask.files},null,8,["files"])],64)}var tt=s(56756),st=s(35526),it=s(51146);const at={class:"d-flex align-center"};function lt(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",at,[(0,m.bF)(S.w,{icon:"mdi-link",size:"large"}),t[1]||(t[1]=(0,m.Lk)("p",{class:"mx-3"},"Mastertask",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",{class:"task-badge px-4 py-2 rounded-pill hover",style:(0,v.Tr)({backgroundColor:s.color}),onClick:t[0]||(t[0]=e=>l.openMastertask())},(0,v.v_)(s.name),5)]),_:1})]),_:1})]),_:1})}var nt={props:{name:{type:String,required:!0},id:{type:Number,required:!0},color:{type:String,required:!0}},emits:["close-modal"],methods:{openMastertask(){this.$emit("close-modal"),this.$events.emit("show-mastertask-modal",{mastertask:{id:this.id},editMode:!1})}}};const ot=(0,A.A)(nt,[["render",lt]]);var rt=ot;const dt={class:"d-flex align-center"},ut={key:0,class:"status-badge px-4 py-2 rounded-pill"},ct={key:1,class:"status-badge px-4 py-2 rounded-pill"};function mt(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",dt,[(0,m.bF)(S.w,{icon:"mdi-drag-vertical",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Status",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[s.isFinished?((0,m.uX)(),(0,m.CE)("p",ut,"Ukončený")):((0,m.uX)(),(0,m.CE)("p",ct,"Neukončený"))]),_:1})]),_:1})]),_:1})}var ht={props:{isFinished:{type:Number,default:()=>0}}};const pt=(0,A.A)(ht,[["render",mt]]);var kt=pt,vt=s(30697);const bt={class:"d-flex align-center"},ft={key:0,class:"d-flex align-center mb-3"},_t={class:"d-flex align-center mb-2"},gt={class:"d-flex justify-space-between align-center pa-4"},yt={class:"d-flex align-start"},wt={class:"d-flex justify-space-between align-center"},Dt={class:"text-red"},Tt={class:"text-black"},Et={class:"d-flex align-start"};function Mt(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-employee-timeblock"),u=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(tt.L,{"no-gutters":""},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",bt,[(0,m.bF)(S.w,{icon:"mdi-calendar-week",size:"large"}),t[9]||(t[9]=(0,m.Lk)("p",{class:"mx-3"},"Trvanie",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[n.isOffice365Task?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",ft,[(0,m.bF)(S.w,{class:"add-date cursor-pointer mr-2",icon:"mdi-plus",size:"medium",onClick:t[0]||(t[0]=e=>l.showModal=!0)}),t[10]||(t[10]=(0,m.Lk)("p",{class:"task-badge rounded-pill"},"Pridať záznam",-1))])),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(s.timeblocks,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:e.id||`timeblock-${t}`,class:"timeblock-item mb-3"},[(0,m.Lk)("div",_t,[n.isOffice365Task?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.Wv)(S.w,{key:0,class:"circle-border cursor-pointer mr-2",icon:"mdi-minus",size:"medium",onClick:(0,i.D$)(s=>e.id?n.deleteTimeblock(e):n.deleteTimeblockByIndex(t),["stop"])},null,8,["onClick"])),(0,m.Lk)("p",{class:(0,v.C4)(["task-badge rounded-pill",{"strike-through":e.is_finished}])},(0,v.v_)(n.formatTimeblockStart(e))+" - "+(0,v.v_)(n.formatTimeblockEnd(e)),3),n.isOffice365Task?(0,m.Q3)("",!0):(0,m.bo)(((0,m.uX)(),(0,m.Wv)(S.w,{key:1,class:(0,v.C4)(["circle-border ml-2",{completed:e.is_finished,"cursor-pointer":!s.subtask.is_draft,"disabled-check":s.subtask.is_draft}]),icon:"mdi-check",size:"medium",onClick:(0,i.D$)(i=>!s.subtask.is_draft&&n.toggleTimeblockIsFinished(e,t),["stop"])},null,8,["class","onClick"])),[[i.aG,s.subtask.id]])])]))),128))]),_:1})]),_:1})]),_:1}),(0,m.bF)(g.p,{modelValue:l.showModal,"onUpdate:modelValue":t[4]||(t[4]=e=>l.showModal=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"},class:"add-timeblock-modal"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",gt,[t[11]||(t[11]=(0,m.Lk)("h1",null,"Pridať dátum",-1)),(0,m.Lk)("div",yt,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[1]||(t[1]=e=>n.closeModal())})])]),(0,m.bF)(vt.O,{class:"pa-4"},{default:(0,m.k6)(()=>[(0,m.bF)(d,{ref:"employeeTimeblockRef",modelValue:l.newTimeblock,"onUpdate:modelValue":t[2]||(t[2]=e=>l.newTimeblock=e),employee:n.employee,deletable:!1,index:0,"draft-timeblocks":n.draftTimeblocks},null,8,["modelValue","employee","draft-timeblocks"])]),_:1}),(0,m.bF)(_.S,{class:"pa-4"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary",onClick:t[3]||(t[3]=e=>n.submitFromEmployeeTimeblock())},{default:(0,m.k6)(()=>[...t[12]||(t[12]=[(0,m.eW)(" Potvrdiť ",-1)])]),_:1})]),_:1}),(0,m.bF)(u,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"]),(0,m.bF)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[8]||(t[8]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",wt,[(0,m.Lk)("h1",Dt,[t[13]||(t[13]=(0,m.eW)(" Ste si istý, že chcete pridať timeblock po deadline ",-1)),t[14]||(t[14]=(0,m.Lk)("br",null,null,-1)),(0,m.Lk)("b",Tt,"z mastertasku "+(0,v.v_)(s.subtask?.project_code)+" ?",1)]),(0,m.Lk)("div",Et,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[5]||(t[5]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",onClick:t[6]||(t[6]=(0,i.D$)(e=>n.confirmSubmit(),["stop"]))},{default:(0,m.k6)(()=>[...t[15]||(t[15]=[(0,m.eW)("ÁNO",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[7]||(t[7]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[16]||(t[16]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(u,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])],64)}var Ct=s(90144),$t=s(74352),xt=s(94373),St=(0,ie.y$)({state:{},getters:{},mutations:{},actions:{},modules:{}}),Ft={parseAndTranslate(e){const t=this._parseToArrayOfStrings(e);return t.join(", ")},_parseToArrayOfStrings(e){return e?.data?.message?[nu(e.data.message)]:"string"==typeof e?[nu(e)]:e?.response?.data?Object.values(e?.response?.data):e&&e.error&&"string"==typeof e.error?[nu(e.error)]:e&&e.error&&"object"==typeof e.error?Object.values(nu(e.error)):e.data&&e.data.error&&"string"==typeof e.data.error?[nu(e.data.error)]:e&&e.data&&e.data.error&&"object"==typeof e.data.error?Object.values(e.data.error).map(e=>nu(e[0])+" "):e.statusText?[nu(e.statusText)]:[e]}},zt=s(94348);xt.A.defaults.baseURL="https://tm.jandl.sk/api/";var At={async get(e,t){return xt.A.get(e,t).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async get_auth(e,t){return t=this._config(t),xt.A.get(e,t).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async get_data(e,t){return xt.A.get(e,t).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async get_auth_data(e,t){return t=this._config(t),xt.A.get(e,t).then(e=>Promise.resolve(e.data.data)).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async post(e,t=null,s){return xt.A.post(e,this._objectToFormData(t),s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async post_auth(e,t=null,s){return s=this._config(s),xt.A.post(e,this._objectToFormData(t),s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async post_data(e,t=null,s){return xt.A.post(e,this._objectToFormData(t),s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async post_auth_data(e,t=null,s){return s=this._config(s),xt.A.post(e,this._objectToFormData(t),s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async delete(e,t){return xt.A.delete(e,t).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async delete_auth(e,t){return t=this._config(t),xt.A.delete(e,t).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async delete_data(e,t){return xt.A.delete(e,t).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async delete_auth_data(e,t){return t=this._config(t),xt.A.delete(e,t).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async patch(e,t=null,s){return xt.A.patch(e,this._objectToFormData(t),s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async patch_auth(e,t=null,s){return s=this._config(s),xt.A.patch(e,this._objectToFormData(t),s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async patch_auth_form(e,t=null,s){s=this._config(s),s.headers["Content-Type"]="multipart/form-data";const i=this._objectToFormData(t);return i.append("_method","put"),s.transformRequest=e=>e,xt.A.post(e,i,s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async patch_data(e,t=null,s){return xt.A.patch(e,this._objectToFormData(t),s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async patch_auth_data(e,t=null,s){return s=this._config(s),xt.A.patch(e,this._objectToFormData(t),s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async put(e,t=null,s){return xt.A.put(e,this._objectToFormData(t),s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async put_auth(e,t=null,s){return s=this._config(s),xt.A.put(e,{data:t},s).then(e=>e.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e)))},async put_data(e,t=null,s){return xt.A.put(e,this._objectToFormData(t),s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},async put_auth_data(e,t=null,s){return s=this._config(s),xt.A.put(e,{data:t},s).then(e=>e.data.data).catch(e=>Promise.reject(Ft.parseAndTranslate(e.response||e)))},_config(e){return e&&zt.error("NOT IMPLEMENTED"),St.getters["auth/token"]?{headers:{Authorization:`Bearer ${St.getters["auth/token"]}`}}:{headers:{}}},_buildFormData(e,t,s){!t||"object"!==typeof t||t instanceof Date||t instanceof File?e.append(s,null==t?"":t):Object.keys(t).forEach(i=>this._buildFormData(e,t[i],s?`${s}[${i}]`:i))},_objectToFormData(e){const t=new FormData;return this._buildFormData(t,{data:e}),t}},Lt=s(91914);function Rt(e,t,s,i){return e<i&&s<t}function jt(e){if(!e.date||!e.starts_at_time||!e.ends_at_time)return{start:null,end:null};const t=_e()(e.date).format("YYYY-MM-DD"),s=_e()(`${t} ${e.starts_at_time}`,"YYYY-MM-DD HH:mm").toDate(),i=_e()(`${t} ${e.ends_at_time}`,"YYYY-MM-DD HH:mm").toDate();return{start:s,end:i}}function Wt(e,t){const s={hasCollision:!1,startCollides:!1,endCollides:!1,collidingTasks:[]},{start:i,end:a}=jt(e);if(!i||!a)return s;const l=t.filter(t=>{if(!t._real_start)return!1;const s=_e()(t._real_start).format("YYYY-MM-DD"),i=_e()(e.date).format("YYYY-MM-DD");return s===i});for(const n of l){if(e.id&&n._timeblock_id&&e.id===n._timeblock_id)continue;const t=new Date(n._real_start),l=new Date(n._real_end);Rt(i,a,t,l)&&(s.hasCollision=!0,s.collidingTasks.push(n),i>=t&&i<l&&(s.startCollides=!0),a>t&&a<=l&&(s.endCollides=!0),i<=t&&a>=l&&(s.startCollides=!0,s.endCollides=!0))}return s}function Vt(e){const{start:t,end:s}=jt(e);if(!t||!s)return 0;const i=s.getTime()-t.getTime();return i/36e5}function Ot(e,t){const s=[],{start:i,end:a}=jt(e);if(!i||!a)return s;const l=t.filter(t=>{if(!t._real_start)return!1;const s=_e()(t._real_start).format("YYYY-MM-DD"),i=_e()(e.date).format("YYYY-MM-DD");return s===i});for(const n of l){if(e.id&&n._timeblock_id&&e.id===n._timeblock_id)continue;const t=new Date(n._real_start),l=new Date(n._real_end);if(Rt(i,a,t,l)){const e=new Date(Math.max(i.getTime(),t.getTime())),n=new Date(Math.min(a.getTime(),l.getTime()));s.push({start:e,end:n})}}return s}var It=s(94348);function Ht(e,t,s,i,a,l,n){const{data:o,isLoading:r,error:d,refetch:u}=(0,$t.I)({queryKey:(0,m.EW)(()=>["employee-timeline",(0,Ct.R1)(e)?.id,(0,Ct.R1)(t)?_e()((0,Ct.R1)(t)).format("YYYY-MM-DD"):null]),queryFn:async()=>{const s=(0,Ct.R1)(e),i=(0,Ct.R1)(t);if(!s?.id||!i)return null;const a=_e()(i).format("YYYY-MM-DD"),l=new URLSearchParams({start:a,end:a,employee_id:s.id.toString()}).toString(),n=await At.get_auth(`v1/subtasks?${l}`);return n},enabled:(0,m.EW)(()=>{const s=(0,Ct.R1)(e),i=(0,Ct.R1)(t);return!(!s?.id||!i)})}),c=(0,m.EW)(()=>{const s=(0,Ct.R1)(o),i=(0,Ct.R1)(e),n=(0,Ct.R1)(t),r=a?(0,Ct.R1)(a):null,u=l?(0,Ct.R1)(l):[];if(!s||!i||!n)return[];const c=[...s.subtasks||[],...s.blockers||[]],m=_e()(n).format("YYYY-MM-DD");try{const e=[];return c.forEach(t=>{if(!t.timeblocks&&t.start&&t.end&&["blocker","adhoc","home_office","vacation","free_day","office365_blocker"].includes(t.type)){if(r&&t.id===r)return;const s=_e()(t.start).format("YYYY-MM-DD");if(s===m){const s=t.type,i={id:t.id,start:new Date(t.start),end:new Date(t.end),master_task:null,date:new Date(t.start),project_code:null,subtask:t,is_draft:!!t.is_draft,blocker:t,type:s,_timeblock_id:null,_timeblock_is_finished:t.is_finished||!1,_real_start:new Date(t.start),_real_end:new Date(t.end)};e.push(i)}}else{let s;if(t.is_draft&&Array.isArray(t.employees)){const e=t.employees.find(e=>Number(e.id)===Number(i.id));s=e?.timeblocks}else s=t.timeblocks;s?.forEach(s=>{const i=_e()(s.start).format("YYYY-MM-DD");if(i===m){let i="subtask";"office365"===t.type&&(i="office365");const a={id:t.id,start:new Date(s.start),end:new Date(s.end),master_task:t.master_task,date:new Date(s.start),project_code:t.project_code,subtask:t,is_draft:!!t.is_draft,blocker:void 0,type:i,_timeblock_id:s.id,_timeblock_is_finished:s.is_finished,_real_start:new Date(s.start),_real_end:new Date(s.end)};e.push(a)}})}}),u.forEach(t=>{if(!t.start||!t.end)return;const s=_e()(t.start).format("YYYY-MM-DD");if(s===m){const s={id:null,start:new Date(t.start),end:new Date(t.end),master_task:null,date:new Date(t.start),project_code:null,subtask:null,is_draft:!0,blocker:void 0,type:"draft_timeblock",_timeblock_id:t.id||null,_timeblock_is_finished:t.is_finished||!1,_real_start:new Date(t.start),_real_end:new Date(t.end),_employee_id:t.employee_id};e.push(s)}}),e}catch(d){return It.error("Error generating timeline tasks:",d),[]}}),h=(0,m.EW)(()=>{const e=(0,Ct.R1)(c),s=(0,Ct.R1)(t);if(!e||!s)return 0;const i=n?new Set((0,Ct.R1)(n).filter(e=>null!=e)):new Set;let a=0;return e.forEach(e=>{"non-working-hours"===e.type||e.subtask?.is_finished||e.blocker?.is_finished||e._timeblock_id&&i.has(e._timeblock_id)||(a+=Lt.A._getDifferenceInMinutes(e._real_end,e._real_start))}),(a/60).toFixed(1)}),p=(0,m.EW)(()=>{const e=parseFloat(String((0,Ct.R1)(h)));let t=0;if(i){const e=(0,Ct.R1)(i)||[];e.forEach(e=>{e.starts_at_time&&e.ends_at_time&&(t+=Vt(e))})}const a=(0,Ct.R1)(s);return a?.starts_at_time&&a?.ends_at_time&&(t+=Vt(a)),(e+t).toFixed(1)}),k=(0,m.EW)(()=>{const s=(0,Ct.R1)(e),i=(0,Ct.R1)(t),a=parseFloat(String((0,Ct.R1)(p)));if(!s||!i)return"0";const l=s.work_end-s.work_start;return(l-a).toFixed(1)}),v=(0,m.EW)(()=>{const e=(0,Ct.R1)(s),t=(0,Ct.R1)(c);return e&&t?Wt(e,t):{hasCollision:!1,startCollides:!1,endCollides:!1,collidingTasks:[]}}),b=(0,m.EW)(()=>{const e=(0,Ct.R1)(s),t=(0,Ct.R1)(c);return e&&t?Ot(e,t):[]}),f=(0,m.EW)(()=>{const e=(0,Ct.R1)(s);return e?Vt(e):0});return{isLoading:r,error:d,refetch:u,timelineTasks:c,scheduledTime:h,totalPlannedTime:p,freeTime:k,collision:v,collisionSegments:b,timeblockDuration:f}}const Yt={class:"actions"},Bt=["disabled"];var Xt=(0,m.pM)({__name:"a-employee-timeblock-header-actions",props:{deletable:{type:Boolean,default:!1}},emits:["addTimeblock","removeTimeblock"],setup(e){const t=e;return(e,s)=>((0,m.uX)(),(0,m.CE)("div",Yt,[(0,m.Lk)("button",{class:"add-btn",onClick:s[0]||(s[0]=t=>e.$emit("addTimeblock"))},"+"),(0,m.Lk)("button",{disabled:!t.deletable,class:"delete-btn",onClick:s[1]||(s[1]=t=>e.$emit("removeTimeblock"))}," × ",8,Bt)]))}});const Nt=(0,A.A)(Xt,[["__scopeId","data-v-584d1220"]]);var Pt=Nt;const Ut={class:"timeblock__header"},qt={class:"timeblock__header__top"},Kt={class:"timeblock__header__content"},Zt={class:"timeblock__date-wrapper"},Qt={class:"timeblock__date"},Jt=["disabled"],Gt=["disabled"],es={class:"actions actions--mobile"},ts={class:"timeblock__controls"},ss={class:"timeblock__controls__time"},is={class:"timeblock__time-overview"},as={key:0,class:"validation-error"},ls={class:"actions actions--desktop"};var ns=(0,m.pM)({__name:"a-employee-timeblock-header",props:{modelValue:{},minDate:{},deletable:{type:Boolean},isEditable:{type:Boolean},isTimeRangeValid:{type:Boolean},employee:{},index:{},collision:{},hasValidationErrors:{type:Boolean},hasStartTimeError:{type:Boolean},hasEndTimeError:{type:Boolean},endTimeErrorMessage:{default:""},plannedTime:{default:""},freeTime:{default:""}},emits:["previousDay","nextDay","updateDate","updateStartTime","updateEndTime","addTimeblock","removeTimeblock"],setup(e){const t=e,s=(0,m.EW)(()=>!!t.modelValue.date&&_e()(t.modelValue.date).isSame(_e()(),"day")),i=(0,Ct.KR)(!1),a=()=>{i.value=window.innerWidth<=768};(0,m.sV)(()=>{a(),window.addEventListener("resize",a)}),(0,m.hi)(()=>{window.removeEventListener("resize",a)});const l=(0,m.EW)(()=>i.value?"dd.MM":"dd.MM.yyyy");return(t,i)=>((0,m.uX)(),(0,m.CE)("div",Ut,[(0,m.Lk)("div",qt,[(0,m.Lk)("p",null," Časový blok "+(0,v.v_)(e.index+1)+" - "+(0,v.v_)(e.employee?._fullName),1)]),(0,m.Lk)("div",Kt,[(0,m.Lk)("div",Zt,[(0,m.Lk)("div",Qt,[(0,m.Lk)("button",{class:"timeblock__date-button",disabled:s.value||!e.isEditable,onClick:i[0]||(i[0]=e=>t.$emit("previousDay"))},[...i[9]||(i[9]=[(0,m.Lk)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},[(0,m.Lk)("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"})],-1)])],8,Jt),((0,m.uX)(),(0,m.Wv)(Be,{key:l.value,"model-value":e.modelValue.date,format:l.value,locale:"sk","select-text":"Vybrať","cancel-text":"Zrušiť",placeholder:"Dátum","auto-apply":!0,"enable-time-picker":!1,"min-date":e.minDate,disabled:!e.isEditable,class:(0,v.C4)(["timeblock__date-picker",{"timeblock__date-picker--disabled":!e.isEditable}]),"onUpdate:modelValue":i[1]||(i[1]=e=>t.$emit("updateDate",e))},null,8,["model-value","format","min-date","disabled","class"])),(0,m.Lk)("button",{class:"timeblock__date-button",disabled:!e.isEditable,onClick:i[2]||(i[2]=e=>t.$emit("nextDay"))},[...i[10]||(i[10]=[(0,m.Lk)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"currentColor"},[(0,m.Lk)("path",{d:"M8.59 16.59L10 18l6-6-6-6-1.41 1.41L13.17 12z"})],-1)])],8,Gt)]),(0,m.Lk)("div",es,[(0,m.bF)(Pt,{deletable:e.deletable,onAddTimeblock:i[3]||(i[3]=e=>t.$emit("addTimeblock")),onRemoveTimeblock:i[4]||(i[4]=e=>t.$emit("removeTimeblock"))},null,8,["deletable"])])]),(0,m.Lk)("div",ts,[(0,m.Lk)("div",ss,[(0,m.bF)(K.Wx,{value:e.modelValue.starts_at_time,class:(0,v.C4)({"error-input":e.collision.startCollides||!e.isTimeRangeValid||e.hasValidationErrors&&e.hasStartTimeError}),disabled:!e.isEditable,type:"time",variant:"solo","bg-color":"white",label:"Začiatok",density:"compact","hide-details":"",onInput:i[5]||(i[5]=e=>t.$emit("updateStartTime",e))},null,8,["value","class","disabled"]),(0,m.bF)(K.Wx,{value:e.modelValue.ends_at_time,class:(0,v.C4)({"error-input":e.collision.endCollides||!e.isTimeRangeValid||e.hasValidationErrors&&e.hasEndTimeError}),disabled:!e.isEditable,type:"time",variant:"solo","bg-color":"white",label:"Koniec",density:"compact","hide-details":"",onInput:i[6]||(i[6]=e=>t.$emit("updateEndTime",e))},null,8,["value","class","disabled"])]),(0,m.Lk)("div",is,[(0,m.Lk)("p",null,[i[11]||(i[11]=(0,m.Lk)("span",{class:"timeblock__time-overview__label timeblock__time-overview__label--desktop"},"Naplánovaný čas:",-1)),i[12]||(i[12]=(0,m.Lk)("span",{class:"timeblock__time-overview__label timeblock__time-overview__label--mobile"},"Nap. čas:",-1)),(0,m.Lk)("span",null,(0,v.v_)(e.plannedTime)+"h",1)]),(0,m.Lk)("p",null,[i[13]||(i[13]=(0,m.Lk)("span",{class:"timeblock__time-overview__label timeblock__time-overview__label--desktop"},"Volný čas:",-1)),i[14]||(i[14]=(0,m.Lk)("span",{class:"timeblock__time-overview__label timeblock__time-overview__label--mobile"},"Vol. čas:",-1)),(0,m.Lk)("span",{style:(0,v.Tr)({color:Number(e.freeTime)<0?"red":void 0})},(0,v.v_)(e.freeTime)+"h",5)])])]),!e.isTimeRangeValid||e.endTimeErrorMessage?((0,m.uX)(),(0,m.CE)("div",as,(0,v.v_)(e.endTimeErrorMessage||"Koniec musí byť po začiatku"),1)):(0,m.Q3)("",!0),(0,m.Lk)("div",ls,[(0,m.bF)(Pt,{deletable:e.deletable,onAddTimeblock:i[7]||(i[7]=e=>t.$emit("addTimeblock")),onRemoveTimeblock:i[8]||(i[8]=e=>t.$emit("removeTimeblock"))},null,8,["deletable"])])])]))}});const os=(0,A.A)(ns,[["__scopeId","data-v-4c39876b"]]);var rs=os;const ds={class:"timeline-hours"},us={class:"hour-label"};var cs=(0,m.pM)({__name:"a-employee-timeblock-timeline-header",props:{startHour:{},endHour:{},hourWidth:{}},setup(e){const t=e,s=(0,m.EW)(()=>{const e=[];for(let s=t.startHour;s<t.endHour;s++)e.push(s);return e}),i=e=>(e-t.startHour)*t.hourWidth;return(e,t)=>((0,m.uX)(),(0,m.CE)("div",ds,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(s.value,e=>((0,m.uX)(),(0,m.CE)("div",{key:e,class:"hour-marker",style:(0,v.Tr)({left:`${i(e)}px`})},[(0,m.Lk)("span",us,(0,v.v_)(e)+":00",1)],4))),128))]))}});const ms=(0,A.A)(cs,[["__scopeId","data-v-d46c34ec"]]);var hs=ms;const ps={class:"timeline"},ks={key:0,class:"timeline-loading"},vs={key:0,class:"weekend-overlay"},bs=["title"],fs={class:"preview-time-label"},_s={key:0},gs={key:1},ys={key:0,class:"timeblock-duration"},ws={key:0,class:"preview-time-label"},Ds={key:1,class:"preview-time-label"};var Ts=(0,m.pM)({__name:"a-employee-timeblock-timeline",props:{isLoading:{type:Boolean},employee:{},date:{},scheduledBlocks:{},otherTimeblocks:{default:()=>[]},currentTimeblockRange:{},collision:{},collisionSegments:{},timeblockDuration:{},startHour:{},endHour:{},hourWidth:{}},emits:["timeblockUpdated"],setup(e,{expose:t,emit:s}){const a=e,l=s,n=(0,Ct.KR)(null),o=(0,Ct.KR)(null),r=(0,Ct.KR)(null),d=(0,Ct.KR)(!1),u=(0,Ct.KR)(!1),c=(0,Ct.KR)(null),h=(0,Ct.KR)({isStretching:!1,isResizingCurrent:!1,resizeEdge:null,startX:0,initialStart:null,initialEnd:null}),p=(0,Ct.KR)(null),k=(0,Ct.KR)(!1),b=(0,Ct.KR)(null),f=(0,m.EW)(()=>{const e=a.date||a.currentTimeblockRange.start;if(!e)return!1;const t=_e()(e).day();return 0===t||6===t}),_=(0,m.EW)(()=>{if(!a.currentTimeblockRange.start||!a.currentTimeblockRange.end)return!1;const e=a.currentTimeblockRange.start.getHours()+a.currentTimeblockRange.start.getMinutes()/60,t=a.currentTimeblockRange.end.getHours()+a.currentTimeblockRange.end.getMinutes()/60,s=e<a.employee.work_start||e>=a.employee.work_end,i=t<=a.employee.work_start||t>a.employee.work_end;return s||i}),g=(0,m.EW)(()=>a.otherTimeblocks.map(e=>{if(!e.date||!e.starts_at_time||!e.ends_at_time)return null;const[t,s]=e.starts_at_time.split(":").map(Number),[i,a]=e.ends_at_time.split(":").map(Number),l=_e()(e.date).set({hour:t,minute:s,second:0}).toDate(),n=_e()(e.date).set({hour:i,minute:a,second:0}).toDate();return{_start:l,_end:n}}).filter(e=>null!==e)),y=e=>(e-a.startHour)*a.hourWidth,w=e=>e*a.hourWidth,D=e=>{const t=e.getHours(),s=e.getMinutes(),i=t+s/60;return(i-a.startHour)*a.hourWidth+1},T=(e,t)=>{const s=e.getHours()+e.getMinutes()/60,i=t.getHours()+t.getMinutes()/60;return(i-s)*a.hourWidth-2},E=(e,t=15)=>{const s=e.getMinutes(),i=Math.round(s/t)*t;return _e()(e).set({minute:i,second:0,millisecond:0}).toDate()},M=e=>{const t=e/a.hourWidth,s=a.startHour+t,i=Math.floor(s),l=s%1*60,n=a.currentTimeblockRange.start?_e()(a.currentTimeblockRange.start):_e()();return n.set({hour:i,minute:l,second:0,millisecond:0}).toDate()},C=e=>_e()(e).format("HH:mm"),$=e=>{if(d.value)return;if(h.value.isStretching)return void F(e);if(h.value.isResizingCurrent)return void L(e);if(!o.value||!r.value)return;const t=o.value.getBoundingClientRect(),s=o.value.scrollLeft,i=e.clientX-t.left+s,l=M(i),n=E(l),m=n.getHours()+n.getMinutes()/60,p=m>=a.employee.work_start&&m<a.employee.work_end;p?(b.value=n,k.value=!0):k.value=!1,o.value&&(o.value.style.cursor=p?"crosshair":"not-allowed");const v=n;let f=_e()(v).add(1,"hour").toDate();if(p){const e=f.getHours()+f.getMinutes()/60;e>a.employee.work_end&&(f=_e()(v).set({hour:Math.floor(a.employee.work_end),minute:a.employee.work_end%1*60,second:0,millisecond:0}).toDate()),u.value=!0,c.value={start:v,end:f}}else u.value=!1},x=()=>{h.value.isStretching||h.value.isResizingCurrent||(u.value=!1,k.value=!1,o.value&&(o.value.style.cursor="crosshair"))},S=e=>{if(d.value)return;if(!o.value||!b.value)return;const t=e.target;if(t.classList.contains("resize-handle"))return;if(!k.value||!u.value||!c.value)return;h.value.isStretching=!0,h.value.startX=e.clientX,h.value.initialStart=b.value;let s=_e()(b.value).add(1,"hour").toDate();const i=s.getHours()+s.getMinutes()/60;i>a.employee.work_end&&(s=_e()(b.value).set({hour:Math.floor(a.employee.work_end),minute:a.employee.work_end%1*60,second:0,millisecond:0}).toDate()),h.value.initialEnd=s,c.value={start:b.value,end:s},e.preventDefault()},F=e=>{if(!h.value.initialStart||!o.value)return;const t=o.value.getBoundingClientRect(),s=e.clientX-t.left+o.value.scrollLeft,i=M(s);let l=E(i);const n=h.value.initialStart.getTime(),r=l.getTime();if(r>=n){let e=l;r===n&&(e=_e()(l).add(15,"minutes").toDate());const t=e.getHours()+e.getMinutes()/60;t>a.employee.work_end&&(e=_e()(e).set({hour:Math.floor(a.employee.work_end),minute:a.employee.work_end%1*60,second:0,millisecond:0}).toDate()),c.value={start:h.value.initialStart,end:e},b.value=e,k.value=!0}else{const e=l.getHours()+l.getMinutes()/60;e<a.employee.work_start&&(l=_e()(l).set({hour:Math.floor(a.employee.work_start),minute:a.employee.work_start%1*60,second:0,millisecond:0}).toDate()),c.value={start:l,end:h.value.initialStart},b.value=l,k.value=!0}},z=()=>{if(h.value.isStretching&&c.value){const e=c.value.start.getTime(),t=c.value.end.getTime();t>e&&l("timeblockUpdated",{starts_at_time:C(c.value.start),ends_at_time:C(c.value.end)})}h.value.isStretching=!1,h.value.initialStart=null,h.value.initialEnd=null,u.value=!1},A=(e,t)=>{a.currentTimeblockRange.start&&a.currentTimeblockRange.end&&(h.value.isResizingCurrent=!0,h.value.resizeEdge=t,h.value.startX=e.clientX,h.value.initialStart=a.currentTimeblockRange.start,h.value.initialEnd=a.currentTimeblockRange.end,p.value={start:a.currentTimeblockRange.start,end:a.currentTimeblockRange.end},e.preventDefault())},L=e=>{if(!h.value.initialStart||!h.value.initialEnd||!o.value)return;const t=o.value.getBoundingClientRect(),s=e.clientX-t.left+o.value.scrollLeft,i=M(s);let l=E(i);if("left"===h.value.resizeEdge){const e=l.getHours()+l.getMinutes()/60;e<a.employee.work_start&&(l=_e()(l).set({hour:Math.floor(a.employee.work_start),minute:a.employee.work_start%1*60,second:0,millisecond:0}).toDate()),l<h.value.initialEnd&&(p.value={start:l,end:h.value.initialEnd},b.value=l,k.value=!0)}else if("right"===h.value.resizeEdge){const e=l.getHours()+l.getMinutes()/60;e>a.employee.work_end&&(l=_e()(l).set({hour:Math.floor(a.employee.work_end),minute:a.employee.work_end%1*60,second:0,millisecond:0}).toDate()),l>h.value.initialStart&&(p.value={start:h.value.initialStart,end:l},b.value=l,k.value=!0)}},R=()=>{h.value.isResizingCurrent&&p.value&&l("timeblockUpdated",{starts_at_time:C(p.value.start),ends_at_time:C(p.value.end)}),h.value.isResizingCurrent=!1,h.value.resizeEdge=null,h.value.initialStart=null,h.value.initialEnd=null,p.value=null},j=()=>{h.value.isStretching?z():h.value.isResizingCurrent&&R()},W=e=>{h.value.isStretching?F(e):h.value.isResizingCurrent&&L(e)};return(0,m.sV)(()=>{d.value=window.innerWidth<=768;const e=()=>{d.value=window.innerWidth<=768};window.addEventListener("resize",e),document.addEventListener("mouseup",j),document.addEventListener("mousemove",W)}),(0,m.hi)(()=>{document.removeEventListener("mouseup",j),document.removeEventListener("mousemove",W)}),t({timelineScroll:o}),(t,s)=>((0,m.uX)(),(0,m.CE)("div",ps,[e.isLoading?((0,m.uX)(),(0,m.CE)("div",ks,[...s[2]||(s[2]=[(0,m.Lk)("span",null,"Načítavam...",-1)])])):((0,m.uX)(),(0,m.CE)("div",{key:1,ref_key:"timelineContainer",ref:n,class:"timeline__content"},[(0,m.Lk)("div",{ref_key:"timelineScroll",ref:o,class:"timeline-scroll",onMousemove:$,onMouseleave:x,onMousedown:S},[(0,m.bF)(hs,{"start-hour":e.startHour,"end-hour":e.endHour,"hour-width":e.hourWidth},null,8,["start-hour","end-hour","hour-width"]),(0,m.Lk)("div",{ref_key:"timelineBar",ref:r,class:"timeline-bar"},[(0,m.Lk)("div",{class:"non-working-hours",style:(0,v.Tr)({left:"0px",width:`${y(e.employee.work_start)}px`})},null,4),(0,m.Lk)("div",{class:"non-working-hours",style:(0,v.Tr)({left:`${y(e.employee.work_end)}px`,width:`${w(24-e.employee.work_end)}px`})},null,4),(0,m.Lk)("div",{class:"work-hours-bar",style:(0,v.Tr)({left:`${y(e.employee.work_start)}px`,width:`${w(e.employee.work_end-e.employee.work_start)}px`})},null,4),f.value?((0,m.uX)(),(0,m.CE)("div",vs)):(0,m.Q3)("",!0),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(e.scheduledBlocks,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:`task-${t}`,class:(0,v.C4)(["scheduled-block",{"scheduled-block--blocker":["blocker","adhoc","home_office","vacation","free_day","office365_blocker"].includes(e.type),"scheduled-block--concept":!0===e.is_draft}]),style:(0,v.Tr)({left:`${D(e._real_start)}px`,width:`${T(e._real_start,e._real_end)}px`}),title:`${e.subtask?.title||e.blocker?.type||"Task"}`},null,14,bs))),128)),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(g.value,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:`other-${t}`,class:"other-timeblock",style:(0,v.Tr)({left:`${D(e._start)}px`,width:`${T(e._start,e._end)}px`}),title:"Other timeblock"},null,4))),128)),u.value&&c.value?((0,m.uX)(),(0,m.CE)("div",{key:1,class:(0,v.C4)(["preview-block",{"is-stretching":h.value.isStretching}]),style:(0,v.Tr)({left:`${D(c.value.start)}px`,width:`${T(c.value.start,c.value.end)}px`})},[(0,m.Lk)("div",fs,[T(c.value.start,c.value.end)<=58?((0,m.uX)(),(0,m.CE)("div",_s,(0,v.v_)(C(c.value.start)),1)):((0,m.uX)(),(0,m.CE)("div",gs,(0,v.v_)(C(c.value.start))+" - "+(0,v.v_)(C(c.value.end)),1))])],6)):(0,m.Q3)("",!0),e.currentTimeblockRange.start&&e.currentTimeblockRange.end&&!h.value.isResizingCurrent?((0,m.uX)(),(0,m.CE)("div",{key:2,class:(0,v.C4)(["current-timeblock",{"has-collision":e.collision.hasCollision,"outside-working-hours":_.value}]),style:(0,v.Tr)({left:`${D(e.currentTimeblockRange.start)}px`,width:`${T(e.currentTimeblockRange.start,e.currentTimeblockRange.end)}px`})},[e.timeblockDuration>0?((0,m.uX)(),(0,m.CE)("div",ys,(0,v.v_)(e.timeblockDuration.toFixed(2))+"h ",1)):(0,m.Q3)("",!0),(0,m.Lk)("div",{class:"resize-handle resize-handle--left",onMousedown:s[0]||(s[0]=(0,i.D$)(e=>A(e,"left"),["stop"]))},null,32),(0,m.Lk)("div",{class:"resize-handle resize-handle--right",onMousedown:s[1]||(s[1]=(0,i.D$)(e=>A(e,"right"),["stop"]))},null,32)],6)):(0,m.Q3)("",!0),h.value.isResizingCurrent&&p.value?((0,m.uX)(),(0,m.CE)("div",{key:3,class:(0,v.C4)(["current-timeblock is-resizing",{"has-collision":e.collision.hasCollision,"outside-working-hours":_.value}]),style:(0,v.Tr)({left:`${D(p.value.start)}px`,width:`${T(p.value.start,p.value.end)}px`})},[T(p.value.start,p.value.end)<=58?((0,m.uX)(),(0,m.CE)("div",ws,(0,v.v_)(C(p.value.start)),1)):((0,m.uX)(),(0,m.CE)("div",Ds,(0,v.v_)(C(p.value.start))+" - "+(0,v.v_)(C(p.value.end)),1))],6)):(0,m.Q3)("",!0),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(e.collisionSegments,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{key:`collision-${t}`,class:"collision-segment",style:(0,v.Tr)({left:`${D(e.start)}px`,width:`${T(e.start,e.end)}px`})},null,4))),128)),k.value&&b.value?((0,m.uX)(),(0,m.CE)("div",{key:4,class:"timeline-cursor",style:(0,v.Tr)({left:`${D(b.value)}px`})},null,4)):(0,m.Q3)("",!0)],512)],544)],512))]))}});const Es=(0,A.A)(Ts,[["__scopeId","data-v-75227d73"]]);var Ms=Es,Cs=s(94348);const $s={key:0,class:"timeline-wrapper"},xs=!0,Ss=60,Fs=50,zs=0,As=24;var Ls=(0,m.pM)({__name:"a-employee-timeblock",props:{modelValue:{},employee:{},allEmployeeTimeblocks:{default:()=>[]},allTimeblocks:{default:()=>[]},deletedTimeblockIds:{default:()=>[]},editingBlockerId:{default:null},currentIndex:{default:0},deletable:{type:Boolean,default:!1},index:{default:0},draftTimeblocks:{default:()=>[]}},emits:["update:modelValue","addTimeblock","removeTimeblock"],setup(e,{expose:t,emit:s}){const i=e,a=s,l=(0,Ct.KR)(null),n=(0,m.EW)(()=>!!xs||!i.modelValue.id),o=(0,Ct.KR)(new Date),r=(0,Ct.KR)(!1);(0,m.sV)(()=>{r.value=window.innerWidth<=768,window.addEventListener("resize",()=>{r.value=window.innerWidth<=768}),(0,m.dY)(()=>{O()})});const d=(0,m.EW)(()=>r.value?Fs:Ss),u=(e,t)=>{if(!t.starts_at_time||!t.ends_at_time||!t.date)return!0;const{start:s,end:i}=jt(t);return!s||!i||i>s},c={date:{requiredWhenHasTime:ee._$.withMessage("Vyberte dátum",ee.mw)},starts_at_time:{requiredWhenHasTime:ee._$.withMessage("Zadajte začiatok",ee.mw)},ends_at_time:{requiredWhenHasTime:ee._$.withMessage("Zadajte koniec",ee.mw),timeRangeValid:ee._$.withMessage("Koniec musí byť po začiatku",u)}},h=(0,G.fG)(c,i.modelValue,{$autoDirty:!0}),p=(0,m.EW)(()=>!(!h.value.starts_at_time.$dirty||!h.value.starts_at_time.$error)||!(!i.modelValue.ends_at_time||i.modelValue.starts_at_time)&&h.value.starts_at_time.$error),k=(0,m.EW)(()=>!(!h.value.ends_at_time.$dirty||!h.value.ends_at_time.$error)||!(!i.modelValue.starts_at_time||i.modelValue.ends_at_time)&&h.value.ends_at_time.$error),b=(0,m.EW)(()=>k.value?h.value.ends_at_time.$errors.map(e=>e.$message).join(", "):""),f=(0,m.EW)(()=>i.employee),_=(0,m.EW)(()=>i.modelValue.date),g=(0,m.EW)(()=>i.modelValue),y=(0,m.EW)(()=>{if(!i.modelValue.date)return[];const e=_e()(i.modelValue.date).format("YYYY-MM-DD");return i.allEmployeeTimeblocks.filter((t,s)=>s!==i.currentIndex&&(!!(t.date&&t.starts_at_time&&t.ends_at_time)&&_e()(t.date).format("YYYY-MM-DD")===e))}),w=(0,m.EW)(()=>i.allEmployeeTimeblocks.filter(e=>null!=e.id).map(e=>e.id)),D=(0,m.EW)(()=>i.editingBlockerId),T=(0,m.EW)(()=>i.draftTimeblocks),{isLoading:E,timelineTasks:M,scheduledTime:C,totalPlannedTime:$,freeTime:x,timeblockDuration:S,refetch:F}=Ht(f,_,g,y,D,T,w);(0,m.wB)(()=>i.modelValue.date,()=>{i.modelValue.date&&i.employee?.id&&F()}),(0,m.sV)(()=>{F()});const z=(0,m.EW)(()=>{const e=new Set([...i.allTimeblocks.filter(e=>e.id).map(e=>e.id),...i.deletedTimeblockIds||[]]);return M.value.filter(t=>!t._timeblock_id||!e.has(t._timeblock_id))}),A=(0,m.EW)(()=>y.value.map(e=>{const{start:t,end:s}=jt(e);return t&&s?{_real_start:t,_real_end:s,_timeblock_id:e.id||null}:null}).filter(e=>null!==e)),L=(0,m.EW)(()=>[...z.value,...A.value]),R=(0,m.EW)(()=>Wt(i.modelValue,L.value)),j=(0,m.EW)(()=>Ot(i.modelValue,L.value)),W=(0,m.EW)(()=>{const{start:e,end:t}=jt(i.modelValue);return{start:e,end:t}}),V=(0,m.EW)(()=>{if(!i.modelValue.starts_at_time||!i.modelValue.ends_at_time)return!0;const{start:e,end:t}=W.value;return!e||!t||t>e}),O=()=>{if(!l.value?.timelineScroll)return;const e=i.employee?.work_start??8,t=i.employee?.work_end??17,s=(e+t)/2,a=(s-zs)*d.value,n=l.value.timelineScroll.clientWidth;l.value.timelineScroll.scrollLeft=a-n/2};(0,m.wB)(()=>[i.modelValue.date,i.employee?.id],()=>{(0,m.dY)(()=>{O()})}),(0,m.wB)(l,e=>{e?.timelineScroll&&(0,m.dY)(()=>{O()})}),(0,m.wB)(E,(e,t)=>{t&&!e&&(0,m.dY)(()=>{setTimeout(()=>{O()},0)})});const I=()=>{if(!i.modelValue.date)return;const e=_e()(i.modelValue.date),t=e.clone().subtract(1,"day").toDate();_e()(t).isBefore(_e()(),"day")||Y(t)},H=()=>{if(!i.modelValue.date)return;const e=_e()(i.modelValue.date),t=e.clone().add(1,"day").toDate();Y(t)},Y=e=>{a("update:modelValue",{...i.modelValue,date:e})},B=e=>{const t=e.target;a("update:modelValue",{...i.modelValue,starts_at_time:t.value})},X=e=>{const t=e.target;a("update:modelValue",{...i.modelValue,ends_at_time:t.value})},N=e=>{const{starts_at_time:t}=e;let{ends_at_time:s}=e;if(t===s){const[e,i]=t.split(":").map(Number),a=(e+1)%24;s=`${String(a).padStart(2,"0")}:${String(i).padStart(2,"0")}`}a("update:modelValue",{...i.modelValue,starts_at_time:t,ends_at_time:s}),(0,m.dY)(()=>{h.value.$touch()})},P=async()=>{h.value.$touch();const e=await h.value.$validate();return e&&V.value};return t({validate:P}),(0,m.wB)(()=>i.modelValue.ends_at_time,()=>{h.value.ends_at_time.$model!==i.modelValue.ends_at_time&&(h.value.ends_at_time.$model=i.modelValue.ends_at_time)}),(0,m.wB)(()=>i.modelValue.starts_at_time,()=>{h.value.starts_at_time.$model!==i.modelValue.starts_at_time&&(h.value.starts_at_time.$model=i.modelValue.starts_at_time,Cs.log("starts_at_time changed",h.value.starts_at_time.$model))}),(0,m.wB)(()=>i.modelValue.date,()=>{h.value.date.$model!==i.modelValue.date&&(h.value.date.$model=i.modelValue.date)}),(t,s)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["timeblock",{"timeblock--finished":e.modelValue.is_finished}])},[(0,m.bF)(rs,{"model-value":e.modelValue,"min-date":o.value,deletable:e.deletable,"is-editable":n.value,"is-time-range-valid":V.value,collision:R.value,"has-validation-errors":(0,Ct.R1)(h).$error&&(0,Ct.R1)(h).$anyDirty,"has-start-time-error":p.value,"has-end-time-error":k.value,"end-time-error-message":b.value,"planned-time":(0,Ct.R1)($),"free-time":(0,Ct.R1)(x),employee:e.employee,index:e.index,onPreviousDay:I,onNextDay:H,onUpdateDate:Y,onUpdateStartTime:B,onUpdateEndTime:X,onAddTimeblock:s[0]||(s[0]=e=>t.$emit("addTimeblock")),onRemoveTimeblock:s[1]||(s[1]=e=>t.$emit("removeTimeblock"))},null,8,["model-value","min-date","deletable","is-editable","is-time-range-valid","collision","has-validation-errors","has-start-time-error","has-end-time-error","end-time-error-message","planned-time","free-time","employee","index"]),e.modelValue.date&&e.employee?((0,m.uX)(),(0,m.CE)("div",$s,[(0,m.bF)(Ms,{ref_key:"timelineRef",ref:l,"is-loading":(0,Ct.R1)(E),employee:e.employee,date:e.modelValue.date,"scheduled-blocks":z.value,"other-timeblocks":y.value,"current-timeblock-range":W.value,collision:R.value,"collision-segments":j.value,"timeblock-duration":(0,Ct.R1)(S),"start-hour":zs,"end-hour":As,"hour-width":d.value,onTimeblockUpdated:N},null,8,["is-loading","employee","date","scheduled-blocks","other-timeblocks","current-timeblock-range","collision","collision-segments","timeblock-duration","hour-width"])])):(0,m.Q3)("",!0)],2))}});const Rs=(0,A.A)(Ls,[["__scopeId","data-v-2dda3ef0"]]);var js=Rs,Ws=s(94348),Vs={components:{AEmployeeTimeblock:js,AResetSizeButton:I,ACloseButton:X,AResizeHandle:R},mixins:[x],props:{timeblocks:{type:Array,required:!0},subtask:{type:Object,required:!0},isDraft:{type:Boolean,default:!1}},emits:["update-subtask"],data(){return{tmUtils:se.A,showModal:!1,visible:!1,newTimeblock:{id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:null},START_HOUR:0,END_HOUR:24,HOUR_WIDTH:60,HOUR_WIDTH_MOBILE:50,existingTimeblocksData:{},modalName:"a-task-timeblocks-modal",modalSize:"medium"}},computed:{...(0,ie.L8)("tm",["mastertasks","enrichedEmployees"]),isOffice365Task(){return"office365"==this.subtask.type},employee(){return this.subtask?.employee_id?this.subtask._employee||this.enrichedEmployees.find(e=>e.id===this.subtask.employee_id):null},draftTimeblocks(){return this.isDraft?this.timeblocks.filter(e=>e.date&&e.starts_at_time&&e.ends_at_time).map(e=>{const t=_e()(e.date).format("YYYY-MM-DD");return{...e,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,employee_id:this.subtask.employee_id}}):[]},hourWidth(){return window.innerWidth<=768?this.HOUR_WIDTH_MOBILE:this.HOUR_WIDTH},existingTimeblocksDataReactive(){return{...this.existingTimeblocksData}}},watch:{timeblocks:{handler(){this.$nextTick(()=>{this.fetchAllTimelinesData()})},deep:!0},"employee.id":{handler(e){e&&this.fetchAllTimelinesData()}},showModal:{handler(e){e&&(this.newTimeblock={id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:this.employee?.id||null})}}},mounted(){this.employee?.id&&this.fetchAllTimelinesData()},methods:{async submitFromEmployeeTimeblock(){const e=await(this.$refs.employeeTimeblockRef?.validate());e&&await this.submit()},getTimelineLoadingState(e){const t=this.existingTimeblocksDataReactive;return t[e]?.loading||!1},getScheduledBlocksForTimeblock(e){const t=this.existingTimeblocksDataReactive,s=t[e]?.tasks||[],i=this.timeblocks[e];return s.filter(e=>!e._timeblock_id||!i.id||e._timeblock_id!==i.id)},getOtherTimeblocksForTimeblock(e,t){if(!e.date)return[];const s=_e()(e.date).format("YYYY-MM-DD");return this.timeblocks.filter((e,i)=>{if(i===t)return!1;if(!e.date||!e.starts_at_time||!e.ends_at_time)return!1;const a=_e()(e.date).format("YYYY-MM-DD");return a===s})},getTimeblockRange(e){const{start:t,end:s}=jt(e);return{start:t,end:s}},getCollisionForTimeblock(e,t){const s=this.getScheduledBlocksForTimeblock(t);return Wt(e,s)},getCollisionSegmentsForTimeblock(e,t){const s=this.getScheduledBlocksForTimeblock(t);return Ot(e,s)},calculateDuration(e){return Vt(e)},async fetchTimelineDataForTimeblock(e){const t=this.timeblocks[e];if(this.employee?.id&&t.date){this.existingTimeblocksData={...this.existingTimeblocksData,[e]:{tasks:this.existingTimeblocksData[e]?.tasks||[],loading:!0}};try{const s=_e()(t.date).format("YYYY-MM-DD"),i=new URLSearchParams({start:s,end:s,employee_id:this.employee.id.toString()}).toString(),a=await this.$axios.get_auth(`v1/subtasks?${i}`),l=[...a.subtasks||[],...a.blockers||[]],n=[];l.forEach(e=>{if(!e.timeblocks&&e.start&&e.end&&["blocker","adhoc","home_office","vacation","free_day","office365_blocker"].includes(e.type)){const t=_e()(e.start).format("YYYY-MM-DD");if(t===s){const t=e.type;n.push({id:e.id,start:new Date(e.start),end:new Date(e.end),master_task:null,date:new Date(e.start),project_code:null,subtask:e,blocker:e,type:t,_timeblock_id:null,_timeblock_is_finished:e.is_finished||!1,_real_start:new Date(e.start),_real_end:new Date(e.end)})}}else e.timeblocks?.forEach(t=>{const i=_e()(t.start).format("YYYY-MM-DD");if(i===s){let s="subtask";"office365"===e.type&&(s="office365"),n.push({id:e.id,start:new Date(t.start),end:new Date(t.end),master_task:e.master_task,date:new Date(t.start),project_code:e.project_code,subtask:e,blocker:void 0,type:s,_timeblock_id:t.id,_timeblock_is_finished:t.is_finished,_real_start:new Date(t.start),_real_end:new Date(t.end)})}})}),this.existingTimeblocksData={...this.existingTimeblocksData,[e]:{tasks:n,loading:!1}}}catch(s){Ws.error("Error fetching timeline data for timeblock:",s),this.existingTimeblocksData={...this.existingTimeblocksData,[e]:{tasks:[],loading:!1}}}}else this.existingTimeblocksData={...this.existingTimeblocksData,[e]:{tasks:[],loading:!1}}},async fetchAllTimelinesData(){if(!this.employee?.id)return;const e=this.timeblocks.map((e,t)=>this.fetchTimelineDataForTimeblock(t));await Promise.all(e)},formatTimeblockStart(e){if(e.date&&e.starts_at_time){const t=_e()(e.date).format("DD.MM.yyyy");return`${t}, ${e.starts_at_time}`}return e.start?se.A.formatDateTime(e.start):""},formatTimeblockEnd(e){return e.date&&e.ends_at_time?e.ends_at_time:e.end?se.A.formatDateTime(e.end):""},async submit(){const e=JSON.parse(JSON.stringify(this.subtask));e?.timeblocks||(e.timeblocks=[]),e?.timesheets||(e.timesheets=[]),e?.is_finished||(e.is_finished=0);const t={id:null,date:this.newTimeblock.date,starts_at_time:this.newTimeblock.starts_at_time,ends_at_time:this.newTimeblock.ends_at_time,is_finished:0};if(e.is_draft&&Array.isArray(e.employees)){const s=e.employees.findIndex(e=>e.id==this.subtask.employee_id);-1!==s&&(e.employees[s].timeblocks||(e.employees[s].timeblocks=[]),e.employees[s].timeblocks.push(t))}else e.timeblocks.push(t);e.deadline&&(e.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate()));const s=this.isAfterDeadline();s?this.visible=!0:e.id?this._update(e):(this.$emit("update-unfinished-subtask",e),this.closeModal())},async confirmSubmit(){const e=JSON.parse(JSON.stringify(this.subtask));e?.timeblocks||(e.timeblocks=[]),e?.timesheets||(e.timesheets=[]),e?.is_finished||(e.is_finished=0);const t={id:null,date:this.newTimeblock.date,starts_at_time:this.newTimeblock.starts_at_time,ends_at_time:this.newTimeblock.ends_at_time,is_finished:0};if(e.is_draft&&Array.isArray(e.employees)){const s=e.employees.findIndex(e=>e.id==this.subtask.employee_id);-1!==s&&(e.employees[s].timeblocks||(e.employees[s].timeblocks=[]),e.employees[s].timeblocks.push(t))}else e.timeblocks.push(t);if(e.deadline&&(e.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate())),!e.id)return this.$emit("update-unfinished-subtask",e),void this.closeModal();this.visible=!1,this._update(e)},async toggleTimeblockIsFinished(e,t){if(!e.id)return;const s=JSON.parse(JSON.stringify(this.subtask)),i=JSON.parse(JSON.stringify(e));i.is_finished=1==i.is_finished?0:1;try{const e={id:i.id,is_finished:i.is_finished};if(i.date){const t=_e()(i.date).format("YYYY-MM-DD");e.start=`${t} ${i.starts_at_time}:00`,e.end=`${t} ${i.ends_at_time}:00`}else e.start=i.start,e.end=i.end;const{data:t}=await this.$axios.put_auth(`v1/timeblocks/${i.id}`,e),a=_e()(t.start,"YYYY-MM-DD HH:mm:ss"),l=_e()(t.end,"YYYY-MM-DD HH:mm:ss"),n={id:t.id,date:a.toDate(),starts_at_time:a.format("HH:mm"),ends_at_time:l.format("HH:mm"),is_finished:t.is_finished};if(s.is_draft&&Array.isArray(s.employees)){const e=s.employees.findIndex(e=>e.id==this.subtask.employee_id);-1!==e&&(s.employees[e].timeblocks=s.employees[e].timeblocks.map(e=>e.id==n.id?n:e))}else s.timeblocks=s.timeblocks.map(e=>e.id==n.id?n:e);this.$events.emit("on-subtask-edited",s),this.$emit("update-subtask",s),i.is_finished&&this.$events.emit("show-task-add-time-modal",{subtask:s})}catch(a){this.$toast.error(a.message||a)}},async deleteTimeblock({id:e}){const t=JSON.parse(JSON.stringify(this.subtask));if(t.is_draft&&Array.isArray(t.employees)){let s=!1;t.employees=t.employees.map(t=>{if(!t.timeblocks)return t;const i=t.timeblocks.some(t=>t.id==e);return i?(s=!0,{...t,timeblocks:t.timeblocks.filter(t=>t.id!=e)}):t}),s||Ws.warn("Timeblock not found in any employee",e)}else t.timeblocks=t.timeblocks.filter(t=>t.id!=e);t.deadline&&(t.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate())),this._update(t)},async deleteTimeblockByIndex(e){const t=JSON.parse(JSON.stringify(this.subtask));if(t.is_draft&&Array.isArray(t.employees)){const s=t.employees.findIndex(e=>e.id==this.subtask.employee_id);-1!==s&&t.employees[s].timeblocks&&t.employees[s].timeblocks.splice(e,1)}else t.timeblocks.splice(e,1);t.deadline&&(t.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate())),t.id?this._update(t):this.$emit("update-unfinished-subtask",t)},async _update(e){try{const t=e.timesheets.map(e=>(delete e.employee_name,e)),s={...e,timesheets:t};if(e.is_draft&&Array.isArray(e.employees)){const t=e.employees.filter(e=>e.id).map(e=>({id:e.id,duration:e.duration,timeblocks:(e.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}})}));s.employees=t,delete s.timeblocks}else{const t=(e.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}});s.timeblocks=t}delete s._created_by,delete s._employee,delete s._master_task,delete s._deadline_time;const{subtask:i}=await this.$axios.put_auth(`v1/subtasks/${e.id}`,s);this.closeModal(),this.$events.emit("on-subtask-edited",i)}catch(t){this.$toast.error(t.message||t)}},isAfterDeadline(){const e=this.getDeadline(this.subtask);if(!e)return;const t=_e()(this.newTimeblock.date),s=_e()(e),[i,a]=this.newTimeblock.ends_at_time.split(":").map(Number);return t.hours(i),t.minutes(a),t.isAfter(s)},getDeadline(e){return e?.deadline?e.deadline:e.master_task_deadline},_mergeDeadlineTimeDate(){const e=new Date(this.subtask.deadline),t=this.subtask._deadline_time.split(":");return e.setHours(parseInt(t[0])),e.setMinutes(parseInt(t[1])),e},closeModal(){this.newTimeblock={id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:this.employee?.id||null},this.showModal=!1}}};const Os=(0,A.A)(Vs,[["render",Mt],["__scopeId","data-v-1b2526e6"]]);var Is=Os;const Hs={class:"d-flex align-center"},Ys={class:"employee-selected-avatar d-flex justify-center align-center"},Bs={class:"ml-2"};function Xs(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Hs,[(0,m.bF)(S.w,{icon:"mdi-account-star-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Vytvoril",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3 d-flex align-center"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",Ys,(0,v.v_)(l.employee?l.employee._initials:"?"),1),(0,m.Lk)("p",Bs,(0,v.v_)(l.employee?l.employee?._fullName:e.$t("Unasigned")),1)]),_:1})]),_:1})]),_:1})}var Ns={props:{employeeId:{type:[Number],required:!1}},computed:{...(0,ie.L8)("tm",["enrichedEmployees"]),employee(){return this.enrichedEmployees.find(e=>e.id==this.employeeId)}}};const Ps=(0,A.A)(Ns,[["render",Xs]]);var Us=Ps;const qs={class:"d-flex align-center"},Ks={class:"employee-selected-avatar d-flex justify-center align-center"},Zs=["innerHTML"];function Qs(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",qs,[(0,m.bF)(S.w,{icon:"mdi-account-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Priradený",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3 d-flex align-center"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",Ks,(0,v.v_)(s.employee.name.charAt(0)+s.employee.surname.charAt(0)),1),(0,m.Lk)("p",{class:"ml-2",innerHTML:`${s.employee.name} ${s.employee.surname}`},null,8,Zs)]),_:1})]),_:1})]),_:1})}var Js={props:{employee:{type:Object,required:!0}}};const Gs=(0,A.A)(Js,[["render",Qs]]);var ei=Gs;const ti={class:"d-flex align-center"};function si(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ti,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Naplánovaný čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours)+" h",1)]),_:1})]),_:1})]),_:1})}var ii={props:{hours:{type:Number,required:!0}}};const ai=(0,A.A)(ii,[["render",si]]);var li=ai;const ni={class:"d-flex align-center"},oi={class:"d-flex align-center mb-3"},ri={class:"d-flex align-center flex-start width-100"},di={class:"task-badge rounded-pill"},ui={class:"ml-5"},ci={class:"d-flex justify-space-between align-center"},mi={class:"d-flex align-start"};function hi(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(tt.L,{"no-gutters":""},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ni,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[5]||(t[5]=(0,m.Lk)("p",{class:"mx-3"},"Odpracovaný čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours)+" h",1)]),_:1}),(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",oi,[(0,m.bF)(S.w,{class:"add-date cursor-pointer mr-2",icon:"mdi-plus",size:"medium",onClick:t[0]||(t[0]=e=>l.showModal=!0)}),t[6]||(t[6]=(0,m.Lk)("p",{class:"task-badge rounded-pill"},"Pridať záznam",-1))]),s.subtask.timesheets.length?((0,m.uX)(!0),(0,m.CE)(m.FK,{key:0},(0,m.pI)(s.subtask.timesheets,e=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"d-flex align-center mb-3"},[(0,m.bF)(S.w,{class:"circle-border cursor-pointer mr-2",icon:"mdi-minus",size:"medium",onClick:(0,i.D$)(t=>n.deleteTimesheet(e),["stop"])},null,8,["onClick"]),(0,m.Lk)("div",ri,[(0,m.Lk)("p",di,(0,v.v_)(e.time),1),(0,m.Lk)("p",ui,(0,v.v_)(e.employee_name)+" ("+(0,v.v_)(e.timestamp)+") ",1)])]))),128)):(0,m.Q3)("",!0)]),_:1})]),_:1})]),_:1}),(0,m.bF)(g.p,{modelValue:l.showModal,"onUpdate:modelValue":t[4]||(t[4]=e=>l.showModal=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ci,[t[7]||(t[7]=(0,m.Lk)("h1",null,"Pridať odpracovaný čas",-1)),(0,m.Lk)("div",mi,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[1]||(t[1]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(K.Wx,{modelValue:l.form.hours,"onUpdate:modelValue":t[2]||(t[2]=e=>l.form.hours=e),variant:"solo","bg-color":"white",type:"number",hint:l.v$.form.hours.$errors?l.errorUtils.parseErrors(l.v$.form.hours.$errors):null,class:(0,v.C4)([{error:l.v$.form.hours.$errors.length},"mb-2"]),label:"Odpracovaný čas"},null,8,["modelValue","hint","class"])]),_:1}),(0,m.bF)(b.D,{class:"button primary mt-5",onClick:t[3]||(t[3]=e=>n.submit())},{default:(0,m.k6)(()=>[...t[8]||(t[8]=[(0,m.eW)("Potvrdiť",-1)])]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])],64)}var pi={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],props:{hours:{type:Number,required:!0},subtask:{type:Object,required:!0}},data(){return{moment:_e(),v$:(0,G.Ay)(),errorUtils:te.A,showModal:!1,form:{hours:null},modalName:"a-task-spent-time-modal",modalSize:"medium"}},validations(){return{form:{hours:{required:ee.mw,numeric:ee.sH,minValue:(0,ee.Ww)(.1)}}}},computed:{...(0,ie.L8)("auth",["user"])},methods:{async submit(){if(!await this.v$.$validate())return;const e=JSON.parse(JSON.stringify(this.subtask));e.timesheets.push({id:null,employee_id:this.user.id,time:"string"==typeof this.form.hours?parseFloat(this.form.hours):this.form.hours}),e.deadline&&(e.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate())),this._update(e)},async deleteTimesheet({id:e}){const t=JSON.parse(JSON.stringify(this.subtask));t.timesheets=t.timesheets.filter(t=>t.id!=e),t.deadline&&(t.deadline=se.A.formatDateTimeForBackend(this._mergeDeadlineTimeDate())),this._update(t)},closeModal(){this.form={hours:null},this.showModal=!1,this.$nextTick(()=>this.v$.$reset())},async _update(e){try{const t=e.timesheets.map(e=>(delete e.employee_name,e)),s=(e.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),{subtask:i}=await this.$axios.put_auth(`v1/subtasks/${e.id}`,{...e,timesheets:t,timeblocks:s});this.closeModal(),this.$events.emit("on-subtask-edited",i)}catch(t){this.$toast.error(t.message||t)}},_mergeDeadlineTimeDate(){const e=new Date(this.subtask.deadline),t=this.subtask._deadline_time.split(":");return e.setHours(parseInt(t[0])),e.setMinutes(parseInt(t[1])),e}}};const ki=(0,A.A)(pi,[["render",hi],["__scopeId","data-v-3056b4a7"]]);var vi=ki;const bi={class:"d-flex align-center"};function fi(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",bi,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Zostávajúci čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours.toFixed(2))+" h",1)]),_:1})]),_:1})]),_:1})}var _i={props:{hours:{type:Number,required:!0}}};const gi=(0,A.A)(_i,[["render",fi]]);var yi=gi;const wi={class:"d-flex align-center"};function Di(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",wi,[(0,m.bF)(S.w,{icon:"mdi-calendar-week",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Deadline",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[s.subtask.deadline?((0,m.uX)(),(0,m.CE)("p",{key:0,class:(0,v.C4)(""+(a.tmUtils.isAfter(s.subtask.deadline)?"text-black":"text-red-darken-4"))},(0,v.v_)(a.tmUtils.formatDate(s.subtask.deadline))+" "+(0,v.v_)(l.deadlineTime),3)):((0,m.uX)(),(0,m.Wv)(j.y,{key:1,text:"Deadline z Mastertasku",location:"end"},{activator:(0,m.k6)(({props:e})=>[(0,m.Lk)("span",(0,m.v6)({class:"cursor-pointer"},e),(0,v.v_)(l.getMasterTaskDeadline(s.subtask))+"*",17)]),_:1}))]),_:1})]),_:1})]),_:1})}var Ti={props:{subtask:{type:[String,Object,null],required:!0}},data(){return{tmUtils:se.A}},computed:{...(0,ie.L8)("tm",["mastertasks"]),deadlineTime(){const e=this.subtask?._deadline_time;return e?_e()(e,"HH:mm:ss").format("HH:mm"):""}},methods:{getMasterTaskDeadline(e){return e?.deadline?e.deadline:e.master_task_deadline}}};const Ei=(0,A.A)(Ti,[["render",Di]]);var Mi=Ei;const Ci={key:0,class:"px-5 py-5 border-bottom"},$i=["innerHTML"],xi={key:1,class:"px-5 py-5 border-bottom"},Si=["innerHTML"];function Fi(e,t,s,i,a,l){return(0,m.uX)(),(0,m.CE)(m.FK,null,[s.description?((0,m.uX)(),(0,m.CE)("div",Ci,[t[0]||(t[0]=(0,m.Lk)("p",null,"Popis zadania",-1)),(0,m.Lk)("section",{class:"description-detail px-2 py-2 w-100 rounded mt-2",innerHTML:a.preparedDescription},null,8,$i)])):(0,m.Q3)("",!0),s.mastertaskDescription?((0,m.uX)(),(0,m.CE)("div",xi,[t[1]||(t[1]=(0,m.Lk)("p",null,"Popis mastertasku",-1)),(0,m.Lk)("section",{class:"description-detail px-2 py-2 w-100 rounded mt-2",innerHTML:a.preparedMastertaskDescription},null,8,Si)])):(0,m.Q3)("",!0)],64)}var zi=s(85335),Ai=s.n(zi);const Li=(0,zi.useToast)();function Ri(){const e=window.navigator.platform,t=["Macintosh","MacIntel","MacPPC","Mac68K"],s=["Win32","Win64","Windows","WinCE"];return-1!==t.indexOf(e)?"mac":(s.indexOf(e),"win")}function ji(e){if(!e)return e;const t=Ri();return"mac"===t?(e=e.replace(/\\\\/g,"smb://"),e=e=e.replace(/(smb:\/\/[^\s<>"()]+)/g,function(e){return'<a href="'+e.replace(/\\/g,"/")+'">'+e.replace(/\\/g,"/")+"</a>"})):(e=e.replace(/smb:\/\//g,"\\\\"),e=e.replace(/(\\\\[^\s<>"()]+)/g,function(e){return e=e.replaceAll("/","\\"),'<span style="cursor: pointer; text-decoration: underline" onclick="'+Wi(e)+'">'+e+"</span>"})),e}function Wi(e){return`\n\t\tif (navigator.clipboard && navigator.clipboard.writeText) {\n\t\t\tnavigator.clipboard.writeText('${e.replace(/\\/g,"\\\\")}').then(() => {\n\t\t\t\twindow.toast.success('Link copied to clipboard!')\n\t\t\t}).catch(err => {\n\t\t\t\twindow.toast.error('Failed to copy link to clipboard!')\n\t\t\t});\n\t\t} else {\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.style.position = 'fixed';\n\t\t\tinput.style.opacity = 0;\n\t\t\tinput.style.pointerEvents = 'none';\n\t\t\tinput.value = '${e.replace(/\\/g,"\\\\")}';\n\t\t\tdocument.body.appendChild(input);\n\t\t\tinput.select();\n\t\t\tinput.focus();\n\t\t\tdocument.execCommand('copy');\n\t\t\tdocument.body.removeChild(input);\n\t\t\twindow.toast.success('Link copied to clipboard!')\n\t\t}\n\t`}window.toast=Li;var Vi={props:{description:{type:String||null,default:()=>null},mastertaskDescription:{type:String||null,default:()=>null}},data(){return{copiedIndices:[],preparedDescription:"",preparedMastertaskDescription:""}},mounted(){this.preparedDescription=ji(this.description),this.preparedMastertaskDescription=ji(this.mastertaskDescription)}};const Oi=(0,A.A)(Vi,[["render",Fi]]);var Ii=Oi;const Hi={class:"w-100 d-flex align-center"},Yi=["onClick"],Bi={key:0,class:"d-flex align-center"},Xi=["src"];function Ni(e,t,i,a,l,n){const o=(0,m.g2)("W-loadable");return(0,m.uX)(),(0,m.CE)(m.FK,null,[t[1]||(t[1]=(0,m.Lk)("p",{class:"mt-5"},"Prílohy",-1)),(0,m.Lk)("div",Hi,[(0,m.bF)(o,{content:i.files,"empty-message":"Žiadne prílohy neboli nahraté"},{default:(0,m.k6)(()=>[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(i.files,(e,i)=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:(0,v.C4)(["d-flex align-center flex-wrap",[0===i?"ml-0":"ml-2"]])},[(0,m.bF)(Xe.x,{class:"mt-2"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",{class:"cursor-pointer",onClick:t=>n.downloadFile(e)},(0,v.v_)(e.name),9,Yi),(0,m.bF)(S.w,{class:"mx-1",icon:"mdi-paperclip"}),(0,m.Lk)("p",null,(0,v.v_)((e.file_size/1048576).toFixed(2))+" MB",1)]),_:2},1024),e.isLoading?((0,m.uX)(),(0,m.CE)("div",Bi,[(0,m.Lk)("img",{class:"gif-loader",src:s(28206),alt:"Loading..."},null,8,Xi),t[0]||(t[0]=(0,m.Lk)("p",{class:"ml-2"},"Súbor sa sťahuje, počkajte prosím",-1))])):(0,m.Q3)("",!0)],2))),128))]),_:1},8,["content"])])],64)}var Pi=s(10788),Ui={props:{files:{type:Array,default:()=>[]}},data(){return{isLoading:!1}},methods:{async downloadFile(e){e.isLoading=!0;try{const t=await fetch(e.path),s=await t.blob();Pi.saveAs(s,e.name)}catch(t){this.$toast.error(this.$parseError(t))}finally{e.isLoading=!1}}}};const qi=(0,A.A)(Ui,[["render",Ni],["__scopeId","data-v-31f3e293"]]);var Ki=qi,Zi={components:{ZFiles:Ki,AMastertaskName:rt,AMastertaskStatus:kt,ATaskTimeblocks:Is,ZCreatedBy:Us,ATaskAssignedEmployee:ei,ATaskPlannedTime:li,ATaskSpentTime:vi,ATaskRemainingTime:yi,ATaskDescription:Ii,ATaskDeadline:Mi},props:{subtask:{type:Object,required:!0}},emits:["close-modal","update-subtask"],computed:{...(0,ie.L8)("tm",["enrichedEmployees"]),normalizedEmployees(){return this.subtask.is_draft&&Array.isArray(this.subtask.employees)?this.subtask.employees.filter(e=>e.id).map(e=>({id:e.id,duration:e.duration||0,timeblocks:e.timeblocks||[],_employee:this.enrichedEmployees.find(t=>t.id==e.id)||{}})):[{id:this.subtask.employee_id,duration:this.subtask.duration,timeblocks:this.subtask.timeblocks||[],_employee:this.subtask._employee}]},hasMultipleEmployees(){return!!this.subtask.is_draft||this.normalizedEmployees.length>1}}};const Qi=(0,A.A)(Zi,[["render",et],["__scopeId","data-v-2ec69e38"]]);var Ji=Qi,Gi=s(94348);const ea={class:"employee-select"},ta={class:"employee-select__duration-container"},sa=["disabled"];var ia=(0,m.pM)({__name:"a-employee-select",props:{modelValue:{},customFilter:{type:Function,default:void 0},required:{type:Boolean}},emits:["update:modelValue","clearEmployee"],setup(e,{expose:t,emit:s}){const i=e,a=s,l=(0,ie.Pj)(),n=(0,Ct.KR)(null),o=(0,Ct.KR)(0),r=(0,m.EW)(()=>{const e=l.getters["tm/enrichedEmployees"]||[];return e.map(e=>({...e,_fullName:e._fullName||`${e.name||""} ${e.surname||""}`.trim()||`Employee ${e.id}`}))}),d=e=>{if(e&&"object"===typeof e&&e._fullName)return e._fullName;if(e&&("string"===typeof e||"number"===typeof e)){const t=r.value.find(t=>t.id==e);return t?._fullName||`Employee ${e}`}return""};(0,m.wB)(()=>r.value.length,(e,t)=>{e>0&&e!==t&&(0,m.dY)(()=>{o.value++})},{immediate:!0}),(0,m.wB)(()=>i.modelValue.id,e=>{e&&r.value.length>0&&(0,m.dY)(()=>{o.value++})});const{modelValue:u}=(0,Ct.QW)(i),c=e=>t=>{const{id:s,duration:i}=u.value,a=!(!s&&!i);return!a||("id"===e?!!s:null!==i&&void 0!==i)},h=(0,m.EW)(()=>i.required?{id:{required:ee.mw},duration:{required:ee.mw}}:{id:{requiredWhenPaired:ee._$.withMessage("Vyberte zamestnanca",c("id"))},duration:{requiredWhenPaired:ee._$.withMessage("Zadajte časový odhad",c("duration"))}}),p=(0,G.fG)(h.value,u,{$autoDirty:!1}),k=e=>{a("update:modelValue",{...i.modelValue,id:e})},b=e=>{const t=parseFloat(e);a("update:modelValue",{...i.modelValue,duration:isNaN(t)?null:t})},f=()=>{a("clearEmployee")},_=async(e=!1)=>{if(e){const{id:e,duration:t}=u.value;if(!e||null===t||void 0===t)return p.value.$touch(),!1}p.value.$touch();const t=await p.value.$validate();return t};return(0,m.sV)(()=>{setTimeout(()=>{Gi.log("Employee select ref:",n.value)},1e3)}),t({validate:_}),(t,s)=>((0,m.uX)(),(0,m.CE)("div",ea,[((0,m.uX)(),(0,m.Wv)(q.V,{key:`employee-select-${o.value}`,ref_key:"employeeSelectRef",ref:n,"model-value":(0,Ct.R1)(u).id,"custom-filter":e.customFilter,"match-any":!0,label:"Priradený",items:r.value,"item-title":d,"item-value":"id",variant:"solo",class:(0,v.C4)(["employee-select__select-field",{error:(0,Ct.R1)(p).id.$error}]),"error-messages":(0,Ct.R1)(p).id.$errors.map(e=>String(e.$message)),"onUpdate:modelValue":k},null,8,["model-value","custom-filter","items","class","error-messages"])),(0,m.Lk)("div",ta,[(0,m.bF)(K.Wx,{"model-value":(0,Ct.R1)(u).duration,class:(0,v.C4)(["employee-select__duration-field",{error:(0,Ct.R1)(p).duration.$error}]),variant:"solo",type:"number",label:"Časový odhad","error-messages":(0,Ct.R1)(p).duration.$errors.map(e=>String(e.$message)),"append-inner-icon":"mdi-clock-outline","onUpdate:modelValue":b},null,8,["model-value","class","error-messages"]),(0,m.Lk)("button",{class:"employee-select__delete-button",disabled:!(0,Ct.R1)(u).id,onClick:f},[(0,m.bF)(S.w,{icon:"mdi-close"})],8,sa)])]))}});const aa=(0,A.A)(ia,[["__scopeId","data-v-141c1add"]]);var la=aa;const na={key:0,class:"employee__timeblocks"};var oa=(0,m.pM)({__name:"a-employee",props:{employeeData:{},timeblocks:{default:()=>[]},allTimeblocks:{default:()=>[]},deletedTimeblockIds:{default:()=>[]},draftTimeblocks:{default:()=>[]},customFilter:{type:Function,default:void 0},hasBackground:{type:Boolean,default:!0},required:{type:Boolean,default:!1}},emits:["update:employeeData","update:timeblocks","clearEmployee","addTimeblock"],setup(e,{expose:t,emit:s}){const i=e,a=s,l=(0,ie.Pj)(),n=(0,m.EW)({get:()=>i.employeeData,set:e=>a("update:employeeData",e)}),o=(0,Ct.KR)(null),r=(0,Ct.KR)([]),d=(e,t)=>{e&&(r.value[t]=e)},u=(0,m.EW)(()=>{if(!i.employeeData.id)return null;const e=l.getters["tm/enrichedEmployees"];return e.find(e=>e.id==i.employeeData.id)||null}),c=(0,m.EW)(()=>i.employeeData.id?i.allTimeblocks.filter(e=>e.employee_id==i.employeeData.id):[]);(0,m.wB)(()=>i.employeeData.id,(e,t)=>{e&&!t&&0===i.timeblocks.length&&(0,m.dY)(()=>{a("addTimeblock",-1)})},{flush:"post"}),(0,m.sV)(()=>{i.employeeData.id&&0===i.timeblocks.length&&(0,m.dY)(()=>{a("addTimeblock",-1)})});const h=()=>{a("clearEmployee")},p=(e,t)=>{const s=[...i.timeblocks];s[e]=t,a("update:timeblocks",s)},k=e=>{const t=[...i.timeblocks];t.splice(e,1),a("update:timeblocks",t)},b=e=>{a("addTimeblock",e)},f=async()=>{let e=!0;if(o.value){const t=await o.value.validate();e=e&&t}for(const t of r.value)if(t){const s=await t.validate();e=e&&s}return e};return t({validate:f}),(t,s)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["employee",{"employee--has-background":e.hasBackground}])},[(0,m.bF)(la,{ref_key:"employeeSelectRef",ref:o,modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=e=>n.value=e),"custom-filter":e.customFilter,required:e.required,onClearEmployee:h},null,8,["modelValue","custom-filter","required"]),u.value?((0,m.uX)(),(0,m.CE)("div",na,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(e.timeblocks,(t,s)=>((0,m.uX)(),(0,m.Wv)(js,{key:t._clientId||t.id||`timeblock-${s}`,ref_for:!0,ref:e=>d(e,s),"model-value":t,employee:u.value,"all-employee-timeblocks":e.timeblocks,"all-timeblocks":c.value,"deleted-timeblock-ids":e.deletedTimeblockIds,"draft-timeblocks":e.draftTimeblocks,"current-index":s,deletable:e.timeblocks.length>1,index:s,"onUpdate:modelValue":e=>p(s,e),onAddTimeblock:e=>b(s),onRemoveTimeblock:e=>k(s)},null,8,["model-value","employee","all-employee-timeblocks","all-timeblocks","deleted-timeblock-ids","draft-timeblocks","current-index","deletable","index","onUpdate:modelValue","onAddTimeblock","onRemoveTimeblock"]))),128))])):(0,m.Q3)("",!0)],2))}});const ra=(0,A.A)(oa,[["__scopeId","data-v-f79dcc74"]]);var da=ra;const ua={class:"d-flex justify-space-between align-center"},ca={class:"d-flex align-start"};function ma(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ua,[t[4]||(t[4]=(0,m.Lk)("h1",null," Naozaj chcete odstrániť tohto zamestnanca a všetky jeho timeblocks? ",-1)),(0,m.Lk)("div",ca,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{class:"mb-15",onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",onClick:t[1]||(t[1]=e=>n.confirm())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("ÁNO",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var ha={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["confirm"],data(){return{visible:!1,modalName:"z-remove-employee-modal",modalSize:"small"}},methods:{showModal(){this.visible=!0},closeModal(){this.visible=!1},confirm(){this.$emit("confirm"),this.closeModal()}}};const pa=(0,A.A)(ha,[["render",ma]]);var ka=pa;const va={class:"d-flex justify-space-between align-center"},ba={class:"d-flex align-start"};function fa(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",va,[t[4]||(t[4]=(0,m.Lk)("h1",null,"Naozaj chcete odstrániť tento timeblock?",-1)),(0,m.Lk)("div",ba,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{class:"mb-15",onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",onClick:t[1]||(t[1]=e=>n.confirm())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("ÁNO",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var _a={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],data(){return{visible:!1,modalName:"z-remove-timeblock-modal",modalSize:"small",onConfirmCallback:null}},methods:{showModal({onConfirm:e}){this.onConfirmCallback=e,this.visible=!0},closeModal(){this.visible=!1,this.onConfirmCallback=null},confirm(){this.onConfirmCallback&&this.onConfirmCallback(),this.closeModal()}}};const ga=(0,A.A)(_a,[["render",fa]]);var ya=ga,wa=s(94348),Da={components:{ZTaskReadonlyInfo:Ji,AEmployee:da,ZFilesUpload:Je,ZDatepicker:Be,QuillEditor:r.tB,AResizeHandle:R,AResetSizeButton:I,ACloseButton:X,ZRemoveEmployeeModal:ka,ZRemoveTimeblockModal:ya},mixins:[Ge,ae.A,x],emits:["close","refresh"],data(){return{tmUtils:se.A,editMode:!1,visible:!1,subtask:null,isSaving:!1,errorUtils:te.A,v$:(0,G.Ay)(),showDatePicker:!1,selectedNewDate:[],timeblocks:[],deletedTimeblockIds:[],wasFormValidationTriggered:!1,modalName:"z-task-modal",modalSize:"large",employeeRefs:[],pendingRemoveEmployeeId:void 0,pendingRemoveEmployeeIndex:void 0,timeblockClientIdCounter:0}},computed:{...(0,ie.L8)("tm",["mastertasks","enrichedEmployees"]),enrichedMastertasks(){return this.mastertasks.map(e=>({...e,_fullName:`${e.name} [${e.project_code}]`}))},editModeEmployee:{get(){return{id:this.subtask?.employee_id||null,duration:this.subtask?.duration||null}},set(e){this.subtask&&(this.subtask.employee_id=e.id,this.subtask.duration=e.duration)}},isDraftWithMultipleEmployees(){return this.subtask?.is_draft&&Array.isArray(this.subtask?.employees)&&this.subtask.employees.length>0}},validations(){return{subtask:{master_task_id:{required:ee.mw},deadline:{required:ee.mw},_deadline_time:{required:ee.mw}}}},watch:{"subtask.employee_id"(e,t){e&&t&&(this.subtask.id?this.timeblocks=this.timeblocks.map(s=>s.employee_id==t?{...s,employee_id:e}:s):this.timeblocks=this.timeblocks.filter(e=>e.employee_id!=t),this.subtask._employee=this.enrichedEmployees.find(e=>e.id==this.subtask.employee_id))},"subtask.employees":{handler(){if(!this.subtask?.employees)return;const e=this.subtask.employees[this.subtask.employees.length-1];(e?.id||e?.duration)&&this.subtask.employees.push({})},deep:!0},"subtask.master_task_id"(e){e&&(this.subtask._master_task=this.mastertasks.find(e=>e.id==this.subtask.master_task_id),this.subtask.project_code=this.subtask._master_task?.project_code||null)},editMode(){this.$nextTick(()=>{this.$refs["description"]?.setHTML(this.subtask.description||"")})},subtask:{handler(e){if(this.editMode&&!this.subtask?.id){const t=e?.employees?.filter(e=>e?.id||e?.duration)||[{}],s={...e,employees:t&&t.length>0?t:[{}]};localStorage.setItem("subtaskData",JSON.stringify(s))}},deep:!0},timeblocks:{handler(e){this.editMode&&!this.subtask?.id&&localStorage.setItem("subtaskTimeblocks",JSON.stringify(e))},deep:!0}},mounted(){this.$events.on("show-remove-timeblock-modal",({onConfirm:e})=>{this.$refs.removeTimeblockModal.showModal({onConfirm:e})}),this.$events.on("add-timeblock",e=>{this.subtask&&(this.subtask.timeblocks||(this.subtask.timeblocks=[]),this.subtask.timesheets||(this.subtask.timesheets=[]),this.subtask.is_finished||(this.subtask.is_finished=0),this.subtask.timeblocks.push(e))}),this.$events.on("on-subtask-edited",e=>{if(e?.id!==this.subtask?.id)return;const t=JSON.parse(JSON.stringify(e)),s=t.deadline?.split(" ")||[];if(t.deadline=s[0],t._deadline_time=s[1],t.is_draft&&Array.isArray(t.employees)){const e=[];t.employees=t.employees.map(t=>{const s=(t.timeblocks||[]).map(e=>this._convertTimeblockToInternal(e,t.id)).filter(Boolean);return e.push(...s),{...t,timeblocks:s}}),this.timeblocks=e}else this.timeblocks=(t.timeblocks||[]).map(e=>this._convertTimeblockToInternal(e,t.employee_id)).filter(Boolean);this.subtask=this._enrichTask(t),this.$forceUpdate()}),this.$events.on("on-subtask-deleted",e=>{e?.id==this.subtask?.id&&this.closeModal()})},methods:{_convertTimeblockToInternal(e,t){if(e.date)return{...e,_clientId:e._clientId||"client-"+ ++this.timeblockClientIdCounter,employee_id:t};if(e.start&&e.end){const s=_e()(e.start,"YYYY-MM-DD HH:mm:ss"),i=_e()(e.end,"YYYY-MM-DD HH:mm:ss");return{id:e.id||null,_clientId:e._clientId||"client-"+ ++this.timeblockClientIdCounter,date:s.toDate(),starts_at_time:s.format("HH:mm"),ends_at_time:i.format("HH:mm"),is_finished:e.is_finished||0,employee_id:t}}return null},customFilterWithEmployeeFilter(e,t,s){const i=this.customFilter(e,t);if(!i)return!1;if(!s?.value)return!1;const a=s.value;if(this.subtask.id){if(this.subtask.is_draft){const e=Array.isArray(this.subtask.employees)&&this.subtask.employees.some(e=>e.id&&Number(e.id)===a);return i&&!e}return i}{const e=Array.isArray(this.subtask.employees)&&this.subtask.employees.some(e=>e.id&&Number(e.id)===a);return i&&!e}},toggleEditMode(){if("office365"==this.subtask.type)return this.$events.emit("show-unable-to-edit-office-task-modal",{mode:"edit"});this.editMode=!this.editMode},setEmployeeRef(e,t){e&&(this.employeeRefs[t]=e)},openDatepicker(e){this.$refs[e].openMenu()},getEmployeeById(e){return this.enrichedEmployees.find(t=>t.id===e)},getEmployeeFullName(e){const t=this.getEmployeeById(e);return t?`${t.name} ${t.surname}`:""},getEnrichedEmployee(e){return this.enrichedEmployees.find(t=>t.id===e)||{}},getValidEmployees(){return this.subtask?.employees?this.subtask.employees.filter(e=>e.id&&e.duration):[]},getEmployeeTimeblocks(e){return this.timeblocks&&e?this.timeblocks.filter(t=>t.employee_id&&Number(t.employee_id)===Number(e)):[]},updateEmployeeTimeblocks(e,t){const s=new Set(e.filter(e=>e.id).map(e=>e.id)),i=this.timeblocks.filter(e=>e.employee_id==t&&e.id&&!s.has(e.id)).map(e=>e.id).filter(e=>!this.deletedTimeblockIds.includes(e));this.deletedTimeblockIds.push(...i);const a=this.timeblocks.filter(e=>e.employee_id!=t),l=e.map(e=>({...e,employee_id:t}));this.timeblocks=[...a,...l]},updateTimeblock(e,t,s){const i=this.getEmployeeTimeblocks(s),a=i[t];if(!a)return;const l=this.timeblocks.indexOf(a);-1!==l&&(this.timeblocks[l]={...e,employee_id:s})},addTimeblock(e,t=-1){const s={_clientId:"client-"+ ++this.timeblockClientIdCounter,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:e},i=this.timeblocks.filter(t=>t.employee_id==e);if(-1===t||t>=i.length-1)this.timeblocks.push(s);else{const e=i[t],a=this.timeblocks.indexOf(e)+1;this.timeblocks.splice(a,0,s)}},removeTimeblock(e,t){const s=this.getEmployeeTimeblocks(t),i=s[e];if(!i)return;const a=this.timeblocks.indexOf(i);-1!==a&&this.timeblocks.splice(a,1)},handleRemoveEmployee(){this.pendingRemoveEmployeeId=this.subtask.employee_id,this.$refs.removeEmployeeModal.showModal()},removeEmployeeAtIndex(e){this.pendingRemoveEmployeeIndex=e,this.$refs.removeEmployeeModal.showModal()},confirmRemoveEmployee(){if(void 0!==this.pendingRemoveEmployeeId)this.subtask.employee_id&&(this.timeblocks=this.timeblocks.filter(e=>e.employee_id!=this.subtask.employee_id)),this.subtask.employee_id=null,this.subtask.duration=null,this.pendingRemoveEmployeeId=void 0;else if(void 0!==this.pendingRemoveEmployeeIndex&&Array.isArray(this.subtask.employees)){const e=this.subtask.employees[this.pendingRemoveEmployeeIndex];e?.id&&(this.timeblocks=this.timeblocks.filter(t=>t.employee_id!=e.id)),this.subtask.employees.splice(this.pendingRemoveEmployeeIndex,1),this.pendingRemoveEmployeeIndex=void 0}},async showModal({subtask:e,editMode:t=!1,mastertask:s={}}){this.isSaving=!1,this.subtask=null,this.wasFormValidationTriggered=!1,this.preventInputFocus=!0,this.visible=!0,this.timeblocks=[],this.deletedTimeblockIds=[],this.employeeRefs=[],this.$nextTick(()=>{this.v$.$reset(),setTimeout(()=>{this.preventInputFocus=!1},300)});try{if(e?.id){const s=await this.$axios.get_auth_data(`v1/subtasks/${e.id}`);if(s.is_draft&&s.employees&&Array.isArray(s.employees)){const e=[];s.employees=s.employees.map(t=>{const s=(t.timeblocks||[]).map(e=>this._convertTimeblockToInternal(e,t.id)).filter(Boolean);return e.push(...s),{...t,timeblocks:s}}),this.timeblocks=e;const t=s.employees[s.employees.length-1];t&&(t.id||t.duration)&&s.employees.push({})}else this.timeblocks=(s.timeblocks||[]).map(e=>this._convertTimeblockToInternal(e,s.employee_id)).filter(Boolean);if(s.employee_id&&!s.is_draft&&0===this.timeblocks.length&&this.addTimeblock(s.employee_id),!s.deadline)return this.subtask=this._enrichTask(s),this.editMode=t||!s.id,void this.$nextTick(()=>{this.$refs["description"]&&this.$refs["description"].setHTML(this.subtask.description||"")});const i=s.deadline.split(" ");s.deadline=i[0],s._deadline_time=i[1],this.subtask=this._enrichTask(s)}else{const t=localStorage.getItem("subtaskData"),l=localStorage.getItem("subtaskTimeblocks");try{if(!t)throw new Error("subtaskData is null or undefined");{const e=JSON.parse(t);if(this.subtask=e,"object"!==typeof this.subtask||null===this.subtask)throw new Error("Parsed subtask is not an object");if(l)try{let e=JSON.parse(l);e=e.filter(e=>e.employee_id&&e.starts_at_time&&e.ends_at_time),Array.isArray(e)?this.timeblocks=e.map(e=>({...e,_clientId:e._clientId||"client-"+ ++this.timeblockClientIdCounter,date:e.date?new Date(e.date):null})):this.timeblocks=[]}catch(i){wa.error("Error parsing saved timeblocks:",i),this.timeblocks=[]}this.$nextTick(()=>{this.$refs["description"]?.setHTML(this.subtask.description||"")})}}catch(a){const e=this.$store.getters["auth/user"]?.id,t=e?this.enrichedEmployees.find(t=>t.id===e):null;this.subtask={master_task:s,employees:t?[{id:t.id,duration:null}]:[{}],_deadline_time:"17:00"},e&&this.addTimeblock(e)}if(e?.deadline&&e._deadline_time&&e.employee_id){const t=this.enrichedEmployees.find(t=>t.id==e.employee_id),s=this.$store.getters["auth/user"]?.id,i=s===e.employee_id;this.subtask.employees=i?[t]:[{id:s,duration:null},t],this.subtask.deadline=e.deadline,this.subtask._deadline_time=e._deadline_time,setTimeout(()=>{this.timeblocks=[...i?[]:[{_clientId:"client-"+ ++this.timeblockClientIdCounter,date:new Date(e.deadline),starts_at_time:e._deadline_time,ends_at_time:null,employee_id:s}],{_clientId:"client-"+ ++this.timeblockClientIdCounter,date:new Date(e.deadline),starts_at_time:e._deadline_time,ends_at_time:null,employee_id:e.employee_id}]},500)}e?.master_task_id&&e?.project_code&&(this.subtask.master_task_id=e.master_task_id,this.subtask.project_code=e.project_code)}this.editMode=t||!this.subtask.id,this.editMode&&this.$nextTick(()=>{this.$refs["description"]&&this.$refs["description"].setHTML(this.subtask?.description||"")})}catch(a){this.$toast.error(this.$parseError(a))}},deleteTimeblock(e){this.subtask.timeblocks.splice(e,1)},closeModal(){this.visible=!1,this.$router.replace({name:this.$route.name})},async validate(e=!1){if(!1===e){const e=await this._validateEmployees(),t=await this._validateTimeblocks();if(!await this.v$.$validate())return;if(!e||!t)return;return!0}return this.v$.subtask.master_task_id.$touch(),0===this.v$.subtask.master_task_id.$errors.length},async save(e=!1){if(this.v$.$reset(),this.wasFormValidationTriggered=!0,await this.validate(e)){this.subtask.description=this.$refs["description"].getHTML(),this._mergeDeadlineTimeDate();try{if(this.isSaving=!0,this.subtask.deadline=this.subtask.deadline?_e()(this.subtask.deadline).format("YYYY-MM-DD HH:mm:SS"):null,this.subtask?.id){const t=this.subtask.timesheets.map(e=>(delete e.employee_name,e)),s=(this.subtask.files||[]).filter(e=>e instanceof File);this.subtask.files=s;const i=this.subtask.is_draft&&this.isDraftWithMultipleEmployees?[]:this.timeblocks.filter(e=>e.date&&e.starts_at_time&&e.ends_at_time&&Number(e.employee_id)===Number(this.subtask.employee_id)).map(e=>{const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),a={...this.subtask,timesheets:t,timeblocks:i};if(this.subtask.is_draft&&this.isDraftWithMultipleEmployees){const t=this._filterValidEmployees(this.subtask.employees,e);t.forEach(e=>{const t=this._getEmployeeTimeblocks(e.id,!0);e.timeblocks=t.map(e=>({start:`${_e()(e.date).format("YYYY-MM-DD")} ${e.starts_at_time}:00`,end:`${_e()(e.date).format("YYYY-MM-DD")} ${e.ends_at_time}:00`,id:e.id||null}))}),a.employees=t}a.is_draft=e?1:0;const{subtask:l}=await this.$axios.patch_auth_form(`v1/subtasks/${this.subtask.id}`,a);localStorage.removeItem("subtaskData"),localStorage.removeItem("subtaskTimeblocks"),this.$store.commit("tm/update_subtask",l),this.$events.emit("on-subtask-edited",this.subtask)}else{const t=this._filterValidEmployees(this.subtask.employees,e);t.forEach(e=>{const t=this._getEmployeeTimeblocks(e.id,!0);e.timeblocks=t.map(e=>({start:`${_e()(e.date).format("YYYY-MM-DD")} ${e.starts_at_time}:00`,end:`${_e()(e.date).format("YYYY-MM-DD")} ${e.ends_at_time}:00`,id:null}))});const s={...this.subtask,employees:t};e&&(s.is_draft=!0,s.employees=s.employees?.length>0?s.employees:[{id:this.$store.getters["auth/user"]?.id,duration:0}]),delete s._master_task;const{subtasks:i}=await this.$axios.post_auth(`v1/mastertasks/${this.subtask.master_task_id}/subtasks`,s);localStorage.removeItem("subtaskData"),localStorage.removeItem("subtaskTimeblocks"),this.subtask.id=i[0].id,i.forEach(e=>{this.$store.commit("tm/update_subtask",e),this.$events.emit("on-subtask-edited",this.subtask)}),this.$events.emit("task-created"),this.$events.emit("close-both-modals")}this.closeModal()}catch(t){wa.log("error",t),this.$toast.error(this.$parseError(t))}finally{this.isSaving=!1}}},openDeleteTaskModal(e){if("office365"==e.type)return this.$events.emit("show-unable-to-edit-office-task-modal",{mode:"delete"});this.$events.emit("show-delete-task-modal",{subtask:e})},showCompleteTaskModal(){this.$events.emit("show-complete-task-modal",{subtask:this.subtask}),this.subtask.deadline&&(this.subtask.deadline=se.A.formatDateTimeForBackend(this.subtask.deadline))},filesUploaded(e){this.subtask.files=e},updateSubtask(e){this.subtask=e},_mergeDeadlineTimeDate(){const e=!isNaN(new Date(this.subtask.deadline).getTime());if(!e)return void(this.subtask.deadline=null);const t=new Date(this.subtask.deadline);if(this.subtask._deadline_time){const e=this.subtask._deadline_time.split(":");t.setHours(parseInt(e[0])),t.setMinutes(parseInt(e[1]))}else t.setHours(23),t.setMinutes(59);this.subtask.deadline=t},_filterValidEmployees(e,t){return Array.isArray(e)?e.filter(e=>t?e.id:e.id&&e.duration):[]},_getEmployeeTimeblocks(e,t=!0){const s=this.timeblocks.filter(s=>{const i=Number(s.employee_id)===Number(e);return t?i&&s.date&&s.starts_at_time&&s.ends_at_time:i});return s},async _validateEmployees(){if(this.subtask.id&&!this.subtask.is_draft){const e=!(!this.subtask.employee_id||!this.subtask.duration);return e}{let e=!0;for(let t=0;t<this.employeeRefs.length;t++){const s=this.employeeRefs[t];s&&"function"===typeof s.validate&&(await s.validate()||(e=!1))}return e}},async _validateTimeblocks(){let e=!0;for(const t of this.timeblocks){const s=!!t.starts_at_time,i=!!t.ends_at_time,a=s||i;if(!a)continue;const l=!!t.date;if(!l||!s||!i){e=!1;break}const n=_e()(t.date).format("YYYY-MM-DD"),o=_e()(`${n} ${t.starts_at_time}`,"YYYY-MM-DD HH:mm"),r=_e()(`${n} ${t.ends_at_time}`,"YYYY-MM-DD HH:mm");if(r.isSameOrBefore(o)){e=!1;break}}return e},_enrichTask(e){return{...e,_created_by:this.enrichedEmployees.find(t=>t.id==e.created_by),_employee:this.enrichedEmployees.find(t=>t.id==e.employee_id),_master_task:this.mastertasks.find(t=>t.id==e.master_task_id)}}}};const Ta=(0,A.A)(Da,[["render",je],["__scopeId","data-v-81e1c720"]]);var Ea=Ta;const Ma={class:"d-flex justify-space-between align-center"},Ca={class:"d-flex align-start"};function $a(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Ma,[(0,m.Lk)("h1",null,[t[4]||(t[4]=(0,m.eW)(" Ste si istý, že chcete zmazať ",-1)),(0,m.Lk)("b",null,(0,v.v_)(l.blocker.name),1),t[5]||(t[5]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",Ca,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{class:"mb-15",onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",disabled:l.isDeleting,onClick:t[1]||(t[1]=e=>n.deleteBlocker())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ÁNO",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[7]||(t[7]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var xa={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["on-blocker-deleted"],data(){return{visible:!1,blocker:null,isDeleting:!1,modalName:"z-delete-blocker-modal",modalSize:"small"}},methods:{async showModal({blocker:e}){this.blocker=e,this.visible=!0},closeModal(){this.visible=!1},async deleteBlocker(){if(!this.isDeleting){this.isDeleting=!0;try{await this.$axios.delete_auth(`v1/blockers/${this.blocker.id}`),this.$emit("on-blocker-deleted",this.blocker),this.closeModal()}catch(e){this.$toast.error(this.$parseError(e))}finally{this.isDeleting=!1}}}}};const Sa=(0,A.A)(xa,[["render",$a]]);var Fa=Sa;const za={class:"d-flex justify-space-between align-center"},Aa={class:"d-flex align-start"};function La(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",za,[(0,m.Lk)("h1",null,[(0,m.eW)(" Ste si istý, že chcete "+(0,v.v_)(l.subtask.is_finished?"znovu otvoriť":"dokončiť")+" sub task, z mastertasku ",1),(0,m.Lk)("b",null,(0,v.v_)(l.subtask?.master_task?.name||l.subtask.master_task),1),t[4]||(t[4]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",Aa,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",onClick:t[1]||(t[1]=e=>n.complete())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("ÁNO",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>l.visible=!1,["stop"]))},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var Ra={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["close","on-subtask-edited"],data(){return{visible:!1,subtask:null,modalName:"z-complete-task-modal",modalSize:"small"}},methods:{async showModal({subtask:e}){this.subtask=e,this.visible=!0},async complete(){try{const e=this.subtask.timesheets.map(e=>(delete e.employee_name,e)),t=(this.subtask.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),s={...this.subtask,is_finished:this.subtask.is_finished?0:1,timesheets:e,timeblocks:t},{subtask:i}=await this.$axios.put_auth(`v1/subtasks/${s.id}`,s);this.visible=!1,this.$emit("on-subtask-edited",i)}catch(e){this.$toast.error(this.$parseError(e))}},closeModal(){this.visible=!1}}};const ja=(0,A.A)(Ra,[["render",La]]);var Wa=ja;const Va={class:"d-flex justify-space-between align-center"},Oa={class:"d-flex align-start"};function Ia(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Va,[(0,m.Lk)("h1",null,[(0,m.eW)(" Ste si istý, že chcete "+(0,v.v_)(l.mastertask.is_finished?"znovu otvoriť":"dokončiť")+" ",1),(0,m.Lk)("b",null,(0,v.v_)(l.mastertask?.name),1),t[4]||(t[4]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",Oa,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=()=>l.visible=!1)})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",onClick:t[1]||(t[1]=e=>n.complete())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("ÁNO",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>l.visible=!1,["stop"]))},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var Ha={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["close","master-task-edited"],data(){return{visible:!1,mastertask:null,modalName:"z-complete-master-task-modal",modalSize:"small"}},methods:{async showModal({mastertask:e}){this.mastertask=e,this.visible=!0},async complete(){try{const e={...this.mastertask,is_finished:this.mastertask.is_finished?0:1},{mastertask:t}=await this.$axios.put_auth(`v1/mastertasks/${e.id}`,e);this.visible=!1,this.$emit("master-task-edited",t),this.$events.emit("close-both-modals")}catch(e){this.$toast.error(this.$parseError(e))}}}};const Ya=(0,A.A)(Ha,[["render",Ia]]);var Ba=Ya;const Xa={class:"d-flex justify-space-between align-center"},Na={class:"d-flex align-start"};function Pa(e,t,s,i,a,l){const n=(0,m.g2)("a-reset-size-button"),o=(0,m.g2)("a-close-button"),r=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:a.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>a.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Xa,[t[4]||(t[4]=(0,m.Lk)("h1",null,"Pridať odpracovaný čas",-1)),(0,m.Lk)("div",Na,[(0,m.bF)(n,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(o,{onClose:t[0]||(t[0]=e=>l.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(K.Wx,{modelValue:a.form.hours,"onUpdate:modelValue":t[1]||(t[1]=e=>a.form.hours=e),variant:"solo","bg-color":"white",type:"number",hint:a.v$.form.hours.$errors?a.errorUtils.parseErrors(a.v$.form.hours.$errors):null,class:(0,v.C4)([{error:a.v$.form.hours.$errors.length},"mb-2"]),label:"Odpracovaný čas"},null,8,["modelValue","hint","class"])]),_:1}),(0,m.bF)(b.D,{class:"button primary mt-5",onClick:t[2]||(t[2]=e=>l.submit())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("Potvrdiť",-1)])]),_:1}),(0,m.bF)(r,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var Ua={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["close","on-subtask-edited"],data(){return{v$:(0,G.Ay)(),errorUtils:te.A,visible:!1,subtask:null,form:{hours:null},modalName:"z-task-add-time-modal",modalSize:"medium"}},validations(){return{form:{hours:{required:ee.mw,numeric:ee.sH,minValue:(0,ee.Ww)(.1)}}}},methods:{async showModal({subtask:e}){e.is_draft?this.$toast.info("Pre koncepty použite režim úprav"):(this.subtask=e,this.visible=!0,this.form.hours=null,this.$nextTick(()=>this.v$.$reset()))},async submit(){if(!await this.v$.$validate())return;this.subtask.deadline&&(this.subtask.deadline=se.A.formatDateTimeForBackend(this.subtask.deadline)),this.subtask.timesheets.push({id:null,employee_id:this.subtask.employee_id,time:"string"==typeof this.form.hours?parseFloat(this.form.hours):this.form.hours});const e=this.subtask.timesheets.map(e=>(delete e.employee_name,e)),t=(this.subtask.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),s={...this.subtask,timesheets:e,timeblocks:t};try{const{subtask:e}=await this.$axios.put_auth(`v1/subtasks/${this.subtask.id}`,s);this.closeModal(),this.$events.emit("on-subtask-edited",e)}catch(i){this.$toast.error(i.message||i)}},closeModal(){this.visible=!1,this.v$.$reset()}}};const qa=(0,A.A)(Ua,[["render",Pa]]);var Ka=qa;const Za={class:"d-flex justify-space-between align-center modal-header"},Qa={class:"d-flex align-center"};function Ja(e,t,s,i,a,l){const n=(0,m.g2)("a-reset-size-button"),o=(0,m.g2)("a-close-button"),r=(0,m.g2)("a-employee-timeblock"),d=(0,m.g2)("a-resize-handle"),u=(0,m.g2)("W-loadable");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:a.visible,"onUpdate:modelValue":t[5]||(t[5]=e=>a.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(u,{content:a.blocker,class:"h-100"},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"},class:"d-flex flex-column"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Za,[(0,m.Lk)("h1",null,(0,v.v_)(a.blocker.id?"Upraviť":"Vytvoriť")+" blocker",1),(0,m.Lk)("div",Qa,[(0,m.bF)(n,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(o,{onClose:t[0]||(t[0]=e=>l.closeModal())})])]),(0,m.bF)(_.S,{class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.bF)(K.Wx,{modelValue:a.blocker.name,"onUpdate:modelValue":t[1]||(t[1]=e=>a.blocker.name=e),class:(0,v.C4)(["modal-input",{error:a.v$.blocker.name.$errors.length}]),label:"Názov blockeru",hint:a.v$.blocker.name.$errors?a.errorUtils.parseErrors(a.v$.blocker.name.$errors):null,variant:"solo"},null,8,["modelValue","class","hint"]),(0,m.bF)(q.V,{modelValue:a.blocker.employee_id,"onUpdate:modelValue":t[2]||(t[2]=e=>a.blocker.employee_id=e),"custom-filter":e.customFilter,"match-any":!0,clearable:"",label:"Vyhľadať zamestnanca",items:e.enrichedEmployees,"item-title":"_fullName","item-value":"id",variant:"solo",class:"modal-input",error:!l.selectedEmployee&&a.blocker.employee_id,hint:!l.selectedEmployee&&a.blocker.employee_id?"Zamestnanec neexistuje":null},null,8,["modelValue","custom-filter","items","error","hint"]),(0,m.bF)(r,{ref:"employeeTimeblockRef",modelValue:a.timeblockData,"onUpdate:modelValue":t[3]||(t[3]=e=>a.timeblockData=e),employee:l.selectedEmployee,"editing-blocker-id":a.blocker.id,deletable:!1,index:0},null,8,["modelValue","employee","editing-blocker-id"])]),_:1}),(0,m.bF)(b.D,{class:"button primary",onClick:t[4]||(t[4]=e=>l.save())},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(a.blocker.id?"UPRAVIŤ":"VYTVORIŤ"),1)]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["content"])]),_:1},8,["modelValue","width","height"])}s(94348);var Ga={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X,AEmployeeTimeblock:js},mixins:[ae.A,x],emits:["close"],data(){return{visible:!1,v$:(0,G.Ay)(),errorUtils:te.A,blocker:{id:null,name:"",start:null,end:null,employee_id:null},timeblockData:{id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:null},employee:null,modalName:"z-blocker-modal",modalSize:"large"}},computed:{...(0,ie.L8)("tm",["enrichedEmployees"]),...(0,ie.L8)("auth",["user"]),selectedEmployee(){return this.blocker?.employee_id?this.enrichedEmployees.find(e=>e.id===this.blocker.employee_id):null}},validations(){return{blocker:{name:{required:ee.mw},start:{required:ee.mw},end:{required:ee.mw}}}},watch:{"blocker.employee_id"(e){this.timeblockData&&(this.timeblockData.employee_id=e)},"timeblockData.date"(){this._syncDatesTimes()},"timeblockData.starts_at_time"(){this._syncDatesTimes()},"timeblockData.ends_at_time"(){this._syncDatesTimes()}},methods:{async showModal({blocker:e}){this.visible=!0,this.blocker={id:null,name:"",start:null,end:null,employee_id:this.user.id},this.timeblockData={id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:this.user.id},this.$nextTick(()=>{this.v$.$reset()});try{if(e?.id){e=await this.$axios.get_auth_data(`v1/blockers/${e.id}`);const t=_e()(e.start),s=_e()(e.end);this.timeblockData={id:null,date:t.toDate(),starts_at_time:t.format("HH:mm"),ends_at_time:s.format("HH:mm"),employee_id:e.employee?.id||this.user.id},this.blocker={id:e.id,name:e.name||"",start:e.start,end:e.end,employee_id:e.employee?.id||this.user.id}}else e?.starts_at_time&&e?.datepicker&&e?.employee_id&&(this.timeblockData={id:null,date:e.datepicker,starts_at_time:e.starts_at_time,ends_at_time:e.ends_at_time||null,employee_id:e.employee_id},this.blocker.employee_id=e.employee_id)}catch(t){this.$toast.error(this.$parseError(t))}},async save(){const e=await(this.$refs.employeeTimeblockRef?.validate());if(e&&await this.v$.$validate())try{if(this.blocker.id){const{blocker:e}=await this.$axios.put_auth(`v1/blockers/${this.blocker.id}`,this.blocker);this.blocker=e}else{const{blocker:e}=await this.$axios.post_auth("v1/blockers",this.blocker);this.blocker=e}this.$events.emit("on-blocker-edited",this.blocker),this.$events.emit("blocker-created"),this.closeModal()}catch(t){this.$toast.error(this.$parseError(t))}},closeModal(){this.visible=!1,this.blocker={id:null,name:"",start:null,end:null,employee_id:null},this.timeblockData={id:null,date:new Date,starts_at_time:null,ends_at_time:null,employee_id:null},this.$emit("close",this.blocker)},_syncDatesTimes(){if(!this.blocker||!this.timeblockData.starts_at_time||!this.timeblockData.ends_at_time||!this.timeblockData.date)return;const e=this.timeblockData.starts_at_time.split(":"),t=this.timeblockData.ends_at_time.split(":");this.blocker.start=_e()(this.timeblockData.date).set({hours:parseInt(e[0]),minutes:parseInt(e[1])}).format("YYYY-MM-DD HH:mm"),this.blocker.end=_e()(this.timeblockData.date).set({hours:parseInt(t[0]),minutes:parseInt(t[1])}).format("YYYY-MM-DD HH:mm")}}};const el=(0,A.A)(Ga,[["render",Ja],["__scopeId","data-v-45f14e72"]]);var tl=el;const sl={class:"d-flex justify-space-between align-center"},il={class:"d-flex align-start"};function al(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",sl,[(0,m.Lk)("h1",null,[t[4]||(t[4]=(0,m.eW)(" Ste si istý, že chcete zmazať ",-1)),(0,m.Lk)("b",null,(0,v.v_)(l.mastertask.name),1),t[5]||(t[5]=(0,m.eW)("? ",-1))]),(0,m.Lk)("div",il,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{class:"mb-15",onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half",variant:"flat",disabled:l.isDeleting,onClick:t[1]||(t[1]=e=>n.deleteMasterTask())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("ÁNO",-1)])]),_:1},8,["disabled"]),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.closeModal(),["stop"]))},{default:(0,m.k6)(()=>[...t[7]||(t[7]=[(0,m.eW)("ZRUŠIŤ",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var ll={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],emits:["on-mastertask-deleted"],data(){return{visible:!1,mastertask:null,isDeleting:!1,modalName:"z-delete-master-task-modal",modalSize:"small"}},methods:{async showModal({mastertask:e}){this.mastertask=e,this.visible=!0},closeModal(){this.visible=!1},async deleteMasterTask(){if(!this.isDeleting){this.isDeleting=!0;try{await this.$axios.delete_auth(`v1/mastertasks/${this.mastertask.id}`),this.$emit("on-mastertask-deleted",this.mastertask),this.closeModal()}catch(e){this.$toast.error(this.$parseError(e))}finally{this.isDeleting=!1}}}}};const nl=(0,A.A)(ll,[["render",al]]);var ol=nl,rl=s(20105);const dl={class:"d-flex justify-space-between align-center modal-header"},ul={class:"d-flex align-center"},cl={class:"splitted-inputs"},ml={ref:"datepicker-wrapper",class:"datepicker-wrapper left"},hl={class:"employee-select-avatar d-flex justify-center align-center"},pl={class:"employee-select-avatar d-flex justify-center align-center"},kl={class:"d-flex justify-space-between align-center"},vl={class:"d-flex align-center"},bl={class:"d-flex justify-space-between align-center modal-header border-bottom pb-4"},fl={class:"d-flex justify-start"},_l=["src"],gl=["src"],yl={class:"w-100"},wl={class:"d-flex justify-start align-center mt-8"},Dl={class:"d-flex align-center"};function Tl(e,t,a,l,n,o){const r=(0,m.g2)("a-reset-size-button"),d=(0,m.g2)("a-close-button"),u=(0,m.g2)("Z-datepicker"),c=(0,m.g2)("QuillEditor"),h=(0,m.g2)("Z-files-upload"),p=(0,m.g2)("a-resize-handle"),k=(0,m.g2)("A-mastertask-description"),y=(0,m.g2)("A-tasks-table"),w=(0,m.g2)("W-loadable");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:n.visible,"onUpdate:modelValue":t[17]||(t[17]=e=>n.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(w,{content:n.mastertask,class:"h-100"},{default:(0,m.k6)(()=>[n.editMode?((0,m.uX)(),(0,m.Wv)(f.J,{key:0,style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"},class:"d-flex flex-column scrolling"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",dl,[(0,m.Lk)("h1",null,(0,v.v_)(n.mastertask?.id?"Upraviť master task":"Vytvoriť master task"),1),(0,m.Lk)("div",ul,[(0,m.bF)(r,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(d,{onClose:t[0]||(t[0]=e=>o.closeModal())})])]),(0,m.bF)(_.S,{class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.bF)(q.V,{modelValue:n.mastertask.project_id,"onUpdate:modelValue":t[1]||(t[1]=e=>n.mastertask.project_id=e),"custom-filter":e.customFilter,"match-any":!0,label:e.$t("Project code"),class:(0,v.C4)([{error:n.v$.mastertask.project_id.$errors.length},"modal-input"]),items:e.projectsOptions,"item-title":"code","item-value":"id",variant:"solo",clearable:"","onUpdate:search":t[2]||(t[2]=e=>n.projectCodeSearch=e)},null,8,["modelValue","custom-filter","label","class","items"]),(0,m.bF)(K.Wx,{modelValue:n.mastertask.name,"onUpdate:modelValue":t[3]||(t[3]=e=>n.mastertask.name=e),class:(0,v.C4)(["modal-input",{error:n.v$.mastertask.name.$errors.length}]),label:"Názov mastertasku",variant:"solo",hint:n.v$.mastertask.name.$errors?n.errorUtils.parseErrors(n.v$.mastertask.name.$errors):null},null,8,["modelValue","class","hint"]),(0,m.Lk)("div",cl,[(0,m.Lk)("div",ml,[(0,m.bF)(u,{ref:"datepicker",modelValue:n.mastertask.deadline,"onUpdate:modelValue":t[4]||(t[4]=e=>n.mastertask.deadline=e),label:"Deadline","auto-apply":!0,"min-date":new Date,class:(0,v.C4)(["modal-input",{error:n.v$.mastertask.deadline.$errors?.length}]),format:"dd.MM.yyyy",locale:"sk","select-text":"Vybrať","cancel-text":"Zrušiť",placeholder:"Deadline",validations:n.v$.mastertask.deadline},null,8,["modelValue","min-date","class","validations"])],512),(0,m.bF)(K.Wx,{modelValue:n.mastertask._deadline_time,"onUpdate:modelValue":t[5]||(t[5]=e=>n.mastertask._deadline_time=e),class:(0,v.C4)(["modal-input right",{error:n.v$.mastertask._deadline_time.$errors.length}]),variant:"solo",label:"Čas","append-inner-icon":"mdi-clock-outline",type:"time",hint:n.v$.mastertask._deadline_time.$errors?n.errorUtils.parseErrors(n.v$.mastertask._deadline_time.$errors):null},null,8,["modelValue","class","hint"])]),(0,m.bF)(K.Wx,{modelValue:n.mastertask.estimated_duration,"onUpdate:modelValue":t[6]||(t[6]=e=>n.mastertask.estimated_duration=e),class:(0,v.C4)(["modal-input",{error:n.v$.mastertask.estimated_duration.$errors.length}]),variant:"solo",type:"number",label:"Nacenené hodiny",hint:n.v$.mastertask.estimated_duration.$errors?n.errorUtils.parseErrors(n.v$.mastertask.estimated_duration.$errors):null},null,8,["modelValue","class","hint"]),(0,m.bF)(K.Wx,{modelValue:n.mastertask.duration,"onUpdate:modelValue":t[7]||(t[7]=e=>n.mastertask.duration=e),class:"modal-input",variant:"solo",type:"number",label:"Naplánované hodiny",disabled:!0},null,8,["modelValue"]),(0,m.bF)(rl.d,{modelValue:n.mastertask.team_id,"onUpdate:modelValue":t[8]||(t[8]=e=>n.mastertask.team_id=e),class:(0,v.C4)(["modal-input border-select",{error:n.v$.mastertask.employees.$errors.length}]),label:"Tím",variant:"solo",items:e.teams,"item-value":"id","item-title":"name",disabled:!!n.mastertask.id,clearable:!0},null,8,["modelValue","class","items","disabled"]),n.mastertask.id?((0,m.uX)(!0),(0,m.CE)(m.FK,{key:1},(0,m.pI)(n.mastertask._allEmployees,e=>((0,m.uX)(),(0,m.Wv)(K.Wx,{key:e.id,modelValue:e.duration,"onUpdate:modelValue":t=>e.duration=t,class:"modal-input",label:`${e.name} ${e.surname}`,variant:"solo",placeholder:"h",type:"number",disabled:!0},{default:(0,m.k6)(()=>[(0,m.Lk)("p",pl,(0,v.v_)(e?.name.charAt(0)+e?.surname.charAt(0)),1),(0,m.bF)(S.w,{class:"remove-input",icon:"mdi-close-circle",size:"default",onClick:(0,i.D$)(t=>o.removeEmployee(e),["stop"])},null,8,["onClick"])]),_:2},1032,["modelValue","onUpdate:modelValue","label"]))),128)):((0,m.uX)(!0),(0,m.CE)(m.FK,{key:0},(0,m.pI)(n.mastertask.employees,(t,s)=>((0,m.uX)(),(0,m.Wv)(K.Wx,{key:t.id,modelValue:n.mastertask.employees[s].duration,"onUpdate:modelValue":e=>n.mastertask.employees[s].duration=e,class:(0,v.C4)(["modal-input",{error:t.invalid}]),label:`${t.name} ${t.surname} (h)`,variant:"solo",placeholder:"h",type:"number",min:"1",onInput:e.onEmployeeDurationChanged},{default:(0,m.k6)(()=>[(0,m.Lk)("p",hl,(0,v.v_)(t?.name.charAt(0)+t?.surname.charAt(0)),1),(0,m.bF)(S.w,{class:"remove-input",icon:"mdi-close-circle",size:"default",onClick:(0,i.D$)(e=>o.removeEmployee(t),["stop"])},null,8,["onClick"])]),_:2},1032,["modelValue","onUpdate:modelValue","class","label","onInput"]))),128)),n.showAddEmployeeInput?((0,m.uX)(),(0,m.Wv)(q.V,{key:2,"custom-filter":e.customFilter,"match-any":!0,label:e.$t("Search for employee"),class:(0,v.C4)([{error:n.v$.mastertask.project_id.$errors.length},"modal-input"]),items:e.employeesOptions,"item-title":"_fullName","item-value":"id",variant:"solo",clearable:"","onUpdate:modelValue":e.onEmployeeSelected},null,8,["custom-filter","label","class","items","onUpdate:modelValue"])):(0,m.Q3)("",!0),(0,m.bF)(b.D,{disabled:!!n.mastertask.id,class:(0,v.C4)(["w-100 mb-5 button secondary",{error:n.v$.mastertask.project_id.$errors.length}]),onClick:t[9]||(t[9]=e=>n.showAddEmployeeInput=!0)},{default:(0,m.k6)(()=>[(0,m.bF)(S.w,{class:"mx-1",icon:"mdi-plus"}),t[18]||(t[18]=(0,m.eW)("Pridať zamestnanca ",-1))]),_:1},8,["disabled","class"]),(0,m.Lk)("div",{class:(0,v.C4)(["w-100 modal-input quill-editor-wrapper",{error:n.v$.mastertask.description.$errors.length}])},[(0,m.bF)(c,{ref:"description",modelValue:n.mastertask.description,"onUpdate:modelValue":t[10]||(t[10]=e=>n.mastertask.description=e),placeholder:"Popis",theme:"snow",class:"rich-text-editor",onKeyup:o.onQuillEditorInput},null,8,["modelValue","onKeyup"])],2),(0,m.bF)(h,{class:"mt-15 files",files:n.mastertask.files,"is-saving":n.isSaving,onFilesUploaded:o.filesUploaded},null,8,["files","is-saving","onFilesUploaded"])]),_:1}),n.isSaving?((0,m.uX)(),(0,m.Wv)(b.D,{key:1,class:"button primary disabled",disabled:""},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(e.$t("Ukladám...")),1)]),_:1})):((0,m.uX)(),(0,m.Wv)(b.D,{key:0,class:"button primary",onClick:t[11]||(t[11]=e=>o.save())},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(n.mastertask.id?"ULOŽIŤ":"VYTVORIŤ"),1)]),_:1})),(0,m.bF)(p,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})):((0,m.uX)(),(0,m.Wv)(f.J,{key:1,style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"},class:"d-flex flex-column scrolling"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",kl,[(0,m.Lk)("p",null,(0,v.v_)(n.mastertask.project_code),1),(0,m.Lk)("div",vl,[(0,m.bF)(r,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(d,{onClose:t[12]||(t[12]=e=>o.closeModal())})])]),(0,m.Lk)("div",bl,[(0,m.Lk)("h1",null,(0,v.v_)(n.mastertask.name),1),(0,m.Lk)("div",fl,[n.mastertask.is_finished?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("img",{key:0,class:"icon",src:s(63120),alt:"pencil-icon",onClick:t[13]||(t[13]=(0,i.D$)(e=>n.editMode=!n.editMode,["stop"]))},null,8,_l)),(0,m.Lk)("img",{class:"icon trash",src:s(74366),alt:"trash-icon",onClick:t[14]||(t[14]=(0,i.D$)(e=>o.openDeleteMasterTaskModal(n.mastertask),["stop"]))},null,8,gl)])]),(0,m.bF)(_.S,{class:"d-flex flex-column modal-content"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",yl,[(0,m.bF)(k,{mastertask:n.mastertask},null,8,["mastertask"]),(0,m.Lk)("div",wl,[(0,m.bF)(b.D,{class:"button primary",onClick:t[15]||(t[15]=e=>o.toggleIsFinished(n.mastertask))},{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(n.mastertask.is_finished?"Otvoriť mastertask":"Ukončiť mastertask"),1)]),_:1})]),(0,m.bF)(y,{subtasks:n.mastertask.subtasks},null,8,["subtasks"]),(0,m.Lk)("div",Dl,[(0,m.bF)(b.D,{class:"subtask-btn w-100",onClick:t[16]||(t[16]=e=>o.addTask())},{default:(0,m.k6)(()=>[(0,m.bF)(S.w,{class:"mx-1",icon:"mdi-plus"}),t[19]||(t[19]=(0,m.eW)("Pridať sub task",-1))]),_:1})])])]),_:1}),(0,m.bF)(p,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1}))]),_:1},8,["content"])]),_:1},8,["modelValue","width","height"])}var El=s(83260);const Ml={class:"px-5 py-5"},Cl={key:0,class:"w-25"},$l={key:1,class:"w-50"},xl={class:"d-flex align-center"},Sl={class:"employee-selected-avatar d-flex justify-center align-center"},Fl={class:"ml-2 line-clamp"},zl={key:0,class:"text-light-green"},Al={key:1},Ll={class:"task-action"},Rl={class:"d-flex justify-start align-center"},jl=["src","onClick"],Wl=["src"],Vl=["src","onClick"],Ol=["src","onClick"],Il=["src","onClick"],Hl=["src","onClick"];function Yl(e,t,s,a,l,n){return(0,m.uX)(),(0,m.Wv)(El.Z,{class:"mt-7 mb-5"},{default:(0,m.k6)(()=>[(0,m.Lk)("tbody",Ml,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.enrichedtasks,e=>((0,m.uX)(),(0,m.CE)("tr",{key:e.id},[e?.title?((0,m.uX)(),(0,m.CE)("td",Cl,(0,v.v_)(e.title),1)):((0,m.uX)(),(0,m.CE)("td",$l,(0,v.v_)(e?.master_task),1)),(0,m.Lk)("td",xl,[(0,m.Lk)("p",Sl,(0,v.v_)(e._employeeInitials),1),(0,m.Lk)("p",Fl,(0,v.v_)(e._employeeFullName),1)]),(0,m.Lk)("td",null,[e.is_finished?((0,m.uX)(),(0,m.CE)("p",zl,"Ukončený")):(0,m.Q3)("",!0),e.is_finished?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("p",Al,"Neukončený"))]),(0,m.Lk)("td",Ll,[(0,m.Lk)("div",Rl,["office365"==s.subtasks.type?((0,m.uX)(),(0,m.CE)(m.FK,{key:0},[(0,m.Lk)("img",{class:"pencil-icon ml-2",src:l.eye,alt:"pencil-icon",onClick:(0,i.D$)(t=>n.openTaskModal(e),["stop"])},null,8,jl),(0,m.Lk)("img",{class:"office-icon",src:l.office365},null,8,Wl)],64)):((0,m.uX)(),(0,m.CE)(m.FK,{key:1},[e.is_finished?((0,m.uX)(),(0,m.CE)("img",{key:0,class:"pencil-icon is-finished",src:l.checkmark,alt:"checkmark-icon",onClick:(0,i.D$)(t=>n.clickCompleteTask(e),["stop"])},null,8,Vl)):(0,m.Q3)("",!0),e.is_finished?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("img",{key:1,class:"pencil-icon",src:l.checkmark,alt:"checkmark-icon",onClick:(0,i.D$)(t=>n.clickCompleteTask(e),["stop"])},null,8,Ol)),(0,m.Lk)("img",{class:"pencil-icon ml-2",src:l.eye,alt:"pencil-icon",onClick:(0,i.D$)(t=>n.openTaskModal(e),["stop"])},null,8,Il),(0,m.Lk)("img",{class:"trash-icon",src:l.bin,alt:"trash-icon",onClick:(0,i.D$)(t=>n.openDeleteTaskModal(e),["stop"])},null,8,Hl)],64))])])]))),128))])]),_:1})}var Bl=s(95022),Xl={props:{subtasks:{type:Array,required:!0}},data(){return{checkmark:Bl.AI,bin:Bl.e5,eye:Bl.y5,office365:Bl.ni}},computed:{...(0,ie.L8)("tm",["enrichedEmployees"]),enrichedtasks(){return this.subtasks.map(e=>{const t=this.enrichedEmployees.find(t=>t.id==e.employee_id);return{...e,_employeeInitials:t?t._initials:"?",_employeeFullName:t?t._fullName:""}})}},methods:{openDeleteTaskModal(e){this.$events.emit("show-delete-task-modal",{subtask:e})},openTaskModal(e){this.$events.emit("show-subtask-modal",{subtask:e,editMode:!1})},async clickCompleteTask(e){this.$events.emit("show-complete-task-modal",{subtask:e})}}};const Nl=(0,A.A)(Xl,[["render",Yl],["__scopeId","data-v-2dfbf12e"]]);var Pl=Nl;function Ul(e,t,s,i,a,l){const n=(0,m.g2)("Z-status"),o=(0,m.g2)("Z-deadline"),r=(0,m.g2)("Z-created-by"),d=(0,m.g2)("Z-team"),u=(0,m.g2)("Z-estimated-duration"),c=(0,m.g2)("Z-planned-time"),h=(0,m.g2)("Z-remaining-time"),p=(0,m.g2)("Z-spent-time"),k=(0,m.g2)("Z-description"),v=(0,m.g2)("Z-files");return(0,m.uX)(),(0,m.CE)(m.FK,null,[(0,m.bF)(n,{status:s.mastertask.is_finished},null,8,["status"]),(0,m.bF)(o,{deadline:s.mastertask.deadline},null,8,["deadline"]),(0,m.bF)(r,{"employee-id":s.mastertask.created_by},null,8,["employee-id"]),(0,m.bF)(d,{team:s.mastertask.team,employees:s.mastertask._allEmployees||s.mastertask.employees},null,8,["team","employees"]),(0,m.bF)(u,{hours:s.mastertask.estimated_duration},null,8,["hours"]),(0,m.bF)(c,{hours:s.mastertask.duration},null,8,["hours"]),(0,m.bF)(h,{hours:s.mastertask.duration-s.mastertask.time_worked},null,8,["hours"]),(0,m.bF)(p,{hours:s.mastertask.time_worked,"is-exceeded":s.mastertask.time_worked>s.mastertask.duration},null,8,["hours","is-exceeded"]),(0,m.bF)(k,{description:s.mastertask.description},null,8,["description"]),(0,m.bF)(v,{files:s.mastertask.files},null,8,["files"])],64)}const ql={class:"d-flex align-center"};function Kl(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ql,[(0,m.bF)(S.w,{icon:"mdi-calendar-week",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Deadline",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",{class:(0,v.C4)(""+(a.tmUtils.isAfter(s.deadline)?"text-black":"text-red-darken-4"))},(0,v.v_)(a.tmUtils.formatDateTime(s.deadline)),3)]),_:1})]),_:1})]),_:1})}var Zl={props:{deadline:{type:String,required:!0}},data(){return{tmUtils:se.A}}};const Ql=(0,A.A)(Zl,[["render",Kl]]);var Jl=Ql;const Gl={key:0,class:"px-5 py-5 border-bottom"},en=["innerHTML"],tn={key:1,class:"px-5 py-5 border-bottom"},sn=["innerHTML"];function an(e,t,s,i,a,l){return(0,m.uX)(),(0,m.CE)(m.FK,null,[s.description?((0,m.uX)(),(0,m.CE)("div",Gl,[t[0]||(t[0]=(0,m.Lk)("p",null,"Popis zadania",-1)),(0,m.Lk)("section",{class:"description-detail px-2 py-2 w-100 rounded mt-2",innerHTML:a.preparedDescription},null,8,en)])):(0,m.Q3)("",!0),s.inheritedDescription?((0,m.uX)(),(0,m.CE)("div",tn,[t[1]||(t[1]=(0,m.Lk)("p",null,"Popis mastertasku",-1)),(0,m.Lk)("section",{class:"description-detail px-2 py-2 w-100 rounded mt-2",innerHTML:a.preparedInheritedDescription},null,8,sn)])):(0,m.Q3)("",!0)],64)}var ln={props:{description:{type:String||null,default:()=>null},inheritedDescription:{type:String||null,default:()=>null}},data(){return{copiedIndices:[],preparedDescription:"",preparedInheritedDescription:""}},mounted(){this.preparedDescription=ji(this.description),this.preparedInheritedDescription=ji(this.inheritedDescription)}};const nn=(0,A.A)(ln,[["render",an]]);var on=nn;const rn={class:"d-flex align-center"};function dn(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",rn,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Naplánovaný čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours)+" h",1)]),_:1})]),_:1})]),_:1})}var un={props:{hours:{type:Number,required:!0}}};const cn=(0,A.A)(un,[["render",dn]]);var mn=cn;const hn={class:"d-flex align-center"};function pn(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center border-bottom"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",hn,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Zostávajúci čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours)+" h",1)]),_:1})]),_:1})]),_:1})}var kn={props:{hours:{type:Number,required:!0}}};const vn=(0,A.A)(kn,[["render",pn]]);var bn=vn;const fn={class:"d-flex align-center"};function _n(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":""},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",fn,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Odpracovaný čas",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",{class:(0,v.C4)(s.isExceeded?"text-red-darken-4":"text-black")},(0,v.v_)(s.hours)+" h",3)]),_:1})]),_:1})]),_:1})}var gn={props:{hours:{type:Number,required:!0},isExceeded:{type:Boolean,required:!0}}};const yn=(0,A.A)(gn,[["render",_n]]);var wn=yn;const Dn={class:"d-flex align-center"},Tn={key:0,class:"status-badge px-4 py-2 rounded-pill"},En={key:1,class:"status-badge px-4 py-2 rounded-pill"};function Mn(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Dn,[(0,m.bF)(S.w,{icon:"mdi-drag-vertical",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Status",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[1==s.status?((0,m.uX)(),(0,m.CE)("p",Tn,"Ukončený")):0==s.status?((0,m.uX)(),(0,m.CE)("p",En,"Neukončený")):(0,m.Q3)("",!0)]),_:1})]),_:1})]),_:1})}var Cn={props:{status:{type:Number,required:!0}}};const $n=(0,A.A)(Cn,[["render",Mn]]);var xn=$n;const Sn={class:"d-flex align-center"},Fn={class:"task-badge px-4 py-2 rounded-pill flex-shrink-0"},zn={class:"employee-selected-avatar d-flex justify-center align-center"},An={class:"ml-2"},Ln={class:"employee-selected-avatar d-flex justify-center align-center"},Rn={class:"ml-2"};function jn(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":""},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Sn,[(0,m.bF)(S.w,{icon:"mdi-account-multiple-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Tím",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3 d-flex flex-wrap flex-column"},{default:(0,m.k6)(()=>[s.team?((0,m.uX)(),(0,m.CE)(m.FK,{key:0},[(0,m.Lk)("p",Fn,(0,v.v_)(s.team.name),1),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.enrichedEmployeesInTeam,e=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill"},[(0,m.Lk)("p",zn,(0,v.v_)(e._initials),1),(0,m.Lk)("p",An,(0,v.v_)(e?._fullName),1)]))),128)),t[1]||(t[1]=(0,m.Lk)("div",{class:"mb-4"},null,-1))],64)):(0,m.Q3)("",!0),t[2]||(t[2]=(0,m.Lk)("p",{class:"task-badge px-4 py-2 rounded-pill flex-shrink-0"},"Nepriradený",-1)),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.enrichedEmployeesOutsideTeam,e=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"d-flex align-center flex-shrink-0 mt-2 task-badge px-4 py-2 rounded-pill"},[(0,m.Lk)("p",Ln,(0,v.v_)(e._initials),1),(0,m.Lk)("p",Rn,(0,v.v_)(e?._fullName),1)]))),128))]),_:1})]),_:1})]),_:1})}var Wn={props:{team:{type:Object,required:!1},employees:{type:Array,required:!0}},computed:{enrichedEmployeesInTeam(){return this.team?.employees?se.A.enrichEmployees(this.team.employees):[]},enrichedEmployeesOutsideTeam(){if(!this.team)return se.A.enrichEmployees(this.employees);const e=this.employees.filter(e=>!this.team.employees.find(t=>t.id==e.id));return se.A.enrichEmployees(e)}}};const Vn=(0,A.A)(Wn,[["render",jn]]);var On=Vn;const In={class:"d-flex align-center"};function Hn(e,t,s,i,a,l){return(0,m.uX)(),(0,m.Wv)(tt.L,{"no-gutters":"",class:"align-center"},{default:(0,m.k6)(()=>[(0,m.bF)(st.B,{cols:"5"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("div",In,[(0,m.bF)(S.w,{icon:"mdi-clock-time-three-outline",size:"large"}),t[0]||(t[0]=(0,m.Lk)("p",{class:"mx-3"},"Nacenené hodiny",-1))])]),_:1})]),_:1}),(0,m.bF)(st.B,{cols:"7"},{default:(0,m.k6)(()=>[(0,m.bF)(it.i,{class:"py-3"},{default:(0,m.k6)(()=>[(0,m.Lk)("p",null,(0,v.v_)(s.hours||0)+" h",1)]),_:1})]),_:1})]),_:1})}var Yn={props:{hours:{type:[Number,void 0]}}};const Bn=(0,A.A)(Yn,[["render",Hn]]);var Xn=Bn,Nn={components:{ZCreatedBy:Us,ZDeadline:Jl,ZDescription:on,ZFiles:Ki,ZPlannedTime:mn,ZRemainingTime:bn,ZSpentTime:wn,ZStatus:xn,ZTeam:On,ZEstimatedDuration:Xn},props:{mastertask:{type:Object,required:!0}}};const Pn=(0,A.A)(Nn,[["render",Ul]]);var Un=Pn,qn={components:{AMastertaskDescription:Un,ATasksTable:Pl,ZDatepicker:Be,ZFilesUpload:Je,QuillEditor:r.tB,AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[Ge,ae.A,x],emits:["master-task-edited","close"],data(){return{deadline:null,editMode:!1,visible:!1,errorUtils:te.A,v$:(0,G.Ay)(),mastertask:null,isSaving:!1,showAddEmployeeInput:!1,date:null,projectCodeSearch:null,modalName:"z-master-task-modal",modalSize:"large"}},computed:{...(0,ie.L8)("tm",["teams","projects","enrichedEmployees"]),enrichedSubtasks(){return this.mastertask?.subtasks?this.mastertask.subtasks.map(e=>{const t=this.enrichedEmployees.find(t=>t.id==e.employee_id);return{...e,_initials:t?t.name.charAt(0)+t.surname.charAt(0):"?",_fullName:t?`${t.name} ${t.surname}`:""}}).filter(e=>null!==e):null}},validations(){const e=e=>!!(e&&e.length&&e.replace(/<[^>]*>/g,"").length);return{mastertask:{employees:{required:ee.mw,minLength:(0,ee.Bp)(1),$each:{duration:{required:ee.mw}}},project_id:{required:ee.mw},name:{required:ee.mw},description:{quillEditorRequired:e},deadline:{required:ee.mw},estimated_duration:{required:ee.mw},_deadline_time:{required:ee.mw}}}},watch:{editMode(){this.$nextTick(()=>{if(this.$refs["description"]?.setHTML(this.mastertask.description||""),!this.mastertask?.id)return;const e=new Date(this.mastertask.deadline),t=e.getHours(),s=e.getMinutes();this.mastertask._deadline_time=`${t.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}`})},mastertask:{handler(e){this.editMode&&!this.mastertask?.id&&localStorage.setItem("mastertaskData",JSON.stringify(e))},deep:!0},"mastertask.team_id":{handler(e,t){if(this.editMode&&!e&&t){const e=this.teams.find(e=>e.id==t)?.employees.map(e=>e?.id)||[],s=this.mastertask.employees.filter(t=>!e.includes(t?.id));this.mastertask.employees=s}},deep:!0},"$route.query":{handler(e,t){t?.subtask?.length&&this.mastertask?.id&&this.loadMastertask(this.mastertask.id)},deep:!0}},mounted(){this.$events.on("close-both-modals",this.closeBothModals),this.$events.on("master-task:team-member-deleted",({teamId:e,memberId:t})=>{this.mastertask.team_id==e&&(this.mastertask.employees=this.mastertask.employees.filter(e=>e.id!=t))}),this.$events.on("on-mastertask-deleted",e=>{e?.id==this.mastertask?.id&&this.closeModal()}),this.$events.on("on-subtask-deleted",e=>{this.mastertask&&(this.mastertask.subtasks=this.mastertask.subtasks.filter(t=>t.id!=e.id))}),this.$events.on("on-subtask-edited",e=>{this.mastertask?.subtasks&&(this.mastertask.subtasks.find(t=>t.id==e.id)?this.mastertask.subtasks=this.mastertask.subtasks.map(t=>t.id==e.id?e:t):this.mastertask.subtasks.push(e))})},beforeUnmount(){this.$events.off("on-mastertask-deleted"),this.$events.off("on-subtask-deleted"),this.$events.off("on-subtask-edited"),this.$events.off("master-task:team-member-deleted"),this.$events.off("close-both-modals",this.closeBothModals)},methods:{closeBothModals(){this.$emit("close"),this.visible=!1},removeEmployee({id:e}){this.mastertask.employees=this.mastertask.employees.filter(t=>t.id!=e)},removeMemberAlert(e){const t=this.mastertask.team;this.$events.emit("show-delete-team-member-modal",{member:e,team:t})},async loadMastertask(e){try{this.mastertask=await this.$axios.get_auth_data(`v1/mastertasks/${e}`);const t=this.projects.find(e=>e.code==this.mastertask.project_code);this.mastertask.project_id=t?.id||null,this.mastertask.team_id=this.mastertask.team?.id||null,this.mastertask._allEmployees=this.mastertask.subtasks.map(({employee_id:e,duration:t})=>{const s=this.enrichedEmployees.find(({id:t})=>t==e);return s?(s.duration=t,s):null}).filter(e=>null!==e)}catch(t){this.$toast.error(t.message||t)}},async showModal({mastertask:e,editMode:t=!1}){this.isSaving=!1,this.editMode=null,this.preventInputFocus=!0,this.visible=!0,this.mastertask=null,this.$nextTick(()=>{this.v$.$reset(),setTimeout(()=>{this.preventInputFocus=!1},300)});try{if(e?.id)await this.loadMastertask(e.id);else{const e=localStorage.getItem("mastertaskData");try{if(!e)throw new Error("mastertaskData is null or undefined");{const t=JSON.parse(e);if(this.mastertask=t,"object"!==typeof this.mastertask||null===this.mastertask)throw new Error("Parsed mastertask is not an object");this.$nextTick(()=>{this.$refs["description"]?.setHTML(this.mastertask.description||"")})}}catch(s){this.mastertask={employees:[],duration:0,_deadline_time:"17:00"}}}this.editMode=t||!this.mastertask.id}catch(s){this.$toast.error(s.message||s)}},toggleIsFinished(){this.$events.emit("show-complete-master-task-modal",{mastertask:this.mastertask})},async save(){this.mastertask.id&&(this.mastertask.employees=this.mastertask.employees.map(e=>{const{duration:t}=this.mastertask.subtasks.find(({employee_id:t})=>t==e.id)||{};return e.duration=t||0,e}));const e=await this.v$.$validate(),t=await this._validateEmployees();if(e&&t){this.$refs["description"]&&(this.mastertask.description=this.$refs["description"].getHTML()),this._mergeDeadlineTimeDate();try{this.isSaving=!0,this.mastertask.deadline=_e()(this.mastertask.deadline).format("YYYY-MM-DD HH:MM:SS"),this.mastertask.id?await this.$axios.patch_auth_form(`v1/mastertasks/${this.mastertask.id}`,this.mastertask):await this.$axios.post_auth_data("v1/mastertasks",this.mastertask),localStorage.removeItem("mastertaskData"),this.$emit("master-task-edited",this.mastertask),this.closeModal()}catch(s){this.$toast.error(this.$parseError(s))}finally{this.isSaving=!1}}},filesUploaded(e){this.mastertask.files=e},closeModal(){this.visible=!1},openDeleteMasterTaskModal(e){this.$events.emit("show-delete-master-task-modal",{mastertask:e})},addTask(){this.$events.emit("show-subtask-modal",{subtask:{master_task_id:this.mastertask.id,project_code:this.mastertask.project_code}})},onQuillEditorInput(){this.mastertask.description=this.$refs["description"].getHTML()},_mergeDeadlineTimeDate(){const e=new Date(this.mastertask.deadline),t=this.mastertask._deadline_time.split(":");e.setHours(parseInt(t[0])),e.setMinutes(parseInt(t[1])),this.mastertask.deadline=e},_validateEmployees(){let e=!0;return this.mastertask.employees=this.mastertask.employees.map(t=>(null!==t.duration&&void 0!==t.duration||(t.invalid=!0,e=!1),t)),e}}};const Kn=(0,A.A)(qn,[["render",Tl],["__scopeId","data-v-4c7ab775"]]);var Zn=Kn,Qn=s(41720);const Jn={class:"d-flex justify-space-between align-center"},Gn={class:"d-flex align-start"};function eo(e,t,s,i,a,l){const n=(0,m.g2)("a-reset-size-button"),o=(0,m.g2)("a-close-button"),r=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:a.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>a.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",Jn,[t[4]||(t[4]=(0,m.Lk)("h1",{class:"text-h5"},"Chcete túto osobu odstrániť z tímu?",-1)),(0,m.Lk)("div",Gn,[(0,m.bF)(n,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(o,{onClose:t[0]||(t[0]=e=>l.closeModal())})])]),(0,m.bF)(vt.O,null,{default:(0,m.k6)(()=>[(0,m.eW)((0,v.v_)(a.member.name+" "+a.member.surname)+" bude odstránený/á z teamu.",1)]),_:1}),(0,m.bF)(_.S,null,{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button secondary",variant:"text",onClick:t[1]||(t[1]=e=>l.closeModal())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)(" Zrušiť ",-1)])]),_:1}),(0,m.bF)(Qn.h),(0,m.bF)(b.D,{class:"button primary",variant:"text",onClick:t[2]||(t[2]=e=>l.deleteMember())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)(" Áno ",-1)])]),_:1})]),_:1}),(0,m.bF)(r,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var to={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],data(){return{visible:!1,member:null,team:null,modalName:"z-delete-team-member-modal",modalSize:"small"}},methods:{async showModal({member:e,team:t}){this.member=e,this.team=t,this.visible=!0},closeModal(){this.visible=!1},async deleteMember(){this.team.employees=[...this.team.employees].filter(e=>e.id!==this.member.id);try{if(this.team.id){const{team:e}=await this.$axios.put_auth(`v1/teams/${this.team.id}`,this.team);this.$store.commit("tm/update_team",e)}else{const{team:e}=await this.$axios.post_auth("v1/teams",this.team);this.$store.commit("tm/save_team",e)}this.$events.emit("master-task:team-member-deleted",{teamId:this.team.id,memberId:this.member.id}),this.closeModal()}catch(e){this.$toast.error(this.$parseError(e))}},_enrichTeam(e){return e.employees=se.A.enrichEmployees(e.employees),e}}};const so=(0,A.A)(to,[["render",eo]]);var io=so;const ao={class:"d-flex justify-space-between align-center"},lo={class:"d-flex align-start"};function no(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",ao,[t[4]||(t[4]=(0,m.Lk)("h1",null,"Vytvoriť",-1)),(0,m.Lk)("div",lo,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.bF)(_.S,{class:"mt-10 d-flex justify-start align-center mobile-view"},{default:(0,m.k6)(()=>[(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[1]||(t[1]=(0,i.D$)(e=>n.createTask(),["stop"]))},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("SUB TASK",-1)])]),_:1}),(0,m.bF)(b.D,{class:"button primary half outline",onClick:t[2]||(t[2]=(0,i.D$)(e=>n.createBlocker(),["stop"]))},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("BLOCKER",-1)])]),_:1})]),_:1}),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var oo={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],props:{data:{type:Object,default:()=>({})}},emits:["update","data"],data(){return{visible:!1,localData:null,modalName:"z-show-menu-modal",modalSize:"small"}},mounted(){this.$events.on("blocker-created",()=>{this.closeModal()}),this.$events.on("task-created",()=>{this.closeModal()})},methods:{async showModal(e){this.localData=e,this.visible=!0},closeModal(){this.visible=!1},createTask(){this.$events.emit("show-subtask-modal",{subtask:{deadline:this.localData.date,_deadline_time:this.localData.time,employee_id:this.localData.employee},onTaskCreated:()=>{this.closeModal()}})},createBlocker(){this.$events.emit("show-blocker-modal",{blocker:{starts_at_time:this.localData.time,datepicker:this.localData.date,employee_id:this.localData.employee},onBlockerCreated:()=>{this.closeModal()}})}}};const ro=(0,A.A)(oo,[["render",no]]);var uo=ro;const co={class:"d-flex justify-space-between align-center"},mo={key:0},ho={key:1},po={class:"d-flex align-start"};function ko(e,t,s,i,a,l){const n=(0,m.g2)("a-reset-size-button"),o=(0,m.g2)("a-close-button"),r=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:a.visible,"onUpdate:modelValue":t[1]||(t[1]=e=>a.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",co,["edit"===s.mode?((0,m.uX)(),(0,m.CE)("h1",mo," Sub Task zosynchronizovaný z Office365 sa nedá upravovat. Upravte ho vo svojom kalendári a pockajte na zosynchronizovanie s Task Managerom ")):"delete"===s.mode?((0,m.uX)(),(0,m.CE)("h1",ho," Sub Task zosynchronizovaný z Office365 sa nedá zmazať. Zmažte ho vo svojom kalendári a pockajte na zosynchronizovanie s Task Managerom ")):(0,m.Q3)("",!0),(0,m.Lk)("div",po,[(0,m.bF)(n,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(o,{onClose:t[0]||(t[0]=e=>l.closeModal())})])]),(0,m.bF)(r,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}var vo={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],props:{mode:{type:String,default:"edit"}},emits:["close","on-subtask-edited"],data(){return{visible:!1,subtask:null,modalName:"z-unable-to-edit-office-task-modal",modalSize:"small"}},methods:{async showModal({subtask:e}){this.subtask=e,this.visible=!0},async complete(){},closeModal(){this.visible=!1}}};const bo=(0,A.A)(vo,[["render",ko]]);var fo=bo;const _o={class:"d-flex justify-space-between align-center"},go={class:"d-flex align-start"},yo={class:"card-content"},wo={class:"card-actions"};function Do(e,t,s,a,l,n){const o=(0,m.g2)("a-reset-size-button"),r=(0,m.g2)("a-close-button"),d=(0,m.g2)("a-resize-handle");return(0,m.uX)(),(0,m.Wv)(g.p,{modelValue:l.visible,"onUpdate:modelValue":t[3]||(t[3]=e=>l.visible=e),width:e.modalWidth,height:e.modalHeight,persistent:"","retain-focus":!1},{default:(0,m.k6)(()=>[(0,m.bF)(f.J,{style:{position:"relative",height:"100%","max-height":"calc(100vh - 48px)"}},{default:(0,m.k6)(()=>[(0,m.Lk)("div",_o,[t[4]||(t[4]=(0,m.Lk)("h1",null,"Sub Task má nedokončené úlohy",-1)),(0,m.Lk)("div",go,[(0,m.bF)(o,{onReset:e.resetModalSize},null,8,["onReset"]),(0,m.bF)(r,{onClose:t[0]||(t[0]=e=>n.closeModal())})])]),(0,m.Lk)("div",yo,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(l.subtask?.timeblocks,e=>((0,m.uX)(),(0,m.CE)("div",{key:e.id,class:"d-flex align-center mb-3"},[(0,m.Lk)("p",{class:(0,v.C4)(["task-badge rounded-pill",{"strike-through":e.is_finished}])},(0,v.v_)(l.tmUtils.formatDateTime(e.start))+" - "+(0,v.v_)(l.tmUtils.formatDateTime(e.end)),3),(0,m.bF)(S.w,{class:(0,v.C4)(["finish-icon circle-border cursor-pointer ml-2",{disabled:l.loadingTimeblocks[e.id]||l.loadingCloseAll,finished:e.is_finished}]),icon:"mdi-check",size:"medium",onClick:(0,i.D$)(t=>n.handleFinishTimeblock(e),["stop"])},null,8,["class","onClick"])]))),128))]),(0,m.Lk)("div",wo,[(0,m.bF)(b.D,{class:"button secondary",onClick:t[1]||(t[1]=e=>n.closeModal())},{default:(0,m.k6)(()=>[...t[5]||(t[5]=[(0,m.eW)("Zrušiť",-1)])]),_:1}),(0,m.bF)(b.D,{loading:l.loadingCloseAll,class:"button primary",onClick:t[2]||(t[2]=e=>n.handleFinishAllTimeblocks())},{default:(0,m.k6)(()=>[...t[6]||(t[6]=[(0,m.eW)("Uzatvoriť všetky",-1)])]),_:1},8,["loading"])]),(0,m.bF)(d,{"current-width":e.modalWidthPx,"current-height":e.modalHeightPx,onResize:e.handleModalResize,onResizeEnd:e.handleResizeEnd},null,8,["current-width","current-height","onResize","onResizeEnd"])]),_:1})]),_:1},8,["modelValue","width","height"])}s(60178);var To={components:{AResizeHandle:R,AResetSizeButton:I,ACloseButton:X},mixins:[x],props:{mode:{type:String,default:"edit"}},emits:["close","on-subtask-edited"],data(){return{tmUtils:se.A,visible:!1,subtask:null,loadingTimeblocks:{},loadingCloseAll:!1,modalName:"z-unable-to-complete-task-modal",modalSize:"medium"}},methods:{async showModal({subtask:e}){this.subtask=e,this.visible=!0},async complete(){},closeModal(){this.visible=!1},async handleFinishTimeblock(e){const t=JSON.parse(JSON.stringify(this.subtask));try{this.loadingTimeblocks[e.id]=!0,await this.$axios.put_auth(`v1/timeblocks/${e.id}`,{...e,is_finished:1}),e.is_finished=1;const s=t.timeblocks.every(e=>e.is_finished);s&&(await this._finishSubtask(),this.$store.dispatch("tm/removeOngoingSubtask",this.subtask.id)),this.$events.emit("on-subtask-edited",t),this.closeModal()}catch(s){this.$toast.error(s.message||s)}finally{this.loadingTimeblocks[e.id]=!1}},async handleFinishAllTimeblocks(){this.loadingCloseAll=!0;try{const e=this.subtask.timeblocks.map(e=>this.$axios.put_auth(`v1/timeblocks/${e.id}`,{...e,is_finished:1}));await Promise.all(e),this.subtask.timeblocks=this.subtask.timeblocks.map(e=>(e.is_finished=1,e)),await this._finishSubtask(),this.$store.dispatch("tm/removeOngoingSubtask",this.subtask.id),this.$events.emit("on-subtask-edited",this.subtask),this.closeModal()}catch(e){this.$toast.error(e.message||e)}finally{this.loadingCloseAll=!1}},async _finishSubtask(){const e=this.subtask.timesheets.map(e=>(delete e.employee_name,e)),t=(this.subtask.timeblocks||[]).filter(e=>e.date||e.start).map(e=>{if(e.start&&!e.date)return{id:e.id||null,start:e.start,end:e.end,is_finished:e.is_finished||0};const t=_e()(e.date).format("YYYY-MM-DD");return{id:e.id||null,start:`${t} ${e.starts_at_time}:00`,end:`${t} ${e.ends_at_time}:00`,is_finished:e.is_finished||0}}),s={...this.subtask,is_finished:1,timesheets:e,timeblocks:t};return this.$axios.put_auth(`v1/subtasks/${s.id}`,s)}}};const Eo=(0,A.A)(To,[["render",Do],["__scopeId","data-v-ab972d10"]]);var Mo=Eo,Co={components:{ZDeleteTeamModal:U,ZTeamModal:re,ZDeleteTaskModal:pe,ZDeleteBlockerModal:Fa,ZTaskModal:Ea,ZMasterTaskModal:Zn,ZCompleteTaskModal:Wa,ZTaskAddTimeModal:Ka,ZBlockerModal:tl,ZDeleteMasterTaskModal:ol,ZDeleteTeamMemberModal:io,ZShowMenuModal:uo,ZCompleteMasterTaskModal:Ba,ZDeleteTimeBlockModal:we,ZUnableToEditOfficeTaskModal:fo,ZUnableToCompleteTaskModal:Mo},mounted(){this.$events.on("show-menu-modal",e=>{this.$refs["z-show-menu-modal"].showModal(e)}),this.$events.on("show-delete-team-modal",({team:e})=>{this.$refs["z-delete-team-modal"].showModal({team:e})}),this.$events.on("show-team-modal",({team:e})=>{this.$refs["z-team-modal"].showModal({team:e})}),this.$events.on("show-delete-task-modal",({subtask:e})=>{this.$refs["z-delete-task-modal"].showModal({subtask:e})}),this.$events.on("show-delete-timeblock-modal",({subtask:e})=>{this.$refs["z-delete-timeblock-modal"].showModal({subtask:e})}),this.$events.on("show-delete-blocker-modal",({blocker:e})=>{this.$refs["z-delete-blocker-modal"].showModal({blocker:e})}),this.$events.on("show-delete-master-task-modal",({mastertask:e})=>{this.$refs["z-delete-master-task-modal"].showModal({mastertask:e})}),this.$events.on("show-delete-team-member-modal",({member:e,team:t})=>{this.$refs["z-delete-team-member-modal"].showModal({member:e,team:t})}),this.$events.on("show-subtask-modal",({subtask:e,editMode:t,mastertask:s})=>{if(e&&e.id){const t=e.id;this.$router.push({query:{subtask:t}})}this.$refs["z-task-modal"].showModal({subtask:e,editMode:t,mastertask:s})}),this.$events.on("show-mastertask-modal",({mastertask:e,editMode:t})=>{if(e&&e.id){const t=e.id;this.$router.push({query:{mastertask:t}})}this.$refs["z-master-task-modal"].showModal({mastertask:e,editMode:t})}),this.$events.on("show-complete-task-modal",({subtask:e})=>{this.$refs["z-complete-task-modal"].showModal({subtask:e})}),this.$events.on("show-complete-master-task-modal",({mastertask:e})=>{this.$refs["z-complete-master-task-modal"].showModal({mastertask:e})}),this.$events.on("show-blocker-modal",({blocker:e={}})=>{this.$refs["z-blocker-modal"].showModal({blocker:e})}),this.$events.on("show-task-add-time-modal",({subtask:e})=>{this.$refs["z-task-add-time-modal"].showModal({subtask:e})}),this.$events.on("on-subtask-edited",()=>{this.$store.dispatch("tm/reloadSubtasks")}),this.$events.on("on-mastertask-edited",()=>{this.$store.dispatch("tm/reloadMastertasks")}),this.$events.on("on-mastertask-deleted",()=>{this.$store.dispatch("tm/reloadMastertasks")}),this.$events.on("show-unable-to-edit-office-task-modal",({mode:e})=>{this.$refs["z-unable-to-edit-office-task-modal"].showModal({mode:e})}),this.$events.on("show-unable-to-complete-task-modal",({subtask:e})=>{this.$refs["z-unable-to-complete-task-modal"].showModal({subtask:e})}),this._showModalsAfterInicialization()},methods:{onTeamUpdate(e){this.$events.emit("on-team-update",e)},onTaskDeleted(e){this.$events.emit("on-subtask-deleted",e)},onBlockerDeleted(e){this.$events.emit("on-blocker-deleted",e)},onTaskEdited(e){this.$events.emit("on-subtask-edited",e)},onMasterTaskDeleted(e){this.$events.emit("on-mastertask-deleted",e)},onMasterTaskEdited(e){this.$events.emit("on-mastertask-edited",e)},_showModalsAfterInicialization(e=0){setTimeout(()=>e>50?this.$router.push({name:this.$route.name}):this.$store.getters["tm/isInitialized"]?this.$route.query["mastertask"]?this.$events.emit("show-mastertask-modal",{mastertask:{id:this.$route.query["mastertask"]},editMode:!1}):this.$route.query["subtask"]?this.$events.emit("show-subtask-modal",{subtask:{id:this.$route.query["subtask"]},editMode:!1}):void 0:this._showModalsAfterInicialization(e+1),300)}}};const $o=(0,A.A)(Co,[["render",k]]);var xo=$o,So=s(81387);const Fo=[{path:"",redirect:"/auth"},{path:"/auth/",component:()=>s.e(2416).then(s.bind(s,32416)),children:[{path:"",redirect:"/auth/login"},{path:"/auth/login",name:"Login",component:()=>s.e(1481).then(s.bind(s,41481)),meta:{requiresAuth:!1}},{path:"/auth/forgot-password",name:"Forgot password",component:()=>s.e(1173).then(s.bind(s,61173)),meta:{requiresAuth:!1}},{path:"/auth/forgot-success",name:"Forgot success",component:()=>s.e(987).then(s.bind(s,987)),meta:{requiresAuth:!1}},{path:"/auth/reset-password",name:"Reset password",component:()=>s.e(7116).then(s.bind(s,97116)),meta:{requiresAuth:null}}]},{path:"/app",component:()=>s.e(9202).then(s.bind(s,9202)),children:[{path:"",redirect:"/app/dashboard"},{path:"/app/dashboard",redirect:"/app/dashboard/tasks",children:[{path:"/app/dashboard/tasks",name:"Dashboard - Tasks",meta:{title:"Sub Tasks",requiresAuth:!0},component:()=>Promise.all([s.e(8081),s.e(5714)]).then(s.bind(s,79411))},{path:"/app/dashboard/tasks-concepts",name:"Dashboard - Tasks Concepts",meta:{title:"Draft Tasks",requiresAuth:!0},component:()=>s.e(1720).then(s.bind(s,1720))},{path:"/app/dashboard/teams",name:"Dashboard - Teams",meta:{title:"Teams Overview",requiresAuth:!0},component:()=>Promise.all([s.e(8081),s.e(9841)]).then(s.bind(s,18104))},{path:"/app/dashboard/projects",name:"Dashboard - Projects",meta:{title:"Projects overview",requiresAuth:!0},component:()=>s.e(8352).then(s.bind(s,78352))},{path:"/app/overview/unscheduled",name:"Overview - Unscheduled tasks",meta:{title:"Unscheduled Sub Tasks",requiresAuth:!0},component:()=>s.e(528).then(s.bind(s,60528))},{path:"/app/overview/ongoing",name:"Overview - Ongoing tasks",meta:{title:"Ongoing Sub Tasks",requiresAuth:!0},component:()=>s.e(9721).then(s.bind(s,79721))},{path:"/app/overview/teams",name:"Overview - Teams",meta:{title:"Teams",requiresAuth:!0},component:()=>s.e(7914).then(s.bind(s,47914))},{path:"/app/dashboard/user",name:"Dashboard - User",meta:{title:"Profile",requiresAuth:!0},component:()=>s.e(5282).then(s.bind(s,55282))},{path:"/app/search",name:"Search",meta:{title:"Search Results",requiresAuth:!0},component:()=>s.e(2947).then(s.bind(s,22947))}]}]},{path:"/:catchAll(.*)",name:"404",component:()=>s.e(2281).then(s.bind(s,92281)),meta:{requiresAuth:null}}],zo=(0,So.aE)({history:(0,So.Bt)("/"),routes:Fo});zo.beforeEach((e,t,s)=>{const i=St.getters["auth/isLoggedIn"];return!0===e.meta.requiresAuth?i?s():s({name:"Login"}):!1===e.meta.requiresAuth&&i?s({name:"Dashboard - Tasks"}):s()});var Ao=zo,Lo=s(94348);xt.A.defaults.baseURL="https://tm.jandl.sk/api/";var Ro={async get(e,t){return xt.A.get(e,t).then(e=>e.data).catch(e=>Promise.reject(e))},async get_auth(e,t){return t=this._config(t),xt.A.get(e,t).then(e=>e.data).catch(e=>Promise.reject(e))},async get_data(e,t){return xt.A.get(e,t).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async get_auth_data(e,t){return t=this._config(t),xt.A.get(e,t).then(e=>Promise.resolve(e.data.data)).catch(e=>Promise.reject(e.response||e))},async post(e,t=null,s){return xt.A.post(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async post_auth(e,t=null,s){return s=this._config(s),xt.A.post(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async post_data(e,t=null,s){return xt.A.post(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async post_auth_data(e,t=null,s){return s=this._config(s),xt.A.post(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async delete(e,t){return xt.A.delete(e,t).then(e=>e.data).catch(e=>Promise.reject(e))},async delete_auth(e,t){return t=this._config(t),xt.A.delete(e,t).then(e=>e.data).catch(e=>Promise.reject(e))},async delete_data(e,t){return xt.A.delete(e,t).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async delete_auth_data(e,t){return t=this._config(t),xt.A.delete(e,t).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async patch(e,t=null,s){return xt.A.patch(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async patch_auth(e,t=null,s){return s=this._config(s),xt.A.patch(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async patch_data(e,t=null,s){return xt.A.patch(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async patch_auth_data(e,t=null,s){return s=this._config(s),xt.A.patch(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async put(e,t=null,s){return xt.A.put(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async put_auth(e,t=null,s){return s=this._config(s),xt.A.put(e,t,s).then(e=>e.data).catch(e=>Promise.reject(e))},async put_data(e,t=null,s){return xt.A.put(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},async put_auth_data(e,t=null,s){return s=this._config(s),xt.A.put(e,t,s).then(e=>e.data.data).catch(e=>Promise.reject(e.response||e))},_config(e){return e&&Lo.error("NOT IMPLEMENTED"),St.getters["auth/token"]?{headers:{Authorization:`Bearer ${St.getters["auth/token"]}`}}:{headers:{}}}},jo={install:(e,t)=>{t&&!0===t.disabled||(e.config.globalProperties.$axios=Ro)}};const Wo=e=>Object.entries(e).map(e=>e.map(encodeURIComponent).join("=")).join("&");function Vo(e){let t=e;return t=t.replace(/\//g,"\\/"),t=t.replace(/\./g,"\\."),t=t.replace(/\([^)]+\)/g,"[^/]+"),t}var Oo=s(94348);class Io{constructor(){this._mocks={},xt.A.interceptors.request.use(this._redirectRequestToMock.bind(this)),this._mocks={}}mock(e){for(const t in e){let s=e[t];!1!==s&&(s={},s.name=t,s.url=t.split(" ")[1],s.reUrl||(s.reUrl=Vo(s.url)),s.matchMethod||(s.matchMethod=t.split(" ")[0].toLowerCase()),this._mocks[t]=s)}}_redirectRequestToMock(e){const t=e.url.replace(/https?:\/\/[^/?]+/,"");let s;for(const i in this._mocks){const a=this._mocks[i];if(e.method==a.matchMethod&&t.match(a.reUrl)){s=a;break}}if(s){s.fname||(s.fname={VUE_APP_WAXIOS_URL:"https://tm.jandl.sk/api/",NODE_ENV:"production",BASE_URL:"/"}.VUE_APP_PLATFORM?`/mock/${{VUE_APP_WAXIOS_URL:"https://tm.jandl.sk/api/",NODE_ENV:"production",BASE_URL:"/"}.VUE_APP_PLATFORM}/${s.url}.${e.method.toUpperCase()}.json`:`/mock/${s.url}.${e.method.toUpperCase()}.json`),Oo.log(s.fname=`/mock/${s.url}.${e.method.toUpperCase()}.json`);const t={method:"get",url:window.location.origin+s.fname+"?___MOCK___&"+Wo(e.data||{})};e={...e,...t}}return e}}var Ho={install:(e,t)=>{const s=new Io;t&&t.routes&&Object.values(t.routes).length&&!0!==t.disabled&&s.mock(t.routes)}},Yo=s(38385),Bo={install:(e,t)=>{if(t&&!0===t.disabled)return;const s=(0,Yo.A)();e.config.globalProperties.$events=s}},Xo=s(85384),No=s(70192),Po=s(94348);class Uo{constructor(e){this.currentLanguage=(0,Ct.KR)(),this.availableLanguages=void 0,this.vendorI18n=void 0,this.defaultLanguage=void 0,this.languageKey=void 0,this._missingTranslation=(e,t,s,i)=>t,this._postTranslation=e=>e,this.availableLanguages=e.languages||[],this.defaultLanguage=e.languages.find(t=>t.value==e.defaultLanguage),this.languageKey=e.languageKey||{VUE_APP_WAXIOS_URL:"https://tm.jandl.sk/api/",NODE_ENV:"production",BASE_URL:"/"}.VUE_APP_PLATFORM+"_language"||0,this.vendorI18n=(0,Xo.hU)({legacy:!0,fallbackLocale:this.defaultLanguage.value,messages:this._loadLocaleMessages(),missing:this._missingTranslation,postTranslation:this._postTranslation}),this.changeLanguage({title:"Slovenský",flag:"sk",value:"sk"}),this.initCurrentLanguage()}async initCurrentLanguage(){const{value:e}=await No.p.get({key:this.languageKey});if(e)this.currentLanguage.value=JSON.parse(e);else if(this.defaultLanguage)this.currentLanguage.value=this.defaultLanguage;else{if(!this.availableLanguages[0])return Po.error("[w18n] Could not init current language");this.currentLanguage.value=this.availableLanguages[0]}const t={};this.availableLanguages.forEach(e=>{t[e.value]=e.title}),this.changeLanguage(this.currentLanguage.value),this._addAxiosHeaders()}changeLanguage(e){this.currentLanguage.value=e,this._addAxiosHeaders(),No.p.set({key:this.languageKey,value:JSON.stringify(e)}),this.vendorI18n.global.locale=e.value}_addAxiosHeaders(){xt.A.interceptors.request.use(e=>(this.currentLanguage.value&&this.currentLanguage.value.value&&(e.headers["Accept-Language"]=this.currentLanguage.value.value),e)),xt.A.interceptors.response.use(e=>e,e=>Promise.reject(e?.response||e))}_loadLocaleMessages(e="@/locales"){let t;try{t=s(35679)}catch(a){return Po.warn("[@wezeo/i18n] Could not initialize i18n. Missing folder /src/locales."),{}}const i={};return t.keys().forEach(e=>{const s=e.match(/([A-Za-z0-9-_]+)\./i);if(s&&s.length>1){const a=s[1];i[a]=t(e)}}),i}}var qo=s(94348),Ko={install:(e,t)=>{if(t&&!0===t.disabled)return;if(!t||!t.languages||!t.defaultLanguage)return qo.warn("[@wezeo/i18n] Could not initialize i18n. Missing configuration options.");e.config.globalProperties.$events||e.use(Bo);const s=new Uo(t);e.use(s.vendorI18n),e.config.globalProperties.$w18n=s}},Zo={install:(e,t)=>{t&&!0===t.disabled||(e.component("IonContent",a.W9),e.component("IonPage",a.AO),e.component("IonLabel",a.he),e.component("IonBackButton",a.el),e.component("IonCheckbox",a.eY),e.component("IonText",a.IO),e.component("IonButton",a.Jm),e.component("IonItem",a.uz),e.component("IonItemGroup",a.jh),e.component("IonItemSliding",a.A7),e.component("IonItemOption",a.LU),e.component("IonItemOptions",a.CE),e.component("IonToolbar",a.ai),e.component("IonHeader",a.eU),e.component("IonFooter",a.M0),e.component("IonSlides",a.tR),e.component("IonSlide",a.q3),e.component("IonSpinner",a.w2),e.component("IonRow",a.ln),e.component("IonCol",a.hU),e.component("IonGrid",a.lO),e.component("IonInput",a.$w),e.component("IonButtons",a.QW),e.component("IonIcon",a.iq),e.component("IonImg",a.KW),e.component("IonList",a.nf),e.component("IonSkeletonText",a.ds),e.component("IonTitle",a.BC),e.component("IonMenu",a.oS),e.component("IonSplitPane",a.HP),e.component("IonMenuButton",a.MC),e.component("IonRouterOutlet",a.Rg),e.component("IonSegment",a.Gp),e.component("IonSegmentButton",a.eP),e.component("IonVirtualScroll",a.Zw),e.component("IonTextarea",a.nc),e.component("IonSearchbar",a.S1),e.component("IonRefresherContent",a.Ki),e.component("IonRefresher",a.To),e.component("IonInfiniteScrollContent",a.Hp),e.component("IonInfiniteScroll",a.Ax),e.component("IonAvatar",a.mC),e.component("IonThumbnail",a.Zx),e.component("IonModal",a.Sb),e.component("IonRadioGroup",a.f0),e.component("IonRadio",a.KO),e.component("IonNote",a.JI),e.component("IonCard",a.b_),e.component("IonCardContent",a.I9),e.component("IonTabBar",a.Jq),e.component("IonTabButton",a.qW),e.component("IonMenuToggle",a.cA),e.component("IonFab",a.Q8),e.component("IonFabButton",a.YW),e.component("IonFabList",a.OL),e.component("IonReorderGroup",a.p$),e.component("IonReorder",a.UB),e.component("IonSelect",a.Nm),e.component("IonSelectOption",a.Ip),e.component("IonToggle",a.BY),e.component("IonBadge",a.In),e.component("IonChip",a.ZB),e.component("IonTabs",a.p4))}};async function Qo(e){return"Unauthenticated."==e?.response?.data?.message?St.dispatch("auth/logout"):Promise.reject(e)}xt.A.interceptors.response.use(e=>e,e=>Qo(e));var Jo=s(94348),Go={namespaced:!0,state:{token:localStorage.getItem("wzo_vue_user_token")||"",user:JSON.parse(localStorage.getItem("wzo_vue_user_user")||"{}")},mutations:{auth_success(e,t){t.token&&(e.token=t.token,localStorage.setItem("wzo_vue_user_token",t.token)),t.user&&(e.user=t.user,localStorage.setItem("wzo_vue_user_user",JSON.stringify(t.user)))},auth_error(e){e.token="",localStorage.removeItem("wzo_vue_user_token"),localStorage.removeItem("wzo_vue_user_user")},logout(e){e.token="",e.user=null,localStorage.removeItem("wzo_vue_user_token"),localStorage.removeItem("wzo_vue_user_user"),window.open(location.origin,"_self")}},actions:{login({commit:e},t){return new Promise((s,i)=>{Ro.post("v1/tokens/create",{data:t}).then(t=>{const i=t.token,a=t.user;e("auth_success",{token:i,user:a}),s(t)}).catch(t=>{e("auth_error"),i(t)})})},signup({commit:e},t){return new Promise((s,i)=>{e("auth_request"),Ro.post_data("v1/auth/signup",t).then(t=>{const i=t.token,a=t.user;e("auth_success",{token:i,user:a}),s(t)}).catch(t=>{e("auth_error"),i(t)})})},logout({commit:e}){return new Promise(t=>{Ro.post_auth_data("v1/auth/invalidate").finally(()=>{e("logout"),t(null)})})},forgotPassword({commit:e},t){return new Promise((e,s)=>{Ro.post("v1/users/forgot",{data:t}).then(t=>e(t)).catch(e=>s(e))})},resetPassword({commit:e},t){return e("auth_success",{token:t.token}),new Promise((s,i)=>{Ro.post_auth_data("v1/users/reset",{data:t}).then(t=>{e("logout"),s(t)}).catch(e=>i(e))})},async refreshToken({commit:e}){try{const t=await Ro.post_auth_data("v1/auth/refresh"),s=t.token,i=t.user;return e("auth_success",{token:s,user:i}),s}catch(t){e("auth_error"),Jo.error(t)}},async userInfo({commit:e}){return new Promise((t,s)=>{Ro.get_auth_data("v1/auth/info").then(s=>{const i=s.user;e("auth_success",{user:i}),t(i)}).catch(e=>{s(e)})})},updateUserInfo({commit:e},t){return new Promise((s,i)=>{Ro.put_auth(`v1/users/${t.id}`,{data:t}).then(t=>{const i=t.user;e("auth_success",{user:i}),s(i)}).catch(e=>{i(e)})})}},getters:{isLoggedIn:e=>!!e.token,user:e=>e.user,token:e=>e.token&&void 0!=e.token?e.token:null}},er=s(94348),tr={install:(e,t)=>{if(!t||1!=t.disabled)return e.config.globalProperties.$store?void e.config.globalProperties.$store.registerModule("auth",Go):er.warn("[w/auth] Could not initialize. App does not have vuex store added.")}},sr={install:(e,t)=>{t&&!0===t.disabled||(e.use(Ai()),e.config.globalProperties.$parseError=e=>e?.data?.message||e?.response?.data?.message||e?.message||e)}};const ir={ref:"loadingContainer"},ar={key:0},lr={key:1},nr={key:2};function or(e,t,s,i,a,l){return(0,m.uX)(),(0,m.CE)("div",ir,[s.content?s.content.error?((0,m.uX)(),(0,m.CE)("div",lr,(0,v.v_)(s.content.error),1)):"array"==typeof s.content&&!e.array.length||"object"==typeof s.content&&!Object.values(s.content).length?((0,m.uX)(),(0,m.CE)("div",nr,(0,v.v_)(s.emptyMessage),1)):(0,m.RG)(e.$slots,"default",{key:3},void 0,!0):((0,m.uX)(),(0,m.CE)("div",ar))],512)}var rr={props:{content:{type:[Object,Array,Boolean],default:()=>null},emptyMessage:{type:String,default:"No items"}},data(){return{loader:null}},watch:{},async mounted(){this.content||await this._startLoading()},methods:{async _startLoading(){},_stopLoading(){}}};const dr=(0,A.A)(rr,[["render",or],["__scopeId","data-v-0294e4c6"]]);var ur=dr,cr={install:(e,t)=>{t&&!0===t.disabled||e.component("WLoadable",ur)}},mr={install:(e,t={})=>{Bo.install(e,t.events),jo.install(e,t.axios),Ko.install(e,t.i18n),Ho.install(e,t.moxios),Zo.install(e,t.ionic),tr.install(e,t.auth),sr.install(e,t.toast),cr.install(e,t.loadable)}},hr={install:(e,t)=>{t&&!0===t.disabled||(e.config.globalProperties.$axios=At)}},pr={namespaced:!0,state:{mastertasks:null,employees:null,teams:null,projects:null,unscheduledSubtasks:null,ongoingSubtasks:null,initialized:!1,ongoingSubtasksEmployeeId:null,unscheduledSubtasksEmployeeId:null},mutations:{set_mastertasks(e,t){e.mastertasks=t},set_employees(e,t){e.employees=t},set_teams(e,t){e.teams=t},set_projects(e,t){e.projects=t},set_unscheduled_subtasks(e,t){e.unscheduledSubtasks=t},set_ongoing_subtasks(e,t){e.ongoingSubtasks=t},remove_ongoing_subtask(e,t){e.ongoingSubtasks=e.ongoingSubtasks.filter(e=>e.id!=t)},update_team(e,t){e.teams=e.teams.map(e=>e.id==t.id?t:e)},save_team(e,t){e.teams.push(t)},delete_team(e,t){e.teams=e.teams.filter(e=>e.id!=t.id)},update_subtask(e,t){e.unscheduledSubtasks&&(e.unscheduledSubtasks=e.unscheduledSubtasks.map(e=>e?.id==t?.id?t:e)),e.ongoingSubtasks&&(e.ongoingSubtasks=e.ongoingSubtasks.map(e=>e?.id==t?.id?t:e))},delete_subtask(e,t){e.unscheduledSubtasks=e.unscheduledSubtasks.filter(e=>e.id!=t.id),e.ongoingSubtasks=e.ongoingSubtasks.filter(e=>e.id!=t.id)},set_ongoing_subtasks_employee_id(e,t){e.ongoingSubtasksEmployeeId=t},set_unscheduled_subtasks_employee_id(e,t){e.unscheduledSubtasksEmployeeId=t},initialized(e){e.initialized=!0}},actions:{initialize({dispatch:e,commit:t}){return Promise.all([e("loadMastertasks"),e("loadEmployees"),e("loadTeams"),e("loadProjects"),e("loadUnscheduledSubtasks"),e("loadOngoingSubtasks")]).then(()=>t("initialized"))},reloadSubtasks({dispatch:e}){return Promise.all([e("loadMastertasks"),e("loadProjects"),e("loadUnscheduledSubtasks"),e("loadOngoingSubtasks")])},reloadMastertasks({dispatch:e}){return Promise.all([e("loadMastertasks")])},loadMastertasks({commit:e}){return new Promise((t,s)=>{At.get_auth("v1/mastertasks/?simple=true").then(({mastertasks:s})=>{e("set_mastertasks",s),t(s)}).catch(t=>{e("set_mastertasks",{error:t}),s(t)})})},loadEmployees({commit:e}){return new Promise((t,s)=>{At.get_auth_data("v1/employees").then(s=>{e("set_employees",s),t(s)}).catch(t=>{e("set_employees",{error:t}),s(t)})})},loadTeams({commit:e}){return new Promise((t,s)=>{At.get_auth_data("v1/teams").then(s=>{e("set_teams",s),t(s)}).catch(t=>{e("set_teams",{error:t}),s(t)})})},loadProjects({commit:e}){return new Promise((t,s)=>{At.get_auth_data("v1/projects").then(s=>{e("set_projects",s),t(s)}).catch(t=>{e("set_projects",{error:t}),s(t)})})},loadUnscheduledSubtasks({commit:e,state:t},s=void 0){let i;return s?(i=s,e("set_unscheduled_subtasks_employee_id",s)):i=t.unscheduledSubtasksEmployeeId?t.unscheduledSubtasksEmployeeId:St.getters["auth/user"]?.id,new Promise((t,s)=>{At.get_auth(`v1/subtasks?type=unscheduled&employee_id=${i}`).then(({subtasks:s})=>{e("set_unscheduled_subtasks",s),t(s)}).catch(t=>{e("set_unscheduled_subtasks",{error:t}),s(t)})})},loadOngoingSubtasks({commit:e,state:t},s=void 0){let i;return s?(i=s,e("set_ongoing_subtasks_employee_id",s)):t.ongoingSubtasksEmployeeId?i=t.ongoingSubtasksEmployeeId:(i=St.getters["auth/user"]?.id,e("set_ongoing_subtasks_employee_id",i)),new Promise((t,s)=>{At.get_auth(`v1/subtasks?type=ongoing&employee_id=${i}`).then(({subtasks:s})=>{e("set_ongoing_subtasks",s),t(s)}).catch(t=>{e("set_ongoing_subtasks",{error:t}),s(t)})})},removeOngoingSubtask({commit:e},t){e("remove_ongoing_subtask",t)}},getters:{mastertasks:e=>e.mastertasks,employees:e=>e.employees,enrichedEmployees:e=>e.employees?e.employees.map(e=>({...e,_fullName:`${e.name} ${e.surname}`,_initials:e.name.charAt(0)+e.surname.charAt(0)})).sort((e,t)=>e.name<t.name?-1:1):[],teams:e=>e.teams,projects:e=>e.projects,unscheduledSubtasks:e=>e.unscheduledSubtasks,ongoingSubtasks:e=>e.ongoingSubtasks,isInitialized:e=>e.initialized}},kr={install:e=>{e.config.globalProperties.$store.registerModule("tm",pr)}};const vr=["lang"],br={key:0,class:"vuecal__flex vuecal__body",grow:"grow"},fr=["onBlur","innerHTML"],_r=["innerHTML"],gr=["innerHTML"],yr={class:"vuecal__flex",row:"row",grow:"grow"},wr={key:0,class:"vuecal__time-column"},Dr={class:"vuecal__time-cell-label"},Tr={key:1,class:"vuecal__flex vuecal__week-numbers",column:"column"},Er=["wrap","column"],Mr=["onBlur","innerHTML"],Cr=["innerHTML"],$r=["innerHTML"],xr=["wrap"],Sr=["innerHTML"],Fr=["innerHTML"],zr={key:2,class:"vuecal__cell-events-count"},Ar={key:3,class:"vuecal__no-event"},Lr=["onBlur","innerHTML"],Rr=["innerHTML"],jr={key:2,class:"vuecal__event-time"},Wr={key:0},Vr={key:1,class:"days-to-end"},Or=["innerHTML"],Ir={key:0,class:"vuecal__scrollbar-check"};function Hr(e,t,s,a,l,n){const o=(0,m.g2)("vuecal-header"),r=(0,m.g2)("all-day-bar"),d=(0,m.g2)("weekdays-headings"),u=(0,m.g2)("vuecal-cell");return(0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["vuecal__flex vuecal",n.cssClasses]),column:"column",ref:"vuecal",lang:s.locale},[(0,m.bF)(o,{options:e.$props,"edit-events":n.editEvents,"view-props":{views:n.views,weekDaysInHeader:n.weekDaysInHeader},"week-days":n.weekDays,"has-splits":n.hasSplits,"day-splits":n.daySplits,"switch-to-narrower-view":n.switchToNarrowerView},(0,m.eX)({_:2},[e.$slots["weekday-heading"]?{name:"weekday-heading",fn:(0,m.k6)(({heading:t,view:s})=>[(0,m.RG)(e.$slots,"weekday-heading",{heading:t,view:s})]),key:"0"}:void 0,e.$slots["split-label"]?{name:"split-label",fn:(0,m.k6)(({split:t,view:s})=>[(0,m.RG)(e.$slots,"split-label",{split:t,view:s.id})]),key:"1"}:void 0]),1032,["options","edit-events","view-props","week-days","has-splits","day-splits","switch-to-narrower-view"]),s.hideBody?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",br,[(0,m.bF)(i.eB,{name:`slide-fade--${l.transitionDirection}`,appear:s.transitions},{default:(0,m.k6)(()=>[((0,m.uX)(),(0,m.CE)("div",{class:"vuecal__flex",style:{"min-width":"100%"},key:!!s.transitions&&l.view.id,column:"column"},[s.showAllDayEvents&&n.hasTimeColumn&&(!n.cellOrSplitMinWidth||n.isDayView&&!s.minSplitWidth)?((0,m.uX)(),(0,m.Wv)(r,(0,v._B)((0,m.v6)({key:0},n.allDayBar)),{event:(0,m.k6)(({event:t,view:s})=>[(0,m.RG)(e.$slots,"event",{view:s,event:t},()=>[n.editEvents.title&&t.titleEditable?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"vuecal__event-title vuecal__event-title--edit",contenteditable:"contenteditable",onBlur:e=>n.onEventTitleBlur(e,t),innerHTML:t.title},null,40,fr)):t.title?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__event-title",innerHTML:t.title},null,8,_r)):(0,m.Q3)("",!0),!t.content||n.hasShortEvents||n.isShortMonthView?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",{key:2,class:"vuecal__event-content",innerHTML:t.content},null,8,gr))])]),_:3},16)):(0,m.Q3)("",!0),(0,m.Lk)("div",{class:(0,v.C4)(["vuecal__bg",{vuecal__flex:!n.hasTimeColumn}]),column:"column",ref:"vuecal_scroll"},[(0,m.Lk)("div",yr,[n.hasTimeColumn?((0,m.uX)(),(0,m.CE)("div",wr,[s.showAllDayEvents&&n.cellOrSplitMinWidth&&(!n.isDayView||s.minSplitWidth)?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"vuecal__all-day-text",style:(0,v.Tr)({height:n.allDayBar.height})},[(0,m.Lk)("span",null,(0,v.v_)(l.texts.allDay),1)],4)):(0,m.Q3)("",!0),((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.timeCells,(i,a)=>((0,m.uX)(),(0,m.CE)("div",{class:"vuecal__time-cell",key:a,style:(0,v.Tr)(`height: ${s.timeCellHeight}px`)},[(0,m.RG)(e.$slots,"time-cell",{hours:i.hours,minutes:i.minutes},()=>[t[0]||(t[0]=(0,m.Lk)("span",{class:"vuecal__time-cell-line"},null,-1)),(0,m.Lk)("span",Dr,(0,v.v_)(i.label),1)])],4))),128))])):(0,m.Q3)("",!0),s.showWeekNumbers&&n.isMonthView?((0,m.uX)(),(0,m.CE)("div",Tr,[((0,m.uX)(),(0,m.CE)(m.FK,null,(0,m.pI)(6,t=>(0,m.Lk)("div",{class:"vuecal__flex vuecal__week-number-cell",key:t,grow:"grow"},[(0,m.RG)(e.$slots,"week-number-cell",{week:n.getWeekNumber(t-1)},()=>[(0,m.eW)((0,v.v_)(n.getWeekNumber(t-1)),1)])])),64))])):(0,m.Q3)("",!0),(0,m.Lk)("div",{class:(0,v.C4)(["vuecal__flex vuecal__cells vuecal__scrollable-body",`${l.view.id}-view`]),grow:"grow",wrap:!n.cellOrSplitMinWidth||!n.isWeekView,column:!!n.cellOrSplitMinWidth},[n.cellOrSplitMinWidth&&n.isWeekView?((0,m.uX)(),(0,m.Wv)(d,{key:0,"transition-direction":l.transitionDirection,"week-days":n.weekDays,"switch-to-narrower-view":n.switchToNarrowerView,style:(0,v.Tr)(n.cellOrSplitMinWidth?`min-width: ${n.cellOrSplitMinWidth}px`:""),unscheduledTime:s.unscheduledTime,ref:"vuecal_weekday_heading"},(0,m.eX)({_:2},[e.$slots["weekday-heading"]?{name:"weekday-heading",fn:(0,m.k6)(({heading:t,view:s})=>[(0,m.RG)(e.$slots,"weekday-heading",{heading:t,view:s})]),key:"0"}:void 0,e.$slots["split-label"]?{name:"split-label",fn:(0,m.k6)(({split:t})=>[(0,m.RG)(e.$slots,"split-label",{split:t,view:l.view.id})]),key:"1"}:void 0]),1032,["transition-direction","week-days","switch-to-narrower-view","style","unscheduledTime"])):n.hasSplits&&s.stickySplitLabels&&s.minSplitWidth?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__flex vuecal__split-days-headers",ref:"vuecal_splits_heading",style:(0,v.Tr)(n.cellOrSplitMinWidth?`min-width: ${n.cellOrSplitMinWidth}px`:"")},[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.daySplits,(t,s)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["day-split-header",t.class||!1]),key:s},[(0,m.RG)(e.$slots,"split-label",{split:t,view:l.view.id},()=>[(0,m.eW)((0,v.v_)(t.label),1)])],2))),128))],4)):(0,m.Q3)("",!0),s.showAllDayEvents&&n.hasTimeColumn&&(n.isWeekView&&n.cellOrSplitMinWidth||n.isDayView&&n.hasSplits&&s.minSplitWidth)?((0,m.uX)(),(0,m.Wv)(r,(0,v._B)((0,m.v6)({key:2},n.allDayBar)),{event:(0,m.k6)(({event:t,view:s})=>[(0,m.RG)(e.$slots,"event",{view:s,event:t},()=>[n.editEvents.title&&t.titleEditable?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"vuecal__event-title vuecal__event-title--edit",contenteditable:"contenteditable",onBlur:e=>n.onEventTitleBlur(e,t),innerHTML:t.title},null,40,Mr)):t.title?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__event-title",innerHTML:t.title},null,8,Cr)):(0,m.Q3)("",!0),!t.content||n.hasShortEvents||n.isShortMonthView?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",{key:2,class:"vuecal__event-content",innerHTML:t.content},null,8,$r))])]),_:3},16)):(0,m.Q3)("",!0),(0,m.Lk)("div",{class:"vuecal__flex vuecal__cells-body",ref:e=>l.cellsEl=e,grow:"grow",wrap:!n.cellOrSplitMinWidth||!n.isWeekView,style:(0,v.Tr)(n.cellOrSplitMinWidth?`min-width: ${n.cellOrSplitMinWidth}px`:"")},[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.viewCells,(t,i)=>((0,m.uX)(),(0,m.Wv)(u,{key:i,options:e.$props,"edit-events":n.editEvents,data:t,"cell-width":s.hideWeekdays.length&&(n.isWeekView||n.isMonthView)&&n.cellWidth,"min-timestamp":n.minTimestamp,"max-timestamp":n.maxTimestamp,"cell-splits":n.hasSplits&&n.daySplits||[]},{"cell-content":(0,m.k6)(({events:i,split:a,selectCell:o})=>[(0,m.RG)(e.$slots,"cell-content",{cell:t,view:l.view,goNarrower:o,events:i},()=>[a&&!s.stickySplitLabels?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"split-label",innerHTML:a.label},null,8,Sr)):(0,m.Q3)("",!0),t.content?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__cell-date",innerHTML:t.content},null,8,Fr)):(0,m.Q3)("",!0),(n.isMonthView&&!s.eventsOnMonthView||n.isYearsOrYearView&&s.eventsCountOnYearView)&&i.length?((0,m.uX)(),(0,m.CE)("div",zr,[(0,m.RG)(e.$slots,"events-count",{view:l.view,events:i},()=>[(0,m.eW)((0,v.v_)(i.length),1)])])):(0,m.Q3)("",!0),!n.cellOrSplitHasEvents(i,a)&&n.isWeekOrDayView?((0,m.uX)(),(0,m.CE)("div",Ar,[(0,m.RG)(e.$slots,"no-event",{},()=>[(0,m.eW)((0,v.v_)(l.texts.noEvent),1)])])):(0,m.Q3)("",!0)])]),event:(0,m.k6)(({event:i,view:a})=>[(0,m.RG)(e.$slots,"event",{view:a,event:i},()=>[n.editEvents.title&&i.titleEditable?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"vuecal__event-title vuecal__event-title--edit",contenteditable:"contenteditable",onBlur:e=>n.onEventTitleBlur(e,i),innerHTML:i.title},null,40,Lr)):i.title?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__event-title",innerHTML:i.title},null,8,Rr)):(0,m.Q3)("",!0),!s.time||i.allDay||n.isMonthView&&(i.allDay||"short"===s.showAllDayEvents)||n.isShortMonthView?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",jr,[(0,m.eW)((0,v.v_)(l.utils.date.formatTime(i.start,n.TimeFormat)),1),i.endTimeMinutes?((0,m.uX)(),(0,m.CE)("span",Wr," - "+(0,v.v_)(l.utils.date.formatTime(i.end,n.TimeFormat,null,!0)),1)):(0,m.Q3)("",!0),i.daysCount>1&&(i.segments[t.formattedDate]||{}).isFirstDay?((0,m.uX)(),(0,m.CE)("small",Vr," +"+(0,v.v_)(i.daysCount-1)+(0,v.v_)((l.texts.day[0]||"").toLowerCase()),1)):(0,m.Q3)("",!0)])),!i.content||n.isMonthView&&i.allDay&&"short"===s.showAllDayEvents||n.isShortMonthView?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",{key:3,class:"vuecal__event-content",innerHTML:i.content},null,8,Or))])]),_:2},1032,["options","edit-events","data","cell-width","min-timestamp","max-timestamp","cell-splits"]))),128))],12,xr)],10,Er)])],2)]))]),_:3},8,["name","appear"]),l.ready?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",Ir,[...t[1]||(t[1]=[(0,m.Lk)("div",null,null,-1)])]))]))],10,vr)}s(89471);let Yr,Br,Xr,Nr,Pr={},Ur={};class qr{constructor(e,t=!1){this.texts={},this.dateToMinutes=e=>60*e.getHours()+e.getMinutes(),Nr=this,this._texts=e,t||!Date||Date.prototype.addDays||this._initDatePrototypes()}_initDatePrototypes(){Date.prototype.addDays=function(e){return Nr.addDays(this,e)},Date.prototype.subtractDays=function(e){return Nr.subtractDays(this,e)},Date.prototype.addHours=function(e){return Nr.addHours(this,e)},Date.prototype.subtractHours=function(e){return Nr.subtractHours(this,e)},Date.prototype.addMinutes=function(e){return Nr.addMinutes(this,e)},Date.prototype.subtractMinutes=function(e){return Nr.subtractMinutes(this,e)},Date.prototype.getWeek=function(){return Nr.getWeek(this)},Date.prototype.isToday=function(){return Nr.isToday(this)},Date.prototype.isLeapYear=function(){return Nr.isLeapYear(this)},Date.prototype.format=function(e="YYYY-MM-DD"){return Nr.formatDate(this,e)},Date.prototype.formatTime=function(e="HH:mm"){return Nr.formatTime(this,e)}}removePrototypes(){delete Date.prototype.addDays,delete Date.prototype.subtractDays,delete Date.prototype.addHours,delete Date.prototype.subtractHours,delete Date.prototype.addMinutes,delete Date.prototype.subtractMinutes,delete Date.prototype.getWeek,delete Date.prototype.isToday,delete Date.prototype.isLeapYear,delete Date.prototype.format,delete Date.prototype.formatTime}updateTexts(e){this._texts=e}_todayFormatted(){return Br!==(new Date).getDate()&&(Yr=new Date,Br=Yr.getDate(),Xr=`${Yr.getFullYear()}-${Yr.getMonth()}-${Yr.getDate()}`),Xr}addDays(e,t){const s=new Date(e.valueOf());return s.setDate(s.getDate()+t),s}subtractDays(e,t){const s=new Date(e.valueOf());return s.setDate(s.getDate()-t),s}addHours(e,t){const s=new Date(e.valueOf());return s.setHours(s.getHours()+t),s}subtractHours(e,t){const s=new Date(e.valueOf());return s.setHours(s.getHours()-t),s}addMinutes(e,t){const s=new Date(e.valueOf());return s.setMinutes(s.getMinutes()+t),s}subtractMinutes(e,t){const s=new Date(e.valueOf());return s.setMinutes(s.getMinutes()-t),s}getWeek(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),s=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-s);const i=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t-i)/864e5+1)/7)}isToday(e){return`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`===this._todayFormatted()}isLeapYear(e){const t=e.getFullYear();return!(t%400)||t%100&&!(t%4)}getPreviousFirstDayOfWeek(e=null,t){const s=e&&new Date(e.valueOf())||new Date,i=t?7:6;return s.setDate(s.getDate()-(s.getDay()+i)%7),s}stringToDate(e){return e instanceof Date?e:(10===e.length&&(e+=" 00:00"),new Date(e.replace(/-/g,"/")))}countDays(e,t){"string"===typeof e&&(e=e.replace(/-/g,"/")),"string"===typeof t&&(t=t.replace(/-/g,"/")),e=new Date(e).setHours(0,0,0,0),t=new Date(t).setHours(0,0,1,0);const s=60*(new Date(t).getTimezoneOffset()-new Date(e).getTimezoneOffset())*1e3;return Math.ceil((t-e-s)/864e5)}datesInSameTimeStep(e,t,s){return Math.abs(e.getTime()-t.getTime())<=60*s*1e3}formatDate(e,t="YYYY-MM-DD",s=null){if(s||(s=this._texts),t||(t="YYYY-MM-DD"),"YYYY-MM-DD"===t)return this.formatDateLite(e);Pr={},Ur={};const i={YYYY:()=>this._hydrateDateObject(e,s).YYYY,YY:()=>this._hydrateDateObject(e,s).YY(),M:()=>this._hydrateDateObject(e,s).M,MM:()=>this._hydrateDateObject(e,s).MM(),MMM:()=>this._hydrateDateObject(e,s).MMM(),MMMM:()=>this._hydrateDateObject(e,s).MMMM(),MMMMG:()=>this._hydrateDateObject(e,s).MMMMG(),D:()=>this._hydrateDateObject(e,s).D,DD:()=>this._hydrateDateObject(e,s).DD(),S:()=>this._hydrateDateObject(e,s).S(),d:()=>this._hydrateDateObject(e,s).d,dd:()=>this._hydrateDateObject(e,s).dd(),ddd:()=>this._hydrateDateObject(e,s).ddd(),dddd:()=>this._hydrateDateObject(e,s).dddd(),HH:()=>this._hydrateTimeObject(e,s).HH,H:()=>this._hydrateTimeObject(e,s).H,hh:()=>this._hydrateTimeObject(e,s).hh,h:()=>this._hydrateTimeObject(e,s).h,am:()=>this._hydrateTimeObject(e,s).am,AM:()=>this._hydrateTimeObject(e,s).AM,mm:()=>this._hydrateTimeObject(e,s).mm,m:()=>this._hydrateTimeObject(e,s).m};return t.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g,(e,t)=>{const s=i[t.replace(/\{|\}/g,"")];return void 0!==s?s():t})}formatDateLite(e){const t=e.getMonth()+1,s=e.getDate();return`${e.getFullYear()}-${t<10?"0":""}${t}-${s<10?"0":""}${s}`}formatTime(e,t="HH:mm",s=null,i=!1){let a=!1;if(i){const[t,s,i]=[e.getHours(),e.getMinutes(),e.getSeconds()];t+s+i===141&&(a=!0)}if(e instanceof Date&&"HH:mm"===t)return a?"24:00":this.formatTimeLite(e);Ur={},s||(s=this._texts);const l=this._hydrateTimeObject(e,s),n=t.replace(/(\{[a-zA-Z]+\}|[a-zA-Z]+)/g,(e,t)=>{const s=l[t.replace(/\{|\}/g,"")];return void 0!==s?s:t});return a?n.replace("23:59","24:00"):n}formatTimeLite(e){const t=e.getHours(),s=e.getMinutes();return`${(t<10?"0":"")+t}:${(s<10?"0":"")+s}`}_nth(e){if(e>3&&e<21)return"th";switch(e%10){case 1:return"st";case 2:return"nd";case 3:return"rd";default:return"th"}}_hydrateDateObject(e,t){if(Pr.D)return Pr;const s=e.getFullYear(),i=e.getMonth()+1,a=e.getDate(),l=e.getDay(),n=(l-1+7)%7;return Pr={YYYY:s,YY:()=>s.toString().substring(2),M:i,MM:()=>(i<10?"0":"")+i,MMM:()=>t.months[i-1].substring(0,3),MMMM:()=>t.months[i-1],MMMMG:()=>(t.monthsGenitive||t.months)[i-1],D:a,DD:()=>(a<10?"0":"")+a,S:()=>this._nth(a),d:n+1,dd:()=>t.weekDays[n][0],ddd:()=>t.weekDays[n].substr(0,3),dddd:()=>t.weekDays[n]},Pr}_hydrateTimeObject(e,t){if(Ur.am)return Ur;let s,i;e instanceof Date?(s=e.getHours(),i=e.getMinutes()):(s=Math.floor(e/60),i=Math.floor(e%60));const a=s%12?s%12:12,l=(t||{am:"am",pm:"pm"})[24===s||s<12?"am":"pm"];return Ur={H:s,h:a,HH:(s<10?"0":"")+s,hh:(a<10?"0":"")+a,am:l,AM:l.toUpperCase(),m:i,mm:(i<10?"0":"")+i},Ur}}const Kr=1440;class Zr{constructor(e){this._vuecal=null,this.selectCell=(e=!1,t,s)=>{this._vuecal.$emit("cell-click",s?{date:t,split:s}:t),this._vuecal.clickToNavigate||e?this._vuecal.switchToNarrowerView():this._vuecal.dblclickToNavigate&&"ontouchstart"in window&&(this._vuecal.domEvents.dblTapACell.taps++,setTimeout(()=>this._vuecal.domEvents.dblTapACell.taps=0,this._vuecal.domEvents.dblTapACell.timeout),this._vuecal.domEvents.dblTapACell.taps>=2&&(this._vuecal.domEvents.dblTapACell.taps=0,this._vuecal.switchToNarrowerView(),this._vuecal.$emit("cell-dblclick",s?{date:t,split:s}:t)))},this.keyPressEnterCell=(e,t)=>{this._vuecal.$emit("cell-keypress-enter",t?{date:e,split:t}:e),this._vuecal.switchToNarrowerView()},this.getPosition=e=>{const{left:t,top:s}=this._vuecal.cellsEl.getBoundingClientRect(),{clientX:i,clientY:a}="ontouchstart"in window&&e.touches?e.touches[0]:e;return{x:i-t,y:a-s}},this.minutesAtCursor=e=>{let t=0,s={x:0,y:0};const{timeStep:i,timeCellHeight:a,timeFrom:l}=this._vuecal.$props;return"number"===typeof e?t=e:"object"===typeof e&&(s=this.getPosition(e),t=Math.round(s.y*i/parseInt(a)+l)),{minutes:Math.max(Math.min(t,Kr),0),cursorCoords:s}},this._vuecal=e}}const Qr=2,Jr=1440;let Gr,ed,td;class sd{constructor(e,t){this._vuecal=null,this.eventDefaults={_eid:null,start:"",startTimeMinutes:0,end:"",endTimeMinutes:0,title:"",content:"",background:!1,allDay:!1,segments:null,repeat:null,daysCount:1,deletable:!0,deleting:!1,titleEditable:!0,resizable:!0,resizing:!1,draggable:!0,dragging:!1,draggingStatic:!1,focused:!1,class:""},this._vuecal=e,Gr=t}createAnEvent(e,t,s){if("string"===typeof e&&(e=Gr.stringToDate(e)),!(e instanceof Date))return!1;const i=Gr.dateToMinutes(e);t=1*t||60*Qr;const a=i+t,l=Gr.addMinutes(new Date(e),t);s.end&&("string"===typeof s.end&&(s.end=Gr.stringToDate(s.end)),s.endTimeMinutes=Gr.dateToMinutes(s.end));const n={...this.eventDefaults,_eid:`${this._vuecal._.uid}_${this._vuecal.eventIdIncrement++}`,start:e,startTimeMinutes:i,end:l,endTimeMinutes:a,segments:null,...s};return"function"!==typeof this._vuecal.onEventCreate||this._vuecal.onEventCreate(n,()=>this.deleteAnEvent(n))?(n.startDateF!==n.endDateF&&(n.daysCount=Gr.countDays(n.start,n.end)),this._vuecal.mutableEvents.push(n),this._vuecal.addEventsToView([n]),this._vuecal.emitWithEvent("event-create",n),this._vuecal.$emit("event-change",{event:this._vuecal.cleanupEvent(n),originalEvent:null}),n):void 0}addEventSegment(e){e.segments||(e.segments={},e.segments[Gr.formatDateLite(e.start)]={start:e.start,startTimeMinutes:e.startTimeMinutes,endTimeMinutes:Jr,isFirstDay:!0,isLastDay:!1});const t=e.segments[Gr.formatDateLite(e.end)];t&&(t.isLastDay=!1,t.endTimeMinutes=Jr);const s=Gr.addDays(e.end,1),i=Gr.formatDateLite(s);return s.setHours(0,0,0,0),e.segments[i]={start:s,startTimeMinutes:0,endTimeMinutes:e.endTimeMinutes,isFirstDay:!1,isLastDay:!0},e.end=Gr.addMinutes(s,e.endTimeMinutes),e.daysCount=Object.keys(e.segments).length,i}removeEventSegment(e){let t=Object.keys(e.segments).length;if(t<=1)return Gr.formatDateLite(e.end);delete e.segments[Gr.formatDateLite(e.end)],t--;const s=Gr.subtractDays(e.end,1),i=Gr.formatDateLite(s),a=e.segments[i];return t?a&&(a.isLastDay=!0,a.endTimeMinutes=e.endTimeMinutes):e.segments=null,e.daysCount=t||1,e.end=s,i}createEventSegments(e,t,s){const i=t.getTime(),a=s.getTime();let l,n,o,r=e.start.getTime(),d=e.end.getTime(),u=!1;e.end.getHours()||e.end.getMinutes()||(d-=1e3),e.segments={},e.repeat?(l=i,n=Math.min(a,e.repeat.until?Gr.stringToDate(e.repeat.until).getTime():a)):(l=Math.max(i,r),n=Math.min(a,d));while(l<=n){let t=!1;const s=Gr.addDays(new Date(l),1).setHours(0,0,0,0);let i,a,c,m;if(e.repeat){const s=new Date(l),n=Gr.formatDateLite(s);(u||e.occurrences&&e.occurrences[n])&&(u||(r=e.occurrences[n].start,o=new Date(r).setHours(0,0,0,0),d=e.occurrences[n].end),u=!0,t=!0),i=l===o,a=n===Gr.formatDateLite(new Date(d)),c=new Date(i?r:l),m=Gr.formatDateLite(c),a&&(u=!1)}else t=!0,i=l===r,a=n===d&&s>n,c=i?e.start:new Date(l),m=Gr.formatDateLite(i?e.start:c);t&&(e.segments[m]={start:c,startTimeMinutes:i?e.startTimeMinutes:0,endTimeMinutes:a?e.endTimeMinutes:Jr,isFirstDay:i,isLastDay:a}),l=s}return e}deleteAnEvent(e){this._vuecal.emitWithEvent("event-delete",e),this._vuecal.mutableEvents=this._vuecal.mutableEvents.filter(t=>t._eid!==e._eid),this._vuecal.view.events=this._vuecal.view.events.filter(t=>t._eid!==e._eid)}checkCellOverlappingEvents(e,t){td=e.slice(0),ed={},e.forEach(e=>{td.shift(),ed[e._eid]||(ed[e._eid]={overlaps:[],start:e.start,position:0,sameOverlaps:[]}),ed[e._eid].position=0,td.forEach(s=>{ed[s._eid]||(ed[s._eid]={overlaps:[],start:s.start,position:0,sameOverlaps:[]});const i=this.eventInRange(s,e.start,e.end),a=this.eventSameRange(s,e),l=t.overlapsPerTimeStep?Gr.datesInSameTimeStep(e.start,s.start,t.timeStep):1;if(e.background||e.allDay||s.background||s.allDay||!i||!l){let t,i;(t=(ed[e._eid]||{overlaps:[]}).overlaps.indexOf(s._eid))>-1&&ed[e._eid].overlaps.splice(t,1),(i=(ed[s._eid]||{overlaps:[]}).overlaps.indexOf(e._eid))>-1&&ed[s._eid].overlaps.splice(i,1),ed[s._eid].position--}else ed[e._eid].overlaps.push(s._eid),ed[e._eid].overlaps=[...new Set(ed[e._eid].overlaps)],ed[s._eid].overlaps.push(e._eid),ed[s._eid].overlaps=[...new Set(ed[s._eid].overlaps)],ed[s._eid].position++,a&&(ed[e._eid].sameOverlaps.push(s._eid),ed[e._eid].sameOverlaps=[...new Set(ed[e._eid].sameOverlaps)],ed[s._eid].sameOverlaps.push(e._eid),ed[s._eid].sameOverlaps=[...new Set(ed[s._eid].sameOverlaps)])})});let s=0;for(const i in ed){const e=ed[i],t=e.overlaps.map(e=>({id:e,start:ed[e].start}));t.push({id:i,start:e.start}),t.sort((e,t)=>e.start<t.start?-1:e.start>t.start?1:e.id>t.id?-1:1),e.position=t.findIndex(e=>e.id===i),s=Math.max(this.getOverlapsStreak(e,ed),s)}return[ed,s]}getOverlapsStreak(e,t={}){let s=e.overlaps.length+1,i=[];return e.overlaps.forEach(s=>{if(!i.includes(s)){const a=e.overlaps.filter(e=>e!==s);a.forEach(e=>{t[e].overlaps.includes(s)||i.push(e)})}}),i=[...new Set(i)],s-=i.length,s}eventInRange(e,t,s){if(e.allDay||!this._vuecal.time){const i=new Date(e.start).setHours(0,0,0,0),a=new Date(e.end).setHours(23,59,0,0);return a>=new Date(t).setHours(0,0,0,0)&&i<=new Date(s).setHours(0,0,0,0)}const i=e.start.getTime(),a=e.end.getTime();return i<s.getTime()&&a>t.getTime()}eventSameRange(e,t){const s=e.start.getTime()==t.start.getTime(),i=e.end.getTime()==t.end.getTime();return s&&i}}const id={class:"vuecal__header"},ad={key:0,class:"vuecal__flex vuecal__menu",role:"tablist","aria-label":"Calendar views navigation"},ld=["onDragenter","onDragleave","onClick","aria-label"],nd={key:1,class:"vuecal__title-bar"},od=["aria-label"],rd={class:"vuecal__flex vuecal__title",grow:""},dd=["aria-label"],ud={key:0,class:"vuecal__flex vuecal__split-days-headers"};function cd(e,t,s,a,l,n){const o=(0,m.g2)("weekdays-headings");return(0,m.uX)(),(0,m.CE)("div",id,[s.options.hideViewSelector?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",ad,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(s.viewProps.views,(t,i)=>((0,m.uX)(),(0,m.CE)(m.FK,{key:i},[t.enabled?((0,m.uX)(),(0,m.CE)("button",{key:0,class:(0,v.C4)(["vuecal__view-btn",{"vuecal__view-btn--active":n.view.id===i,"vuecal__view-btn--highlighted":e.highlightedControl===i}]),type:"button",onDragenter:t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragEnter(t,i,e.$data),onDragleave:t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragLeave(t,i,e.$data),onClick:e=>n.switchView(i,null,!0),"aria-label":`${t.label} view`},(0,v.v_)(t.label),43,ld)):(0,m.Q3)("",!0)],64))),128))])),s.options.hideTitleBar?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",nd,[(0,m.Lk)("button",{class:(0,v.C4)(["vuecal__arrow vuecal__arrow--prev",{"vuecal__arrow--highlighted":"previous"===e.highlightedControl}]),type:"button",onClick:t[0]||(t[0]=(...e)=>n.previous&&n.previous(...e)),onDragenter:t[1]||(t[1]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragEnter(t,"previous",e.$data)),onDragleave:t[2]||(t[2]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragLeave(t,"previous",e.$data)),"aria-label":`Previous ${n.view.id}`},[(0,m.RG)(e.$slots,"arrow-prev")],42,od),(0,m.Lk)("div",rd,[(0,m.bF)(i.eB,{name:s.options.transitions?`slide-fade--${n.transitionDirection}`:""},{default:(0,m.k6)(()=>[((0,m.uX)(),(0,m.Wv)((0,m.$y)(n.broaderView?"button":"span"),{type:!!n.broaderView&&"button",key:`${n.view.id}${n.view.startDate.toString()}`,onClick:t[3]||(t[3]=e=>!!n.broaderView&&n.switchToBroaderView()),"aria-label":!!n.broaderView&&`Go to ${n.broaderView} view`},{default:(0,m.k6)(()=>[(0,m.RG)(e.$slots,"title")]),_:3},8,["type","aria-label"]))]),_:3},8,["name"])]),s.options.todayButton?((0,m.uX)(),(0,m.CE)("button",{key:0,class:(0,v.C4)(["vuecal__today-btn",{"vuecal__today-btn--highlighted":"today"===e.highlightedControl}]),type:"button",onClick:t[4]||(t[4]=(...e)=>n.goToToday&&n.goToToday(...e)),onDragenter:t[5]||(t[5]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragEnter(t,"today",e.$data)),onDragleave:t[6]||(t[6]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragLeave(t,"today",e.$data)),"aria-label":"Today"},[(0,m.RG)(e.$slots,"today-button")],34)):(0,m.Q3)("",!0),(0,m.Lk)("button",{class:(0,v.C4)(["vuecal__arrow vuecal__arrow--next",{"vuecal__arrow--highlighted":"next"===e.highlightedControl}]),type:"button",onClick:t[7]||(t[7]=(...e)=>n.next&&n.next(...e)),onDragenter:t[8]||(t[8]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragEnter(t,"next",e.$data)),onDragleave:t[9]||(t[9]=t=>s.editEvents.drag&&n.dnd&&n.dnd.viewSelectorDragLeave(t,"next",e.$data)),"aria-label":`Next ${n.view.id}`},[(0,m.RG)(e.$slots,"arrow-next")],42,dd)])),s.viewProps.weekDaysInHeader?((0,m.uX)(),(0,m.Wv)(o,{key:2,"week-days":s.weekDays,"transition-direction":n.transitionDirection,"switch-to-narrower-view":s.switchToNarrowerView},(0,m.eX)({_:2},[e.$slots["weekday-heading"]?{name:"weekday-heading",fn:(0,m.k6)(({heading:t,view:s})=>[(0,m.RG)(e.$slots,"weekday-heading",{heading:t,view:s})]),key:"0"}:void 0,e.$slots["split-label"]?{name:"split-label",fn:(0,m.k6)(({split:t})=>[(0,m.RG)(e.$slots,"split-label",{split:t,view:n.view})]),key:"1"}:void 0]),1032,["week-days","transition-direction","switch-to-narrower-view"])):(0,m.Q3)("",!0),(0,m.bF)(i.eB,{name:`slide-fade--${n.transitionDirection}`},{default:(0,m.k6)(()=>[n.showDaySplits?((0,m.uX)(),(0,m.CE)("div",ud,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(s.daySplits,(t,s)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["day-split-header",t.class||!1]),key:s},[(0,m.RG)(e.$slots,"split-label",{split:t,view:n.view.id},()=>[(0,m.eW)((0,v.v_)(t.label),1)])],2))),128))])):(0,m.Q3)("",!0)]),_:3},8,["name"])])}const md={class:"vuecal__flex vuecal__weekdays-headings",ref:"vuecal_weekday_heading"},hd=["onClick"],pd={class:"vuecal__flex weekday-label",grow:""},kd={class:"full"},vd={class:"small"},bd={class:"xsmall"},fd={key:0},_d={key:0,class:"vuecal__flex vuecal__split-days-headers",grow:""};function gd(e,t,s,a,l,n){return(0,m.uX)(),(0,m.CE)("div",md,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.headings,(a,l)=>((0,m.uX)(),(0,m.CE)(m.FK,{key:l},[a.hide?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",{key:0,class:(0,v.C4)(["vuecal__flex vuecal__heading",{today:a.today,"today-cell":a.today,clickable:n.cellHeadingsClickable,"yesterday-cell":new Date(a.date).toLocaleDateString("sk-SK")==new Date((new Date).setDate((new Date).getDate()-1)).toLocaleDateString("sk-SK")}]),style:(0,v.Tr)(n.weekdayCellStyles),onClick:e=>"week"===n.view.id&&n.selectCell(a.date,e),onDblclick:t[0]||(t[0]=e=>"week"===n.view.id&&n.vuecal.dblclickToNavigate&&s.switchToNarrowerView())},[(0,m.bF)(i.eB,{name:`slide-fade--${s.transitionDirection}`,appear:n.vuecal.transitions},{default:(0,m.k6)(()=>[((0,m.uX)(),(0,m.CE)("div",{class:"vuecal__flex",column:"",key:!!n.vuecal.transitions&&`${l}-${a.dayOfMonth}`},[(0,m.Lk)("div",pd,[(0,m.RG)(e.$slots,"weekday-heading",{heading:n.cleanupHeading(a),view:n.view},()=>[(0,m.Lk)("span",kd,(0,v.v_)(a.full),1),(0,m.Lk)("span",vd,(0,v.v_)(a.small),1),(0,m.Lk)("span",bd,(0,v.v_)(a.xsmall),1),a.dayOfMonth?((0,m.uX)(),(0,m.CE)("span",fd," "+(0,v.v_)(a.dayOfMonth),1)):(0,m.Q3)("",!0)])]),n.vuecal.hasSplits&&n.vuecal.stickySplitLabels?((0,m.uX)(),(0,m.CE)("div",_d,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.vuecal.daySplits,(t,s)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["day-split-header",t.class||!1]),key:s},[(0,m.RG)(e.$slots,"split-label",{split:t,view:n.view},()=>[(0,m.eW)((0,v.v_)(t.label),1)])],2))),128))])):(0,m.Q3)("",!0)]))]),_:2},1032,["name","appear"])],46,hd))],64))),128))],512)}var yd={inject:["vuecal","utils","view"],props:{transitionDirection:{type:String,default:"right"},weekDays:{type:Array,default:()=>[]},switchToNarrowerView:{type:Function,default:()=>{}},unscheduledTime:{type:Array,default:[]}},methods:{selectCell(e,t){e.getTime()!==this.view.selectedDate.getTime()&&(this.view.selectedDate=e),this.utils.cell.selectCell(!1,e,t)},cleanupHeading:e=>({label:e.full,date:e.date,unscheduledTime:e.unscheduledTime,name:e.name,initials:e.initials,...e.today?{today:e.today}:{}}),onTimelineScroll(e){this.$refs["vuecal_weekday_heading"].style.top=`${e}px`}},computed:{headings(){if(!["month","week"].includes(this.view.id))return[];let e=!1;const t=this.weekDays.map((t,s)=>{const i=this.utils.date.addDays(this.view.startDate,this.vuecal.startWeekOnSunday?s-1:s);let a=null,l=null,n=null;return this.unscheduledTime[s]?.time&&(a=Math.floor(this.unscheduledTime[s].time/60)+","+String(this.unscheduledTime[s].time%60)[0]),this.unscheduledTime[s]?.name&&this.unscheduledTime[s]?.name&&(l=this.unscheduledTime[s].name+" "+this.unscheduledTime[s].surname,n=this.unscheduledTime[s].name.charAt(0).toUpperCase()+this.unscheduledTime[s].surname.charAt(0).toUpperCase()),{hide:t.hide,full:t.label,small:t.short||t.label.substr(0,3),xsmall:t.short||t.label.substr(0,1),unscheduledTime:a,name:l,initials:n,..."week"===this.view.id?{dayOfMonth:i.getDate(),date:i,today:!e&&this.utils.date.isToday(i)&&!e++}:{}}});return t},cellWidth(){return 100/(7-this.weekDays.reduce((e,t)=>e+t.hide,0))},weekdayCellStyles(){return{...this.vuecal.hideWeekdays.length?{width:`${this.cellWidth}%`}:{}}},cellHeadingsClickable(){return"week"===this.view.id&&(this.vuecal.clickToNavigate||this.vuecal.dblclickToNavigate)}}};const wd=(0,A.A)(yd,[["render",gd]]);var Dd=wd,Td={inject:["vuecal","previous","next","switchView","updateSelectedDate","modules","view"],components:{WeekdaysHeadings:Dd},props:{options:{type:Object,default:()=>({})},editEvents:{type:Object,required:!0},hasSplits:{type:[Boolean,Number],default:!1},daySplits:{type:Array,default:()=>[]},viewProps:{type:Object,default:()=>({})},weekDays:{type:Array,default:()=>[]},switchToNarrowerView:{type:Function,default:()=>{}}},data:()=>({highlightedControl:null}),methods:{goToToday(){this.updateSelectedDate(new Date((new Date).setHours(0,0,0,0)))},switchToBroaderView(){this.transitionDirection="left",this.broaderView&&this.switchView(this.broaderView)}},computed:{transitionDirection:{get(){return this.vuecal.transitionDirection},set(e){this.vuecal.transitionDirection=e}},broaderView(){const{enabledViews:e}=this.vuecal;return e[e.indexOf(this.view.id)-1]},showDaySplits(){return"day"===this.view.id&&this.hasSplits&&this.options.stickySplitLabels&&!this.options.minSplitWidth},dnd(){return this.modules.dnd}}};const Ed=(0,A.A)(Td,[["render",cd]]);var Md=Ed;const Cd={key:0,class:"vuecal__all-day-text",style:{width:"3em"}};function $d(e,t,s,i,a,l){const n=(0,m.g2)("vuecal-cell");return(0,m.uX)(),(0,m.CE)("div",{class:"vuecal__flex vuecal__all-day",style:(0,v.Tr)(s.cellOrSplitMinWidth&&{height:s.height})},[s.cellOrSplitMinWidth?(0,m.Q3)("",!0):((0,m.uX)(),(0,m.CE)("div",Cd,[(0,m.Lk)("span",null,(0,v.v_)(s.label),1)])),(0,m.Lk)("div",{class:(0,v.C4)(["vuecal__flex vuecal__cells",`${l.view.id}-view`]),grow:"",style:(0,v.Tr)(s.cellOrSplitMinWidth?`min-width: ${s.cellOrSplitMinWidth}px`:"")},[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(s.cells,(t,i)=>((0,m.uX)(),(0,m.Wv)(n,{key:i,options:s.options,"edit-events":l.editEvents,data:t,"all-day":!0,"cell-width":s.options.hideWeekdays.length&&(l.vuecal.isWeekView||l.vuecal.isMonthView)&&l.vuecal.cellWidth,"min-timestamp":s.options.minTimestamp,"max-timestamp":s.options.maxTimestamp,"cell-splits":s.daySplits},{event:(0,m.k6)(({event:t,view:s})=>[(0,m.RG)(e.$slots,"event",{view:s,event:t})]),_:3},8,["options","edit-events","data","cell-width","min-timestamp","max-timestamp","cell-splits"]))),128))],6)],4)}const xd=["data-split","aria-label","onTouchstart","onMousedown","onClick","onDragover","onDrop"],Sd={key:0,class:"cell-time-labels"},Fd=["innerHTML"],zd={key:2,class:"vuecal__cell-events"},Ad=["title"];function Ld(e,t,s,a,l,n){const o=(0,m.g2)("event");return(0,m.uX)(),(0,m.Wv)(i.F,{class:(0,v.C4)(["vuecal__cell",n.cellClasses]),name:`slide-fade--${n.transitionDirection}`,tag:"div",appear:s.options.transitions,style:(0,v.Tr)(n.cellStyles)},{default:(0,m.k6)(()=>[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.splitsCount?n.splits:1,(a,l)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["vuecal__flex vuecal__cell-content",n.splitsCount&&n.splitClasses(a)]),key:s.options.transitions?`${n.view.id}-${s.data.content}-${l}`:l,"data-split":!!n.splitsCount&&a.id,column:"",tabindex:"0","aria-label":s.data.content,onFocus:t[0]||(t[0]=e=>n.onCellFocus(e)),onKeypress:t[1]||(t[1]=(0,i.jR)(e=>n.onCellkeyPressEnter(e),["enter"])),onTouchstart:e=>!n.isDisabled&&n.onCellTouchStart(e,n.splitsCount?a.id:null),onMousedown:e=>!n.isDisabled&&n.onCellMouseDown(e,n.splitsCount?a.id:null),onClick:e=>!n.isDisabled&&n.onCellClick(e,a),onDblclick:t[2]||(t[2]=e=>!n.isDisabled&&n.onCellDblClick(e)),onContextmenu:t[3]||(t[3]=e=>!n.isDisabled&&s.options.cellContextmenu&&n.onCellContextMenu(e)),onDragenter:t[4]||(t[4]=t=>!n.isDisabled&&s.editEvents.drag&&n.dnd&&n.dnd.cellDragEnter(t,e.$data,s.data.startDate)),onDragover:t=>!n.isDisabled&&s.editEvents.drag&&n.dnd&&n.dnd.cellDragOver(t,e.$data,s.data.startDate,n.splitsCount?a.id:null),onDragleave:t[5]||(t[5]=t=>!n.isDisabled&&s.editEvents.drag&&n.dnd&&n.dnd.cellDragLeave(t,e.$data,s.data.startDate)),onDrop:t=>!n.isDisabled&&s.editEvents.drag&&n.dnd&&n.dnd.cellDragDrop(t,e.$data,s.data.startDate,n.splitsCount?a.id:null)},[s.options.showTimeInCells&&s.options.time&&n.isWeekOrDayView&&!s.allDay?((0,m.uX)(),(0,m.CE)("div",Sd,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.vuecal.timeCells,(e,t)=>((0,m.uX)(),(0,m.CE)("span",{class:"cell-time-label",key:t},(0,v.v_)(e.label),1))),128))])):(0,m.Q3)("",!0),n.isWeekOrDayView&&!s.allDay&&n.specialHours.length?((0,m.uX)(!0),(0,m.CE)(m.FK,{key:1},(0,m.pI)(n.specialHours,(e,t)=>((0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["vuecal__special-hours",`vuecal__special-hours--day${e.day} ${e.class}`]),style:(0,v.Tr)(`height: ${e.height}px;top: ${e.top}px`)},[e.label?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"special-hours-label",innerHTML:e.label},null,8,Fd)):(0,m.Q3)("",!0)],6))),256)):(0,m.Q3)("",!0),(0,m.RG)(e.$slots,"cell-content",{events:n.events,selectCell:e=>n.selectCell(e,!0),split:!!n.splitsCount&&a}),n.eventsCount&&(n.isWeekOrDayView||"month"===n.view.id&&s.options.eventsOnMonthView)?((0,m.uX)(),(0,m.CE)("div",zd,[((0,m.uX)(!0),(0,m.CE)(m.FK,null,(0,m.pI)(n.splitsCount?a.events:n.events,(t,i)=>((0,m.uX)(),(0,m.Wv)(o,{key:i,"cell-formatted-date":s.data.formattedDate,event:t,"all-day":s.allDay,"cell-events":n.splitsCount?a.events:n.events,cellOverlaps:(n.splitsCount?a.overlaps[t._eid]:e.cellOverlaps[t._eid])||[],allOverlaps:(n.splitsCount?a.overlaps:e.cellOverlaps)||[],"event-position":((n.splitsCount?a.overlaps[t._eid]:e.cellOverlaps[t._eid])||[]).position,"overlaps-streak":n.splitsCount?a.overlapsStreak:e.cellOverlapsStreak},{event:(0,m.k6)(({event:t,view:s})=>[(0,m.RG)(e.$slots,"event",{view:s,event:t})]),_:2},1032,["cell-formatted-date","event","all-day","cell-events","cellOverlaps","allOverlaps","event-position","overlaps-streak"]))),128))])):(0,m.Q3)("",!0)],42,xd))),128)),n.timelineVisible?((0,m.uX)(),(0,m.CE)("div",{class:"vuecal__now-line",style:(0,v.Tr)(`top: ${n.todaysTimePosition}px`),key:s.options.transitions?`${n.view.id}-now-line`:"now-line",title:n.utils.date.formatTime(n.vuecal.now)},null,12,Ad)):(0,m.Q3)("",!0)]),_:3},8,["class","name","appear","style"])}const Rd=["eventId","draggable"];function jd(e,t,s,a,l,n){return(0,m.uX)(),(0,m.CE)("div",{class:(0,v.C4)(["vuecal__event",n.eventClasses]),style:(0,v.Tr)(n.eventStyles),eventId:`event-id-${s.event.id}`,tabindex:"0",onFocus:t[4]||(t[4]=(...e)=>n.focusEvent&&n.focusEvent(...e)),onKeypress:t[5]||(t[5]=(0,i.jR)((0,i.D$)((...e)=>n.onEnterKeypress&&n.onEnterKeypress(...e),["stop"]),["enter"])),onMouseenter:t[6]||(t[6]=(...e)=>n.onMouseEnter&&n.onMouseEnter(...e)),onMouseleave:t[7]||(t[7]=(...e)=>n.onMouseLeave&&n.onMouseLeave(...e)),onTouchstart:t[8]||(t[8]=(0,i.D$)((...e)=>n.onTouchStart&&n.onTouchStart(...e),["stop"])),onMousedown:t[9]||(t[9]=e=>n.onMouseDown(e)),onMouseup:t[10]||(t[10]=(...e)=>n.onMouseUp&&n.onMouseUp(...e)),onTouchend:t[11]||(t[11]=(...e)=>n.onMouseUp&&n.onMouseUp(...e)),onTouchmove:t[12]||(t[12]=(...e)=>n.onTouchMove&&n.onTouchMove(...e)),onDblclick:t[13]||(t[13]=(...e)=>n.onDblClick&&n.onDblClick(...e)),draggable:n.draggable,onDragstart:t[14]||(t[14]=e=>n.draggable&&n.onDragStart(e)),onDragend:t[15]||(t[15]=e=>n.draggable&&n.onDragEnd())},[n.vuecal.editEvents.delete&&s.event.deletable?((0,m.uX)(),(0,m.CE)("div",{key:0,class:"vuecal__event-delete",onClick:t[0]||(t[0]=(0,i.D$)((...e)=>n.deleteEvent&&n.deleteEvent(...e),["stop"])),onTouchstart:t[1]||(t[1]=(0,i.D$)((...e)=>n.touchDeleteEvent&&n.touchDeleteEvent(...e),["stop"]))},(0,v.v_)(n.vuecal.texts.deleteEvent),33)):(0,m.Q3)("",!0),(0,m.RG)(e.$slots,"event",{event:s.event,view:n.view.id}),n.resizable?((0,m.uX)(),(0,m.CE)("div",{key:1,class:"vuecal__event-resize-handle",contenteditable:"false",onMousedown:t[2]||(t[2]=(0,i.D$)((...e)=>n.onResizeHandleMouseDown&&n.onResizeHandleMouseDown(...e),["stop","prevent"])),onTouchstart:t[3]||(t[3]=(0,i.D$)((...e)=>n.onResizeHandleMouseDown&&n.onResizeHandleMouseDown(...e),["stop","prevent"]))},null,32)):(0,m.Q3)("",!0)],46,Rd)}var Wd={inject:["vuecal","utils","modules","view","domEvents","editEvents"],props:{cellFormattedDate:{type:String,default:""},event:{type:Object,default:()=>({})},cellEvents:{type:Array,default:()=>[]},cellOverlaps:{type:Object,default:()=>({})},allOverlaps:{type:Object,default:()=>({})},eventPosition:{type:Number,default:0},overlapsStreak:{type:Number,default:0},allDay:{type:Boolean,default:!1}},data:()=>({touch:{dragThreshold:30,startX:0,startY:0,dragged:!1}}),methods:{onMouseDown(e,t=!1){let s;if("BUTTON"==e.target.nodeName?s=e.target:"IMG"==e.srcElement.nodeName&&(s=e.target.parentElement),s?.classList?.contains("v-btn__content")||"BUTTON"==e?.target?.nodeName)return void e.preventDefault();if("ontouchstart"in window&&!t)return!1;const{clickHoldAnEvent:i,focusAnEvent:a,resizeAnEvent:l,dragAnEvent:n}=this.domEvents;if(a._eid===this.event._eid&&i._eid===this.event._eid)return!0;this.focusEvent(),i._eid=null,this.vuecal.editEvents.delete&&this.event.deletable&&(i.timeoutId=setTimeout(()=>{l._eid||n._eid||(i._eid=this.event._eid,this.event.deleting=!0)},i.timeout))},onMouseUp(e){this.domEvents.focusAnEvent._eid!==this.event._eid||this.touch.dragged||(this.domEvents.focusAnEvent.mousedUp=!0),this.touch.dragged=!1},onMouseEnter(e){e.preventDefault(),this.vuecal.emitWithEvent("event-mouse-enter",this.event)},onMouseLeave(e){e.preventDefault(),this.vuecal.emitWithEvent("event-mouse-leave",this.event)},onTouchMove(e){if("function"!==typeof this.vuecal.onEventClick)return;const{clientX:t,clientY:s}=e.touches[0],{startX:i,startY:a,dragThreshold:l}=this.touch;(Math.abs(t-i)>l||Math.abs(s-a)>l)&&(this.touch.dragged=!0)},onTouchStart(e){this.touch.startX=e.touches[0].clientX,this.touch.startY=e.touches[0].clientY,this.onMouseDown(e,!0)},onEnterKeypress(e){if("function"===typeof this.vuecal.onEventClick)return this.vuecal.onEventClick(this.event,e)},onDblClick(e){if("function"===typeof this.vuecal.onEventDblclick)return this.vuecal.onEventDblclick(this.event,e)},onDragStart(e){"blocker"!=this.event.type&&"non-working-hours"!=this.event.type&&"office365_blocker"!=this.event.type&&(this.event.draggingStatic=!1,this.dnd&&this.dnd.eventDragStart(e,this.event))},onDragEnd(){this.dnd&&this.dnd.eventDragEnd(this.event)},onResizeHandleMouseDown(){this.focusEvent(),this.domEvents.dragAnEvent._eid=null,this.domEvents.resizeAnEvent=Object.assign(this.domEvents.resizeAnEvent,{_eid:this.event._eid,start:(this.segment||this.event).start,split:this.event.split||null,segment:!!this.segment&&this.utils.date.formatDateLite(this.segment.start),originalEnd:new Date((this.segment||this.event).end),originalEndTimeMinutes:this.event.endTimeMinutes}),this.event.resizing=!0},deleteEvent(e=!1){if("ontouchstart"in window&&!e)return!1;this.utils.event.deleteAnEvent(this.event)},touchDeleteEvent(e){this.deleteEvent(!0)},cancelDeleteEvent(){this.event.deleting=!1},focusEvent(){const{focusAnEvent:e}=this.domEvents,t=e._eid;if(t!==this.event._eid){if(t){const e=this.view.events.find(e=>e._eid===t);e&&(e.focused=!1)}this.vuecal.cancelDelete(),this.vuecal.emitWithEvent("event-focus",this.event),e._eid=this.event._eid,this.event.focused=!0}}},computed:{eventDimensions(){const{startTimeMinutes:e,endTimeMinutes:t}=this.segment||this.event;let s=e-this.vuecal.timeFrom;const i=Math.max(Math.round(s*this.vuecal.timeCellHeight/this.vuecal.timeStep),0);s=Math.min(t,this.vuecal.timeTo)-this.vuecal.timeFrom;const a=Math.round(s*this.vuecal.timeCellHeight/this.vuecal.timeStep),l=Math.max(a-i,5);return{top:i,height:l}},eventStyles(){if(this.event.allDay||!this.vuecal.time||!this.event.endTimeMinutes||"month"===this.view.id||this.allDay)return{};let e=100-10*this.eventPosition,t=5*this.eventPosition,s=10*(this.eventPosition+1),i=this.event.master_task_color;if(Array.isArray(this.cellOverlaps.sameOverlaps)&&this.cellOverlaps.sameOverlaps.length){const s=this.cellOverlaps.sameOverlaps.length+1,i=this.cellOverlaps.overlaps.filter(e=>{if(!this.cellOverlaps.sameOverlaps.includes(e)&&this.allOverlaps[this.event._eid].position>this.allOverlaps[e].position)return e});e=100/s-5,t=100/s*(this.eventPosition-i.length)+5*(this.eventPosition-i.length)/s,i.length&&(e-=i.length*(10/s),t+=5*i.length-10*i.length/s*(this.eventPosition-i.length))}this.vuecal.minEventWidth&&e<this.vuecal.minEventWidth&&(e=this.vuecal.minEventWidth,t=(100-this.vuecal.minEventWidth)/this.cellOverlaps.overlaps.length*this.eventPosition);const{top:a,height:l}=this.eventDimensions;return{background:i,"z-index":`${s}`,top:`${a}px`,height:`${l}px`,width:`${e}%`,left:this.event.left&&`${this.event.left}px`||`${t}%`}},eventClasses(){const{isFirstDay:e,isLastDay:t}=this.segment||{};return{[this.event.class]:!!this.event.class,"event-blocker":this.event.is_blocker,"vuecal__event--focus":this.event.focused,"vuecal__event--resizing":this.event.resizing,"vuecal__event--background":this.event.background,"vuecal__event--deletable":this.event.deleting,"vuecal__event--all-day":this.event.allDay,"vuecal__event--dragging":!this.event.draggingStatic&&this.event.dragging,"vuecal__event--static":this.event.dragging&&this.event.draggingStatic,"vuecal__event--multiple-days":!!this.segment,"event-start":this.segment&&e&&!t,"event-middle":this.segment&&!e&&!t,"event-end":this.segment&&t&&!e}},segment(){return this.event.segments&&this.event.segments[this.cellFormattedDate]||null},draggable(){const{draggable:e,background:t,daysCount:s}=this.event;return this.vuecal.editEvents.drag&&e&&!t&&1===s},resizable(){const{editEvents:e,time:t}=this.vuecal;return e.resize&&this.event.resizable&&t&&!this.allDay&&(!this.segment||this.segment&&this.segment.isLastDay)&&"month"!==this.view.id},dnd(){return this.modules.dnd}}};const Vd=(0,A.A)(Wd,[["render",jd]]);var Od=Vd,Id={inject:["vuecal","utils","modules","view","domEvents"],components:{Event:Od},props:{options:{type:Object,default:()=>({})},editEvents:{type:Object,required:!0},data:{type:Object,required:!0},cellSplits:{type:Array,default:()=>[]},minTimestamp:{type:[Number,null],default:null},maxTimestamp:{type:[Number,null],default:null},cellWidth:{type:[Number,Boolean],default:!1},allDay:{type:Boolean,default:!1}},data:()=>({tmUtils:se.A,cellOverlaps:{},cellOverlapsStreak:1,timeAtCursor:null,highlighted:!1,highlightedSplit:null}),methods:{getSplitAtCursor({target:e}){const t=e.classList.contains("vuecal__cell-split");let s=t?e:this.vuecal.findAncestor(e,"vuecal__cell-split");return s&&(s=s.attributes["data-split"].value,parseInt(s).toString()===s.toString()&&(s=parseInt(s))),s||null},splitClasses(e){return{"vuecal__cell-split":!0,"vuecal__cell-split--highlighted":this.highlightedSplit===e.id,"vuecal__cell-split--weekend":e.isWeekend,[e.class]:!!e.class}},checkCellOverlappingEvents(){this.options.time&&this.eventsCount&&!this.splitsCount&&(1===this.eventsCount?(this.cellOverlaps=[],this.cellOverlapsStreak=1):[this.cellOverlaps,this.cellOverlapsStreak]=this.utils.event.checkCellOverlappingEvents(this.events,this.options))},isDOMElementAnEvent(e){return this.vuecal.isDOMElementAnEvent(e)},selectCell(e,t=!1){const s=this.splitsCount?this.getSplitAtCursor(e):null;this.utils.cell.selectCell(t,this.timeAtCursor,s),this.timeAtCursor=null},onCellkeyPressEnter(e){this.isSelected||this.onCellFocus(e);const t=this.splitsCount?this.getSplitAtCursor(e):null;this.utils.cell.keyPressEnterCell(this.timeAtCursor,t),this.timeAtCursor=null},onCellFocus(e){if(!this.isSelected&&!this.isDisabled){this.isSelected=this.data.startDate;const t=this.splitsCount?this.getSplitAtCursor(e):null,s=this.timeAtCursor||this.data.startDate;this.vuecal.$emit("cell-focus",t?{date:s,split:t}:s)}},onCellMouseDown(e,t=null,s=!1){if("ontouchstart"in window&&!s)return!1;this.isSelected||this.onCellFocus(e);const{clickHoldACell:i,focusAnEvent:a}=this.domEvents;this.domEvents.cancelClickEventCreation=!1,i.eventCreated=!1,this.timeAtCursor=new Date(this.data.startDate);const{minutes:l,cursorCoords:{y:n}}=this.vuecal.minutesAtCursor(e);this.timeAtCursor.setMinutes(l);const o=this.isDOMElementAnEvent(e.target);!o&&a._eid&&((this.view.events.find(e=>e._eid===a._eid)||{}).focused=!1),this.editEvents.create&&!o&&this.setUpEventCreation(e,n)},setUpEventCreation(e,t){if(this.options.dragToCreateEvent&&["week","day"].includes(this.view.id)){const{dragCreateAnEvent:s}=this.domEvents;if(s.startCursorY=t,s.split=this.splitsCount?this.getSplitAtCursor(e):null,s.start=this.timeAtCursor,this.options.snapToTime){let e=60*this.timeAtCursor.getHours()+this.timeAtCursor.getMinutes();const t=e+this.options.snapToTime/2;e=t-t%this.options.snapToTime,s.start.setHours(0,e,0,0)}}else this.options.cellClickHold&&["month","week","day"].includes(this.view.id)&&this.setUpCellHoldTimer(e)},setUpCellHoldTimer(e){const{clickHoldACell:t}=this.domEvents;t.cellId=`${this.vuecal._.uid}_${this.data.formattedDate}`,t.split=this.splitsCount?this.getSplitAtCursor(e):null,t.timeoutId=setTimeout(()=>{if(t.cellId&&!this.domEvents.cancelClickEventCreation){const{_eid:e}=this.utils.event.createAnEvent(this.timeAtCursor,null,t.split?{split:t.split}:{});t.eventCreated=e}},t.timeout)},onCellTouchStart(e,t=null){this.onCellMouseDown(e,t,!0)},onCellClick(e,t){const s=e.target.querySelectorAll(".non-working-event"),i=e.target.offsetHeight,a=s?.[0]?.offsetHeight||950,l=s?.[1]?.offsetHeight||1700;if(e.offsetY>a&&e.offsetY<i-l){const s=t.date;s.setHours(Math.floor(e.offsetY/100),0,0,0);const i=new Date(s);i.setHours(s.getHours()+1);const a=_e()(s).format("HH:mm"),l="Dashboard - Teams"===this.$route.name,n=l?t.employee_id:Number(localStorage.getItem("selectedEmployee")||this.user.id);this.$events.emit("show-menu-modal",{time:a,date:se.A.formatDateTimeForBackend(s),employee:n}),setTimeout(()=>{this.$events.emit("add-timeblock",{id:null,start:se.A.formatDateTimeForBackend(s),end:se.A.formatDateTimeForBackend(i)})},150)}this.isDOMElementAnEvent(e.target)||this.selectCell(e)},onCellDblClick(e){const t=new Date(this.data.startDate);t.setMinutes(this.vuecal.minutesAtCursor(e).minutes);const s=this.splitsCount?this.getSplitAtCursor(e):null;this.vuecal.$emit("cell-dblclick",s?{date:t,split:s}:t),this.options.dblclickToNavigate&&this.vuecal.switchToNarrowerView()},onCellContextMenu(e){e.stopPropagation(),e.preventDefault();const t=new Date(this.data.startDate),{cursorCoords:s,minutes:i}=this.vuecal.minutesAtCursor(e);t.setMinutes(i);const a=this.splitsCount?this.getSplitAtCursor(e):null;this.vuecal.$emit("cell-contextmenu",{date:t,...s,...a||{},e:e})}},computed:{...(0,ie.L8)("auth",["user"]),dnd(){return this.modules.dnd},nowInMinutes(){return this.utils.date.dateToMinutes(this.vuecal.now)},isBeforeMinDate(){return null!==this.minTimestamp&&this.minTimestamp>this.data.endDate.getTime()},isAfterMaxDate(){return this.maxTimestamp&&this.maxTimestamp<this.data.startDate.getTime()},isDisabled(){const{disableDays:e}=this.options,{isYearsOrYearView:t}=this.vuecal;return!(!e.length||!e.includes(this.data.formattedDate)||t)||(this.isBeforeMinDate||this.isAfterMaxDate)},isSelected:{get(){let e=!1;const{selectedDate:t}=this.view;return e="years"===this.view.id?t.getFullYear()===this.data.startDate.getFullYear():"year"===this.view.id?t.getFullYear()===this.data.startDate.getFullYear()&&t.getMonth()===this.data.startDate.getMonth():t.getTime()===this.data.startDate.getTime(),e},set(e){this.view.selectedDate=e,this.vuecal.$emit("update:selected-date",this.view.selectedDate)}},isWeekOrDayView(){return["week","day"].includes(this.view.id)},transitionDirection(){return this.vuecal.transitionDirection},specialHours(){return this.data.specialHours.map(e=>{let{from:t,to:s}=e;return t=Math.max(t,this.options.timeFrom),s=Math.min(s,this.options.timeTo),{...e,height:(s-t)*this.timeScale,top:(t-this.options.timeFrom)*this.timeScale}})},events(){const{startDate:e,endDate:t}=this.data;let s=[];if(!["years","year"].includes(this.view.id)||this.options.eventsCountOnYearView){if(s=this.view.events.slice(0),"month"===this.view.id&&s.push(...this.view.outOfScopeEvents),s=s.filter(s=>this.utils.event.eventInRange(s,e,t)),this.options.showAllDayEvents&&"month"!==this.view.id&&(s=s.filter(e=>!!e.allDay===this.allDay)),this.options.time&&this.isWeekOrDayView&&!this.allDay){const{timeFrom:e,timeTo:t}=this.options;s=s.filter(s=>{const i=s.daysCount>1&&s.segments[this.data.formattedDate]||{},a=1===s.daysCount&&s.startTimeMinutes<t&&s.endTimeMinutes>e,l=s.daysCount>1&&i.startTimeMinutes<t&&i.endTimeMinutes>e,n=!1;return s.allDay||a||l||n})}!this.options.time||!this.isWeekOrDayView||this.options.showAllDayEvents&&this.allDay||s.sort((e,t)=>e.start<t.start?-1:1),this.cellSplits.length||this.$nextTick(this.checkCellOverlappingEvents)}return s},eventsCount(){return this.events.length},splits(){return this.cellSplits.map((e,t)=>{const s=this.events.filter(t=>t.split===e.id),[i,a]=this.utils.event.checkCellOverlappingEvents(s.filter(e=>!e.background&&!e.allDay),this.options);return{...e,overlaps:i,overlapsStreak:a,events:s}})},splitsCount(){return this.splits.length},cellClasses(){return{[this.data.class]:!!this.data.class,"vuecal__cell--current":this.data.current,"vuecal__cell--today":this.data.today,"vuecal__cell--out-of-scope":this.data.outOfScope,"vuecal__cell--before-min":this.isDisabled&&this.isBeforeMinDate,"vuecal__cell--after-max":this.isDisabled&&this.isAfterMaxDate,"vuecal__cell--disabled":this.isDisabled,"vuecal__cell--selected":this.isSelected,"vuecal__cell--highlighted":this.highlighted,"vuecal__cell--has-splits":this.splitsCount,"vuecal__cell--has-events":this.eventsCount}},cellStyles(){return{...this.cellWidth?{width:`${this.cellWidth}%`}:{}}},timelineVisible(){const{time:e,timeTo:t}=this.options;return this.data.today&&this.isWeekOrDayView&&e&&!this.allDay&&this.nowInMinutes<=t},todaysTimePosition(){if(!this.data.today||!this.options.time)return;const e=this.nowInMinutes-this.options.timeFrom;return Math.round(e*this.timeScale)},timeScale(){return this.options.timeCellHeight/this.options.timeStep}}};const Hd=(0,A.A)(Id,[["render",Ld]]);var Yd=Hd,Bd={inject:["vuecal","view","editEvents"],components:{"vuecal-cell":Yd},props:{options:{type:Object,required:!0},cells:{type:Array,required:!0},label:{type:String,required:!0},daySplits:{type:Array,default:()=>[]},shortEvents:{type:Boolean,default:!0},height:{type:String,default:""},cellOrSplitMinWidth:{type:Number,default:null}},computed:{hasCellOrSplitWidth(){return!!(this.options.minCellWidth||this.daySplits.length&&this.options.minSplitWidth)}}};const Xd=(0,A.A)(Bd,[["render",$d]]);var Nd=Xd,Pd=s(94348);const Ud=1440,qd={weekDays:Array(7).fill(""),weekDaysShort:[],months:Array(12).fill(""),years:"",year:"",month:"",week:"",day:"",today:"",noEvent:"",allDay:"",deleteEvent:"",createEvent:"",dateFormat:"dddd MMMM D, YYYY",am:"am",pm:"pm"},Kd=["years","year","month","week","day"],Zd=new qr(qd);var Qd={name:"vue-cal",components:{"vuecal-cell":Yd,"vuecal-header":Md,WeekdaysHeadings:Dd,AllDayBar:Nd},provide(){return{vuecal:this,utils:this.utils,modules:this.modules,previous:this.previous,next:this.next,switchView:this.switchView,updateSelectedDate:this.updateSelectedDate,editEvents:this.editEvents,view:this.view,domEvents:this.domEvents}},props:{activeView:{type:String,default:"week"},scrollToHour:{type:Number,default:0},allDayBarHeight:{type:[String,Number],default:"25px"},cellClickHold:{type:Boolean,default:!0},cellContextmenu:{type:Boolean,default:!1},clickToNavigate:{type:Boolean,default:!1},dblclickToNavigate:{type:Boolean,default:!0},disableDatePrototypes:{type:Boolean,default:!1},disableDays:{type:Array,default:()=>[]},disableViews:{type:Array,default:()=>[]},dragToCreateEvent:{type:Boolean,default:!0},dragToCreateThreshold:{type:Number,default:15},editableEvents:{type:[Boolean,Object],default:!1},unscheduledTime:{type:Array,default:[]},events:{type:Array,default:()=>[]},eventsCountOnYearView:{type:Boolean,default:!1},eventsOnMonthView:{type:[Boolean,String],default:!1},hideBody:{type:Boolean,default:!1},hideTitleBar:{type:Boolean,default:!1},hideViewSelector:{type:Boolean,default:!1},hideWeekdays:{type:Array,default:()=>[]},hideWeekends:{type:Boolean,default:!1},locale:{type:[String,Object],default:"en"},maxDate:{type:[String,Date],default:""},minCellWidth:{type:Number,default:0},minDate:{type:[String,Date],default:""},minEventWidth:{type:Number,default:0},minSplitWidth:{type:Number,default:0},onEventClick:{type:[Function,null],default:null},onEventCreate:{type:[Function,null],default:null},onEventDblclick:{type:[Function,null],default:null},overlapsPerTimeStep:{type:Boolean,default:!1},resizeX:{type:Boolean,default:!1},selectedDate:{type:[String,Date],default:""},showAllDayEvents:{type:[Boolean,String],default:!1},showTimeInCells:{type:Boolean,default:!1},showWeekNumbers:{type:[Boolean,String],default:!1},snapToTime:{type:Number,default:0},small:{type:Boolean,default:!1},specialHours:{type:Object,default:()=>({})},splitDays:{type:Array,default:()=>[]},startWeekOnSunday:{type:Boolean,default:!1},stickySplitLabels:{type:Boolean,default:!1},time:{type:Boolean,default:!0},timeCellHeight:{type:Number,default:40},timeFormat:{type:String,default:""},timeFrom:{type:Number,default:0},timeStep:{type:Number,default:60},timeTo:{type:Number,default:Ud},todayButton:{type:Boolean,default:!1},transitions:{type:Boolean,default:!0},twelveHour:{type:Boolean,default:!1},watchRealTime:{type:Boolean,default:!1},xsmall:{type:Boolean,default:!1}},data(){return{ready:!1,texts:{...qd},utils:{date:!!this.disableDatePrototypes&&Zd.removePrototypes()||Zd,cell:null,event:null},modules:{dnd:null},cellsEl:null,view:{id:"",title:"",startDate:null,endDate:null,firstCellDate:null,lastCellDate:null,selectedDate:null,events:[]},eventIdIncrement:1,now:new Date,timeTickerIds:[null,null],domEvents:{resizeAnEvent:{_eid:null,start:null,split:null,segment:null,originalEndTimeMinutes:0,originalEnd:null,end:null,startCell:null,endCell:null},dragAnEvent:{_eid:null},dragCreateAnEvent:{startCursorY:null,start:null,split:null,event:null},focusAnEvent:{_eid:null,mousedUp:!1},clickHoldAnEvent:{_eid:null,timeout:1200,timeoutId:null},dblTapACell:{taps:0,timeout:500},clickHoldACell:{cellId:null,split:null,timeout:1200,timeoutId:null,eventCreated:!1},cancelClickEventCreation:!1},mutableEvents:[],transitionDirection:"right"}},methods:{async loadLocale(e){if("object"===typeof this.locale)return this.texts=Object.assign({},qd,e),void this.utils.date.updateTexts(this.texts);if("en"===this.locale){const e=await s.e(1424).then(s.t.bind(s,31424,19));this.texts=Object.assign({},qd,e)}else s(53053)(`./${e}.json`).then(e=>{this.texts=Object.assign({},qd,e.default),this.utils.date.updateTexts(this.texts)})},loadDragAndDrop(){s.e(4574).then(s.bind(s,94574)).then(e=>{const{DragAndDrop:t}=e;this.modules.dnd=new t(this)}).catch(()=>Pd.warn("Vue Cal: Missing drag & drop module."))},validateView(e){return Kd.includes(e)||(Pd.error(`Vue Cal: invalid active-view parameter provided: "${e}".\nA valid view must be one of: ${Kd.join(", ")}.`),e="week"),this.enabledViews.includes(e)||(Pd.warn(`Vue Cal: the provided active-view "${e}" is disabled. Using the "${this.enabledViews[0]}" view instead.`),e=this.enabledViews[0]),e},switchToNarrowerView(e=null){this.transitionDirection="right";const t=this.enabledViews[this.enabledViews.indexOf(this.view.id)+1];t&&this.switchView(t,e)},switchView(e,t=null,s=!1){e=this.validateView(e);const i=this.utils.date,a=this.view.startDate&&this.view.startDate.getTime();if(this.transitions&&s){if(this.view.id===e)return;const t=this.enabledViews;this.transitionDirection=t.indexOf(this.view.id)>t.indexOf(e)?"left":"right"}const l=this.view.id;switch(this.view.events=[],this.view.id=e,this.view.firstCellDate=null,this.view.lastCellDate=null,t||(t=this.view.selectedDate||this.view.startDate),e){case"years":this.view.startDate=new Date(25*Math.floor(t.getFullYear()/25)||2e3,0,1),this.view.endDate=new Date(this.view.startDate.getFullYear()+25,0,1),this.view.endDate.setSeconds(-1);break;case"year":this.view.startDate=new Date(t.getFullYear(),0,1),this.view.endDate=new Date(t.getFullYear()+1,0,1),this.view.endDate.setSeconds(-1);break;case"month":{this.view.startDate=new Date(t.getFullYear(),t.getMonth(),1),this.view.endDate=new Date(t.getFullYear(),t.getMonth()+1,1),this.view.endDate.setSeconds(-1);let e=new Date(this.view.startDate);if(e.getDay()!==(this.startWeekOnSunday?0:1)&&(e=i.getPreviousFirstDayOfWeek(e,this.startWeekOnSunday)),this.view.firstCellDate=e,this.view.lastCellDate=i.addDays(e,41),this.view.lastCellDate.setHours(23,59,59,0),this.hideWeekends){if([0,6].includes(this.view.firstCellDate.getDay())){const e=6!==this.view.firstCellDate.getDay()||this.startWeekOnSunday?1:2;this.view.firstCellDate=i.addDays(this.view.firstCellDate,e)}if([0,6].includes(this.view.startDate.getDay())){const e=6===this.view.startDate.getDay()?2:1;this.view.startDate=i.addDays(this.view.startDate,e)}if([0,6].includes(this.view.lastCellDate.getDay())){const e=0!==this.view.lastCellDate.getDay()||this.startWeekOnSunday?1:2;this.view.lastCellDate=i.subtractDays(this.view.lastCellDate,e)}if([0,6].includes(this.view.endDate.getDay())){const e=0===this.view.endDate.getDay()?2:1;this.view.endDate=i.subtractDays(this.view.endDate,e)}}break}case"week":{t=i.getPreviousFirstDayOfWeek(t,this.startWeekOnSunday);const e=this.hideWeekends?5:7;this.view.startDate=this.hideWeekends&&this.startWeekOnSunday?i.addDays(t,1):t,this.view.startDate.setHours(0,0,0,0),this.view.endDate=i.addDays(t,e),this.view.endDate.setSeconds(-1);break}case"day":this.view.startDate=t,this.view.startDate.setHours(0,0,0,0),this.view.endDate=new Date(t),this.view.endDate.setHours(23,59,59,0);break}this.addEventsToView();const n=this.view.startDate&&this.view.startDate.getTime();if((l!==e||n!==a)&&(this.$emit("update:activeView",e),this.ready)){const t=this.view.startDate,s={view:e,startDate:t,endDate:this.view.endDate,...this.isMonthView?{firstCellDate:this.view.firstCellDate,lastCellDate:this.view.lastCellDate,outOfScopeEvents:this.view.outOfScopeEvents.map(this.cleanupEvent)}:{},events:this.view.events.map(this.cleanupEvent),...this.isWeekView?{week:i.getWeek(this.startWeekOnSunday?i.addDays(t,1):t)}:{}};this.$refs["vuecal_scroll"].scrollTop=this.scrollToHour*this.timeCellHeight,this.$emit("view-change",s)}},previous(){this.previousNext(!1)},next(){this.previousNext()},previousNext(e=!0){const t=this.utils.date;this.transitionDirection=e?"right":"left";const s=e?1:-1;let i=null;const{startDate:a,id:l}=this.view;switch(l){case"years":i=new Date(a.getFullYear()+25*s,0,1);break;case"year":i=new Date(a.getFullYear()+1*s,1,1);break;case"month":i=new Date(a.getFullYear(),a.getMonth()+1*s,1);break;case"week":i=t[e?"addDays":"subtractDays"](t.getPreviousFirstDayOfWeek(a,this.startWeekOnSunday),7);break;case"day":i=t[e?"addDays":"subtractDays"](a,1);const l=i.getDay(),n=this.startWeekOnSunday?l:(l||7)-1,o=this.weekDays[n].hide;if(o){const s=this.weekDays.map((e,t)=>({...e,i:t}));let a=null,l=0;e?(a=[...s.slice(n),...s].find(e=>(l++,!e.hide)).i,l--):a=[...s,...s.slice(0,n)].reverse().find(e=>(l++,!e.hide)).i,i=t[e?"addDays":"subtractDays"](i,l)}break}i&&this.switchView(l,i)},addEventsToView(e=[]){const t=this.utils.event,{startDate:s,endDate:i,firstCellDate:a,lastCellDate:l}=this.view;if(e.length||(this.view.events=[]),e=e.length?e:[...this.mutableEvents],!e||this.isYearsOrYearView&&!this.eventsCountOnYearView)return;let n=e.filter(e=>t.eventInRange(e,s,i));this.isYearsOrYearView||this.isMonthView&&!this.eventsOnMonthView||(n=n.map(e=>e.daysCount>1?t.createEventSegments(e,a||s,l||i):e)),this.view.events.push(...n),this.isMonthView&&(this.view.outOfScopeEvents=[],e.forEach(e=>{(t.eventInRange(e,a,s)||t.eventInRange(e,i,l))&&(this.view.events.some(t=>t._eid===e._eid)||this.view.outOfScopeEvents.push(e))}))},findAncestor(e,t){while((e=e.parentElement)&&!e.classList.contains(t));return e},isDOMElementAnEvent(e){return e.classList.contains("vuecal__event")||this.findAncestor(e,"vuecal__event")},onMouseMove(e){const{resizeAnEvent:t,dragAnEvent:s,dragCreateAnEvent:i}=this.domEvents;(null!==t._eid||null!==s._eid||i.start)&&(e.preventDefault(),t._eid?this.eventResizing(e):this.dragToCreateEvent&&i.start&&this.eventDragCreation(e))},onMouseUp(e){const{focusAnEvent:t,resizeAnEvent:s,clickHoldAnEvent:i,clickHoldACell:a,dragCreateAnEvent:l}=this.domEvents,{_eid:n}=i,{_eid:o}=s;let r=!1;const{event:d,start:u}=l,c=this.isDOMElementAnEvent(e.target),m=t.mousedUp;if(t.mousedUp=!1,c&&(this.domEvents.cancelClickEventCreation=!0),a.eventCreated)return;if(o){const{originalEnd:e,originalEndTimeMinutes:t,endTimeMinutes:i}=s,a=this.view.events.find(e=>e._eid===s._eid);if(r=i&&i!==t,a&&a.end.getTime()!==e.getTime()){const t=this.mutableEvents.find(e=>e._eid===s._eid);t.endTimeMinutes=a.endTimeMinutes,t.end=a.end;const i=this.cleanupEvent(a),l={...this.cleanupEvent(a),end:e,endTimeMinutes:a.originalEndTimeMinutes};this.$emit("event-duration-change",{event:i,oldDate:s.originalEnd,originalEvent:l}),this.$emit("event-change",{event:i,originalEvent:l})}a&&(a.resizing=!1),s._eid=null,s.start=null,s.split=null,s.segment=null,s.originalEndTimeMinutes=null,s.originalEnd=null,s.endTimeMinutes=null,s.startCell=null,s.endCell=null}else u&&(d&&(this.emitWithEvent("event-drag-create",d),l.event.resizing=!1),l.start=null,l.split=null,l.event=null);c||o||this.unfocusEvent(),i.timeoutId&&!n&&(clearTimeout(i.timeoutId),i.timeoutId=null),a.timeoutId&&(clearTimeout(a.timeoutId),a.timeoutId=null);const h="function"===typeof this.onEventClick;if(m&&!r&&!n&&!d&&h){let s=this.view.events.find(e=>e._eid===t._eid);return!s&&this.isMonthView&&(s=this.view.outOfScopeEvents.find(e=>e._eid===t._eid)),s&&this.onEventClick(s,e)}},onKeyUp(e){27===e.keyCode&&this.cancelDelete()},eventResizing(e){const{resizeAnEvent:t}=this.domEvents,s=this.view.events.find(e=>e._eid===t._eid)||{segments:{}},{minutes:i,cursorCoords:a}=this.minutesAtCursor(e),l=s.segments&&s.segments[t.segment],{date:n,event:o}=this.utils,r=Math.max(i,this.timeFrom+1,(l||s).startTimeMinutes+1);if(s.endTimeMinutes=t.endTimeMinutes=r,this.snapToTime){const e=s.endTimeMinutes+this.snapToTime/2;s.endTimeMinutes=e-e%this.snapToTime}if(l&&(l.endTimeMinutes=s.endTimeMinutes),s.end.setHours(0,s.endTimeMinutes,s.endTimeMinutes===Ud?-1:0,0),this.resizeX&&this.isWeekView){s.daysCount=n.countDays(s.start,s.end);const e=this.cellsEl,i=e.offsetWidth/e.childElementCount,l=Math.floor(a.x/i);if(null===t.startCell&&(t.startCell=l-(s.daysCount-1)),t.endCell!==l){t.endCell=l;const e=n.addDays(s.start,l-t.startCell),i=Math.max(n.countDays(s.start,e),1);if(i!==s.daysCount){let e=null;e=i>s.daysCount?o.addEventSegment(s):o.removeEventSegment(s),t.segment=e,s.endTimeMinutes+=.001}}}this.$emit("event-resizing",{_eid:s._eid,end:s.end,endTimeMinutes:s.endTimeMinutes})},eventDragCreation(e){const{dragCreateAnEvent:t}=this.domEvents,{start:s,startCursorY:i,split:a}=t,l=new Date(s),{minutes:n,cursorCoords:{y:o}}=this.minutesAtCursor(e);if(t.event||!(Math.abs(i-o)<this.dragToCreateThreshold))if(t.event){if(l.setHours(0,n,n===Ud?-1:0,0),this.snapToTime){let e=60*l.getHours()+l.getMinutes();const t=e+this.snapToTime/2;e=t-t%this.snapToTime,l.setHours(0,e,0,0)}const e=s<l,{event:i}=t;i.start=e?s:l,i.end=e?l:s,i.startTimeMinutes=60*i.start.getHours()+i.start.getMinutes(),i.endTimeMinutes=60*i.end.getHours()+i.end.getMinutes()}else{if(t.event=this.utils.event.createAnEvent(s,1,{split:a}),!t.event)return t.start=null,t.split=null,void(t.event=null);t.event.resizing=!0}},unfocusEvent(){const{focusAnEvent:e,clickHoldAnEvent:t}=this.domEvents,s=this.view.events.find(s=>s._eid===(e._eid||t._eid));e._eid=null,t._eid=null,s&&(s.focused=!1,s.deleting=!1)},cancelDelete(){const{clickHoldAnEvent:e}=this.domEvents;if(e._eid){const t=this.view.events.find(t=>t._eid===e._eid);t&&(t.deleting=!1),e._eid=null,e.timeoutId=null}},onEventTitleBlur(e,t){if(t.title===e.target.innerHTML)return;const s=t.title;t.title=e.target.innerHTML;const i=this.cleanupEvent(t);this.$emit("event-title-change",{event:i,oldTitle:s}),this.$emit("event-change",{event:i,originalEvent:{...i,title:s}})},updateMutableEvents(){const e=this.utils.date;this.mutableEvents=[],this.events.forEach(t=>{const s="string"===typeof t.start?e.stringToDate(t.start):t.start,i=e.formatDateLite(s),a=e.dateToMinutes(s);let l=null;"string"===typeof t.end&&t.end.includes("24:00")?(l=new Date(t.end.replace(" 24:00","")),l.setHours(23,59,59,0)):l="string"===typeof t.end?e.stringToDate(t.end):t.end;let n=e.formatDateLite(l),o=e.dateToMinutes(l);o&&o!==Ud||(!this.time||"string"===typeof t.end&&10===t.end.length?l.setHours(23,59,59,0):l.setSeconds(l.getSeconds()-1),n=e.formatDateLite(l),o=Ud);const r=i!==n;t=Object.assign({...this.utils.event.eventDefaults},t,{_eid:`${this._.uid}_${this.eventIdIncrement++}`,segments:r?{}:null,start:s,startTimeMinutes:a,end:l,endTimeMinutes:o,daysCount:r?e.countDays(s,l):1,class:t.class}),this.mutableEvents.push(t)})},minutesAtCursor(e){return this.utils.cell.minutesAtCursor(e)},createEvent(e,t,s={}){return this.utils.event.createAnEvent(e,t,s)},cleanupEvent(e){e={...e};const t=["segments","deletable","deleting","titleEditable","resizable","resizing","draggable","dragging","draggingStatic","focused"];return t.forEach(t=>{t in e&&delete e[t]}),e.repeat||delete e.repeat,e},emitWithEvent(e,t){this.$emit(e,this.cleanupEvent(t))},updateSelectedDate(e){if(e=e&&"string"===typeof e?this.utils.date.stringToDate(e):new Date(e),e&&e instanceof Date){const{selectedDate:t}=this.view;t&&(this.transitionDirection=t.getTime()>e.getTime()?"left":"right"),e.setHours(0,0,0,0),t&&t.getTime()===e.getTime()||(this.view.selectedDate=e),this.switchView(this.view.id)}this.$emit("update:selected-date",this.view.selectedDate)},getWeekNumber(e){const t=this.utils.date,s=this.firstCellDateWeekNumber,i=s+e,a=this.startWeekOnSunday?1:0;return i>52?t.getWeek(t.addDays(this.view.firstCellDate,7*e+a)):i},timeTick(){this.now=new Date,this.timeTickerIds[1]=setTimeout(this.timeTick,6e4)},updateDateTexts(){this.utils.date.updateTexts(this.texts)},alignWithScrollbar(){},cellOrSplitHasEvents(e,t=null){return e.length&&(!t&&e.length||t&&e.some(e=>e.split===t.id))}},created(){this.utils.cell=new Zr(this),this.utils.event=new sd(this,this.utils.date),this.loadLocale(this.locale),this.editEvents.drag&&this.loadDragAndDrop(),this.updateMutableEvents(this.events),this.view.id=this.currentView,this.selectedDate?this.updateSelectedDate(this.selectedDate):(this.view.selectedDate=new Date,this.switchView(this.currentView)),this.time&&this.watchRealTime&&(this.timeTickerIds[0]=setTimeout(this.timeTick,1e3*(60-this.now.getSeconds())))},mounted(){const e=this.utils.date,t="ontouchstart"in window,{resize:s,drag:i,create:a,delete:l,title:n}=this.editEvents,o=this.onEventClick&&"function"===typeof this.onEventClick;(s||i||a||l||n||o)&&window.addEventListener(t?"touchend":"mouseup",this.onMouseUp),(s||i||a&&this.dragToCreateEvent)&&window.addEventListener(t?"touchmove":"mousemove",this.onMouseMove,{passive:!1}),n&&window.addEventListener("keyup",this.onKeyUp),t&&(this.$refs.vuecal.oncontextmenu=function(e){e.preventDefault(),e.stopPropagation()});const r=this.view.startDate,d={view:this.view.id,startDate:r,endDate:this.view.endDate,...this.isMonthView?{firstCellDate:this.view.firstCellDate,lastCellDate:this.view.lastCellDate}:{},events:this.view.events.map(this.cleanupEvent),...this.isWeekView?{week:e.getWeek(this.startWeekOnSunday?e.addDays(r,1):r)}:{}};this.$refs["vuecal_scroll"].addEventListener("scroll",()=>{this.$refs["vuecal_splits_heading"].style.top=`${this.$refs["vuecal_scroll"].scrollTop}px`}),this.viewportTimelineOffset=this.$refs["vuecal_scroll"].getBoundingClientRect().top,this.$refs["vuecal_scroll"].scrollTop=this.scrollToHour*this.timeCellHeight,this.$emit("ready",d),this.ready=!0},beforeUnmount(){const e="ontouchstart"in window;window.removeEventListener(e?"touchmove":"mousemove",this.onMouseMove,{passive:!1}),window.removeEventListener(e?"touchend":"mouseup",this.onMouseUp),window.removeEventListener("keyup",this.onKeyUp),this.timeTickerIds[0]&&clearTimeout(this.timeTickerIds[0]),this.timeTickerIds[1]&&clearTimeout(this.timeTickerIds[1]),this.timeTickerIds=[null,null]},computed:{editEvents(){return this.editableEvents&&"object"===typeof this.editableEvents?{title:!!this.editableEvents.title,drag:!!this.editableEvents.drag,resize:!!this.editableEvents.resize,create:!!this.editableEvents.create,delete:!!this.editableEvents.delete}:{title:!!this.editableEvents,drag:!!this.editableEvents,resize:!!this.editableEvents,create:!!this.editableEvents,delete:!!this.editableEvents}},views(){return{years:{label:this.texts.years,enabled:!this.disableViews.includes("years")},year:{label:this.texts.year,enabled:!this.disableViews.includes("year")},month:{label:this.texts.month,enabled:!this.disableViews.includes("month")},week:{label:this.texts.week,enabled:!this.disableViews.includes("week")},day:{label:this.texts.day,enabled:!this.disableViews.includes("day")}}},currentView(){return this.validateView(this.activeView)},enabledViews(){return Object.keys(this.views).filter(e=>this.views[e].enabled)},hasTimeColumn(){return this.time&&this.isWeekOrDayView},isShortMonthView(){return this.isMonthView&&"short"===this.eventsOnMonthView},firstCellDateWeekNumber(){const e=this.utils.date,t=this.view.firstCellDate;return e.getWeek(this.startWeekOnSunday?e.addDays(t,1):t)},timeCells(){const e=[];for(let t=this.timeFrom,s=this.timeTo;t<s;t+=this.timeStep)e.push({hours:Math.floor(t/60),minutes:t%60,label:this.utils.date.formatTime(t,this.TimeFormat),value:t});return e},TimeFormat(){return this.timeFormat||(this.twelveHour?"h:mm{am}":"HH:mm")},daySplits(){return(this.splitDays.filter(e=>!e.hide)||[]).map((e,t)=>({...e,id:e.id||t+1}))},hasSplits(){return this.daySplits.length&&this.isWeekOrDayView},hasShortEvents(){return"short"===this.showAllDayEvents},cellOrSplitMinWidth(){let e=null;return this.hasSplits&&this.minSplitWidth?e=this.visibleDaysCount*this.minSplitWidth*this.daySplits.length:this.minCellWidth&&this.isWeekView&&(e=this.visibleDaysCount*this.minCellWidth),e},allDayBar(){let e=this.allDayBarHeight||null;return e&&!isNaN(e)&&(e+="px"),{cells:this.viewCells,options:this.$props,label:this.texts.allDay,shortEvents:this.hasShortEvents,daySplits:this.hasSplits&&this.daySplits||[],cellOrSplitMinWidth:this.cellOrSplitMinWidth,height:e}},minTimestamp(){let e=null;return this.minDate&&"string"===typeof this.minDate?e=this.utils.date.stringToDate(this.minDate):this.minDate&&this.minDate instanceof Date&&(e=this.minDate),e?e.getTime():null},maxTimestamp(){let e=null;return this.maxDate&&"string"===typeof this.maxDate?e=this.utils.date.stringToDate(this.maxDate):this.maxDate&&this.minDate instanceof Date&&(e=this.maxDate),e?e.getTime():null},weekDays(){let{weekDays:e,weekDaysShort:t=[]}=this.texts;return e=e.slice(0).map((e,s)=>({label:e,...t.length?{short:t[s]}:{},hide:this.hideWeekends&&s>=5||this.hideWeekdays.length&&this.hideWeekdays.includes(s+1)})),this.startWeekOnSunday&&e.unshift(e.pop()),e},weekDaysInHeader(){return this.isMonthView||this.isWeekView&&!this.minCellWidth&&!(this.hasSplits&&this.minSplitWidth)},months(){return this.texts.months.map(e=>({label:e}))},specialDayHours(){return this.specialHours&&Object.keys(this.specialHours).length?Array(7).fill("").map((e,t)=>{let s=this.specialHours[t+1]||[];return Array.isArray(s)||(s=[s]),e=[],s.forEach(({from:s,to:i,class:a,label:l},n)=>{e[n]={day:t+1,from:[null,void 0].includes(s)?null:1*s,to:[null,void 0].includes(i)?null:1*i,class:a||"",label:l||""}}),e}):{}},viewTitle(){const e=this.utils.date;let t="";const s=this.view.startDate,i=s.getFullYear(),a=s.getMonth();switch(this.view.id){case"years":t=this.texts.years;break;case"year":t=i;break;case"month":t=`${this.months[a].label} ${i}`;break;case"week":{const i=this.view.endDate,a=s.getFullYear();let l=this.texts.months[s.getMonth()];this.xsmall&&(l=l.substring(0,3));let n=`${l} ${a}`;if(i.getMonth()!==s.getMonth()){const e=i.getFullYear();let t=this.texts.months[i.getMonth()];this.xsmall&&(t=t.substring(0,3)),n=a===e?`${l} - ${t} ${a}`:this.small?`${l.substring(0,3)} ${a} - ${t.substring(0,3)} ${e}`:`${l} ${a} - ${t} ${e}`}t=`${this.texts.week} ${e.getWeek(this.startWeekOnSunday?e.addDays(s,1):s)} (${n})`;break}case"day":t=this.utils.date.formatDate(s,this.texts.dateFormat,this.texts);break}return t},viewCells(){const e=this.utils.date;let t=[],s=null,i=!1;this.watchRealTime||(this.now=new Date);const a=this.now;switch(this.view.id){case"years":s=this.view.startDate.getFullYear(),t=Array.apply(null,Array(25)).map((t,i)=>{const l=new Date(s+i,0,1),n=new Date(s+i+1,0,1);return n.setSeconds(-1),{startDate:l,formattedDate:e.formatDateLite(l),endDate:n,content:s+i,current:s+i===a.getFullYear()}});break;case"year":s=this.view.startDate.getFullYear(),t=Array.apply(null,Array(12)).map((t,i)=>{const l=new Date(s,i,1),n=new Date(s,i+1,1);return n.setSeconds(-1),{startDate:l,formattedDate:e.formatDateLite(l),endDate:n,content:this.xsmall?this.months[i].label.substr(0,3):this.months[i].label,current:i===a.getMonth()&&s===a.getFullYear()}});break;case"month":{const s=this.view.startDate.getMonth(),a=new Date(this.view.firstCellDate);i=!1,t=Array.apply(null,Array(42)).map((t,l)=>{const n=e.addDays(a,l),o=new Date(n);o.setHours(23,59,59,0);const r=!i&&e.isToday(n)&&!i++;return{startDate:n,formattedDate:e.formatDateLite(n),endDate:o,content:n.getDate(),today:r,outOfScope:n.getMonth()!==s,class:`vuecal__cell--day${n.getDay()||7}`}}),(this.hideWeekends||this.hideWeekdays.length)&&(t=t.filter(e=>{const t=e.startDate.getDay()||7;return!(this.hideWeekends&&t>=6||this.hideWeekdays.length&&this.hideWeekdays.includes(t))}));break}case"week":{i=!1;let s=this.view.startDate;const a=this.weekDays;t=a.map((t,a)=>{const l=e.addDays(s,this.startWeekOnSunday?a-1:a),n=new Date(l);n.setHours(23,59,59,0);const o=(l.getDay()||7)-1;return{startDate:l,formattedDate:e.formatDateLite(l),endDate:n,today:!i&&e.isToday(l)&&!i++,specialHours:this.specialDayHours[o]||[]}}).filter((e,t)=>!a[t].hide);break}case"day":{const s=this.view.startDate,i=new Date(this.view.startDate);i.setHours(23,59,59,0);const a=(s.getDay()||7)-1;t=[{startDate:s,formattedDate:e.formatDateLite(s),endDate:i,today:e.isToday(s),specialHours:this.specialDayHours[a]||[]}];break}}return t},visibleDaysCount(){return this.isDayView?1:7-this.weekDays.reduce((e,t)=>e+t.hide,0)},cellWidth(){return 100/this.visibleDaysCount},cssClasses(){const{resizeAnEvent:e,dragAnEvent:t,dragCreateAnEvent:s}=this.domEvents;return{[`vuecal--${this.view.id}-view`]:!0,[`vuecal--${this.locale}`]:this.locale,"vuecal--no-time":!this.time,"vuecal--view-with-time":this.hasTimeColumn,"vuecal--week-numbers":this.showWeekNumbers&&this.isMonthView,"vuecal--twelve-hour":this.twelveHour,"vuecal--click-to-navigate":this.clickToNavigate,"vuecal--hide-weekends":this.hideWeekends,"vuecal--split-days":this.hasSplits,"vuecal--sticky-split-labels":this.hasSplits&&this.stickySplitLabels,"vuecal--overflow-x":this.minCellWidth&&this.isWeekView||this.hasSplits&&this.minSplitWidth,"vuecal--small":this.small,"vuecal--xsmall":this.xsmall,"vuecal--resizing-event":e._eid,"vuecal--drag-creating-event":s.event,"vuecal--dragging-event":t._eid,"vuecal--events-on-month-view":this.eventsOnMonthView,"vuecal--short-events":this.isMonthView&&"short"===this.eventsOnMonthView,"vuecal--has-touch":"undefined"!==typeof window&&"ontouchstart"in window}},isYearsOrYearView(){return["years","year"].includes(this.view.id)},isYearsView(){return"years"===this.view.id},isYearView(){return"year"===this.view.id},isMonthView(){return"month"===this.view.id},isWeekOrDayView(){return["week","day"].includes(this.view.id)},isWeekView(){return"week"===this.view.id},isDayView(){return"day"===this.view.id}},watch:{events:{handler(e,t){this.updateMutableEvents(e),this.addEventsToView()},deep:!0},locale(e){this.loadLocale(e)},selectedDate(e){this.updateSelectedDate(e)},activeView(e){this.switchView(e)}}};const Jd=(0,A.A)(Qd,[["render",Hr]]);var Gd=Jd,eu={install:e=>{e.component("Vue-cal",Gd)}},tu=s(50686),su=s(55643);const iu=new tu.E({defaultOptions:{queries:{staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,retry:1}}});s(69326),s(10202),s(21152),s(59256),s(39400),s(22595),s(47706),s(70862),s(25626),s(32705);l(),d();const au={axios:{disabled:!0},i18n:{languages:[{title:"Slovenský",flag:"sk",value:"sk"}],defaultLanguage:"sk"},moxios:{routes:{"GET v1/overview/teams":!0,"GET v1/overview/tasks":!0}}},lu=(0,i.Ef)(xo).use(Ao).use(St).use(hr).use(mr,au).use(a.hx).use(o).use(eu).use(kr).use(su.O,{queryClient:iu}).use(c(),{color:"#6200EE"}).mount("#app"),nu=lu.$i18n.t},28206:function(e,t,s){"use strict";e.exports=s.p+"img/spinner.34fd3cb2.gif"},35358:function(e,t,s){var i={"./af":22190,"./af.js":22190,"./ar":7218,"./ar-dz":85785,"./ar-dz.js":85785,"./ar-kw":29417,"./ar-kw.js":29417,"./ar-ly":56904,"./ar-ly.js":56904,"./ar-ma":98617,"./ar-ma.js":98617,"./ar-sa":82699,"./ar-sa.js":82699,"./ar-tn":36789,"./ar-tn.js":36789,"./ar.js":7218,"./az":23050,"./az.js":23050,"./be":8316,"./be.js":8316,"./bg":70310,"./bg.js":70310,"./bm":58884,"./bm.js":58884,"./bn":83469,"./bn-bd":46672,"./bn-bd.js":46672,"./bn.js":83469,"./bo":39118,"./bo.js":39118,"./br":13113,"./br.js":13113,"./bs":23626,"./bs.js":23626,"./ca":40921,"./ca.js":40921,"./cs":17799,"./cs.js":17799,"./cv":12828,"./cv.js":12828,"./cy":93521,"./cy.js":93521,"./da":56962,"./da.js":56962,"./de":93294,"./de-at":16158,"./de-at.js":16158,"./de-ch":95960,"./de-ch.js":95960,"./de.js":93294,"./dv":47963,"./dv.js":47963,"./el":3432,"./el.js":3432,"./en-au":20998,"./en-au.js":20998,"./en-ca":15931,"./en-ca.js":15931,"./en-gb":45930,"./en-gb.js":45930,"./en-ie":58081,"./en-ie.js":58081,"./en-il":71594,"./en-il.js":71594,"./en-in":23904,"./en-in.js":23904,"./en-nz":1507,"./en-nz.js":1507,"./en-sg":19409,"./en-sg.js":19409,"./eo":22177,"./eo.js":22177,"./es":84805,"./es-do":39155,"./es-do.js":39155,"./es-mx":69791,"./es-mx.js":69791,"./es-us":76098,"./es-us.js":76098,"./es.js":84805,"./et":96240,"./et.js":96240,"./eu":20391,"./eu.js":20391,"./fa":20612,"./fa.js":20612,"./fi":4220,"./fi.js":4220,"./fil":65570,"./fil.js":65570,"./fo":5466,"./fo.js":5466,"./fr":14461,"./fr-ca":66306,"./fr-ca.js":66306,"./fr-ch":27081,"./fr-ch.js":27081,"./fr.js":14461,"./fy":73484,"./fy.js":73484,"./ga":76957,"./ga.js":76957,"./gd":72978,"./gd.js":72978,"./gl":89866,"./gl.js":89866,"./gom-deva":65011,"./gom-deva.js":65011,"./gom-latn":84724,"./gom-latn.js":84724,"./gu":71601,"./gu.js":71601,"./he":79802,"./he.js":79802,"./hi":9358,"./hi.js":9358,"./hr":13907,"./hr.js":13907,"./hu":10218,"./hu.js":10218,"./hy-am":20533,"./hy-am.js":20533,"./id":52844,"./id.js":52844,"./is":97353,"./is.js":97353,"./it":6364,"./it-ch":20774,"./it-ch.js":20774,"./it.js":6364,"./ja":6008,"./ja.js":6008,"./jv":68221,"./jv.js":68221,"./ka":92417,"./ka.js":92417,"./kk":42071,"./kk.js":42071,"./km":76149,"./km.js":76149,"./kn":94572,"./kn.js":94572,"./ko":60659,"./ko.js":60659,"./ku":66285,"./ku.js":66285,"./ky":81609,"./ky.js":81609,"./lb":119,"./lb.js":119,"./lo":81748,"./lo.js":81748,"./lt":71973,"./lt.js":71973,"./lv":81347,"./lv.js":81347,"./me":53023,"./me.js":53023,"./mi":65747,"./mi.js":65747,"./mk":64341,"./mk.js":64341,"./ml":63840,"./ml.js":63840,"./mn":62058,"./mn.js":62058,"./mr":19182,"./mr.js":19182,"./ms":45197,"./ms-my":89136,"./ms-my.js":89136,"./ms.js":45197,"./mt":36408,"./mt.js":36408,"./my":51683,"./my.js":51683,"./nb":53141,"./nb.js":53141,"./ne":29344,"./ne.js":29344,"./nl":44703,"./nl-be":84641,"./nl-be.js":84641,"./nl.js":44703,"./nn":79873,"./nn.js":79873,"./oc-lnc":61217,"./oc-lnc.js":61217,"./pa-in":24612,"./pa-in.js":24612,"./pl":24457,"./pl.js":24457,"./pt":1089,"./pt-br":79146,"./pt-br.js":79146,"./pt.js":1089,"./ro":45950,"./ro.js":45950,"./ru":27292,"./ru.js":27292,"./sd":56774,"./sd.js":56774,"./se":87493,"./se.js":87493,"./si":3761,"./si.js":3761,"./sk":49711,"./sk.js":49711,"./sl":88558,"./sl.js":88558,"./sq":8633,"./sq.js":8633,"./sr":90688,"./sr-cyrl":47903,"./sr-cyrl.js":47903,"./sr.js":90688,"./ss":31991,"./ss.js":31991,"./sv":27020,"./sv.js":27020,"./sw":15891,"./sw.js":15891,"./ta":45714,"./ta.js":45714,"./te":30206,"./te.js":30206,"./tet":24768,"./tet.js":24768,"./tg":28276,"./tg.js":28276,"./th":57977,"./th.js":57977,"./tk":56928,"./tk.js":56928,"./tl-ph":8046,"./tl-ph.js":8046,"./tlh":41361,"./tlh.js":41361,"./tr":64367,"./tr.js":64367,"./tzl":10627,"./tzl.js":10627,"./tzm":12636,"./tzm-latn":98148,"./tzm-latn.js":98148,"./tzm.js":12636,"./ug-cn":68823,"./ug-cn.js":68823,"./uk":40461,"./uk.js":40461,"./ur":41366,"./ur.js":41366,"./uz":83454,"./uz-latn":18374,"./uz-latn.js":18374,"./uz.js":83454,"./vi":78572,"./vi.js":78572,"./x-pseudo":80464,"./x-pseudo.js":80464,"./yo":93709,"./yo.js":93709,"./zh-cn":65873,"./zh-cn.js":65873,"./zh-hk":17549,"./zh-hk.js":17549,"./zh-mo":52240,"./zh-mo.js":52240,"./zh-tw":90405,"./zh-tw.js":90405};function a(e){var t=l(e);return s(t)}function l(e){if(!s.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}a.keys=function(){return Object.keys(i)},a.resolve=l,e.exports=a,a.id=35358},35679:function(e,t,s){var i={"./en.json":44174,"./sk.json":10347};function a(e){var t=l(e);return s(t)}function l(e){if(!s.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}a.keys=function(){return Object.keys(i)},a.resolve=l,e.exports=a,a.id=35679},44174:function(e){"use strict";e.exports=JSON.parse('{"Value is not a valid email address":"Value is not a valid email address","error":"chyba","Value is required":"Pole je povinné","This field should be at least 8 characters long":"Pole musí obsahovať aspoň 8 znakov","This field should be at least 6 characters long":"Pole musí obsahovať aspoň 6 znakov","This maximum length allowed is 6":"Pole musí obsahovať 6 znakov","The value must be equal to the other value":"Heslá sa nezhodujú"}')},53053:function(e,t,s){var i={"./ar.json":[30136,136],"./bg.json":[27128,7128],"./bn.json":[35491,5491],"./bs.json":[60228,228],"./ca.json":[79511,9511],"./cs.json":[33153,3153],"./da.json":[72808,2808],"./de.json":[32676,2676],"./el.json":[18098,8098],"./en.json":[31424,1424],"./es.json":[1815,1815],"./et.json":[31482,1482],"./fa.json":[65986,5986],"./fr.json":[73763,3763],"./he.json":[68488,8488],"./hr.json":[56257,6257],"./hu.json":[92024,2024],"./id.json":[57742,7742],"./is.json":[92115,2115],"./it.json":[39870,9870],"./ja.json":[74206,4206],"./ka.json":[3279,3279],"./ko.json":[65045,5045],"./lt.json":[30303,303],"./mn.json":[62120,2120],"./nl.json":[68441,8441],"./no.json":[77516,7516],"./pl.json":[68443,8443],"./pt-br.json":[60698,698],"./ro.json":[58480,8480],"./ru.json":[70058,58],"./sk.json":[88873,8873],"./sl.json":[19744,9744],"./sq.json":[55063,5063],"./sr.json":[8694,8694],"./sv.json":[5242,5242],"./tr.json":[33061,3061],"./uk.json":[69599,9599],"./vi.json":[90858,858],"./zh-cn.json":[82449,2449],"./zh-hk.json":[50565,565]};function a(e){if(!s.o(i,e))return Promise.resolve().then(function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=i[e],a=t[0];return s.e(t[1]).then(function(){return s.t(a,19)})}a.keys=function(){return Object.keys(i)},a.id=53053,e.exports=a},54860:function(e,t){"use strict";t.A={methods:{customFilter(e,t){const s=e.normalize("NFD").replace(/[\u0300-\u036f]/g,""),i=t.normalize("NFD").replace(/[\u0300-\u036f]/g,""),a=/[^a-zA-Z0-9 ]/g,l=s.replace(a,""),n=i.replace(a,"");return l.toLowerCase().includes(n.toLowerCase())||""===e}}}},55884:function(e,t,s){"use strict";s(83725),s(51339);var i=s(49148),a=s.n(i);t.A={enrichEmployees(e){return e.map(e=>({...e,_fullName:`${e.name} ${e.surname}`,_initials:e.name.charAt(0)+e.surname.charAt(0)}))},formatDateTime(e){return a()(e),a()(e).format("DD.MM.yyyy, HH:mm")},formatTimeblockDateTime(e){if(e.date&&e.starts_at_time){const t=a()(e.date).format("DD.MM.yyyy");return`${t}, ${e.starts_at_time}`}return e.start?this.formatDateTime(e.start):""},formatDateTimeForBackend(e){return a()(e).format("YYYY-MM-DD HH:mm:ss")},formatDate(e){return a()(e).format("DD.MM.yyyy")},isBefore(e,t=null){return a()(e).isBefore(a()(t))},isAfter(e,t=a()()){return a()(e).isAfter(a()(t))}}},60349:function(e){function t(e){return Promise.resolve().then(function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t})}t.keys=function(){return[]},t.resolve=t,t.id=60349,e.exports=t},63120:function(e,t,s){"use strict";e.exports=s.p+"img/pencil.b9009162.svg"},65970:function(e,t,s){"use strict";e.exports=s.p+"img/eye.6d5fa7d3.svg"},74366:function(e,t,s){"use strict";e.exports=s.p+"img/bin.8778f5be.svg"},85695:function(e,t,s){"use strict";e.exports=s.p+"img/search.bd80c5fb.svg"},85838:function(e,t,s){"use strict";e.exports=s.p+"img/icon-next.25e7a4f4.svg"},91914:function(e,t,s){"use strict";s(28743),s(83725),s(35019),s(29838),s(51339);var i=s(17533),a=s(79217),l=s(49148),n=s.n(l);t.A={generateTimelineTasks(e,t,s){const{tasks:i,blockers:a,homeoffices:l}=this.generateTimelineEvents(e,s,t),{nonWorkingHours:n}=this.generateTimelineNonWorkingHours(t,s);return{tasks:i,blockers:a,nonWorkingHours:n,homeoffices:l}},getUnscheduledTime(e){let t=0;return e.forEach(e=>t+=e.duration-e.spent_time),t},getScheduledTime(e){let t=0;return e.forEach(e=>t+=e.spent_time),t},isWeekend(e){return n()(e).day()%6==0},generateTimelineEvents(e,t,s){let i=[];const a=[];return e.forEach(e=>{["blocker","adhoc","home_office","vacation","free_day","office365_blocker"].includes(e.type)?i=[...i,...this._generateEventsFromBlocker(e,s)]:e.timeblocks?.forEach(i=>{a.push(this._composeTimelineEvent(e,t,s,i))})}),{tasks:a,blockers:i.filter(e=>"home_office"!=e.type),homeoffices:i.filter(e=>"home_office"==e.type)}},_composeTimelineEvent(e,t,s,l){const n=(0,a.A)(s,new Date(l.start));let o="subtask";return"office365"==e.type&&(o="office365"),{id:e.id,start:(0,i.A)(new Date(l.start),n),end:(0,i.A)(new Date(l.end),n),master_task:e.master_task,date:new Date(l.start),isWeekend:this.isWeekend(l.start),initials:t.name.charAt(0).toUpperCase()+t.surname.charAt(0).toUpperCase(),split:this._getSplitFromDate(s,l.start),project_code:e.project_code,subtask:e,type:o,_timeblock_id:l.id,_timeblock_is_finished:l.is_finished,_real_start:new Date(l.start),_real_end:new Date(l.end),draggable:"office365"!==o}},_generateEventsFromBlocker(e,t){const s=n()(e.start),l=n()(e.end),o=s.isSame(l,"date")?[n()(s).format("YYYY-MM-DD")]:this._getDatesInRange(s,l),r=o.map(o=>{const r=(0,a.A)(t,new Date(o)),d=new Date(n()(o).set({hours:s.hours(),minutes:s.minutes()}).format("YYYY-MM-DD HH:mm")),u=new Date(n()(o).set({hours:l.hours(),minutes:l.minutes()}).format("YYYY-MM-DD HH:mm"));return{blocker:e,split:this._getSplitFromDate(t,o),start:(0,i.A)(d,r),end:(0,i.A)(u,r),date:new Date(o),type:e.type,isBlocker:!0,initials:`${e.employee?.name[0]}${e.employee?.surname[0]}`,color:"#B00020",draggable:!1,_real_start:d,_real_end:u}});return r},_getDatesInRange(e,t){const s=[];while(e<=t)s.push(n()(e).format("YYYY-MM-DD")),e.add(1,"day");return s},generateTimelineNonWorkingHours(e,t){const s=[],{start:i,end:a}=this._getDayStartEnd(e);for(let l=0;l<7;l++)s.push({title:"Non working hours",start:i,end:this._setMinutesToDate(60*t.work_start,e),type:"non-working-hours",split:l+1,draggable:!1}),s.push({title:"Non working hours",start:this._setMinutesToDate(60*t.work_end,e),end:a,type:"non-working-hours",split:l+1,draggable:!1});return{nonWorkingHours:s}},_getSplitFromDate(e,t){return-1*(0,a.A)(new Date(e),new Date(t))+1},_getDifferenceInHours(e,t){return this._getDifferenceInMinutes(e,t)/60},_getDifferenceInMinutes(e,t){if(!e||!t)return 0;let s=(e.getTime()-t.getTime())/1e3;return s/=60,Math.abs(Math.round(s))},_getDayStartEnd(e){return{start:this._setMinutesToDate(0,e),end:this._setMinutesToDate(1439,e)}},_setMinutesToDate(e,t){const s=new Date(t);return s.setHours(Math.floor(e/60),e%60,0,0),s}}},95022:function(e,t,s){"use strict";s.d(t,{e5:function(){return i},AI:function(){return a},Ty:function(){return l},y5:function(){return n},ni:function(){return r},wz:function(){return o}});var i=s(74366),a=s(1914),l=s.p+"img/checkmark-double.8bc9494b.svg",n=s(65970),o=(s(1030),s(63120)),r=(s(8322),s(85838),s(85695),s.p+"img/office-365.84b4e31a.svg")}},t={};function s(i){var a=t[i];if(void 0!==a)return a.exports;var l=t[i]={id:i,loaded:!1,exports:{}};return e[i].call(l.exports,l,l.exports,s),l.loaded=!0,l.exports}s.m=e,function(){var e=[];s.O=function(t,i,a,l){if(!i){var n=1/0;for(u=0;u<e.length;u++){i=e[u][0],a=e[u][1],l=e[u][2];for(var o=!0,r=0;r<i.length;r++)(!1&l||n>=l)&&Object.keys(s.O).every(function(e){return s.O[e](i[r])})?i.splice(r--,1):(o=!1,l<n&&(n=l));if(o){e.splice(u--,1);var d=a();void 0!==d&&(t=d)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[i,a,l]}}(),function(){s.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return s.d(t,{a:t}),t}}(),function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};s.t=function(i,a){if(1&a&&(i=this(i)),8&a)return i;if("object"===typeof i&&i){if(4&a&&i.__esModule)return i;if(16&a&&"function"===typeof i.then)return i}var l=Object.create(null);s.r(l);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=2&a&&i;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(function(e){n[e]=function(){return i[e]}});return n["default"]=function(){return i},s.d(l,n),l}}(),function(){s.d=function(e,t){for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}}(),function(){s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,i){return s.f[i](e,t),t},[]))}}(),function(){s.u=function(e){return"js/"+e+"."+{58:"f154bf2f",136:"69c1f9bd",228:"9c4edc6d",303:"497e5be4",528:"8fb7fa6c",565:"76b5365a",661:"fa979ee5",698:"fc8755f4",858:"566f1d6c",987:"5f9602b9",1173:"58090dd2",1424:"fd9ba40d",1481:"5a2ae1b3",1482:"f76f6ebd",1720:"cd3a1e11",1815:"84b03bc3",2024:"b34691ac",2033:"40c5702b",2115:"e5d8b428",2120:"efa444c5",2281:"ede71462",2416:"4089f5c1",2449:"d90ca4d4",2676:"03859e4a",2808:"d3b75f09",2947:"8ae9b51f",3061:"80d00a57",3153:"3371fc01",3279:"62ff3da8",3474:"1db02bf0",3763:"9edf6ff6",4206:"857725b9",4362:"313aae50",4574:"feca5d29",5045:"0879e63a",5063:"b657adbb",5242:"904479a1",5282:"59912085",5491:"97084a40",5714:"58d7a94a",5986:"3abb5f07",6257:"b851cb6f",7116:"fb38a32b",7128:"eb759ea7",7516:"51436cbb",7742:"8c84225b",7914:"30cff48d",8041:"73b05d24",8081:"47b8b6cb",8098:"69ac9ab2",8352:"b2adecd5",8441:"ccfa34f6",8443:"c8c9177c",8480:"9a686c7a",8488:"80759477",8694:"b793d9f3",8873:"7cb333ae",8874:"b4c2fd84",9202:"b2a5dc39",9441:"5bb002c0",9511:"dabc0b3b",9599:"984d3c71",9721:"5ae11807",9744:"99c8a3d6",9841:"e3a2f8ac",9870:"20c0ed01"}[e]+".js"}}(),function(){s.miniCssF=function(e){return"css/"+e+"."+{528:"30f4491c",1720:"37c9d5d7",2281:"ea6a4ebd",2416:"ace2e544",2947:"36aa9b9d",5282:"60a5622e",5714:"45345959",7914:"3978ef96",8352:"4f15acde",9202:"dbf995cd",9721:"5597b32e",9841:"0cdcb652"}[e]+".css"}}(),function(){s.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="jandl:";s.l=function(i,a,l,n){if(e[i])e[i].push(a);else{var o,r;if(void 0!==l)for(var d=document.getElementsByTagName("script"),u=0;u<d.length;u++){var c=d[u];if(c.getAttribute("src")==i||c.getAttribute("data-webpack")==t+l){o=c;break}}o||(r=!0,o=document.createElement("script"),o.charset="utf-8",s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-webpack",t+l),o.src=i),e[i]=[a];var m=function(t,s){o.onerror=o.onload=null,clearTimeout(h);var a=e[i];if(delete e[i],o.parentNode&&o.parentNode.removeChild(o),a&&a.forEach(function(e){return e(s)}),t)return t(s)},h=setTimeout(m.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=m.bind(null,o.onerror),o.onload=m.bind(null,o.onload),r&&document.head.appendChild(o)}}}(),function(){s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){s.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e}}(),function(){s.p="/"}(),function(){var e=function(e,t,s,i){var a=document.createElement("link");a.rel="stylesheet",a.type="text/css";var l=function(l){if(a.onerror=a.onload=null,"load"===l.type)s();else{var n=l&&("load"===l.type?"missing":l.type),o=l&&l.target&&l.target.href||t,r=new Error("Loading CSS chunk "+e+" failed.\n("+o+")");r.code="CSS_CHUNK_LOAD_FAILED",r.type=n,r.request=o,a.parentNode.removeChild(a),i(r)}};return a.onerror=a.onload=l,a.href=t,document.head.appendChild(a),a},t=function(e,t){for(var s=document.getElementsByTagName("link"),i=0;i<s.length;i++){var a=s[i],l=a.getAttribute("data-href")||a.getAttribute("href");if("stylesheet"===a.rel&&(l===e||l===t))return a}var n=document.getElementsByTagName("style");for(i=0;i<n.length;i++){a=n[i],l=a.getAttribute("data-href");if(l===e||l===t)return a}},i=function(i){return new Promise(function(a,l){var n=s.miniCssF(i),o=s.p+n;if(t(n,o))return a();e(i,o,a,l)})},a={3057:0};s.f.miniCss=function(e,t){var s={528:1,1720:1,2281:1,2416:1,2947:1,5282:1,5714:1,7914:1,8352:1,9202:1,9721:1,9841:1};a[e]?t.push(a[e]):0!==a[e]&&s[e]&&t.push(a[e]=i(e).then(function(){a[e]=0},function(t){throw delete a[e],t}))}}(),function(){var e={3057:0};s.f.j=function(t,i){var a=s.o(e,t)?e[t]:void 0;if(0!==a)if(a)i.push(a[2]);else{var l=new Promise(function(s,i){a=e[t]=[s,i]});i.push(a[2]=l);var n=s.p+s.u(t),o=new Error,r=function(i){if(s.o(e,t)&&(a=e[t],0!==a&&(e[t]=void 0),a)){var l=i&&("load"===i.type?"missing":i.type),n=i&&i.target&&i.target.src;o.message="Loading chunk "+t+" failed.\n("+l+": "+n+")",o.name="ChunkLoadError",o.type=l,o.request=n,a[1](o)}};s.l(n,r,"chunk-"+t,t)}},s.O.j=function(t){return 0===e[t]};var t=function(t,i){var a,l,n=i[0],o=i[1],r=i[2],d=0;if(n.some(function(t){return 0!==e[t]})){for(a in o)s.o(o,a)&&(s.m[a]=o[a]);if(r)var u=r(s)}for(t&&t(i);d<n.length;d++)l=n[d],s.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return s.O(u)},i=self["webpackChunkjandl"]=self["webpackChunkjandl"]||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))}();var i=s.O(void 0,[504],function(){return s(13086)});i=s.O(i)})();
|
||
//# sourceMappingURL=index.bc9ed432.js.map
|