import{a as ie}from"./chunk-IIY4IOHM.js";import{a as _}from"./chunk-JN2ZUHXX.js";import{a as W,b as q,c as Q}from"./chunk-UZB7YFT6.js";import{a as te}from"./chunk-5OT2MLHH.js";import{a as ee}from"./chunk-4MZCYQX4.js";import{b as X,c as J,d as Z}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as $}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Mb as G,Ob as K,a as fe,c as x,vb as I,za as Y}from"./chunk-YSQLW2JA.js";import{kd as H,md as w}from"./chunk-NVJ2ZZFT.js";import{Aa as d,Fb as N,Fg as u,Lb as g,Mg as j,Nc as l,Ng as E,Pd as B,Qf as S,Rd as T,Sd as z,Te as U,Yb as O,ab as m,bb as v,cb as C,cd as M,db as V,dc as A,dd as p,eb as F,g as pe,hd as R,jb as b,mc as L,nd as f,va as h,wa as P,ya as c,zc as D}from"./chunk-SKPDQO4E.js";var se=`<div class="h-100">
  <side-navigation #sideNavigation>
    <ng-template side-navigation-nav>
      <div class="row">
        <div class="col-12">
          <ng-container *ngIf="filterFields">
            <ng-container *ngFor="let filterField of filterFields" [ngSwitch]="filterField.filterType">
              <!-- Visitor Field Search -->
              <ng-container *ngSwitchCase="1">
                <label class="report-form-label">{{filterField.caption}}</label>
                <armon-visitor-field-search #fieldSearchComponent [fieldName]="filterField.name"
                  [isProfileField]="filterField.isProfileField"></armon-visitor-field-search>
              </ng-container>
              <!-- Checkbox -->
              <ng-container *ngSwitchCase="2">
                <div class="form-check mb-1 mt-2">
                  <input type="checkbox" #checkBox class="form-check-input" [attr.fieldName]="filterField.name"
                    [id]="filterField.name"
                    [checked]="(filterField.options && filterField.options.defaultValue && isBoolean(filterField.options.defaultValue)) ? filterField.options.defaultValue : false" />
                  <label [for]="filterField.name" class="form-check-label text-sm">{{filterField.caption}}</label>
                </div>
              </ng-container>
              <!--Combo Selection-->
              <ng-container *ngSwitchCase="3">
                <label class="report-form-label">{{filterField.caption}}</label>
                <select #select [attr.fieldName]="filterField.name" class="form-select form-select-sm">
                  <option *ngFor="let option of filterField.options.options" value="{{option.value}}">
                    {{option.captionLines[0]
                    | translate}}</option>
                </select>
              </ng-container>
            </ng-container>
          </ng-container>
        </div>
        <div class="col-12">
          <div class="form-check my-1">
            <input type="checkbox" [(ngModel)]="selectionOnlyBlacklist" class="form-check-input"
              id="selectionOnlyBlacklist" />
            <label for="selectionOnlyBlacklist" class="form-check-label text-sm">{{'VISITOR.ONLY_BLACK_LIST' |
              translate}}</label>
          </div>
        </div>
        <div class="col-12">
          <div class="form-check my-1">
            <input type="checkbox" [(ngModel)]="selectionOnlyTemporaryPermitted" class="form-check-input"
              id="selectionOnlyTemporaryPermitted" />
            <label for="selectionOnlyTemporaryPermitted"
              class="form-check-label text-sm">{{'VISITOR.ONLY_TEMPORARY_PERMITTED' | translate}}</label>
          </div>
        </div>
      </div>

      <!-- Buttons for filtering state -->
      <div class="d-flex justify-content-center mt-3">
        <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)">{{'COMMON.SEARCH' |
          translate}}</button>
      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row pt-2 pb-2" *ngIf="limitedMode">
          <div class="col-12">
            <div class="alert alert-warning alert-sm passive-alert">
              <div class="alert-items">
                <div class="alert-item static">
                  <div class="alert-text">
                    {{"VISITOR.DIRECTION_VISITOR_LIST_LIMITED"|translate}}<button class="ms-3 btn btn-sm btn-link"
                      (click)="exitLimitedMode($event)">{{'BUTTON.SHOW_ALL'|translate}}</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-12" *ngIf="lastResult">
            <p-table [value]="records" dataKey="id" [responsive]="true" rowExpandMode="single"
              [expandedRowKeys]="expandedRows">
              <ng-template pTemplate="header">
                <tr>
                  <th *ngFor="let column of columnFields">{{column.caption}}</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 *ngFor="let column of columnFields">
                    <ng-container [ngSwitch]="column.type">
                      <div *ngSwitchCase="5">
                        <cds-icon shape="{{record.values[column.name]?'check-circle':'minus'}}" class="cds-icon-20"
                          solid={{record.values[column.name]}}></cds-icon>
                      </div>
                      <ng-container *ngSwitchDefault>
                        <ng-container *ngIf="column.name=='name'">
                          <div class="name-column-container">
                            <span>{{record.values[column.name]}}</span>
                            <!-- STATES -->
                            <div class="mt-2">
                              <armon-icon-label [colorCode]="7" *ngIf="record.isBlacklisted">
                                <ng-template icon-label-icon>
                                  <cds-icon shape="no-access" solid></cds-icon>
                                </ng-template>
                                <ng-template icon-label-content>
                                  <span>{{'VISITOR.BLACK_LIST_USER'|translate}}</span>
                                  <span
                                    *ngIf="record.isBlacklistedFuture">&nbsp;({{'VISITOR.STATE_FUTURE_DATE'|translate}})</span>
                                </ng-template>
                              </armon-icon-label>
                              <armon-icon-label [colorCode]="8" *ngIf="record.isTempPermitted">
                                <ng-template icon-label-icon>
                                  <cds-icon shape="success-standard" solid></cds-icon>
                                </ng-template>
                                <ng-template icon-label-content>
                                  <span>{{'VISITOR.TEMPORARY_PERMITTED_USER'|translate}}</span>
                                  <span
                                    *ngIf="record.isTempPermittedFuture">&nbsp;({{'VISITOR.STATE_FUTURE_DATE'|translate}})</span>
                                </ng-template>
                              </armon-icon-label>
                            </div>
                          </div>
                          <!-- STATES -->
                        </ng-container>
                        <ng-container *ngIf="column.name!='name'">
                          <span>{{record.values[column.name]}}</span>
                        </ng-container>
                      </ng-container>
                    </ng-container>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-record>
                <tr>
                  <td [attr.colspan]="columnFields.length" class="expanded-row">
                    <div class="ms-2 py-2" *ngIf="permissionVisitorReport">
                      <button class="btn btn-sm btn-outline-primary"
                        (click)="onShowReportsClicked(record)">{{'WIDGET.VISIT_VISITOR_RECORDS'|translate}}</button>
                    </div>
                    <div *ngFor="let field of getDetailValues(record)" class="py-2 px-2">
                      <ng-container *ngIf="record.values[field.name]">
                        <span>{{field.caption}} :</span>
                        <ng-container [ngSwitch]="field.type">
                          <div *ngSwitchCase="5" class="d-inline-block ms-2">
                            <cds-icon shape="{{record.values[field.name]?'check-circle':'minus'}}" class="cds-icon-20"
                              solid={{record.values[field.name]}}></cds-icon>
                          </div>
                          <span *ngSwitchDefault>{{record.values[field.name]}}</span>
                        </ng-container>
                      </ng-container>
                    </div>
                    <div class="detail-state-container">
                      <span class="state-title">
                        <cds-icon shape="no-access" class="color-error me-2" solid></cds-icon>{{'VISITOR.BLACK_LIST'
                        |
                        translate}}
                      </span>
                      <span class="state-date" *ngIf="record.blacklistState">{{'VISITOR.STATE_START_DATE'
                        | translate}} : {{record.blacklistState.startUtcText}}</span>
                      <span class="state-date" *ngIf="record.blacklistState">{{'VISITOR.STATE_END_DATE'
                        | translate}} : {{record.blacklistState.endUtcText}}</span>
                      <span class="state-note"
                        *ngIf="record.blacklistState && record.blacklistState.note">{{'VISITOR.STATE_NOTE'
                        | translate}} : {{record.blacklistState.note}}</span>
                      <span class="state-date" *ngIf="!record.blacklistState">{{'VISITOR.INFO_NO_BLACK_LIST_USER' |
                        translate}}</span>
                      <div *ngIf="record.blacklistState && permissionBlackList" class="my-2">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onEditBlackListClicked(record)">{{'BUTTON.EDIT'|translate}}</button>
                        <button class="btn btn-sm btn-outline-primary ms-2"
                          (click)="onRemoveBlackListClicked(record)">{{'BUTTON.REMOVE'|translate}}</button>
                      </div>
                      <div *ngIf="!record.blacklistState && permissionBlackList" class="my-2">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onAddBlackListClicked(record)">{{'BUTTON.ADD'|translate}}</button>
                      </div>
                    </div>
                    <div class="detail-state-container">
                      <span class="state-title">
                        <cds-icon shape="success-standard" class="color-dark-blue-color me-2" solid></cds-icon>
                        {{'VISITOR.TEMPORARY_PERMITTED'
                        |
                        translate}}
                      </span>
                      <span class="state-date" *ngIf="record.tempPermitState">{{'VISITOR.STATE_START_DATE'
                        | translate}} : {{record.tempPermitState.startUtcText}}</span>
                      <span class="state-date" *ngIf="record.tempPermitState">{{'VISITOR.STATE_END_DATE'
                        | translate}} : {{record.tempPermitState.endUtcText}}</span>
                      <span class="state-note"
                        *ngIf="record.tempPermitState && record.tempPermitState.note">{{'VISITOR.STATE_NOTE'
                        | translate}} : {{record.tempPermitState.note}}</span>
                      <span class="state-date"
                        *ngIf="!record.tempPermitState">{{'VISITOR.INFO_NO_TEMPORARY_PERMITTED_USER'
                        | translate}}</span>
                      <div *ngIf="record.tempPermitState && permissionTempPermission" class="my-2">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onEditTempPermittedClicked(record)">{{'BUTTON.EDIT'|translate}}</button>
                        <button class="btn btn-sm btn-outline-primary ms-2"
                          (click)="onRemoveTempPermittedClicked(record)">{{'BUTTON.REMOVE'|translate}}</button>
                      </div>
                      <div *ngIf="!record.tempPermitState && permissionTempPermission" class="my-2">
                        <button class="btn btn-sm btn-outline-primary"
                          (click)="onAddTempPermittedClicked(record)">{{'BUTTON.ADD'|translate}}</button>
                      </div>
                    </div>
                    <div class="detail-state-container" *ngIf="gdprEnabled">
                      <span class="state-title">
                        <cds-icon shape="trash" class="color-primary me-2" solid></cds-icon>
                        {{'VISITOR.GDPR_TITLE'|translate}}
                      </span>
                      <div class="my-2">
                        <button class="btn btn-sm btn-outline-info me-2"
                          (click)="onAnonymousClicked(record)">{{'BUTTON.ANONYMOUS'|translate}}</button>
                        <button class="btn btn-sm btn-outline-danger" *ngIf="canBeDeleted"
                          (click)="onDeleteClicked(record)">{{'BUTTON.DELETE'|translate}}</button>
                      </div>
                    </div>
                    <div class="detail-state-container">
                      <span class="state-title">
                        <cds-icon shape="history" class="color-primary me-2" solid></cds-icon>
                        {{'VISITOR.ACTIONHISTORY'|translate}}
                      </span>
                      <armon-visitor-list-item-history [visitorId]="record.id" [visitorName]="record.values['name']">
                      </armon-visitor-list-item-history>
                    </div>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-12 my-2">
            <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var oe=`.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}.name-column-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}.detail-state-container{padding:.35rem;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;background-color:#fff;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;box-shadow:0 0 4px #ccc;margin:.35rem}.detail-state-container .state-title{margin:.21rem 0;font-size:.756rem}.detail-state-container .state-date{margin:.14rem 0;font-size:.672rem}.detail-state-container .state-note{margin:.14rem 0;font-size:.588rem}
`;var de=pe(fe());var re=`<div>

  <div class="history-container" *ngIf="lastHistoryActions.length > 0">
    <div class="history-item" *ngFor="let item of lastHistoryActions">
      <span class="message">{{item.message}}</span>
      <span class="user-date">{{item.actionUser.fullname}} - {{item.actionUtc | date:'medium'}}</span>
    </div>
  </div>

  <span class="history-empty" *ngIf="lastHistoryActions.length === 0">{{'VISITOR.INFO_NO_VISITOR_HISTORY' | translate}}</span>

  <div *ngIf="historyActions.length > 5">
    <button class="btn btn-sm btn-outline-primary" (click)="onShowAllClicked()">{{'BUTTON.SHOW_ALL'|translate}}</button>
  </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}.history-container{padding-top:6px;overflow-x:auto}.history-container .history-item{margin:3px;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;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-border-top-right-radius:.375rem;-moz-border-radius-topv:.375rem;border-top-right-radius:.375rem;-webkit-border-v-right-radius:.375rem;-moz-border-radius-bottomright:.375rem;border-bottom-right-radius:.375rem;border-left:3px solid #0a2a5a;padding:6px 6px 6px 12px;background-color:#eee}.history-container .history-item .message{margin-top:6px;font-size:.714rem;line-height:.6rem}.history-container .history-item .user-date{margin-top:6px;font-size:.588rem;line-height:.45rem}.history-empty{margin:.15rem 0;font-size:.672rem;line-height:.6rem}
`;var ae=`<div>
    <h3 class="modal-title mt-0">
      <cds-icon shape="history" class="me-2" size="md"></cds-icon>
      <span>{{'VISITOR.ACTIONHISTORY' | translate}} - {{visitorName}}</span>
    </h3>
    <div class="modal-body pt-3">
      <div class="history-container">
        <div class="history-item" *ngFor="let item of historyItems">
          <span class="message">{{item.message}}</span>
          <span class="user-date">{{item.actionUser.fullname}} - {{item.actionUtc | date:'medium'}}</span>
        </div>
      </div>
    </div>
    <div class="modal-footer">
      <button class="btn btn-primary me-0" (click)="closeClicked($event)">
        {{'BUTTON.CLOSE' | translate}}
      </button>
    </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}.history-container{padding-top:6px;min-height:160px;max-height:360px;overflow-x:auto}.history-container .history-item{margin:3px;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;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;-webkit-border-top-right-radius:.375rem;-moz-border-radius-topv:.375rem;border-top-right-radius:.375rem;-webkit-border-v-right-radius:.375rem;-moz-border-radius-bottomright:.375rem;border-bottom-right-radius:.375rem;border-left:3px solid #0a2a5a;padding:6px 6px 6px 12px;background-color:#eee}.history-container .history-item .message{margin-top:6px;font-size:.714rem;line-height:.6rem}.history-container .history-item .user-date{margin-top:6px;font-size:.588rem;line-height:.45rem}
`;var Se=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},y=class extends z{interactionService;historyItems=[];visitorName;constructor(e){super(),this.interactionService=e}onModalInitialized(){super.onModalInitialized()}closeClicked(e){this.cancelModal()}static ctorParameters=()=>[{type:S}];static propDecorators={historyItems:[{type:d}],visitorName:[{type:d}]}};y=Se([c({selector:"visitor-list-item-history-modal",template:ae,standalone:!0,imports:[m,b,p],styles:[le]})],y);var xe=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},k=class{visitorService;modalService;visitorId;visitorName;historyActions=[];constructor(e,t){this.visitorService=e,this.modalService=t}ngOnInit(){this.visitorService.getActionHistoryOfVisitor(this.visitorId).subscribe(e=>{this.historyActions=e.items||[]})}get lastHistoryActions(){return this.historyActions?this.historyActions.slice(0,5):[]}onShowAllClicked(){this.modalService.open(y,{settings:{size:"lg"},props:{historyItems:this.historyActions||[],visitorName:this.visitorName}}).result.then(e=>{}).catch(e=>{})}static ctorParameters=()=>[{type:I},{type:T}];static propDecorators={visitorId:[{type:d}],visitorName:[{type:d}]}};k=xe([c({selector:"armon-visitor-list-item-history",template:re,standalone:!0,imports:[v,m,b,p],styles:[ne]})],k);var Ie=function(n,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(r=n[a])&&(o=(s<3?r(o):s>3?r(e,t,o):r(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},ce=class{interactionService;authService;visitorService;routingService;modalService;translate;route;sessionService;lastFilter;lastResult;columnFields;detailFields;records=[];filterFields=[];limitedMode=!1;expandedRows={};selectionVisitor;fieldSearchComponents;checkBoxs;selects;selectionOnlyBlacklist=!1;selectionOnlyTemporaryPermitted=!1;permissionBlackList=!1;permissionTempPermission=!1;permissionVisitorReport=!1;gdprEnabled=!1;canBeDeleted=!1;paginationResponse=new E;paginationRequest=new j;constructor(e,t,i,s,o,r,a,me){this.interactionService=e,this.authService=t,this.visitorService=i,this.routingService=s,this.modalService=o,this.translate=r,this.route=a,this.sessionService=me,this.gdprEnabled=this.sessionService.currentOrganization&&this.sessionService.currentOrganization.visitorModuleSettings&&this.sessionService.currentOrganization.visitorModuleSettings.gdprEnabled,this.gdprEnabled&&(this.canBeDeleted=this.sessionService.currentOrganization.visitorModuleSettings.canBeDeleted)}get visitorActiveStatusTypes(){return H}get selectedVisitors(){return this.selectionVisitor?this.selectionVisitor.getSelection()||[]:[]}set selectedVisitors(e){e&&this.selectionVisitor&&this.selectionVisitor.setSelection(e)}ngOnInit(){this.permissionBlackList=this.authService.checkPermission(R.VISITOR.getBlacklist()),this.permissionTempPermission=this.authService.checkPermission(R.VISITOR.getTempPermission()),this.permissionVisitorReport=!0;let e=this.sessionService.currentOrganization.visitorModuleSettings.visitorProfileFormFields.filter(t=>t.reportable);e.forEach(t=>{t.isProfileField=!0}),L(e,"reportOrder"),this.filterFields=[],e.forEach(t=>{let i=A(t);if(O(i.reportableInDetail)||i.reportableInDetail==!1)switch(i.type){case g.Text:i.filterType=1,this.filterFields.push(i);break;case g.Checkbox:i.filterType=2,this.filterFields.push(i);break;case g.Select:i.options.type==1?(i.options.options.unshift({value:null,captionLines:["VISITORACTIVESTATUS.ALL"]}),i.filterType=3,this.filterFields.push(i)):(i.filterType=1,this.filterFields.push(i));break}})}ngAfterViewInit(){this.lastFilter=this.getFilter(),this.route.queryParams.subscribe(e=>{e&&e[x.VisitorId]&&e[x.VisitorId]!=""&&(this.limitedMode=!0,this.lastFilter.visitorProfileId=e[x.VisitorId],this.expandedRows[this.lastFilter.visitorProfileId]=1),this.fetchData()})}ngOnDestroy(){}isBoolean(e){return typeof e=="boolean"}getDetailValues(e){return this.detailFields.filter(t=>e.values[t.name])}setPaginationRecords(e){this.records=e}fetchPaginationRecords(e){this.lastFilter.skip=e,this.fetchData()}isProfileField(e){return this.filterFields.find(t=>t.name==e).isProfileField}getFilter(e=!1){let t=new Y;return t.visitorProfileFilterFields=[],this.fieldSearchComponents.forEach(i=>{if(i.getSelection()&&i.getSelection().length>0){let s=new u;s.name=i.fieldName,s.value=i.getSelection()[0].value?i.getSelection()[0].value:i.getSelection()[0].captionLines[0],t.visitorProfileFilterFields.push(s)}else if(i.getInputText()&&i.getInputText()!=""){let s=new u;s.name=i.fieldName,s.value=i.getInputText(),t.visitorProfileFilterFields.push(s)}}),this.checkBoxs.forEach(i=>{if(i.nativeElement&&i.nativeElement.checked==!0){let s=new u;s.name=i.nativeElement.getAttribute("fieldName"),s.value=i.nativeElement.checked,t.visitorProfileFilterFields.push(s)}}),this.selects.forEach(i=>{if(i.nativeElement.value&&i.nativeElement.value!=""){let s=new u;s.name=i.nativeElement.getAttribute("fieldName"),s.value=+i.nativeElement.value,t.visitorProfileFilterFields.push(s)}}),t.showOnlyBlacklist=this.selectionOnlyBlacklist==!0?!0:null,t.showOnlyTemporaryPermitted=this.selectionOnlyTemporaryPermitted==!0?!0:null,t.skip=e?null:0,t.take=e?null:D.REQUEST_REPORT_ITEM_LIMIT,t}onGetReportClicked(e){this.lastFilter=this.getFilter(),this.fetchData()}onGetExcelClicked(e){let t=this.getFilter(!0);this.visitorService.getVisitorListAsExcel(t).subscribe(i=>{this.translate.get(["PAGES.VISITOR_LIST"]).subscribe(s=>{de.default.saveAs(i,s["PAGES.VISITOR_LIST"]+".xlsx")})})}fetchData(){this.visitorService.getVisitorList(this.lastFilter).subscribe(e=>{this.lastResult=e,this.columnFields=this.sessionService.currentOrganization.visitorModuleSettings.visitorProfileFormFields.filter(t=>t.reportable&&(O(t.reportableInDetail)||t.reportableInDetail==!1)),this.detailFields=this.sessionService.currentOrganization.visitorModuleSettings.visitorProfileFormFields.filter(t=>t.reportable&&t.reportableInDetail==!0),this.records=e.items||[],this.paginationResponse=new E,this.paginationResponse.total=e.total,this.paginationResponse.take=e.take,this.paginationResponse.skip=e.skip})}updateProfile(e){this.visitorService.getVisitorDetail(e.id).subscribe(t=>{let i=this.records.findIndex(s=>s.id==e.id);this.records.splice(i,1,t)})}upsertBlackList(e){this.modalService.open(_,{settings:{size:"md"},props:{profile:e,visitorState:w.Forbidden}}).result.then(t=>{this.interactionService.showMessage("VISITOR.COMPLETED_UPDATE_BLACK_LIST",null,l.Success),this.updateProfile(e)}).catch(t=>{})}upsertTempPermit(e){this.modalService.open(_,{settings:{size:"md"},props:{profile:e,visitorState:w.TemporaryPermit}}).result.then(t=>{this.interactionService.showMessage("VISITOR.COMPLETED_UPDATE_TEMPORARY_PERMITTED",null,l.Success),this.updateProfile(e)}).catch(t=>{})}removeBlackList(e){this.interactionService.showDialog(e.values[f.VISITOR.Name],"VISITOR.APPROVE_FOR_REMOVE_BLACK_LIST",null,null,!0,"BUTTON.REMOVE","BUTTON.CANCEL",!0,()=>{this.visitorService.removeVisitorBlacklistState(e.id).subscribe(t=>{this.interactionService.showMessage("VISITOR.COMPLETED_REMOVE_BLACK_LIST",null,l.Success),this.updateProfile(e)})})}removeTempPermit(e){this.interactionService.showDialog(e.values[f.VISITOR.Name],"VISITOR.APPROVE_FOR_REMOVE_TEMPORARY_PERMITTED",null,null,!0,"BUTTON.REMOVE","BUTTON.CANCEL",!0,()=>{this.visitorService.removeVisitorTempPermitState(e.id).subscribe(t=>{this.interactionService.showMessage("VISITOR.COMPLETED_REMOVE_TEMPORARY_PERMITTED",null,l.Success),this.updateProfile(e)})})}anonymous(e){this.interactionService.showDialog(e.values[f.VISITOR.Name],"VISITOR.APPROVE_FOR_ANONYMOUS",null,null,!0,"BUTTON.ANONYMOUS","BUTTON.CANCEL",!0,()=>{this.visitorService.anonymous(e.id).subscribe(()=>{this.interactionService.showMessage("VISITOR.COMPLETED_ANONYMOUS",null,l.Success),this.updateProfile(e)})})}delete(e){this.interactionService.showDialog(e.values[f.VISITOR.Name],"VISITOR.APPROVE_FOR_DELETE",null,null,!0,"BUTTON.DELETE","BUTTON.CANCEL",!0,()=>{this.visitorService.delete(e.id).subscribe(()=>{this.interactionService.showMessage("VISITOR.COMPLETED_DELETE",null,l.Success),this.fetchData()})})}pageChanged(e){this.lastFilter.skip=e.skip,this.lastFilter.take=e.take,this.fetchData()}exitLimitedMode(e){this.limitedMode=!1,this.lastFilter.visitorProfileId&&delete this.lastFilter.visitorProfileId,this.expandedRows={},this.fetchData()}onAddBlackListClicked(e){this.upsertBlackList(e)}onEditBlackListClicked(e){this.upsertBlackList(e)}onRemoveBlackListClicked(e){this.removeBlackList(e)}onAddTempPermittedClicked(e){this.upsertTempPermit(e)}onEditTempPermittedClicked(e){this.upsertTempPermit(e)}onRemoveTempPermittedClicked(e){this.removeTempPermit(e)}onShowReportsClicked(e){this.routingService.gotoVisitorReport(e.id)}onAnonymousClicked(e){this.anonymous(e)}onDeleteClicked(e){this.delete(e)}static ctorParameters=()=>[{type:S},{type:K},{type:I},{type:G},{type:T},{type:M},{type:N},{type:B}];static propDecorators={selectionVisitor:[{type:P,args:["searchVisitor"]}],fieldSearchComponents:[{type:h,args:["fieldSearchComponent"]}],checkBoxs:[{type:h,args:["checkBox"]}],selects:[{type:h,args:["select"]}]}};ce=Ie([c({selector:"armon-visitor-list",template:se,standalone:!0,imports:[Z,X,v,m,C,V,ie,U,J,te,ee,F,Q,W,q,k,$,p],styles:[oe]})],ce);export{ce as VisitorListComponent};
