import{a as Re}from"./chunk-LMQQ766H.js";import"./chunk-SLQSOQUB.js";import{a as fe}from"./chunk-D4RZOGGF.js";import{a as I}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as ue,c as be,d as ve}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as he}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{$ as se,Ob as w,Y as oe,Z as P,_ as D,a as _e,aa as le,f as Z,g as Q,j as u,k as ie,l as ne,la as N,na as me,o as ae,oa as ce,wb as ge}from"./chunk-YSQLW2JA.js";import{kc as b,mc as de,nc as c}from"./chunk-NVJ2ZZFT.js";import{Aa as g,Ba as R,Dc as l,Fb as G,Hb as x,Id as B,Nc as $,Ng as re,Qf as y,Rd as q,Sd as K,Te as k,Ve as Y,W as L,Ye as V,Yg as pe,ab as F,af as X,bb as d,cb as H,cd as J,db as U,dd as f,ea as W,fb as T,g as Oe,gb as z,gg as h,ha as v,hd as M,hg as ee,jb as S,jg as te,wa as j,ya as p}from"./chunk-SKPDQO4E.js";var De=`<div class="h-100">
    <side-navigation #sideNavigation>
        <ng-template side-navigation-nav>
            <div *ngIf="filter">
                <div class="row">
                    <div class="col-12">
                        <label class="report-form-label">{{'REPORT.WORKPLANS' | translate}}</label>
                        <armon-select-search query="workplan" [allowMulti]="true" [(ngModel)]="filter.workPlanIds">
                        </armon-select-search>
                    </div>
                    <div class="col-12">
                        <label class="report-form-label">{{'REPORT.EMPLOYEES' | translate}}</label>
                        <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="filter.userIds">
                        </armon-select-search>
                    </div>
                    <div class="col-12">
                        <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
                        <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="filter.organizationUnitIds">
                        </armon-select-search>
                        <label class="report-checkbox-label" nz-checkbox
                            *ngIf="filter.organizationUnitIds && filter.organizationUnitIds.length > 0"
                            [(ngModel)]="filter.applyOrganizationUnitFilterHierarchically">{{'REPORT.SHOW_HIERARCHICALLY'|
                            translate}}</label>
                    </div>
                    <div class="col-12">
                        <label class="report-form-label">{{'REPORT.USER_GROUPS' | translate :
                            languageService.userTranslate}}</label>
                        <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="filter.userGroupIds">
                        </armon-select-search>
                    </div>
                </div>

                <div class="col-12 mt-3 d-flex justify-content-center">
                    <button class="btn btn-success btn-sm" (click)="onGetExcelClicked($event)"
                        [disabled]="!rangeItems || rangeItems.length==0">{{'BUTTON.EXCEL' |
                        translate}}</button>
                    <button class="btn btn-primary btn-sm ms-2"
                        (click)="onGetReportClicked($event)">{{'REPORT.GET_REPORT' |
                        translate}}</button>
                </div>

            </div>
        </ng-template>
        <ng-template side-navigation-content>
            <div class="report-data-container">
                <div class="row report-filter-container">
                    <div class="col-12" style="min-height:0;">
                        <div class="row">
                            <div class="col-12">
                                <armon-date-picker #datePicker [options]="datePickerOptions"
                                    (selectionChanged)="onDateSelectionChanged($event)">
                                </armon-date-picker>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row report-data-table-container" id="report-data-table-container">
                    <div class="col-12">
                        <ng-container *ngFor="let rangeItem of rangeItems">
                            <pacs-workplan-planner-item [item]="rangeItem" [syncId]="syncId">
                            </pacs-workplan-planner-item>
                        </ng-container>
                    </div>
                    <ng-template *ngTemplateOutlet="paginationTemplate"></ng-template>
                </div>
            </div>
        </ng-template>
    </side-navigation>
</div>

<ng-template #paginationTemplate>
    <div class="col-12 mb-3 mt-3">
        <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
            (pageChanged)="pageChanged($event)"></armon-pagination>
    </div>
</ng-template>`;var Te=`.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.section-title{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666;margin-bottom:12px}.employee-count,.employee-count-remove{font-size:2.52rem;color:#81b551;font-weight:lighter}.employee-count-remove{color:#c82602}
`;var Ce=Oe(_e());var Ne=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},C=class{_tlSyncService;constructor(){this._tlSyncService=me.getInstance()}resetSyncIdCache(e){this._tlSyncService.resetSyncIdCache(e)}static ctorParameters=()=>[]};C=Ne([W({providedIn:"root"})],C);var Se=`<div class="row mx-1 my-2 bg-white py-2 rounded-2">
    <div class="col-12 col-lg-3">
        <armon-captionlines *ngIf="item?.userCaptions" [showBorder]="false" [captionlines]="item.userCaptions">
        </armon-captionlines>
    </div>
    <div class="col-12 col-lg-9">
        <ng-container *ngIf="visibleSpinner">
            <div class="d-flex mhs-5 b-1 rnd-1 p-2">
                <div class="spinner-grow spinner-grow-sm text-primary" role="status">
                    <span class="sr-only"></span>
                </div>
            </div>
        </ng-container>
        <ng-container *ngIf="!visibleSpinner">
            <div *ngIf="timeline">
                <app-timeline-wrapper-component [timeline]="timeline" [options]="timelineSelectionOptions"
                    (onRangeClicked)="onRangeClicked($event)" (onRangeMouseEnter)="onRangeMouseEnter($event)"
                    (onRangeMouseLeave)="onRangeMouseLeave($event)" (onDividerClicked)="onDividerClicked($event)"
                    (onDividerMouseEnter)="onDividerMouseEnter($event)"
                    (onDividerMouseLeave)="onDividerMouseLeave($event)">
                </app-timeline-wrapper-component>
            </div>
        </ng-container>
    </div>
</div>`;var xe="";var ke=`<ng-container>
    <div class="modal-header align-items-center">
        <div class="d-flex me-2 align-items-center">
            <cds-icon shape="calendar" size="lg" class="text-primary opacity-25"></cds-icon>
        </div>
        <div class="d-flex flex-column flex-grow-1">
            <span class="text-lg">{{'PACS.PLANNER_WORKPLAN_RANGE' | translate}}</span>
        </div>
    </div>
    <div class="modal-body mhs-15">
        <div class="row">
            <div class="col-12 b-b-1 mb-3 pb-3">
                <div class="d-flex">
                    <div class="flex-grow-1">
                        <armon-captionlines *ngIf="userCaptions" [showBorder]="false" [captionlines]="userCaptions">
                        </armon-captionlines>
                    </div>
                    <div class="ms-auto d-flex align-items-end">
                        <div>
                            <button class="btn btn-success" (click)="onDayPlannerClicked($event)">{{'PACS.PLANNER_DAY' |
                                translate}}</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row my-4">
            <div class="col-12 d-flex pb-3 workplan-container" [ngStyle]="{'border-color': membership.workPlanColor}">
                <div class="d-flex flex-column flex-grow-1">
                    <span>{{membership.workPlanName}}</span>
                    <div class="d-flex align-items-center text-md" *ngIf="membershipRange.originalRange">
                        <cds-icon shape="calendar" class="me-2"></cds-icon>
                        <ng-container
                            *ngIf="!membershipRange.originalRange.startDateTime && !membershipRange.originalRange.endDateTime">
                            {{'COMMON.CONTINUOUS'|translate}}</ng-container>
                        <ng-container
                            *ngIf="membershipRange.originalRange.startDateTime || membershipRange.originalRange.endDateTime">
                            <span
                                *ngIf="membershipRange.originalRange.startDateTime">{{membershipRange.originalRange.startDateTime|
                                date:'fullDate'}} - </span>
                            <span *ngIf="!membershipRange.originalRange.startDateTime">... - </span>
                            <span
                                *ngIf="membershipRange.originalRange.endDateTime">{{membershipRange.originalRange.endDateTime|
                                date:'fullDate'}}</span>
                            <span *ngIf="!membershipRange.originalRange.endDateTime">...</span>
                        </ng-container>
                    </div>
                </div>
            </div>
        </div>
        <div class="row my-3">
            <div class="col-6 d-flex flex-column">
                <label class="report-form-label">{{'PLACEHOLDER.DATE_FROM'|translate}}</label>
                <div class="d-flex align-items-center">
                    <cds-icon shape="calendar" style="width: 20px; height: 20px;" class="color-primary me-2"></cds-icon>
                    <input type="text" class="form-control form-control-sm bg-white" readonly owlinput
                        placeholder="{{'COMMON.CONTINUOUS'|translate}}" [max]="endDateTime" [(ngModel)]="startDateTime"
                        [owlDateTimeTrigger]="dateTimePickerStart" [owlDateTime]="dateTimePickerStart">
                    <owl-date-time [firstDayOfWeek]="1" #dateTimePickerStart [stepMinute]="5"
                        [startAt]="startStartAtDate" [showSecondsTimer]="false"
                        (afterPickerOpen)="onAfterPickerOpened($event)">
                    </owl-date-time>
                    <div class="p-1 cursor-pointer mx-1" [hidden]="startDateTime==null" (click)="startDateTime = null"
                        nz-tooltip nzTooltipTitle="{{'BUTTON.REMOVE'|translate}}">
                        <cds-icon shape="times-circle" solid class="color-error"></cds-icon>
                    </div>
                </div>
            </div>
            <div class="col-6 d-flex flex-column">
                <label class="report-form-label">{{'PLACEHOLDER.DATE_TO'|translate}}</label>
                <div class="d-flex align-items-center">
                    <cds-icon shape="calendar" style="width: 20px; height: 20px;" class="color-primary me-2"></cds-icon>
                    <input type="text" class="form-control form-control-sm bg-white" readonly owlinput
                        placeholder="{{'COMMON.CONTINUOUS'|translate}}" [min]="startDateTime" [(ngModel)]="endDateTime"
                        [owlDateTimeTrigger]="dateTimePickerEnd" [owlDateTime]="dateTimePickerEnd">
                    <owl-date-time [firstDayOfWeek]="1" #dateTimePickerEnd [stepMinute]="5" [startAt]="endStartAtDate"
                        [showSecondsTimer]="false" (afterPickerOpen)="onAfterPickerOpened($event)">
                    </owl-date-time>
                    <div class="p-1 cursor-pointer mx-1" [hidden]="endDateTime==null" (click)="endDateTime = null"
                        nz-tooltip nzTooltipTitle="{{'BUTTON.REMOVE'|translate}}">
                        <cds-icon shape="times-circle" solid class="color-error"></cds-icon>
                    </div>
                </div>
            </div>
            <div class="col-12 d-flex justify-content-between mt-3">
                <button class="btn btn-outline-danger" (click)="onDeleteClicked($event)">{{'BUTTON.DELETE' |
                    translate}}</button>
                <button class="btn btn-primary" (click)="onUpdateClicked($event)">{{'BUTTON.UPDATE' |
                    translate}}</button>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">{{'BUTTON.CANCEL' |
            translate}}</button>
    </div>
</ng-container>`;var ye=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}.workplan-container{border-bottom:5px solid #FFF}
`;var Fe=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},O=class extends K{interactionService;pacsService;membership;membershipRange;userCaptions;startDateTime;endDateTime;startStartAtDate;endStartAtDate;constructor(e,i){super(),this.interactionService=e,this.pacsService=i}onModalInitialized(){super.onModalInitialized(),this.membershipRange&&(this.startDateTime=this.membershipRange.originalRange.startDateTime,this.endDateTime=this.membershipRange.originalRange.endDateTime,this.startStartAtDate=this.membershipRange.originalRange.startDateTime||l.local().startOf("day").toJSDate(),this.endStartAtDate=this.membershipRange.originalRange.endDateTime||l.local().plus({days:1}).startOf("day").toJSDate())}onUpdateClicked(e){let i=new de;i.startDateTime=l.fromJSDate(this.startDateTime).toISO(),i.endDateTime=l.fromJSDate(this.endDateTime).toISO(),this.pacsService.updateWorkplanMembershipRange(this.membershipRange.userWorkPlanId,i).subscribe(n=>{this.interactionService.showMessage("PACS.PLANNER_WORKPLAN_UPDATED",null,$.Success);let r={result:"editCompleted"};this.closeModal(r)})}onDayPlannerClicked(e){let i={result:"dayPlanner"};this.closeModal(i)}onDeleteClicked(e){this.interactionService.showDialog(this.membership.workPlanName,"PACS.PLANNER_APPROVE_DELETE_RANGE",null,null,!0,"BUTTON.DELETE","",!0,()=>{this.pacsService.deleteWorkplanMembershipRange(this.membershipRange.userWorkPlanId).subscribe(()=>{let i={result:"deleteCompleted"};this.closeModal(i)})})}onAfterPickerOpened(e){setTimeout(()=>{Array.from(document.getElementsByClassName("owl-dt-timer-input")).forEach(i=>{i.setAttribute("disabled","true")})},100)}static ctorParameters=()=>[{type:y},{type:u}];static propDecorators={membership:[{type:g}],membershipRange:[{type:g}],userCaptions:[{type:g}]}};O=Fe([p({selector:"armon-pacs-workplan-planner-range-modal",template:ke,standalone:!0,providers:[{provide:Y,useClass:ie}],imports:[d,I,T,k,V,pe,S,f],styles:[ye]})],O);var Pe=`<div class="tooltip-container p-2" [ngStyle]="{'border-color': color}">
    <div class="d-flex flex-column mb-2">
        <span class="text-sm">{{title|translate}}</span>
        <span class="text-xs fw-medium">{{subTitle|translate}}</span>
    </div>
    <ng-container [ngSwitch]="data.type">
        <!-- MEMBERSHIP -->
        <ng-container *ngSwitchCase="1">
            <ng-container *ngIf="data.membershipRange.originalRange.isDailyRange">
                <div class="d-flex flex-column b-t-1 pt-2">
                    <span
                        class="text-lg">{{data.membershipRange.originalRange.startDateTime|date:'HH:mm'}}&nbsp;-&nbsp;{{data.membershipRange.originalRange.endDateTime|date:'HH:mm'}}</span>
                </div>
            </ng-container>
            <ng-container *ngIf="!data.membershipRange.originalRange.isDailyRange">
                <div class="d-flex align-items-center b-t-1 pt-2 text-xs" *ngIf="data.membershipRange.originalRange">
                    <cds-icon shape="calendar" class="me-2"></cds-icon>
                    <ng-container
                        *ngIf="!data.membershipRange.originalRange.startDateTime && !data.membershipRange.originalRange.endDateTime">
                        {{'COMMON.CONTINUOUS'|translate}}</ng-container>
                    <ng-container
                        *ngIf="data.membershipRange.originalRange.startDateTime || data.membershipRange.originalRange.endDateTime">
                        <span
                            *ngIf="data.membershipRange.originalRange.startDateTime">{{data.membershipRange.originalRange.startDateTime|
                            date:'medium'}} - </span>
                        <span *ngIf="!data.membershipRange.originalRange.startDateTime">... - </span>
                        <span
                            *ngIf="data.membershipRange.originalRange.endDateTime">{{data.membershipRange.originalRange.endDateTime|
                            date:'medium'}}</span>
                        <span *ngIf="!data.membershipRange.originalRange.endDateTime">...</span>
                    </ng-container>
                </div>
            </ng-container>
            <div class="d-flex mt-2 text-xs text-italic" *ngIf="data.membershipRange.intersectingRange">
                <span>{{data.membershipRange.intersectingRange.startDateTime|
                    date:'medium'}}&nbsp;-&nbsp;{{data.membershipRange.intersectingRange.endDateTime|
                    date:'medium'}}</span>
            </div>
        </ng-container>
        <!-- WORKING HOURS -->
        <ng-container *ngSwitchCase="2">
            <div class="d-flex flex-column b-t-1 pt-2" *ngIf="data.workingHours.range">
                <span class="text-lg"
                    *ngIf="data.workingHours.range.isDailyRange">{{data.workingHours.range.startDateTime|date:'HH:mm'}}&nbsp;-&nbsp;{{data.workingHours.range.endDateTime|date:'HH:mm'}}</span>
                <span
                    class="text-xs">{{data.workingHours.range.startDateTime|date:'medium'}}&nbsp;-&nbsp;{{data.workingHours.range.endDateTime|date:'medium'}}</span>
            </div>
        </ng-container>
        <!-- PPERMISSION -->
        <ng-container *ngSwitchCase="3">
            <div class="d-flex flex-column b-t-1 pt-2" *ngIf="data.ppermission.originalRange">
                <span class="text-lg"
                    *ngIf="data.ppermission.originalRange.isDailyRange">{{data.ppermission.originalRange.startDateTime|date:'HH:mm'}}&nbsp;-&nbsp;{{data.ppermission.originalRange.endDateTime|date:'HH:mm'}}</span>
                <span class="text-xs">{{data.ppermission.originalRange.startDateTime|
                    date:'medium'}}&nbsp;-&nbsp;{{data.ppermission.originalRange.endDateTime|
                    date:'medium'}}</span>
            </div>
        </ng-container>
    </ng-container>
</div>`;var we=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}.tooltip-container{width:280px;background-color:#f5f5f5;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;border-left:6px solid #FFF}
`;var ze=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},_=class{authService;router;popoverRef;data;color;title;subTitle;constructor(e,i,n){if(this.authService=e,this.router=i,this.popoverRef=n,n)switch(this.data=this.popoverRef.data,this.data.type){case c.Membership:this.title="PACS.WORKPLAN",this.subTitle=this.data.membership.workPlanName,this.color=this.data.membership.workPlanColor;break;case c.WorkingSchedule:this.title="REPORT.WORKING_PERIOD",this.subTitle=this.data.workingHours.workPlanName,this.color=this.data.workingHours.workPlanColor;break;case c.PPermission:this.title=this.data.ppermission.ppermissionTypeName,this.subTitle="PERMISSION_TYPE.OFFTIME",this.color="#D91FE6";break;case c.Day:this.title=l.fromISO(this.data.day).toFormat("d")+" "+l.fromISO(this.data.day).toFormat("LLLL"),this.subTitle=l.fromISO(this.data.day).toFormat("cccc"),this.color="#AAAAAA";break}}ngOnInit(){}static ctorParameters=()=>[{type:w},{type:x},{type:Z,decorators:[{type:L}]}]};_=ze([p({selector:"armon-pacs-workplan-planner-tooltip",template:Pe,animations:fe,standalone:!0,imports:[T,H,U,d,S,f],styles:[we]})],_);var A={WIDTH:280,HEIGHT:60};var Ge=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},E=class{router;authService;pacsService;popoverService;modalService;item;syncId;interactionStarted=new v;interactionFinished=new v;routingStarted=new v;dataLoaded=new v;useAsHumanResources;permissionWritePPermission;timeline;popoverReference;visibleSpinner=!1;timelineSelectionOptions={enableZoom:!0,paddingY:6,firstRowMarginTop:12,lastRowMarginBottom:6,scaleForSubDividers:0,countSubDividers:12,rowGapHeight:8};constructor(e,i,n,r,t){this.router=e,this.authService=i,this.pacsService=n,this.popoverService=r,this.modalService=t}ngOnInit(){this.useAsHumanResources=this.authService.checkPermission(M.PPERMISSION.getHRApprovement()),this.permissionWritePPermission=this.authService.checkPermission(M.PPERMISSION.getWrite())}ngAfterContentInit(){this.renderTimeline()}ngOnDestroy(){}renderTimeline(){let e=new oe;this.syncId&&(e.syncId=this.syncId);let i=new se,n=1/this.item.rangeInDays,r=l.fromJSDate(this.item.range.startDateTime);for(let t=0;t<=this.item.rangeInDays;t++){let a=new le;a.label=r.toFormat("d")+" "+r.toFormat("LLL")+" "+r.toFormat("ccc"),a.pos=t*n,a.color="#999",a.labelPosition="left",a.clickable=!0,a.data={type:c.Day,day:r.toFormat("yyyy-MM-dd")},i.addItem(a),r=r.plus({day:1})}if(e.addDivider(i),this.item.workingSchedule&&this.item.workingSchedule.length>0){let t=new P;t.height=6,this.item.workingSchedule.forEach(a=>{a.workingHours.forEach(o=>{let m=new D;m=this.getRangeFromWorkingHours(o),m.color=o.workPlanColor,m.data={type:c.WorkingSchedule,workingHours:o},m.cornerRadius=3,t.addRange(m)})}),t.hasRange&&e.addRow(t)}if(this.item.memberships&&this.item.memberships.length>0){let t=new P;t.height=10,this.item.memberships.forEach(a=>{a.ranges.forEach(o=>{let m=new D;m=this.getRangeFromMembership(o),m.color=a.workPlanColor,m.pattern="lines_light",m.data={type:c.Membership,membership:a,membershipRange:o},m.clickable=!0,m.cornerRadius=2,t.addRange(m)})}),t.hasRange&&e.addRow(t)}if(this.item.ppermissions&&this.item.ppermissions.length>0){let t=new P;t.height=6,this.item.ppermissions.forEach(a=>{let o=new D;o=this.getRangeFromPPermission(a),o.color="#D91FE6",o.data={type:c.PPermission,ppermission:a},o.clickable=!1,t.addRange(o)}),t.hasRange&&e.addRow(t)}this.item.rangeInDays>15?this.timelineSelectionOptions.scaleForSubDividers=2:this.item.rangeInDays>7?this.timelineSelectionOptions.scaleForSubDividers=1:this.timelineSelectionOptions.scaleForSubDividers=0,setTimeout(()=>{this.timeline=e},300)}getRangeFromMembership(e){return this.createRange(e.intersectingRange.startDateTime,e.intersectingRange.endDateTime)}getRangeFromWorkingHours(e){return this.createRange(e.range.startDateTime,e.range.endDateTime)}getRangeFromPPermission(e){return this.createRange(e.intersectingRange.startDateTime,e.intersectingRange.endDateTime)}_startDateTime;_timelineDurationInMs;createRange(e,i){this._startDateTime||(this._startDateTime=l.fromJSDate(this.item.range.startDateTime)),this._timelineDurationInMs||(this._timelineDurationInMs=this.item.rangeInDays*864e5);let n=new D;return n.hoverable=!0,n.startPos=N.getPercantageForDateTimes(this._startDateTime,l.fromJSDate(e),this._timelineDurationInMs),n.endPos=N.getPercantageForDateTimes(this._startDateTime,l.fromJSDate(i),this._timelineDurationInMs),n}refreshScheduleData(){this.visibleSpinner=!0,this.timeline=null;let e=b.getEmptyModel();e.userIds=[this.item.userId],e.range={startDateTime:l.fromJSDate(this.item.range.startDateTime).toISO(),endDateTime:l.fromJSDate(this.item.range.endDateTime).toISO()},this.pacsService.getPacsWorkplanPlannerRange(e,!1).subscribe(i=>{this.item=i.items[0],this.visibleSpinner=!1,this.renderTimeline()})}showDayModal(e){this.interactionStarted.emit(),this.modalService.open(Re,{settings:{size:"xxl",scrollable:!0,centered:!1},props:{day:e,userId:this.item.userId,userCaptions:this.item.userCaptions}}).result.then(i=>{this.interactionFinished.emit(),this.refreshScheduleData()}).catch(i=>{this.interactionFinished.emit()})}showRangeModal(e,i){this.interactionStarted.emit(),this.modalService.open(O,{settings:{size:"lg",scrollable:!0,centered:!0},props:{membershipRange:e,membership:i,userCaptions:this.item.userCaptions}}).result.then(n=>{switch(n.result){case"dayPlanner":this.showDayModal(l.fromJSDate(e.intersectingRange.startDateTime).toFormat("yyyy-MM-dd"));break;case"deleteCompleted":case"editCompleted":this.interactionFinished.emit(),this.refreshScheduleData();break}}).catch(n=>{this.interactionFinished.emit()})}onRangeClicked(e){this.showRangeModal(e.data.membershipRange,e.data.membership)}onRangeMouseEnter(e){this.showTooltip(e)}onRangeMouseLeave(e){this.hideToolTip(e)}showTooltip(e){this.popoverReference=this.popoverService.openGlobalPositon({content:_,width:A.WIDTH,height:0,left:e.posX-A.WIDTH-10,top:e.posY-10,data:e.data})}hideToolTip(e){this.popoverReference&&this.popoverReference.close()}onDividerClicked(e){this.showDayModal(e.data.day)}onDividerMouseEnter(e){this.showTooltip(e)}onDividerMouseLeave(e){this.hideToolTip(e)}static ctorParameters=()=>[{type:x},{type:w},{type:u},{type:Q},{type:q}];static propDecorators={item:[{type:g}],syncId:[{type:g}],interactionStarted:[{type:R}],interactionFinished:[{type:R}],routingStarted:[{type:R}],dataLoaded:[{type:R}]}};E=Ge([p({selector:"pacs-workplan-planner-item",template:Se,standalone:!0,imports:[d,I,ce],styles:[xe]})],E);var $e=function(s,e,i,n){var r=arguments.length,t=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,n);else for(var o=s.length-1;o>=0;o--)(a=s[o])&&(t=(r<3?a(t):r>3?a(e,i,t):a(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},Ie=class{interactionService;pacsService;translate;languageService;route;tlTimelineService;filter;rangeItems;paginationResponse=new re;datePickerOptions=new ee;datePicker;syncId=B();constructor(e,i,n,r,t,a){this.interactionService=e,this.pacsService=i,this.translate=n,this.languageService=r,this.route=t,this.tlTimelineService=a}ngOnInit(){this.datePickerOptions.items=[{type:h.CurrentWeek,selected:!0},{type:h.NextWeek},{type:h.PreviousWeek},{type:h.CurrentMonth,hasDivider:!0},{type:h.PreviousMonth},{type:h.Custom,maxDays:31,hasDivider:!0}],this.createFilter()}ngOnDestroy(){}ngAfterViewInit(){this.fetchReportData()}createFilter(){this.filter=b.getEmptyModel(),this.setDateSelection(te.getDateSelection(this.datePickerOptions.items[0]))}lastDateSelection;setDateSelection(e){this.lastDateSelection=e,this.filter.range={startDateTime:l.fromJSDate(e.startDate).toISO(),endDateTime:l.fromJSDate(e.endDate).plus({days:1}).startOf("day").toISO()}}onGetReportClicked(e){this.filter.pagination.skip=0,this.fetchReportData()}onGetExcelClicked(e){this.pacsService.getPacsWorkplanPlannerRangeExcel(b.getRequestModel(this.filter)).subscribe(i=>{this.translate.get(["PAGES.PACS_WORKPLAN_PLANNER"]).subscribe(n=>{Ce.default.saveAs(i,n["PAGES.PACS_WORKPLAN_PLANNER"]+" "+l.fromJSDate(this.lastDateSelection.startDate).toLocaleString(l.DATE_HUGE)+"-"+l.fromJSDate(this.lastDateSelection.endDate).toLocaleString(l.DATE_HUGE)+".xlsx")})})}onGetPdfClicked(e){}fetchReportData(){this.tlTimelineService.resetSyncIdCache(this.syncId),this.pacsService.getPacsWorkplanPlannerRange(b.getRequestModel(this.filter)).subscribe(e=>{this.rangeItems=e.items,this.paginationResponse=e.pagination})}pageChanged(e){this.filter.pagination.skip=e.skip,this.filter.pagination.take=e.take,this.fetchReportData()}onDateSelectionChanged(e){this.setDateSelection(e),this.filter.pagination.skip=0,this.fetchReportData()}static ctorParameters=()=>[{type:y},{type:u},{type:J},{type:X},{type:G},{type:C}];static propDecorators={datePicker:[{type:j,args:["datePicker"]}]}};Ie=$e([p({selector:"armon-pacs-workplan-planner",template:De,standalone:!0,imports:[ve,ue,d,ge,k,ae,be,ne,F,E,z,he,f],styles:[Te]})],Ie);export{Ie as PacsWorkplanPlannerComponent};
