import{a as J}from"./chunk-HXEFMD5A.js";import"./chunk-KCLQIV7M.js";import"./chunk-5KCUTXXV.js";import"./chunk-JUDWAYYT.js";import{a as j}from"./chunk-WFZJP5WR.js";import"./chunk-F6KLNSUK.js";import{b as B,c as Y,d as q}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as $}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Fb as G,J as A,Mb as V,Ob as H,a as te,j as O,l as _,m as M,o as U,wb as z}from"./chunk-YSQLW2JA.js";import{Hb as w,Vb as F,Wb as L,_ as D}from"./chunk-NVJ2ZZFT.js";import{Dc as n,Fb as S,Mg as N,Ng as d,Pd as R,Qf as E,Te as x,_a as g,ab as v,af as T,bb as I,bh as k,cd as b,dd as h,g as ee,gb as P,gg as m,hd as r,hg as C,jg as y,wa as u,ya as f}from"./chunk-SKPDQO4E.js";var W=`<div class="h-100">
	<side-navigation #sideNavigation>
		<ng-template side-navigation-nav>
			<div>
				<div class="row" *ngIf="!selfMode">
					<div class="col-12 mb-2 b-b-1 py-3">
						<nz-switch [(ngModel)]="visibleMultiUserReport" (ngModelChange)="onReportModeChanged($event)"
							nzSize="small"
							title="{{ ( visibleMultiUserReport ? 'REPORT.SINGLE_USER_REPORT':'REPORT.USERS_REPORT') | translate }}">
						</nz-switch>
						<label class="report-form-label ms-2 cursor-pointer"
							(click)="visibleMultiUserReport=!visibleMultiUserReport">{{ ( visibleMultiUserReport ?
							'REPORT.USERS_REPORT':'REPORT.SINGLE_USER_REPORT') | translate }}</label>
					</div>
				</div>

				<!-- SINGLE USER REPORT -->
				<ng-container *ngIf="!visibleMultiUserReport">
					<div class="row">
						<div class="col-xl-12" *ngIf="permissionSearchIdentity && permissionManagement">
							<label class="report-form-label">{{'REPORT.PACS_COL_USER' | translate}}</label>
							<armon-select-search query="identity" [allowMulti]="false" [(ngModel)]="selectedIdentityId"
								(ngModelChange)="onFilterUpdated($event)">
							</armon-select-search>
						</div>
					</div>
					<div class="row">
						<div class="col-xl-12">
							<label class="report-form-label">{{'PACS.PPERMISSION_TYPE_LABEL' | translate}}</label>
							<div class="select">
								<select [(ngModel)]="filter.ppermissionTypeId" (ngModelChange)="onTypeChanged($event)"
									class="form-select form-select-sm">
									<option *ngFor="let availableType of availableTypes" [ngValue]="availableType.id">
										{{availableType.name}}
									</option>
								</select>
							</div>
						</div>
					</div>
					<div class="row" *ngIf="permissionSearchIdentity && permissionManagement">
						<div class="col-12 mt-3">
							<label class="report-form-label">{{'PACS.USERS_LIST' | translate}}</label>
						</div>
						<div class="col-12 mt-2">
							<armon-identity-filter [enableDetailSearch]="false" [enableIdentitySelection]="true"
								[identitySelectionTake]="8" (identitySelected)="onListIdentitySelected($event)">
							</armon-identity-filter>
						</div>
					</div>
					<div class="centered filterButtons">
						<button class="btn btn-success btn-sm" (click)="onGetExcelClicked($event)"
							*ngIf="items">{{'BUTTON.EXCEL'
							| translate}}</button>
					</div>
				</ng-container>

				<!-- MULTI USER REPORT -->
				<ng-container *ngIf="visibleMultiUserReport">
					<div class="row">
						<div class="col-12">
							<label class="report-form-label">{{'REPORT.EMPLOYEES' | translate}}</label>
							<armon-select-search query="identity" [allowMulti]="true" [(ngModel)]="multiFilter.userIds">
							</armon-select-search>
						</div>
						<div class="col-12">
							<label class="report-form-label">{{'REPORT.ORGANIZATION_UNITS' | translate}}</label>
							<armon-select-search query="unit" [allowMulti]="true"
								[(ngModel)]="multiFilter.organizationUnitIds">
							</armon-select-search>
							<label class="report-checkbox-label" nz-checkbox
								*ngIf="multiFilter.organizationUnitIds && multiFilter.organizationUnitIds.length > 0"
								[(ngModel)]="multiFilter.applyOrganizationUnitFilterHierarchically">{{'REPORT.SHOW_HIERARCHICALLY'
								|
								translate}}</label>
						</div>
						<div class="col-12">
							<label class="report-form-label">{{'REPORT.USER_GROUPS' | translate :
								languageService.userTranslate}}</label>
							<armon-select-search query="group" [allowMulti]="true"
								[(ngModel)]="multiFilter.userGroupIds">
							</armon-select-search>
						</div>
					</div>
					<div class="row">
						<div class="col-xl-12">
							<label class="report-form-label">{{'PACS.PPERMISSION_TYPE_LABEL' | translate}}</label>
							<div class="select">
								<select [(ngModel)]="multiFilter.ppermissionTypeId" class="form-select form-select-sm">
									<option *ngFor="let availableType of availableTypes" [ngValue]="availableType.id">
										{{availableType.name}}
									</option>
								</select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-12 mb-2" *ngIf="permissionSearchIdentity && permissionManagement">
							<label class="report-form-label">{{'IDENTITY.FILTER_TITLE_STATUS' | translate}}</label>
							<armon-identity-status [(ngModel)]="multiFilter.userOrganizationStatus">
							</armon-identity-status>
						</div>
					</div>
					<!-- Buttons for filtering state -->
					<div class="centered filterButtons">
						<button class="btn btn-success btn-sm me-2"
							(click)="onMultiGetExcelClicked($event)">{{'BUTTON.EXCEL'
							| translate}}</button>
						<button class="btn btn-primary btn-sm"
							(click)="onMultiGetReportClicked($event)">{{'REPORT.GET_REPORT' |
							translate}}</button>
					</div>
				</ng-container>
			</div>
		</ng-template>
		<ng-template side-navigation-content>
			<div class="report-data-container">
				<div class="report-filter-container mt-3 mb-2" *ngIf="annualPermissionCurrentStatus">
					<div class="item-container col-12 py-3 px-4">
						<div class="row">
							<div class="col-sm-6 col-12 d-flex align-items-center">
								<div class="d-flex flex-column justify-content-center me-3">
									<span class="text-sm text-bold">
										{{annualPermissionCurrentStatus.title}}
									</span>
									<span class="text-lg text-bold text-success">
										{{annualPermissionCurrentStatus.leftOverPermissionCount}}
										{{'USER_PERMISSION_UNIT_TYPE_DAY'|translate}}
									</span>
								</div>
								<ng-container
									*ngIf="permissionUpdateRemainingAnnual && annualPermissionCurrentStatus.editable">
									<div class="ps-3 b-l-1" *ngIf="!visibleAnnualPermissionCurrentUpdate">
										<button class="btn btn-sm btn-outline-primary"
											(click)="onUpdateAnnualPermissionCurrentClicked($event)">{{'BUTTON.UPDATE'|translate}}</button>
									</div>
									<div class="ps-3 b-l-1" *ngIf="visibleAnnualPermissionCurrentUpdate">
										<form name="form" #updateForm="ngForm">
											<div class="input-group input-group-sm">
												<input type="number" class="form-control form-control-sm" required
													name="leftOverPermissionCount"
													[(ngModel)]="tempLeftOverPermissionCount" pattern="^-?\\d+(\\.5)?$"
													[ngClass]="{'is-invalid': updateForm.controls['leftOverPermissionCount'] && updateForm.controls['leftOverPermissionCount'].invalid}">
												<button class="btn btn-sm btn-outline-primary"
													(click)="onCancelAnnualPermissionCurrentClicked($event)">{{'BUTTON.CANCEL'|translate}}</button>
												<button class="btn btn-sm btn-primary" [disabled]="updateForm.invalid"
													(click)="onSaveAnnualPermissionCurrentClicked($event)">{{'BUTTON.UPDATE'|translate}}</button>
											</div>
											<ng-container
												*ngIf="updateForm && updateForm.controls['leftOverPermissionCount']">
												<div class="invalid-feedback" style="display: initial;"
													*ngIf="updateForm.controls['leftOverPermissionCount'].errors && updateForm.controls['leftOverPermissionCount'].errors.pattern">
													{{'VALIDATION.HALF_DURATION_PATTERN'|translate}}
												</div>
												<div class="invalid-feedback" style="display: initial;"
													*ngIf="updateForm.controls['leftOverPermissionCount'].errors && updateForm.controls['leftOverPermissionCount'].errors.required">
													{{'VALIDATION.REQUIRED'|translate}}
												</div>
											</ng-container>
										</form>
									</div>
								</ng-container>
							</div>
							<div class="col-sm-6 col-12 d-flex flex-column justify-content-center"
								*ngIf="annualPermissionCurrentStatus.nextPeriodClaim && annualPermissionCurrentStatus.nextPeriodClaim>0">
								<span class="text-sm text-bold">
									{{'REPORT.PACS_USER_MONTH_INFO_NEXT_PERIOD'|translate}}
								</span>
								<span class="text-sm">
									{{annualPermissionCurrentStatus.nextPeriodClaim}}
									{{'USER_PERMISSION_UNIT_TYPE_DAY'|translate}}
									({{annualPermissionCurrentStatus.nextPeriodStartDateText}})
								</span>
							</div>
						</div>
					</div>
				</div>
				<!-- SINGLE REPORT HEADER -->
				<ng-container *ngIf="!visibleMultiUserReport">
					<div class="row report-filter-container">
						<div class="col-xl-12">
							<div class="row">
								<div class="col-xl-12">
									<armon-date-picker [options]="datePickerOptions"
										(selectionChanged)="onDateSelectionChanged($event)">
									</armon-date-picker>
								</div>
							</div>
						</div>
					</div>
					<div class="row mt-5"
						*ngIf="!selectedIdentityId && (permissionSearchIdentity && permissionManagement)">
						<div class="col-12">
							<nz-empty [nzNotFoundContent]="contentTpl"
								[nzNotFoundImage]="'./assets/images/empty/search_user.png'">
								<ng-template #contentTpl>
									<span>{{'REPORT.PACS_PERMISSION_USAGE_INFO'|translate}}</span>
								</ng-template>
							</nz-empty>
						</div>
					</div>
				</ng-container>

				<!-- MULTI REPORT HEADER -->
				<ng-container *ngIf="visibleMultiUserReport">
					<div class="row mt-5" *ngIf="multiItems && multiItems.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>
				</ng-container>

				<!-- SINGLE REPORT TABLE -->
				<ng-container *ngIf="!visibleMultiUserReport && selectedIdentityId">
					<div class="row report-data-table-container" id="report-data-table-container-single" *ngIf="items">
						<div class="col-12">
							<ng-container *ngFor="let item of items">
								<div class="item-container col-12 bg-white mb-3 py-3 px-4">
									<div class="row">
										<div
											class="col-sm-3 col-12 d-flex flex-column justify-content-center mb-3 mb-sm-0">
											<span class="text-lg">{{item.title}}
												{{'REPORT.PACS_USER_PPERMISSION_PERIOD'|translate}}</span>
											<span class="text-md">{{item.subTitle}}</span>
											<span class="text-xs text-italic">{{item.rangeText}}</span>
										</div>
										<div class="col-sm-2 col-6 d-flex">
											<ng-template
												*ngTemplateOutlet="countTemplate; context: {$implicit: item, countTitle:'REPORT.PACS_USER_MONTH_INFO_PREV', countValue:item.leftFromPreviousPeriod, countImportant:false}">
											</ng-template>
										</div>
										<div class="col-sm-2 col-6 d-flex">
											<ng-template
												*ngTemplateOutlet="countTemplate; context: {$implicit: item, countTitle:'REPORT.PACS_USER_MONTH_INFO_NEW_CLAIM', countValue:item.newlyClaimed, countImportant:false}">
											</ng-template>
										</div>
										<div class="col-sm-2 col-6 d-flex">
											<ng-template
												*ngTemplateOutlet="countTemplate; context: {$implicit: item, countTitle:'REPORT.PACS_USER_MONTH_INFO_USED', countValue:item.usage, countImportant:true}">
											</ng-template>
										</div>
										<div class="col-sm-2 col-6 d-flex">
											<ng-template
												*ngTemplateOutlet="countTemplate; context: {$implicit: item, countTitle:'REPORT.PACS_USER_MONTH_INFO_LEFT', countValue:item.rollOverToNextPeriod, countImportant:false}">
											</ng-template>
										</div>
										<div class="col-sm-1 col-12 d-flex justify-content-end align-items-center">
											<div>
												<button class="btn btn-sm btn-outline-primary"
													(click)="onPermissionListClicked(item)"
													[hidden]="(!item.usage || item.usage==0)">{{'REPORT.PACS_PPERMISSION_LIST'|translate}}</button>
											</div>
										</div>
									</div>
								</div>
							</ng-container>
						</div>
						<div class="row">
							<div class="col-12" *ngIf="items">
								<armon-pagination [paginationResponse]="paginationResponse"
									[scrollDomId]="'report-data-table-container-single'"
									(pageChanged)="pageChanged($event)">
								</armon-pagination>
							</div>
						</div>
					</div>
				</ng-container>

				<!-- MULTI REPORT TABLE -->
				<ng-container *ngIf="visibleMultiUserReport">
					<div class="row report-data-table-container" id="report-data-table-container-multi"
						*ngIf="multiItems">
						<div class="col-12">
							<ng-container *ngFor="let multiItem of multiItems">
								<div class="item-container col-12 bg-white mb-3 py-3 px-4">
									<div class="row">
										<div class="col-sm-3 col-12 d-flex flex-column justify-content-center">
											<armon-captionlines *ngIf="multiItem.user?.userCaptions"
												[showBorder]="false" [captionlines]="multiItem.user?.userCaptions">
											</armon-captionlines>
											<ng-container *ngIf="multiItem.permissionClaimInfo">
												<span class="text-xs ms-1 color-gray text-bold">{{multiItem.title}}
													{{'REPORT.PACS_USER_PPERMISSION_PERIOD'|translate}}
													{{multiItem.subTitle}}</span>
												<span
													class="text-xs text-italic color-gray">{{multiItem.rangeText}}</span>
											</ng-container>
										</div>
										<ng-container *ngIf="multiItem.permissionClaimInfo">
											<div class="col-sm-2 col-6 d-flex">
												<ng-template
													*ngTemplateOutlet="countTemplate; context: {$implicit: multiItem.permissionClaimInfo, countTitle:'REPORT.PACS_USER_MONTH_INFO_PREV', countValue:multiItem.permissionClaimInfo.leftFromPreviousPeriod, countImportant:false}">
												</ng-template>
											</div>
											<div class="col-sm-2 col-6 d-flex">
												<ng-template
													*ngTemplateOutlet="countTemplate; context: {$implicit: multiItem.permissionClaimInfo, countTitle:'REPORT.PACS_USER_MONTH_INFO_NEW_CLAIM', countValue:multiItem.permissionClaimInfo.newlyClaimed, countImportant:false}">
												</ng-template>
											</div>
											<div class="col-sm-2 col-6 d-flex">
												<ng-template
													*ngTemplateOutlet="countTemplate; context: {$implicit: multiItem.permissionClaimInfo, countTitle:'REPORT.PACS_USER_MONTH_INFO_USED', countValue:multiItem.permissionClaimInfo.usage, countImportant:true}">
												</ng-template>
											</div>
											<div class="col-sm-2 col-6 d-flex flex-column">
												<ng-template
													*ngTemplateOutlet="countTemplate; context: {$implicit: multiItem.permissionClaimInfo, countTitle:'REPORT.PACS_USER_MONTH_INFO_LEFT', countValue:multiItem.permissionClaimInfo.remaining, countImportant:false}">
												</ng-template>
												<div class="d-flex flex-column justify-content-center"
													*ngIf="multiItem.permissionClaimInfo.nextPeriodClaim && multiItem.permissionClaimInfo.nextPeriodClaim>0">
													<span class="text-xs text-bold">
														{{'REPORT.PACS_USER_MONTH_INFO_NEXT_PERIOD'|translate}}
													</span>
													<span class="text-xs">
														{{multiItem.permissionClaimInfo.nextPeriodClaim}}
														{{'USER_PERMISSION_UNIT_TYPE_DAY'|translate}}
														({{multiItem.permissionClaimInfo.nextPeriodStartDateText}})
													</span>
												</div>
											</div>
											<div class="col-sm-1 col-12 d-flex justify-content-end align-items-center">
												<div>
													<button class="btn btn-sm btn-outline-primary"
														(click)="onPermissionListClicked(multiItem.permissionClaimInfo, multiItem.user.id)"
														[hidden]="(!multiItem.permissionClaimInfo.usage || multiItem.permissionClaimInfo.usage==0)">{{'REPORT.PACS_PPERMISSION_LIST'|translate}}</button>
												</div>
											</div>
										</ng-container>
										<ng-container *ngIf="!multiItem.permissionClaimInfo">
											<div
												class="col-sm-9 col-12 d-flex justify-content-center align-items-center">
												<span class="text-xs text-italic color-gray">
													{{"REPORT.PACS_USER_PPERMISSION_NO_START_DATE_WARNIING" |
													translate}}
												</span>
											</div>
										</ng-container>
									</div>
								</div>
							</ng-container>
						</div>
						<div class="row">
							<div class="col-12" *ngIf="multiItems">
								<armon-pagination [paginationResponse]="multiPaginationResponse"
									[scrollDomId]="'report-data-table-container-multi'"
									(pageChanged)="multiPageChanged($event)">
								</armon-pagination>
							</div>
						</div>
					</div>
				</ng-container>
			</div>
		</ng-template>
	</side-navigation>
</div>

<ng-template #countTemplate let-item let-countTitle="countTitle" let-countValue="countValue"
	let-countImportant="countImportant">
	<div class="d-flex flex-column me-2" [ngClass]="{'opacity-25': !(countValue && countValue!=0)}">
		<span class="text-sm text-secondary"
			[ngClass]="{'color-ppermission': countImportant}">{{countTitle|translate}}</span>
		<div class="d-flex align-items-baseline">
			<span class="text-xxl me-1"
				[ngClass]="{'color-ppermission': countImportant, 'text-black-50':!countImportant}">{{(countValue &&
				countValue!=0)?countValue:'-'}}</span>
			<span *ngIf="countValue && countValue!=0" class="text-md"
				[ngClass]="{'color-ppermission': countImportant}">{{(ppermissionInfo.isDailyScheduled ?
				'USER_PERMISSION_UNIT_TYPE_DAY' : 'USER_PERMISSION_UNIT_TYPE_HOUR' ) | translate}}</span>
		</div>
	</div>
</ng-template>`;var X=`.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}.item-container{-webkit-border-radius:.25rem;-moz-border-radius:.25rem;border-radius:.25rem;box-shadow:0 0 4px #ccc;background-color:#fff}.counter-container{margin-right:7rem}
`;var p=ee(te());var se=function(c,e,t,i){var s=arguments.length,a=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(c,e,t,i);else for(var l=c.length-1;l>=0;l--)(o=c[l])&&(a=(s<3?o(a):s>3?o(e,t,a):o(e,t))||a);return s>3&&a&&Object.defineProperty(e,t,a),a},Q=class{interactionService;authService;reportService;translate;sessionService;pacsService;languageService;routingService;route;filter;selectedIdentityId=null;items;ppermissionInfo;annualPermissionCurrentStatus;permissionSearchIdentity;permissionManagement;permissionUpdateRemainingAnnual;selfMode=!1;visibleAnnualPermissionCurrentUpdate=!1;visibleMultiUserReport=!1;multiFilter;paginationResponse=new d;multiPaginationResponse=new d;multiItems;datePickerOptions=new C;sideNavigation;availableTypes=[];constructor(e,t,i,s,a,o,l,Z,K){this.interactionService=e,this.authService=t,this.reportService=i,this.translate=s,this.sessionService=a,this.pacsService=o,this.languageService=l,this.routingService=Z,this.route=K,this.permissionSearchIdentity=this.authService.checkPermission(r.IDENTITY.getReadBasic()),this.permissionUpdateRemainingAnnual=this.authService.checkPermission(r.PPERMISSION.getWriteAnnualRemaining()),this.permissionManagement=this.authService.checkPermission(r.PPERMISSION.getRead())||this.authService.checkPermission(r.PPERMISSION.getListAll())}ngOnInit(){this.datePickerOptions.items=[{type:m.AllToNow,selected:!0},{type:m.Last3Years},{type:m.LastYear},{type:m.Custom}],this.createFilters(),this.setDateSelection(y.getDateSelection(this.datePickerOptions.items[0])),this.getPPermissionTypes()}ngAfterViewInit(){}ngOnDestroy(){}createFilters(){this.filter=F.getEmptyModel(),this.multiFilter=L.getEmptyModel()}getPPermissionTypes(){let e=new w,t=new N;t.take=0,e.pagination=t,this.pacsService.getPPermissionTypeList(e).subscribe(i=>{if(this.availableTypes=i.items,this.availableTypes&&this.availableTypes.length>0){let s=this.availableTypes.findIndex(a=>a.preDefined==!0);this.filter.ppermissionTypeId=i.items[s||0].id,this.multiFilter.ppermissionTypeId=i.items[s||0].id}this.permissionManagement&&this.permissionSearchIdentity||(this.selfMode=!0,this.getReportData())})}setDateSelection(e){this.filter.startDay=n.fromJSDate(e.startDate).toFormat("yyyy-MM-dd"),this.filter.endDay=n.fromJSDate(e.endDate).toFormat("yyyy-MM-dd")}onReportModeChanged(e){this.selectedIdentityId=null,e==!0||e==null?this.getMultiReportData():this.selectedIdentityId&&this.getReportData()}onListIdentitySelected(e){this.selectedIdentityId=e.id,this.sideNavigation.hideLeftClicked(),this.getReportData()}onFilterUpdated(e){this.selectedIdentityId&&this._waitForReportData==!1&&this.getReportData()}onTypeChanged(e){(this.selfMode||this.selectedIdentityId)&&(this.sideNavigation.hideLeftClicked(),this.getReportData())}_waitForReportData=!1;getReportData(e=!0){this._waitForReportData=!0,this.annualPermissionCurrentStatus=null,e&&(this.filter.pagination.skip=0),this.reportService.getSinglePPermissionUsage(this.selectedIdentityId?this.selectedIdentityId:this.sessionService.currentUserId,this.filter).subscribe(t=>{if(this.ppermissionInfo=t.ppermissionInfo,this.items=t.items,t.annualPermissionCurrentStatus){let i=this.availableTypes.find(s=>s.type==D.Annual);i&&(t.annualPermissionCurrentStatus.title=i.name,this.annualPermissionCurrentStatus=t.annualPermissionCurrentStatus)}this.paginationResponse=t.pagination,this._waitForReportData=!1})}onGetExcelClicked(e){this.reportService.getSinglePPermissionUsageAsExcel(this.selectedIdentityId?this.selectedIdentityId:this.sessionService.currentUserId,this.filter).subscribe(t=>{this.translate.get(["PAGES.REPORT_PACS_PPERMISSION_USAGE"]).subscribe(i=>{p.default.saveAs(t,i["PAGES.REPORT_PACS_PPERMISSION_USAGE"]+"_"+n.fromISO(this.filter.startDay).toLocaleString(n.DATE_HUGE)+"-"+n.fromISO(this.filter.endDay).toLocaleString(n.DATE_HUGE)+".xlsx")})})}pageChanged(e){this.filter.pagination.skip=e.skip,this.getReportData(!1)}onDateSelectionChanged(e){this.setDateSelection(e),(this.selfMode||this.selectedIdentityId)&&this.getReportData()}onMultiGetReportClicked(e){(!this.selfMode||this.visibleMultiUserReport)&&(this.sideNavigation.hideLeftClicked(),this.getMultiReportData())}onMultiGetExcelClicked(e){(!this.selfMode||this.visibleMultiUserReport)&&(this.sideNavigation.hideLeftClicked(),this.getMultiExcelReportData())}getMultiReportData(e=!0){console.log("getMultiReportData"),e&&(this.multiFilter.pagination.skip=0),this.reportService.getMultiPPermissionUsage(this.multiFilter).subscribe(t=>{this.annualPermissionCurrentStatus=null,this.ppermissionInfo=t.ppermissionInfo,this.multiItems=t.items,this.multiPaginationResponse=t.pagination})}getMultiExcelReportData(e=!0){this.reportService.getMultiPPermissionUsageAsExcel(this.multiFilter).subscribe(t=>{this.translate.get(["PAGES.REPORT_PACS_PPERMISSION_USAGE"]).subscribe(i=>{p.default.saveAs(t,i["PAGES.REPORT_PACS_PPERMISSION_USAGE"]+"_"+n.fromISO(this.filter.startDay).toLocaleString(n.DATE_HUGE)+"-"+n.fromISO(this.filter.endDay).toLocaleString(n.DATE_HUGE)+".xlsx")})})}multiPageChanged(e){this.multiFilter.pagination.skip=e.skip,this.getMultiReportData(!1)}onPermissionListClicked(e,t=void 0){this.selfMode?this.routingService.gotoPPermissionUser(this.ppermissionInfo.id,n.fromJSDate(e.startDate).toISODate(),n.fromJSDate(e.endDate).toISODate()):this.routingService.gotoPPermissionManagement(t||this.selectedIdentityId,this.ppermissionInfo.id,n.fromJSDate(e.startDate).toISODate(),n.fromJSDate(e.endDate).toISODate())}tempLeftOverPermissionCount;onUpdateAnnualPermissionCurrentClicked(e){this.tempLeftOverPermissionCount=this.annualPermissionCurrentStatus.leftOverPermissionCount,this.visibleAnnualPermissionCurrentUpdate=!0}onSaveAnnualPermissionCurrentClicked(e){this.visibleAnnualPermissionCurrentUpdate=!1,this.reportService.editAnnualPermissionLeft(this.selectedIdentityId?this.selectedIdentityId:this.sessionService.currentUserId,this.tempLeftOverPermissionCount).subscribe(t=>{this.annualPermissionCurrentStatus.leftOverPermissionCount=this.tempLeftOverPermissionCount})}onCancelAnnualPermissionCurrentClicked(e){this.visibleAnnualPermissionCurrentUpdate=!1}static ctorParameters=()=>[{type:E},{type:H},{type:A},{type:b},{type:R},{type:O},{type:T},{type:V},{type:S}];static propDecorators={sideNavigation:[{type:u,args:["sideNavigation",{static:!0}]}]}};Q=se([f({selector:"armon-report-ppermission-usage",template:W,standalone:!0,imports:[q,B,I,G,x,v,J,M,z,U,Y,g,_,k,P,$,j,h],styles:[X]})],Q);export{Q as ReportPacsPPermissionUsageComponent};
