import{a as $}from"./chunk-D4RZOGGF.js";import{a as X}from"./chunk-JUDWAYYT.js";import{b as G,c as H,d as Q}from"./chunk-YOJ4KGSB.js";import"./chunk-CO3X7TQN.js";import{a as q}from"./chunk-VSFNMVXJ.js";import"./chunk-WQ6DP4JQ.js";import{Aa as b,Ba as E,E as T,He as v,Pd as g,Qf as D,Rd as P,Sc as R,Sd as z,Se as j,Te as h,Uc as k,Ue as M,Xc as L,_a as u,ab as S,ad as N,bb as c,bh as U,dd as p,ea as _,eh as F,fg as m,gb as w,ha as A,jb as I,kg as B,ma as f,ng as V,rb as O,ya as s}from"./chunk-SKPDQO4E.js";var J=`<div class="h-100">\r
	<side-navigation>\r
		<ng-template side-navigation-nav>\r
			<div class="row">\r
				<div class="col-12 mb-3">\r
					<label class="report-form-label">{{'TABLET.SEARCH' | translate}}</label>\r
					<armon-search-text-input [(ngModel)]="request.filter" [maxLength]="20" [minLength]="3"\r
						(ngModelChange)="filterChanged($event)" placeholder="COMMON.SEARCH"></armon-search-text-input>\r
				</div>\r
				<div class="col-12">\r
					<label class="report-form-label">{{'TABLET.APPROVAL_STATUS' | translate}}</label>\r
					<nz-select class="w-100" [(ngModel)]="request.status" nzSize="small"\r
						(ngModelChange)="filterChanged($event)">\r
						<nz-option *ngFor="let statusType of statusTypes" [nzValue]="statusType.type" [nzLabel]="statusType.description |\r
						  translate"></nz-option>\r
					</nz-select>\r
				</div>\r
			</div>\r
		</ng-template>\r
		<ng-template side-navigation-content>\r
			<!-- Listing area -->\r
			<div class="row" *ngIf="listReponse && listReponse.items?.length>0"\r
				[@listAnimationFast]="listReponse.items.length">\r
				<div class="col-xxxl-3 col-xl-4 col-lg-6 col-md-12" *ngFor="let tablet of listReponse.items">\r
					<armon-tablet-card [tablet]="tablet"\r
						(tabletCheckedIn)="onTabletCheckedIn($event)"></armon-tablet-card>\r
				</div>\r
			</div>\r
			<div class="row pt-5" *ngIf="listReponse && listReponse.items?.length==0">\r
				<div class="col-12">\r
					<nz-empty [nzNotFoundContent]="contentTpl"\r
						[nzNotFoundImage]="'./assets/images/empty/empty_list.png'">\r
						<ng-template #contentTpl>\r
							<span>{{'TABLET.FILTER_NO_ITEMS'|translate}}</span>\r
						</ng-template>\r
					</nz-empty>\r
				</div>\r
			</div>\r
			<div class="row pb-3 pt-3">\r
				<div class="col-xl-12">\r
					<armon-pagination [paginationResponse]="paginationResponse" (pageChanged)="pageChanged($event)">\r
					</armon-pagination>\r
				</div>\r
			</div>\r
		</ng-template>\r
	</side-navigation>\r
</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 x=class extends L{http;sessionService;configurationService;interactionService;constructor(e,t,n,r){super(e,t,n,r),this.http=e,this.sessionService=t,this.configurationService=n,this.interactionService=r}getCheckInTablets(e){return this.requestPost(`/${this.sessionService.currentOrganizationId}/checkintablet/listapprovements`,e,null,k.User)}approvePendingTablet(e){return this.requestPost(`/${this.sessionService.currentOrganizationId}/checkintablet/approve`,e,null,k.User)}};var re=function(a,e,t,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,n);else for(var l=a.length-1;l>=0;l--)(i=a[l])&&(o=(r<3?i(o):r>3?i(e,t,o):i(e,t))||o);return r>3&&o&&Object.defineProperty(e,t,o),o},d=class extends R{http;configurationService;interactionService;sessionService;api;constructor(e,t,n,r){super(n,r),this.http=e,this.configurationService=t,this.interactionService=n,this.sessionService=r,this.api=new x(this.http,this.sessionService,this.configurationService,this.interactionService)}getCheckInTablets(e){return this.api.getCheckInTablets(e).pipe(T(t=>this.handleError(t,[])))}approvePendingTablet(e){return this.api.approvePendingTablet(e).pipe(T(t=>this.handleError(t,[])))}static ctorParameters=()=>[{type:O},{type:N},{type:D},{type:g}]};d=re([_({providedIn:"root"})],d);var W=`<div class="card mb-3">
	<div class="card-body mhs-12 p-3">
		<div class="d-flex column-gap-2">
			<div class="d-flex flex-column align-items-center justify-content-between  p-2">
				<cds-icon shape="tablet" size="lg" solid
					[ngClass]="{'text-primary': tablet.isApproved, 'color-gray': !tablet.isApproved}"></cds-icon>
				<cds-icon shape="warning-standard" solid class="text-danger" size="md"
					*ngIf="!tablet.isApproved"></cds-icon>
			</div>
			<div class="d-flex flex-column">
				<span class="text-xl fw-medium mt-2 mb-3"
					[ngClass]="{'text-primary': tablet.isApproved, 'color-gray': !tablet.isApproved}">{{tablet.referenceCode}}</span>
				<span
					class="text-sm color-gray-dark">{{'TABLET.CREATION_DATE'|translate}}:&nbsp;{{tablet.creationTime|date:'medium'}}</span>
				<span class="text-xs text-italic color-gray-dark">{{tablet.id}}</span>
				<div *ngIf="!tablet.isApproved" class="mt-3">
					<button class="btn btn-sm btn-outline-primary"
						(click)="onApproveClicked($event)">{{'BUTTON.APPROVE'|translate}}</button>
				</div>
			</div>
		</div>
	</div>
</div>`;var Y=`.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 Z=`<ng-container>\r
  <div class="modal-header">\r
    <span class="text-lg">{{'TABLET.APPROVAL'|translate}}</span>\r
  </div>\r
  <div class="modal-body">\r
    <div class="row">\r
      <div class="col-12">\r
        <span class="text-md">{{'TABLET.APPROVAL_CODE_DIRECTION'|translate}}</span>\r
      </div>\r
    </div>\r
    <div class="row my-3">\r
      <div class="col-12">\r
        <form [formGroup]="form" (ngSubmit)="onApproveClicked($event)">\r
          <div class="form-group form-layout mb-3">\r
            <label for="approvementCode-input">{{'TABLET.APPROVAL_CODE' | translate}}</label>\r
            <input type="text" id="referencecode-input" formControlName="approvementCode" maxlength="6"\r
              class="form-control text-lg text-primary fw-medium"\r
              [ngClass]="{'is-invalid': form.get('approvementCode').touched && form.get('approvementCode').invalid}">\r
            <ng-template\r
              *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('approvementCode')}">\r
            </ng-template>\r
          </div>\r
        </form>\r
      </div>\r
    </div>\r
    <div class="row">\r
      <div class="col-12 d-flex justify-content-center">\r
        <div style="width: 384px; height: 240px; background-color: #7a7a7a;"\r
          class="d-flex flex-column rounded-2 border border-2">\r
          <div class="d-flex bg-color-primary rounded-1 position-relative m-2" style="flex:1;">\r
            <img src="./assets/images/armongate_dark_logo.svg" style="height: 16px; top:20px; left:20px;"\r
              class="position-absolute">\r
            <div class="d-flex text-white px-4 column-gap-5 position-absolute" style="bottom: 20px; left: 0px;">\r
              <div class="d-flex flex-column">\r
                <span class="text-sm fw-light">{{'TABLET.REFERENCE_CODE'|translate}}</span>\r
                <span class="text-base fw-medium">{{data.tablet.referenceCode}}</span>\r
              </div>\r
              <div class="d-flex flex-column">\r
                <span class="text-sm fw-light">{{'TABLET.APPROVAL_CODE'|translate}}</span>\r
                <span class="text-base fw-medium"\r
                  [ngClass]="{'text-white': form.valid, 'text-danger': !form.valid}">{{form?.value?.approvementCode?form.value.approvementCode:'?????'}}</span>\r
              </div>\r
            </div>\r
          </div>\r
        </div>\r
      </div>\r
    </div>\r
  </div>\r
\r
  <div class="modal-footer">\r
    <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">{{'BUTTON.CANCEL' | translate}}</button>\r
    <button class="btn btn-primary" [disabled]="form.invalid" (click)="onApproveClicked($event)">{{'BUTTON.APPROVE' |\r
      translate}}</button>\r
  </div>\r
</ng-container>\r
\r
<!-- FORM FIELD VALIDATION -->\r
<ng-template #controlValidationTemplate let-form let-control="control">\r
  <ng-container *ngIf="control.errors">\r
    <div class="invalid-feedback d-flex flex-column" style="display: initial;">\r
      <span *ngIf="control.errors.required">{{'VALIDATION.REQUIRED'|translate}}</span>\r
      <span *ngIf="control.errors.numeric">{{'TABLET.VALIDATION_APPROVAL_CODE'|translate}}</span>\r
      <span *ngIf="control.errors.maxlength">{{'VALIDATION.MAX_LENGTH'|translate: {\r
        max:control.errors.maxlength.requiredLength} }}</span>\r
      <span *ngIf="control.errors.minlength">{{'VALIDATION.MIN_LENGTH'|translate: {\r
        min:control.errors.minlength.requiredLength} }}</span>\r
    </div>\r
  </ng-container>\r
</ng-template>`;var ee=`.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}.color-primary,.color-primary-all *{color:#0a2a5a!important}.color-selection{color:#eb8d00!important}.color-secondary-tint{color:#cde1ec!important}.color-secondary{color:#0369a1!important}.color-error{color:#c82602!important}.color-success{color:#62a325!important}.color-dark-blue-color{color:#445187!important}.color-background-color{color:#f3f4f6!important}.bg-color-primary{background-color:#0a2a5a}.bg-color-selection{background-color:#eb8d00!important}.bg-color-error{background-color:#c82602}.bg-color-success{background-color:#62a325}.bg-color-background{background-color:#f3f4f6}.bg-color-white{background-color:#fff}.bg-color-gray{background-color:#aaa}.bg-color-gray-dark{background-color:#999}.bg-color-gray-lightest{background-color:#eee}.color-black{color:#000}.color-white{color:#fff}.color-gray{color:#aaa}.color-error{color:#c82602}.color-gray-dark{color:#999!important}.color-gray-darkest{color:#666}.color-gray-light{color:#ccc}.color-gray-lightest{color:#eee}.color-ppermission{color:#4c2aa8}.opacity-0{opacity:0!important}.opacity-25{opacity:.25}.opacity-50{opacity:.5}.opacity-75{opacity:.75}.bg-color-primary-tint{background-color:#f3f4f7}.bg-color-secondary-tint{background-color:#e6f0f6}.bg-color-success-tint{background-color:#f7faf4}.bg-color-selection-tint{background-color:#fef9f2}.bg-color-white-alpha{background-color:#ffffff1a}.bg-color-gray-tint{background-color:#fbfbfb}
`;var ce=function(a,e,t,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,n);else for(var l=a.length-1;l>=0;l--)(i=a[l])&&(o=(r<3?i(o):r>3?i(e,t,o):i(e,t))||o);return r>3&&o&&Object.defineProperty(e,t,o),o},y=class extends z{sessionService;formBuilder;tabletService;tablet;form;constructor(e,t,n){super(),this.sessionService=e,this.formBuilder=t,this.tabletService=n}onModalInitialized(){super.onModalInitialized(),this.initializeForms()}initializeForms(){this.form=this.formBuilder.group({approvementCode:[null,[v.required,v.minLength(6),v.maxLength(6),V.numeric({acceptValue:B.PositiveNumber,allowDecimal:!1})]]})}onModalDestroyed(){super.onModalDestroyed()}onApproveClicked(e){if(this.form.valid&&this.form.value?.approvementCode){let t={id:this.tablet.id,referenceCode:this.tablet.referenceCode,approvementCode:this.form.value.approvementCode.toString()};this.tabletService.approvePendingTablet(t).subscribe(n=>{this.closeModal(n)})}}static ctorParameters=()=>[{type:g},{type:j},{type:d}];static propDecorators={tablet:[{type:b}]}};y=ce([s({selector:"armon-tablet-checkin-modal",template:Z,schemas:[f],standalone:!0,imports:[c,h,M,p,w,u],styles:[ee]})],y);var pe=function(a,e,t,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,n);else for(var l=a.length-1;l>=0;l--)(i=a[l])&&(o=(r<3?i(o):r>3?i(e,t,o):i(e,t))||o);return r>3&&o&&Object.defineProperty(e,t,o),o},C=class{modalService;tablet;tabletCheckedIn=new A;constructor(e){this.modalService=e}ngOnInit(){}ngOnDestroy(){}onApproveClicked(e){this.modalService.open(y,{settings:{size:"md",centered:!0,scrollable:!1},props:{tablet:this.tablet}}).result.then(t=>{this.tabletCheckedIn.emit(t)}).catch(t=>{})}static ctorParameters=()=>[{type:P}];static propDecorators={tablet:[{type:b}],tabletCheckedIn:[{type:E}]}};C=pe([s({selector:"armon-tablet-card",template:W,standalone:!0,schemas:[f],imports:[c,u,p,I],styles:[Y]})],C);var de=function(a,e,t,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,n);else for(var l=a.length-1;l>=0;l--)(i=a[l])&&(o=(r<3?i(o):r>3?i(e,t,o):i(e,t))||o);return r>3&&o&&Object.defineProperty(e,t,o),o},te=class{tabletService;listReponse=void 0;paginationResponse;request;statusTypes;constructor(e){this.tabletService=e}ngOnInit(){this.request={pagination:{skip:0,take:24},status:m.All},this.statusTypes=[{type:m.All,description:"COMMON.ALL"},{type:m.NotApproved,description:"TABLET.APPROVAL_STATUS_PENDING"},{type:m.Approved,description:"TABLET.APPROVAL_STATUS_ACCEPTED"}],this.getTablets()}ngOnDestroy(){}pageChanged(e){this.request.pagination.skip=e.skip,this.request.pagination.take=e.take,this.getTablets()}filterChanged(e){this.request.pagination.skip=0,this.getTablets()}getTablets(){this.tabletService.getCheckInTablets(this.request).subscribe(e=>{this.listReponse=e,this.paginationResponse=e.pagination})}onTabletCheckedIn(e){this.getTablets()}static ctorParameters=()=>[{type:d}]};te=de([s({selector:"armon-manage-tablets",template:J,animations:$,standalone:!0,imports:[Q,G,h,S,H,C,c,U,q,p,X,F],styles:[K]})],te);export{te as ManageTabletsComponent};
