"use strict";(self["webpackChunkjandl"]=self["webpackChunkjandl"]||[]).push([[3850],{70026:function(e,t){t["Z"]={data(){return{header:{initialized:!1,marginTop:0,calendar_previousScrollPosition:0,isVisible:!0}}},unmounted(){this.$refs.page?.querySelector(".vuecal__bg")?.removeEventListener("scroll",this.handleScroll)},methods:{_initScrollListener(e=0){if(this.initialized)return;const t=this.$refs.page?.querySelector(".vuecal__bg");if(!t)return setTimeout((()=>{e<20&&this._initScrollListener(e+1)}),200);t.addEventListener("scroll",this._handleScroll),this.initialized=!0,this.header.calendar_previousScrollPosition=t.scrollTop},_handleScroll(e){const t=document.querySelector("div.subheader");this.initialized?(this.header.calendar_previousScrollPosition>e.target.scrollTop?this.header.isVisible||this.showHeader():(t.offsetHeight,Math.abs(e.target.scrollTop),this.header.isVisible&&this.hideHeader()),this.header.calendar_previousScrollPosition=e.target.scrollTop):this.header.calendar_previousScrollPosition=e.target.scrollTop},hideHeader(){const e=document.querySelector("div.subheader");e.style.transition="margin-top 0.5s",e.style.marginTop=`-${e.offsetHeight}px`,this.header.isVisible=!1,setTimeout((()=>{e.style.transition=""}),500)},showHeader(){const e=document.querySelector("div.subheader");e.style.transition="margin-top 0.5s",e.style.marginTop="0",this.header.isVisible=!0,setTimeout((()=>{e.style.transition=""}),500)}}}},2750:function(e,t,s){s(57658);var i=s(67462),a=s(85174),n=s(36797),l=s.n(n);t["Z"]={generateTimelineTasks(e,t,s){const{tasks:i,blockers:a,homeoffices:n}=this.generateTimelineEvents(e,s,t),{nonWorkingHours:l}=this.generateTimelineNonWorkingHours(t,s);return{tasks:i,blockers:a,nonWorkingHours:l,homeoffices:n}},getUnscheduledTime(e){let t=0;return e.forEach((e=>t+=e.duration-e.spent_time)),t},isWeekend(e){return l()(e).day()%6==0},generateTimelineEvents(e,t,s){let i=[];const a=[];return e.forEach((e=>{["blocker","adhoc","home_office","vacation","free_day"].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,n){const l=(0,i.Z)(s,new Date(n.start));return{id:e.id,start:(0,a.Z)(new Date(n.start),l),end:(0,a.Z)(new Date(n.end),l),master_task:e.master_task,date:new Date(n.start),isWeekend:this.isWeekend(n.start),initials:t.name.charAt(0).toUpperCase()+t.surname.charAt(0).toUpperCase(),split:this._getSplitFromDate(s,n.start),project_code:e.project_code,subtask:e,type:"subtask",_timeblock_id:n.id,_timeblock_is_finished:n.is_finished,_real_start:new Date(n.start),_real_end:new Date(n.end)}},_generateEventsFromBlocker(e,t){const s=l()(e.start),n=l()(e.end),o=s.isSame(n,"date")?[l()(s).format("YYYY-MM-DD")]:this._getDatesInRange(s,n),r=o.map((o=>{const r=(0,i.Z)(t,new Date(o)),c=new Date(l()(o).set({hours:s.hours(),minutes:s.minutes()}).format("YYYY-MM-DD HH:mm")),d=new Date(l()(o).set({hours:n.hours(),minutes:n.minutes()}).format("YYYY-MM-DD HH:mm"));return{blocker:e,split:this._getSplitFromDate(t,o),start:(0,a.Z)(c,r),end:(0,a.Z)(d,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:c,_real_end:d}}));return r},_getDatesInRange(e,t){const s=[];while(e<=t)s.push(l()(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 n=0;n<7;n++)s.push({title:"Non working hours",start:i,end:this._setMinutesToDate(60*t.work_start,e),type:"non-working-hours",split:n+1,draggable:!1}),s.push({title:"Non working hours",start:this._setMinutesToDate(60*t.work_end,e),end:a,type:"non-working-hours",split:n+1,draggable:!1});return{nonWorkingHours:s}},_getSplitFromDate(e,t){return-1*(0,i.Z)(new Date(e),new Date(t))+1},_getDifferenceInHours(e,t){return this._getDifferenceInMinutes(e,t)/60},_getDifferenceInMinutes(e,t){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}}},30592:function(e,t,s){s.d(t,{Z:function(){return ae}});var i=s(73396),a=s(87139),n=s(49242),l=s(67312),o=s(53289),r=s(80678);const c=e=>((0,i.dD)("data-v-8f2d0fa4"),e=e(),(0,i.Cn)(),e),d={class:"calendar-wrapper"},u={class:"colWidth h-100 d-flex flex-column"},m={key:0,class:"d-flex align-center"},h=["src"],k={class:"weekday-label"},g={key:1,class:"d-flex align-center"},_=["src"],p={class:"weekday-label"},f={key:2},b={class:"day-name"},v={class:"unscheduled-time-initials d-flex align-center justify-center"},w={class:"text-wrap me-4"},y={class:"mb-0 mt-0 unscheduled-time-name"},D={class:"mb-0 mt-0"},T={class:"d-flex justify-center"},C={class:"d-flex justify-center"},S={style:{"margin-top":"-9px"}},M=c((()=>(0,i._)("div",{class:"time-column-line"},null,-1))),x=c((()=>(0,i._)("span",{class:"vuecal__time-cell-line hour"},null,-1))),$=c((()=>(0,i._)("span",{class:"vuecal__time-cell-line",style:{"margin-top":"25px"}},null,-1))),H=c((()=>(0,i._)("span",{class:"vuecal__time-cell-line",style:{"margin-top":"50px"}},null,-1))),E=c((()=>(0,i._)("span",{class:"vuecal__time-cell-line",style:{"margin-top":"75px"}},null,-1))),z={key:0,class:"custom-event-body non-working-event colWidth h-100 d-flex flex-column justify-center"},W={class:"d-flex justify-center align-center"},j={class:"mb-0 ms-2"},B={key:0,class:"project-code"},Y={key:1},L={class:"d-flex align-center event-details event-initials-wrapper"},Z={class:"event-initials d-flex justify-center align-center"},q={class:"event-initials-date"},F={key:2,class:"d-flex align-center"},I={key:0,class:"ml-1"},N={class:"event-footer d-flex"},V=["src"],K=["src"],A=["src"],P=["src"],R=["src"],U=["src"];function O(e,t,c,O,G,J){const Q=(0,i.up)("Vue-cal");return(0,i.wg)(),(0,i.iD)("div",d,[(0,i.Wm)(Q,{"hide-view-selector":!0,"hide-title-bar":!0,"disable-views":["years","year","month","week"],"active-view":"day","selected-date":c.calConfig.date,onEventClick:J.taskClicked,"editable-events":G.vueCalConfig.editing,events:c.calData.tasks,unscheduledTime:c.calData.unscheduled_times,"overlaps-per-time-step":!1,showTimeInCells:!1,"time-cell-height":G.timeCellHeight,"snap-to-time":15,"scroll-to-hour":c.calConfig.scrollHour,"split-days":c.splits,"sticky-split-labels":!0,"min-split-width":140,onReady:t[0]||(t[0]=e=>J.onReady()),onViewChange:J.weekChanged,onEventDrop:J.eventMoved,onEventFocus:J.eventFocused},{"split-label":(0,i.w5)((({split:e})=>[(0,i._)("div",u,[e.date?((0,i.wg)(),(0,i.iD)("span",m,[e.isHomeoffice?((0,i.wg)(),(0,i.iD)("img",{key:0,src:s(87500),class:"mr-2"},null,8,h)):(0,i.kq)("",!0),(0,i._)("p",k,(0,a.zw)(J.getHeadingDate(e.date)),1)])):((0,i.wg)(),(0,i.iD)("span",g,[e.isHomeoffice?((0,i.wg)(),(0,i.iD)("img",{key:0,src:s(87500),class:"mr-2"},null,8,_)):(0,i.kq)("",!0),(0,i._)("p",p,(0,a.zw)(e.name),1)])),e.date?((0,i.wg)(),(0,i.iD)("span",f,[(0,i._)("p",b,(0,a.zw)(e.date.toLocaleDateString("en-EN",{weekday:"long"})),1)])):(0,i.kq)("",!0),(0,i._)("div",{class:(0,a.C_)(["unscheduled-time d-flex align-center text-left",{"vuecal__cell-split--weekend":e.isWeekend}])},[(0,i._)("div",v,[(0,i._)("p",null,(0,a.zw)(e.initials),1)]),(0,i._)("div",w,[(0,i._)("p",y,(0,a.zw)(e.fullname),1),(0,i._)("h1",D,(0,a.zw)(e.unscheduledTime)+" h",1)])],2)])])),"time-cell":(0,i.w5)((({hours:e,minutes:t})=>[(0,i._)("span",T,[(0,i._)("span",C,[(0,i._)("p",S,(0,a.zw)(e)+":"+(0,a.zw)(String(t).padStart(2,"0")),1),M,x]),$,H,E])])),event:(0,i.w5)((({event:e})=>["non-working-hours"==e.type?((0,i.wg)(),(0,i.iD)("div",z,[(0,i._)("div",W,[(0,i.Wm)(o.t,{icon:"mdi-cancel",color:"black"}),(0,i._)("h3",j,(0,a.zw)(e.title),1)])])):["subtask","blocker","adhoc","vacation","free_day"].includes(e.type)?((0,i.wg)(),(0,i.iD)("div",{key:1,class:(0,a.C_)(["custom-event-body colWidth h-100 d-flex flex-column justify-space-between",{"short-event":J.getEventLength(e)<=9e6,"mini-event":J.getEventLength(e)<=54e5,"micro-event":J.getEventLength(e)<=36e5}]),style:(0,a.j5)({backgroundColor:e._timeblock_is_finished||e.subtask?.is_finished?"#dedfe0":e.color||e.subtask?.color})},[(0,i._)("div",{class:(0,a.C_)(["event-content",{"is-blocker":e.isBlocker}])},["subtask"==e.type?((0,i.wg)(),(0,i.iD)(i.HY,{key:0},[e.subtask.project_code?((0,i.wg)(),(0,i.iD)("small",B,(0,a.zw)(e.subtask.project_code),1)):(0,i.kq)("",!0),(0,i._)("h3",null,(0,a.zw)(e.subtask.title??e.subtask.master_task?.name??e.subtask.master_task),1)],64)):((0,i.wg)(),(0,i.iD)("h3",Y,(0,a.zw)(e.blocker.name),1)),(0,i._)("div",L,[(0,i._)("div",Z,[(0,i._)("small",null,(0,a.zw)(e.initials),1)]),(0,i._)("small",q,(0,a.zw)(e.date?.toLocaleDateString("sk-SK")),1)]),"subtask"==e.type?((0,i.wg)(),(0,i.iD)("div",F,[(0,i.Wm)(o.t,{icon:"mdi-skull-outline",size:"small"}),e?.subtask.deadline?((0,i.wg)(),(0,i.iD)("small",I,(0,a.zw)(J.getDeadline(e?.subtask)),1)):((0,i.wg)(),(0,i.j4)(r.N,{key:1,text:"Deadline z Mastertasku",location:"bottom"},{activator:(0,i.w5)((({props:t})=>[e?.subtask?.deadline?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("small",(0,i.dG)({key:0,class:"cursor-pointer ml-1"},t),(0,a.zw)(J.getDeadline(e?.subtask))+"*",17))])),_:2},1024))])):(0,i.kq)("",!0)],2),(0,i._)("div",N,["adhoc"==e.type?((0,i.wg)(),(0,i.iD)(i.HY,{key:0},[(0,i.Wm)(l.T,{rounded:"",class:"event-footer-button me-2",onClick:(0,n.iM)((t=>J.editBlocker(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(60666),alt:""},null,8,V)])),_:2},1032,["onClick"]),(0,i.Wm)(l.T,{rounded:"",class:"event-footer-button me-2",onClick:(0,n.iM)((t=>J.deleteBlocker(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(27484),alt:""},null,8,K)])),_:2},1032,["onClick"])],64)):"subtask"==e.type?((0,i.wg)(),(0,i.iD)(i.HY,{key:1},[(0,i.Wm)(l.T,{rounded:"",class:(0,a.C_)(["event-footer-button me-2",{completed:e.subtask?.is_finished}]),onClick:(0,n.iM)((t=>J.completeTask(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(9003),alt:""},null,8,A)])),_:2},1032,["class","onClick"]),(0,i.Wm)(l.T,{rounded:"",class:(0,a.C_)(["event-footer-button me-2",{completed:e._timeblock_is_finished}]),onClick:(0,n.iM)((t=>J.toggleTimeblockIsFinished(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(53830),alt:""},null,8,P)])),_:2},1032,["class","onClick"]),(0,i.Wm)(l.T,{rounded:"",class:"event-footer-button me-2",onClick:(0,n.iM)((t=>J.editTask(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(34413),alt:""},null,8,R)])),_:2},1032,["onClick"]),(0,i.Wm)(l.T,{rounded:"",class:"event-footer-button me-2",onClick:(0,n.iM)((t=>J.deleteTimeBlockInTask(e)),["stop"])},{default:(0,i.w5)((()=>[(0,i._)("img",{src:s(27484),alt:""},null,8,U)])),_:2},1032,["onClick"])],64)):(0,i.kq)("",!0)])],6)):(0,i.kq)("",!0)])),_:1},8,["selected-date","onEventClick","editable-events","events","unscheduledTime","time-cell-height","scroll-to-hour","split-days","onViewChange","onEventDrop","onEventFocus"])])}var G=s(85174),J=s(34407),Q=s(20065),X=s(36797),ee=s.n(X),te={props:{calData:{type:Object,required:!0,default(){return{}}},calConfig:{type:Object,required:!0,default(){return{date:new Date,scrollHour:7}}},splits:{type:Array,required:!1,default(){return[]}}},data(){return{vueCalConfig:{editing:{title:!1,drag:!0,resize:!1,delete:!1,create:!1}},focusedEventId:null,timeCellHeight:100,tmUtils:J.Z,visible:!1}},computed:{...(0,Q.Se)("tm",["mastertasks"])},methods:{isAfterDeadline(e){const t=this.getDeadline(e.subtask);if(!t)return;const s=ee()(e.date),i=ee()(t),a=e.end.getHours(),n=e.end.getMinutes();return s.hours(a),s.minutes(n),s.isAfter(i)},getDeadline(e){if(e?.deadline)return e.deadline;if(!this.mastertasks)return null;const t=this.mastertasks.find((t=>t.id===e.master_task_id));return t.deadline},weekChanged(){const e=this.$el.getElementsByClassName("vuecal__scrollable-body")[0];e.scrollLeft=0},async eventMoved({event:e,newSplit:t}){const s=(0,G.Z)(this.calConfig.date,t-1),i=s.setHours(Math.round(e.startTimeMinutes/60),Math.round(e.startTimeMinutes%60),0),a=s.setHours(Math.round(e.endTimeMinutes/60),Math.round(e.endTimeMinutes%60),0),n=this.splits.find((e=>e.id==t));if("Dashboard - Tasks"==this.$route.name){const t={...e.subtask,timeblocks:[...e.subtask.timeblocks,{id:e._timeblock_id,is_finished:0,start:J.Z.formatDateTimeForBackend(i),end:J.Z.formatDateTimeForBackend(a)}],timesheets:e.subtask.timesheets.map((e=>(delete e.employee_name,e)))};try{const{subtask:e}=await this.$axios.put_auth(`v1/subtasks/${t.id}`,t);this.$events.emit("on-subtask-edited",e),e.employee_id==this.$store.getters["auth/user"].id&&this.$events.emit("show-task-add-time-modal",{subtask:e})}catch(l){this.$toast.error(l.message||l)}const s=this.isAfterDeadline(e);s&&this.$toast.error("Timeblock, ktorý ste presunuli je po deadline !")}else if("Dashboard - Teams"==this.$route.name){const t={...e.subtask,employee_id:n.employee_id,timeblocks:[...e.subtask.timeblocks,{id:e._timeblock_id,is_finished:0,start:J.Z.formatDateTimeForBackend(e.start),end:J.Z.formatDateTimeForBackend(e.end)}],timesheets:e.subtask.timesheets.map((e=>(delete e.employee_name,e)))};try{const{subtask:e}=await this.$axios.put_auth(`v1/subtasks/${t.id}`,t);this.$events.emit("on-subtask-edited",e)}catch(l){this.$toast.error(l.message||l)}}},onReady(){this.correctMargins()},correctMargins(){if(!this.$el.getElementsByClassName("vuecal__split-days-headers").length)return;const e=this.$el.getElementsByClassName("vuecal__split-days-headers")[0].clientHeight;this.$el.getElementsByClassName("vuecal__time-column")[0].style.marginTop=`${e}px`,this.$el.getElementsByClassName("vuecal__cells-body")[0].style.marginTop=`${e}px`},getHeadingDate(e){const t=new Date(e),s=new Date,i=new Date((new Date).setDate(s.getDate()-1)),a=new Date((new Date).setDate(s.getDate()+1));return s.toLocaleDateString("sk-SK")===t.toLocaleDateString("sk-SK")?"Dnes":i.toLocaleDateString("sk-SK")===t.toLocaleDateString("sk-SK")?"Včera":a.toLocaleDateString("sk-SK")===t.toLocaleDateString("sk-SK")?"Zajtra":t.toLocaleDateString("sk-SK")},getEventLength(e){return e.end.getTime()-e.start.getTime()},taskClicked(e){},eventFocused(e){this.focusedEventId=e.task_id},completeTask({subtask:e}){this.$events.emit("show-complete-task-modal",{subtask:e})},async toggleTimeblockIsFinished(e){const t=e.subtask,s=t.timeblocks.find((t=>t.id==e._timeblock_id));s.is_finished=s?.is_finished?0:1;try{const{data:e}=await this.$axios.put_auth(`v1/timeblocks/${s.id}`,s);t.timeblocks=t.timeblocks.map((t=>t.id==e.id?e:t)),this.$events.emit("on-subtask-edited",t),s.is_finished&&this.$events.emit("show-task-add-time-modal",{subtask:t})}catch(i){this.$toast.error(i.message||i)}},editTask({subtask:e}){this.$events.emit("show-subtask-modal",{subtask:e})},deleteTimeBlockInTask({subtask:e}){this.$events.emit("show-delete-timeblock-modal",{subtask:e})},editBlocker({blocker:e}){this.$events.emit("show-blocker-modal",{blocker:e})},deleteBlocker({blocker:e}){this.$events.emit("show-delete-blocker-modal",{blocker:e})}}},se=s(40089);const ie=(0,se.Z)(te,[["render",O],["__scopeId","data-v-8f2d0fa4"]]);var ae=ie},9003:function(e,t,s){e.exports=s.p+"img/checkmark-double.8bc9494b.svg"},87500:function(e,t,s){e.exports=s.p+"img/home.a9495a95.svg"},35902:function(e,t,s){e.exports=s.p+"img/icon-next.25e7a4f4.svg"},38351:function(e,t,s){e.exports=s.p+"img/icon-prev.22ba0fa6.svg"}}]); //# sourceMappingURL=3850.6ae5b4a5.js.map