import{Hb as J,N as p,P as T,X as g}from"./chunk-YSQLW2JA.js";import{Aa as n,Nc as l,Qf as x,Sd as u,ab as m,af as S,bb as b,cb as v,db as y,dd as h,wa as d,ya as f}from"./chunk-SKPDQO4E.js";var w=`<ng-container *ngIf="visible">
    <div class="modal-header align-items-center">
        <div class="d-flex me-2 align-items-center">
            <cds-icon shape="bell" size="lg" class="text-primary opacity-25"></cds-icon>
        </div>
        <div class="d-flex flex-column flex-grow-1">
            <span class="text-lg">{{(isEditMode?'NOTIFICATIONJOBS.EDIT':'NOTIFICATIONJOBS.ADD') | translate}}</span>
            <span class="text-sm fw-medium" *ngIf="notificationJobType">{{notificationJobType.title|translate}}</span>
        </div>
    </div>
    <div class="modal-body">
        <ng-container [ngSwitch]="viewState">
            <ng-container *ngSwitchCase="'typeSelectionView'">
                <div class="row">
                    <div class="col-12 mb-3">
                        <span
                            class="text-sm fw-medium">{{(typeSelectionText?typeSelectionText:'NOTIFICATIONJOBS.TYPE_SELECTION_DIRECTION')|translate}}</span>
                    </div>
                </div>
                <ng-container *ngFor="let notificationType of availableTypes">
                    <div class="row">
                        <div class="col-12 d-flex flex-column">
                            <div (click)="onNotificationTypeSelected($event, notificationType)"
                                class="border border-1 rnd-1 hover-secondary cursor-pointer hover-border-secondary py-2 px-3 mb-3">
                                <span class="text-md">{{notificationType.title|translate}}</span>
                            </div>
                        </div>
                    </div>
                </ng-container>
            </ng-container>
            <ng-container *ngSwitchCase="'formView'">
                <armon-notificationjobs-upsert #notificationJobsUpsertComponent [notification]="notificationJob"
                    [notificationJobType]="notificationJobType" [(valid)]="valid"></armon-notificationjobs-upsert>
            </ng-container>
        </ng-container>
    </div>
    <div class="modal-footer">
        <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">{{'BUTTON.CLOSE' |
            translate}}</button>
        <button class="btn btn-primary" (click)="onSaveClicked($event)" [disabled]="!valid">{{'BUTTON.SAVE' |
            translate}}</button>
    </div>
</ng-container>`;var C=`.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 E=function(a,e,t,i){var s=arguments.length,o=s<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(a,e,t,i);else for(var r=a.length-1;r>=0;r--)(c=a[r])&&(o=(s<3?c(o):s>3?c(e,t,o):c(e,t))||o);return s>3&&o&&Object.defineProperty(e,t,o),o},N=class extends u{languageService;interactionService;notificationJobService;notificationJob;availableTypes;typeSelectionText;typeSelectedFunction;notificationJobsUpsertComponent;visible=!1;valid=!1;notificationJobType;isEditMode;viewState;constructor(e,t,i){super(),this.languageService=e,this.interactionService=t,this.notificationJobService=i}ngOnInit(){this.notificationJob?(this.notificationJobType=p.find(e=>e.type==this.notificationJob.type),this.isEditMode=this.notificationJob.id&&this.notificationJob.id!="",this.viewState="formView"):(this.isEditMode=!1,(!this.availableTypes||this.availableTypes.length==0)&&(this.availableTypes=p.filter(e=>e.addable==!0)),this.viewState="typeSelectionView"),this.visible=!0}onNotificationTypeSelected(e,t){let i=T.getEmptyModel(t.type);this.typeSelectedFunction&&this.typeSelectedFunction.apply(this,[i]),this.notificationJobType=t,this.notificationJob=i,this.viewState="formView"}onSaveClicked(e){let t=this.notificationJobsUpsertComponent.formValue;this.isEditMode?this.notificationJobService.updateNotificationJob(this.notificationJob.id,t).subscribe(i=>{this.interactionService.showMessage("NOTIFICATIONJOBS.UPDATE_COMPLETED",null,l.Success),this.closeModal(t)}):this.notificationJobService.addNotificationJob(t).subscribe(i=>{this.interactionService.showMessage("NOTIFICATIONJOBS.ADD_COMPLETED",null,l.Success),this.closeModal(t)})}static ctorParameters=()=>[{type:S},{type:x},{type:g}];static propDecorators={notificationJob:[{type:n}],availableTypes:[{type:n}],typeSelectionText:[{type:n}],typeSelectedFunction:[{type:n}],notificationJobsUpsertComponent:[{type:d,args:["notificationJobsUpsertComponent"]}]}};N=E([f({selector:"armon-notificationjobs-upsert-modal",template:w,standalone:!0,imports:[b,v,y,m,J,h],styles:[C]})],N);export{N as a};
