import{a as R}from"./chunk-PQGNYTS4.js";import{a as E,b as D}from"./chunk-FSCI3FDB.js";import{a as j}from"./chunk-WFZJP5WR.js";import{M as u,Mb as J}from"./chunk-YSQLW2JA.js";import{ma as r}from"./chunk-NVJ2ZZFT.js";import{$c as f,Aa as l,Ba as v,Hb as S,Pd as k,Qf as N,Rd as _,Sd as C,Yg as O,_a as I,ab as w,af as T,bb as p,dd as d,fb as y,ha as h,wa as g,ya as m}from"./chunk-SKPDQO4E.js";var P=`<ng-container *ngIf="!selfView">
    <div class="card mb-3">
        <div class="card-body p-4">
            <div class="row">
                <div class="col-md-4 col-12">
                    <armon-captionlines *ngIf="notificationJobInstance.userBadge.caption"
                        [captionlines]="notificationJobInstance.userBadge.caption" [showBorder]="false">
                    </armon-captionlines>
                </div>
                <div class="col-md-4 col-12 d-flex flex-column">
                    <span class="text-lg">{{notificationJobInstance.createdTHourText}}</span>
                    <span class="text-sm text-italic">{{notificationJobInstance.createdTDateText}}</span>
                    <span *ngIf="notificationJobInstance.archived"
                        class="text-xs fw-medium text-danger">{{'COMMON.DELETED'|translate}}</span>
                </div>
                <div class="col-md-4 col-12 d-flex flex-column">
                    <span class="text-sm">{{notificationJobInstance.notificationType.title|translate}}</span>
                    <div class="d-flex mt-2">
                        <ng-container *ngFor="let instance of notificationJobInstance.instances">
                            <cds-icon [attr.shape]="instance.notificationMedium.icon" style="width: 20px; height: 20px;"
                                class="ms-2 text-primary opacity-50" nz-tooltip
                                nzTooltipTitle="{{instance.notificationMedium.title | translate}}"></cds-icon>
                        </ng-container>
                    </div>
                </div>
            </div>
            <div class="row mt-2 b-t-1 pt-3" *ngIf="notificationJobInstance.showDetail">
                <ng-container *ngFor="let instance of notificationJobInstance.instances">
                    <div class="col-12 col-lg-6 col-xl-4">
                        <div class="d-flex rounded-2 p-2 mb-2 border border-1 border-light-subtle">
                            <div class="d-flex flex-column align-items-center py-2 pe-2 b-r-1 me-3"
                                style="width: 64px;">
                                <cds-icon [attr.shape]="instance.notificationMedium.icon"
                                    class="cds-icon-20 text-primary"></cds-icon>
                                <span class="text-xs text-primary text-center mt-1">{{instance.notificationMedium.title
                                    |
                                    translate}}</span>
                            </div>
                            <div class="d-flex flex-column">
                                <armon-notificationjobs-content [instanceGroup]="instance" />
                            </div>
                        </div>
                    </div>
                </ng-container>
            </div>
        </div>
        <div class="card-footer">
            <button class="btn btn-sm btn-link me-2"
                (click)="notificationJobInstance.showDetail = !notificationJobInstance.showDetail;">{{(notificationJobInstance.showDetail?'BUTTON.HIDE_DETAIL':"BUTTON.SHOW_DETAIL")|translate}}</button>
        </div>
    </div>
</ng-container>

<ng-container *ngIf="selfView">
    <div class="card mb-3">
        <div class="card-body p-4">
            <div class="row">
                <div class="col-12 d-flex flex-column">
                    <ng-container *ngFor="let instance of notificationJobInstance.instances">
                        <ng-container *ngIf="instance.medium == 1">
                            <span class="text-md mb-3 text-primary">
                                <cds-icon shape="bell" class="me-1"
                                    [ngClass]="{'text-success': notificationJobInstance.isNew , 'color-gray': !notificationJobInstance.isNew}">
                                </cds-icon>
                                {{instance.content.title}}
                            </span>
                            <span class="text-sm mb-2">{{instance.content.body}}</span>
                            <ng-container *ngIf="notificationJobInstance.hasFiles">
                                <armon-pacs-attachment-list [uploadEnabled]="false"
                                    [attachmentList]="notificationJobInstance.files" class="mb-3" [feature]="2">
                                </armon-pacs-attachment-list>
                            </ng-container>
                            <span
                                class="text-xs text-italic color-gray">{{notificationJobInstance.notificationType.title|translate}},&nbsp;{{humanizedDate}}
                                - {{notificationJobInstance.createdTHourText}}
                                {{notificationJobInstance.createdTDateText}}</span>
                        </ng-container>
                    </ng-container>
                </div>
            </div>
        </div>
        <div class="card-footer"
            *ngIf="notificationJobInstance.hasDetail || notificationJobInstance.hasDownload || notificationJobInstance.isNew">
            <div class="d-flex justify-content-end">
                <button class="btn btn-link btn-sm me-2" (click)="detailClicked($event)"
                    *ngIf="notificationJobInstance.hasDetail">{{'BUTTON.DETAIL'|translate}}</button>
                <button class="btn btn-link btn-sm me-2" (click)="downloadClicked($event)"
                    *ngIf="notificationJobInstance.hasDownload">
                    <cds-icon shape="download-cloud" class="me-1"></cds-icon>{{'BUTTON.DOWNLOAD'|translate}}
                </button>
                <button class="btn btn-link btn-sm" (click)="readClicked($event)"
                    *ngIf="notificationJobInstance.isNew">{{'NOTIFICATIONS.BUTTON_SET_AS_READ'|translate}}</button>
            </div>
        </div>
    </div>
</ng-container>`;var M=`.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=`<div class="d-flex flex-column w-100">
    <div class="d-flex flex-column mb-2 column-gap-2">
        <span *ngIf="instanceGroup.notificationState" class="text-sm text-italic">
            <cds-icon [attr.shape]="instanceGroup.notificationState.icon" solid class="me-1"
                [ngStyle]="{'color': instanceGroup.notificationState.color}" size="sm">
            </cds-icon>
            {{instanceGroup.notificationState.title|translate}}
            <ng-container *ngIf="instanceGroup.createdTDateText">({{instanceGroup.createdTDateText}})</ng-container>
        </span>
        <span *ngIf="instanceGroup.showMessage" class="text-sm text-danger">{{instanceGroup.message}}</span>
    </div>
    <!-- Web or Push Notification -->
    <ng-container *ngIf="instanceGroup.notificationMedium.medium == 1 || instanceGroup.notificationMedium.medium == 4">
        <span class="text-sm fw-medium mb-1">{{instanceGroup.content.title}}</span>
        <span class="text-sm">{{instanceGroup.content.body}}</span>
    </ng-container>
    <!-- Email Notification -->
    <ng-container *ngIf="instanceGroup.notificationMedium.medium == 2">
        <span class="text-sm fw-medium mb-1">{{instanceGroup.content.to}}</span>
        <span class="text-sm mb-1">{{instanceGroup.content.subject}}</span>
        <span>
            <button class="btn btn-sm btn-outline-primary my-2"
                (click)="onEmailContentClicked($event, instanceGroup.content)">
                <cds-icon shape="search" size="sm" class="me-2"></cds-icon>
                {{'NOTIFICATIONJOBS.HISTORY_EMAIL_CONTENT'|translate}}
            </button>
        </span>
    </ng-container>
    <!-- SMS Notification -->
    <ng-container *ngIf="instanceGroup.notificationMedium.medium == 3">
        <span class="text-sm fw-medium mb-1">{{instanceGroup.content.phoneNumber}}</span>
        <span class="text-sm mb-1">{{instanceGroup.content.text}}</span>
    </ng-container>
</div>`;var G=`.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 A=`<div class="modal-header">
  <span class="text-lg">{{title | translate}}</span>
</div>
<div class="modal-body">
  <iframe style="height: 640px; width: 100%;" #iframe frameBorder="0"></iframe>
</div>
<div class="modal-footer">
  <button class="btn btn-outline-primary" (click)="onCancelClicked($event)">
    {{'BUTTON.CLOSE' | translate}}
  </button>
</div>`;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 $=function(a,t,e,i){var o=arguments.length,n=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,t,e,i);else for(var c=a.length-1;c>=0;c--)(s=a[c])&&(n=(o<3?s(n):o>3?s(t,e,n):s(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},b=class extends C{interactionService;sessionService;content;title;visibleComponent=!1;iframe;constructor(t,e){super(),this.interactionService=t,this.sessionService=e}onModalInitialized(){super.onModalInitialized(),setTimeout(()=>{this.iframe&&this.iframe.nativeElement.contentWindow.document.write(this.content)},300)}static ctorParameters=()=>[{type:N},{type:k}];static propDecorators={content:[{type:l}],title:[{type:l}],iframe:[{type:g,args:["iframe",{static:!1}]}]}};b=$([m({selector:"armon-html-content-modal",template:A,standalone:!0,imports:[d],styles:[L]})],b);var Y=function(a,t,e,i){var o=arguments.length,n=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,t,e,i);else for(var c=a.length-1;c>=0;c--)(s=a[c])&&(n=(o<3?s(n):o>3?s(t,e,n):s(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},x=class{modalService;instanceGroup;constructor(t){this.modalService=t}ngOnInit(){}ngOnDestroy(){}onEmailContentClicked(t,e){this.modalService.open(b,{settings:{size:"xl",scrollable:!0},props:{title:"NOTIFICATIONJOBS.HISTORY_EMAIL_CONTENT",content:e.html}}).result.then(i=>{}).catch(i=>{})}static ctorParameters=()=>[{type:_}];static propDecorators={instanceGroup:[{type:l}]}};x=Y([m({selector:"armon-notificationjobs-content",template:z,standalone:!0,imports:[p,y,d],styles:[G]})],x);var K=function(a,t,e,i){var o=arguments.length,n=o<3?t:i===null?i=Object.getOwnPropertyDescriptor(t,e):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(a,t,e,i);else for(var c=a.length-1;c>=0;c--)(s=a[c])&&(n=(o<3?s(n):o>3?s(t,e,n):s(t,e))||n);return o>3&&n&&Object.defineProperty(t,e,n),n},U=class{router;languageService;userService;notificationService;routingService;notificationJobInstance;selfView=!0;routingStarted=new h;humanizedDate;constructor(t,e,i,o,n){this.router=t,this.languageService=e,this.userService=i,this.notificationService=o,this.routingService=n}ngOnInit(){this.languageService.getHumanizeDate(this.notificationJobInstance.createdT).then(t=>this.humanizedDate=t)}ngOnDestroy(){}markAsRead(t=!1){let e=this.notificationJobInstance.instances.find(i=>i.medium==u.Web);this.notificationService.markAsReadNotification(e.notificationInstanceId).subscribe(i=>{t?this.routingStarted.emit():this.notificationJobInstance.isNew=!1})}readClicked(t){this.markAsRead()}emitRoutingStarted(){this.markAsRead(!0)}detailClicked(t){if(this.notificationJobInstance.hasDetail){let e=this.notificationJobInstance.instances.find(i=>i.medium==u.Web).content;switch(this.notificationJobInstance.type){case r.PPermissionWaitForSignature:this.router.navigate([f.PACS_USER_PPERMISSIONS.fullPath],{queryParams:{id:e.data.p,t:new Date().getTime()}}),this.emitRoutingStarted();break;case r.PPermissionApprovementToOwner:this.router.navigate([f.PACS_USER_PPERMISSIONS.fullPath],{queryParams:{id:e.data.p,t:new Date().getTime()}}),this.emitRoutingStarted();break;case r.PPermissionWaitForApprovement:case r.PPermissionApprovementStatesCompleted:this.router.navigate([f.PACS_PPERMISSIONS_MANAGEMENT.fullPath],{queryParams:{id:e.data.p,ih:e.data.h,t:new Date().getTime()}}),this.emitRoutingStarted();break;case r.NewFeedback:case r.FeedbackUpdate:this.router.navigate([f.FEEDBACKS.fullPath],{queryParams:{id:e.data.f,t:new Date().getTime()}}),this.emitRoutingStarted();break}}}downloadClicked(t){if(this.notificationJobInstance.hasDownload){let e=this.notificationJobInstance.instances.find(i=>i.medium==u.Web).content;switch(this.notificationJobInstance.type){case r.HugeReport:case r.ScheduledReport:e.data.i&&this.userService.downloadRequestedReport(e.data.i);break}}}static ctorParameters=()=>[{type:S},{type:T},{type:R},{type:E},{type:J}];static propDecorators={notificationJobInstance:[{type:l}],selfView:[{type:l}],routingStarted:[{type:v}]}};U=K([m({selector:"armon-notificationjobs-instance",template:P,standalone:!0,imports:[p,j,w,O,x,I,D,d],styles:[M]})],U);export{U as a};
