import{a as U}from"./chunk-JUDWAYYT.js";import{a as H}from"./chunk-5OT2MLHH.js";import{a as k}from"./chunk-4IRXRL4C.js";import"./chunk-LAJI7RPC.js";import{a as P}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{a as q}from"./chunk-4MZCYQX4.js";import{b as G,c as D,d as w}from"./chunk-YOJ4KGSB.js";import"./chunk-I6FSQTEP.js";import"./chunk-CO3X7TQN.js";import{a as M}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{J as O,Ob as z,Ta as L,Ua as x,a as B,l as I,o as R,wb as A}from"./chunk-YSQLW2JA.js";import"./chunk-NVJ2ZZFT.js";import{Dc as r,Fb as u,Te as C,Yg as y,_a as d,ab as h,af as E,bb as g,bh as N,cd as v,dc as f,dd as S,eh as _,g as F,gg as o,hd as s,hg as T,jg as b,ya as m}from"./chunk-SKPDQO4E.js";var V=`<div class="h-100">
	<side-navigation *ngIf="visibleComponent">
		<ng-template side-navigation-nav>
			<div class="row row-gap-2">

				<div class="col-12" *ngIf="permissionSearchOrganizationUnit">
					<label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
					<armon-select-search query="unit" [allowMulti]="true" [(ngModel)]="request.organizationUnitIds">
					</armon-select-search>
					<label class="report-checkbox-label" nz-checkbox
						*ngIf="request.organizationUnitIds && request.organizationUnitIds.length > 0"
						[(ngModel)]="request.filterOrganizationUnitMembersHierarchically">{{'REPORT.SHOW_HIERARCHICALLY'
						|
						translate}}</label>
				</div>
				<div class="col-12" *ngIf="permissionSearchIdentity">
					<label class="report-form-label">{{'REPORT.IDENTITIES' | translate :
						languageService.userTranslate}}</label>
					<armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="request.userIds">
					</armon-select-search>
				</div>
				<div class="col-12">
					<label class="report-form-label">{{'REPORT.ACCESS_CONTROL_POINTS' | translate}}</label>
					<armon-select-search query="point" [allowMulti]="true" [(ngModel)]="request.accessControlPointIds">
					</armon-select-search>
				</div>
				<div class="col-12" *ngIf="permissionSearchRegion">
					<label class="report-form-label">{{'REPORT.REGIONS' | translate}}</label>
					<armon-select-search query="region" [allowMulti]="true" [(ngModel)]="request.regionIds">
					</armon-select-search>
				</div>
				<div class="col-12" *ngIf="permissionSearchUserGroup">
					<label class="report-form-label">{{'REPORT.USER_GROUPS' | translate :
						languageService.userTranslate}}</label>
					<armon-select-search query="group" [allowMulti]="true" [(ngModel)]="request.userGroupIds">
					</armon-select-search>
				</div>
				<div class="col-12">
					<label class="report-form-label">{{'VEHICLE_TRACKING.LOG_TYPE' | translate}}</label>
					<nz-select class="w-100" [(ngModel)]="request.type" nzSize="small"
						nzPlaceHolder="{{'COMMON.ALL'|translate}}">
						<nz-option *ngFor="let type of logTypes" [nzValue]="type.type" [nzLabel]="type.description |
						  translate"></nz-option>
					</nz-select>
				</div>
				<div class="col-12">
					<label class="report-form-label">{{'VEHICLE_TRACKING.TRACKING_REGION' | translate}}</label>
					<armon-search-text-input [(ngModel)]="request.region" [maxLength]="20" [minLength]="3"
						placeholder="COMMON.SEARCH"></armon-search-text-input>
				</div>
				<div class="col-12">
					<label class="report-form-label">{{'VEHICLE_TRACKING.LICENSE_PLATE' | translate}}</label>
					<armon-search-text-input [(ngModel)]="request.licencePlate" [maxLength]="20" [minLength]="3"
						placeholder="COMMON.SEARCH"></armon-search-text-input>
				</div>
				<div class="col-12">
					<label class="report-form-label">{{'VEHICLE_TRACKING.LOG_SYNCED_STATUS' | translate}}</label>
					<nz-select class="w-100" [(ngModel)]="request.isSynchronized" nzSize="small"
						nzPlaceHolder="{{'COMMON.ALL'|translate}}">
						<nz-option *ngFor="let state of syncStates" [nzValue]="state.value" [nzLabel]="state.label |
						  translate"></nz-option>
					</nz-select>
				</div>
			</div>
			<!-- Buttons for filtering state -->
			<div class="centered filterButtons">
				<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)">{{'REPORT.GET_REPORT' |
					translate}}</button>
			</div>
		</ng-template>
		<ng-template side-navigation-content>
			<div class="report-data-container">
				<div class="row report-filter-container">
					<!-- <div class="col-12">
						<div class="row">
							<div class="col-12">
								<armon-report-template-panel [reportType]="reportTemplateType" [filter]="filter"
									[templateId]="reportTemplateId"
									(templateLoaded)="onTemplateLoaded($event)"></armon-report-template-panel>
							</div>
						</div>
					</div> -->
					<div class="col-12">
						<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 pt-5" *ngIf="items && items.length==0">
					<div class="col-12">
						<nz-empty [nzNotFoundContent]="contentTpl"
							[nzNotFoundImage]="'./assets/images/empty/empty_list.png'">
							<ng-template #contentTpl>
								<span>{{'COMMON.NO_DATA'|translate}}</span>
							</ng-template>
						</nz-empty>
					</div>
				</div>
				<div class="row report-data-table-container" id="report-data-table-container"
					*ngIf="items && items.length > 0">
					<div class="col-12">
						<p-table [value]="items" dataKey="id" [responsive]="true" rowExpandMode="single">
							<ng-template pTemplate="header">
								<tr>
									<th>{{'REPORT.ACCESS_LOGS_HEADER_FULLNAME' | translate}}</th>
									<th>{{'REPORT.ACCESS_LOGS_HEADER_ACCESS_TIME' | translate}}</th>
									<th>{{'REPORT.ACCESS_LOGS_HEADER_ACCESS_POINT' | translate}}</th>
									<th>{{'VEHICLE_TRACKING.INFO' | translate}}</th>
									<th>{{'VEHICLE_TRACKING.TRACKING_REGION' | translate}}</th>
								</tr>
							</ng-template>
							<ng-template pTemplate="body" let-item>
								<tr class="data-row">
									<td>
										<armon-captionlines *ngIf="item.userCaptions" [showBorder]="false"
											[captionlines]="item.userCaptions"></armon-captionlines>
									</td>
									<td>
										<div class="report-multi-data-cell">
											<span
												class="title-text fw-medium">{{item.actionUtcHourText}}<armon-local-date
													[dateUtc]="item.actionUtc">
												</armon-local-date></span>
											<span class="sub-text">{{item.actionUtcText}}</span>
										</div>
									</td>
									<td>
										<span class="text-md"
											*ngIf="item.accessControlPointName">{{item.accessControlPointName}}</span>
									</td>
									<td>
										<div class="report-multi-data-cell">
											<span class="main-text"
												*ngIf="item.licencePlate">{{item.licencePlate}}</span>
											<div class="d-flex column-gap-2 align-items-center">
												<cds-icon shape="cloud-traffic" class="cds-icon-16" nz-tooltip
													nzTooltipTitle="{{item.isSynchronized ? ('VEHICLE_TRACKING.LOG_SYNCED' | translate) :('VEHICLE_TRACKING.LOG_NOT_SYNCED' | translate)}}"
													[ngClass]="{'color-gray': !item.isSynchronized, 'text-success': item.isSynchronized }"></cds-icon>
												<span class="sub-text"
													*ngIf="item.typeText">{{item.typeText|translate}}</span>
											</div>
										</div>
									</td>
									<td>
										<span class="text-md" *ngIf="item.region">{{item.region}}</span>
									</td>
								</tr>
							</ng-template>
						</p-table>
					</div>

					<div class="col-12 my-3">
						<armon-pagination [paginationResponse]="paginationResponse"
							[scrollDomId]="'report-data-table-container'"
							(pageChanged)="pageChanged($event)"></armon-pagination>
					</div>
				</div>
			</div>
		</ng-template>
	</side-navigation>
</div>`;var K=`.justify-content-center{-webkit-box-pack:center;-moz-box-pack:center;-webkit-flex-pack:center;-ms-flex-pack:center;-moz-justify-content:center;-webkit-justify-content:center;justify-content:center}.justify-content-flex-end{-webkit-box-pack:end;-moz-box-pack:end;-webkit-flex-pack:end;-ms-flex-pack:end;-moz-justify-content:flex-end;-webkit-justify-content:flex-end;justify-content:flex-end}.card-footer{padding:.28rem .7rem}.alert{font-size:.756rem}@media screen and (min-width: 992px){.modal-xxl{max-width:1640px}}@media screen and (min-width: 1200px){.modal-xxxl{max-width:1860px}}.modal-fs{max-width:none;position:absolute;margin:auto;inset:16px;height:100vh;display:flex}.btn-link{text-decoration:none}.btn-link:hover{text-decoration:underline}.invalid-feedback{margin-top:0!important;font-size:.672rem!important}
`;var Y=F(B());var W=function(l,e,a,i){var n=arguments.length,t=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,a):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(l,e,a,i);else for(var p=l.length-1;p>=0;p--)(c=l[p])&&(t=(n<3?c(t):n>3?c(e,a,t):c(e,a))||t);return n>3&&t&&Object.defineProperty(e,a,t),t},j=class{route;authService;reportService;languageService;translate;request;items;visibleComponent=!1;permissionSearchRegion;permissionSearchUserGroup;permissionSearchIdentity;permissionSearchOrganizationUnit;logTypes;syncStates;datePickerOptions=new T;constructor(e,a,i,n,t){this.route=e,this.authService=a,this.reportService=i,this.languageService=n,this.translate=t}ngOnInit(){this.logTypes=f(L),this.logTypes.unshift({type:null,description:"COMMON.ALL"}),this.syncStates=[{value:null,label:"COMMON.ALL"},{value:!0,label:"VEHICLE_TRACKING.LOG_ONLY_SYNCED"},{value:!1,label:"VEHICLE_TRACKING.LOG_ONLY_NOT_SYNCED"}],this.permissionSearchIdentity=this.authService.checkPermission(s.IDENTITY.getReadBasic()),this.permissionSearchOrganizationUnit=this.authService.checkPermission(s.ORGANIZATIONUNIT.getReadBasic()),this.permissionSearchUserGroup=this.authService.checkPermission(s.USERGROUP.getRead()),this.permissionSearchRegion=this.authService.checkPermission(s.REGION.getRead()),this.request=x.getEmptyModel(),this.datePickerOptions.items=[{type:o.Today,selected:!0,currentTimeForEnd:!0},{type:o.Yesterday},{type:o.SelectDay},{type:o.CustomWithTimer}],this.setDateSelection(b.getDateSelection(this.datePickerOptions.items[0])),this.visibleComponent=!0}ngAfterViewInit(){this.getList()}ngOnDestroy(){}setDateSelection(e){this.request.startUtc=e.startDate,this.request.endUtc=e.endDate}getList(){this.reportService.getVehicleTrackingAccessLogs(this.request).subscribe(e=>{this.items=e.items})}onGetExcelClicked(e){this.reportService.exportVehicleTrackingAccessLogsAsExcel(this.request).subscribe(a=>{this.translate.get(["PAGES.REPORT_VEHICLE_TRACKING"],this.languageService.userTranslate).subscribe(i=>{Y.default.saveAs(a,i["PAGES.REPORT_VEHICLE_TRACKING"]+" "+r.fromJSDate(this.request.startUtc).toLocaleString(r.DATETIME_MED)+" "+r.fromJSDate(this.request.endUtc).toLocaleString(r.DATETIME_MED)+".xlsx")})})}refreshList(e=!0){e&&(this.request.pagination.skip=0),this.getList()}onGetReportClicked(e){this.refreshList()}pageChanged(e){this.request.pagination=e,this.refreshList(!1)}onDateSelectionChanged(e){this.setDateSelection(e),this.refreshList()}static ctorParameters=()=>[{type:u},{type:z},{type:O},{type:E},{type:v}]};j=W([m({selector:"armon-report-vehicle-tracking",template:V,standalone:!0,imports:[g,h,d,w,G,C,A,R,_,y,D,I,N,q,k,P,U,S,H,M],styles:[K]})],j);export{j as ReportVehicleTrackingComponent};
