import{Rb as w,k as A,wb as N}from"./chunk-YSQLW2JA.js";import{Aa as D,H as E,I as y}from"./chunk-NVJ2ZZFT.js";import{Aa as s,He as l,Nc as u,Pd as v,Qf as S,Sd as T,Se as I,Te as C,Ue as x,Ve as h,Ye as O,ab as d,af as b,bb as p,dd as g,eh as R,gb as f,ya as m}from"./chunk-SKPDQO4E.js";var _=`<div class="modal-header">\r
  <div class="d-flex flex-column">\r
    <span class="text-lg">{{'ACCESSCONTROLPOINT.ADD_MANUAL_RECORD' | translate}}</span>\r
    <span class="text-sm" *ngIf="accessControlPoint">{{accessControlPoint.name}}</span>\r
  </div>\r
</div>\r
\r
<div class="modal-body">\r
  <form [formGroup]="form">\r
    <div class="row">\r
      <div class="col-12">\r
        <div class="form-group">\r
          <label>{{'REPORT.ACCESS_CONTROL_POINT'|translate}}</label>\r
          <armon-select-search query="point" [allowMulti]="false" [formControl]="form.get('accessControlPointId')">\r
          </armon-select-search>\r
          <ng-template\r
            *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('accessControlPointId')}">\r
          </ng-template>\r
        </div>\r
      </div>\r
      <div class="col-12">\r
        <div class="form-group">\r
          <label>{{'IDENTITY.TITLE'|translate:languageService.userTranslate}}</label>\r
          <armon-select-search query="identity" [allowMulti]="false" [formControl]="form.get('userId')">\r
          </armon-select-search>\r
          <ng-template\r
            *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('userId')}">\r
          </ng-template>\r
        </div>\r
      </div>\r
      <div class="col-12">\r
        <div class="form-group">\r
          <label>{{'REPORT.DATE' | translate}}</label>\r
          <input placeholder="{{'PLACEHOLDER.DATE_SELECT' | translate}}" type="text"\r
            class="form-control form-control-sm bg-white" readonly owlinput [formControl]="form.get('actionUtc')"\r
            [owlDateTime]="dt1" [owlDateTimeTrigger]="dt1" [max]="nowDate">\r
          <owl-date-time [firstDayOfWeek]="1" #dt1 [showSecondsTimer]="true"></owl-date-time>\r
          <ng-template\r
            *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('actionUtc')}">\r
          </ng-template>\r
        </div>\r
      </div>\r
      <div class="col-12">\r
        <div class="form-group">\r
          <label>{{'REPORT.DIRECTION' | translate}}</label>\r
          <nz-select class="w-100" [formControl]="form.get('direction')" nzSize="small">\r
            <nz-option *ngFor="let option of directionTypes" [nzValue]="option.type" [nzLabel]="option.description |\r
            translate"></nz-option>\r
          </nz-select>\r
          <ng-template\r
            *ngTemplateOutlet="controlValidationTemplate; context: {$implicit: form, control:form.get('direction')}">\r
          </ng-template>\r
        </div>\r
      </div>\r
    </div>\r
  </form>\r
</div>\r
<div class="modal-footer">\r
  <button class="btn btn-outline-primary me-2" (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>\r
  <button class="btn btn-primary" (click)="onSaveClicked($event)" [disabled]="form.invalid">\r
    {{'BUTTON.SAVE' | translate}}\r
  </button>\r
</div>\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">{{'VALIDATION.POSITIVE_NUMBER'|translate}}</span>\r
      <span *ngIf="control.errors.max">{{'VALIDATION.MAX_VALUE'|translate:control.errors.max}}</span>\r
      <span *ngIf="control.errors.maxlength">{{'VALIDATION.MAX_LENGTH'|translate: {\r
        max:control.errors.maxlength.requiredLength} }}</span>\r
      <span *ngIf="control.errors.min">{{'VALIDATION.MIN_VALUE'|translate:control.errors.min}}</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 L=`.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 V=function(i,o,e,r){var n=arguments.length,t=n<3?o:r===null?r=Object.getOwnPropertyDescriptor(o,e):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")t=Reflect.decorate(i,o,e,r);else for(var c=i.length-1;c>=0;c--)(a=i[c])&&(t=(n<3?a(t):n>3?a(o,e,t):a(o,e))||t);return n>3&&t&&Object.defineProperty(o,e,t),t},P=class extends T{accessControlPointService;interactionService;sessionService;languageService;formBuilder;accessControlPoint;userId;actionUtc;form;nowDate=new Date;directionTypes=y;constructor(o,e,r,n,t){super(),this.accessControlPointService=o,this.interactionService=e,this.sessionService=r,this.languageService=n,this.formBuilder=t}onModalInitialized(){super.onModalInitialized(),this.createForm()}createForm(){this.form=this.formBuilder.group({accessControlPointId:[this.accessControlPoint?.id||null,[l.required]],actionUtc:[this.actionUtc||null,[l.required]],userId:[this.userId||null,[l.required]],direction:[E.All,[l.required]]})}onSaveClicked(o){let e=D.getEmptyModel();Object.assign(e,this.form.value),this.accessControlPointService.insertManualRecord(e).subscribe(r=>{this.interactionService.showMessage("ACCESSCONTROLPOINT.MANUAL_RECORD_INSERT_SUCCEED",null,u.Success,this.languageService.userTranslate),this.closeModal()})}static ctorParameters=()=>[{type:w},{type:S},{type:v},{type:b},{type:I}];static propDecorators={accessControlPoint:[{type:s}],userId:[{type:s}],actionUtc:[{type:s}]}};P=V([m({selector:"armon-access-control-point-manual-record",template:_,standalone:!0,providers:[{provide:h,useClass:A}],imports:[p,f,C,x,O,N,R,d,g],styles:[L]})],P);export{P as a};
