import{a as j}from"./chunk-5OT2MLHH.js";import{a as N}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as P}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as z}from"./chunk-4MZCYQX4.js";import{b as M,c as L,d as U}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as k}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as C,Mb as O,Na as S,Ob as _,Qa as w,a as $,l as y,wb as A}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Dc as s,Fb as f,Hb as g,Mg as I,Ng as E,Te as b,ab as p,bb as d,bh as D,cd as u,dc as h,dd as v,g as B,gg as l,hd as T,hg as x,jg as R,ya as m}from"./chunk-SKPDQO4E.js";var V=`<div class="h-100">
  <side-navigation *ngIf="visibleComponent">
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12 mb-2">
          <label class="report-form-label">{{'REPORT.AUDIT_ACTION_TYPE' | translate}}</label>
          <select [(ngModel)]="filter.actionType" class="form-select form-select-sm">
            <option *ngFor="let actionType of actionTypes" [ngValue]="actionType.type">
              {{actionType.description | translate}}</option>
          </select>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.TERMINALS' | translate}}</label>
          <armon-select-search query="terminal" [allowMulti]="true" [(ngModel)]="filter.terminalIds">
          </armon-select-search>
        </div>
        <div class="col-12" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'REPORT.AUDIT_ACTION_OWNERS' | translate}}</label>
          <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="filter.actionUserIds">
          </armon-select-search>
        </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>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row report-filter-container">
          <div class="col-12">
            <div class="row">
              <div class="col-12">
                <armon-date-picker [options]="datePickerOptions" (selectionChanged)="onDateSelectionChanged($event)">
                </armon-date-picker>
              </div>
            </div>
          </div>
        </div>
        <div class="row pt-5" *ngIf="items && items.length==0">
          <div class="col-12">
            <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 report-data-table-container" id="report-data-table-container" *ngIf="items && items.length > 0">
          <div class="col-12">
            <p-table [value]="items" dataKey="actionId" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th>{{'REPORT.AUDIT_ACTION_DATE' | translate}}</th>
                  <th>{{'REPORT.TERMINAL' | translate}}</th>
                  <th>{{'REPORT.AUDIT_ACTION' | translate}}</th>
                </tr>
              </ng-template>
              <ng-template pTemplate="body" let-item let-rowData let-expanded="expanded">
                <tr [pRowToggler]="rowData" [attr.expanded]="expanded" class="data-row">
                  <td>
                    <div class="report-multi-data-cell my-2">
                      <span class="main-text" *ngIf="item.actionUtc">{{item.actionUtcText}}<armon-local-date
                          [dateUtc]="item.actionUtc"></armon-local-date></span>
                      <span class="sub-text" *ngIf="item.actionUtc">{{item.actionUtcSubText}}</span>
                    </div>
                  </td>
                  <td>
                    <span>{{item.terminalName}}</span>
                  </td>
                  <td>
                    <div class="d-flex flex-column">
                      <span class="text-sm">{{item.message}}</span>
                      <span class="text-xs text-italic text-black-50">{{item.actionText | translate}}</span>
                    </div>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-item>
                <tr>
                  <td [attr.colspan]="3" class="expanded-row">
                    <div class="d-flex flex-column p-2">
                      <ng-container *ngFor="let change of item.changes">
                        <div>
                          <span class="text-sm text-bold">{{change.field}}</span>&nbsp;:&nbsp;
                          <ng-container *ngIf="change.oldValue && change.newValue">
                            <span class="text-sm">{{change.oldValue}}</span>
                            <cds-icon shape="circle-arrow" direction="right" size="sm" solid class="mx-2 color-secondary">
                            </cds-icon>
                            <span class="text-sm">{{change.newValue}}</span>
                          </ng-container>
                          <ng-container *ngIf="change.oldValue && !change.newValue">
                            <cds-icon shape="minus-circle" size="sm" solid class="me-2 color-secondary">
                            </cds-icon>
                            <span class="text-sm">{{change.oldValue}}</span>
                          </ng-container>
                          <ng-container *ngIf="!change.oldValue && change.newValue">
                            <cds-icon shape="plus-circle" size="sm" solid class="me-2 color-secondary">
                            </cds-icon>
                            <span class="text-sm">{{change.newValue}}</span>
                          </ng-container>
                        </div>
                      </ng-container>
                      <div class="my-2" *ngIf="item.terminalId">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onShowDetailClicked(item)">{{'REPORT.AUDIT_CURRENT_RECORD'|translate}}</button>
                      </div>
                      <div class="d-flex flex-column pt-2 mt-2 b-t-1">
                        <span class="text-sm">{{'REPORT.AUDIT_ACTION_OWNER'|translate}}</span>
                        <div class="my-2">
                          <armon-captionlines [showBorder]="false" [captionlines]="item.actionUserCaptions">
                          </armon-captionlines>
                        </div>
                      </div>
                    </div>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </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 G=`.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 q=B($());var Y=function(r,e,n,i){var a=arguments.length,t=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,n):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(r,e,n,i);else for(var c=r.length-1;c>=0;c--)(o=r[c])&&(t=(a<3?o(t):a>3?o(e,n,t):o(e,n))||t);return a>3&&t&&Object.defineProperty(e,n,t),t},F=class{router;routingService;route;authService;reportService;translate;filter;items;visibleComponent=!1;paginationResponse=new E;paginationRequest=new I;permissionSearchIdentity;actionTypes;datePickerOptions=new x;constructor(e,n,i,a,t,o){this.router=e,this.routingService=n,this.route=i,this.authService=a,this.reportService=t,this.translate=o}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(T.IDENTITY.getReadBasic()),this.filter=w.getEmptyModel(),this.actionTypes=h(S),this.actionTypes.unshift({type:null,description:"COMMON.ALL"}),this.filter.actionType=this.actionTypes[0].type,this.datePickerOptions.items=[{type:l.LastMonth,selected:!0},{type:l.Last3Months},{type:l.CustomWithTimer}],this.setDateSelection(R.getDateSelection(this.datePickerOptions.items[0])),this.visibleComponent=!0}ngAfterViewInit(){this.getList()}ngOnDestroy(){}setDateSelection(e){this.filter.dateRange.startDateTime=e.startDate,this.filter.dateRange.endDateTime=e.endDate}getList(){this.reportService.getAuditTerminalActions(this.filter).subscribe(e=>{this.items=e.items,this.paginationResponse=e.pagination})}onGetExcelClicked(e){this.reportService.getAuditTerminalActionsAsExcel(this.filter).subscribe(n=>{this.translate.get(["PAGES.REPORT_AUDIT_TERMINAL"]).subscribe(i=>{q.default.saveAs(n,i["PAGES.REPORT_AUDIT_TERMINAL"]+" "+s.fromJSDate(this.filter.dateRange.startDateTime).toLocaleString(s.DATETIME_MED)+" "+s.fromJSDate(this.filter.dateRange.endDateTime).toLocaleString(s.DATETIME_MED)+".xlsx")})})}refreshList(e=!0){e&&(this.filter.pagination.skip=0),this.getList()}onGetReportClicked(e){this.refreshList()}pageChanged(e){this.filter.pagination=e,this.refreshList(!1)}onDateSelectionChanged(e){this.setDateSelection(e),this.refreshList()}onShowDetailClicked(e){this.routingService.gotoManageTerminals(e.terminalId)}static ctorParameters=()=>[{type:g},{type:O},{type:f},{type:_},{type:C},{type:u}]};F=Y([m({selector:"armon-report-audit-terminal.component",template:V,standalone:!0,imports:[d,U,M,b,p,A,L,y,D,j,z,N,P,k,v],styles:[G]})],F);export{F as ReportAuditTerminalComponent};
