import{Ob as L}from"./chunk-YSQLW2JA.js";import{sd as N}from"./chunk-NVJ2ZZFT.js";import{Aa as l,E as b,Nc as F,Pd as j,Qc as f,Qf as y,Rc as d,Sc as U,Sd as z,Te as B,Uc as u,Wc as k,Xc as A,_a as w,ab as T,ad as R,bb as p,dc as I,dd as m,ea as D,fb as h,hd as O,mg as P,rb as _,wa as M,ya as c}from"./chunk-SKPDQO4E.js";var x=class extends A{http;sessionService;configurationService;interactionService;constructor(e,t,i,a){super(e,t,i,a),this.http=e,this.sessionService=t,this.configurationService=i,this.interactionService=a}insertFeedback(e){return this.requestPost(`/${this.sessionService.currentOrganizationId}/system/feedback/insert`,e,null,u.User,k.User)}updateFeedback(e,t){return this.requestPost(`/${this.sessionService.currentOrganizationId}/system/feedback/${e}/update`,t,null,u.User,k.User)}listFeedbacks(e,t){let i=t?"list/self":"list";return this.requestPost(`/${this.sessionService.currentOrganizationId}/system/feedback/${i}`,e,"FeedbackListResponse",u.User,k.User)}listFeedbacksAsExcel(e,t){let i=t?"excel/self":"excel";return this.requestPostFileResponse(`/${this.sessionService.currentOrganizationId}/system/feedback/${i}`,e,u.User)}};var H=function(n,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var r=n.length-1;r>=0;r--)(s=n[r])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o},v=class extends U{http;configurationService;interactionService;sessionService;apiFeedback;constructor(e,t,i,a){super(i,a),this.http=e,this.configurationService=t,this.interactionService=i,this.sessionService=a,this.apiFeedback=new x(this.http,this.sessionService,this.configurationService,this.interactionService)}insertFeedback(e){return this.apiFeedback.insertFeedback(e).pipe(b(t=>this.handleError(t,[])))}updateFeedback(e,t){return this.apiFeedback.updateFeedback(e,t).pipe(b(i=>this.handleError(i,[])))}listFeedbacks(e,t=!0){return this.apiFeedback.listFeedbacks(e,t).pipe(b(i=>this.handleError(i,[])))}listFeedbacksAsExcel(e,t=!0){return this.apiFeedback.listFeedbacksAsExcel(e,t).pipe(b(i=>this.handleError(i,[])))}static ctorParameters=()=>[{type:_},{type:R},{type:y},{type:j}]};v=H([D({providedIn:"root"})],v);var g=[{type:d.New,description:"FEEDBACK.STATUS_NEW",icon:"clock",color:"#A4A4A6"},{type:d.Inspecting,description:"FEEDBACK.STATUS_INSPECTING",icon:"clock",color:"#59518C"},{type:d.Read,description:"FEEDBACK.STATUS_READ",icon:"clock",color:"#A68B03"},{type:d.Resolved,description:"FEEDBACK.STATUS_RESOLVED",icon:"clock",color:"#037353"},{type:d.Rejected,description:"FEEDBACK.STATUS_REJECTED",icon:"clock",color:"#D9415D"},{type:d.Ignored,description:"FEEDBACK.STATUS_IGNORED",icon:"clock",color:"#D96B43"}];var E=[{type:f.BlockingError,description:"FEEDBACK.TYPE_BLOCKING_ERROR",icon:"warning-standard",color:"#F21313"},{type:f.MajorError,description:"FEEDBACK.TYPE_MAJOR_ERROR",icon:"warning-standard",color:"#F23030"},{type:f.MinorError,description:"FEEDBACK.TYPE_MINOR_ERROR",icon:"error-standard",color:"#F28888"},{type:f.Suggestion,description:"FEEDBACK.TYPE_SUGGESTION",icon:"thumbs-up",color:"#297343"},{type:f.Feedback,description:"FEEDBACK.TYPE_FEEDBACK",icon:"chat-bubble",color:"#448AA6"}];var K=`<div *ngIf="typeDefinition" class="status-container"
    [ngStyle]="{'border-color': typeDefinition.color, 'color': typeDefinition.color}">
    <cds-icon [attr.shape]="typeDefinition.icon" style="width: 12px; height: 12px;"
        [attr.solid]="typeDefinition.type==1"></cds-icon>
    <span class="text-bold" [ngStyle]="{'color': typeDefinition.color}">{{typeDefinition.description|translate}}</span>
</div>`;var $=`.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}.status-container{display:initial;padding:.1rem .4rem;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;font-size:.672rem;border-style:solid;border-width:1px;background-color:#fff}.status-container cds-icon{margin-right:3px}
`;var X=function(n,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var r=n.length-1;r>=0;r--)(s=n[r])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o},S=class{type;typeDefinition;constructor(){}ngOnInit(){this.setTypeDefiniton()}ngOnDestroy(){}ngOnChanges(e){e.type&&this.setTypeDefiniton()}setTypeDefiniton(){this.typeDefinition=E.find(e=>e.type==this.type)}static ctorParameters=()=>[];static propDecorators={type:[{type:l}]}};S=X([c({selector:"armon-feedback-type",template:K,standalone:!0,imports:[p,h,m],styles:[$]})],S);var G=`<div *ngIf="typeDefinition" class="status-container" [ngStyle]="{'background': typeDefinition.color, 'border-color': typeDefinition.color}">
    <span class="text-bold">{{typeDefinition.description|translate}}</span>
</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}.status-container{display:initial;padding:.1rem .4rem;-webkit-border-radius:.375rem;-moz-border-radius:.375rem;border-radius:.375rem;font-size:.672rem;border-style:solid;border-width:1px;color:#fff}
`;var te=function(n,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var r=n.length-1;r>=0;r--)(s=n[r])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o},C=class{status;typeDefinition;constructor(){}ngOnInit(){this.setTypeDefinition()}ngOnDestroy(){}ngOnChanges(e){e.status&&this.setTypeDefinition()}setTypeDefinition(){this.typeDefinition=g.find(e=>e.type==this.status)}static ctorParameters=()=>[];static propDecorators={status:[{type:l}]}};C=te([c({selector:"armon-feedback-status",template:G,standalone:!0,imports:[p,h,m],styles:[q]})],C);var Y=`<ng-container *ngIf="visibleComponent">
  <div class="modal-header">
    <span
      class="text-lg">{{(editMode ? feedbackModal.feedbackDetailed.title : 'FEEDBACK.SEND_LABEL' ) | translate}}</span>
  </div>
  <div class="modal-body">
    <div class="row" *ngIf="feedbackUpdate">
      <div class="col-12">
        <armon-feedback-status [status]="feedbackUpdate.status"></armon-feedback-status>
        <armon-feedback-type [type]="feedbackUpdate.type" class="ms-2"></armon-feedback-type>
      </div>
    </div>
    <div class="row mt-3" *ngIf="visibleUpdateControls" [ngClass]="{'b-b-1 pb-3': editMode}">
      <div class="col-12" *ngIf="editMode">
        <div class="form-group">
          <label for="statusInput" class="required">{{'FEEDBACK.STATUS' | translate}}</label>
          <select [(ngModel)]="feedbackUpdate.status" id="statusInput" (ngModelChange)="onUpdateModelChanged($event)"
            class="form-select form-select-sm">
            <option *ngFor="let feedbackStatus of feedbackStatusList" [ngValue]="feedbackStatus.type">{{feedbackStatus.description
                      | translate}}</option>
          </select>
        </div>
      </div>
      <div class="col-12" *ngIf="feedbackModal && !feedbackModal.disableTypeSelection">
        <div class="form-group">
          <label for="typeInput" class="required">{{'FEEDBACK.TYPE' | translate}}</label>
          <select [(ngModel)]="feedbackUpdate.type" id="typeInput" (ngModelChange)="onUpdateModelChanged($event)"
            class="form-select form-select-sm">
            <option *ngFor="let feedbackType of feedbackTypeList" [ngValue]="feedbackType.type">{{feedbackType.description
                      | translate}}</option>
          </select>
        </div>
      </div>
      <div class="col-12" *ngIf="editMode">
        <div class="form-group">
          <label for="noteTextArea" class="required">{{'FEEDBACK.NOTE' | translate}}</label>
          <textarea name="note" id="noteTextArea" [(ngModel)]="feedbackUpdate.note" rows="4" cols="20" maxlength="512"
            class="form-control form-control-sm" (ngModelChange)="onUpdateModelChanged($event)"
            style="resize:none"></textarea>
        </div>
      </div>
    </div>
    <div class="row" [ngClass]="{'mt-3': editMode}">
      <div class="col-12" *ngIf="!editMode">
        <div class="form-group">
          <label for="titleInput" [ngClass]="{'required': !editMode}">{{'FEEDBACK.TITLE' | translate}}</label>
          <input type="text" id="titleInput" [(ngModel)]="feedbackModal.feedbackDetailed.title" maxlength="128"
            class="form-control form-control-sm" (ngModelChange)="onModelChanged($event)">
          <!-- <span *ngIf="editMode" class="custom-item">{{feedbackModal.feedbackDetailed.title}}</span> -->
        </div>
      </div>
      <div class="col-12">
        <div class="form-group">
          <label for="bodyTextArea" [ngClass]="{'required': !editMode}">{{'FEEDBACK.DESCRIPTION' | translate}}</label>
          <textarea name="body" id="bodyTextArea" [(ngModel)]="feedbackModal.feedbackDetailed.body" rows="4" cols="20"
            class="form-control form-control-sm" maxlength="512" (ngModelChange)="onModelChanged($event)"
            style="resize:none" *ngIf="!editMode"></textarea>
          <div *ngIf="editMode" class="text-sm">{{feedbackModal.feedbackDetailed.body}}</div>
        </div>
      </div>
      <div class="col-12" *ngIf="feedbackModal.feedbackDetailed.screenshot">
        <div class="form-group">
          <label>{{'FEEDBACK.SCREENSHOT' | translate}}</label>
          <div class="w-100" style="flex:0;" (click)="onImageClicked($event)">
            <div class="feedback-screenshot-container d-flex justify-content-center">
              <img class="feedback-screenshot" [src]="feedbackModal.feedbackDetailed.screenshot">
              <cds-icon shape="zoom-in" size="lg" class="zoom-icon"></cds-icon>
            </div>
          </div>
        </div>
      </div>
      <div class="col-12" *ngIf="!this.editMode && !feedbackModal.feedbackDetailed.screenshot">
        <div class="form-group">
          <label>{{'FEEDBACK.SCREENSHOT' | translate}}</label>
          <div class="w-100" style="flex:0;">
            <input #imageFileInput type="file" style="display:none" (change)="imageFileChangeEvent($event)"
              accept="image/*" />
            <button class="btn btn-primary btn-sm" (click)="uploadImageFileClicked($event)">
              <cds-icon shape="image" class="me-2"></cds-icon>{{'BUTTON.UPLOAD_IMAGE'|translate}}
            </button>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div class="modal-footer">
    <button class="btn btn-outline-primary me-2"
      (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' | translate}}</button>
    <button class="btn btn-primary" *ngIf="!editMode" (click)="onSaveClicked($event)" [disabled]="disableSaveButton">{{'BUTTON.SEND'
      | translate}}
    </button>
    <button class="btn btn-primary" *ngIf="editMode && visibleUpdateControls" (click)="onUpdateClicked($event)"
      [disabled]="disableUpdateButton">{{'BUTTON.UPDATE'
        | translate}}
    </button>
  </div>
</ng-container>`;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}:host .form-layout{width:100%!important;display:-webkit-box;display:-moz-box;display:-webkit-flexbox;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-webkit-flex-direction:row;-moz-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:start;-moz-box-pack:start;-webkit-flex-pack:start;-ms-flex-pack:start;-moz-justify-content:flex-start;-webkit-justify-content:flex-start;justify-content:flex-start;-webkit-flex-wrap:wrap;-moz-flex-wrap:wrap;flex-wrap:wrap;padding-top:6px;padding-bottom:6px}:host .form-layout>label:not(.custom-item){width:auto;margin-right:12px;min-width:130px}@media screen and (max-width: 576px){:host .form-layout>label:not(.custom-item){width:100%;margin-right:0;margin-bottom:0}}:host .form-layout>label[unit]{margin-left:3px}@media screen and (max-width: 576px){:host .form-layout>label[unit]{flex:0}}:host .form-layout input{flex:1}:host .form-layout .select{flex:1}:host .form-layout textarea{flex:1;margin-right:0}:host .form-layout .form-item{flex:1}:host .form-layout .checkbox{flex:1}:host .form-layout .custom-item{flex:1}:host .form-layout .radio-inline-container{position:relative}:host .form-layout .form-button{margin:0 0 0 12px}:host .form-layout .required:after{content:"*";font-size:1.1em;color:#c92100;margin-left:6px}:host .feedback-screenshot-container{position:relative;cursor:pointer}:host .feedback-screenshot-container .feedback-screenshot{height:160px;border:1px solid #0a2a5a}:host .feedback-screenshot-container .zoom-icon{position:absolute;margin:auto;inset:0}
`;var ae=function(n,e,t,i){var a=arguments.length,o=a<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(n,e,t,i);else for(var r=n.length-1;r>=0;r--)(s=n[r])&&(o=(a<3?s(o):a>3?s(e,t,o):s(e,t))||o);return a>3&&o&&Object.defineProperty(e,t,o),o},V=class extends z{feedbackService;authService;interactionService;feedbackModal;editMode;feedbackUpdate;feedbackStatusList=g;feedbackTypeList=E;permissionWriteFeedback;disableSaveButton=!0;disableUpdateButton=!0;visibleUpdateControls=!1;visibleComponent=!1;imageFileInput;constructor(e,t,i){super(),this.feedbackService=e,this.authService=t,this.interactionService=i}onModalInitialized(){super.onModalInitialized(),this.permissionWriteFeedback=this.authService.checkPermission(O.SYSTEM.getFeedbackWrite()),this.feedbackModal!==void 0&&this.feedbackModal!==null&&(this.feedbackModal=I(this.feedbackModal),this.feedbackUpdate=N.getEmptyModel(this.feedbackModal.feedbackDetailed.status,this.feedbackModal.feedbackDetailed.type),this.visibleUpdateControls=this.permissionWriteFeedback,this.feedbackModal.feedbackDetailed.id&&this.feedbackModal.feedbackDetailed.id!=""?(this.editMode=!0,this.validateUpdateForm()):(this.editMode=!1,this.validateSaveForm())),this.visibleComponent=!0}saveFeedback(){this.feedbackModal.feedbackDetailed.type=this.feedbackUpdate.type,this.feedbackModal.feedbackDetailed.status=this.feedbackUpdate.status,this.feedbackService.insertFeedback(this.feedbackModal.feedbackDetailed).subscribe(e=>{this.interactionService.showMessage("FEEDBACK.COMPLETED_UPSERT",null,F.Success),this.closeModal()})}updateFeedback(){this.feedbackService.updateFeedback(this.feedbackModal.feedbackDetailed.id,this.feedbackUpdate).subscribe(e=>{this.interactionService.showMessage("FEEDBACK.COMPLETED_UPDATE",null,F.Success),this.closeModal()})}validateSaveForm(){let e=!1;(!this.feedbackModal.feedbackDetailed.title||this.feedbackModal.feedbackDetailed.title=="")&&(e=!0),(!this.feedbackModal.feedbackDetailed.body||this.feedbackModal.feedbackDetailed.body=="")&&(e=!0),this.disableSaveButton=e}validateUpdateForm(){let e=!1;this.feedbackUpdate.status||(e=!0),this.feedbackUpdate.type||(e=!0),(this.editMode&&!this.feedbackUpdate.note||this.feedbackUpdate.note=="")&&(e=!0),this.disableUpdateButton=e}onModelChanged(e){this.validateSaveForm()}onUpdateModelChanged(e){this.validateUpdateForm()}onSaveClicked(e){this.disableSaveButton||this.saveFeedback()}onUpdateClicked(e){this.disableUpdateButton||this.updateFeedback()}onImageClicked(e){this.interactionService.showFullScreenImage({src:this.feedbackModal.feedbackDetailed.screenshot})}uploadImageFileClicked(e){this.imageFileInput.nativeElement.click()}imageFileChangeEvent(e){if(e.target.files&&e.target.files[0]){var t=new FileReader;t.onload=i=>{this.feedbackModal.feedbackDetailed.screenshot=i.target.result},t.readAsDataURL(e.target.files[0])}}static ctorParameters=()=>[{type:v},{type:L},{type:y}];static propDecorators={feedbackModal:[{type:l}],imageFileInput:[{type:M,args:["imageFileInput"]}]}};V=ae([c({selector:"armon-feedback-upsert",template:Y,standalone:!0,imports:[p,C,S,w,B,P,T,m],styles:[W]})],V);export{v as a,g as b,E as c,S as d,C as e,V as f};
