import{a as j}from"./chunk-LTYRORJD.js";import"./chunk-ZTPSCNCV.js";import"./chunk-PMJFQIXL.js";import"./chunk-MNVOJIXC.js";import{a as z}from"./chunk-5OT2MLHH.js";import{a as k}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as w}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as U}from"./chunk-4MZCYQX4.js";import{b as N,c as M,d as L}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as _}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as I,Ma as P,Ob as D,Pa as A,a as $,l as C,wb as E}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Dc as o,Fb as f,Mg as y,Ng as O,Rd as T,Te as b,ab as m,bb as d,bh as S,cd as h,dc as g,dd as u,g as B,gg as l,hd as v,hg as R,jg as x,ya as p}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.ACCESS_CONTROL_POINTS' | translate}}</label>
          <armon-select-search query="point" [allowMulti]="true" [(ngModel)]="filter.acpIds">
          </armon-select-search>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.REGIONS' | translate}}</label>
          <armon-select-search query="region" [allowMulti]="true" [(ngModel)]="filter.regionIds">
          </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.ACCESS_CONTROL_POINT' | 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.accessControlPointName}}</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.accessControlPointId">
                        <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 F=B($());var Y=function(s,e,t,i){var a=arguments.length,n=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(s,e,t,i);else for(var c=s.length-1;c>=0;c--)(r=s[c])&&(n=(a<3?r(n):a>3?r(e,t,n):r(e,t))||n);return a>3&&n&&Object.defineProperty(e,t,n),n},q=class{modalService;route;authService;reportService;translate;filter;items;visibleComponent=!1;paginationResponse=new O;paginationRequest=new y;permissionSearchIdentity;actionTypes;datePickerOptions=new R;constructor(e,t,i,a,n){this.modalService=e,this.route=t,this.authService=i,this.reportService=a,this.translate=n}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(v.IDENTITY.getReadBasic()),this.filter=A.getEmptyModel(),this.actionTypes=g(P),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(x.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.getAuditAccessControlPointActions(this.filter).subscribe(e=>{this.items=e.items,this.paginationResponse=e.pagination})}onGetExcelClicked(e){this.reportService.getAuditAccessControlPointActionsAsExcel(this.filter).subscribe(t=>{this.translate.get(["PAGES.REPORT_AUDIT_CONTROL_PANEL"]).subscribe(i=>{F.default.saveAs(t,i["PAGES.REPORT_AUDIT_CONTROL_PANEL"]+" "+o.fromJSDate(this.filter.dateRange.startDateTime).toLocaleString(o.DATETIME_MED)+" "+o.fromJSDate(this.filter.dateRange.endDateTime).toLocaleString(o.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.modalService.open(j,{settings:{size:"lg"},props:{accessControlPointId:e.accessControlPointId}}).result.then(t=>{}).catch(t=>{})}static ctorParameters=()=>[{type:T},{type:f},{type:D},{type:I},{type:h}]};q=Y([p({selector:"armon-report-audit-access-control-point.component",template:V,standalone:!0,imports:[d,L,N,b,m,E,M,C,S,z,U,k,w,_,u],styles:[G]})],q);export{q as ReportAuditAccessControlPanelComponent};
