import{b as E}from"./chunk-5DQKN4SL.js";import{a as ae}from"./chunk-G7OJYPNY.js";import{a as pe}from"./chunk-5OT2MLHH.js";import{a as f}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as ce}from"./chunk-4MZCYQX4.js";import{b as ne,c as se,d as le}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as P}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as u,Ob as R,a as ye,h as Y,i as $,l as J,m as X,o as Z,s as Q,v as ee,wb as ie,y as te}from"./chunk-YSQLW2JA.js";import{Eb as M,Xb as C,Yb as oe,Zb as A,x as O}from"./chunk-NVJ2ZZFT.js";import{Aa as p,Ba as U,Dc as a,Mg as S,Nc as D,Ng as y,Pd as F,Qf as x,Rd as K,Sd as j,Te as b,Vc as H,ab as k,af as q,bb as m,bf as T,bh as re,cd as G,dc as L,dd as h,g as Se,gg as l,ha as W,hd as g,hg as B,jg as V,wa as v,wc as _,ya as d}from"./chunk-SKPDQO4E.js";var de=`<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.WORKPLANS' | translate}}</label>
          <armon-select-search query="workplan" [allowMulti]="true" [(ngModel)]="filter.userFilter.workPlanIds">
          </armon-select-search>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.EMPLOYEES' | translate}}</label>
          <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="filter.userFilter.userIds">
          </armon-select-search>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
          <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="filter.userFilter.organizationUnitIds">
          </armon-select-search>
          <label class="report-checkbox-label" nz-checkbox
            *ngIf="filter.userFilter.organizationUnitIds && filter.userFilter.organizationUnitIds.length > 0"
            [(ngModel)]="filter.userFilter.applyOrganizationUnitFilterHierarchically">{{'REPORT.SHOW_HIERARCHICALLY' |
            translate}}</label>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.USER_GROUPS' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="filter.userFilter.userGroupIds">
          </armon-select-search>
        </div>
        <div class="col-12 mb-1 mt-2" *ngIf="filter">
          <label class="report-form-label">{{'REPORT.USER_STATUS' | translate}}</label>
          <armon-identity-status [(ngModel)]="filter.userFilter.userOrganizationStatus"></armon-identity-status>
        </div>
      </div>
      <!-- Buttons for filtering state -->
      <div class="centered filterButtons">
        <button nz-dropdown [nzDropdownMenu]="menuPrint" class="btn btn-success btn-sm me-2">
          {{'BUTTON.DOWNLOAD' | translate}}
          <cds-icon shape="angle" direction="down"></cds-icon>
        </button>
        <nz-dropdown-menu #menuPrint="nzDropdownMenu">
          <ul nz-menu>
            <li nz-menu-item (click)="onGetExcelClicked($event)">
              {{'REPORT.PACS_EXCEL_MONTHLY_WORKING_HOURS'|translate}}</li>
            <li nz-menu-item (click)="onGetExtraHoursExcelClicked($event)">
              {{'REPORT.PACS_EXCEL_MONTHLY_EXTRA_HOURS'|translate}}</li>
          </ul>
        </nz-dropdown-menu>
        <button class="btn btn-primary btn-sm" (click)="onGetReportClicked($event)">{{'REPORT.GET_REPORT' |
          translate}}</button>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row report-filter-container">
          <div class="col-12" style="min-height:0;">
            <div class="row">
              <div class="col-12">
                <armon-date-picker [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 [data]="sortingPickerData" (selectionChanged)="onSortingSelectionChanged($event)">
                </armon-sorting-picker>
              </div>
            </div>
          </div>
          <div class="col-12">
            <div class="row" *ngIf="!isCurrentMonth && enabledApprovement">
              <div class="col-12">
                <armon-report-pacs-summary-approve-month #approveMonth [period]="selectedPeriod">
                </armon-report-pacs-summary-approve-month>
              </div>
            </div>
          </div>
        </div>
        <div class="row" *ngIf="isCurrentMonth">
          <div class="col-12">
            <div class="alert alert-warning" role="alert">
              {{'REPORT.PACS_CURRENT_MONTH_NO_UPDATE'|translate}}
            </div>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-12">
            <p-table [value]="records" dataKey="user.id" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th *ngIf="enabledApprovement">{{'REPORT.PACS_CHECKED_STATUS' | translate}}</th>
                  <th>{{'REPORT.PACS_COL_USER' | translate}}</th>
                  <th>{{'PACS.SEGMENT_WORKING_ON_WORKINGHOURS'|translate}}</th>
                  <th>{{'PACS.SEGMENT_WORKING_OUT_WORKINGHOURS'|translate}}</th>
                  <th>{{'REPORT.PACS_COL_TOTAL_WORK'|translate}}</th>
                  <th>{{'PACS.SEGMENT_NOT_WORKING_ON_WORKINGHOURS'|translate}}</th>
                  <th>{{'REPORT.PACS_COL_EXPECTED_WORK'|translate}}</th>
                </tr>
              </ng-template>
              <ng-template pTemplate="body" let-record let-rowData let-expanded="expanded">
                <tr class="data-row" [pRowToggler]="enabledApprovement?rowData:null"
                  [attr.expanded]="enabledApprovement?expanded:null">
                  <td *ngIf="enabledApprovement">
                    <span *ngIf="record.isChecked" class="checked-ok">
                      <cds-icon shape="success-standard" solid class="me-2" size="sm"></cds-icon>
                      {{'REPORT.PACS_CHECKED_STATUS_OK' | translate}}
                    </span>
                    <span *ngIf="!record.isChecked" class="checked-not">
                      <cds-icon shape="help" solid class="me-2" size="sm"></cds-icon>
                      {{'REPORT.PACS_CHECKED_STATUS_NOT_YET' | translate}}
                    </span>
                  </td>
                  <td>
                    <armon-captionlines [showBorder]="false" *ngIf="record.user.captionLines"
                      [captionlines]="record.user.captionLines">
                    </armon-captionlines>
                    <span class="text-sm" *ngIf="!record.user.captionLines">{{record.user.fullname}}</span>
                  </td>
                  <td>
                    {{record.data.normalWorkDuration | minuteFormatter}}
                    <div *ngIf="expanded" class="d-flex flex-column mt-2">
                      <span class="text-xs">{{'COMMON.RAW_DATA'|translate}}</span>
                      <span class="text-xs">{{record.rawData.normalWorkDuration | minuteFormatter}}</span>
                    </div>
                  </td>
                  <td>
                    {{record.data.extraWorkDuration | minuteFormatter}}
                    <div *ngIf="expanded" class="d-flex flex-column mt-2">
                      <span class="text-xs">{{'COMMON.RAW_DATA'|translate}}</span>
                      <span class="text-xs">{{record.rawData.extraWorkDuration | minuteFormatter}}</span>
                    </div>
                  </td>
                  <td>
                    {{record.data.totalWorkDuration | minuteFormatter}}
                    <div *ngIf="expanded" class="d-flex flex-column mt-2">
                      <span class="text-xs">{{'COMMON.RAW_DATA'|translate}}</span>
                      <span class="text-xs">{{record.rawData.totalWorkDuration | minuteFormatter}}</span>
                    </div>
                  </td>
                  <td>
                    {{record.data.missedWorkDuration | minuteFormatter}}
                    <div *ngIf="expanded" class="d-flex flex-column mt-2">
                      <span class="text-xs">{{'COMMON.RAW_DATA'|translate}}</span>
                      <span class="text-xs">{{record.rawData.missedWorkDuration | minuteFormatter}}</span>
                    </div>
                  </td>
                  <td>
                    {{record.expectedWorkDuration | minuteFormatter}}
                    <div *ngIf="expanded" class="d-flex flex-column mt-2">
                      <span class="text-xs">{{'COMMON.RAW_DATA'|translate}}</span>
                      <span class="text-xs">{{record.expectedWorkDuration | minuteFormatter}}</span>
                    </div>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-record>
                <tr>
                  <td [attr.colspan]="enabledApprovement ? 7 : 6" class="expanded-row">
                    <armon-report-pacs-summary-history [record]="record" [period]="selectedPeriod"
                      (recordUpdated)="onRecordUpdated($event)" [isCurrentMonth]="isCurrentMonth"
                      [enabledApprovement]="enabledApprovement">
                    </armon-report-pacs-summary-history>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-12 mt-5" *ngIf="records && records.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 class="col-12 mb-2">
            <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var me=`.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}.filterArea{background:#fff;border:1px solid rgb(235,235,235);padding:12px;border-radius:4px;box-shadow:0 3px 6px #ebebeb;-moz-transition:width .25s ease;-webkit-transition:width .25s ease;-o-transition:width .25s ease;transition:width .25s ease}.filterArea>div:first-child>p:first-child{margin-top:0}.filterSummary>p:first-child{margin-top:0}.filterContent>div{margin-bottom:12px}.filterContent clr-checkbox{margin-top:12px}.filterButtons{margin-top:12px}.filterSmallButtons>button:last-child{margin-right:0!important}.filterMoreInfo p{margin-top:0}.filterMoreInfo div{margin-bottom:8px}.filterMoreInfo div:last-child{margin-bottom:0}.resultArea{position:relative}.resultDisabled{position:absolute;width:100%;height:100%;background:linear-gradient(to top,#f3f4f6,transparent 150%)}.required:after{content:"*";font-size:1.1em;color:#c92100;margin-left:6px}.report-data-container{height:100%;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}.report-data-container .report-filter-container{margin-bottom:.2rem}.report-data-container .report-data-table-container{overflow-y:auto;overflow-x:hidden;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;height:0;display:block}.report-multi-data-cell{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;line-height:initial!important}.report-multi-data-cell .title-text{font-size:1.008rem}.report-multi-data-cell .main-text{font-size:.84rem}.report-multi-data-cell .sub-text{font-size:.672rem;color:#aaa}.report-form-label{font-size:.672rem;line-height:.84rem;font-weight:500;margin-top:.3rem;margin-bottom:.1rem!important}.report-form-label label{margin-bottom:0!important}.report-form-icon{position:absolute;color:#0a2a5a;right:15px;bottom:6px;cursor:pointer}.report-checkbox-label{font-size:.672rem}:host .checked-ok cds-icon{color:#62a325}:host .checked-not cds-icon{color:#ccc}:host .data-row[checked=true]{background-color:#62a3250d}:host .history-items-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;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}:host .history-items-container .history-item{border-top:1px solid #CCC;padding:6px 0;font-size:.672rem}:host .history-items-container .history-item .history-numbers{color:#0a2a5a;font-size:.588rem}:host .history-items-container .history-item .history-notes{font-size:.588rem}
`;var z=Se(ye());var he=`<div class="d-flex flex-column px-2">\r
  <div class="d-flex my-2">\r
    <button class="btn btn-sm btn-primary me-2"\r
      *ngIf="permissionAttendancePlanWrite && enabledApprovement && !isCurrentMonth"\r
      (click)="updateUserDataClicked($event)">{{'BUTTON.UPDATE' | translate}}</button>\r
    <button class="btn btn-sm btn-outline-primary" *ngIf="enabledApprovement && !isCurrentMonth"\r
      (click)="showHistoryClicked($event)">{{'COMMON.UPDATE_HISTORY' | translate}}</button>\r
  </div>\r
</div>\r
\r
<ng-template #historyDrawerTemplate let-data let-drawerRef="historyDrawerRef">\r
  <div class="d-flex flex-column w-100">\r
    <div class="row mb-3">\r
      <div class="col-12 d-flex">\r
        <span class="text-lg">{{'COMMON.UPDATE_HISTORY' | translate}}</span>\r
        <div class="spinner-grow spinner-grow-sm ms-2" role="status" *ngIf="!items"></div>\r
      </div>\r
    </div>\r
    <ng-container *ngIf="items && items.length>0">\r
      <ng-container *ngFor="let item of items">\r
        <div class="row shadow-box-1 rnd-1 m-2 py-3">\r
          <div class="col-md-6 col-12">\r
            <armon-captionlines *ngIf="item.updatedBy.captionLines" [showBorder]="false"\r
              [captionlines]="item.updatedBy.captionLines">\r
            </armon-captionlines>\r
          </div>\r
          <div class="col-md-6 col-12 d-flex flex-column">\r
            <span class="text-sm">{{'PACS.SEGMENT_WORKING_ON_WORKINGHOURS'|translate}} :\r
              <strong>{{item.normalWorkDuration | minuteFormatter}}</strong></span>\r
            <span class="text-sm">{{'PACS.SEGMENT_WORKING_OUT_WORKINGHOURS'|translate}} :\r
              <strong>{{item.extraWorkDuration | minuteFormatter}}</strong></span>\r
            <span class="text-sm">{{'PACS.SEGMENT_NOT_WORKING_ON_WORKINGHOURS'|translate}} :\r
              <strong>{{item.missedWorkDuration | minuteFormatter}}</strong></span>\r
            <span class="text-xs mt-2">{{item.updatedAtText}}</span>\r
            <span class="text-xs text-italic mt-1"\r
              *ngIf="item.note"><strong>{{'PACS.WORKPLAN_APPROVE_NOTE'|translate}}</strong> : {{item.note}}</span>\r
          </div>\r
        </div>\r
      </ng-container>\r
      <div class="row">\r
        <div class="col-12">\r
          <armon-pagination [paginationResponse]="paginationResponse" (pageChanged)="pageChanged($event)">\r
          </armon-pagination>\r
        </div>\r
      </div>\r
    </ng-container>\r
    <ng-container *ngIf="items && items.length==0">\r
      <div class="row">\r
        <div class="col-12">\r
          <span class="text-sm text-italic">{{'REPORT.PACS_NO_HISTORY' | translate}}</span>\r
        </div>\r
      </div>\r
    </ng-container>\r
  </div>\r
</ng-template>`;var ue=`.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 .approve-month-container{background:#f7fbfc;border:1px solid #cde1ec;padding:12px;border-radius:4px;box-shadow:0 3px 6px #ebebeb}:host .approve-base,:host .approve-not-finalized,:host .approve-finalized{display:inline;font-size:.714rem;padding:6px;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}:host .approve-finalized{background-color:#88a8251a;color:#88a825}:host .approve-not-finalized{background-color:#cf4a301a;color:#cf4a30}:host .history-item{font-size:.714rem}:host .history-item-system{font-size:.714rem}:host .history-note{font-size:.672rem;padding-left:24px}
`;var fe=`<ng-container *ngIf="visibleComponent">\r
  <div class="modal-header">\r
    <div class="d-flex flex-column">\r
      <span class="text-lg">{{'PACS.WORKPLAN_UPDATE_MONTH' | translate}}</span>\r
      <span class="text-md">{{year}} {{monthName}}</span>\r
    </div>\r
  </div>\r
  <div class="modal-body">\r
    <div class="row mb-4">\r
      <div class="col-12">\r
        <armon-captionlines *ngIf="record.user.captionLines" [showBorder]="false" [captionlines]="record.user.captionLines">\r
        </armon-captionlines>\r
      </div>\r
    </div>\r
    <div class="row">\r
      <div class="col-12">\r
        <div class="form-group">\r
          <div class="form-check">\r
            <input id="checkedInput" type="checkbox" [(ngModel)]="userDataChecked" name="checkedInput"\r
              class="form-check-input">\r
            <label class="form-check-label"\r
              for="checkedInput">{{'PACS.WORKPLAN_UPDATE_MONTH_CHECKED' | translate}}</label>\r
          </div>\r
        </div>\r
      </div>\r
      <div class="col-md-4 col-12">\r
        <div class="form-group">\r
          <label for="realizedWorkDurationInput">{{'PACS.SEGMENT_WORKING_ON_WORKINGHOURS' | translate}}</label>\r
          <div class="input-group input-group-sm">\r
            <input id="realizedWorkDurationInput" class="form-control" type="number" min="0" max="100000"\r
              [onlyNumber]="true" [(ngModel)]="userData.normalWorkDuration">\r
              <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
          </div>\r
        </div>\r
      </div>\r
      <div class="col-md-4 col-12">\r
        <div class="form-group">\r
          <label for="extraWorkDurationInput">{{'PACS.SEGMENT_WORKING_OUT_WORKINGHOURS' | translate}}</label>\r
          <div class="input-group input-group-sm">\r
            <input id="extraWorkDurationInput" class="form-control" type="number" min="0" max="100000"\r
              [onlyNumber]="true" [(ngModel)]="userData.extraWorkDuration">           \r
              <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
          </div>\r
        </div>\r
      </div>\r
      <div class="col-md-4 col-12">\r
        <div class="form-group">\r
          <label for="missedWorkDurationInput">{{'PACS.SEGMENT_NOT_WORKING_ON_WORKINGHOURS' | translate}}</label>\r
          <div class="input-group input-group-sm">\r
            <input id="missedWorkDurationInput" class="form-control" type="number" min="0" max="100000"\r
              [onlyNumber]="true" [(ngModel)]="userData.missedWorkDuration">           \r
              <span class="input-group-text">{{'PACS.WORKPLAN_PERIOD_UNIT_MINUTE'|translate}}</span>\r
          </div>\r
        </div>\r
      </div>\r
      <div class="col-12 mt-2">\r
        <div class="form-group">\r
          <label for="noteTextAreaInput">{{'PACS.WORKPLAN_UPDATE_MONTH_NOTE' | translate}}</label>\r
          <textarea name="note" id="noteTextArea" [(ngModel)]="userDataNote" rows="4" cols="20" style="resize:none"\r
            class="form-control form-control-sm" maxlength="512"></textarea>\r
        </div>\r
      </div>\r
    </div>\r
  </div>\r
  <div class="modal-footer">\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
</ng-container>`;var ve="";var De=function(s,e,t,o){var i=arguments.length,r=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(r=(i<3?n(r):i>3?n(e,t,r):n(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r},w=class extends j{interactionService;reportService;year;month;record;userData;userDataChecked;userDataNote;monthName;visibleComponent=!1;disableSaveButton=!0;constructor(e,t){super(),this.interactionService=e,this.reportService=t}onModalInitialized(){super.onModalInitialized(),this.userData=L(this.record.data?this.record.data:this.record.rawData),this.userDataChecked=this.record.isChecked?this.record.isChecked:!1,this.userDataNote="",this.monthName=a.fromObject({month:this.month}).toFormat("MMMM"),this.checkValidation(),this.visibleComponent=!0}cancelClicked(e){this.cancelModal()}saveClicked(e){let t={userId:this.record.user.id,year:this.year,month:this.month,checked:this.userDataChecked,working:this.userData,note:this.userDataNote};this.reportService.updatePacsMonthlyEmployeeData(t).subscribe(()=>{this.interactionService.showMessage("PACS.MESSAGE_UPDATE_WORKPLAN_MONTH",null,D.Success),this.closeModal()})}checkValidation(e){this.disableSaveButton=!1}static ctorParameters=()=>[{type:x},{type:u}];static propDecorators={year:[{type:p}],month:[{type:p}],record:[{type:p}]}};w=De([d({selector:"armon-report-pacs-summary-update",template:fe,standalone:!0,imports:[m,f,b,ae,h],styles:[ve]})],w);var Te=function(s,e,t,o){var i=arguments.length,r=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(r=(i<3?n(r):i>3?n(e,t,r):n(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r},N=class{modalService;authService;reportService;drawerService;record;enabledApprovement;isCurrentMonth;period;recordUpdated=new W;request;items;visibleComponent=!1;permissionAttendancePlanWrite=!1;paginationResponse=new y;paginationRequest=new S;historyDrawerTemplate;historyDrawerRef;constructor(e,t,o,i){this.modalService=e,this.authService=t,this.reportService=o,this.drawerService=i}ngOnChanges(e){}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(g.ATTENDANCEPLAN.getWrite()),this.request={pagination:{take:10,skip:0},userId:this.record.user.id,year:this.period.year,month:this.period.month}}refreshData(){}getData(){this.reportService.getPacsMonthlyEmployeeHistory(this.request).subscribe(e=>{this.items=e.items,this.paginationResponse=e.pagination})}pageChanged(e){this.request.pagination=e,this.getData()}updateUserDataClicked(e){this.permissionAttendancePlanWrite&&this.modalService.open(w,{settings:{size:"lg"},props:{year:this.period.year,month:this.period.month,record:this.record}}).result.then(t=>{this.recordUpdated.emit()}).catch(t=>{})}showHistoryClicked(e){this.historyDrawerRef=this.drawerService.create({nzContent:this.historyDrawerTemplate,nzClosable:!1,nzWidth:_(!1),nzContentParams:{value:""}}),setTimeout(()=>{this.request.skip=0,this.getData()},600)}static ctorParameters=()=>[{type:K},{type:R},{type:u},{type:E}];static propDecorators={record:[{type:p}],enabledApprovement:[{type:p}],isCurrentMonth:[{type:p}],period:[{type:p}],recordUpdated:[{type:U}],historyDrawerTemplate:[{type:v,args:["historyDrawerTemplate"]}]}};N=Te([d({selector:"armon-report-pacs-summary-history",template:he,standalone:!0,imports:[m,k,f,P,h,T],styles:[ue]})],N);var ge=`<div *ngIf="visibleComponent && monthStatus" class="approve-month-container my-2 p-2">
  <div class="row">
    <div class="col-md-6 col-12 d-flex align-items-center">
      <div>{{'PACS.WORKPLAN_APPROVE_MONTH_TITLE'|translate:period}}</div>
      <div class="ms-2">
        <div *ngIf="monthStatus.approved" class="approve-finalized">
          <cds-icon shape="check-circle" solid></cds-icon>
          <strong>{{'PACS.WORKPLAN_APPROVE_FINALIZED'|translate}}</strong>
        </div>
        <div *ngIf="!monthStatus.approved" class="approve-not-finalized">
          <cds-icon shape="exclamation-circle" solid></cds-icon>
          <strong>{{'PACS.WORKPLAN_APPROVE_NOT_FINALIZED'|translate}}</strong>
        </div>
      </div>
    </div>
    <div class="col-md-6 col-12">
      <div class="d-flex justify-content-end">
        <button class="btn btn-sm btn-outline-primary me-2" (click)="historyClicked($event)">
          {{'PACS.WORKPLAN_APPROVE_HISTORY_BUTTON' | translate}}
        </button>
        <button class="btn btn-sm btn-success" (click)="approveClicked($event)" *ngIf="permissionAttendancePlanWrite">
          {{'PACS.WORKPLAN_APPROVE_BUTTON' | translate}}
        </button>
      </div>
    </div>
  </div>
</div>

<ng-template #historyDrawerTemplate let-data let-drawerRef="historyDrawerRef">
  <div class="d-flex flex-column w-100" *ngIf="historyItems">
    <span class="text-lg mb-3">{{'PACS.WORKPLAN_APPROVE_HISTORY_BUTTON' | translate}}</span>
    <ng-container *ngIf="historyItems && historyItems.length>0">
      <div class="row shadow-box-1 rnd-1 m-2 py-3" *ngFor="let historyItem of historyItems">
        <div class="col-md-6 col-12">
          <armon-captionlines *ngIf="historyItem.updatedBy.captionLines" [showBorder]="false"
            [captionlines]="historyItem.updatedBy.captionLines">
          </armon-captionlines>
        </div>
        <div class="col-md-6 col-12 d-flex flex-column justify-content-center">
          <div class="d-flex mb-2 align-items-center">
            <cds-icon shape="check-circle" solid class="me-2 text-success" *ngIf="historyItem.isFinalized" size="sm">
            </cds-icon>
            <cds-icon shape="times-circle" solid class="me-2 text-danger" *ngIf="!historyItem.isFinalized" size="sm">
            </cds-icon>
            <span
              class="text-sm">{{(historyItem.isFinalized ? 'PACS.WORKPLAN_APPROVE_DATE_UPDATED' : 'PACS.WORKPLAN_APPROVE_DATE_REMOVED' ) | translate}}</span>
            <span class="text-sm ms-2">({{historyItem.updatedAtText}})</span>
          </div>
          <span class="text-xs text-italic"
            *ngIf="historyItem.note"><strong>{{'PACS.WORKPLAN_APPROVE_NOTE'|translate}}</strong> :
            {{historyItem.note}}</span>
        </div>
      </div>
      <div class="row" *ngIf="paginationResponse">
        <div class="col-12">
          <armon-pagination [paginationResponse]="paginationResponse" (pageChanged)="pageChanged($event)">
          </armon-pagination>
        </div>
      </div>
    </ng-container>
    <ng-container *ngIf="!historyItems || historyItems.length==0">
      <span class="text-xs">{{'PACS.WORKPLAN_APPROVE_NO_HISTORY' | translate}}</span>
    </ng-container>
  </div>
</ng-template>

<ng-template #approveDrawerTemplate let-data let-drawerRef="approveDrawerRef">
  <div class="row">
    <div class="col-12 mb-3">
      <span class="text-lg">{{'PACS.WORKPLAN_APPROVE_MONTH_TITLE'|translate:period}}</span>
    </div>
    <div class="col-12 my-3">
      <div class="form-group">
        <label>{{'PACS.WORKPLAN_APPROVE_NOTE'|translate}}</label>
        <textarea name="note" [(ngModel)]='request.note' rows="5" cols="20" maxlength="512"
          class="form-control form-control-sm"></textarea>
      </div>
    </div>
    <div class="col-12 d-flex justify-content-end">
      <button class="btn btn-outline-primary btn-sm me-2" (click)="cancelClicked($event)">
        {{'BUTTON.CANCEL' | translate}}
      </button>
      <button class="btn btn-success btn-sm" (click)="saveClicked($event)">
        <cds-icon shape="check-circle" solid></cds-icon>
        {{'PACS.WORKPLAN_APPROVE_BUTTON' | translate}}
      </button>
    </div>
  </div>
</ng-template>`;var be=`.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 .approve-month-container{background:tint(#0369a1,97%);border:1px solid tint(#0369a1,80%);border-radius:4px;box-shadow:0 3px 6px #ebebeb}:host .approve-base,:host .approve-not-finalized,:host .approve-finalized{display:inline;font-size:.672rem;padding:6px;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}:host .approve-finalized{background-color:#88a8251a;color:#88a825}:host .approve-not-finalized{background-color:#cf4a301a;color:#cf4a30}:host .history-item{font-size:.714rem}:host .history-item-system{font-size:.714rem}:host .history-note{font-size:.672rem;padding-left:24px}
`;var we=function(s,e,t,o){var i=arguments.length,r=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(r=(i<3?n(r):i>3?n(e,t,r):n(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r},I=class{authService;reportService;drawerService;interactionService;period;monthStatus=null;request;visibleComponent=!1;disableSaveButton=!0;permissionAttendancePlanWrite=!1;paginationResponse=new y;paginationRequest=new S;historyRequest;historyItems;historyDrawerTemplate;historyDrawerRef;approveDrawerTemplate;approveDrawerRef;constructor(e,t,o,i){this.authService=e,this.reportService=t,this.drawerService=o,this.interactionService=i}ngOnChanges(e){e.period.isFirstChange()||this.period&&this.getStatus(this.period.year,this.period.month)}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(g.ATTENDANCEPLAN.getWrite()),this.request=new M,this.refreshData()}refreshData(){this.period&&this.period.year&&this.period.month&&(this.visibleComponent=!1,this.getStatus(this.period.year,this.period.month))}getStatus(e,t){this.reportService.getPacsMonthlyApproveStatus(e,t).subscribe(o=>{this.monthStatus=o,this.monthStatus&&(this.visibleComponent=!0)})}approveClicked(e){this.permissionAttendancePlanWrite&&(this.approveDrawerRef=this.drawerService.create({nzContent:this.approveDrawerTemplate,nzClosable:!1,nzWidth:_(!0),nzContentParams:{value:""}}))}historyClicked(e){this.historyDrawerRef=this.drawerService.create({nzContent:this.historyDrawerTemplate,nzClosable:!1,nzWidth:_(!1),nzContentParams:{value:""}}),this.historyRequest={pagination:{take:10,skip:0}},this.getHistory()}getHistory(){this.reportService.getPacsMonthlyMonthHistory(this.period.year,this.period.month,this.historyRequest).subscribe(e=>{this.historyItems=e.items,this.paginationResponse=e.pagination})}saveClicked(e){this.permissionAttendancePlanWrite&&this.reportService.finalizePacsMonthlyStatus(this.period.year,this.period.month,this.request).subscribe(()=>{this.request=new M,this.getStatus(this.period.year,this.period.month),this.interactionService.showMessage("PACS.MESSAGE_APPROVE_MONTHLY_REPORT",null,D.Success),this.approveDrawerRef.close()})}cancelClicked(e){this.approveDrawerRef.close()}pageChanged(e){this.historyRequest.pagination=e,this.getHistory()}static ctorParameters=()=>[{type:R},{type:u},{type:E},{type:x}];static propDecorators={period:[{type:p}],historyDrawerTemplate:[{type:v,args:["historyDrawerTemplate"]}],approveDrawerTemplate:[{type:v,args:["approveDrawerTemplate"]}]}};I=we([d({selector:"armon-report-pacs-summary-approve-month",template:ge,standalone:!0,imports:[m,k,f,P,b,h],styles:[be]})],I);var Ne=function(s,e,t,o){var i=arguments.length,r=i<3?e:o===null?o=Object.getOwnPropertyDescriptor(e,t):o,n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(s,e,t,o);else for(var c=s.length-1;c>=0;c--)(n=s[c])&&(r=(i<3?n(r):i>3?n(e,t,r):n(e,t))||r);return i>3&&r&&Object.defineProperty(e,t,r),r},xe=class{interactionService;reportService;authService;sessionService;languageService;translate;filter;records;selectedPeriod;paginationResponse=new y;paginationRequest=new S;datePickerOptions=new B;permissionAttendancePlanWrite=!1;isCurrentMonth=!1;enabledApprovement=!1;approveMonth;sortingPickerData;constructor(e,t,o,i,r,n){this.interactionService=e,this.reportService=t,this.authService=o,this.sessionService=i,this.languageService=r,this.translate=n}ngOnInit(){this.permissionAttendancePlanWrite=this.authService.checkPermission(g.ATTENDANCEPLAN.getWrite()),this.createFilter(),this.datePickerOptions.items=[{type:l.PreviousMonth,selected:!0},{type:l.SelectMonth,max:a.local().endOf("month").toJSDate(),maxValidationText:"DATEPICKER.NOT_SELECTED_FUTURE_MONTH"},{type:l.CurrentYear,hasDivider:!0},{type:l.SelectYear,max:a.local().endOf("year").toJSDate(),maxValidationText:"DATEPICKER.NOT_SELECTED_FUTURE_YEAR"},{type:l.LastWeek,hasDivider:!0},{type:l.LastMonth},{type:l.Custom}],this.sortingPickerData={items:[{value:O.EmployeeName,label:"REPORT.SORTING_USERNAME",showDirection:!0,isAlpha:!0,directionDefault:$.ASC},{value:O.EmployeeUniqueId,label:"REPORT.SORTING_USER_UNIQUE_FIELD",showDirection:!0,labelTranslationData:{uniqueIdCaption:this.sessionService.currentOrganizationUniqueIdCaption?this.sessionService.currentOrganizationUniqueIdCaption:"-"}},{value:O.ExtraWork,label:"REPORT.SORTING_EXTRAWORK",showDirection:!0},{value:O.MissingWork,label:"REPORT.SORTING_MISSEDWORK",showDirection:!0}]},this.setSortingSelection({value:this.sortingPickerData.items[0].value,direction:H.ASC}),this.setDateSelection(V.getDateSelection(this.datePickerOptions.items[0])),this.fetchReportData()}_datePickerSelection;setDateSelection(e){switch(this._datePickerSelection=e,e.type){case l.PreviousMonth:case l.SelectMonth:this.enabledApprovement=!0;break;default:this.enabledApprovement=!1;break}switch(this.selectedPeriod={year:a.fromJSDate(e.startDate).year,month:a.fromJSDate(e.startDate).month,monthName:a.fromJSDate(e.startDate).toFormat("MMMM")},this.isCurrentMonth=a.fromJSDate(e.startDate).year==a.local().year&&a.fromJSDate(e.startDate).month==a.local().month,this.filter.dateFilter=oe.getEmptyModel(),this._datePickerSelection.type){case l.PreviousMonth:case l.SelectMonth:this.filter.dateFilter.group=A.Monthly,this.filter.dateFilter.year=a.fromJSDate(this._datePickerSelection.startDate).get("year"),this.filter.dateFilter.month=a.fromJSDate(this._datePickerSelection.startDate).get("month");break;case l.CurrentYear:case l.SelectYear:this.filter.dateFilter.group=A.Annually,this.filter.dateFilter.year=a.fromJSDate(this._datePickerSelection.startDate).get("year");break;case l.LastWeek:case l.LastMonth:case l.Custom:this.filter.dateFilter.group=A.Whole,this.filter.dateFilter.range={startDateTime:a.fromJSDate(this._datePickerSelection.startDate).toFormat("yyyy-MM-dd"),endDateTime:a.fromJSDate(this._datePickerSelection.endDate).toFormat("yyyy-MM-dd")};break}}setSortingSelection(e){this.filter.sortType=e.value,this.filter.sortOrder=e.direction}createFilter(){this.filter=C.getEmptyModel()}onGetReportClicked(e){this.filter.pagination.skip=0,this.fetchReportData()}onGetExcelClicked(e){this.reportService.exportPacsMonthlySummaryAsExcel(C.getRequestModel(this.filter)).subscribe(t=>{this.translate.get(["REPORT.PACS_EXCEL_MONTHLY_WORKING_HOURS"]).subscribe(o=>{z.default.saveAs(t,o["REPORT.PACS_EXCEL_MONTHLY_WORKING_HOURS"]+" "+a.fromJSDate(this._datePickerSelection.startDate).toLocaleString(a.DATE_HUGE)+"-"+a.fromJSDate(this._datePickerSelection.endDate).toLocaleString(a.DATE_HUGE)+".xlsx")})})}onGetExtraHoursExcelClicked(e){this.reportService.exportPacsMonthlyExtraHoursAsExcel(C.getRequestModel(this.filter)).subscribe(t=>{this.translate.get(["REPORT.PACS_EXCEL_MONTHLY_EXTRA_HOURS"]).subscribe(o=>{z.default.saveAs(t,o["REPORT.PACS_EXCEL_MONTHLY_EXTRA_HOURS"]+" "+a.fromJSDate(this._datePickerSelection.startDate).toLocaleString(a.DATE_HUGE)+"-"+a.fromJSDate(this._datePickerSelection.endDate).toLocaleString(a.DATE_HUGE)+".xlsx")})})}fetchReportData(){this.reportService.getPacsSummary(C.getRequestModel(this.filter)).subscribe(e=>{this.records=e.items||[],this.paginationResponse=e.pagination})}onRecordUpdated(e){this.fetchReportData()}pageChanged(e){this.filter.pagination.skip=e.skip,this.filter.pagination.take=e.take,this.fetchReportData()}onDateSelectionChanged(e){this.filter.pagination.skip=0,this.setDateSelection(e),this.fetchReportData()}onSortingSelectionChanged(e){this.filter.pagination.skip=0,this.setSortingSelection(e),this.fetchReportData()}static ctorParameters=()=>[{type:x},{type:u},{type:R},{type:F},{type:q},{type:G}];static propDecorators={approveMonth:[{type:v,args:["approveMonth"]}]}};xe=Ne([d({selector:"armon-report-pacs-summary",template:de,standalone:!0,imports:[le,ne,ie,b,m,Z,X,te,ee,Q,se,J,Y,I,pe,ce,f,N,re,P,h,T],styles:[me]})],xe);export{xe as ReportPacsSummaryComponent};
