import{a as We}from"./chunk-ERH4HFS3.js";import{a as Le}from"./chunk-IKQMUISD.js";import{a as Ne}from"./chunk-C7K6NHIV.js";import{a as Ie}from"./chunk-3BUU6LNF.js";import{a as le,c as W}from"./chunk-MFZ3EXVF.js";import{a as Se}from"./chunk-KCLQIV7M.js";import{Ob as $,j as y,k as C,o as Oe,s as K,v as z,wb as Re,y as F}from"./chunk-YSQLW2JA.js";import{Ab as H,Bb as V,Cb as G,Db as q,o as h,p as k,sb as N,tb as A,ub as L,vb as re,wb as we,xb as ne,yb as se,zb as Ae}from"./chunk-NVJ2ZZFT.js";import{$c as Ce,Aa as d,Ba as u,Bc as ae,Dc as l,De as Ee,Hb as ye,He as Pe,Nc as P,Qf as g,S as pe,Se as xe,Te as v,Ue as De,Ve as b,Xb as be,Yb as _e,Ye as _,Yg as j,_a as he,ab as E,bb as p,bf as U,cb as ve,cd as O,db as ge,dd as m,gb as B,ha as f,hd as w,jb as ke,ma as me,mg as Te,xa as fe,ya as c,za as ue}from"./chunk-SKPDQO4E.js";var Me=class{route;pacsService;translate;authService;COMP_WORKPLAN_TYPE;visibleComponent=!1;visibleNewPeriod=!1;workplan;workplanDetail;workplanSaved=!1;editMode=!1;editPeriodMode=!1;permissionAttendancePlanWrite;constructor(e,t,o,a){this.route=e,this.pacsService=t,this.translate=o,this.authService=a}initComponent(){this.permissionAttendancePlanWrite=this.authService.checkPermission(w.ATTENDANCEPLAN.getWrite()),this.route.queryParams.subscribe(e=>{e&&e.id&&e.id!=""?this.getWorkplanDetail(e.id,this.COMP_WORKPLAN_TYPE):this.translate.get([le[this.COMP_WORKPLAN_TYPE-1].i18nName]).subscribe(t=>{let o=N.getEmptyModel();o.name=t[le[this.COMP_WORKPLAN_TYPE-1].i18nName],o.type=this.COMP_WORKPLAN_TYPE,this.workplan=o,this.visibleComponent=!0})})}getWorkplanDetail(e,t){this.pacsService.getWorkplanDetail(e,t).subscribe(o=>{this.workplanDetail=o;let a=new N;a.createInstance(this.workplanDetail,N,a),this.workplan=a,this.visibleComponent=!0,this.editMode=!0,this.setEditPeriodMode(!1)})}setEditPeriodMode(e){this.editPeriodMode=e}refreshWorkplanDetail(){this.getWorkplanDetail(this.workplan.id,this.workplan.type)}workPlanUpdated(e){this.getWorkplanDetail(e.id,e.type)}periodAddStarted(e){this.visibleNewPeriod=!0,this.setEditPeriodMode(!0)}periodAddCancelled(e){this.visibleNewPeriod=!1,this.setEditPeriodMode(!1)}periodAddCompleted(e){this.visibleNewPeriod=!1,this.setEditPeriodMode(!1),this.refreshWorkplanDetail()}periodEditStarted(e){this.setEditPeriodMode(!0)}periodEditCancelled(e){this.setEditPeriodMode(!1)}periodEditCompleted(e){this.setEditPeriodMode(!1),this.refreshWorkplanDetail()}periodDeleteCompleted(e){this.refreshWorkplanDetail()}};var Be=`<div class="componentContainer" *ngIf="visibleComponent">\r
  <div class="row">\r
    <div class="col-12">\r
      <span\r
        class="text-lg">{{(editMode ? 'PACS.EDIT_WORKPLAN_PERIOD' : 'PACS.ADD_WORKPLAN_PERIOD' ) | translate}}</span>\r
    </div>\r
  </div>\r
  <div class="row mt-3">\r
    <div class="col-xl-4 col-lg-4 col-md-12">\r
      <div class="form-group">\r
        <label for="periodStartDateTimeInput" class="required">{{'PACS.WORKPLAN_PERIOD_START_DATE' | translate}}</label>\r
        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}" id="periodStartDateTimeInput"\r
          [(ngModel)]="period.periodStartDateTime" type="text" class="form-control form-control-sm bg-white" readonly\r
          owlinput (ngModelChange)="periodStartDateChanged($event)" [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1">\r
        <owl-date-time [firstDayOfWeek]="1" #dt1></owl-date-time>\r
      </div>\r
    </div>\r
    <div class="col-xl-2 col-lg-2 col-md-6">\r
      <div class="form-group">\r
        <label for="workDurationInput" class="required">{{'PACS.WORKPLAN_PERIOD_SHIFT_WORK' | translate}}</label>\r
        <div class="input-group input-group-sm">\r
          <input id="workDurationInput" class="form-control" type="number" min="1" max="1440"\r
            onkeypress="return event.charCode >= 48 && event.charCode <= 57" [(ngModel)]="period.workDuration">\r
            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
        </div>\r
      </div>\r
    </div>\r
    <div class="col-xl-2 col-lg-2 col-md-6">\r
      <div class="form-group">\r
        <label for="restDurationInput" class="required">{{'PACS.WORKPLAN_PERIOD_SHIFT_REST' | translate}}</label>\r
        <div class="input-group input-group-sm">\r
          <input id="restDurationInput" class="form-control" type="number" min="1" max="1440"\r
            onkeypress="return event.charCode >= 48 && event.charCode <= 57" [(ngModel)]="period.restDuration">         \r
            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
        </div>\r
      </div>\r
    </div>\r
    <div class="col-xl-4 col-lg-4 col-md-12">\r
      <armon-pacs-workplan-period-offset [(offset)]="period.offset"></armon-pacs-workplan-period-offset>\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3">\r
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_DAYS_TTILE' | translate}}</div>\r
      <armon-pacs-workplan-days [(periodDays)]="period.dayBreakItems" [workplanType]="workplanType" [(routineType)]="period.routineType" [periodStartDateTime]="period.periodStartDateTime"\r
        (periodDaysUpdated)="periodDaysChanged($event)" (validationChanged)="weekValidationChanged($event)">\r
      </armon-pacs-workplan-days>\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3">\r
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_TOLERANCES_TITLE' | translate}}</div>\r
      <armon-pacs-workplan-tolerances [(tolerances)]="period.tolerances"></armon-pacs-workplan-tolerances>\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3 d-flex justify-content-end">\r
      <button class="btn btn-outline-primary me-2" (click)="cancelClicked($event)">\r
        {{'BUTTON.CANCEL' | translate}}\r
      </button>\r
      <button class="btn btn-primary" (click)="saveClicked($event)" [disabled]="disableSaveButton">\r
        {{'BUTTON.SAVE' | translate}}\r
      </button>\r
    </div>\r
  </div>\r
</div>`;var Ue=`.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}:host .componentContainer{padding:18px;background-color:#fff;-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem}:host .sectionTitle{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666}
`;var mt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},x=class{pacsService;interactionService;workplan=null;periodAddCompleted=new f;periodAddCancelled=new f;periodEditCompleted=new f;periodEditCancelled=new f;workplanType;visibleComponent=!1;editMode=!1;disableSaveButton=!0;constructor(e,t){this.pacsService=e,this.interactionService=t}cancelClicked(e){this.editMode?this.periodEditCancelled.emit():this.periodAddCancelled.emit()}static ctorParameters=()=>[{type:y},{type:g}];static propDecorators={workplan:[{type:d}],periodAddCompleted:[{type:u}],periodAddCancelled:[{type:u}],periodEditCompleted:[{type:u}],periodEditCancelled:[{type:u}]}};x=mt([fe()],x);var Ke=`<div *ngIf="visibleComponent">\r
    <div class="row mt-3">\r
        <div class="col-xl-3 col-lg-3 col-md-6">\r
            <div class="form-group">\r
                <label for="earlyInInput">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_EARLY_IN' | translate}}</label>\r
                <div class="input-group input-group-sm">\r
                    <input id="earlyInInput" class="form-control" type="number" min="0" max="360"\r
                        onkeypress="return event.charCode >= 48 && event.charCode <= 57"\r
                        [(ngModel)]="tolerances.earlyStart">\r
                    <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
                </div>\r
            </div>\r
        </div>\r
        <div class="col-xl-3 col-lg-3 col-md-6">\r
            <div class="form-group">\r
                <label for="lateInInput">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_LATE_IN' | translate}}</label>\r
                <div class="input-group input-group-sm">\r
                    <input id="lateInInput" class="form-control" type="number" min="0" max="360"\r
                        onkeypress="return event.charCode >= 48 && event.charCode <= 57"\r
                        [(ngModel)]="tolerances.lateStart">\r
                    <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
                </div>\r
            </div>\r
        </div>\r
        <div class="col-xl-3 col-lg-3 col-md-6">\r
            <div class="form-group">\r
                <label for="earlyOutInput">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_EARLY_OUT' | translate}}</label>\r
                <div class="input-group input-group-sm">\r
                    <input id="earlyOutInput" class="form-control" type="number" min="0" max="360"\r
                        onkeypress="return event.charCode >= 48 && event.charCode <= 57"\r
                        [(ngModel)]="tolerances.earlyLeave">\r
                    <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
                </div>\r
            </div>\r
        </div>\r
        <div class="col-xl-3 col-lg-3 col-md-6">\r
            <div class="form-group">\r
                <label for="lateInInput">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_LATE_OUT' | translate}}</label>\r
                <div class="input-group input-group-sm">\r
                    <input id="lateInInput" class="form-control" type="number" min="0" max="360"\r
                        onkeypress="return event.charCode >= 48 && event.charCode <= 57"\r
                        [(ngModel)]="tolerances.lateLeave">\r
                    <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
                </div>\r
            </div>\r
        </div>\r
    </div>\r
</div>`;var ze="";var ht=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},R=class{tolerances;visibleComponent=!0;constructor(){}ngOnInit(){this.visibleComponent=!0}ngOnDestroy(){}static ctorParameters=()=>[];static propDecorators={tolerances:[{type:d}]}};R=ht([c({selector:"armon-pacs-workplan-tolerances",template:Ke,standalone:!0,imports:[p,v,m],styles:[ze]})],R);var Fe=`<ng-container *ngIf="visibleComponent">
    <ng-container *ngIf="hasRoutineType; then daysTemplate else routineSelectionTemplate"></ng-container>
    <ng-template #routineSelectionTemplate>
        <div class="row">
            <div class="col-12 d-flex justify-content-center my-4">
                <span class="text-center text-md">{{'PACS.WORKPLAN_PERIOD_SELECT_ROUTINE'|translate}}</span>
            </div>
            <div class="col-6">
                <div class="cursor-pointer hover-secondary p-3 d-flex flex-column align-items-center justify-content-center rnd-3"
                    (click)="onRoutineTypeSelected(2);">
                    <img src="./assets/images/pacs/pacs_period_week.png">
                    <span class="text-md text-bold mt-3">{{'PACS.WORKPLAN_PERIOD_SELECT_ROUTINE_WEEK'|translate}}</span>
                    <span class="text-sm">{{'PACS.WORKPLAN_PERIOD_SELECT_ROUTINE_WEEK_INFO'|translate}}</span>
                </div>
            </div>
            <div class="col-6">
                <div class="cursor-pointer hover-secondary p-3 d-flex flex-column align-items-center justify-content-center rnd-3"
                    (click)="onRoutineTypeSelected(1);">
                    <img src="./assets/images/pacs/pacs_period_days.png">
                    <span class="text-md text-bold mt-3">{{'PACS.WORKPLAN_PERIOD_SELECT_ROUTINE_DAYS'|translate}}</span>
                    <span class="text-sm">{{'PACS.WORKPLAN_PERIOD_SELECT_ROUTINE_DAYS_INFO'|translate}}</span>
                </div>
            </div>
        </div>
    </ng-template>
    <ng-template #daysTemplate>
        <ng-container *ngFor="let day of days; let dayIndex = index">
            <div class="row day-title-Container" [attr.collapsable]="day.selected">
                <div class="col-xl-12 py-2 day-title d-flex align-items-center">
                    <div class="pe-2 collapse-icon" (click)="dayCollapsed(day)">
                        <cds-icon shape="angle" direction="right" *ngIf="day.collapsed"></cds-icon>
                        <cds-icon shape="angle" direction="down" *ngIf="!day.collapsed"></cds-icon>
                    </div>
                    <div class="form-check custom-control-inline" *ngIf="!enableDayListUpdate">
                        <input type="checkbox" [id]="'checkday'+dayIndex" [(ngModel)]="day.selected"
                            class="form-check-input" (ngModelChange)="daySelectionChanged($event, day)">
                        <label class="form-check-label" [for]="'checkday'+dayIndex">{{day.title|translate}}</label>
                    </div>
                    <div *ngIf="enableDayListUpdate" (click)="onDayLabelClicked(day)">
                        <label class="me-1 cursor-pointer">{{day.title|translate}}<span *ngIf="day.subTitle"
                                class="text-sm text-black-50 ms-1">{{day.subTitle|translate}}</span></label>
                    </div>
                    <cds-icon shape="warning-standard" class="day-invalid-icon"
                        *ngIf="!day.isBreaksValid || !day.isHoursValid">
                    </cds-icon>
                    <div class="ms-auto">
                        <button class="btn btn-sm btn-outline-danger me-2" *ngIf="enableDayListUpdate"
                            [disabled]="days.length==1"
                            (click)="onRemoveDayClicked(day)">{{'BUTTON.REMOVE'|translate}}</button>
                        <button nz-dropdown [nzDropdownMenu]="menuCopy" class="btn btn-sm btn-outline-primary"
                            nzTooltipTrigger="click" nz-tooltip
                            nzTooltipTitle="{{'PACS.WORKPLAN_PERIOD_COPY_DAY_TOOLTIP'|translate}}"
                            [nzDisabled]="day.disableCopy" nzClickHide="false" [(nzVisible)]="day.visibleCopyDrop">
                            {{'BUTTON.COPY'|translate}}
                            <cds-icon shape="angle" direction="down"></cds-icon>
                        </button>
                        <nz-dropdown-menu #menuCopy="nzDropdownMenu">
                            <ul nz-menu>
                                <ng-container *ngFor="let copyDay of day.copyDays">
                                    <li nz-menu-item>
                                        <label nz-checkbox [(ngModel)]="copyDay.selected"
                                            (ngModelChange)="onCopyDaySelected(day)">{{copyDay.title|translate}}</label>
                                    </li>
                                </ng-container>
                                <div class="d-flex justify-content-center p-1">
                                    <button class="btn btn-sm btn-primary" [disabled]="!day.enableCopyButton"
                                        (click)="day.visibleCopyDrop=false;onCopyDaysClicked(day.index, day.copyDays)">{{'BUTTON.COPY'|translate}}</button>
                                </div>
                            </ul>
                        </nz-dropdown-menu>
                    </div>
                </div>
            </div>
            <div class="row day-settings-container" *ngIf="!day.collapsed" [attr.collapsable]="day.selected">
                <ng-container *ngIf="enableWorkingHours">
                    <div class="col-xl-12">
                        <span>
                            <strong *ngIf="workplanType==1">{{'PACS.WORKPLAN_PERIOD_REGULAR_HOURS'|translate}}</strong>
                            <strong
                                *ngIf="workplanType==2">{{'PACS.WORKPLAN_PERIOD_HALFFLEXIBLE_HOURS'|translate}}</strong>
                        </span>
                        <button class="btn btn-sm btn-outline-primary ms-2"
                            (click)="addWorkingHourClicked($event, day)">{{'BUTTON.ADD'|translate}}</button>
                        <div class="row mt-2" *ngIf="!day.isHoursValid">
                            <div class="col-xl-12">
                                <div class="alert alert-danger" role="alert">
                                    {{"PACS.DIRECTION_INVALID_WORKING_HOURS"|translate}}
                                </div>
                            </div>
                        </div>
                        <ng-container *ngFor="let workingHour of day.periodDay.workingHours; let first = first;">
                            <div class="row mt-2">
                                <div class="col-xl-3 col-lg-4 col-md-6 col-12">
                                    <div class="form-group">
                                        <label for="nameInput">{{'PACS.WORKPLAN_PERIOD_START_TIME' | translate}}</label>
                                        <div class="input-group input-group-sm">
                                            <button class="btn btn-sm btn-danger"
                                                (click)="removeWorkingHourClicked($event, day, workingHour)">{{'BUTTON.DELETE'|translate}}</button>
                                            <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                                                [(ngModel)]="workingHour.startDate" type="text"
                                                class="form-control bg-white" readonly owlinput
                                                (ngModelChange)="startDateChanged($event, day)" [owlDateTime]="dt1"
                                                [owlDateTimeTrigger]="dt1">
                                            <owl-date-time [firstDayOfWeek]="1" #dt1 [pickerType]="'timer'">
                                            </owl-date-time>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-xl-3 col-lg-4 col-md-6 col-12">
                                    <div class="form-group">
                                        <label for="nameInput">{{'PACS.WORKPLAN_PERIOD_END_TIME' | translate}}</label>
                                        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                                            [(ngModel)]="workingHour.endDate" type="text"
                                            class="form-control form-control-sm bg-white" readonly owlinput
                                            (ngModelChange)="endDateChanged($event, day)" [owlDateTime]="dt2"
                                            [owlDateTimeTrigger]="dt2">
                                        <owl-date-time [firstDayOfWeek]="1" #dt2 [pickerType]="'timer'"></owl-date-time>
                                    </div>
                                </div>
                            </div>
                        </ng-container>
                    </div>
                </ng-container>
                <div class="col-xl-12 pt-4 pb-3">
                    <!-- <pre>{{day.periodDay|json}}</pre> -->
                    <armon-pacs-workplan-breaks [(claimBreak)]="day.periodDay.claimBreak"
                        [(fixedBreaks)]="day.periodDay.fixedBreaks" [workingHours]="day.periodDay.workingHours"
                        [(extraWorkBreaks)]="day.periodDay.extraWorkBreaks"
                        (validationChanged)="breaksValidationChanged($event, day)">
                    </armon-pacs-workplan-breaks>
                </div>
            </div>
        </ng-container>
        <div class="row" *ngIf="enableDayListUpdate">
            <div class="col-12 d-flex justify-content-center">
                <button class="btn btn-sm btn-success mt-3" (click)="onAddDayClicked($event)">
                    <cds-icon shape="plus-circle" solid class="cds-icon-18 me-1"></cds-icon>
                    {{'PACS.WORKPLAN_PERIOD_ADD_DAY'|translate}}
                </button>
            </div>
        </div>
    </ng-template>
</ng-container>`;var je=`.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}:host .day-title-Container,:host .day-title-Container[collapsable=true]{font-weight:500;background-color:#f7f7f7;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;margin:6px 0;border-left:2px solid #aaa}:host .day-title-Container .collapse-icon{cursor:pointer}:host .day-title-Container .day-invalid-icon{color:#c82602}:host .day-title-Container[collapsable=true]{background-color:#eff6e9;border-left-color:#62a325}:host .day-settings-container,:host .day-settings-container[collapsable=true]{background-color:#9999990d;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;margin:0}:host .day-settings-container[collapsable=true]{background-color:#fcfdfb;border-left:2px solid #c0daa8;margin-bottom:12px}:host .deleteIcon{color:#c82602;cursor:pointer;text-align:right}
`;var He=`<div *ngIf="visibleComponent">
    <div class="row">
        <div class="col-xl-12">
            <span class="me-2" *ngIf="showTitle">
                <strong>{{'PACS.WORKPLAN_PERIOD_DAYS_BREAKS'|translate}}</strong>
            </span>
            <button nz-dropdown [nzDropdownMenu]="menuAdd" class="btn btn-sm btn-outline-primary">
                {{'PACS.ADD_WORKPLAN_BREAK'|translate}}
                <cds-icon shape="angle" direction="down"></cds-icon>
            </button>
            <nz-dropdown-menu #menuAdd="nzDropdownMenu">
                <ul nz-menu>
                    <li nz-menu-item (click)="addRequiredBreak($event)">
                        {{'PACS.ADD_WORKPLAN_BREAK_FIXED'|translate}}
                    </li>
                    <li nz-menu-item (click)="addClaimBreak($event)" [nzDisabled]="claimBreak">
                        {{'PACS.ADD_WORKPLAN_BREAK_CLAIM'|translate}}</li>
                    <li nz-menu-item (click)="addExtraBreak($event)">{{'PACS.ADD_WORKPLAN_BREAK_EXTRA'|translate}}
                    </li>
                </ul>
            </nz-dropdown-menu>
        </div>
    </div>
    <div class="row">
        <div class="col-12 mt-2" *ngIf="!isValid">
            <div class="alert alert-danger" role="alert">
                {{"PACS.DIRECTION_INVALID_BREAK_HOURS"|translate}}
            </div>
        </div>
        <div class="col-12 mt-2 mb-2" *ngFor="let requiredBreak of fixedBreaks">
            <div class="row break-row">
                <div class="col-xl-4 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_TYPE' | translate}}</label>
                        <div class="input-group input-group-sm">
                            <button class="btn btn-sm btn-danger"
                                (click)="removeRequiredBreak($event, requiredBreak)">{{'BUTTON.DELETE'|translate}}</button>
                            <select [(ngModel)]="requiredBreak.type" class="form-select">
                                <option *ngFor="let requiredBreakType of requiredBreakTypes"
                                    [ngValue]="requiredBreakType.value">{{requiredBreakType.i18nName
                                    | translate}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_PERIOD_START_TIME' | translate}}</label>
                        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                            [(ngModel)]="requiredBreak.startDate" type="text"
                            class="form-control form-control-sm bg-white" readonly owlinput
                            (ngModelChange)="startDateChanged($event, requiredBreak)"
                            [ngClass]="{'is-invalid': !requiredBreak.isValid}" [owlDateTime]="dtStartRequired"
                            [owlDateTimeTrigger]="dtStartRequired">
                        <owl-date-time [firstDayOfWeek]="1" #dtStartRequired [pickerType]="'timer'"></owl-date-time>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_PERIOD_END_TIME' | translate}}</label>
                        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                            [(ngModel)]="requiredBreak.endDate" type="text"
                            class="form-control form-control-sm bg-white" readonly owlinput
                            (ngModelChange)="endDateChanged($event, requiredBreak)"
                            [ngClass]="{'is-invalid': !requiredBreak.isValid}" [owlDateTime]="dtEndRequired"
                            [owlDateTimeTrigger]="dtEndRequired">
                        <owl-date-time [firstDayOfWeek]="1" #dtEndRequired [pickerType]="'timer'"></owl-date-time>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_CLAIM_BREAK_MINS' |
                            translate}}</label>
                        <div class="input-group input-group-sm">
                            <input type="number" min="1" max="360"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="requiredBreak.allowedMaxBreakDuration" class="form-control">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6">
                    <div class="form-group" title="{{'PACS.WORKPLAN_BREAK_AUTO_BELOW_MINS_INFO'|translate}}">
                        <label>{{'PACS.WORKPLAN_BREAK_AUTO_BELOW_MINS' |
                            translate}}</label>
                        <div class="input-group input-group-sm">
                            <input type="number" min="1" [attr.max]="requiredBreak.allowedMaxBreakDuration"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="requiredBreak.executeAutomaticallyBelowDuration" class="form-control">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xl-12 mt-2 mb-2" *ngIf="claimBreak">
            <div class="row break-row">
                <div class="col-xl-4 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_TYPE' | translate}}</label>
                        <div class="input-group input-group-sm">
                            <button class="btn btn-danger"
                            (click)="removeClaimBreak($event, claimBreak)">{{'BUTTON.DELETE'|translate}}</button>                           
                            <select [(ngModel)]="claimBreak.type" class="form-select">
                                <option *ngFor="let requiredClaimType of requiredClaimTypes"
                                    [ngValue]="requiredClaimType.value">{{requiredClaimType.i18nName
                                    | translate}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label for="workDurationInput">{{'PACS.WORKPLAN_BREAK_CLAIM_WORK_HOURS' | translate}}</label>
                        <div class="input-group input-group-sm">
                            <input id="workDurationInput" class="form-control" type="number" min="1" max="1200"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="claimBreak.workDuration">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label for="breakDurationInput">{{'PACS.WORKPLAN_BREAK_CLAIM_BREAK_MINS' | translate}}</label>
                        <div class="input-group input-group-sm">
                            <input id="breakDurationInput" class="form-control" type="number" min="1" max="360"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="claimBreak.breakDuration">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group" title="{{'PACS.WORKPLAN_BREAK_AUTO_BELOW_MINS_INFO'|translate}}">
                        <label for="claimExecuteAutomaticallyBelowDurationInput">{{'PACS.WORKPLAN_BREAK_AUTO_BELOW_MINS'
                            |
                            translate}}</label>
                        <div class="input-group input-group-sm">
                            <input id="claimExecuteAutomaticallyBelowDurationInput" type="number" min="1" max="360"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="claimBreak.executeAutomaticallyBelowDuration" class="form-control">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <!-- <div class="col-12 mt-2" *ngIf="!isValid">
            <div class="alert alert-danger" role="alert">
                {{"PACS.DIRECTION_INVALID_BREAK_HOURS"|translate}}
            </div>
        </div> -->
        <div class="col-12 mt-2 mb-2" *ngFor="let extraWorkBreak of extraWorkBreaks">
            <div class="row break-row">
                <div class="col-xl-4 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_TYPE' | translate}}</label>
                        <div class="input-group input-group-sm">
                            <button class="btn btn-sm btn-danger"
                                    (click)="removeExtraBreak($event, extraWorkBreak)">{{'BUTTON.DELETE'|translate}}</button>
                            <select [(ngModel)]="extraWorkBreak.type" class="form-select">
                                <option *ngFor="let requiredBreakType of requiredBreakTypes"
                                    [ngValue]="requiredBreakType.value">{{requiredBreakType.i18nName
                                    | translate}}</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_START' | translate}}</label>
                        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                            [(ngModel)]="extraWorkBreak.startDate" type="text"
                            class="form-control form-control-sm bg-white" readonly owlinput
                            (ngModelChange)="startDateChanged($event, extraWorkBreak)"
                            [ngClass]="{'is-invalid': !extraWorkBreak.isValid}" [owlDateTime]="dtStartExtra"
                            [owlDateTimeTrigger]="dtStartExtra">
                        <owl-date-time [firstDayOfWeek]="1" #dtStartExtra [pickerType]="'timer'"></owl-date-time>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_END' | translate}}</label>
                        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}"
                            [(ngModel)]="extraWorkBreak.endDate" type="text"
                            class="form-control form-control-sm bg-white" readonly owlinput
                            (ngModelChange)="endDateChanged($event, extraWorkBreak)"
                            [ngClass]="{'is-invalid': !extraWorkBreak.isValid}" [owlDateTime]="dtEndExtra"
                            [owlDateTimeTrigger]="dtEndExtra">
                        <owl-date-time [firstDayOfWeek]="1" #dtEndExtra [pickerType]="'timer'"></owl-date-time>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6 col-12">
                    <div class="form-group">
                        <label>{{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_MINS' |
                            translate}}</label>
                        <div class="input-group input-group-sm">
                            <input type="number" min="1" max="360"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="extraWorkBreak.breakDuration" class="form-control">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
                <div class="col-xl-2 col-lg-6">
                    <div class="form-group" title="{{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_MIN_DURATION'|translate}}">
                        <label>{{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_MIN_DURATION' |
                            translate}}</label>
                        <div class="input-group input-group-sm">
                            <input type="number" min="1" [attr.max]="extraWorkBreak.breakDuration"
                                onkeypress="return event.charCode >= 48 && event.charCode <= 57"
                                [(ngModel)]="extraWorkBreak.minWorkDuration" class="form-control">
                            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>`;var Ve=`.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}:host .deleteIcon{color:#c82602;cursor:pointer;text-align:right}:host .break-row{background-color:#fbfbfb;margin:0;padding:6px 0;border-radius:5px;border:1px solid #d3d3d3}
`;var Y=[{value:A.Launch,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_LAUNCH"},{value:A.Dinner,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_DINNER"},{value:A.Free,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_FREE"},{value:A.Custom,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_CUSTOM"}];var J=[{value:L.Launch,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_LAUNCH"},{value:L.Dinner,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_DINNER"},{value:L.Free,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_FREE"},{value:L.Custom,i18nName:"PACS.WORKPLAN_BREAK_REQ_TYPE_CUSTOM"}];var bt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},X=class{interactionService;showTitle=!0;fixedBreaks;claimBreak;extraWorkBreaks;workingHours;claimBreakChange=new f;validationChanged=new f;ngOnChanges(e){e.workingHours&&!e.workingHours.isFirstChange()&&this.validateBreaks()}requiredBreakTypes=Y;requiredClaimTypes=J;visibleComponent=!0;isValid=!0;constructor(e){this.interactionService=e}ngOnInit(){this.visibleComponent=!0}ngOnDestroy(){}validateBreaks(){let e=!0;this.fixedBreaks.forEach((t,o)=>{if(t.type!==A.Dinner){if(this.workingHours&&this.workingHours.length>0){let a=!1;this.workingHours.forEach(i=>{this.isOverlapBreakInRange(t,i.startDate,i.endDate)&&(a=!0)}),t.isValid=a}else t.isValid=!0;t.isValid&&this.fixedBreaks.forEach((a,i)=>{o!=i&&(t.isValid=this.isOverlapBreakInRange(t,a.startDate,a.endDate,!0))})}else t.type===A.Dinner&&(t.isValid=!0);t.isValid==!1&&(e=!1)}),this.extraWorkBreaks.forEach((t,o)=>{t.isValid=!0}),this.extraWorkBreaks.forEach((t,o)=>{this.extraWorkBreaks.forEach((a,i)=>{o!=i&&t.isValid&&(t.isValid=this.isOverlapBreakInRange(t,a.startDate,a.endDate,!0),t.isValid==!1&&(a.isValid=!1))}),t.isValid==!1&&(e=!1)}),this.isValid=e,this.validationChanged.emit(e)}isOverlapBreakInRange(e,t,o,a=!1){let i,r,s,S,ce=!1;s=t.getTime(),t.getTime()>o.getTime()?(ce=!0,S=l.fromJSDate(o).plus({days:1}).toJSDate().getTime()):S=o.getTime(),i=e.startDate.getTime(),ce&&e.startDate.getTime()<e.endDate.getTime()?(i=l.fromJSDate(e.startDate).plus({days:1}).toJSDate().getTime(),r=l.fromJSDate(e.endDate).plus({days:1}).toJSDate().getTime()):e.startDate.getTime()>e.endDate.getTime()?(i=e.startDate.getTime(),r=l.fromJSDate(e.endDate).plus({days:1}).toJSDate().getTime()):(i=e.startDate.getTime(),r=e.endDate.getTime());let I=!0;return a?(i>=s&&i<=S||r<=S&&r>=s||r>S&&i<s)&&(I=!1):(i<s||r>S)&&(I=!1),I}addRequiredBreak(e){let t;this.workingHours&&this.workingHours.length>0?t=re.getEmptyModel(this.workingHours[0].startDate,this.workingHours[0].endDate):t=re.getEmptyModel(l.local().startOf("day").plus({hours:12}).toJSDate(),l.local().startOf("day").plus({hours:14}).toJSDate()),this.fixedBreaks.push(t),this.validateBreaks()}addClaimBreak(e){this.claimBreak||(this.claimBreak=we.getEmptyModel(),this.claimBreakChange.emit(this.claimBreak),this.validateBreaks())}addExtraBreak(e){let t;this.workingHours&&this.workingHours.length>0?t=ne.getEmptyModel(this.workingHours[0].startDate,this.workingHours[0].endDate):t=ne.getEmptyModel(l.local().startOf("day").plus({hours:12}).toJSDate(),l.local().startOf("day").plus({hours:14}).toJSDate()),this.extraWorkBreaks.push(t),this.validateBreaks()}removeRequiredBreak(e,t){let o=this.fixedBreaks.findIndex(a=>a===t);this.fixedBreaks.splice(o,1),this.validateBreaks()}removeClaimBreak(e,t){this.claimBreak=null,this.claimBreakChange.emit(this.claimBreak),this.validateBreaks()}removeExtraBreak(e,t){let o=this.extraWorkBreaks.findIndex(a=>a===t);this.extraWorkBreaks.splice(o,1),this.validateBreaks()}startDateChanged(e,t){t.startTime=l.fromJSDate(t.startDate).toFormat("HHmm"),this.validateBreaks()}endDateChanged(e,t){t.endTime=l.fromJSDate(t.endDate).toFormat("HHmm"),this.validateBreaks()}static ctorParameters=()=>[{type:g}];static propDecorators={showTitle:[{type:d}],fixedBreaks:[{type:d}],claimBreak:[{type:d}],extraWorkBreaks:[{type:d}],workingHours:[{type:d}],claimBreakChange:[{type:u}],validationChanged:[{type:u}]}};X=bt([c({selector:"armon-pacs-workplan-breaks",template:He,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,F,z,K,E,v,_,he,m],styles:[Ve]})],X);var _t=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},D=class{interactionService;translate;periodDays;workplanType;routineType;periodStartDateTime;periodDaysUpdated=new f;validationChanged=new f;routineTypeChange=new f;days=[];hasRoutineType;enableDayListUpdate=!1;enableWorkingHours=!1;_translated;visibleComponent=!0;isValid=!0;now=l.local().startOf("day").toJSDate();constructor(e,t){this.interactionService=e,this.translate=t}ngOnInit(){switch(this.workplanType){case h.Regular:this.enableWorkingHours=!0;break;case h.HalfFlexible:this.enableWorkingHours=!0;break;case h.FullFlexible:break;case h.Shift:break}this.translate.get(["USER_PERMISSION_UNIT_TYPE_DAY"]).subscribe(e=>{this._translated=e,this.routineType?this.createRoutineTypeDays():this.hasRoutineType=!1,this.visibleComponent=!0})}ngOnDestroy(){}ngOnChanges(e){e.periodStartDateTime&&!e.periodStartDateTime.isFirstChange()&&this.updateDaysAfterListPopulated()}createRoutineTypeDays(){switch(this.routineType){case k.Day:if(this.enableDayListUpdate=!0,this.periodDays&&this.periodDays.length>0)for(let e=1;e<=this.periodDays.length;e++)this.addEmptyDay(e);else for(let e=1;e<=3;e++)this.addEmptyDay(e);break;case k.Week:this.enableDayListUpdate=!1;for(let e=1;e<=7;e++)this.addEmptyDay(e);break}this.hasRoutineType=!0,this.updateDaysAfterListPopulated(),this.setCopyDays()}addEmptyDay(e){let t=new de,o,a=this.periodDays.findIndex(i=>i.index===e);switch(a>-1?(o=this.periodDays[a],t.selected=!0):o=se.getEmptyModel(this.workplanType),o.index=e,t.periodDay=o,t.index=e-1,this.routineType){case k.Day:t.selected=!0,this.addDayToPeriodDays(t);break;case k.Week:t.title=W.find(i=>i.type==e).description;break}this.days.push(t)}addDayToPeriodDays(e){let t=this.periodDays.findIndex(o=>o.index===e.periodDay.index);t>-1?this.periodDays.splice(t,1,e.periodDay):this.periodDays.push(e.periodDay),this.periodDaysUpdated.emit()}removeDayFromPeriodDays(e){let t=this.periodDays.findIndex(o=>o.index===e.periodDay.index);this.periodDays.splice(t,1),this.periodDaysUpdated.emit()}setCopyDays(){for(let e of this.days){e.copyDays=[];for(let t of this.days)t.index!=e.index&&e.copyDays.push({index:t.index,title:t.title,selected:!1});e.disableCopy=e.copyDays.length==0,e.enableCopyButton=!1}}updateDaysAfterListPopulated(){this.days.forEach((e,t)=>{e.title=this.getDayTitle(t+1),e.subTitle=this.getDaySubTitle(t+1)})}daySelectionChanged(e,t){e?(this.addDayToPeriodDays(t),t.collapsed=!1):(this.removeDayFromPeriodDays(t),t.collapsed=!0),this.setCopyDays(),this.validate()}dayCollapsed(e){switch(e.collapsed=!e.collapsed,this.routineType){case k.Day:break;case k.Week:e.selected==!1&&e.collapsed==!1&&(e.selected=!0,this.daySelectionChanged(e.selected,e));break}}onCopyDaySelected(e){e.enableCopyButton=e.copyDays.findIndex(t=>t.selected==!0)>-1}onCopyDaysClicked(e,t){t.forEach(o=>{o.selected&&this.copyDay(o.index,e)})}copyDay(e,t){let o=this.days[e].periodDay.index;this.days[e].periodDay=se.getCopyModel(this.days[t].periodDay),this.days[e].periodDay.index=o,this.days[e].selected=this.days[t].selected,this.days[e].isBreaksValid=this.days[t].isBreaksValid,this.days[e].collapsed=!this.days[e].selected,this.addDayToPeriodDays(this.days[e]),this.validate(),this.setCopyDays()}normalizeToNow(e){return l.fromJSDate(this.now).set({hour:l.fromJSDate(e).hour,minute:l.fromJSDate(e).minute,second:0}).toJSDate()}startDateChanged(e,t){this.validateWorkingHours(t)}endDateChanged(e,t){this.validateWorkingHours(t)}validateWorkingHours(e){e.periodDay.workingHours.forEach(a=>{a.startDate=this.normalizeToNow(a.startDate),a.endDate=this.normalizeToNow(a.endDate)}),e.periodDay.workingHours.forEach(a=>{a.startDate=this.normalizeToNow(a.startDate),a.endDate=this.normalizeToNow(a.endDate)});let t=!1;for(let a=0;a<e.periodDay.workingHours.length;a++)if(t==!1&&a!=e.periodDay.workingHours.length-1){var o=ae.fromDateTimes(l.fromJSDate(e.periodDay.workingHours[a].startDate),l.fromJSDate(e.periodDay.workingHours[a].endDate));for(let i=a+1;i<e.periodDay.workingHours.length;i++)t=o.overlaps(ae.fromDateTimes(l.fromJSDate(e.periodDay.workingHours[i].startDate),l.fromJSDate(e.periodDay.workingHours[i].endDate)))}e.isHoursValid=!t,this.validate()}validate(){this.isValid=this.days.findIndex(e=>e.isBreaksValid===!1&&e.selected)==-1&&this.days.findIndex(e=>e.isHoursValid===!1&&e.selected)==-1,this.validationChanged.emit(this.isValid)}breaksValidationChanged(e,t){t.isBreaksValid=e,this.validate()}addWorkingHourClicked(e,t){let o=Ae.getEmptyModel();t.periodDay.workingHours.push(o),this.validateWorkingHours(t)}removeWorkingHourClicked(e,t,o){let a=t.periodDay.workingHours.indexOf(o,0);a>-1&&t.periodDay.workingHours.splice(a,1),this.validateWorkingHours(t)}onRoutineTypeSelected(e){this.routineType=e,this.routineTypeChange.emit(this.routineType),this.createRoutineTypeDays()}getDayTitle(e){switch(this.routineType){case k.Day:return this._translated.USER_PERMISSION_UNIT_TYPE_DAY+" "+e;case k.Week:return W.find(t=>t.type==e).description}}getDaySubTitle(e){switch(this.routineType){case k.Day:if(this.periodStartDateTime){let t=[];for(let o=0;o<3;o++)t.push(l.fromJSDate(this.periodStartDateTime).plus({days:o*this.days.length+(e-1)}).toFormat("d MMMM"));return"( "+t.join(", ")+" ... )"}else return null;case k.Week:return null}}updateDaysList(){this.periodDays.splice(0,this.periodDays.length),this.days.forEach((e,t)=>{e.index=t,e.periodDay.index=t+1,this.periodDays.push(e.periodDay)}),this.periodDaysUpdated.emit(),this.updateDaysAfterListPopulated(),this.setCopyDays()}onAddDayClicked(e){this.addEmptyDay(this.days.length+1),this.updateDaysAfterListPopulated(),this.setCopyDays()}onRemoveDayClicked(e){let t=this.days.findIndex(o=>o.index===e.index);this.days.splice(t,1),this.updateDaysList()}onDayLabelClicked(e){e.collapsed=!e.collapsed}static ctorParameters=()=>[{type:g},{type:O}];static propDecorators={periodDays:[{type:d}],workplanType:[{type:d}],routineType:[{type:d}],periodStartDateTime:[{type:d}],periodDaysUpdated:[{type:u}],validationChanged:[{type:u}],routineTypeChange:[{type:u}]}};D=_t([c({selector:"armon-pacs-workplan-days",template:Fe,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,E,v,F,j,z,K,Oe,_,X,m],styles:[je]})],D);var de=class{index;periodDay;selected=!1;title;subTitle;collapsed=!0;disableCopy=!0;visibleCopyDrop=!1;enableCopyButton=!1;copyDays;isBreaksValid=!0;isHoursValid=!0};var Ge=`<div *ngIf="visibleComponent" class="d-flex flex-column">\r
    <div class="d-flex align-items-center">\r
        <div class="form-check">\r
            <input class="form-check-input" id="offsetEnabled" type="checkbox" [(ngModel)]="enabledOffset"\r
                name="offsetEnabled" (ngModelChange)="onEnabledOffsetChanged($event)">\r
            <label class="form-check-label" for="offsetEnabled">\r
                <span>{{'PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET' | translate}}</span>\r
            </label>\r
        </div>\r
        <span class="text-sm ms-auto"><span *ngIf="selectedOffset<0">-\r
            </span>{{selectedOffset|minuteFormatter:''}}</span>\r
    </div>\r
    <div class="d-flex flex-column">\r
        <input type="range" class="form-range" min="-720" max="720" step="5" [(ngModel)]="selectedOffset" [disabled]="!enabledOffset"\r
            (ngModelChange)="onSelectedOffsetChanged($event)">\r
        <span class="text-xs text-italic">{{selectedOffsetInfo}}</span>\r
    </div>\r
</div>`;var qe="";var Pt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},T=class{translate;offset;offsetChange=new f;visibleComponent=!0;enabledOffset=!1;selectedOffset=0;selectedOffsetInfo;constructor(e){this.translate=e}ngOnInit(){_e(this.offset)||be(this.offset)?(this.enabledOffset=!1,this.selectedOffset=0):(this.enabledOffset=!0,this.selectedOffset=this.offset),this.setSelectedOffsetInfo(),this.visibleComponent=!0}ngOnDestroy(){}setSelectedOffsetInfo(){this.translate.get(["PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET_PERIOD_INFO"],{dayStart:l.local().startOf("day").plus({minutes:this.selectedOffset||0}).toLocaleString(l.TIME_24_SIMPLE),dayEnd:l.local().startOf("day").plus({minutes:this.selectedOffset||0}).plus({hours:24}).toLocaleString(l.TIME_24_SIMPLE)}).subscribe(e=>{this.selectedOffsetInfo=e["PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET_PERIOD_INFO"]})}updateOffset(){this.offsetChange.emit(this.enabledOffset?this.selectedOffset:void 0)}onSelectedOffsetChanged(e){this.updateOffset(),this.setSelectedOffsetInfo()}onEnabledOffsetChanged(e){this.updateOffset(),this.setSelectedOffsetInfo()}static ctorParameters=()=>[{type:O}];static propDecorators={offset:[{type:d}],offsetChange:[{type:u}]}};T=Pt([c({selector:"armon-pacs-workplan-period-offset",template:Ge,standalone:!0,imports:[p,v,m,U],styles:[qe]})],T);var xt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},Q=class extends x{pacsService;interactionService;period=null;weekValidation=!0;constructor(e,t){super(e,t),this.pacsService=e,this.interactionService=t,this.workplanType=h.Shift}ngOnInit(){this.period==null?(this.period=q.getEmptyModel(this.workplan.id),this.period.periodStartDateTime=l.local().startOf("day").toJSDate(),this.editMode=!1):(this.period=q.getCopyModel(this.period),this.editMode=!0),this.visibleComponent=!0,this.validateSaveButton()}validateSaveButton(){this.disableSaveButton=this.period.periodStartDateTime==null||this.period.workDuration==0||this.period.restDuration==0||this.weekValidation==!1}saveClicked(e){var t=q.getRequestModel(this.period);this.pacsService.upsertShiftPeriod(t).subscribe(o=>{this.editMode?this.periodEditCompleted.emit():this.periodAddCompleted.emit(),this.interactionService.showMessage("PACS.MESSAGE_SAVED_PERIOD",null,P.Success)},o=>{o&&o.error&&o.error.message&&this.interactionService.showDialog("PACS.ADD_WORKPLAN_TYPE",o.error.message,null,null,!1,"BUTTON.OK","",!1,()=>{})})}periodStartDateChanged(e){this.validateSaveButton()}periodDaysChanged(e){this.validateSaveButton()}weekValidationChanged(e){this.weekValidation=e,this.validateSaveButton()}static ctorParameters=()=>[{type:y},{type:g}];static propDecorators={period:[{type:d}]}};Q=xt([c({selector:"armon-pacs-period-shift-upsert",template:Be,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,v,_,T,D,R,m],styles:[Ue]})],Q);var $e=`<div class="componentContainer" *ngIf="visibleComponent">
  <div class="row">
    <div class="col-12">
      <span class="text-lg">{{(editMode ? 'PACS.EDIT_WORKPLAN_PERIOD' : 'PACS.ADD_WORKPLAN_PERIOD' ) |
        translate}}</span>
    </div>
  </div>
  <div class="row">
    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
      <div class="form-group">
        <label for="periodStartDateTimeInput" class="required">{{'PACS.WORKPLAN_PERIOD_START_DATE' | translate}}</label>
        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}" id="periodStartDateTimeInput"
          [(ngModel)]="period.periodStartDateTime" type="text" class="form-control form-control-sm bg-white" readonly
          owlinput (ngModelChange)="periodStartDateChanged($event)" [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1">
        <owl-date-time [firstDayOfWeek]="1" #dt1></owl-date-time>
      </div>
    </div>
    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
      <div class="form-group">
        <label for="weeklyExpectedWorkDurationInput" class="required">{{'PACS.WORKPLAN_PERIOD_FLEXIBLE_DURATION' |
          translate}}</label>
        <div class="input-group input-group-sm">
          <input id="weeklyExpectedWorkDurationInput" class="form-control" type="number" min="0" max="80"
            onkeypress="return event.charCode >= 48 && event.charCode <= 57"
            [(ngModel)]="period.weeklyExpectedWorkDuration" (ngModelChange)="onWorkDurationChanged($event)">
            <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_HOUR'|translate}}</span>
        </div>
      </div>
    </div>
    <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12">
      <armon-pacs-workplan-period-offset [(offset)]="period.offset"></armon-pacs-workplan-period-offset>
    </div>
  </div>
  <div class="row">
    <div class="col-12 pt-3">
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_DAYS_TTILE' | translate}}</div>
      <armon-pacs-workplan-days [(periodDays)]="period.dayBreakItems" [workplanType]="workplanType"
        [(routineType)]="period.routineType" [periodStartDateTime]="period.periodStartDateTime"
        (periodDaysUpdated)="periodDaysChanged($event)" (validationChanged)="weekValidationChanged($event)">
      </armon-pacs-workplan-days>
    </div>
  </div>
  <div class="row">
    <div class="col-12 pt-3 d-flex justify-content-end">
      <button class="btn btn-outline-primary me-2" (click)="cancelClicked($event)">
        {{'BUTTON.CANCEL' | translate}}
      </button>
      <button class="btn btn-primary" (click)="saveClicked($event)" [disabled]="disableSaveButton">
        {{'BUTTON.SAVE' | translate}}
      </button>
    </div>
  </div>
</div>`;var Ye=`.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}:host .componentContainer{padding:18px;background-color:#fff;-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem}:host .form-layout{width:100%!important;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:start;-moz-box-pack:start;-webkit-flex-pack:start;-ms-flex-pack:start;-moz-justify-content:flex-start;-webkit-justify-content:flex-start;justify-content:flex-start;-webkit-flex-wrap:wrap;-moz-flex-wrap:wrap;flex-wrap:wrap;padding-top:6px;padding-bottom:6px}:host .form-layout>label:not(.custom-item){width:auto;margin-right:12px}@media screen and (max-width: 576px){:host .form-layout>label:not(.custom-item){width:100%;margin-right:0;margin-bottom:0}}:host .form-layout>label[unit]{margin-left:3px}@media screen and (max-width: 576px){:host .form-layout>label[unit]{flex:0}}:host .form-layout input{flex:1}:host .form-layout .select{flex:1}:host .form-layout textarea{flex:1;margin-right:0}:host .form-layout .form-item{flex:1}:host .form-layout .checkbox{flex:1}:host .form-layout .custom-item{flex:1}:host .form-layout .radio-inline-container{position:relative}:host .form-layout .form-button{margin:0 0 0 12px}:host .form-layout label{font-size:.5rem!important;font-weight:700!important}:host .sectionTitle{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666}:host .required:after{content:"*";font-size:1.1em;color:#c92100;margin-left:6px}
`;var Ot=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},Z=class extends x{pacsService;interactionService;period=null;weekValidation=!0;constructor(e,t){super(e,t),this.pacsService=e,this.interactionService=t,this.workplanType=h.FullFlexible}ngOnInit(){this.period==null?(this.period=G.getEmptyModel(this.workplan.id),this.period.periodStartDateTime=l.local().startOf("day").toJSDate(),this.editMode=!1):(this.period=G.getCopyModel(this.period),this.editMode=!0),this.visibleComponent=!0,this.validateSaveButton()}validateSaveButton(){this.disableSaveButton=this.period.periodStartDateTime==null||this.period.weeklyExpectedWorkDuration==null||this.period.weeklyExpectedWorkDuration==null||this.period.weeklyExpectedWorkDuration<0||this.weekValidation==!1}saveClicked(e){var t=G.getRequestModel(this.period);this.pacsService.upsertFullFlexiblePeriod(t).subscribe(o=>{this.editMode?this.periodEditCompleted.emit():this.periodAddCompleted.emit(),this.interactionService.showMessage("PACS.MESSAGE_SAVED_PERIOD",null,P.Success)},o=>{o&&o.error&&o.error.message&&this.interactionService.showDialog("PACS.ADD_WORKPLAN_TYPE",o.error.message,null,null,!1,"BUTTON.OK","",!1,()=>{})})}periodStartDateChanged(e){this.validateSaveButton()}periodDaysChanged(e){this.validateSaveButton()}onWorkDurationChanged(e){this.validateSaveButton()}weekValidationChanged(e){this.weekValidation=e,this.validateSaveButton()}static ctorParameters=()=>[{type:y},{type:g}];static propDecorators={period:[{type:d}]}};Z=Ot([c({selector:"armon-pacs-period-fullflexible-upsert",template:$e,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,v,_,T,D,m],styles:[Ye]})],Z);var Je=`<div class="componentContainer" *ngIf="visibleComponent">
  <div class="row">
    <div class="col-12">
      <span class="text-lg">{{(editMode ? 'PACS.EDIT_WORKPLAN_PERIOD' : 'PACS.ADD_WORKPLAN_PERIOD' ) |
        translate}}</span>
    </div>
  </div>
  <div class="row mt-3">
    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
      <div class="form-group">
        <label for="periodStartDateTimeInput" class="required">{{'PACS.WORKPLAN_PERIOD_START_DATE' | translate}}</label>
        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}" id="periodStartDateTimeInput"
          [(ngModel)]="period.periodStartDateTime" type="text" class="form-control form-control-sm bg-white" readonly
          owlinput (ngModelChange)="periodStartDateChanged($event)" [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1">
        <owl-date-time [firstDayOfWeek]="1" #dt1></owl-date-time>
      </div>
    </div>
    <div class="col-xl-4 col-lg-4 col-md-6 col-sm-12">
      <div class="form-group">
        <label for="weeklyExpectedWorkDurationInput" class="required">{{'PACS.WORKPLAN_PERIOD_FLEXIBLE_DURATION' |
          translate}}</label>
        <div class="input-group input-group-sm">
          <input id="weeklyExpectedWorkDurationInput" class="form-control" type="number" min="0" max="80"
            onkeypress="return event.charCode >= 48 && event.charCode <= 57"
            [(ngModel)]="period.weeklyExpectedWorkDuration" (ngModelChange)="onWorkDurationChanged($event)">
          <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_HOUR'|translate}}</span>
        </div>
      </div>
    </div>
    <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12">
      <armon-pacs-workplan-period-offset [(offset)]="period.offset"></armon-pacs-workplan-period-offset>
    </div>
  </div>
  <div class="row">
    <div class="col-12 pt-3">
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_DAYS_TTILE' | translate}}</div>
      <armon-pacs-workplan-days [(periodDays)]="period.dayItems" [workplanType]="workplanType"
        [(routineType)]="period.routineType" [periodStartDateTime]="period.periodStartDateTime"
        (periodDaysUpdated)="periodDaysChanged($event)" (validationChanged)="weekValidationChanged($event)">
      </armon-pacs-workplan-days>
    </div>
  </div>
  <div class="row">
    <div class="col-12 pt-123">
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_TOLERANCES_TITLE' | translate}}</div>
      <armon-pacs-workplan-tolerances [(tolerances)]="period.tolerances"></armon-pacs-workplan-tolerances>
    </div>
  </div>
  <div class="row">
    <div class="col-12 pt-3 d-flex justify-content-end">
      <button class="btn btn-outline-primary me-2" (click)="cancelClicked($event)">
        {{'BUTTON.CANCEL' | translate}}
      </button>
      <button class="btn btn-primary" (click)="saveClicked($event)" [disabled]="disableSaveButton">
        {{'BUTTON.SAVE' | translate}}
      </button>
    </div>
  </div>
</div>`;var Xe=`.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}:host .componentContainer{padding:18px;background-color:#fff;-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem}:host .sectionTitle{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666}
`;var Rt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},ee=class extends x{pacsService;interactionService;period=null;weekValidation=!0;constructor(e,t){super(e,t),this.pacsService=e,this.interactionService=t,this.workplanType=h.HalfFlexible}ngOnInit(){this.period==null?(this.period=V.getEmptyModel(this.workplan.id),this.period.periodStartDateTime=l.local().startOf("day").toJSDate(),this.editMode=!1):(this.period=V.getCopyModel(this.period),this.editMode=!0),this.visibleComponent=!0,this.validateSaveButton()}validateSaveButton(){this.disableSaveButton=this.period.periodStartDateTime==null||this.period.dayItems.length==0||this.period.weeklyExpectedWorkDuration==null||this.period.weeklyExpectedWorkDuration==null||this.period.weeklyExpectedWorkDuration<0||this.weekValidation==!1}saveClicked(e){var t=V.getRequestModel(this.period);this.pacsService.upsertHalfFlexiblePeriod(t).subscribe(o=>{this.editMode?this.periodEditCompleted.emit():this.periodAddCompleted.emit(),this.interactionService.showMessage("PACS.MESSAGE_SAVED_PERIOD",null,P.Success)},o=>{o&&o.error&&o.error.message&&this.interactionService.showDialog("PACS.ADD_WORKPLAN_TYPE",o.error.message,null,null,!1,"BUTTON.OK","",!1,()=>{})})}periodStartDateChanged(e){this.validateSaveButton()}periodDaysChanged(e){this.validateSaveButton()}onWorkDurationChanged(e){this.validateSaveButton()}weekValidationChanged(e){this.weekValidation=e,this.validateSaveButton()}static ctorParameters=()=>[{type:y},{type:g}];static propDecorators={period:[{type:d}]}};ee=Rt([c({selector:"armon-pacs-period-halfflexible-upsert",template:Je,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,v,_,T,D,R,m],styles:[Xe]})],ee);var Qe=`<div class="componentContainer" *ngIf="visibleComponent">\r
  <div class="row">\r
    <div class="col-12">\r
      <span class="text-lg">{{(editMode ? 'PACS.EDIT_WORKPLAN_PERIOD' : 'PACS.ADD_WORKPLAN_PERIOD' ) |\r
        translate}}</span>\r
    </div>\r
  </div>\r
  <div class="row justify-content-between mt-3">\r
    <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">\r
      <div class="form-group">\r
        <label for="periodStartDateTimeInput" class="required">{{'PACS.WORKPLAN_PERIOD_START_DATE' | translate}}</label>\r
        <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}" id="periodStartDateTimeInput"\r
          class="form-control form-control-sm bg-white" [(ngModel)]="period.periodStartDateTime" type="text" readonly\r
          owlinput (ngModelChange)="periodStartDateChanged($event)" [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1">\r
        <owl-date-time [firstDayOfWeek]="1" #dt1></owl-date-time>\r
      </div>\r
    </div>\r
    <div class="col-xl-4 col-lg-6 col-md-6 col-sm-12">\r
      <armon-pacs-workplan-period-offset [(offset)]="period.offset"></armon-pacs-workplan-period-offset>\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3">\r
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_DAYS_TTILE' | translate}}</div>\r
      <armon-pacs-workplan-days [(periodDays)]="period.dayItems" [workplanType]="workplanType"\r
        [(routineType)]="period.routineType" [periodStartDateTime]="period.periodStartDateTime"\r
        (periodDaysUpdated)="periodDaysChanged($event)" (validationChanged)="weekValidationChanged($event)">\r
      </armon-pacs-workplan-days>\r
      <!-- <pre>{{period.dayItems|json}}</pre> -->\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3">\r
      <div class="sectionTitle">{{'PACS.WORKPLAN_PERIOD_TOLERANCES_TITLE' | translate}}</div>\r
      <armon-pacs-workplan-tolerances [(tolerances)]="period.tolerances"></armon-pacs-workplan-tolerances>\r
    </div>\r
  </div>\r
  <div class="row">\r
    <div class="col-12 pt-3 d-flex justify-content-end">\r
      <button class="btn btn-outline-primary me-2" (click)="cancelClicked($event)">\r
        {{'BUTTON.CANCEL' | translate}}\r
      </button>\r
      <button class="btn btn-primary" (click)="saveClicked($event)" [disabled]="disableSaveButton">\r
        {{'BUTTON.SAVE' | translate}}\r
      </button>\r
    </div>\r
  </div>\r
</div>`;var Ze=`.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}:host .componentContainer{padding:18px;background-color:#fff;-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem}:host .sectionTitle{width:100%;padding:6px;border-bottom:solid 1px rgba(102,102,102,.2);color:#666}
`;var Nt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},te=class extends x{pacsService;interactionService;period=null;weekValidation=!0;constructor(e,t){super(e,t),this.pacsService=e,this.interactionService=t,this.workplanType=h.Regular}ngOnInit(){this.period==null?(this.period=H.getEmptyModel(this.workplan.id),this.period.periodStartDateTime=l.local().startOf("day").toJSDate(),this.editMode=!1):(this.period=H.getCopyModel(this.period),this.editMode=!0),this.visibleComponent=!0,this.validateSaveButton()}validateSaveButton(){this.disableSaveButton=this.period.periodStartDateTime==null||this.period.dayItems.length==0||this.weekValidation==!1}saveClicked(e){var t=H.getRequestModel(this.period);this.pacsService.upsertRegularPeriod(t).subscribe(o=>{this.editMode?this.periodEditCompleted.emit():this.periodAddCompleted.emit(),this.interactionService.showMessage("PACS.MESSAGE_SAVED_PERIOD",null,P.Success)},o=>{o&&o.error&&o.error.message&&this.interactionService.showDialog("PACS.ADD_WORKPLAN_TYPE",o.error.message,null,null,!1,"BUTTON.OK","",!1,()=>{})})}periodStartDateChanged(e){this.validateSaveButton()}periodDaysChanged(e){this.validateSaveButton()}weekValidationChanged(e){this.weekValidation=e,this.validateSaveButton()}static ctorParameters=()=>[{type:y},{type:g}];static propDecorators={period:[{type:d}]}};te=Nt([c({selector:"armon-pacs-period-regular-upsert",template:Qe,standalone:!0,providers:[{provide:b,useClass:C}],imports:[p,v,_,T,D,R,m],styles:[Ze]})],te);var et=`<div class="period-item card mb-3" *ngIf="visibleComponent">
    <div class="card-header period-header" [ngSwitch]="period.timeLineState"
        [attr.timeLineState]="period.timeLineState">
        <div class="period-state" *ngSwitchCase="0">
            {{'PACS.WORKPLAN_PERIOD_ACTIVE' | translate}}
        </div>
        <div class="period-state" *ngSwitchCase="1">
            {{'PACS.WORKPLAN_PERIOD_EXPIRED' | translate}}
        </div>
        <div class="period-state" *ngSwitchCase="2">
            {{'PACS.WORKPLAN_PERIOD_NOTACTIVEYET' | translate}}
        </div>
        <span class="period-start-date">{{'PACS.WORKPLAN_PERIOD_START_DATE' | translate}} :
            {{period.periodStartDateTime | date:'medium'}}</span>
    </div>
    <div class="card-block" *ngIf="editMode">
        <armon-pacs-period-regular-upsert *ngIf="workplanType==1" [period]="period"
            (periodEditCancelled)="editCancelled($event)" (periodEditCompleted)="editCompleted($event)">
        </armon-pacs-period-regular-upsert>
        <armon-pacs-period-halfflexible-upsert *ngIf="workplanType==2" [period]="period"
            (periodEditCancelled)="editCancelled($event)" (periodEditCompleted)="editCompleted($event)">
        </armon-pacs-period-halfflexible-upsert>
        <armon-pacs-period-fullflexible-upsert *ngIf="workplanType==3" [period]="period"
            (periodEditCancelled)="editCancelled($event)" (periodEditCompleted)="editCompleted($event)">
        </armon-pacs-period-fullflexible-upsert>
        <armon-pacs-period-shift-upsert *ngIf="workplanType==4" [period]="period"
            (periodEditCancelled)="editCancelled($event)" (periodEditCompleted)="editCompleted($event)">
        </armon-pacs-period-shift-upsert>
    </div>
    <div class="card-block" *ngIf="!editMode">
        <armon-pacs-workplan-period-info [period]="period" [workplanType]="workplanType">
        </armon-pacs-workplan-period-info>
    </div>
    <div class="card-footer" *ngIf="(permissionAttendancePlanWrite==true) && !editMode">
        <button class="btn btn-sm btn-link" (click)="editClicked($event)"
            [disabled]="disabled">{{'BUTTON.EDIT'|translate}}</button>
        <button class="btn btn-sm btn-link" (click)="deleteClicked($event)"
            [disabled]="disabled">{{'BUTTON.DELETE'|translate}}</button>
    </div>
</div>`;var tt=`.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}:host .period-state{font-size:.756rem}:host .period-start-date{font-size:.714rem}:host .period-header[timeLineState="0"]{background-color:#538f1c;color:#fff}:host .period-header[timeLineState="1"]{background-color:#9191914d}:host .period-header[timeLineState="2"]{background-color:#538f1c26}
`;var ot=`<div class="row" *ngIf="visibleComponent">
    <div class="col-12" *ngIf="showSettings">
        <div class="settings-container">
            <div>
                <strong>{{'PACS.WORKPLAN_PERIOD_SETTINGS_TTILE' | translate}}</strong>
            </div>
            <span *ngIf="showWeeklyExpectedWorkDuration">{{'PACS.WORKPLAN_PERIOD_FLEXIBLE_DURATION' | translate}}:
                {{period.weeklyExpectedWorkDuration}} {{'PACS.WORKPLAN_PERIOD_UNIT_HOUR'
                | translate}}
                <br>
            </span>
            <span *ngIf="showWorkRestDuration">{{'PACS.WORKPLAN_PERIOD_SHIFT_WORK' | translate}}:
                {{period.workDuration}} {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}} - {{'PACS.WORKPLAN_PERIOD_SHIFT_REST' | translate}}: {{period.restDuration}}
                {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}}
                <br>
            </span>
        </div>
    </div>
    <div class="col-12">
        <div class="week-container bg-white">
            <div>
                <strong>{{'PACS.WORKPLAN_PERIOD_DAYS_TTILE' | translate}}</strong>
            </div>
            <ng-container *ngIf="period.dayItems">
                <ng-container *ngFor="let day of period.dayItems">
                    <ng-template *ngTemplateOutlet="daydetail; context: {$implicit: day}"></ng-template>
                </ng-container>
            </ng-container>
            <ng-container *ngIf="period.dayBreakItems">
                <ng-container *ngFor="let day of period.dayBreakItems">
                    <ng-template *ngTemplateOutlet="daydetail; context: {$implicit: day}"></ng-template>
                </ng-container>
            </ng-container>
        </div>
    </div>
    <div class="col-12" *ngIf="showTolerances">
        <div class="tolerances-container">
            <div>
                <strong>{{'PACS.WORKPLAN_PERIOD_TOLERANCES_TITLE' | translate}}</strong>
            </div>
            <span class="me-2">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_EARLY_IN' | translate}}:
                {{period.tolerances.earlyStart}} {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}}</span>
            <span class="me-2">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_LATE_IN' | translate}}: {{period.tolerances.lateStart}}
                {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}}</span>
            <span class="me-2">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_EARLY_OUT' | translate}}:
                {{period.tolerances.earlyLeave}} {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}}</span>
            <span class="me-2">{{'PACS.WORKPLAN_PERIOD_TOLERANCE_LATE_OUT' | translate}}:
                {{period.tolerances.lateLeave}} {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
                | translate}}</span>
        </div>
    </div>
</div>

<ng-template #daydetail let-day>
    <div class="mt-2 ms-3">
        <span class="text-55rem">{{getDayName(day.index)|translate}}</span>
        <ng-container *ngIf="showWorkingHours">
            <br>
            <span><strong>- {{'PACS.WORKPLAN_PERIOD_REGULAR_HOURS' | translate}}: </strong>
                <ng-container *ngIf="day.workingHours">
                    <ng-container *ngFor="let workingHour of day.workingHours">
                        {{workingHour.startTime|HHMMFormatter}} - {{workingHour.endTime|HHMMFormatter}}
                    </ng-container>
                </ng-container>
                <ng-container *ngIf="!day.workingHours || day.workingHours.length == 0">
                    {{'PACS.WORKPLAN_PERIOD_NO_WORKING_HOUR'|translate}}
                </ng-container>
            </span>
        </ng-container>
        <span *ngIf="day.fixedBreaks.length >0 || day.claimBreak || day.extraWorkBreaks.length >0" class="ms-3"><br>-
        </span>
        <span class="comma"
            *ngFor="let requiredBreak of day.fixedBreaks"><strong>&nbsp;{{getRequiredBreakTypeName(requiredBreak.type)|translate}}</strong>
            {{requiredBreak.startTime|HHMMFormatter}} - {{requiredBreak.endTime|HHMMFormatter}}
            {{'PACS.WORKPLAN_BREAK_CLAIM_BREAK_MINS' | translate}}: {{requiredBreak.allowedMaxBreakDuration}}
            {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
            | translate}}</span>
        <span *ngIf="day.claimBreak"
            class="comma"><strong>&nbsp;{{getClaimBreakTypeName(day.claimBreak.type)|translate}}</strong>
            {{'PACS.WORKPLAN_BREAK_CLAIM_WORK_HOURS' | translate}}:
            {{day.claimBreak.workDuration}} {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE' | translate}}
            {{'PACS.WORKPLAN_BREAK_CLAIM_BREAK_MINS'
            | translate}}: {{day.claimBreak.breakDuration}}
            {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE' | translate}}
        </span>
        <span class="comma"
            *ngFor="let extraWorkBreak of day.extraWorkBreaks"><strong>&nbsp;{{getRequiredBreakTypeName(extraWorkBreak.type)|translate}}
                ({{'REPORT.PACS_COL_EXTRA_WORK'|translate}})</strong>
            {{extraWorkBreak.startTime|HHMMFormatter}} - {{extraWorkBreak.endTime|HHMMFormatter}}
            {{'PACS.WORKPLAN_BREAK_EXTRA_BREAK_MINS' | translate}}: {{extraWorkBreak.breakDuration}}
            {{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'
            | translate}}</span>
    </div>
</ng-template>`;var it=`.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}:host .base-container,:host .tolerances-container,:host .week-container,:host .settings-container{padding:6px 12px;margin-bottom:6px}:host .base-container div,:host .tolerances-container div,:host .week-container div,:host .settings-container div{font-size:.756rem}:host .base-container span,:host .tolerances-container span,:host .week-container span,:host .settings-container span{font-size:.714rem}
`;var Ut=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},oe=class{transform(e){return e?this.addString(e,2,0,":"):""}addString(e,t,o,a){return e.slice(0,t)+a+e.slice(t+Math.abs(o))}};oe=Ut([ue({name:"HHMMFormatter",standalone:!0})],oe);var Kt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},ie=class{translate;period;workplanType;showSettings=!1;showWorkRestDuration=!1;showWeeklyExpectedWorkDuration=!1;showWorkingHours=!1;showTolerances=!1;_translated;visibleComponent=!0;constructor(e){this.translate=e}ngOnInit(){this.translate.get(["USER_PERMISSION_UNIT_TYPE_DAY"]).subscribe(e=>{switch(this._translated=e,this.workplanType){case h.Regular:this.showTolerances=!0,this.showWorkingHours=!0;break;case h.HalfFlexible:this.showWeeklyExpectedWorkDuration=!0,this.showWorkingHours=!0,this.showTolerances=!0;break;case h.FullFlexible:this.showWeeklyExpectedWorkDuration=!0;break;case h.Shift:this.showTolerances=!0,this.showWorkRestDuration=!0;break}this.showSettings=this.showWeeklyExpectedWorkDuration||this.showWorkRestDuration,this.visibleComponent=!0})}ngOnDestroy(){}getDayName(e){switch(this.period.routineType){case k.Week:return W.find(t=>t.type==e).description;case k.Day:return this._translated.USER_PERMISSION_UNIT_TYPE_DAY+" "+e}}getRequiredBreakTypeName(e){return Y.find(t=>t.value===e).i18nName}getClaimBreakTypeName(e){return J.find(t=>t.value===e).i18nName}static ctorParameters=()=>[{type:O}];static propDecorators={period:[{type:d}],workplanType:[{type:d}]}};ie=Kt([c({selector:"armon-pacs-workplan-period-info",template:ot,standalone:!0,imports:[p,E,B,m,oe],styles:[it]})],ie);var zt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},at=class{pacsService;interactionService;authService;period;workplanType;disabled=!1;periodEditStarted=new f;periodEditCancelled=new f;periodEditCompleted=new f;periodDeleteCompleted=new f;visibleComponent=!0;editMode=!1;permissionAttendancePlanWrite;constructor(e,t,o){this.pacsService=e,this.interactionService=t,this.authService=o}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(w.ATTENDANCEPLAN.getWrite()),this.visibleComponent=!0}ngOnDestroy(){}editClicked(e){this.editMode=!0,this.periodEditStarted.emit()}editCancelled(e){this.periodEditCancelled.emit(),this.editMode=!1}editCompleted(e){this.periodEditCompleted.emit(),this.editMode=!1}deleteClicked(e){this.interactionService.showDialog("PACS.DIALOG_DELETE_WORKPLAN_PERIOD_TITLE","PACS.DIALOG_DELETE_WORKPLAN_PERIOD",null,null,!0,"BUTTON.DELETE","",!0,()=>{this.pacsService.deleteWorkplanPeriod(this.period.id).subscribe(()=>{this.periodDeleteCompleted.emit()})})}static ctorParameters=()=>[{type:y},{type:g},{type:$}];static propDecorators={period:[{type:d}],workplanType:[{type:d}],disabled:[{type:d}],periodEditStarted:[{type:u}],periodEditCancelled:[{type:u}],periodEditCompleted:[{type:u}],periodDeleteCompleted:[{type:u}]}};at=zt([c({selector:"armon-pacs-workplan-period",template:et,standalone:!0,imports:[p,ve,ge,te,ee,Z,Q,ie,ke,m],styles:[tt]})],at);var rt=`<div class="row">
    <div class="col-12 d-flex align-items-center">
        <cds-icon shape="circle-arrow" size="md" direction="left" (click)="backClicked($event)" class="me-2"></cds-icon>
        <span class="text-xl me-2">{{workplan.name}}</span>
        <armon-pacs-workplan-type [workplanType]="workplan.type"></armon-pacs-workplan-type>
    </div>
</div>
<div class="row my-3" *ngIf="permissionAttendancePlanWrite==false">
    <div class="col-12">
        <div class="alert alert-warning" role="alert">
            {{'PACS.WORKPLAN_NO_WRITE_PERMISSION'|translate}}
        </div>
    </div>
</div>
<div class="row mt-3">
    <div class="col-12">
        <div class="b-b-1">
            <span class="title">{{'PACS.WORKPLAN_SETTINGS' | translate}}</span>
        </div>
    </div>
</div>
<div class="componentContainer pos-relative">
    <div class="row">
        <div class="col-12 mb-3" *ngIf="!editMode">
            <div class="alert alert-info" role="alert">
                {{"PACS.DIRECTION_ADD_WORKPLAN"|translate}}
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 col-12">
            <div class="form-group">
                <label for="nameInput">{{'PACS.WORKPLAN_TITLE' | translate}}</label>
                <input type="text" id="nameInput" [(ngModel)]="workplan.name" class="form-control form-control-sm">
            </div>
        </div>
        <div class="col-md-6 col-12">
            <div class="form-group">
                <label for="nameInput">{{'PACS.WORKPLAN_REGION' | translate}}</label>
                <armon-select-search query="region" [allowMulti]="false" [(ngModel)]="workplan.regionId"
                    allowClear="true">
                </armon-select-search>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-6 col-12">
            <div class="form-group">
                <label for="nameInput">{{'ORGANIZATIONUNIT.TITLE_ORGANIZATION_UNIT' | translate}}</label>
                <armon-select-search query="unit" [allowMulti]="false" [(ngModel)]="workplan.organizationUnitId"
                    [allowClear]="true" #selectSearchUnit
                    [invalid]="((!permittedForOrganizationWrite && permittedForAnyUnitWrite) && !workplan.organizationUnitId)">
                </armon-select-search>
                <div class="invalid-feedback" style="display: initial;">
                    <span *ngIf="selectSearchUnit.invalid">{{'VALIDATION.REQUIRED'|translate}}</span>
                </div>
            </div>
            <div class="form-group" *ngIf="visiblePermissionRequiredForExtraWorking">
                <label for="permissionRequiresInput">{{'PACS.SEGMENT_WORKING_OUT_WORKINGHOURS' | translate}}</label>
                <div class="form-check">
                    <input class="form-check-input" id="permissionRequiresInput" type="checkbox"
                        [(ngModel)]="workplan.permissionRequiredForExtraWorking" name="permissionRequiresInput">
                    <label class="form-check-label" for="permissionRequiresInput">
                        <span>{{'PACS.WORKPLAN_REQUIRED_PERMISSION_EXTRA' | translate}}</span>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label for="holidaysInput">{{'PAGES.PACS_VACATIONS' | translate}}</label>
                <div class="form-check">
                    <input class="form-check-input" id="holidaysInput" customValue type="checkbox" [trueValue]="false"
                        [falseValue]="true" [(ngModel)]="workplan.ignoreHolidays" name="holidaysInput">
                    <label class="form-check-label" for="holidaysInput">
                        <span>{{'PACS.WORKPLAN_NOT_IGNORE_HOLIDAY' | translate}}</span>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label for="hexcode-input" class="w-100">{{'PACS.WORKPLAN_COLOR' | translate}}</label>
                <nz-color-picker id="hexcode-input" [(ngModel)]="workplan.hexColor" class="mb-2" nzShowText
                    nzDisabledAlpha="true" nzFormat="hex"></nz-color-picker>
            </div>
        </div>
        <div class="col-md-6 col-12">
            <div class="form-group">
                <label>{{'COMMON.TIMEZONE'|translate}}</label>
                <armon-timezone-input class="custom-item" [(ngModel)]="workplan.timezone"></armon-timezone-input>
            </div>
            <div class="form-group">
                <label>{{'PACS.WORKPLAN_ENTRY_EXIT_CONTROL' | translate}}</label>
                <div class="form-check">
                    <input class="form-check-input" id="controlregion" type="radio" name="controlregion"
                        [(ngModel)]="workplan.accessCheckType" (ngModelChange)="accessCheckTypeChanged($event)"
                        [value]="1">
                    <label class="form-check-label" for="controlregion">
                        {{'PACS.WORKPLAN_ENTRY_EXIT_REGION'|translate}}
                    </label>
                </div>
                <div class="form-check">
                    <input class="form-check-input" id="controlentryexit" type="radio" name="controlentryexit"
                        [(ngModel)]="workplan.accessCheckType" (ngModelChange)="accessCheckTypeChanged($event)"
                        [value]="2">
                    <label class="form-check-label" for="controlentryexit">
                        {{'PACS.WORKPLAN_ENTRY_EXIT_LAST'|translate}}
                    </label>
                </div>
                <div class="form-group ms-4 mt-2">
                    <div class="d-flex align-items-center">
                        <label class="report-form-label">{{'PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET' | translate}}</label>
                        <span class="text-sm ms-auto"><span *ngIf="workplan.offset<0">-
                            </span>{{workplan.offset|minuteFormatter:''}}</span>
                    </div>
                    <div class="d-flex flex-column">
                        <input type="range" class="form-range" min="-720" max="720" step="5"
                            [(ngModel)]="workplan.offset" (ngModelChange)="onEndDayOffsetChanged($event)">
                        <span class="text-xs text-italic">{{endOfDayOffsetInfo}}</span>
                    </div>
                </div>
                <div class="form-group">
                    <div class="form-check">
                        <input class="form-check-input" id="ignoreUnpairedAccessesInput" type="checkbox"
                            [(ngModel)]="workplan.ignoreUnpairedAccesses" name="holidaysInput">
                        <label class="form-check-label" for="ignoreUnpairedAccessesInput">
                            <span>{{(workplan.ignoreUnpairedAccesses ? 'PACS.WORKPLAN_IGNORE_UNPAIRED_ACCESS' :
                                'PACS.WORKPLAN_UNPAIRED_ACCESS' ) | translate}}</span>
                        </label>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-12">
            <div class="form-group">
                <label>{{'PACS.WORKPLAN_MOBILE_CHECK_IN' | translate}}</label>
                <div class="form-check">
                    <input class="form-check-input" id="allowMobileCheckinsInput" type="checkbox"
                        [(ngModel)]="workplan.allowMobileCheckins" name="allowMobileCheckins"
                        (ngModelChange)="onMobileCheckInSettingsChanged($event)">
                    <label class="form-check-label" for="allowMobileCheckinsInput">
                        <span>{{'PACS.WORKPLAN_MOBILE_CHECK_IN_ALLOW' | translate}}</span>
                    </label>
                </div>
                <div class="form-check" [hidden]="workplan.allowMobileCheckins==false">
                    <input class="form-check-input" id="mobileCheckinRequiresLocationInput" type="checkbox"
                        [(ngModel)]="workplan.mobileCheckinRequiresLocation" name="mobileCheckinRequiresLocation"
                        (ngModelChange)="onMobileCheckInSettingsChanged($event)">
                    <label class="form-check-label" for="mobileCheckinRequiresLocationInput">
                        <span>{{'PACS.WORKPLAN_MOBILE_CHECK_IN_LOCATION' | translate}}</span>
                    </label>
                </div>
                <div class="form-check"
                    [hidden]="workplan.mobileCheckinRequiresLocation==false || workplan.allowMobileCheckins==false">
                    <input class="form-check-input" id="allowUnreliableCheckinsInput" type="checkbox"
                        [(ngModel)]="workplan.allowUnreliableCheckins" name="allowUnreliableCheckins"
                        (ngModelChange)="onMobileCheckInSettingsChanged($event)">
                    <label class="form-check-label" for="allowUnreliableCheckinsInput">
                        <span>{{'PACS.WORKPLAN_MOBILE_CHECK_IN_ALLOW_UNVERIFIED' | translate}}</span>
                    </label>
                </div>
            </div>
        </div>
        <div class="col-12 mb-3" [hidden]="workplan.mobileCheckinRequiresLocation==false">
            <div class="d-flex align-items-center mb-3 b-b-1 py-1">
                <div class="d-flex flex-column">
                    <span class="text-md">{{'MAP.GEOLOCATION'|translate}} ({{formGeoLocations.controls.length}})</span>
                    <span class="text-xs text-italic">{{'PACS.WORKPLAN_LOCATION_ANY_DIRECTION'|translate}}</span>
                </div>
                <button class="btn btn-sm btn-primary ms-auto" (click)="onAddGeolocationClicked($event)"
                    *ngIf="(permissionAttendancePlanWrite==true)" [disabled]="formGeoLocations.controls.length >= 10">
                    <cds-icon shape="plus-circle" solid class="cds-icon-18 me-1"></cds-icon>{{'BUTTON.ADD'|translate}}
                </button>
            </div>
            <span class="text-sm text-italic color-gray cursor-pointer"
                *ngIf="(permissionAttendancePlanWrite==true) && formGeoLocations.controls.length == 0"
                (click)="onAddGeolocationClicked($event)">
                <cds-icon shape="info-standard" class="me-2"></cds-icon>{{'PACS.WORKPLAN_LOCATION_DIRECTION'|translate}}
            </span>
            <form [formGroup]="geoLocationForm">
                <div class="form-row">
                    <ng-container *ngFor="let formGeoLocationControl of formGeoLocations.controls; let index = index;">
                        <div class="form-group col-lg-6 col-12 my-1" [formGroup]="formGeoLocationControl">
                            <div class="d-flex align-items-center">
                                <armon-geolocation-control formControlName="geoLocation" class="flex-grow-1"
                                    [invalid]="formGeoLocationControl.get('geoLocation').invalid">
                                </armon-geolocation-control>
                                <cds-icon class="ms-2 text-danger cursor-pointer" shape="times-circle"
                                    style="width: 20px; height: 20px;" solid
                                    (click)="onRemoveGeolocationClicked($event, index)" nz-tooltip
                                    nzTooltipTitle="{{'BUTTON.DELETE'|translate}}"></cds-icon>
                            </div>
                            <ng-template
                                *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: formGeoLocationControl, control:formGeoLocationControl.get('geoLocation')}">
                            </ng-template>
                        </div>
                    </ng-container>
                </div>
            </form>
        </div>
    </div>
    <div class="row" *ngIf="(permissionAttendancePlanWrite==true)">
        <div class="col-12 d-flex justify-content-end">
            <button class="btn btn-primary" (click)="saveClicked($event)"
                [disabled]="workplan.name=='' || disabled || !notificationListValid || (workplan.mobileCheckinRequiresLocation && geoLocationForm.invalid) || selectSearchUnit.invalid">
                {{'BUTTON.SAVE' | translate}}
            </button>
        </div>
    </div>
    <div class="disabled-overlay" *ngIf="disabled || (permissionAttendancePlanWrite==false)"></div>
</div>

<ng-template #controlValidationTemplate let-form let-control="control">
    <ng-container *ngIf="control.errors">
        <div class="invalid-feedback" style="display: initial;">
            <span *ngIf="control.errors.required">{{'VALIDATION.REQUIRED'|translate}}</span>
        </div>
    </ng-container>
</ng-template>`;var nt=`.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}:host .componentContainer{padding:18px;background-color:#fff;-webkit-border-radius:.75rem;-moz-border-radius:.75rem;border-radius:.75rem;margin-top:18px;margin-bottom:12px}:host cds-icon{cursor:pointer}:host .disabled-overlay{position:absolute;margin:auto;inset:0;cursor:default;background-color:#ffffff80;z-index:1}
`;var st=`<select [(ngModel)]="selected" (ngModelChange)="onTimezoneChanged($event)" class="form-select form-select-sm">\r
       <option *ngFor="let timezone of timezones" [ngValue]="timezone">{{timezone.label}}</option>\r
</select>`;var lt=`.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}:host .color-picker{width:28px;height:28px;border:1px solid #999;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;cursor:pointer}
`;var Gt=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},qt={provide:Ee,useExisting:pe(()=>M),multi:!0},M=class{onChange;selected;inputValue;timezones;constructor(){this.timezones=this.createList()}createList(){let e=[];for(let t=-12;t<=12;t++)e.push({label:"UTC "+(t>0?"+":"")+t.toString(),offset:t*60,value:this.getOffsetString(t)});return e}getOffsetString(e){return(e==0?"":e>0?"+":"-")+("0"+Math.abs(e).toString()).slice(-2)+":00"}writeValue(e){e&&(this.inputValue=e,this.selected=this.timezones.find(t=>t.value==e))}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){}ngOnInit(){this.selected||(this.selected=this.timezones.find(e=>e.offset==l.utc().offset),this.onChange&&this.onChange(this.selected.value))}onTimezoneChanged(e){this.onChange(this.selected.value)}static ctorParameters=()=>[]};M=Gt([c({selector:"armon-timezone-input",providers:[qt],template:st,standalone:!0,imports:[v,Te,E],styles:[lt]})],M);var $t=function(n,e,t,o){var a=arguments.length,i=a<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,e,t,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(i=(a<3?r(i):a>3?r(e,t,i):r(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},dt=class{router;pacsService;authService;interactionService;accessControlPointUserService;translate;formBuilder;workplan;workplanType;disabled;workplanUpdated=new f;visibleComponent=!0;editMode=!0;visiblePermissionRequiredForExtraWorking;notificationListValid=!0;geoLocationForm;endOfDayOffsetInfo;permittedForOrganizationWrite;permittedForAnyUnitWrite;permissionAttendancePlanWrite;constructor(e,t,o,a,i,r,s){this.router=e,this.pacsService=t,this.authService=o,this.interactionService=a,this.accessControlPointUserService=i,this.translate=r,this.formBuilder=s}ngOnInit(){if(this.permissionAttendancePlanWrite=this.authService.checkPermission(w.ATTENDANCEPLAN.getWrite()),this.permittedForOrganizationWrite=this.authService.isPermittedForOrganization(w.ATTENDANCEPLAN.getWrite()),this.permittedForAnyUnitWrite=this.authService.isPermittedForAnyUnitInOrganization(w.ATTENDANCEPLAN.getWrite()),this.editMode=this.workplan&&this.workplan.id&&this.workplan.id!="",this.visiblePermissionRequiredForExtraWorking=this.workplan.type==h.Regular||this.workplan.type==h.Shift,this.geoLocationForm=this.formBuilder.group({geoLocations:this.formBuilder.array([])}),this.workplan.typedGeoLocations&&this.workplan.typedGeoLocations.length>0){let e=this.geoLocationForm.get("geoLocations");this.workplan.typedGeoLocations.map(t=>{e.push(this.createGeolocationForm(t))})}this.setEndOfDayOffsetInfo()}ngOnDestroy(){}saveClicked(e){let t=N.getRequestModel(this.workplan);t.mobileCheckinRequiresLocation&&this.geoLocationForm.valid&&(t.typedGeoLocations=[],this.geoLocationForm.value.geoLocations.forEach(a=>{t.typedGeoLocations.push(a.geoLocation)})),this.pacsService.upsertWorkplan(t).subscribe(o=>{this.afterUpdated(o)},o=>{o&&o.error&&o.error.message&&this.interactionService.showDialog("PACS.ADD_WORKPLAN_TYPE",o.error.message,null,null,!1,"BUTTON.OK","",!1,()=>{})})}afterUpdated(e){this.workplan.id=e,this.editMode=!0,this.workplanUpdated.emit(this.workplan),this.interactionService.showMessage("PACS.MESSAGE_SAVED_WORKPLAN",null,P.Success),this.workplan.allowMobileCheckins&&this.accessControlPointUserService.checkUserSelectionVirtualMobileCheckin(this.workplan.id,!0)}backClicked(e){this.router.navigate([Ce.PACS_WORKPLANS.fullPath])}accessCheckTypeChanged(e){}onEndOfDayHourDateChanged(e){}onMobileCheckInSettingsChanged(e){this.workplan.allowMobileCheckins==!1&&(this.workplan.mobileCheckinRequiresLocation=!1,this.workplan.allowUnreliableCheckins=!1),this.workplan.mobileCheckinRequiresLocation==!1&&(this.workplan.allowUnreliableCheckins=!1)}onNotificationsUpdated(e){this.notificationListValid=e}setEndOfDayOffsetInfo(){this.workplan&&this.translate.get(["PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET_INFO"],{day:l.local().toLocaleString(l.DATE_FULL),dayStart:l.local().startOf("day").plus({minutes:this.workplan.offset}).toLocaleString(l.DATETIME_MED),dayEnd:l.local().startOf("day").plus({minutes:this.workplan.offset}).plus({hours:24}).toLocaleString(l.DATETIME_MED)}).subscribe(e=>{this.endOfDayOffsetInfo=e["PACS.WORKPLAN_ENTRY_EXIT_LAST_OFFSET_INFO"]})}onEndDayOffsetChanged(e){this.setEndOfDayOffsetInfo()}get formGeoLocations(){return this.geoLocationForm.get("geoLocations")}createGeolocationForm(e=null){return this.formBuilder.group({geoLocation:[e||null,[Pe.required]]})}onAddGeolocationClicked(e){this.formGeoLocations.controls.length<10&&(this.formGeoLocations.push(this.createGeolocationForm()),this.geoLocationForm.updateValueAndValidity())}onRemoveGeolocationClicked(e,t){this.formGeoLocations.removeAt(t),this.geoLocationForm.updateValueAndValidity()}static ctorParameters=()=>[{type:ye},{type:y},{type:$},{type:g},{type:Le},{type:O},{type:xe}];static propDecorators={workplan:[{type:d}],workplanType:[{type:d}],disabled:[{type:d}],workplanUpdated:[{type:u}]}};dt=$t([c({selector:"armon-pacs-workplan-header",template:rt,standalone:!0,schemas:[me],imports:[We,p,v,Re,Se,M,De,E,Ne,j,B,Ie,m,U],styles:[nt]})],dt);export{Me as a,Q as b,Z as c,ee as d,te as e,at as f,dt as g};
