import{a as ue}from"./chunk-ERH4HFS3.js";import{a as de}from"./chunk-FFR3SHS6.js";import{a as me}from"./chunk-IKQMUISD.js";import{a as N,b as h}from"./chunk-MFZ3EXVF.js";import{a as ce}from"./chunk-MXSLISEG.js";import"./chunk-7GYHTWED.js";import"./chunk-7QEXVS2A.js";import{a as ie,b as re,c as ae}from"./chunk-UZB7YFT6.js";import"./chunk-HXEFMD5A.js";import"./chunk-KCLQIV7M.js";import"./chunk-5KCUTXXV.js";import{a as S}from"./chunk-JUDWAYYT.js";import"./chunk-LAJI7RPC.js";import{a as oe}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as se,c as le,d as pe}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as ne}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Mb as te,Ob as C,j as u,k as Q,s as y,v as b,y as w}from"./chunk-YSQLW2JA.js";import{Fb as ee,o as I,z as J}from"./chunk-NVJ2ZZFT.js";import{Aa as p,Ba as z,Be as _,Ce as K,Dc as P,Hb as k,If as Y,Mc as W,Mg as X,Nc as M,Ng as Z,Qf as V,Rd as U,Sd as j,Te as d,Ve as H,Ye as G,ab as v,bb as c,bh as x,dc as R,dd as m,fb as O,ha as L,hd as f,jb as D,ma as A,te as F,ue as $,ve as g,xe as B,ya as l,ye as q}from"./chunk-SKPDQO4E.js";var fe=`<div class="h-100">
    <side-navigation *ngIf="visibleComponent">
        <ng-template side-navigation-nav>
            <div class="row mb-3">
                <label class="report-form-label">{{'PACS.WORKPLAN_SEARCH' | translate}}</label>
                <armon-search-text-input [(ngModel)]="filterName" [maxLength]="20" [minLength]="3"
                    (ngModelChange)="filterChanged($event)" placeholder="COMMON.SEARCH"></armon-search-text-input>
            </div>
            <div class="row">
                <armon-pacs-filter-select class="col-12" [title]="'PACS.WORKPLAN_TYPE'" [options]="typeFilterOptions"
                    [(ngModel)]="filterType" (filterChanged)="workplanTypeChanged($event)">
                </armon-pacs-filter-select>
            </div>
        </ng-template>
        <ng-template side-navigation-content>
            <div class="row my-3" *ngIf="permissionAttendancePlanWrite">
                <div class="col-xl-12">
                    <button nz-dropdown [nzDropdownMenu]="menuSub" class="btn btn-primary btn-sm">
                        {{'PACS.ADD_WORKPLAN_TYPE'|translate}}
                        <cds-icon shape="angle" direction="down"></cds-icon>
                    </button>
                    <nz-dropdown-menu #menuSub="nzDropdownMenu">
                        <ul nz-menu>
                            <li nz-menu-item *ngFor="let type of types" (click)="addNewWorkplan($event, type)">
                                {{type.i18nName|translate}}</li>
                        </ul>
                    </nz-dropdown-menu>
                </div>
            </div>
            <div class="row py-5" *ngIf="workplans && workplans.length==0">
                <div class="col-12">
                    <nz-empty [nzNotFoundContent]="contentTpl"
                        [nzNotFoundImage]="'./assets/images/empty/empty_list.png'">
                        <ng-template #contentTpl>
                            <span>{{'PACS.WORKPLAN_FILTER_NO_ITEMS'|translate}}</span>
                        </ng-template>
                    </nz-empty>
                </div>
            </div>
            <div class="row" [@listAnimation]="workplans.length" *ngIf="workplans && workplans.length>0">
                <armon-pacs-workplan-list-item class="col-12 col-xl-6" *ngFor="let workplan of workplans"
                    [workplan]="workplan" (itemUpdated)="itemUpdated($event)"></armon-pacs-workplan-list-item>
            </div>
        </ng-template>
    </side-navigation>
</div>`;var ge="";var he=`<div class="card my-2">
    <div class="card-header d-flex flex-column hover-secondary" (click)="gotoWorkplan($event)">
        <span class="text-lg">
            <cds-icon shape="circle" solid class="me-2 cds-icon-20" [ngStyle]="{'color': workplan.hexColor}"></cds-icon>
            <span>{{workplan.name}}</span>
            <span class="text-sm text-italic color-gray ms-2" *ngIf="workplan.organizationUnitName">
                <cds-icon shape="organization" class="me-1"></cds-icon>{{workplan.organizationUnitName}}
            </span></span>
        <div class="d-flex justify-content-end flex-grow-1 mt-2 column-gap-1">
            <armon-pacs-workplan-type [workplanType]="workplan.type"></armon-pacs-workplan-type>
            <armon-icon-label [colorCode]="1" *ngIf="workplan.regionId">
                <ng-template icon-label-icon>
                    <cds-icon shape="region"></cds-icon>
                </ng-template>
                <ng-template icon-label-content>
                    <span>{{workplan.regionName}}</span>
                </ng-template>
            </armon-icon-label>
            <armon-icon-label [colorCode]="6" *ngIf="workplan.allowMobileCheckins">
                <ng-template icon-label-icon>
                    <cds-icon shape="check-circle" solid></cds-icon>
                </ng-template>
                <ng-template icon-label-content>
                    <span>{{'PACS.WORKPLAN_MOBILE_CHECK_IN'|translate}}</span>
                </ng-template>
            </armon-icon-label>
            <armon-icon-label [colorCode]="7" *ngIf="workplan.geoLocationCount && workplan.geoLocationCount>0">
                <ng-template icon-label-icon>
                    <cds-icon shape="map-marker" solid></cds-icon>
                </ng-template>
                <ng-template icon-label-content>
                    <span>{{'MAP.GEOLOCATION_SELECTED'|translate}}</span>
                </ng-template>
            </armon-icon-label>
        </div>
    </div>
    <div class="card-body p-3">
        <div class="users-container">
            <!-- <div class="users-title">{{'PACS.USERS' | translate}}</div> -->
            <div class="users-container-inner align-items-stretch">
                <div class="d-flex flex-column align-items-center justify-content-between">
                    <span class="text-sm text-primary">{{'PACS.USERS' | translate}}</span>
                    <cds-icon class="icon mb-3" shape="users" size="lg"></cds-icon>
                </div>
                <div class="user-count-container">
                    <div class="date-title text-primary"><span>{{userCountTitle|translate}}</span>
                        <cds-icon shape="calendar" [owlDateTimeTrigger]="datepicker" class="ms-2"
                            title="{{'PLACEHOLDER.DATE_SELECT'|translate}}"></cds-icon>
                        <input [(ngModel)]="selectedDate" [owlDateTime]="datepicker" class="date-select-input"
                            (dateTimeChange)="onDateChanged($event)">
                        <owl-date-time [firstDayOfWeek]="1" #datepicker>
                        </owl-date-time>
                    </div>
                    <span class="user-count mt-2 cursor-pointer"
                        (click)="onEmployeeListClicked($event)">{{userCount}}</span>
                </div>
                <div class="button-container">
                    <!-- *ngIf="workplan.isEditable" -->
                    <ng-container>
                        <button nz-dropdown [nzDropdownMenu]="menuSub" class="btn btn-outline-primary btn-sm">
                            {{'PACS.USERS' | translate}}
                            <i nz-icon nzType="down"></i>
                        </button>
                        <nz-dropdown-menu #menuSub="nzDropdownMenu">
                            <ul nz-menu>
                                <li nz-menu-item (click)="onEmployeeListClicked($event)">{{'BUTTON.SHOW' | translate}}
                                </li>
                                <li nz-menu-divider></li>
                                <li nz-menu-item (click)="onUpsertEmployeeClicked($event)">{{'PACS.ADD_USER' |
                                    translate}}
                                </li>
                                <li nz-menu-item (click)="onRemoveEmployeeClicked($event)">{{'PACS.REMOVE_USER' |
                                    translate}}</li>
                                <ng-container *ngIf="workplan.allowMobileCheckins && permissionIdentityEdit">
                                    <li nz-menu-divider></li>
                                    <li nz-menu-item (click)="onShowVirtualACPUsersClicked($event)">
                                        {{'PACS.WORKPLAN_MOBILE_CHECK_ACP_USERS' | translate}}</li>
                                </ng-container>
                            </ul>
                        </nz-dropdown-menu>
                    </ng-container>
                    <!-- <ng-container *ngIf="!workplan.isEditable">
                        <button class="btn btn-outline-primary btn-sm" (click)="onEmployeeListClicked($event)">
                            {{'PACS.USERS' | translate}}
                        </button>
                    </ng-container> -->
                </div>
            </div>
        </div>
    </div>
    <div class="card-footer">
        <button class="btn btn-sm btn-link" (click)="gotoWorkplan($event)">{{'BUTTON.DETAIL'|translate}}</button>
        <button class="btn btn-sm btn-link" (click)="deleteWorkplan($event)"
            *ngIf="permissionAttendancePlanWrite">{{'BUTTON.DELETE'|translate}}</button>
    </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 .card-header{padding:12px;cursor:pointer}:host .users-container .users-title{width:100%;color:#0a2a5acc;border-bottom:1px solid rgba(10,42,90,.3)}:host .users-container .users-container-inner{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-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}:host .users-container .users-container-inner .icon{color:#0a2a5a4d}:host .users-container .users-container-inner .user-count-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:12px;padding-left:12px;text-align:left;color:#0a2a5a80;border-left:1px solid rgba(10,42,90,.3)}:host .users-container .users-container-inner .user-count-container .date-title{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;font-size:.672rem;position:relative}:host .users-container .users-container-inner .user-count-container .date-title cds-icon{cursor:pointer}:host .users-container .users-container-inner .user-count-container .date-title .date-select-input{visibility:hidden;width:0;position:absolute;top:0;left:0}:host .users-container .users-container-inner .user-count-container .user-count{font-size:2.184rem}:host .users-container .users-container-inner .user-count-title{padding-left:6px;text-align:left;font-size:.756rem;color:#0a2a5a99;-ms-flex-item-align:end;-webkit-align-self:flex-end;-moz-align-self:flex-end;align-self:flex-end}:host .users-container .users-container-inner .button-container{margin-left:auto;-ms-flex-item-align:end;-webkit-align-self:flex-end;-moz-align-self:flex-end;align-self:flex-end}:host .users-container .users-container-inner .button-container button:last-child{margin-right:0}
`;var ke=`<div class="modal-header d-flex flex-column align-items-start">
  <span class="text-lg">{{workplanName}}</span>
  <span class="text-sm fw-medium">{{dateTime | date:'medium'}}</span>
</div>
<div class="modal-body bg-color-background">
  <div class="row">
    <div class="col-12 col-lg-3">
      <div class="row">
        <div class="col-12 d-flex flex-column">
          <label class="report-form-label mb-2">{{'PACS.USER_SEARCH' | translate}}</label>
          <armon-search-text-input [(ngModel)]="request.filter" [maxLength]="20" [minLength]="3"
            (ngModelChange)="filterChanged($event)" placeholder="COMMON.SEARCH"></armon-search-text-input>
        </div>
      </div>
    </div>
    <div class="col-12 col-lg-9">
      <div class="row py-1 mh-vh-60 mxh-vh-60 overflow-y-auto" id="workplan-employee-list-scroll-container">
        <div class="col-md-6 col-sm-12 mb-2" *ngFor="let employee of employees">
          <div class="p-2 d-flex flex-column b-1 rounded-2 bg-white p-3">
            <armon-captionlines *ngIf="employee.captionLines" [captionlines]="employee.captionLines" showBorder="false">
            </armon-captionlines>
            <div class="d-flex mt-2 text-sm align-items-center" *ngIf="employee.range">
              <cds-icon shape="calendar" class="me-2"></cds-icon>
              <ng-container *ngIf="!employee.range.startDateTime && !employee.range.endDateTime">
                {{'COMMON.CONTINUOUS'|translate}}</ng-container>
              <ng-container *ngIf="employee.range.startDateTime || employee.range.endDateTime">
                <span *ngIf="employee.range.startDateTime">{{employee.range.startDateTime| date:'medium'}} - </span>
                <span *ngIf="!employee.range.startDateTime">... - </span>
                <span *ngIf="employee.range.endDateTime">{{employee.range.endDateTime| date:'medium'}}</span>
                <span *ngIf="!employee.range.endDateTime">...</span>
              </ng-container>
            </div>
          </div>
        </div>
        <div class="col-12 pt-5" *ngIf="employees.length==0">
          <nz-empty [nzNotFoundContent]="contentTpl" [nzNotFoundImage]="'./assets/images/empty/empty_list.png'">
            <ng-template #contentTpl>
              <span>{{'COMMON.NO_DATA'|translate}}</span>
            </ng-template>
          </nz-empty>
        </div>
      </div>
      <div class="row mt-3">
        <div class="col-xl-12">
          <armon-pagination [paginationResponse]="paginationResponse"
            [scrollDomId]="'workplan-employee-list-scroll-container'"
            (pageChanged)="pageChanged($event)"></armon-pagination>
        </div>
      </div>
    </div>
  </div>
</div>
<div class="modal-footer">
  <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>
</div>`;var ye=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}
`;var _e=function(a,e,t,o){var i=arguments.length,n=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,o);else for(var s=a.length-1;s>=0;s--)(r=a[s])&&(n=(i<3?r(n):i>3?r(e,t,n):r(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n},E=class extends j{pacsService;workplanId;workplanName;dateTime;accessControlPoint;request=ee.getEmptyModel();employees;paginationResponse=new Z;paginationRequest=new X;constructor(e){super(),this.pacsService=e}onModalInitialized(){super.onModalInitialized(),this.request.dateTime=this.dateTime,this.getList()}getList(){this.pacsService.getWorkplanEmployeeList(this.workplanId,this.request).subscribe(e=>{this.employees=e.items,this.paginationResponse=e.pagination})}pageChanged(e){this.request.pagination=e,this.getList()}filterChanged(e){this.request.pagination.skip=0,this.getList()}static ctorParameters=()=>[{type:u}];static propDecorators={workplanId:[{type:p}],workplanName:[{type:p}],dateTime:[{type:p}]}};E=_e([l({selector:"armon-pacs-workplan-employee-list",template:ke,standalone:!0,imports:[v,c,d,oe,ne,D,S,x,m],styles:[ye]})],E);var Ie=function(a,e,t,o){var i=arguments.length,n=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,o);else for(var s=a.length-1;s>=0;s--)(r=a[s])&&(n=(i<3?r(n):i>3?r(e,t,n):r(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n},T=class{router;pacsService;interactionService;routingService;authService;accessControlPointUserService;modalService;identitySelectionService;workplan;itemUpdated=new L;userCount;userCountTitle="DATEPICKER.LABEL_NOW";selectedDate=new Date;permissionAttendancePlanWrite;permissionIdentityEdit;constructor(e,t,o,i,n,r,s,we){this.router=e,this.pacsService=t,this.interactionService=o,this.routingService=i,this.authService=n,this.accessControlPointUserService=r,this.modalService=s,this.identitySelectionService=we}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(f.ATTENDANCEPLAN.getWrite()),this.permissionIdentityEdit=this.authService.checkPermission(f.IDENTITY.getEdit()),this.userCount=this.workplan.assignedUserCount}ngOnDestroy(){}gotoWorkplan(e){this.router.navigate([h.getPageRoute(this.workplan.type)],{queryParams:{id:this.workplan.id}})}deleteWorkplan(e){this.permissionAttendancePlanWrite!=!1&&this.interactionService.showDialog(this.workplan.name,"PACS.DIALOG_DELETE_WORKPLAN",null,null,!0,"BUTTON.DELETE","",!0,()=>{this.pacsService.deleteWorkplan(this.workplan.id).subscribe(()=>{this.itemUpdated.emit()},t=>{t&&t.status&&t.status===W.Conflict&&this.interactionService.showDialog(this.workplan.name,"PACS.DIALOG_DELETE_WORKPLAN_HAS_USER",null,null,!0,"BUTTON.DELETE","",!0,()=>{this.pacsService.deleteWorkplan(this.workplan.id,!0).subscribe(()=>{this.itemUpdated.emit()},o=>{})})})})}getEmployeeCount(e,t=!0){this.selectedDate=e,this.userCountTitle=t?P.fromJSDate(e).toLocaleString(P.DATETIME_MED):"DATEPICKER.LABEL_NOW",this.pacsService.getWorkplanEmployeeCount(this.workplan.id,e).subscribe(o=>{this.userCount=o})}getSessionIdForWorkplan(e){return this.identitySelectionService.getSessionForWorkplan(this.workplan.id,!1,e)}onRemoveEmployeeClicked(e){this.routingService.gotoWorkplanUpsertEmployee(this.workplan.id,this.workplan.type,!1)}onUpsertEmployeeClicked(e){this.routingService.gotoWorkplanUpsertEmployee(this.workplan.id,this.workplan.type,!0)}onShowVirtualACPUsersClicked(e){this.accessControlPointUserService.checkUserSelectionVirtualMobileCheckin(this.workplan.id)}onDateChanged(e){this.getEmployeeCount(e.value)}onEmployeeListClicked(e){this.userCount>0?this.modalService.open(E,{settings:{size:"xl",centered:!1},props:{workplanId:this.workplan.id,workplanName:this.workplan.name,dateTime:this.selectedDate}}).result.then(t=>{}).catch(t=>{}):this.interactionService.showMessage("PACS.DIALOG_WORKPLAN_NO_USER",null,M.Warning)}static ctorParameters=()=>[{type:k},{type:u},{type:V},{type:te},{type:C},{type:me},{type:U},{type:ce}];static propDecorators={workplan:[{type:p}],itemUpdated:[{type:z}]}};T=Ie([l({selector:"armon-pacs-workplan-list-item",template:he,standalone:!0,providers:[{provide:H,useClass:Q}],schemas:[A],imports:[O,c,ue,ae,ie,re,G,d,w,y,Y,b,m],styles:[ve]})],T);var Ne=function(a,e,t,o){var i=arguments.length,n=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,e,t,o);else for(var s=a.length-1;s>=0;s--)(r=a[s])&&(n=(i<3?r(n):i>3?r(e,t,n):r(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n},be=class{router;authService;pacsService;visibleComponent=!1;types=N;workplans=void 0;filterType=I.All;filterName=void 0;typeFilterOptions;permissionAttendancePlanWrite;constructor(e,t,o){this.router=e,this.authService=t,this.pacsService=o}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(f.ATTENDANCEPLAN.getWrite()),this.typeFilterOptions=R(N),this.typeFilterOptions.unshift(new h(I.All,"PACS.ALL")),this.getWorkplans()}ngOnDestroy(){}getWorkplans(){this.workplans=void 0;let e=new J;e.type=this.filterType,e.name=this.filterName,this.visibleComponent=!0,this.pacsService.getWorkplanList(e).subscribe(t=>{this.workplans=t.items})}refreshList(){this.getWorkplans()}addNewWorkplan(e,t){this.permissionAttendancePlanWrite!=!1&&this.router.navigate([h.getPageRoute(t.value)])}workplanTypeChanged(e){this.filterType=e.value,this.getWorkplans()}filterChanged(e){this.getWorkplans()}itemUpdated(e){this.refreshList()}static ctorParameters=()=>[{type:k},{type:C},{type:u}]};be=Ne([l({selector:"armon-pacs-workplan-list",template:fe,animations:[F("listAnimation",[q("* => *",[_(":enter",g({opacity:0}),{optional:!0}),_(":enter",K("100ms",[$("0.2s ease-in",B([g({opacity:0,transform:"translateY(10%)",offset:0}),g({opacity:.5,transform:"translateY(-3%)",offset:.3}),g({opacity:1,transform:"translateY(0)",offset:1})]))]),{optional:!0,delay:200})])])],standalone:!0,imports:[c,d,pe,se,de,S,le,w,b,x,v,y,T,m],styles:[ge]})],be);export{be as PacsWorkplanListComponent};
