import{a as U}from"./chunk-5OT2MLHH.js";import{a as P}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as F}from"./chunk-4MZCYQX4.js";import{b as z,c as M,d as L}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as k}from"./chunk-VSFNMVXJ.js";import{a as y,b as D}from"./chunk-WQ6DP4JQ.js";import{Ia as u,J as C,Ja as _,l as w,wb as A}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Fb as N,Mg as v,Ng as p,Qf as x,Te as O,_a as m,ab as S,bb as g,cb as E,db as h,dc as f,dd as T,eh as I,gg as i,hg as R,jg as b,wa as l,ya as d}from"./chunk-SKPDQO4E.js";var Y=`<div class="h-100">
  <side-navigation #sideNavigation>
    <ng-template side-navigation-nav>
      <div>
        <div class="row">
          <div class="col-12">
            <nz-form-item>
              <label class="report-form-label">{{'TERMINALEVENT.EVENT_FILTER' | translate}}</label>
              <nz-select class="w-100" [(ngModel)]="filter.event" nzSize="small">
                <nz-option *ngFor="let option of eventTypes" [nzValue]="option.type" [nzLabel]="option.description |
                  translate"></nz-option>
              </nz-select>
            </nz-form-item>
          </div>
          <div class="col-12">
            <label class="report-form-label">{{'REPORT.TERMINAL' | translate}}</label>
            <armon-select-search query="terminal" [allowMulti]="true" [(ngModel)]="filter.terminalIds">
            </armon-select-search>
            <!-- <armon-terminal-search #searchTerminal [multiselect]="true" class="custom-item"></armon-terminal-search> -->
          </div>
        </div>
        <div class="centered filterButtons">
          <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-12" style="min-height:0;">
            <div class="row">
              <div class="col-12">
                <armon-date-picker [options]="datePickerOptions" (selectionChanged)="onDateSelectionChanged($event)">
                </armon-date-picker>
              </div>
            </div>
          </div>
        </div>
        <div class="row report-data-table-container" id="report-data-table-container">
          <div class="col-12">
            <p-table [value]="records" dataKey="id" [responsive]="true" rowExpandMode="single">
              <ng-template pTemplate="header">
                <tr>
                  <th>{{'REPORT.DATE' | translate}}</th>
                  <th>{{'REPORT.TERMINAL' | translate}}</th>
                  <th>{{'REPORT.REGION_STATE_HEADER_ACCESS_POINT' | translate}}</th>
                  <th>{{'TERMINALEVENT.EVENT_FILTER' | 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 py-2">
                      <span class="main-text" *ngIf="record.actionUtc">{{record.actionUtcHourText}}<armon-local-date
                          [dateUtc]="record.actionUtc"></armon-local-date></span>
                      <span class="sub-text" *ngIf="record.actionUtc">{{record.actionUtcText}}</span>
                    </div>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{record.terminalName}}</span>
                      <span class="sub-text" *ngIf="record.extensionName">{{record.extensionName}}</span>
                    </div>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">{{record.accessControlPointName?record.accessControlPointName:'-'}}</span>
                      <span class="sub-text">{{record.sensorName}} <span
                          *ngIf="record.sensorNumber">({{record.sensorNumber}})</span></span>
                    </div>
                  </td>
                  <td>
                    <div class="report-multi-data-cell">
                      <span class="main-text">
                        <ng-container [ngSwitch]="record.eventType">
                          <cds-icon shape="ethernet" size="sm" *ngSwitchCase="1"
                            [ngClass]="{'color-success': record.data.s,'color-error': !record.data.s}" class=" me-2">
                          </cds-icon>
                          <cds-icon shape="upload" size="sm" *ngSwitchCase="2" class="color-primary me-2"></cds-icon>
                          <cds-icon shape="network-switch" size="sm" *ngSwitchCase="3" class="color-primary me-2">
                          </cds-icon>
                          <cds-icon shape="status-sensor" size="sm" *ngSwitchCase="4" class="color-primary me-2">
                          </cds-icon>
                          <cds-icon shape="status-sensor" size="sm" *ngSwitchCase="5" class="color-primary me-2">
                          </cds-icon>
                          <cds-icon shape="status-sensor" size="sm" *ngSwitchCase="6" class="color-primary me-2">
                          </cds-icon>
                          <cds-icon shape="cog" size="sm" *ngSwitchCase="7" class="color-primary me-2">
                          </cds-icon>
                        </ng-container>
                        <span>{{record.eventText|translate}}</span>
                      </span>
                      <ng-container *ngIf="record.eventSubText">
                        <ng-container [ngSwitch]="record.eventType">
                          <span class="sub-text fw-bold color-primary"
                            *ngSwitchCase="7">{{record.eventSubText|translate}}</span>
                        </ng-container>
                      </ng-container>
                    </div>
                  </td>
                </tr>
              </ng-template>
              <ng-template pTemplate="rowexpansion" let-record>
                <tr>
                  <td [attr.colspan]="4" class="expanded-row">
                    <div class="detail-row-container detail-event-container py-2">
                      <span class="mb-2 detail-title">{{record.eventText|translate}} ({{record.actionUtcText}})</span>
                      <ng-container [ngSwitch]="record.eventType">
                        <!-- UPLOAD OFFLINE LOGS -->
                        <ng-container *ngSwitchCase="2">
                          <span>{{'TERMINALEVENT.UPLOAD_OFFLINE_LOGS_INFO'|translate:record.data}}</span>
                        </ng-container>
                        <!-- UPLOAD OFFLINE LOGS -->

                        <!-- SYSTEM HEALTH STATUS -->
                        <ng-container *ngSwitchCase="3">
                          <span>{{ ( record.data.ib ? 'TERMINAL.BATTERY_MODE' : 'TERMINAL.POWER_MODE' ) | translate }}
                          </span>
                          <span>{{'TERMINAL.TEMPERATURE_CELCIUS'|translate:record.data}}</span>
                          <span *ngIf="record.data.b">{{'TERMINAL.BATTERY_LEVEL'|translate:record.data}}</span>
                          <span
                            *ngIf="record.data.df && record.data.dt">{{'TERMINAL.STORAGE_STATE'|translate:record.data}}</span>
                          <span *ngIf="record.data.es==1" class="color-error">
                            <cds-icon shape="exclamation-triangle" style="width: 12px; height: 12px;" solid></cds-icon>
                            {{'SYSTEMHEALTH.EMERGENCYSTATE'|translate}}
                          </span>
                        </ng-container>
                        <!-- SYSTEM HEALTH STATUS -->

                        <!-- STATUS SENSOR -->
                        <ng-container *ngSwitchCase="4">
                          <ng-container [ngSwitch]="record.data.s">
                            <span *ngSwitchCase="0">{{'SENSOR.NOTIFICATION_SENSOR_CLOSED'|translate}}</span>
                            <span *ngSwitchCase="1">{{'SENSOR.NOTIFICATION_SENSOR_OPENNED'|translate}}</span>
                            <span *ngSwitchCase="2">{{'SENSOR.NOTIFICATION_SENSOR_TIMEOUT'|translate}}</span>
                          </ng-container>
                          <ng-container [ngSwitch]="record.data.r">
                            <span *ngSwitchCase="1">{{'SENSOR.NOTIFICATION_SENSOR_READER_ACCESS'|translate}}</span>
                            <span *ngSwitchCase="2">{{'SENSOR.NOTIFICATION_SENSOR_EXIT_BUTTON'|translate}}</span>
                            <span *ngSwitchCase="3">{{'SENSOR.NOTIFICATION_SENSOR_REMOTELY_OPEN'|translate}}</span>
                            <span
                              *ngSwitchCase="4">{{'SENSOR.NOTIFICATION_SENSOR_UNKNOWN_OPEN_RELAY_MAPPED_DESC'|translate}}</span>
                            <span
                              *ngSwitchCase="5">{{'SENSOR.NOTIFICATION_SENSOR_UNKNOWN_OPEN_RELAY_NOT_MAPPED_DESC'|translate}}</span>
                            <span *ngSwitchCase="6">{{'SENSOR.NOTIFICATION_SENSOR_LEAVED_OPENNED'|translate}}</span>
                            <!-- <span *ngSwitchCase="7">{{'SENSOR.NOTIFICATION_SENSOR_CLOSED'|translate}}</span>  -->
                            <span *ngSwitchCase="8">{{'SENSOR.NOTIFICATION_SENSOR_CLOSED_TIMEOUT'|translate}}</span>
                          </ng-container>
                        </ng-container>
                        <!-- STATUS SENSOR -->

                        <!-- COUNTER SENSOR -->
                        <ng-container *ngSwitchCase="5">
                          <ng-container [ngSwitch]="record.data.d">
                            <span *ngSwitchCase="0">{{'DIRECTIONTYPE.BOTH'|translate}}</span>
                            <span *ngSwitchCase="1">{{'DIRECTIONTYPE.ENTRANCE'|translate}}</span>
                            <span *ngSwitchCase="2">{{'DIRECTIONTYPE.EXIT'|translate}}</span>
                          </ng-container>
                          <ng-container [ngSwitch]="record.data.r">
                            <span *ngSwitchCase="1">{{'SENSOR.NOTIFICATION_SENSOR_READER_ACCESS'|translate}}</span>
                            <span *ngSwitchCase="2">{{'SENSOR.NOTIFICATION_SENSOR_EXIT_BUTTON'|translate}}</span>
                            <span *ngSwitchCase="3">{{'SENSOR.NOTIFICATION_SENSOR_REMOTELY_OPEN'|translate}}</span>
                            <span
                              *ngSwitchCase="4">{{'SENSOR.NOTIFICATION_SENSOR_UNKNOWN_OPEN_RELAY_MAPPED_DESC'|translate}}</span>
                            <span
                              *ngSwitchCase="5">{{'SENSOR.NOTIFICATION_SENSOR_UNKNOWN_OPEN_RELAY_NOT_MAPPED_DESC'|translate}}</span>
                          </ng-container>
                        </ng-container>
                        <!-- COUNTER SENSOR -->

                        <!-- TAMPER SENSOR -->
                        <ng-container *ngSwitchCase="6">
                          <ng-container [ngSwitch]="record.data.s">
                            <span *ngSwitchCase="0">{{'SENSOR.NOTIFICATION_SENSOR_TAMPERED_SECURE'|translate}}</span>
                            <span *ngSwitchCase="1" class="color-error">
                              <cds-icon shape="exclamation-triangle" style="width: 12px; height: 12px;"
                                solid></cds-icon>
                              {{'SENSOR.NOTIFICATION_SENSOR_TAMPERED'|translate}}
                            </span>
                          </ng-container>
                        </ng-container>
                        <!-- TAMPER SENSOR -->

                        <!-- TERMINAL ACTION -->
                        <span class="sub-text fw-bold color-primary"
                          *ngSwitchCase="7">{{record.eventSubText|translate}}</span>
                        <!-- TERMINAL ACTION -->
                      </ng-container>
                    </div>
                  </td>
                </tr>
              </ng-template>
            </p-table>
          </div>
          <div class="col-12 mb-3 mt-3">
            <armon-pagination [paginationResponse]="paginationResponse" [scrollDomId]="'report-data-table-container'"
              (pageChanged)="pageChanged($event)"></armon-pagination>
          </div>
        </div>
      </div>
    </ng-template>
  </side-navigation>
</div>`;var j=`.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}.detail-event-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-moz-box-orient:vertical;-webkit-flex-direction:column;-moz-flex-direction:column;-ms-flex-direction:column;flex-direction:column;font-size:.672rem}.detail-event-container .detail-title{font-size:.714rem}
`;var B=function(r,e,a,n){var o=arguments.length,t=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,a):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(r,e,a,n);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(t=(o<3?s(t):o>3?s(e,a,t):s(e,a))||t);return o>3&&t&&Object.defineProperty(e,a,t),t},G=class{interactionService;reportService;route;filter;response;records=[];paginationResponse=new p;paginationRequest=new v;datePickerOptions=new R;eventTypes;sideNavigation;searchTerminal;constructor(e,a,n){this.interactionService=e,this.reportService=a,this.route=n}ngOnInit(){this.datePickerOptions.items=[{type:i.Today,selected:!0},{type:i.Yesterday},{type:i.SelectDay},{type:i.Custom}],this.createFilter(),this.eventTypes=f(u),this.filter.event=this.eventTypes[0].type}ngAfterViewInit(){this.fetchReportData()}ngOnDestroy(){}createFilter(){this.filter=_.getEmptyModel(),this.setDateSelection(b.getDateSelection(this.datePickerOptions.items[0]))}get selectedTerminals(){return this.searchTerminal?this.searchTerminal.getSelection()||[]:[]}setDateSelection(e){this.filter.dateRange.startDateTime=e.startDate,this.filter.dateRange.endDateTime=e.endDate}onGetReportClicked(e){this.sideNavigation.hideLeftClicked(),this.fetchReportData()}fetchReportData(){this.reportService.getTerminalEvents(this.filter).subscribe(e=>{this.response=e,this.records=e.items||[],this.paginationResponse=new p,this.paginationResponse=e.pagination})}pageChanged(e){this.filter.pagination.skip=e.skip,this.filter.pagination.take=e.take,this.fetchReportData()}onDateSelectionChanged(e){this.setDateSelection(e),this.fetchReportData()}static ctorParameters=()=>[{type:x},{type:C},{type:N}];static propDecorators={sideNavigation:[{type:l,args:["sideNavigation",{static:!0}]}],searchTerminal:[{type:l,args:["searchTerminal"]}]}};G=B([d({selector:"armon-report-terminal-events",template:Y,standalone:!0,imports:[L,z,y,D,I,O,S,A,M,w,U,F,g,P,E,h,m,k,T],styles:[j]})],G);export{G as ReportTerminalEventsComponent};
