import{a as V}from"./chunk-D4RZOGGF.js";import{a as U}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as G,c as Y,d as $}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as j}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as O,Ka as h,Mb as P,wb as D}from"./chunk-YSQLW2JA.js";import{$c as L,Uc as b,Yc as z,_c as I,ad as M,bd as F,cd as A}from"./chunk-NVJ2ZZFT.js";import{Aa as u,Ba as y,Ng as N,Pd as C,Rd as R,Sd as T,Te as E,_a as v,ab as k,bb as m,bh as _,cb as p,db as f,dc as l,dd as S,ha as g,ma as x,wa as w,ya as d}from"./chunk-SKPDQO4E.js";var B=`<div class="h-100">
	<side-navigation #sideNavigation>
		<ng-template side-navigation-nav>
			<div class="row">
				<div class="col-12 mb-2">
					<label class="report-form-label">{{'REPORT.SENSOR' | translate}}</label>
					<armon-select-search query="sensor" [allowMulti]="true" [(ngModel)]="lastFilter.sensorIds">
					</armon-select-search>
				</div>
				<div class="col-12 mb-2">
					<label class="report-form-label">{{'REPORT.TERMINAL' | translate}}</label>
					<armon-select-search query="terminal" [allowMulti]="true"
						[(ngModel)]="lastFilter.terminalDeviceIds">
					</armon-select-search>
				</div>
				<div class="col-12 mb-2">
					<label class="report-form-label">{{'REPORT.REGION' | translate}}</label>
					<armon-select-search query="region" [allowMulti]="true" [(ngModel)]="lastFilter.regionIds">
					</armon-select-search>
				</div>
				<div class="col-12 mb-2">
					<label class="report-form-label">{{'SENSOREVENT.FILTER_SENSOR_TYPE' | translate}}</label>
					<select [(ngModel)]="selectedSensorType" class="form-select form-select-sm">
						<option *ngFor="let option of sensorTypes" [ngValue]="option.type">{{option.description |
							translate}}</option>
					</select>
				</div>
				<ng-container [ngSwitch]="selectedSensorType">
					<!-- STATUS SENSOR TYPE -->
					<ng-container *ngSwitchCase="5">

						<div class="col-12 mb-2">
							<label class="report-form-label">{{'SENSOREVENT.FILTER_SENSOR_STATE' | translate}}</label>
							<select [(ngModel)]="selectedStatusSensorState" class="form-select form-select-sm">
								<option *ngFor="let statusSensorState of statusSensorStates"
									[ngValue]="statusSensorState.type">{{statusSensorState.description |
									translate}}</option>
							</select>
						</div>
						<div class="col-12 mb-2">
							<label class="report-form-label">{{'SENSOREVENT.FILTER_SENSOR_STATE_REASON' |
								translate}}</label>
							<select [(ngModel)]="selectedStatusSensorStateReason" class="form-select form-select-sm">
								<option *ngFor="let statusSensorStateReason of statusSensorStateReasons"
									[ngValue]="statusSensorStateReason.type">{{statusSensorStateReason.description |
									translate}}</option>
							</select>
						</div>
					</ng-container>
					<!-- END -->
					<!-- COUNTER SENSOR TYPE -->
					<ng-container *ngSwitchCase="7">
						<div class="col-12 mb-2">
							<label class="report-form-label">{{'SENSOREVENT.FILTER_SENSOR_STATE_REASON' |
								translate}}</label>
							<select [(ngModel)]="selectedCounterSensorStateReason" class="form-select form-select-sm">
								<option *ngFor="let counterSensorStateReason of counterSensorStateReasons"
									[ngValue]="counterSensorStateReason.type">{{counterSensorStateReason.description |
									translate}}</option>
							</select>
						</div>
					</ng-container>
					<!-- END -->
					<!-- TAMPER SWITCH TYPE -->
					<ng-container *ngSwitchCase="6">
						<div class="col-12 mb-2">
							<label class="report-form-label">{{'SENSOREVENT.FILTER_SENSOR_STATE' | translate}}</label>
							<select [(ngModel)]="selectedTamperSwitchState" class="form-select form-select-sm">
								<option *ngFor="let tamperSwitchState of tamperSwitchStates"
									[ngValue]="tamperSwitchState.type">{{tamperSwitchState.description |
									translate}}</option>
							</select>
						</div>
					</ng-container>
					<!-- END -->
				</ng-container>
			</div>
			<div class="centered filterButtons">
				<button class="btn btn-primary btn-sm" (click)="onFilterClicked($event)">{{'COMMON.FILTER' |
					translate}}</button>
			</div>
		</ng-template>
		<ng-template side-navigation-content>
			<ng-container *ngIf="sensors">
				<!-- Listing area -->
				<div class="row" [@listAnimationFast]="sensors.length">
					<!-- List of sensors -->
					<div class="col-xl-2 col-lg-4 col-md-4 col-sm-6 col-12" *ngFor="let sensor of sensors">
						<armon-sensor-card [sensor]="sensor" [showDetail]="false"
							(itemClicked)="onItemClicked($event)"></armon-sensor-card>
					</div>
				</div>
				<div class="row pt-5" *ngIf="sensors.length==0">
					<div class="col-12">
						<nz-empty [nzNotFoundContent]="contentTpl"
							[nzNotFoundImage]="'./assets/images/empty/empty_list.png'">
							<ng-template #contentTpl>
								<span>{{'SENSOR.FILTER_NO_ITEMS'|translate}}</span>
							</ng-template>
						</nz-empty>
					</div>
				</div>
				<div class="row py-3">
					<div class="col-12">
						<armon-pagination [paginationResponse]="paginationResponse" (pageChanged)="pageChanged($event)">
						</armon-pagination>
					</div>
				</div>
			</ng-container>
		</ng-template>
	</side-navigation>
</div>`;var q=`.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}.paginationArea{position:absolute;width:100%;bottom:0}
`;var H=`<div [ngClass]="{'modal-body': showDetail}">
	<div class="main-container" [attr.show-detail]="showDetail" (click)="onCardClicked($event)"
		[attr.warning]="sensor.input?.type == 6 && sensor.input?.state!=0">
		<div class="icon-container">
			<cds-icon [attr.shape]="sensor.input.typeIcon" style="width: 20px; height: 20px;"></cds-icon>
			<ng-container [ngSwitch]="sensor.input?.type">
				<!-- STATUS SENSOR TYPE -->
				<ng-container *ngSwitchCase="5">
					<div class="status-alert" [attr.warning]="sensor.input?.state!=0">&nbsp;</div>
				</ng-container>
				<!-- END -->
				<!-- COUNTER SENSOR TYPE -->
				<ng-container *ngSwitchCase="7">
					<!-- <div class="status-alert">&nbsp;</div> -->
				</ng-container>
				<!-- END -->
				<!-- TAMPER SWITCH TYPE -->
				<ng-container *ngSwitchCase="6">
					<div class="temper-alert" *ngIf="sensor.input && sensor.input?.state!=0">
						<cds-icon shape="warning-standard" class="cds-icon-18" solid></cds-icon>
					</div>
				</ng-container>
				<!-- END -->
			</ng-container>
		</div>

		<div class="info-container color-primary">
			<span class="text-sm mb-2">{{sensor.input?.name}}</span>
			<span class="text-xs fw-medium">{{sensor.input?.stateText|translate}}</span>
			<span [ngClass]="{'mt-auto': !showDetail}" class="text-xs"
				*ngIf="sensor.input?.typeName">{{sensor.input?.typeName|translate}}<span *ngIf="sensor.input?.number">
					#{{sensor.input?.number}}</span></span>
			<div *ngIf="showDetail && sensor.terminal && sensor.terminal.id" class="text-sm terminal-container">
				<div class="terminal-info">
					<span><strong>{{'REPORT.TERMINAL'|translate}}</strong></span>
					<span>{{sensor.terminal.name|translate}}</span>
				</div>
				<button class="btn btn-outline-primary btn-sm ms-auto me-0"
					(click)="onTerminalDetailClicked($event)">{{'BUTTON.DETAIL' | translate}}</button>
			</div>
			<div *ngIf="showDetail && sensor.input?.type!=6" class="text-sm accesslog-container">
				<div class="accesslog-info">
					<span><strong>{{'SENSOR.LAST_ACCESS_LOG'|translate}}</strong></span>
					<span *ngIf="sensor.accessControlPoint">{{sensor.accessControlPoint.name}}</span>
					<span
						*ngIf="sensor.lastAction && sensor.lastAction.accessLog">{{sensor.lastAction.accessLog.actionDateTimeText}}</span>
					<armon-captionlines [captionlines]="sensor.lastAction?.accessLog.user"
						*ngIf="sensor.lastAction && sensor.lastAction?.accessLog" [showBorder]="false">
					</armon-captionlines>
				</div>
				<button class="btn btn-outline-primary btn-sm ms-auto me-0" *ngIf="sensor.accessControlPoint"
					(click)="onAccessLogsClicked($event)">{{'BUTTON.SHOW_ACCESS_LOGS' | translate}}</button>
			</div>
		</div>
	</div>
</div>
<div class="modal-footer" *ngIf="showDetail">
	<button class="btn btn-primary" (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>
</div>`;var W=`.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}.main-container{height:120px;min-height:120px;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;border:1px solid #ddd;padding:.3rem 0;background-color:#fff;box-shadow:0 0 4px #ddd;margin-bottom:12px}.main-container[warning=true]{background-color:#fff4f4;padding:.6rem .3rem}.main-container:hover{border:1px solid #81b4d0}.main-container .icon-container{-webkit-border-v-left-radius:.375rem;-moz-border-radius-bottomleft:.375rem;border-bottom-left-radius:.375rem;-webkit-border-top-left-radius:.375rem;-moz-border-radius-topleft:.375rem;border-top-left-radius:.375rem;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;padding:0 .3rem;border-right:1px solid #eee;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;color:#999}.main-container .icon-container .status-alert{margin-top:auto;width:8px;height:8px;-webkit-border-radius:50%;-moz-border-radius:50%;border-radius:50%;background-color:#0dd449;box-shadow:0 0 3px #0dd449;margin-bottom:.3rem}.main-container .icon-container .status-alert[warning=true]{background-color:#fc2b2b;box-shadow:0 0 3px #fc2b2b}.main-container .icon-container .temper-alert{margin-top:auto;color:#fc2b2b}.main-container .info-container{-webkit-border-v-right-radius:.375rem;-moz-border-radius-bottomright:.375rem;border-bottom-right-radius:.375rem;-webkit-border-top-right-radius:.375rem;-moz-border-radius-topv:.375rem;border-top-right-radius:.375rem;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;padding:0 .3rem}.main-container .info-container .terminal-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;margin-top:18px}.main-container .info-container .terminal-container .terminal-info{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}.main-container .info-container .accesslog-container{display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;-moz-align-items:center;align-items:center;margin-top:18px}.main-container .info-container .accesslog-container .accesslog-info{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}.main-container[show-detail=true]{padding:.7rem;border:none;height:auto;min-height:120px;box-shadow:none}.main-container[show-detail=true] .info-container{font-size:.756rem}.main-container[show-detail=true] .info-container .title{font-size:.84rem}.main-container[show-detail=false]{cursor:pointer}
`;var ee=function(o,e,t,s){var i=arguments.length,n=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,e,t,s);else for(var r=o.length-1;r>=0;r--)(a=o[r])&&(n=(i<3?a(n):i>3?a(e,t,n):a(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n},c=class extends T{sessionService;routingService;showDetail=!1;sensor;itemClicked=new g;constructor(e,t){super(),this.sessionService=e,this.routingService=t}onModalInitialized(){super.onModalInitialized()}getSensor(){return this.sensor}updateRecord(e){this.sensor=e}onCardClicked(e){this.showDetail==!1&&this.itemClicked.emit(this.sensor)}onAccessLogsClicked(){this.sensor&&this.sensor.accessControlPoint&&(this.routingService.gotoAccessControlPointAccessLogs(this.sensor.accessControlPoint.id),this.closeModal())}onTerminalDetailClicked(){this.sensor&&this.sensor.terminal&&(this.routingService.gotoManageTerminals(this.sensor.terminal.id),this.closeModal())}static ctorParameters=()=>[{type:C},{type:P}];static propDecorators={showDetail:[{type:u}],sensor:[{type:u}],itemClicked:[{type:y}]}};c=ee([d({selector:"armon-sensor-card",template:H,standalone:!0,schemas:[x],imports:[v,p,f,m,U,S],styles:[W]})],c);var te=function(o,e,t,s){var i=arguments.length,n=i<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,t):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(o,e,t,s);else for(var r=o.length-1;r>=0;r--)(a=o[r])&&(n=(i<3?a(n):i>3?a(e,t,n):a(e,t))||n);return i>3&&n&&Object.defineProperty(e,t,n),n},J=class{reportService;modalService;sensors;paginationResponse=new N;lastFilter;selectionType;sensorTypes;selectedSensorType;statusSensorStates;selectedStatusSensorState;statusSensorStateReasons;selectedStatusSensorStateReason;counterSensorStates;selectedCounterSensorState;counterSensorStateReasons;selectedCounterSensorStateReason;tamperSwitchStates;selectedTamperSwitchState;refreshTimer;modalInstance;sideNavigation;constructor(e,t){this.reportService=e,this.modalService=t}ngOnInit(){this.sensorTypes=l(z),this.sensorTypes.unshift({type:null,description:"COMMON.ALL"}),this.selectedSensorType=this.sensorTypes[0].type,this.statusSensorStates=l(M),this.statusSensorStates.unshift({type:null,description:"COMMON.ALL"}),this.selectedStatusSensorState=this.statusSensorStates[0].type,this.statusSensorStateReasons=l(I),this.statusSensorStateReasons.unshift({type:null,description:"COMMON.ALL"}),this.selectedStatusSensorStateReason=this.statusSensorStateReasons[0].type,this.counterSensorStates=l(F),this.counterSensorStates.unshift({type:null,description:"COMMON.ALL"}),this.selectedCounterSensorState=this.counterSensorStates[0].type,this.counterSensorStateReasons=l(L),this.counterSensorStateReasons.unshift({type:null,description:"COMMON.ALL"}),this.selectedCounterSensorStateReason=this.counterSensorStateReasons[0].type,this.tamperSwitchStates=l(A),this.tamperSwitchStates.unshift({type:null,description:"COMMON.ALL"}),this.selectedTamperSwitchState=this.tamperSwitchStates[0].type,this.lastFilter=h.getEmptyModel(),this.lastFilter.pagination.take=30,this.getList()}ngOnDestroy(){this.refreshTimer&&clearTimeout(this.refreshTimer)}pageChanged(e){this.lastFilter.pagination.skip=e.skip,this.lastFilter.pagination.take=e.take,this.getList()}getList(){if(this.lastFilter.type=this.selectedSensorType,this.lastFilter.type)switch(this.lastFilter.type){case b.StatusSensor:this.lastFilter.state=this.selectedStatusSensorState,this.lastFilter.reason=this.selectedStatusSensorStateReason;break;case b.Counter:this.lastFilter.state=this.selectedCounterSensorState,this.lastFilter.reason=this.selectedCounterSensorStateReason;break;default:this.lastFilter.state=this.selectedTamperSwitchState,this.lastFilter.reason=null;break}this.refreshTimer&&clearTimeout(this.refreshTimer),this.reportService.getSensorList(h.getRequestModel(this.lastFilter,!0),!0).subscribe(e=>{if(this.sensors=e.items||[],this.paginationResponse=e.paginationResponse,this.modalInstance&&this.modalInstance.getSensor()){let t=this.sensors.find(s=>s.input.id==this.modalInstance.getSensor().input.id);t&&this.modalInstance.updateRecord(t)}this.refreshTimer=setTimeout(()=>{this.getList()},15e3)})}onFilterClicked(e){this.sideNavigation&&this.sideNavigation.hideLeftClicked(),this.getList()}onItemClicked(e){this.modalService.open(c,{settings:{size:"md",centered:!0},props:{sensor:e,showDetail:!0}}).result.then(t=>{this.modalInstance=null}).catch(t=>{this.modalInstance=null})}static ctorParameters=()=>[{type:O},{type:R}];static propDecorators={sideNavigation:[{type:w,args:["sideNavigation"]}]}};J=te([d({selector:"armon-manage-sensors",template:B,animations:V,standalone:!0,imports:[$,G,D,E,k,p,f,Y,m,c,_,j,S],styles:[q]})],J);export{J as ManageSensorsComponent};
