import{c as q}from"./chunk-CYRQZGFX.js";import{e as V}from"./chunk-RBSSJWML.js";import"./chunk-MFZ3EXVF.js";import"./chunk-R6MVWAVG.js";import"./chunk-SDHD5Z3H.js";import"./chunk-ZDEKLPKE.js";import"./chunk-VQU52MNH.js";import"./chunk-MXSLISEG.js";import"./chunk-JNXLVPIF.js";import"./chunk-PWALQELY.js";import"./chunk-3GSDFESG.js";import"./chunk-7QEXVS2A.js";import"./chunk-FSCI3FDB.js";import"./chunk-D4RZOGGF.js";import"./chunk-PMJFQIXL.js";import"./chunk-MNVOJIXC.js";import"./chunk-IMWNGRKR.js";import"./chunk-5WJM4RWS.js";import"./chunk-UZB7YFT6.js";import"./chunk-HXEFMD5A.js";import"./chunk-KCLQIV7M.js";import"./chunk-5KCUTXXV.js";import"./chunk-C7NDY7PV.js";import"./chunk-JUDWAYYT.js";import"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as H,c as K,d as $}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as z}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as G,Kb as F,Ob as j,a as te,c as l,d as T,h as x,j as w,l as L,o as M,wb as W}from"./chunk-YSQLW2JA.js";import{ja as p,ka as U,w as A}from"./chunk-NVJ2ZZFT.js";import{Dc as c,De as _,Fb as E,Qf as I,S as v,Te as h,Vc as O,ab as f,bb as y,cd as b,dc as k,dd as g,fb as C,g as ee,gg as S,hd as P,hg as D,jg as R,mg as N,wa as u,ya as d}from"./chunk-SKPDQO4E.js";var B=`<div class="h-100">
  <side-navigation #sideNavigation>
    <ng-template side-navigation-nav>
      <div *ngIf="filter">
        <div class="row">
          <div class="col-12 mb-3" *ngIf="paginationResponse">
            <div class="w-100 d-flex flex-column px-3 py-2 rounded-2 count-container"
              [ngStyle]="{'border-color': filterColor}">
              <div class="text-xxxl line-height-xxxl text-primary fw-light">{{paginationResponse.total}}</div>
              <div class="text-sm text-primary">{{filterText|translate}}</div>
            </div>
          </div>
          <div class="col-12 mb-3">
            <armon-employee-status-input [(ngModel)]="filter.employeeStatusAtSegment"></armon-employee-status-input>
          </div>
          <div class="col-12">
            <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
            <armon-select-search query="unit" [allowMulti]="true"
              [(ngModel)]="filter.idBasedUserFilter.organizationUnitIds">
            </armon-select-search>
            <label class="report-checkbox-label" nz-checkbox
              *ngIf="filter.idBasedUserFilter.organizationUnitIds && filter.idBasedUserFilter.organizationUnitIds.length > 0"
              [(ngModel)]="filter.idBasedUserFilter.applyOrganizationUnitFilterHierarchically">{{'REPORT.SHOW_HIERARCHICALLY'|
              translate}}</label>
          </div>
        </div>

        <!-- Buttons for filtering state -->
        <div class="centered filterButtons">
          <button class="btn btn-success btn-sm me-2" (click)="onGetExcelClicked($event)">{{'BUTTON.EXCEL' |
            translate}}</button>
          <button class="btn btn-primary btn-sm" (click)="onGetReportClicked($event)">{{'REPORT.GET_REPORT' |
            translate}}</button>
        </div>

      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row report-filter-container">
          <div class="col-12" style="min-height:0;">
            <armon-report-template-panel [reportType]="reportTemplateType" [templateId]="reportTemplateId"
              class="d-none d-md-block" [filter]="filter" (templateLoaded)="onTemplateLoaded($event)">
            </armon-report-template-panel>
            <div class="row">
              <div class="col-12">
                <armon-date-picker #datePicker [options]="datePickerOptions"
                  (selectionChanged)="onDateSelectionChanged($event)">
                </armon-date-picker>
              </div>
            </div>
          </div>
          <div class="col-12">
            <div class="row">
              <div class="col-12">
                <armon-sorting-picker #sortingPicker [data]="sortingPickerData"
                  (selectionChanged)="onSortingSelectionChanged($event)">
                </armon-sorting-picker>
              </div>
            </div>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-12">
            <ng-container *ngFor="let record of records">
              <armon-report-pacs-daily-user [record]="record" [day]="selectedDay"></armon-report-pacs-daily-user>
            </ng-container>
          </div>
          <div class="col-12 mb-3 mt-3">
            <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var J=`.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}.count-container{border-left:solid .49rem #999;background-color:#fff}
`;var Z=ee(te());var Y=`<ng-container>
  <label class="report-form-label">{{'REPORT.WORKING_STATUS' | translate}}</label>
  <select [(ngModel)]="filter.working" (ngModelChange)="onWorkingChanged($event)" class="form-select form-select-sm">
    <option *ngFor="let workingItem of workingList" [ngValue]="workingItem.type">{{workingItem.description |
                    translate}}</option>
  </select>
  <label class="report-form-label">{{'REPORT.WORKING_PERIOD' | translate}}</label>
  <select [(ngModel)]="filter.status" (ngModelChange)="onStatusChanged($event)" class="form-select form-select-sm">
    <option *ngFor="let statusItem of statusList" [ngValue]="statusItem.type">{{statusItem.description |
                    translate}}</option>
  </select>
  <label class="report-form-label">{{'REPORT.WORKING_IN_REGION' | translate}}</label>
  <select [(ngModel)]="filter.inRegion" (ngModelChange)="onInRegionChanged($event)"
    class="form-select form-select-sm">
    <option *ngFor="let inRegionItem of inRegionList" [ngValue]="inRegionItem.type">{{inRegionItem.description |
                    translate}}</option>
  </select>
</ng-container>`;var X="";var se=function(s,e,i,o){var r=arguments.length,t=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,o);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(t=(r<3?n(t):r>3?n(e,i,t):n(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},ae={provide:_,useExisting:v(()=>m),multi:!0},m=class{onChange;filter;workingList;statusList=k(q);inRegionList;constructor(){}writeValue(e){e&&(this.filter=e)}registerOnChange(e){this.onChange=e}registerOnTouched(e){}setDisabledState(e){}ngOnInit(){this.workingList=[{type:!0,description:"WIDGET.CURRENT_PERSONNEL_WORKING"},{type:!1,description:"WIDGET.CURRENT_PERSONNEL_NOT_WORKING"}],this.statusList.unshift({type:null,description:"COMMON.ALL"}),this.inRegionList=[{type:!0,description:"WIDGET.CURRENT_PERSONNEL_WORKING_IN_REGION"},{type:!1,description:"WIDGET.CURRENT_PERSONNEL_WORKING_OUT_REGION"}]}onWorkingChanged(e){this.onChange(this.filter)}onStatusChanged(e){this.onChange(this.filter)}onInRegionChanged(e){this.onChange(this.filter)}static ctorParameters=()=>[]};m=se([d({selector:"armon-employee-status-input",providers:[ae],template:Y,standalone:!0,imports:[h,N,f,g],styles:[X]})],m);var le=function(s,e,i,o){var r=arguments.length,t=r<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,i):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(s,e,i,o);else for(var a=s.length-1;a>=0;a--)(n=s[a])&&(t=(r<3?n(t):r>3?n(e,i,t):n(e,i))||t);return r>3&&t&&Object.defineProperty(e,i,t),t},Q=class{interactionService;reportService;pacsService;translate;route;authService;records;filter;useAsHumanResources=!1;paginationResponse;datePicker;datePickerOptions=new D;reportTemplateType=T.InstantAttendanceStatus;reportTemplateId;selectedDay;filterText="";filterColor="";sortingPicker;sortingPickerData;constructor(e,i,o,r,t,n){this.interactionService=e,this.reportService=i,this.pacsService=o,this.translate=r,this.route=t,this.authService=n}ngOnInit(){this.useAsHumanResources=this.authService.checkPermission(P.PPERMISSION.getHRApprovement()),this.datePickerOptions.items=[{type:S.Now,selected:!0},{type:S.SelectMoment,max:c.local().toJSDate()}],this.createFilter(),this.filter.sortOrder=O.ASC,this.filter.sortType=p.getDefaultSortType(this.filter.employeeStatusAtSegment.working,this.filter.employeeStatusAtSegment.status),this.sortingPickerData=this.pacsService.getDefaultSortingPickerData(this.filter.sortType)}ngAfterViewInit(){this.route.queryParams.subscribe(e=>{e&&e[l.Date]&&e[l.Date]!=""?this.setDateSelection(this.datePicker.setPickerItemAndDate(1,c.fromISO(e[l.Date]).toJSDate())):this.setDateSelection(R.getDateSelection(this.datePickerOptions.items[0])),e[l.ReportTemplateId]&&e[l.ReportTemplateId]!=""&&(this.reportTemplateId=e[l.ReportTemplateId]),this.reportTemplateId||this.fetchReportData()})}createFilter(){this.filter=U.getEmptyModel(),this.setDateSelection(R.getDateSelection(this.datePickerOptions.items[0]))}setDateSelection(e){this.filter.dateTime=e.startDate,this.selectedDay=c.fromJSDate(this.filter.dateTime).toFormat("yyyy-MM-dd")}setSortingSelection(e,i){this.filter.sortType=e,this.filter.sortOrder=i}onGetReportClicked(e){this.filter.paginationRequest.skip=0,this.fetchReportData()}onGetExcelClicked(e){this.pacsService.getEmployeeListDistributionAsExcel(this.filter).subscribe(i=>{this.translate.get(["PAGES.REPORT_PACS_MOMENT_SUMMARY"]).subscribe(o=>{Z.default.saveAs(i,o["PAGES.REPORT_PACS_MOMENT_SUMMARY"]+" "+c.fromJSDate(this.filter.dateTime).toLocaleString(c.DATE_HUGE)+".xlsx")})})}fetchReportData(){this.pacsService.getEmployeeListDistribution(this.filter).subscribe(e=>{this.records=e.items,this.paginationResponse=e.paginationResponse,this.filter.employeeStatusAtSegment.status?(this.filterText=p.getTitle(this.filter.employeeStatusAtSegment.working,this.filter.employeeStatusAtSegment.status,this.filter.employeeStatusAtSegment.inRegion),this.filterColor=p.getColor(this.filter.employeeStatusAtSegment.working,this.filter.employeeStatusAtSegment.status,this.filter.employeeStatusAtSegment.inRegion)):(this.filterText=this.filter.employeeStatusAtSegment.working?"WIDGET.CURRENT_PERSONNEL_WORKING":"WIDGET.CURRENT_PERSONNEL_NOT_WORKING",this.filterColor=p.getColor(this.filter.employeeStatusAtSegment.working,A.AtWorkingHours,this.filter.employeeStatusAtSegment.inRegion))})}pageChanged(e){this.filter.paginationRequest.skip=e.skip,this.filter.paginationRequest.take=e.take,this.fetchReportData()}onDateSelectionChanged(e){this.filter.paginationRequest.skip=0,this.setDateSelection(e),this.fetchReportData()}onSortingSelectionChanged(e){this.filter.paginationRequest.skip=0,this.setSortingSelection(e.value,e.direction),this.fetchReportData()}onTemplateLoaded(e){e.filter&&(this.createFilter(),Object.assign(this.filter,e.filter),this.sortingPicker&&e.filter.sortOrder&&e.filter.sortType&&(this.filter.sortOrder=e.filter.sortOrder,this.filter.sortType=e.filter.sortType,this.sortingPicker.setSelection(e.filter.sortType,e.filter.sortOrder))),setTimeout(()=>{this.fetchReportData()},1e3)}static ctorParameters=()=>[{type:I},{type:G},{type:w},{type:b},{type:E},{type:j}];static propDecorators={datePicker:[{type:u,args:["datePicker"]}],sortingPicker:[{type:u,args:["sortingPicker"]}]}};Q=le([d({selector:"armon-report-pacs-moment",template:B,standalone:!0,imports:[$,H,y,C,m,h,W,M,K,F,L,x,f,V,z,g],styles:[J]})],Q);export{Q as ReportPacsMomentComponent};
