import{b as q,c as Z,d as J,f as u,g as K}from"./chunk-SYO4PMIS.js";import{a as $}from"./chunk-R6MVWAVG.js";import{b as Y,c as B,d as X}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{J as F,Mb as V,f as R,g as G,l as A,wb as U}from"./chunk-YSQLW2JA.js";import{M as j,N as W,ja as c,w as l,y as d}from"./chunk-NVJ2ZZFT.js";import{Aa as O,Cc as w,Dc as f,Pd as g,Qf as h,Te as z,W as T,ab as k,bb as m,bh as H,dd as v,gg as y,hg as N,jg as L,wa as P,ya as p}from"./chunk-SKPDQO4E.js";var Q=`<div class="h-100">
  <side-navigation #sideNavigation>
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.ORGANIZATION_UNIT' | translate}}</label>
          <armon-select-search query="unit" [allowMulti]="false" [(ngModel)]="selectedOrganizationId"
            [allowClear]="true">
          </armon-select-search>
        </div>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="row">
        <div class="col-12">
          <armon-date-picker [options]="datePickerOptions" (selectionChanged)="onDateSelectionChanged($event)">
          </armon-date-picker>
        </div>
      </div>
      <div class="row" *ngIf="selectedOrganizationId">
        <div class="col-12">
          <armon-pacs-calendar-grid-organization [organizationId]="selectedOrganizationId"
            [selectedMonth]="selectedMonth"></armon-pacs-calendar-grid-organization>
        </div>
      </div>
      <div class="row mt-5" *ngIf="!selectedOrganizationId">
        <div class="col-12">
          <nz-empty [nzNotFoundContent]="contentTpl" [nzNotFoundImage]="'./assets/images/empty/search_generic.png'">
            <ng-template #contentTpl>
              <span> {{'PACS.CALENDAR_SELECT_ORGANIZATION_INFO'|translate}}</span>
            </ng-template>
          </nz-empty>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var ee="";var te=`<ng-container *ngIf="gridMonth">
    <div class="row">
        <div class="col-12">
            <app-grid-wrapper-component [grid]="gridMonth" [options]="gridMonthOptions"
                (onCellMouseEnter)="onCellMouseEnter($event)" (onCellMouseLeave)="onCellMouseLeave($event)"
                (onCellClicked)="onCellClicked($event)"></app-grid-wrapper-component>
        </div>
    </div>
</ng-container>`;var ae=`.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}
`;var ie=`<div class="tooltip-container p-3">
  <div class="row">
    <div class="col-12 pb-2">
      <span class="text-md text-bold">{{dayText}}</span>
    </div>
  </div>
  <div class="row mb-2 b-t-1" *ngIf="dataList && dataList.length > 0">
    <ng-container *ngFor="let data of dataList">
      <div class="col-12 d-flex flex-column py-1">
        <div class="d-flex align-items-center">
          <span class="text-xs">{{data.label|translate}}</span>
          <span class="text-md text-primary text-bold ms-auto">{{data.graphData.items[0].value}}</span>
          <span class="text-md text-black-50">/{{data.graphData.items[0].value + data.graphData.items[1].value}}</span>
        </div>
        <armon-percentage-graph [data]="data.graphData"></armon-percentage-graph>
      </div>
    </ng-container>
  </div>
</div>`;var oe=`.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}.tooltip-container{width:240px;background-color:#f5f5f5;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}
`;var me=function(n,e,i,o){var t=arguments.length,a=t<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,i,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(a=(t<3?r(a):t>3?r(e,i,a):r(e,i))||a);return t>3&&a&&Object.defineProperty(e,i,a),a},C=class{interactionService;sessionService;popoverRef;dayText;dataList;constructor(e,i,o){if(this.interactionService=e,this.sessionService=i,this.popoverRef=o,o){if(o.data.event.data.statistic){let t=o.data.event.data.statistic;this.dataList=[],this.dataList.push({graphData:this.createGraphData(t,d.Work,c.getColor(!0,l.AtWorkingHours)),label:"WIDGET.DAILY_PERSONNEL_WORKING"}),this.dataList.push({graphData:this.createGraphData(t,d.ExtraWork,c.getColor(!0,l.AtOutOfWorkingHours)),label:"WIDGET.DAILY_PERSONNEL_EXTRA_TIME"}),this.dataList.push({graphData:this.createGraphData(t,d.MissingWork,c.getColor(!1,l.AtWorkingHours)),label:"WIDGET.DAILY_PERSONNEL_MISSING_TIME"}),this.dataList.push({graphData:this.createGraphData(t,d.LateEntrance,c.getColor(!1,l.AtWorkingHours)),label:"WIDGET.DAILY_PERSONNEL_START_LATE"}),this.dataList.push({graphData:this.createGraphData(t,d.EarlyLeave,c.getColor(!1,l.AtWorkingHours)),label:"WIDGET.DAILY_PERSONNEL_EXIT_EARLY"}),this.dataList.push({graphData:this.createGraphData(t,d.OffTimePermission,c.getColor(!1,l.AtOffTimePermission)),label:"WIDGET.DAILY_PERSONNEL_PERMISSION_TIME"})}this.dayText=f.fromISO(o.data.event.data.day).toFormat("d MMMM EEEE")}}createGraphData(e,i,o){return{items:[{value:e.getTypeData(i)[0],color:o},{value:e.getTypeData(i)[1],color:"#FFFFFF"}]}}ngOnInit(){}static ctorParameters=()=>[{type:h},{type:g},{type:R,decorators:[{type:T}]}]};C=me([p({selector:"armon-pacs-calendar-grid-organization-tooltip",template:ie,standalone:!0,imports:[m,k,$,v],styles:[oe]})],C);var I={WIDTH:240};var fe=function(n,e,i,o){var t=arguments.length,a=t<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,i,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(a=(t<3?r(a):t>3?r(e,i,a):r(e,i))||a);return t>3&&a&&Object.defineProperty(e,i,a),a},E=class{routingService;interactionService;sessionService;reportService;popoverService;organizationId;selectedMonth;visibleComponent=!1;gridMonth;selectedMonthText;selectedMonthDateTime;selectedStartDateTime;selectedEndDateTime;gridMonthOptions={fontFamily:"Poppins",paddingX:0,cellHeight:100,percentageChartHeight:3,percentageChartMarginY:3,percentageChartShadow:!1};constructor(e,i,o,t,a){this.routingService=e,this.interactionService=i,this.sessionService=o,this.reportService=t,this.popoverService=a}ngOnInit(){this.getOrganizationSummary(this.organizationId)}ngOnChanges(e){e.organizationId&&!e.organizationId.isFirstChange()&&this.getOrganizationSummary(this.organizationId),e.selectedMonth&&!e.selectedMonth.isFirstChange()&&this.getOrganizationSummary(this.organizationId)}setMonth(){this.selectedMonthDateTime=f.fromISO(this.selectedMonth),this.selectedMonthText=this.selectedMonthDateTime.toFormat("LLLL yyyy"),this.selectedStartDateTime=this.selectedMonthDateTime.startOf("month").startOf("week"),this.selectedEndDateTime=this.selectedMonthDateTime.endOf("month").endOf("week")}getOrganizationSummary(e){if(this.setMonth(),this.popoverService.closeAll(),this.organizationId){let i=new j;i.startDateTime=this.selectedStartDateTime.toFormat("yyyy-MM-dd"),i.endDateTime=this.selectedEndDateTime.toFormat("yyyy-MM-dd"),this.reportService.getPacsDailyOrganizationSummary(this.organizationId,i).subscribe(o=>{this.createGridMonthData(o.statistics)})}}createGridMonthData(e){let i=new q;w.weekdays().forEach(t=>{let a=new Z;a.title=t,i.addColumn(a)});for(var o=this.selectedStartDateTime;o<this.selectedEndDateTime;){let t=new J;if(t.data={day:o.toFormat("yyyy-MM-dd"),dayDateTime:o},t.title=o.toFormat("d"),t.subTitle=o.toFormat("EEEE"),t.bgColor=o.toFormat("yyyy-MM")==this.selectedMonth?"#fdfdfd":"#ededed",t.opacity=o.toFormat("yyyy-MM")==this.selectedMonth?1:.4,t.clickable=!0,e){let a=e.find(r=>r.day==t.data.day);if(a){t.data.statistic=a;let r=new u,s=a.getTypeData(d.Work);r.addValue(s[0],c.getColor(!0,l.AtWorkingHours)),r.addValue(s[1],"#EEEEEE"),t.addPercentageChart(r);let S=new u,_=a.getTypeData(d.ExtraWork);S.addValue(_[0],c.getColor(!0,l.AtOutOfWorkingHours)),S.addValue(_[1],"#EEEEEE"),t.addPercentageChart(S);let D=new u,b=a.getTypeData(d.MissingWork);D.addValue(b[0],c.getColor(!1,l.AtWorkingHours)),D.addValue(b[1],"#EEEEEE"),t.addPercentageChart(D);let x=new u,M=a.getTypeData(d.OffTimePermission);x.addValue(M[0],c.getColor(!1,l.AtOffTimePermission)),x.addValue(M[1],"#EEEEEE"),t.addPercentageChart(x)}}i.addCell(t),o=o.plus({days:1})}this.gridMonth=i}popoverReference;onCellClicked(e){this.popoverService.closeAll();let i=W.getEmptyModel();i.organizationUnitIds=[this.organizationId],this.routingService.gotoReportPacsDaily(e.data.day,{idBasedUserFilter:i})}onCellMouseEnter(e){this.popoverReference=this.popoverService.openGlobalPositon({content:C,width:I.WIDTH,height:0,left:e.posX-I.WIDTH-10,top:e.posY-10,data:{event:e}})}onCellMouseLeave(e){this.popoverReference&&this.popoverReference.close()}static ctorParameters=()=>[{type:V},{type:h},{type:g},{type:F},{type:G}];static propDecorators={organizationId:[{type:O}],selectedMonth:[{type:O}]}};E=fe([p({selector:"armon-pacs-calendar-grid-organization",template:te,standalone:!0,imports:[m,K],styles:[ae]})],E);var ge=function(n,e,i,o){var t=arguments.length,a=t<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(n,e,i,o);else for(var s=n.length-1;s>=0;s--)(r=n[s])&&(a=(t<3?r(a):t>3?r(e,i,a):r(e,i))||a);return t>3&&a&&Object.defineProperty(e,i,a),a},re=class{interactionService;sessionService;visibleComponent=!1;selectedOrganizationId;datePickerOptions=new N;selectedMonth;sideNavigation;constructor(e,i){this.interactionService=e,this.sessionService=i}ngOnInit(){this.datePickerOptions.items=[{type:y.PreviousMonth},{type:y.CurrentMonth,selected:!0},{type:y.SelectMonth}];let e=L.getDateSelection(this.datePickerOptions.items[1]);this.setDateSelection(e)}setDateSelection(e){this.selectedMonth=f.fromJSDate(e.startDate).toFormat("yyyy-MM")}onDateSelectionChanged(e){this.setDateSelection(e)}static ctorParameters=()=>[{type:h},{type:g}];static propDecorators={sideNavigation:[{type:P,args:["sideNavigation"]}]}};re=ge([p({selector:"armon-pacs-calendar-organization-grid",template:Q,standalone:!0,imports:[X,Y,U,z,B,A,m,E,H,v],styles:[ee]})],re);export{re as PacsCalendarOrganizationGridComponent};
