import{a as re}from"./chunk-KCLQIV7M.js";import{e as ne}from"./chunk-5KCUTXXV.js";import{a as ae}from"./chunk-JUDWAYYT.js";import{a as le}from"./chunk-WFZJP5WR.js";import{a as ie}from"./chunk-VSFNMVXJ.js";import{H as G,I as W,Ob as te,k,m as B,nb as X,o as q,wb as ee}from"./chunk-YSQLW2JA.js";import{Kc as Q,fb as w,hb as L,ib as Z}from"./chunk-NVJ2ZZFT.js";import{Aa as d,Ba as v,Dc as _,Fg as c,Ig as $,Lb as F,Mb as s,Mg as K,Ng as A,Pd as S,Qd as V,Qf as j,Se as D,Tb as z,Te as h,Ue as x,Ve as R,Wb as U,Ye as O,Yg as J,ab as f,af as Y,bb as E,cb as C,db as I,dc as P,dd as u,ha as b,hd as T,mg as N,va as y,wa as m,ya as p,zc as H}from"./chunk-SKPDQO4E.js";var oe=`<ng-container *ngIf="enableIdentitySelection; then identitySelectionTpl else identityFilterTpl"></ng-container>

<ng-template #identitySelectionTpl>
  <div [hidden]="visibleIdentitySelectionList">
    <ng-container *ngIf="identities">
      <div class="d-flex align-items-center cursor-pointer b-b-1 py-2" *ngIf="identities.length > 0"
        (click)="onShowIdentities($event)">
        <div class="spinner-grow spinner-grow-sm text-primary" role="status" *ngIf="visibleIdentitySpinner">
          <span class="sr-only"></span>
        </div>
        <span class="text-md text-bold text-success">{{paginationResponse.total}} {{'PACS.USER'|translate}}</span>
        <button class="btn btn-link px-0 py-1 ms-auto">
          <cds-icon shape="circle-arrow" direction="right" class="me-1"></cds-icon>{{'BUTTON.SHOW'|translate}}
        </button>
      </div>
      <div class="b-b-1 py-2" *ngIf="identities.length == 0">
        <span class="text-md text-bold text-danger">{{'PACS.NO_USER'|translate}}</span>
      </div>
    </ng-container>
    <ng-container *ngIf="visibleDetailSearch; then detailSearch else defaultSearch"></ng-container>
  </div>
  <div [hidden]="!visibleIdentitySelectionList">
    <div class="d-flex flex-column">
      <div class="d-flex justify-content-end b-b-1" (click)="onShowIdentityFilters($event)">
        <button class="btn btn-link px-0 py-1">
          <cds-icon shape="circle-arrow" direction="left" class="me-1"></cds-icon>{{'BUTTON.BACK'|translate}}
        </button>
      </div>
      <ng-container *ngFor="let identity of identities">
        <armon-captionlines *ngIf="identity.userCaptions" [captionlines]="identity.userCaptions" [showBorder]="true"
          class="mb-1 cursor-pointer bg-white hover-secondary" (click)="onIdentitySelected(identity)">
        </armon-captionlines>
      </ng-container>
      <armon-pagination [paginationResponse]="paginationResponse" (pageChanged)="pageChanged($event)" minimal="true">
      </armon-pagination>
    </div>
  </div>
</ng-template>

<ng-template #identityFilterTpl>
  <div class="mb-2">
    <div class="row">
      <div class="col-12 mb-3">
        <div class="form-check form-switch" *ngIf="enableDetailSearch" nz-tooltip
          nzTooltipTitle="{{ ( visibleDetailSearch ? 'COMMON.BASIC_FILTER_HEADER':'COMMON.DETAILED_FILTER_HEADER') | translate }}">
          <input type="checkbox" class="form-check-input" id="detailed-input" [(ngModel)]="visibleDetailSearch"
            (ngModelChange)="onDetailModeChanged($event)">
          <label class="form-check-label" for="detailed-input">{{ ( visibleDetailSearch ?
            'COMMON.DETAILED_FILTER_HEADER':'COMMON.BASIC_FILTER_HEADER') | translate }}</label>
        </div>
        <div *ngIf="!enableDetailSearch">
          <label class="report-form-label">{{'COMMON.BASIC_FILTER_HEADER'|translate}}</label>
        </div>
      </div>
    </div>
    <ng-container *ngIf="visibleDetailSearch; then detailSearch else defaultSearch"></ng-container>
  </div>
</ng-template>


<!-- DEFAULT SEARCH -->
<ng-template #defaultSearch>
  <div class="row">
    <div class="col-12 mb-2">
      <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_SEARCH_IDENTITIES' |
        translate:languageService.userTranslate}}</label>
      <armon-search-text-input [(ngModel)]="identityFilter.profileFilter" [maxLength]="20"
        (ngModelChange)="onFilterChanged($event)">
      </armon-search-text-input>
    </div>
    <div class="col-12 mb-2" *ngIf="permissionSearchOrganizationUnit">
      <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_ORGANIZATION_UNITS' | translate}}</label>
      <armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="identityFilter.organizationUnitIds"
        (ngModelChange)="onFilterChanged($event)">
      </armon-select-search>
      <label class="report-checkbox-label" nz-checkbox
        *ngIf="identityFilter.organizationUnitIds && identityFilter.organizationUnitIds.length > 0"
        [(ngModel)]="identityFilter.filterOrganizationUnitMembersHierarchically"
        (ngModelChange)="onFilterChanged($event)">{{'REPORT.SHOW_HIERARCHICALLY' |
        translate}}</label>
    </div>
    <div class="col-12 mb-2" *ngIf="permissionSearchUserGroup">
      <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_USER_GROUPS' |
        translate:languageService.userTranslate}}</label>
      <armon-select-search query="group" [allowMulti]="true" [(ngModel)]="identityFilter.userGroupIds"
        (ngModelChange)="onFilterChanged($event)">
      </armon-select-search>
    </div>
    <div class="col-12 mb-2" *ngIf="permissionSearchWorkplans">
      <label class="report-form-label">{{'REPORT.WORKPLANS' | translate}}</label>
      <armon-select-search query="workplan" [allowMulti]="true" [(ngModel)]="identityFilter.workplans"
        (ngModelChange)="onFilterChanged($event)">
      </armon-select-search>
    </div>
    <div class="col-12 mb-2" *ngIf="identityFilter">
      <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_STATUS' | translate}}</label>
      <armon-identity-status [(ngModel)]="identityFilter.status" (ngModelChange)="onFilterChanged($event)">
      </armon-identity-status>
    </div>
    <div class="col-12 mb-2" *ngIf="triggerWithApply">
      <div class="d-flex justify-content-center mt-3">
        <button class="btn btn-sm btn-outline-primary" (click)="onCancelClicked($event)">Vazge\xE7</button>
        <button class="btn btn-sm btn-primary" (click)="onApplyClicked($event)">Uygula</button>
      </div>
    </div>
  </div>
</ng-template>

<!-- DETAIL SEARCH -->
<ng-template #detailSearch>
  <form [formGroup]="detailedForm">
    <div class="row">
      <div class="col-12 centered">
        <button class="btn btn-primary btn-sm" (click)="onDetailFilterClicked($event)">{{'COMMON.SEARCH' |
          translate}}</button>
      </div>
      <div class="col-12 mt-2">
        <div class="form-check">
          <input type="checkbox" class="form-check-input" customValue [trueValue]="false" [falseValue]="true"
            id="statuscheck" formControlName="isDisabled" />
          <label class="form-check-label" for="statuscheck">{{'IDENTITY.STATUS' | translate}}</label>
        </div>
      </div>
      <div class="col-12">
        <label for="username-input" class="report-form-label">{{'IDENTITY.FILTER_TITLE_ACCOUNT' | translate}}</label>
        <input type="text" name="username" id="username-input" formControlName="username" maxlength="50"
          class="form-control form-control-sm" placeholder="{{'COMMON.SEARCH' | translate}}">
      </div>
      <div class="col-12 mt-2">
        <div class="form-check">
          <input type="checkbox" class="form-check-input" formControlName="accountEnabled" id="accountEnabledcheck" />
          <label class="form-check-label" for="accountEnabledcheck">{{'IDENTITY.FILTER_TITLE_ACCOUNT_ENABLED' |
            translate}}</label>
        </div>
      </div>
      <div class="col-12">
        <label for="role-input" class="report-form-label">{{'IDENTITY.ROLE' | translate}}</label>
        <select id="role-input" formControlName="roleId" class="form-select form-select-sm">
          <option [ngValue]="roleOption.id" *ngFor="let roleOption of allRoles">
            {{roleOption.name| translate}}
          </option>
        </select>
      </div>
      <div class="col-12">
        <label for="name-input" class="report-form-label">{{'IDENTITY.NAME' | translate}}</label>
        <input type="text" name="name" id="name-input" formControlName="name" maxlength="50"
          class="form-control form-control-sm" placeholder="{{'COMMON.SEARCH' | translate}}">
      </div>
      <div class="col-12">
        <label for="surname-input" class="report-form-label">{{'IDENTITY.SURNAME' | translate}}</label>
        <input type="text" name="surname" id="surname-input" formControlName="surname" maxlength="50"
          placeholder="{{'COMMON.SEARCH' | translate}}" class="form-control form-control-sm">
      </div>
      <div class="col-12">
        <label for="uniqueId-input" class="report-form-label">{{ ( sessionService.currentOrganizationUniqueIdCaption ?
          sessionService.currentOrganizationUniqueIdCaption:'IDENTITY.UNIQUEID') | translate }}</label>
        <input type="text" name="uniqueId" id="uniqueId-input" formControlName="uniqueId" maxlength="50"
          placeholder="{{'COMMON.SEARCH' | translate}}" class="form-control form-control-sm">
      </div>
      <div class="col-12">
        <label for="phoneNumber-input" class="report-form-label">{{'IDENTITY.PHONE_NUMBER' | translate}}</label>
        <input type="text" name="phoneNumber" id="phoneNumber-input" formControlName="phoneNumber" maxlength="20"
          placeholder="{{'COMMON.SEARCH' | translate}}" class="form-control form-control-sm">
      </div>
      <div class="col-12">
        <label for="email-input" class="report-form-label">{{'IDENTITY.EMAIL' | translate}}</label>
        <input type="text" name="email" id="email-input" formControlName="email" maxlength="100"
          class="form-control form-control-sm" placeholder="{{'COMMON.SEARCH' | translate}}">
      </div>
      <div class="col-12">
        <label for="address-input" class="report-form-label">{{'IDENTITY.ADDRESS' | translate}}</label>
        <textarea name="note" id="address-textarea" formControlName="address" rows="2" cols="20" maxlength="1023"
          class="form-control form-control-sm" style="resize:none"></textarea>
      </div>
      <div class="col-12 mb-2" *ngIf="permissionSearchOrganizationUnit">
        <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_ORGANIZATION_UNITS' | translate}}</label>
        <armon-select-search query="unit" [allowMulti]="false" formControlName="organizationUnitId" [allowClear]="true">
        </armon-select-search>
        <label class="report-checkbox-label" nz-checkbox
          *ngIf="detailedForm.get('organizationUnitId') && detailedForm.get('organizationUnitId').value"
          formControlName="includeDescendants">{{'REPORT.SHOW_HIERARCHICALLY' |
          translate}}</label>
      </div>
      <div class="col-12 mb-2" *ngIf="permissionSearchWorkplans">
        <label class="report-form-label">{{'PACS.WORKPLAN' | translate}}</label>
        <armon-select-search query="workplan" [allowMulti]="false" formControlName="workplan" [allowClear]="true">
        </armon-select-search>
      </div>
      <div class="col-12 mb-2" *ngIf="permissionSearchUserGroup">
        <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_USER_GROUPS' |
          translate:languageService.userTranslate}}</label>
        <armon-select-search query="group" [allowMulti]="false" formControlName="userGroupId" [allowClear]="true">
        </armon-select-search>
      </div>
    </div>
  </form>
  <armon-dynamic-form-filter #userOrganizationProfileDynamicForm
    [formFields]="dynamicFormFields"></armon-dynamic-form-filter>
  <armon-credential-extension-filter #userOrganizationCredentialExtensionFilter></armon-credential-extension-filter>
  <div class="row mt-2">
    <div class="col-12 mb-3 pos-relative">
      <label class="report-form-label">{{'IDENTITY.FILTER_TITLE_CREATED_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'"
        [owlDateTimeTrigger]="dtRange1" [owlDateTime]="dtRange1">
      <owl-date-time [firstDayOfWeek]="1" #dtRange1 [pickerType]="'calendar'"></owl-date-time>
      <cds-icon shape="times-circle" solid class="report-form-icon" *ngIf="filterDateRange!=null"
        title="{{'BUTTON.CLEAR'|translate}}" click-stop-propagation (click)="filterDateRange=null"></cds-icon>
    </div>
    <div class="col-12 d-flex justify-content-center">
      <button class="btn btn-primary btn-sm" (click)="onDetailFilterClicked($event)">{{'COMMON.SEARCH' |
        translate}}</button>
    </div>
  </div>

</ng-template>
<!-- DEFAULT SEARCH END -->`;var se=`.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}.filterHeader{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}.filterHeader .btn{margin-left:auto;margin-right:0;padding-right:.1rem}.filterHeader>p{margin-top:6px}.filterContent{margin-right:0}.filterContentWithChip>span{white-space:normal;height:auto;line-height:12px}.filterContentWithChip>span>cds-icon{cursor:pointer}.filterContentWithChip>div.checkbox{font-size:12px;margin-top:8px}
`;var ce=`<div class="row mt-2" *ngIf="visibleComponent">
  <div class="col-12">
    <label for="type-input" class="report-form-label">{{'CREDENTIAL.TITLE_TYPE' | translate}}</label>
    <select id="type-input" [(ngModel)]="credentialType" (ngModelChange)="onCredentialTypeChanged($event)"
      class="form-select form-select-sm">
      <option [ngValue]="typeOption.value" *ngFor="let typeOption of typeOptions">
        {{typeOption.name|translate}}
      </option>
    </select>
  </div>
  <div class="col-12 mt-2" *ngIf="credentialType || credentialType==0">
    <label for="data-input" class="report-form-label">{{'CREDENTIAL.TITLE_DATA' | translate}}</label>
    <input type="text" name="data" id="data-input" maxlength="50" [(ngModel)]="credentialData"
      placeholder="{{'COMMON.SEARCH' | translate}}" class="form-control form-control-sm">
  </div>
  <ng-container *ngIf="visibleExtraFields">
    <ng-container [ngSwitch]="credentialType">
      <form [formGroup]="vehiclePlateExtensionForm" *ngSwitchCase="6">

        <!-- CAR OWNER -->
        <div class="col-12">
          <label for="owner-input" class="report-form-label">{{'CREDENTIAL.TITLE_VEHICLE_OWNER' | translate}}</label>
          <input type="text" name="owner" id="owner-input" formControlName="owner" maxlength="100"
            class="form-control form-control-sm">
        </div>

        <!-- CAR TYPE -->
        <div class="col-12">
          <label class="report-form-label" for="vehicle-type-input">{{'CREDENTIAL.TITLE_VEHICLE' | translate}}
            {{'CREDENTIAL.TITLE_VEHICLE_TYPE' | translate}}</label>
          <armon-user-defined-list-input [type]="4" id="vehicle-type-input" formControlName="type">
          </armon-user-defined-list-input>
        </div>

        <!-- CAR COLOR -->
        <div class="col-12">
          <label class="report-form-label" for="vehicle-color-input">{{'CREDENTIAL.TITLE_VEHICLE' | translate}}
            {{'CREDENTIAL.TITLE_VEHICLE_COLOR' | translate}}</label>
          <armon-user-defined-list-input [type]="3" id="vehicle-color-input" formControlName="color">
          </armon-user-defined-list-input>
        </div>

        <!-- CAR YEAR -->
        <div class="col-12">
          <label class="report-form-label" for="vehicle-year-input">{{'CREDENTIAL.TITLE_VEHICLE' | translate}}
            {{'CREDENTIAL.TITLE_VEHICLE_YEAR' | translate}}</label>
          <select id="vehicle-year-input" formControlName="year" class="form-select form-select-sm">
            <option [ngValue]="vehicleYear" *ngFor="let vehicleYear of vehicleYears">
              {{vehicleYear.value}}
            </option>
          </select>
        </div>

        <!-- CAR BRAND -->
        <div class="col-12">
          <label class="report-form-label" for="vehicle-brand-input">{{'CREDENTIAL.TITLE_VEHICLE' | translate}}
            {{'CREDENTIAL.TITLE_VEHICLE_BRAND' | translate}}</label>
          <armon-user-defined-list-input [type]="1" id="vehicle-brand-input" formControlName="brand">
          </armon-user-defined-list-input>
        </div>

        <!-- CAR MODEL -->
        <div class="col-12">
          <label class="report-form-label" for="vehicle-model-input">{{'CREDENTIAL.TITLE_VEHICLE' | translate}}
            {{'CREDENTIAL.TITLE_VEHICLE_MODEL' | translate}}</label>
          <armon-user-defined-list-input [type]="2" [relatedType]="1"
            [relatedValueId]="vehiclePlateExtensionForm.get('brand').value?vehiclePlateExtensionForm.get('brand').value.id:null"
            id="vehicle-model-input" formControlName="model"></armon-user-defined-list-input>
        </div>
      </form>
      <form [formGroup]="vehicleUHFRfidExtensionForm" *ngSwitchCase="5">
        <div class="col-12">
          <!-- LICENCE PLATE -->
          <label for="licencePlate-input"
            class="report-form-label">{{'CREDENTIAL.TITLE_VEHICLE_PLATE' | translate}}</label>
          <input type="text" name="licencePlate" id="licencePlate-input" formControlName="licencePlate" maxlength="60"
            class="form-control form-control-sm">
        </div>
      </form>
    </ng-container>
    <ng-container *ngIf="visibleDynamicForm">
      <div class="col-12">
        <armon-dynamic-form-filter #credentialDynamicForm [formFields]="dynamicFormFields"></armon-dynamic-form-filter>
      </div>
    </ng-container>
  </ng-container>
</div>`;var de=`.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 me=`<ng-container *ngFor="let filterField of filterFields" [ngSwitch]="filterField.filterType">\r
  <!-- Text Field -->\r
  <ng-container *ngSwitchCase="1">\r
    <label class="report-form-label">{{filterField.caption|translate}}</label>\r
    <input type="text" #textInput maxlength="128" class="form-control form-control-sm pe-4"\r
      [(ngModel)]="fieldModels[filterField.name]" [attr.fieldName]="filterField.name"\r
      placeholder="{{filterField.placeholder}}">\r
  </ng-container>\r
  <!-- Checkbox -->\r
  <ng-container *ngSwitchCase="2">\r
    <div class="form-check">\r
      <input type="checkbox" #checkBoxInput clrCheckbox [attr.fieldName]="filterField.name" [id]="filterField.name"\r
        class="form-check-input" [(ngModel)]="fieldModels[filterField.name]"\r
        [checked]="(filterField.options && filterField.options.defaultValue && isBoolean(filterField.options.defaultValue)) ? filterField.options.defaultValue : false" />\r
      <label [for]="filterField.name" class="form-check-label">{{filterField.caption|translate}}</label>\r
    </div>\r
  </ng-container>\r
  <!--Combo Selection-->\r
  <ng-container *ngSwitchCase="3">\r
    <label class="report-form-label">{{filterField.caption|translate}}</label>\r
    <select #selectInput [attr.fieldName]="filterField.name" class="form-select form-select-sm"\r
      [(ngModel)]="fieldModels[filterField.name]">\r
      <option *ngFor="let option of filterField.options.options" value="{{option.value}}">{{option.captionLines[0]\r
        | translate}}</option>\r
    </select>\r
  </ng-container>\r
  <!--Date Range-->\r
  <ng-container *ngSwitchCase="4">\r
    <div class="position-relative">\r
      <label class="report-form-label">{{filterField.caption | translate}}</label>\r
      <input [(ngModel)]="fieldModels[filterField.name]" placeholder="{{'DATEPICKER.LABEL_CUSTOM'|translate}}"\r
        type="text" readonly owlinput class="form-control form-control-sm bg-white" [attr.fieldName]="filterField.name"\r
        [selectMode]="'range'" [owlDateTimeTrigger]="dtRange1" [owlDateTime]="dtRange1">\r
      <owl-date-time [firstDayOfWeek]="1" #dtRange1 #dateInput [pickerType]="'calendar'"></owl-date-time>\r
      <cds-icon shape="times-circle" solid class="date-remove-icon" *ngIf="fieldModels[filterField.name]!=null"\r
        title="{{'BUTTON.CLEAR'|translate}}" click-stop-propagation\r
        (click)="fieldModels[filterField.name]=null;"></cds-icon>\r
    </div>\r
  </ng-container>\r
</ng-container>`;var pe=`:host .date-remove-icon{position:absolute;color:#0a2a5a;right:8px;bottom:8px;cursor:pointer}
`;var Ee=function(a,e,t,i){var n=arguments.length,l=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(l=(n<3?r(l):n>3?r(e,t,l):r(e,t))||l);return n>3&&l&&Object.defineProperty(e,t,l),l},g=class{formFields=[];filterFields=[];fieldModels={};texts;checkBoxs;selects;dates;constructor(){}ngOnInit(){this.render()}render(){this.filterFields=[],this.formFields.forEach(e=>{let t=P(e);switch(t.type){case F.Text:t.filterType=1,this.filterFields.push(t);break;case F.Checkbox:t.filterType=2,this.filterFields.push(t);break;case F.Select:t.options.options.unshift({value:null,captionLines:["COMMON.ALL"]}),t.filterType=3,this.filterFields.push(t);break;case F.Date:t.filterType=4,this.filterFields.push(t);break;default:console.log("Filter type not found: "+t.type);break}}),this.filterFields.forEach(e=>{this.fieldModels[e.name]=null})}getFilterPairs(){let e=[];return console.log(this.fieldModels),this.texts.forEach(t=>{if(t.nativeElement&&this.fieldModels[t.nativeElement.getAttribute("fieldName")]&&this.fieldModels[t.nativeElement.getAttribute("fieldName")]!=""){let i=new c;i.name=t.nativeElement.getAttribute("fieldName"),i.value=this.fieldModels[i.name],e.push(i)}}),this.checkBoxs.forEach(t=>{if(t.nativeElement&&this.fieldModels[t.nativeElement.getAttribute("fieldName")]==!0){let i=new c;i.name=t.nativeElement.getAttribute("fieldName"),i.value=this.fieldModels[i.name],e.push(i)}}),this.selects.forEach(t=>{if(this.fieldModels[t.nativeElement.getAttribute("fieldName")]&&this.fieldModels[t.nativeElement.getAttribute("fieldName")]!=""){let i=new c;i.name=t.nativeElement.getAttribute("fieldName"),i.value=this.fieldModels[i.name],e.push(i)}}),this.dates.forEach(t=>{if(t.dtInput?.elementRef?.nativeElement&&!U(this.fieldModels[t.dtInput.elementRef.nativeElement.getAttribute("fieldName")])&&!z(this.fieldModels[t.dtInput.elementRef.nativeElement.getAttribute("fieldName")])){let i=new c;i.name=t.dtInput.elementRef.nativeElement.getAttribute("fieldName"),i.value={start:this.fieldModels[i.name][0],end:this.fieldModels[i.name][1]},e.push(i)}}),e}static ctorParameters=()=>[];static propDecorators={formFields:[{type:d}],texts:[{type:y,args:["textInput"]}],checkBoxs:[{type:y,args:["checkBoxInput"]}],selects:[{type:y,args:["selectInput"]}],dates:[{type:y,args:["dateInput"]}]}};g=Ee([p({selector:"armon-dynamic-form-filter",template:me,standalone:!0,providers:[{provide:R,useClass:k}],imports:[f,C,I,h,u,O],styles:[pe]})],g);var Ce=function(a,e,t,i){var n=arguments.length,l=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(l=(n<3?r(l):n>3?r(e,t,l):r(e,t))||l);return n>3&&l&&Object.defineProperty(e,t,l),l},M=class{sessionService;formBuilder;visibleComponent=!1;visibleExtraFields=!1;credentialType=null;credentialData;vehiclePlateExtensionForm;vehicleUHFRfidExtensionForm;vehicleYears;visibleDynamicForm=!1;dynamicFormFields;typeOptions;credentialDynamicForm;constructor(e,t){this.sessionService=e,this.formBuilder=t}ngOnInit(){this.createTypeList(),this.createYearOptions()}ngOnDestroy(){}createYearOptions(){if(!this.vehicleYears){let t=[];for(var e=new Date().getFullYear()+1;e>1900;e--)t.push({id:e,value:e});this.vehicleYears=t}}createTypeList(){if(!this.typeOptions){this.typeOptions=[];let e=new c;e.name="COMMON.SELECT_ONE",e.value=null,this.typeOptions.push(e),this.sessionService.currentOrganizationCredentialTypes.forEach(t=>{let i=$.find(n=>n.type===t);if(i)switch(i.type){case s.ProximityCard:case s.BLE:case s.MiFare:case s.AccessToken:case s.UHFRfid:case s.VehiclePlate:case s.NFC:let n=new c;n.name=i.description,n.value=i.type,this.typeOptions.push(n);break}}),this.visibleComponent=this.typeOptions.length>1}}onCredentialTypeChanged(e){this.setVisibleExtraFieldsForm(this.credentialType),this.setVisibilityDynamicForm(this.credentialType)}setVisibleExtraFieldsForm(e){switch(e){case s.VehiclePlate:this.vehiclePlateExtensionForm?this.vehiclePlateExtensionForm.reset():this.vehiclePlateExtensionForm=this.formBuilder.group({owner:[null],type:[null],color:[null],year:[null],brand:[null],model:[null]}),this.visibleExtraFields=!0;break;case s.UHFRfid:this.vehicleUHFRfidExtensionForm?this.vehicleUHFRfidExtensionForm.reset():this.vehicleUHFRfidExtensionForm=this.formBuilder.group({licencePlate:[null]}),this.visibleExtraFields=!0;default:this.visibleExtraFields=!1;break}}setVisibilityDynamicForm(e){this.visibleDynamicForm=!1;let t=this.sessionService.currentOrganization.credentialTypes.find(i=>i.type==e);t&&t.customFields&&t.customFields.length>0&&(this.dynamicFormFields=t.customFields,this.visibleDynamicForm=!0)}getUserOrganizationCredential(){if(this.visibleComponent==!1)return null;let e=new Z;if(this.credentialType||this.credentialType==0){switch(e.type=this.credentialType,e.data=this.credentialData,this.credentialType){case s.VehiclePlate:e.extensionFields=c.getFromObject(this.vehiclePlateExtensionForm.value);break;case s.UHFRfid:e.extensionFields=c.getFromObject(this.vehicleUHFRfidExtensionForm.value);break}return this.visibleDynamicForm&&(e.customFields=this.credentialDynamicForm.getFilterPairs()),e}else return null}static ctorParameters=()=>[{type:S},{type:D}];static propDecorators={credentialDynamicForm:[{type:m,args:["credentialDynamicForm"]}]}};M=Ce([p({selector:"armon-credential-extension-filter",template:ce,standalone:!0,imports:[E,h,N,f,C,I,x,ne,g,u],styles:[de]})],M);var Ie=function(a,e,t,i){var n=arguments.length,l=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(a,e,t,i);else for(var o=a.length-1;o>=0;o--)(r=a[o])&&(l=(n<3?r(l):n>3?r(e,t,l):r(e,t))||l);return n>3&&l&&Object.defineProperty(e,t,l),l},fe=class{interactionService;authService;formBuilder;roleService;identityService;languageService;sessionService;dynamicFormService;currentFilter;triggerWithApply;enableDetailSearch=!1;visibleDetailSearch=!1;enableIdentitySelection=!1;identitySelectionTake=8;visibleIdentitySelectionList=!1;closed=new b;filterChanged=new b;filterDetailChanged=new b;identitySelected=new b;selectionForHierarchicalOrganizationUnit;identityFilter;visibleIdentitySpinner=!1;permissionSearchUserGroup;permissionSearchOrganizationUnit;permissionSearchWorkplans;delayOrganizationUnitSelection;subscriptionShowIdentitiesRequested;filterDateRange=null;identities;paginationResponse=new A;paginationRequest=new K;identitySearch;userOrganizationProfileDynamicForm;userOrganizationCredentialExtensionFilter;detailedForm;allRoles;currentDetailedFilter;dynamicFormFields;filterChangeEnabled=!1;constructor(e,t,i,n,l,r,o,ue){this.interactionService=e,this.authService=t,this.formBuilder=i,this.roleService=n,this.identityService=l,this.languageService=r,this.sessionService=o,this.dynamicFormService=ue,this.initializeSubscriptions(),this.checkPermissions()}ngOnInit(){this.dynamicFormFields=this.dynamicFormService.addPACSFieldsToFormFieldsModule(this.sessionService.getOrganizationFormFields(3),["previousServiceDuration","pacsEnabledRemainedAnnualPPermission"]),this.setFilter(this.currentFilter),this.enableIdentitySelection&&this.emitFilterChanged(this.currentFilter),this.setDetailedForm(),setTimeout(()=>{this.filterChangeEnabled=!0},600)}ngOnDestroy(){this.subscriptionShowIdentitiesRequested&&this.subscriptionShowIdentitiesRequested.unsubscribe()}ngOnChanges(e){e.currentFilter&&this.setFilter(this.currentFilter)}emitFilterChanged(e){this.filterChangeEnabled&&(this.filterChanged.emit(e),this.enableIdentitySelection&&this.fetchIdentities())}onHierarchicalOrganizationUnitSelectionChanged(e){this.identityFilter.organizationUnits.forEach(t=>{t.includeDescendants=this.selectionForHierarchicalOrganizationUnit}),this.checkTrigger()}onStatusFilterChanged(e){this.identityFilter.status=e,this.checkTrigger()}onClearFilterClicked(e){this.clearFilters(),this.checkTrigger()}onCancelClicked(e){this.closed.emit()}onApplyClicked(e){this.emitFilterChanged(this.identityFilter),this.closed.emit()}checkTrigger(){this.triggerWithApply||this.emitFilterChanged(w.getModifiedModel(this.identityFilter))}initializeSubscriptions(){}checkPermissions(){this.permissionSearchUserGroup=this.authService.checkPermission(T.USERGROUP.getRead()),this.permissionSearchOrganizationUnit=this.authService.checkPermission(T.ORGANIZATIONUNIT.getReadBasic()),this.permissionSearchWorkplans=this.authService.checkPermission(T.ATTENDANCECONTROL.getRead())}onFilterChanged(e){this.checkTrigger()}checkFilterData(){this.identityFilter||this.clearFilters()}clearFilters(){this.setFilter(),this.identitySearch&&this.identitySearch.resetText()}setFilter(e){this.identityFilter||(this.identityFilter=w.getEmptyModel()),e?Object.assign(this.identityFilter,e):this.identityFilter=w.getEmptyModel(),this.identityFilter.take=H.REQUEST_ITEM_LIMIT,this.identityFilter.skip=0,this.selectionForHierarchicalOrganizationUnit=this.identityFilter.organizationUnits.filter(t=>t.includeDescendants).length>0,this.identitySearch&&(this.identitySearch.initialText=this.identityFilter.profileFilter)}onDetailModeChanged(e){if(!this.allRoles){let t=new Q;t.id=null,t.name="COMMON.SELECT_ONE",this.allRoles=this.roleService.allRoles,this.allRoles.unshift(t)}this.visibleDetailSearch||this.emitFilterChanged(this.identityFilter)}setDetailedForm(){this.currentDetailedFilter=L.getEmptyModel(),this.detailedForm=this.formBuilder.group({accountEnabled:[null],username:[null],isDisabled:[null],roleId:[null],uniqueId:[null],name:[null],surname:[null],email:[null],phoneNumber:[null],address:[null],organizationUnitId:[null],includeDescendants:[!1],userGroupId:[null],workplan:[null]}),this.detailedForm.controls.isDisabled.setValue(this.currentDetailedFilter.userOrganization.isDisabled),this.detailedForm.controls.accountEnabled.setValue(this.currentDetailedFilter.user.accountEnabled)}onDetailFilterClicked(){let e=this.detailedForm.value;this.currentDetailedFilter=L.getEmptyModel(),this.currentDetailedFilter.user.accountEnabled=e.accountEnabled,e.username&&(this.currentDetailedFilter.user.username=e.username),this.currentDetailedFilter.userOrganization.isDisabled=e.isDisabled,e.roleId&&(this.currentDetailedFilter.userOrganization.roleId=e.roleId),e.uniqueId&&(this.currentDetailedFilter.userOrganizationProfile.uniqueId=e.uniqueId),e.name&&(this.currentDetailedFilter.userOrganizationProfile.name=e.name),e.surname&&(this.currentDetailedFilter.userOrganizationProfile.surname=e.surname),e.email&&(this.currentDetailedFilter.userOrganizationProfile.email=e.email),e.phoneNumber&&(this.currentDetailedFilter.userOrganizationProfile.phoneNumber=e.phoneNumber),e.address&&(this.currentDetailedFilter.userOrganizationProfile.address=e.address),e.organizationUnitId&&(this.currentDetailedFilter.organizationUnit.id=e.organizationUnitId),e.includeDescendants&&(this.currentDetailedFilter.organizationUnit.includeDescendants=e.includeDescendants),e.userGroupId&&(this.currentDetailedFilter.userGroup.id=e.userGroupId),e.workplan&&(this.currentDetailedFilter.workplan.id=e.workplan),this.currentDetailedFilter.userOrganizationProfile.extensionFields=this.userOrganizationProfileDynamicForm.getFilterPairs(),this.currentDetailedFilter.userOrganizationCredential=this.userOrganizationCredentialExtensionFilter.getUserOrganizationCredential(),this.filterDateRange?(this.currentDetailedFilter.createdDate.createdAtStart=_.fromJSDate(this.filterDateRange[0]).startOf("day").toJSDate(),this.currentDetailedFilter.createdDate.createdAtEnd=_.fromJSDate(this.filterDateRange[1]).endOf("day").toJSDate()):(this.currentDetailedFilter.createdDate.createdAtStart=null,this.currentDetailedFilter.createdDate.createdAtEnd=null),this.filterDetailChanged.emit(this.currentDetailedFilter)}fetchIdentities(e=!1){this.visibleIdentitySpinner=!0,this.identityFilter.skip=e?this.paginationRequest.skip:0,this.identityFilter.take=this.paginationRequest.take,this.identityFilter.take=this.identitySelectionTake,this.identityService.searchIdentities(this.identityFilter).subscribe(t=>{this.identities=t.items;let i=new A;i.take=t.take,i.skip=t.skip,i.total=t.total,this.paginationResponse=i,t.total==1&&this.identitySelected.emit(this.identities[0]),this.visibleIdentitySpinner=!1})}onShowIdentities(e){this.visibleIdentitySelectionList=!0}onShowIdentityFilters(e){this.visibleIdentitySelectionList=!1}onIdentitySelected(e){this.identitySelected.emit(e)}pageChanged(e){this.paginationRequest.skip=e.skip,this.paginationRequest.take=e.take,this.fetchIdentities(!0)}static ctorParameters=()=>[{type:j},{type:te},{type:D},{type:G},{type:X},{type:Y},{type:S},{type:W}];static propDecorators={currentFilter:[{type:d}],triggerWithApply:[{type:d}],enableDetailSearch:[{type:d}],visibleDetailSearch:[{type:d}],enableIdentitySelection:[{type:d}],identitySelectionTake:[{type:d}],closed:[{type:v}],filterChanged:[{type:v}],filterDetailChanged:[{type:v}],identitySelected:[{type:v}],identitySearch:[{type:m,args:["identitySearchInput"]}],userOrganizationProfileDynamicForm:[{type:m,args:["userOrganizationProfileDynamicForm"]}],userOrganizationCredentialExtensionFilter:[{type:m,args:["userOrganizationCredentialExtensionFilter"]}]}};fe=Ie([p({selector:"armon-identity-filter",template:oe,standalone:!0,providers:[{provide:R,useClass:k}],imports:[E,f,le,ie,J,h,N,ae,ee,q,B,x,re,g,M,O,V,u],styles:[se]})],fe);export{fe as a};
