import{d as L}from"./chunk-O2WVXTHR.js";import"./chunk-T7RLVMCF.js";import"./chunk-FH4KR5HL.js";import"./chunk-ZBRKSVZT.js";import"./chunk-PLS4K4KY.js";import"./chunk-JN2ZUHXX.js";import"./chunk-NLCRYDJ4.js";import"./chunk-RB5TOXJE.js";import"./chunk-7GYHTWED.js";import"./chunk-AYO4TCFG.js";import"./chunk-XOY5UTVP.js";import"./chunk-25WJNSQA.js";import{b as _}from"./chunk-5DQKN4SL.js";import"./chunk-G7OJYPNY.js";import"./chunk-PWALQELY.js";import"./chunk-3GSDFESG.js";import"./chunk-7QEXVS2A.js";import"./chunk-H6QPU4XN.js";import"./chunk-IMWNGRKR.js";import"./chunk-5WJM4RWS.js";import"./chunk-UZB7YFT6.js";import"./chunk-5KCUTXXV.js";import{a as B}from"./chunk-5OT2MLHH.js";import{a as M}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as z}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as q}from"./chunk-4MZCYQX4.js";import{b as G,c as j,d as V}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as N}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as w,La as A,Oa as P,Ob as U,a as J,l as S,o as O,wb as k}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Dc as r,Fb as f,Hb as h,Mg as E,Ng as C,Te as I,ab as d,af as R,bb as g,bh as D,cd as T,dc as u,dd as b,g as $,gg as p,hd as c,hg as y,jg as x,wc as v,ya as m}from"./chunk-SKPDQO4E.js";var F=`<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" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'REPORT.IDENTITIES' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="filter.modifiedUserIds">
          </armon-select-search>
        </div>

        <div class="col-12" *ngIf="permissionSearchOrganizationUnit">
          <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
          <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="filter.organizationUnitIds">
          </armon-select-search>
          <label class="report-checkbox-label" nz-checkbox
            *ngIf="filter.organizationUnitIds && filter.organizationUnitIds.length > 0"
            [(ngModel)]="filter.filterOrganizationUnitMembersHierarchically">{{'REPORT.SHOW_HIERARCHICALLY' |
            translate}}</label>
        </div>
        <div class="col-12" *ngIf="permissionSearchUserGroup">
          <label class="report-form-label">{{'REPORT.USER_GROUPS' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="filter.userGroupIds">
          </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>{{'IDENTITY.TITLE' | translate : languageService.userTranslate}}</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>
                    <armon-captionlines [showBorder]="false" [captionlines]="item.modifiedUserCaptions">
                    </armon-captionlines>
                  </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.modifiedUserId">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onShowProfileClicked(item)">{{'REPORT.AUDIT_CURRENT_PROFILE'|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 W=`.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 H=$(J());var X=function(l,e,t,n){var a=arguments.length,i=a<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(l,e,t,n);else for(var s=l.length-1;s>=0;s--)(o=l[s])&&(i=(a<3?o(i):a>3?o(e,t,i):o(e,t))||i);return a>3&&i&&Object.defineProperty(e,t,i),i},Y=class{router;drawerService;route;authService;reportService;languageService;translate;filter;items;visibleComponent=!1;paginationResponse=new C;paginationRequest=new E;permissionSearchUserGroup;permissionSearchIdentity;permissionSearchOrganizationUnit;actionTypes;datePickerOptions=new y;constructor(e,t,n,a,i,o,s){this.router=e,this.drawerService=t,this.route=n,this.authService=a,this.reportService=i,this.languageService=o,this.translate=s}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(c.IDENTITY.getReadBasic()),this.permissionSearchOrganizationUnit=this.authService.checkPermission(c.ORGANIZATIONUNIT.getReadBasic()),this.permissionSearchUserGroup=this.authService.checkPermission(c.USERGROUP.getRead()),this.filter=P.getEmptyModel(),this.actionTypes=u(A),this.actionTypes.unshift({type:null,description:"COMMON.ALL"}),this.filter.actionType=this.actionTypes[0].type,this.datePickerOptions.items=[{type:p.LastMonth,selected:!0},{type:p.Last3Months},{type:p.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.getAuditIdentityActions(this.filter).subscribe(e=>{this.items=e.items,this.paginationResponse=e.pagination})}onGetExcelClicked(e){this.reportService.getAuditIdentityActionsAsExcel(this.filter).subscribe(t=>{this.translate.get(["PAGES.REPORT_AUDIT_IDENTITY"],this.languageService.userTranslate).subscribe(n=>{H.default.saveAs(t,n["PAGES.REPORT_AUDIT_IDENTITY"]+" "+r.fromJSDate(this.filter.dateRange.startDateTime).toLocaleString(r.DATETIME_MED)+" "+r.fromJSDate(this.filter.dateRange.endDateTime).toLocaleString(r.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()}onShowProfileClicked(e){let t=this.drawerService.create({nzContent:L,nzClosable:!1,nzWidth:v(),nzContentParams:{identityId:e.modifiedUserId}})}static ctorParameters=()=>[{type:h},{type:_},{type:f},{type:U},{type:w},{type:R},{type:T}]};Y=X([m({selector:"armon-report-audit-identity",template:F,standalone:!0,imports:[g,V,G,I,d,k,O,j,S,D,B,q,M,z,N,b],styles:[W]})],Y);export{Y as ReportAuditIdentityComponent};
