import{a as bt}from"./chunk-IIY4IOHM.js";import{a as O}from"./chunk-OAYF7FNF.js";import{a as vt}from"./chunk-HYAJENKW.js";import"./chunk-KCLQIV7M.js";import{a as P}from"./chunk-5OT2MLHH.js";import{a as w}from"./chunk-4MZCYQX4.js";import{b as ht,c as gt,d as ut}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import{a as ft}from"./chunk-CO3X7TQN.js";import{a as T}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{G as et,I as it,J as k,Mb as mt,Ob as pt,a as Vt,c as d,l as tt,vb as lt,wb as ct,ya as nt,yb as dt}from"./chunk-YSQLW2JA.js";import{D as rt,H as ot,jd as st,kd as at}from"./chunk-NVJ2ZZFT.js";import{Aa as g,Dc as l,Fb as U,Fg as m,Lb as u,Mg as y,Nc as J,Ng as h,Pd as W,Qf as R,Rd as Y,Sd as Q,Te as K,Yb as j,_a as A,ab as S,bb as x,cb as N,cd as $,db as z,dc as G,dd as f,eb as M,fb as L,g as Dt,gg as v,hd as _,hg as X,ic as H,jb as F,jg as Z,mc as B,md as q,nd as c,va as b,wa as V,ya as p,zc as I}from"./chunk-SKPDQO4E.js";var St=`<div class="h-100">
  <side-navigation #sideNavigation>
    <ng-template side-navigation-nav>
      <div>
        <div class="row">
          <div class="col-xl-12">
            <label class="report-form-label">{{'REPORT.VISITOR'|translate}}</label>
            <armon-visitor-search #searchVisitor [multiselect]="true" [showActiveFilter]="false"
              [activeFilterSelected]="false"></armon-visitor-search>
            <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"
                    [endPoint]="(filterField && filterField.options && filterField.options.formFieldSearchEndPoint)?filterField.options.formFieldSearchEndPoint:null">
                  </armon-visitor-field-search>
                </ng-container>
                <!-- Checkbox -->
                <ng-container *ngSwitchCase="2">
                  <div class="form-check">
                    <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">{{filterField.caption}}</label>
                  </div>
                </ng-container>
                <!--Combo Selection-->
                <ng-container *ngSwitchCase="3">
                  <div class="form-group">
                    <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>
                  </div>
                </ng-container>
              </ng-container>
            </ng-container>
            <!-- Visit State -->
            <label class="report-form-label">{{'VISITOR.VISIT_STATE_TITLE'|translate}}</label>
            <div class="btn-group btn-group-sm w-100" *ngIf="lastFilter && lastFilter.type">
              <button class="btn"
                [ngClass]="{'btn-primary': lastFilter.type==1, 'btn-outline-primary': lastFilter.type!=1}"
                (click)="onStateChanged(1)">{{'VISITOR.VISIT_STATE_ALL' | translate}}</button>
              <button class="btn"
                [ngClass]="{'btn-success': lastFilter.type==2, 'btn-outline-success': lastFilter.type!=2}"
                (click)="onStateChanged(2)">{{'VISITOR.VISIT_STATE_ACTIVE' | translate}}</button>
              <button class="btn"
                [ngClass]="{'btn-danger': lastFilter.type==3, 'btn-outline-danger': lastFilter.type!=3}"
                (click)="onStateChanged(3)">{{'VISITOR.VISIT_STATE_TERMINATED' | translate}}</button>
            </div>
            <div class="mt-2" *ngIf="visibleRegistrationPointSearch">
              <label class="report-form-label">{{'VISITOR.REGISTRATION_POINT_TITLE'|translate}}</label>
              <armon-select-search query="registrationpoint" [allowMulti]="false"
                [(ngModel)]="visitorRegistrationPointId">
              </armon-select-search>
              <!-- <armon-registration-point-search #searchRegistrationPoint [multiselect]="false">
              </armon-registration-point-search> -->
            </div>
          </div>
        </div>

        <!-- Buttons for filtering state -->
        <div class="centered filterButtons">
          <button class="btn btn-success btn-sm me-2" (click)="onGetExcelClicked($event)"
            *ngIf="!isSelfReport">{{'BUTTON.EXCEL'
            | translate}}</button>
          <button class="btn btn-primary btn-sm" (click)="onGetReportClicked($event)">{{'REPORT.GET_REPORT' |
            translate}}</button>
        </div>

      </div>
    </ng-template>
    <ng-template side-navigation-content>
      <div class="report-data-container">
        <div class="row report-filter-container">
          <div class="col-xl-12" style="min-height:0;">
            <div class="row">
              <div class="col-xl-12">
                <armon-date-picker [options]="datePickerOptions" (selectionChanged)="onDateSelectionChanged($event)"
                  #datePicker></armon-date-picker>
              </div>
            </div>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-xl-12" *ngIf="lastResult">
            <p-table [value]="records" dataKey="visitId" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th>{{'REPORT.VISITOR_HISTORY_HEADER_DATE' | translate}}</th>
                  <th *ngFor="let column of columnFields">{{column.caption|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>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{record.visitStartUtcHourText}} - {{record.visitEndUtcHourText}}</span>
                      <span class="sub-text">{{record.visitStartUtcText}}</span>
                      <span class="sub-text" *ngIf="record.visitEndUtcText">{{record.visitEndUtcText}}</span>
                    </div>
                  </td>
                  <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>
                      <span *ngSwitchDefault>{{record.values[column.name]}}</span>
                    </ng-container>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-record>
                <tr>
                  <td [attr.colspan]="columnFields.length + 1" class="expanded-row">
                    <div *ngIf="permissionVisitorRead" class="my-2 px-2">
                      <button class="btn btn-sm btn-outline-primary me-2"
                        (click)="onShowVisitHistoryClicked(record)">{{'VISITOR.ACTIONHISTORY'|translate}}</button>
                      <button class="btn btn-sm btn-outline-primary"
                        (click)="onShowProfileClicked(record)">{{'WIDGET.VISIT_VISITOR_PROFILE'|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 *ngIf="!isSelfReport" class="d-flex mb-2">
                      <img [src]="record.visitFields.cameraSnapshot.data"
                        *ngIf="record.visitFields.cameraSnapshot && record.visitFields.cameraSnapshot.data"
                        class="snapshot-image cursor-pointer" (click)="onImageClicked($event, record.visitFields.cameraSnapshot.data)">
                      <armon-report-visitor-access-logs [historyItem]="record"
                        [ngClass]="{'ms-3': record.visitFields.cameraSnapshot && record.visitFields.cameraSnapshot.data}"
                        class="flex-grow-1 bg-white p-2 d-none d-md-block"></armon-report-visitor-access-logs>
                    </div>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-xl-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 xt=`.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}.filterArea{background:#fff;border:1px solid rgb(235,235,235);padding:12px;border-radius:4px;box-shadow:0 3px 6px #ebebeb;-moz-transition:width .25s ease;-webkit-transition:width .25s ease;-o-transition:width .25s ease;transition:width .25s ease}.filterArea>div:first-child>p:first-child{margin-top:0}.filterSummary>p:first-child{margin-top:0}.filterContent>div{margin-bottom:12px}.filterContent clr-checkbox{margin-top:12px}.filterButtons{margin-top:12px}.filterSmallButtons>button:last-child{margin-right:0!important}.filterMoreInfo p{margin-top:0}.filterMoreInfo div{margin-bottom:8px}.filterMoreInfo div:last-child{margin-bottom:0}.resultArea{position:relative}.resultDisabled{position:absolute;width:100%;height:100%;background:linear-gradient(to top,#f3f4f6,transparent 150%)}.required:after{content:"*";font-size:1.1em;color:#c92100;margin-left:6px}.report-data-container{height:100%;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}.report-data-container .report-filter-container{margin-bottom:.2rem}.report-data-container .report-data-table-container{overflow-y:auto;overflow-x:hidden;-webkit-flex-grow:1;-webkit-box-flex:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1;height:0;display:block}.report-multi-data-cell{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;line-height:initial!important}.report-multi-data-cell .title-text{font-size:1.008rem}.report-multi-data-cell .main-text{font-size:.84rem}.report-multi-data-cell .sub-text{font-size:.672rem;color:#aaa}.report-form-label{font-size:.672rem;line-height:.84rem;font-weight:500;margin-top:.3rem;margin-bottom:.1rem!important}.report-form-label label{margin-bottom:0!important}.report-form-icon{position:absolute;color:#0a2a5a;right:15px;bottom:6px;cursor:pointer}.report-checkbox-label{font-size:.672rem}.infoMessage{text-align:center;color:#0a2a5a}.snapshot-image{min-width:min-content;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem}
`;var Tt=Dt(Vt());var Ft=`<div class="modal-header">
    <span class="text-lg">{{'VISITOR.ACTIONHISTORY' | translate}}</span>
</div>
<div class="modal-body">
    <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" (click)="closeClicked($event)">
        {{'BUTTON.CLOSE' | translate}}
    </button>
</div>`;var It=`.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 zt=function(a,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,t,e,i);else for(var n=a.length-1;n>=0;n--)(s=a[n])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},C=class extends Q{interactionService;historyItems=[];visitorName="";constructor(t){super(),this.interactionService=t}onModalInitialized(){super.onModalInitialized()}closeClicked(t){this.cancelModal()}static ctorParameters=()=>[{type:R}];static propDecorators={historyItems:[{type:g}],visitorName:[{type:g}]}};C=zt([p({selector:"report-visitor-history-modal",template:Ft,standalone:!0,imports:[S,F,f],styles:[It]})],C);var E=class extends dt{interactionService;waitingFilter=!0;pagination;cache=!0;constructor(t){super(),this.interactionService=t}onPageChanged(t){}onGetReportClicked(t){}onCancelFilterClicked(t){this.waitingFilter=!1}onChangeFilterClicked(t){this.waitingFilter=!0,this.setFieldsFromLastFilter()}setPaginationRecords(t){}fetchPaginationRecords(t){}setFieldsFromLastFilter(){}};var Rt=`<div class="row" id="report-data-table-container" *ngIf="records">
    <ng-container *ngIf="records.length>0">
        <div class="col-12">
            <p-table [value]="records" dataKey="date" [responsive]="true" rowExpandMode="single">
                <ng-template pTemplate="header">
                    <tr>
                        <th>{{'REPORT.ACCESS_LOGS_HEADER_ACCESS_POINT' | translate}}</th>
                        <th>{{'REPORT.ACCESS_LOGS_HEADER_ACCESS_TIME' | translate}}</th>
                        <th>{{'REPORT.ACCESS_LOGS_HEADER_STATUS' | translate}}</th>
                    </tr>
                </ng-template>
                <ng-template pTemplate="body" let-record>
                    <tr class="data-row">
                        <td>
                            <span>{{record.accessControlPoint.name}}</span>
                        </td>
                        <td>
                            <span>{{record.utc | date:'medium'}}</span>
                        </td>
                        <td>
                            <span class="d-flex">
                                <div class="resultItemStatus" [ngStyle]="{background: record.statusColor}"></div>
                                {{record.statusInfo | translate}}
                            </span>
                        </td>
                    </tr>
                </ng-template>
            </p-table>
        </div>
    </ng-container>
    <ng-container *ngIf="records.length==0">
        <div class="col-12 d-flex justify-content-center pt-3">
            <span class="text-sm">{{'ACCESS_LOG.NO_RECORD'|translate}}</span>
        </div>
    </ng-container>
    <div class="col-12 my-2">
        <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
            (pageChanged)="pageChanged($event)"></armon-pagination>
    </div>
</div>`;var yt="";var Ut=function(a,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,t,e,i);else for(var n=a.length-1;n>=0;n--)(s=a[n])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},D=class{reportService;historyItem;waitingResult;pagination;lastFilter;lastResult;records=[];paginationResponse=new h;paginationRequest=new y;constructor(t){this.reportService=t}ngOnInit(){this.waitingResult=!0,this.getInitialReportData()}pageChanged(t){this.lastFilter.skip=t.skip,this.lastFilter.take=t.take,this.fetchAccessLogs()}getInitialReportData(){this.lastFilter=new st,this.lastFilter.startUtc=l.fromJSDate(this.historyItem.visitStartUtc).minus({minutes:5}).toJSDate(),this.lastFilter.endUtc=l.fromJSDate(this.historyItem.visitEndUtc?this.historyItem.visitEndUtc:new Date).plus({minutes:5}).toJSDate(),this.lastFilter.accessResult=rt.All,this.lastFilter.direction=ot.All,this.lastFilter.userIds=[this.historyItem.visitorUserId],this.lastFilter.showOnlyRemoteAccess=!1,this.lastFilter.showOnlyManuallyInserted=!1,this.lastFilter.showOnlyExitButtons=!1,this.lastFilter.skip=0,this.lastFilter.take=I.REQUEST_ITEM_LIMIT,this.lastFilter.returnTotalCount=!0,this.lastFilter.sortDateDesc=!0,this.fetchAccessLogs()}fetchAccessLogs(){this.reportService.getVisitorAccessLogs(this.lastFilter).subscribe(t=>{this.waitingResult=!1,this.lastResult=t,this.records=t.items||[];let e=new h;e.skip=t.skip,e.take=t.take,e.total=t.total,this.paginationResponse=e})}static ctorParameters=()=>[{type:k}];static propDecorators={historyItem:[{type:g}]}};D=Ut([p({selector:"armon-report-visitor-access-logs",template:Rt,standalone:!0,imports:[x,P,w,L,T,F,f],styles:[yt]})],D);var jt=function(a,t,e,i){var r=arguments.length,o=r<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,t,e,i);else for(var n=a.length-1;n>=0;n--)(s=a[n])&&(o=(r<3?s(o):r>3?s(t,e,o):s(t,e))||o);return r>3&&o&&Object.defineProperty(t,e,o),o},kt=class extends E{interactionService;route;translate;reportService;dynamicFormService;authService;visitorService;sessionService;routingService;screenWidthService;modalService;lastFilter;lastResult;columnFields;detailFields;records=[];filterFields=[];visitReportFormInfo;visitorRegistrationPointId=null;fieldSearchComponents;checkBoxs;selects;isSAGEReport=!1;isSelfReport;visibleRegistrationPointSearch;selectionStartDate;selectionEndDate;selectionCompany;datePickerOptions=new X;permissionVisitorRead;searchVisitor;datePicker;visitFieldsData;paginationResponse=new h;paginationRequest=new y;constructor(t,e,i,r,o,s,n,wt,Pt,Ct,Et){super(t),this.interactionService=t,this.route=e,this.translate=i,this.reportService=r,this.dynamicFormService=o,this.authService=s,this.visitorService=n,this.sessionService=wt,this.routingService=Pt,this.screenWidthService=Ct,this.modalService=Et}get visitorActiveStatusTypes(){return at}get selectedVisitors(){return this.searchVisitor?this.searchVisitor.getSelection()||[]:[]}set selectedVisitors(t){t&&this.searchVisitor&&this.searchVisitor.setSelection(t)}getDetailValues(t){return this.detailFields.filter(e=>t.values[e.name])}ngOnInit(){this.isSelfReport=!this.authService.checkPermission(_.VISITOR.getRead()),this.datePickerOptions.items=[{type:v.Today,selected:!0},{type:v.Yesterday},{type:v.SelectDay},{type:v.CustomWithTimer}];let t=Z.getDateSelection(this.datePickerOptions.items[0]);this.setDateSelection(t);let e=this.sessionService.currentOrganization.visitorModuleSettings.visitFormFields.filter(o=>o.reportable&&!o.hideOnReportFilter&&o.name!=c.VISIT.ExpectedDate);e.forEach(o=>{o.isProfileField=!1});let i=this.sessionService.currentOrganization.visitorModuleSettings.visitorProfileFormFields.filter(o=>o.reportable);i.forEach(o=>{o.isProfileField=!0});let r=i.concat(e);this.isSelfReport&&(r=r.filter(o=>o.name!=c.VISIT.VisitedPerson)),B(r,"reportOrder"),this.filterFields=[],r.forEach(o=>{let s=G(o);if(s.name!="name"&&(j(s.reportableInDetail)||s.reportableInDetail==!1))switch(s.type){case u.Text:s.filterType=1,this.filterFields.push(s);break;case u.Checkbox:s.filterType=2,this.filterFields.push(s);break;case u.Select:s.options.type==1?(s.options.options.unshift({value:null,captionLines:["VISITORACTIVESTATUS.ALL"]}),s.filterType=3,this.filterFields.push(s)):(s.filterType=1,this.filterFields.push(s));break}}),this.visitReportFormInfo=this.dynamicFormService.getFormInfo(q.Visit,!0),this.visibleRegistrationPointSearch=this.visitorService.availableRegistrationPoints.length>1,this.checkPermissions()}ngAfterViewInit(){this.lastFilter=this.getFilter(),this.lastFilter.type=O.All,this.route.queryParams.subscribe(t=>{t&&t[d.VisitorId]&&t[d.VisitorId]!=""&&(this.lastFilter.visitorProfileIds=[t[d.VisitorId]],this.searchVisitor.setSelectionIds(this.lastFilter.visitorProfileIds)),t&&t[d.RegistrationPointId]&&t[d.RegistrationPointId]!=""&&(this.lastFilter.visitorRegistrationPointId=t[d.RegistrationPointId],this.visitorRegistrationPointId=this.lastFilter.visitorRegistrationPointId),this.setDateSelection(this.datePicker.setPickerItemAndDate(this.datePickerOptions.items.length-1,[l.local().minus({months:24}).startOf("day").toJSDate(),l.local().endOf("day").toJSDate()])),this.lastFilter.startUtc=this.selectionStartDate,this.lastFilter.endUtc=this.selectionEndDate,this.fetchReportData()})}ngOnDestroy(){}isBoolean(t){return typeof t=="boolean"}setDateSelection(t){this.selectionStartDate=t.startDate,this.selectionEndDate=t.endDate}setPaginationRecords(t){this.records=t}fetchPaginationRecords(t){this.lastFilter.skip=t,this.fetchReportData()}isProfileField(t){return this.filterFields.find(e=>e.name==t).isProfileField}getFilter(t=!1){let e=new nt;if(e.visitorProfileFilterFields=[],e.visitFilterFields=[],e.visitorProfileIds=this.selectedVisitors.map(i=>i.id),this.searchVisitor.getInputText()&&this.searchVisitor.getInputText()!=""){let i=new m;i.name=c.VISITOR.Name,i.value=this.searchVisitor.getInputText(),e.visitorProfileFilterFields.push(i)}if(e.visitorRegistrationPointId=this.visitorRegistrationPointId,this.fieldSearchComponents.forEach(i=>{if(i.getSelection()&&i.getSelection().length>0){let r=new m;r.name=i.fieldName,r.value=i.getSelection()[0].id?i.getSelection()[0].id:i.getSelection()[0].captionLines[0],i.isProfileField?e.visitorProfileFilterFields.push(r):e.visitFilterFields.push(r)}else if(i.getInputText()&&i.getInputText()!=""){let r=new m;r.name=i.fieldName,r.value=i.getInputText(),i.isProfileField?e.visitorProfileFilterFields.push(r):e.visitFilterFields.push(r)}}),this.checkBoxs.forEach(i=>{if(i.nativeElement&&i.nativeElement.checked==!0){let r=new m;r.name=i.nativeElement.getAttribute("fieldName"),r.value=i.nativeElement.checked,this.isProfileField(i.nativeElement.getAttribute("fieldName"))?e.visitorProfileFilterFields.push(r):e.visitFilterFields.push(r)}}),this.selects.forEach(i=>{if(i.nativeElement.value&&i.nativeElement.value!=""){let r=new m;r.name=i.nativeElement.getAttribute("fieldName"),r.value=+i.nativeElement.value,this.isProfileField(i.nativeElement.getAttribute("fieldName"))?e.visitorProfileFilterFields.push(r):e.visitFilterFields.push(r)}}),this.isSAGEReport&&this.selectionCompany){let i=new m;i.name="company",i.value=this.selectionCompany,e.visitorProfileFilterFields.push(i)}return e.startUtc=this.selectionStartDate,e.endUtc=this.selectionEndDate,e.skip=0,e.take=t?1e4:I.REQUEST_REPORT_ITEM_LIMIT,e.type=this.lastFilter&&this.lastFilter.type?this.lastFilter.type:O.All,e}onDynamicSelectOptionAdded(t){this.visitFieldsData||(this.visitFieldsData={}),this.visitFieldsData[t.fieldName]||(this.visitFieldsData[t.fieldName]=[]),this.visitFieldsData[t.fieldName].push(t.item)}onDynamicSelectOptionRemoved(t){!this.visitFieldsData||!this.visitFieldsData[t.fieldName]||H(this.visitFieldsData[t.fieldName],"id",t.item.id)}onGetReportClicked(t){this.lastFilter=this.getFilter(),this.fetchReportData()}onGetExcelClicked(t){let e=this.getFilter();this.reportService.getTerminatedVisitsReportAsExcel(e,this.isSelfReport).subscribe(i=>{this.translate.get(["PAGES.REPORT_VISITOR"]).subscribe(r=>{Tt.default.saveAs(i,r["PAGES.REPORT_VISITOR"]+" "+l.fromJSDate(e.startUtc).toLocaleString(l.DATETIME_MED)+" "+l.fromJSDate(e.endUtc).toLocaleString(l.DATETIME_MED)+".xlsx")})})}fetchReportData(){this.reportService.getTerminatedVisitsReport(this.lastFilter,this.isSelfReport).subscribe(t=>{this.waitingFilter=!1,this.lastResult=t;let e=t.fields.filter(r=>!(r.reportableInDetail&&r.reportableInDetail==!0)),i=t.fields.filter(r=>!!(r.reportableInDetail&&r.reportableInDetail==!0));if(this.isSelfReport?(this.columnFields=e.filter(r=>r.name!=c.VISIT.VisitedPerson),this.detailFields=i.filter(r=>r.name!=c.VISIT.VisitedPerson)):(this.columnFields=e,this.detailFields=i),this.visibleRegistrationPointSearch){let r=new et;r.type=u.Text,r.name=c.VISIT.RegistrationPoint,r.caption="VISITOR.REGISTRATION_POINT_COLUMN",e.push(r),t.items.forEach(o=>{o.values[c.VISIT.RegistrationPoint]=o.visitFields.visitorRegistrationPointId?this.visitorService.getRegistrationPointById(o.visitFields.visitorRegistrationPointId).name:""})}this.records=t.items||[],this.paginationResponse=new h,this.paginationResponse.total=t.total,this.paginationResponse.take=t.take,this.paginationResponse.skip=t.skip})}onDateSelectionChanged(t){this.setDateSelection(t),this.lastFilter=this.getFilter(),this.fetchReportData()}pageChanged(t){this.lastFilter.skip=t.skip,this.lastFilter.take=t.take,this.fetchReportData()}onStateChanged(t){this.lastFilter.type=t}checkPermissions(){this.permissionVisitorRead=this.authService.checkPermission(_.VISITOR.getRead())}onShowVisitHistoryClicked(t){this.visitorService.getActionHistoryOfVisit(t.visitId).subscribe(e=>{e&&e.items&&e.items.length>0?this.modalService.open(C,{settings:{size:"lg"},props:{historyItems:e.items,visitorName:""}}).result.then(i=>{}).catch(i=>{}):this.interactionService.showMessage("VISITOR.INFO_NO_VISIT_HISTORY",null,J.Info)})}onShowProfileClicked(t){this.routingService.gotoVisitorProfile(t.visitorProfileId)}onImageClicked(t,e){this.interactionService.showFullScreenImage({src:e,width:this.screenWidthService.isMobile()?"480px":"640px"})}static ctorParameters=()=>[{type:R},{type:U},{type:$},{type:k},{type:it},{type:pt},{type:lt},{type:W},{type:mt},{type:ft},{type:Y}];static propDecorators={fieldSearchComponents:[{type:b,args:["fieldSearchComponent"]}],checkBoxs:[{type:b,args:["checkBox"]}],selects:[{type:b,args:["select"]}],searchVisitor:[{type:V,args:["searchVisitor"]}],datePicker:[{type:V,args:["datePicker"]}]}};kt=jt([p({selector:"armon-report-visitor",template:St,standalone:!0,imports:[ut,ht,vt,x,S,N,z,bt,K,A,ct,gt,tt,P,w,M,D,T,f],styles:[xt]})],kt);export{kt as ReportVisitorComponent};
