import{a as ee}from"./chunk-CQAXM2HF.js";import{a as u}from"./chunk-25WJNSQA.js";import{a as W}from"./chunk-JUDWAYYT.js";import{a as Z}from"./chunk-5OT2MLHH.js";import{a as J}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as X}from"./chunk-4MZCYQX4.js";import{b as K,c as Q,d as V}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as H}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Ob as q,a as de,c as m,k as L,nb as f,s as A,v as z,wb as $,y as U}from"./chunk-YSQLW2JA.js";import{ud as Y,wd as G}from"./chunk-NVJ2ZZFT.js";import{Aa as v,Dc as g,Fb as E,Hb as I,Mg as j,Nc as x,Ng as B,Qd as S,Qf as F,Rd as _,Tb as D,Te as O,Ve as w,Xb as T,Yb as y,Ye as M,_a as b,ab as d,af as k,bb as c,bh as P,cd as N,dc as R,dd as p,g as le,hd as C,ya as l}from"./chunk-SKPDQO4E.js";var te=`<div class="h-100">
  <side-navigation *ngIf="visibleComponent">
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'IDENTITY.TITLE' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="identity" [allowMulti]="false" [(ngModel)]="filter.userId"
            (ngModelChange)="onFilterUpdated($event)">
          </armon-select-search>
        </div>
        <div class="col-12 pos-relative" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'CREDENTIAL.TITLE_DATA' | translate}}</label>
          <armon-search-text-input [(ngModel)]="filter.credentialData" [minLength]="2"
            (ngModelChange)="onFilterUpdated($event)" placeholder="CREDENTIAL.TITLE_DATA"></armon-search-text-input>
          <div nz-dropdown [nzDropdownMenu]="menuFilter" class="d-flex search-method"
            *ngIf="filter.credentialData && filter.credentialData!=''">
            <cds-icon shape="filter" size="sm"></cds-icon>
            <cds-icon shape="angle" direction="down"></cds-icon>
          </div>
          <nz-dropdown-menu #menuFilter="nzDropdownMenu">
            <ul nz-menu>
              <ng-container *ngFor="let method of searchMethods">
                <li nz-menu-item (click)="onMethodChanged(method)">
                  <span [ngClass]="{'text-bold': method.type==selectedSearchMethod.type}">
                    {{method.description |
                    translate}}
                    <cds-icon shape="check" class="ms-1" *ngIf="method.type==selectedSearchMethod.type"></cds-icon>
                  </span>
                </li>
              </ng-container>
            </ul>
          </nz-dropdown-menu>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.REGION' | translate}}</label>
          <armon-select-search query="region" [allowMulti]="false" [(ngModel)]="filter.regionId"
            (ngModelChange)="onFilterUpdated($event)">
          </armon-select-search>
        </div>
        <div class="col-12 pos-relative">
          <label class="report-form-label">{{'FORBIDDEN_IDENTITY.RECORD_DATE_RANGE' | translate}}</label>
          <input placeholder="{{'DATEPICKER.LABEL_CUSTOM'|translate}}" type="text" readonly owlinput
            class="form-control form-control-sm bg-white" [(ngModel)]="filterDateRange" [selectMode]="'range'"
            (ngModelChange)="onFilterUpdated($event)" [owlDateTimeTrigger]="dtRange1" [owlDateTime]="dtRange1">
          <owl-date-time [firstDayOfWeek]="1" #dtRange1 [pickerType]="'calendar'"></owl-date-time>
          <cds-icon shape="times-circle" solid class="cds-icon-18 report-form-icon" *ngIf="filterDateRange!=null"
            title="{{'BUTTON.CLEAR'|translate}}" click-stop-propagation
            (click)="filterDateRange=null; onFilterUpdated($event)"></cds-icon>
        </div>
        <div class="col-12 mb-3 pos-relative">
          <label class="report-form-label">{{'FORBIDDEN_IDENTITY.RECORD_NOTE' | translate}}</label>
          <armon-search-text-input [(ngModel)]="filter.note" [minLength]="3" [maxLength]="128"
            (ngModelChange)="onFilterUpdated($event)" placeholder="COMMON.SEARCH"></armon-search-text-input>
        </div>
      </div>
      <div class="row">
        <div class="col-12 d-flex justify-content-center">
          <button class="btn btn-success btn-sm" (click)="onGetExcelClicked($event)">{{'BUTTON.EXCEL' |
            translate}}</button>
        </div>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row my-3">
          <div class="col-12">
            <button class="btn btn-sm btn-primary"
              (click)="onNewRecordClicked($event)">{{'FORBIDDEN_IDENTITY.ADD_RECORD'|translate}}</button>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-12">
            <p-table [value]="records" dataKey="id" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th>{{'IDENTITY.TITLE' | translate : languageService.userTranslate}}</th>
                  <th>{{'REPORT.STATUS' | translate}}</th>
                  <th>{{'FORBIDDEN_IDENTITY.RECORD_START_DATE' | translate}}</th>
                  <th>{{'FORBIDDEN_IDENTITY.RECORD_END_DATE' | translate}}</th>
                  <th>{{'REPORT.REGION' | translate}}</th>
                </tr>
              </ng-template>
              <ng-template pTemplate="body" let-record let-rowData let-expanded="expanded">
                <tr [pRowToggler]="rowData" [attr.expanded]="expanded" class="data-row">
                  <td>
                    <armon-captionlines [captionlines]="record.userCaptions" [showBorder]="false"></armon-captionlines>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <div>
                        <span class="badge fw-normal" [ngClass]="{'bg-color-selection': record.state=='upcoming',
                    'bg-color-success': record.state=='active', 'bg-color-gray': record.state=='expired'}"
                          style="font-size: 11px;">{{record.stateText|translate}}</span>
                      </div>
                      <span class="text-sm mt-2" *ngIf="record.state=='active'"><span
                          *ngIf="!record.forAllCredentials">{{record.credentialIds.length}}&nbsp;</span>{{(record.forAllCredentials?'FORBIDDEN_IDENTITY.ALL_CRENDENTIALS':'FORBIDDEN_IDENTITY.COUNT_CRENDENTIALS')
                        | translate}}</span>
                    </div>
                  </td>
                  <td>
                    <span>{{record.startUtcText}}</span>
                  </td>
                  <td>
                    <span>{{record.endUtcText}}</span>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{(record.regionName?record.regionName:'COMMON.ALL_REGIONS') |
                        translate}}</span>
                    </div>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-record>
                <tr>
                  <td [attr.colspan]="5" class="expanded-row">
                    <div *ngIf="record.note" class="mt-3"><strong>{{'FORBIDDEN_IDENTITY.RECORD_NOTE' | translate}} :
                      </strong>{{record.note}}</div>
                    <armon-forbidden-identity-record-history
                      [record]="record"></armon-forbidden-identity-record-history>
                    <div>
                      <button class="btn btn-sm btn-outline-primary me-2"
                        (click)="onEditClicked(record)">{{'BUTTON.EDIT'|translate}}</button>
                      <button class="btn btn-sm btn-outline-danger"
                        (click)="onDeleteClicked(record)">{{'BUTTON.DELETE'|translate}}</button>
                    </div>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-12 pt-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>
        <div class="row pb-3">
          <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 ie=`.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}.search-method{position:absolute;right:.56rem;top:.07rem}
`;var ae=le(de());var re=`<div *ngIf="record.history" class="w-100 my-3">
    <div class="w-100 b-b-1 mb-2 py-2">
        <span class="color-primary text-sm text-bold">
            <cds-icon shape="history" size="sm"></cds-icon>
            {{'FORBIDDEN_IDENTITY.RECORD_HISTORY'|translate}}
        </span>
    </div>
    <div *ngFor="let item of record.history.items">
        <span class="text-xs">{{item.message}} ({{item.actionUtcText}})</span>
    </div>
</div>`;var ne=`.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 he=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var s=a.length-1;s>=0;s--)(o=a[s])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i},h=class{identityService;record;history;constructor(e){this.identityService=e}ngOnInit(){this.record.history||this.identityService.historyForbiddenRecord(this.record.id).subscribe(e=>{this.record.history=e})}static ctorParameters=()=>[{type:f}];static propDecorators={record:[{type:v}]}};h=he([l({selector:"armon-forbidden-identity-record-history",template:re,standalone:!0,imports:[c,d,p],styles:[ne]})],h);var ge=function(a,e,t,r){var n=arguments.length,i=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(a,e,t,r);else for(var s=a.length-1;s>=0;s--)(o=a[s])&&(i=(n<3?o(i):n>3?o(e,t,i):o(e,t))||i);return n>3&&i&&Object.defineProperty(e,t,i),i},oe=class{router;route;authService;identityService;interactionService;languageService;modalService;translate;filterDateRange;filter;records;searchMethods;selectedSearchMethod;visibleComponent=!1;paginationResponse=new B;paginationRequest=new j;permissionSearchIdentity;constructor(e,t,r,n,i,o,s,se){this.router=e,this.route=t,this.authService=r,this.identityService=n,this.interactionService=i,this.languageService=o,this.modalService=s,this.translate=se}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(C.IDENTITY.getReadBasic()),this.filter=G.getEmptyModel(),this.searchMethods=R(ee),this.selectedSearchMethod=this.searchMethods.find(e=>e.type==this.filter.searchMethod)}ngAfterViewInit(){this.route.queryParams.subscribe(e=>{let t=!1;e&&e[m.UserId]&&e[m.UserId]!=""&&this.permissionSearchIdentity&&(this.filter.userId=e[m.UserId],t=!0),t||this.getList()}),this.visibleComponent=!0}ngOnDestroy(){}getList(){this.identityService.listForbiddenRecords(this.filter).subscribe(e=>{this.records=e.items,this.paginationResponse=e.pagination})}refreshList(e=!0){e&&(this.filter.pagination.skip=0),this.getList()}onFilterUpdated(e){this.filterDateRange?(this.filter.startUtc=g.fromJSDate(this.filterDateRange[0]).startOf("day").toJSDate(),this.filter.endUtc=g.fromJSDate(this.filterDateRange[1]).endOf("day").toJSDate()):(this.filter.startUtc=null,this.filter.endUtc=null),this.refreshList()}onCredentialDataEntered(e){!y(e)&&!T(e)&&!D(e)?this.filter.credentialData=e:this.filter.credentialData=null,this.refreshList()}onMethodChanged(e){this.selectedSearchMethod=e,this.filter.searchMethod=this.selectedSearchMethod.type,this.refreshList()}onGetExcelClicked(e){this.identityService.listForbiddenRecordsAsExcel(this.filter).subscribe(t=>{this.translate.get(["PAGES.MANAGE_FORBIDDEN_IDENTITY"],this.languageService.userTranslate).subscribe(r=>{ae.default.saveAs(t,r["PAGES.MANAGE_FORBIDDEN_IDENTITY"]+".xlsx")})})}pageChanged(e){this.filter.pagination.skip=e.skip,this.filter.pagination.take=e.take,this.refreshList(!1)}onNewRecordClicked(e){this.modalService.open(u,{settings:{size:"md"},props:{record:Y.getEmptyModel()}}).result.then(t=>{this.refreshList()}).catch(t=>{})}onEditClicked(e){this.modalService.open(u,{settings:{size:"md"},props:{record:e}}).result.then(t=>{this.refreshList()}).catch(t=>{})}onDeleteClicked(e){this.interactionService.showDialog("FORBIDDEN_IDENTITY.DELETE_RECORD","FORBIDDEN_IDENTITY.DELETE_RECORD_CONFIRMATION",null,{fullname:e.user.fullname},!0,"BUTTON.DELETE","",!0,()=>{this.identityService.deleteForbiddenRecord(e.id).subscribe(()=>{this.interactionService.showMessage("FORBIDDEN_IDENTITY.RECORD_DELETE_SUCCEED",null,x.Success),this.refreshList()})})}static ctorParameters=()=>[{type:I},{type:E},{type:q},{type:f},{type:F},{type:k},{type:_},{type:N}]};oe=ge([l({selector:"armon-forbidden-identity-list",template:te,standalone:!0,providers:[{provide:w,useClass:L}],imports:[c,V,K,$,O,W,U,z,d,A,b,M,S,Q,Z,X,J,h,P,H,p],styles:[ie]})],oe);export{oe as ForbiddenIdentityListComponent};
