import{a as ie}from"./chunk-CQAXM2HF.js";import{a as ne}from"./chunk-I5K7GPAI.js";import{a as Z}from"./chunk-DIZBRRGC.js";import{a as J}from"./chunk-25WJNSQA.js";import{a as H}from"./chunk-D4RZOGGF.js";import{a as V,b as W,c as X}from"./chunk-UZB7YFT6.js";import{a as te}from"./chunk-JUDWAYYT.js";import{a as q}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as K,c as Q,d as ee}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as Y}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Mb as $,Ob as v,a as me,k as O,m as L,o as A,s as h,v as u,wb as G,y as b}from"./chunk-YSQLW2JA.js";import{ce as x,ud as j}from"./chunk-NVJ2ZZFT.js";import{Aa as T,Ba as C,Dc as d,Ig as U,Mg as F,Ng as P,Pd as k,Qd as M,Rd as z,Te as D,Ve as _,Ye as N,_a as R,ab as m,af as g,bb as p,cd as w,dc as E,dd as f,eh as B,g as ce,ha as I,hd as l,ma as S,ya as c}from"./chunk-SKPDQO4E.js";var oe=`<div class="h-100">
  <side-navigation *ngIf="visibleComponent">
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12 mb-2 pos-relative">
          <label class="report-form-label">{{'CREDENTIAL.TITLE_DATA' | translate}}</label>
          <armon-search-text-input [(ngModel)]="filter.data" [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.data && filter.data!=''">
            <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 mb-2">
          <label class="report-form-label">{{'CREDENTIAL.TITLE_TYPE' | translate}}</label>
          <nz-select class="w-100" [(ngModel)]="filter.credentialType" nzSize="small"
            (ngModelChange)="onFilterUpdated($event)">
            <nz-option *ngFor="let credentialType of credentialTypes" [nzValue]="credentialType.type" [nzLabel]="credentialType.description |
                translate"></nz-option>
          </nz-select>
        </div>
        <div class="col-12 mb-2 pos-relative">
          <label class="report-form-label">{{'CREDENTIAL.TITLE_EXPIRATION_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-2" *ngIf="permissionSearchIdentity">
          <label class="report-form-label">{{'IDENTITY.TITLE' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="filter.userIds"
            (ngModelChange)="onFilterUpdated($event)">
          </armon-select-search>
        </div>
        <div class="col-12 mb-2" *ngIf="permissionSearchOrganizationUnit">
          <label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
          <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="filter.organizationUnitIds"
            (ngModelChange)="onFilterUpdated($event)">
          </armon-select-search>
          <label class="report-checkbox-label" nz-checkbox
            *ngIf="filter.organizationUnitIds && filter.organizationUnitIds.length > 0"
            [(ngModel)]="filter.filterUsersHierarchically"
            (ngModelChange)="onFilterUpdated($event)">{{'REPORT.SHOW_HIERARCHICALLY' |
            translate}}</label>
        </div>
        <div class="col-12 mb-2" *ngIf="permissionSearchUserGroup">
          <label class="report-form-label">{{'REPORT.USER_GROUPS' | translate : languageService.userTranslate}}</label>
          <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="filter.userGroupIds"
            (ngModelChange)="onFilterUpdated($event)">
          </armon-select-search>
        </div>
        <div class="col-12">
          <label class="report-form-label">{{'REPORT.USER_STATUS' | translate}}</label>
          <armon-identity-status [(ngModel)]="filter.userOrganizationStatus" (ngModelChange)="onFilterUpdated($event)">
          </armon-identity-status>
        </div>
      </div>
      <div class="row mt-4">
        <div class="col-12 d-flex align-items-center 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>
      <ng-container *ngIf="records && records.length>0">
        <div class="row" [@listAnimationFast]="records.length" id="manage-credential-list">
          <!-- List of records -->
          <div class="col-xl-4 col-lg-6 col-md-12" *ngFor="let record of records">
            <armon-manage-credential-item [credential]="record"
              (credentialForbiddenUpdated)="onCredentialForbiddenUpdated($event)"></armon-manage-credential-item>
          </div>
        </div>
        <div class="row pb-3">
          <div class="col-12 mb-3 mt-3">
            <armon-pagination [paginationResponse]="paginationResponse"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </ng-container>
    </ng-template>
  </side-navigation>
</div>`;var re=`.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}.credential-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center}.credential-container cds-icon{margin:6px 12px 6px 0;color:#aaa}.credential-container .info-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;font-size:.588rem}.credential-container .info-container .description{font-size:.714rem;font-weight:500}.credential-container .expire-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;margin-top:6px}.credential-container .expire-container span{font-size:.588rem}.search-method{position:absolute;right:.56rem;top:.07rem}.now-forbidden{margin-left:0!important;margin-bottom:6px}.forbid-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}
`;var de=ce(me());var ae=`<div class="card mb-3">

    <div class="position-relative p-4 mhs-15">
        <div class="d-flex column-gap-3">
            <div class="d-flex justify-content-center align-items-center bg-color-gray-lightest rounded-circle border border-1"
                style="width: 48px; height: 48px;">
                <cds-icon class="color-gray-dark" [attr.shape]="credential.credential.icon" size="lg"></cds-icon>
            </div>
            <div class="d-flex flex-column flex-grow-1 justify-content-center">
                <span class="text-base fw-medium">{{credential.credential.description | translate}}</span>
                <span class="text-xs" *ngIf="credential.dataText">{{credential.dataText|translate}}<span
                        *ngIf="credential.decData">&nbsp;({{credential.decData}})</span></span>
                <div class="text-xs fst-italic d-flex column-gap-1" *ngIf="credential.expiresOn">
                    <span>{{'CREDENTIAL.TITLE_EXPIRATION' | translate}}</span>
                    <span>{{credential.expiresOnText}}</span>
                </div>
                <span class="text-xs color-error"
                    *ngIf="credential.hasForbid">{{'FORBIDDEN_IDENTITY.HAS_RECORDS'|translate:credential}}</span>
                <span *ngIf="credential.note" class="text-xs fw-normal">{{'CREDENTIAL.TITLE_NOTE'|translate}}:
                    {{credential.note}}</span>
            </div>
        </div>
        <div class="d-flex mt-3" *ngIf="credential.userCaption">
            <armon-captionlines [captionlines]="credential.userCaption" [compact]="true"></armon-captionlines>
        </div>
        <div *ngIf="credential.nowForbidden" class="position-absolute top-0 end-0 p-3">
            <armon-icon-label [colorCode]="7">
                <ng-template icon-label-icon>
                    <cds-icon shape="no-access" solid size="sm"></cds-icon>
                </ng-template>
                <ng-template icon-label-content>
                    <span>{{'USER_CAPTION.USER_FORBIDDEN'|translate}}</span>
                </ng-template>
            </armon-icon-label>
        </div>
    </div>

    <div class="card-footer" *ngIf="visibleButtons.length > 0">

        <button class="btn btn-sm btn-link" *ngFor="let button of visibleButtons"
            (click)="onFooterButtonClicked($event, button.event)">{{button.text |
            translate:languageService.userTranslate}}</button>

        <button nz-dropdown [nzDropdownMenu]="menuSub" class="btn btn-link btn-sm me-2" *ngIf="hiddenButtons.length > 0"
            [nzClickHide]="true">
            <cds-icon shape="ellipsis-horizontal"></cds-icon>
        </button>
        <nz-dropdown-menu #menuSub="nzDropdownMenu">
            <ul nz-menu>
                <li nz-menu-item *ngFor="let button of hiddenButtons"
                    (click)="onFooterButtonClicked($event, button.event)">
                    {{button.text | translate:languageService.userTranslate}}</li>
            </ul>
        </nz-dropdown-menu>
    </div>

</div>`;var le=`.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 ue=function(r,e,t,i){var o=arguments.length,n=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(n=(o<3?a(n):o>3?a(e,t,n):a(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},y=class extends ne{authService;routingService;modalService;languageService;credential;credentialForbiddenUpdated=new I;constructor(e,t,i,o){super(e),this.authService=e,this.routingService=t,this.modalService=i,this.languageService=o}ngOnInit(){this.initializeButtons()}ngOnDestroy(){}onLogsButtonClicked(){this.routingService.gotoUserAccessLogs(this.credential.userId)}onAddForbiddenRecordClicked(){let e=j.getEmptyModel();e.userId=this.credential.userId,e.credentialIds=[this.credential.id],this.modalService.open(J,{settings:{size:"md"},props:{record:e}}).result.then(t=>{this.credentialForbiddenUpdated.emit()}).catch(t=>{})}onListUserForbiddenRecordsClicked(){this.routingService.gotoManageForbiddenIdentities(this.credential.userId)}initializeButtons(){this.addButton("BUTTON.SHOW_ACCESS_LOGS",this.onLogsButtonClicked,[l.ACCESSLOG.getReportDetailed()]),this.credential.hasForbid&&this.addButton("PAGES.MANAGE_FORBIDDEN_IDENTITY",this.onListUserForbiddenRecordsClicked,[l.IDENTITY.getForbiddenView()]),this.addButton("FORBIDDEN_IDENTITY.ADD_RECORD",this.onAddForbiddenRecordClicked,[l.IDENTITY.getForbiddenView()])}static ctorParameters=()=>[{type:v},{type:$},{type:z},{type:g}];static propDecorators={credential:[{type:T}],credentialForbiddenUpdated:[{type:C}]}};y=ue([c({selector:"armon-manage-credential-item",template:ae,standalone:!0,schemas:[S],imports:[p,q,X,V,W,m,b,u,h,f],styles:[le]})],y);var be=function(r,e,t,i){var o=arguments.length,n=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(a=r[s])&&(n=(o<3?a(n):o>3?a(e,t,n):a(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},se=class{authService;sessionService;credentialService;languageService;translate;filter;records;visibleComponent=!1;credentialTypes;searchMethods;selectedSearchMethod;filterDateRange=null;permissionSearchIdentity;permissionSearchOrganizationUnit;permissionSearchUserGroup;paginationResponse=new P;paginationRequest=new F;constructor(e,t,i,o,n){this.authService=e,this.sessionService=t,this.credentialService=i,this.languageService=o,this.translate=n}ngOnInit(){this.permissionSearchIdentity=this.authService.checkPermission(l.IDENTITY.getReadBasic()),this.permissionSearchOrganizationUnit=this.authService.checkPermission(l.ORGANIZATIONUNIT.getReadBasic()),this.permissionSearchUserGroup=this.authService.checkPermission(l.USERGROUP.getRead());let e=[];this.sessionService.currentOrganizationCredentialTypes.forEach(t=>{e.push(U.find(i=>i.type==t))}),this.filter=x.getEmptyModel(),e.unshift({type:null,description:"IDENTITYSTATUS.ALL"}),this.credentialTypes=e,this.filter.credentialType=e[0].type,this.searchMethods=E(ie),this.selectedSearchMethod=this.searchMethods.find(t=>t.type==this.filter.searchMethod),this.visibleComponent=!0}ngAfterViewInit(){this.getList()}ngOnDestroy(){}getList(){this.records=[],this.credentialService.list(x.getRequestModel(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.dateRange.startDateTime=d.fromJSDate(this.filterDateRange[0]).startOf("day").toJSDate(),this.filter.dateRange.endDateTime=d.fromJSDate(this.filterDateRange[1]).endOf("day").toJSDate()):(this.filter.dateRange.startDateTime=null,this.filter.dateRange.endDateTime=null),this.refreshList()}onGetExcelClicked(e){this.credentialService.listAsExcel(x.getRequestModel(this.filter)).subscribe(t=>{this.translate.get(["PAGES.MANAGE_CREDENTIAL"]).subscribe(i=>{de.default.saveAs(t,i["PAGES.MANAGE_CREDENTIAL"]+"_"+d.local().toLocaleString(d.DATETIME_MED)+".xlsx")})})}pageChanged(e){this.filter.pagination=e,this.refreshList(!1)}onCredentialForbiddenUpdated(e){this.refreshList(!1)}onMethodChanged(e){this.selectedSearchMethod=e,this.filter.searchMethod=this.selectedSearchMethod.type,this.refreshList()}static ctorParameters=()=>[{type:v},{type:k},{type:Z},{type:g},{type:w}]};se=be([c({selector:"armon-manage-credentials.component",template:oe,animations:H,standalone:!0,providers:[{provide:_,useClass:O}],imports:[p,ee,K,te,D,b,u,m,h,R,B,N,M,G,A,L,Q,y,Y,f],styles:[re]})],se);export{se as ManageCredentialsComponent};
