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,CAAC,KAAK,EAAE,YAAY,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;oBAC1H,CAAC,CAAC,CAAC;iBACH;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,EAjTc,OAAO,GAAP,YAAO,KAAP,YAAO,QAiTrB;AAAD,CAAC,EAjTS,IAAI,KAAJ,IAAI,QAiTb","sourcesContent":["/// \r\n\r\nnamespace Seac.Commons {\r\n\texport class NotificationManager {\r\n\t\tpublic notificationManagerButtonId\t\t\t\t\t: string;\r\n\t\tpublic notificationManagerTooltipContainerId\t\t: string;\r\n\t\tpublic notificationManagerTextContainerId\t\t\t: string;\r\n\t\tpublic topMenuContainerClass\t\t\t\t\t\t: string;\r\n\r\n\t\tprivate _notificationManagerButtonInstance\t\t\t: JQuery;\r\n\t\tprivate _notificationManagerTextContainerInstance\t: JQuery;\r\n\t\tprivate _notificationTooltipInstance\t\t\t\t: DevExpress.ui.dxTooltip;\r\n\t\t// Proprietà che indica se il tooltip è aperto o chiuso\r\n\t\tprivate _isOpen\t\t\t\t\t\t\t\t\t\t: boolean\t\t\t\t= false;\r\n\t\tprivate _closeTimeout\t\t\t\t\t\t\t\t: NodeJS.Timeout;\r\n\t\t// Delay che indica dopo quanto tempo il tooltip scompare automaticamente nel caso non sia stato attivato da un messaggio di errore\r\n\t\t// Nel caso in cui il tooltip venga attivato \"manualmente\" questo tempo non viene impostato, e il tooltip rimane aperto\r\n\t\tprivate _notificationDelay\t\t\t\t\t\t\t: number\t\t\t\t= 5000;\r\n\t\tprivate _notificationGuidList\t\t\t\t\t\t: Array\t\t\t= [];\r\n\t\tprivate _notifications\t\t\t\t\t\t\t\t: Array\t= [];\r\n\r\n\t\tpublic init(): void {\r\n\t\t\tthis._notificationManagerButtonInstance\t\t\t= $(`#${this.notificationManagerButtonId}`);\r\n\t\t\tthis._notificationManagerTextContainerInstance\t= $(`#${this.notificationManagerTextContainerId}`);\r\n\r\n\t\t\t// Alla pressione sull'icona delle notifiche, mostro o nascondo il tooltip\r\n\t\t\tthis._notificationManagerButtonInstance.on(Seac.Commons.Constants.clickEvent, (event: JQuery.ClickEvent) => {\r\n\t\t\t\tthis.toggle();\r\n\t\t\t});\r\n\t\t\t// Alla pressione sull'icona delle notifiche, mostro o nascondo il tooltip\r\n\t\t\tthis._notificationManagerTextContainerInstance.on(Seac.Commons.Constants.clickEvent, (event: JQuery.ClickEvent) => {\r\n\t\t\t\tthis.toggle();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Metodo che si occupa di istanziare il tooltip con le opzioni\r\n\t\t * @param delay Se impostato è il tempo dopo il quale la notifica scompare\r\n\t\t */\r\n\t\tprivate _createTooltip(delay: number, closeOnOutsideClick: boolean): void {\r\n\t\t\t$(`#${this.notificationManagerTooltipContainerId}`).dxTooltip({\r\n\t\t\t\ttarget: `#${this.notificationManagerButtonId}`,\r\n\t\t\t\tcloseOnOutsideClick: closeOnOutsideClick,\r\n\t\t\t\tonDisposing: () => {\r\n\t\t\t\t\tthis._notificationGuidList.forEach((guid: string) => {\r\n\t\t\t\t\t\t// Rimuovo il binding all'evento click delle varie notifiche\r\n\t\t\t\t\t\t$(document).undelegate(`.${guid}`, Seac.Commons.Constants.clickEvent);\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tonHidden: () => {\r\n\t\t\t\t\tthis._isOpen = false;\r\n\t\t\t\t},\r\n\t\t\t\tcontentTemplate: (data: DevExpress.core.dxElement) => {\r\n\t\t\t\t\tlet contentTemplate: string = '';\r\n\t\t\t\t\tthis._notifications.forEach((notification: Notification) => {\r\n\t\t\t\t\t\tlet backgroundColorClass: string;\r\n\t\t\t\t\t\tlet iconElement: string;\r\n\t\t\t\t\t\tswitch (notification.notificationType) {\r\n\t\t\t\t\t\t\tcase NotificationType.info:\r\n\t\t\t\t\t\t\t\tbackgroundColorClass = 'info';\r\n\t\t\t\t\t\t\t\ticonElement = '';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase NotificationType.success:\r\n\t\t\t\t\t\t\t\tbackgroundColorClass = 'success';\r\n\t\t\t\t\t\t\t\ticonElement = '';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase NotificationType.error:\r\n\t\t\t\t\t\t\t\tbackgroundColorClass = 'error';\r\n\t\t\t\t\t\t\t\ticonElement = '';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t\tcase NotificationType.warning:\r\n\t\t\t\t\t\t\t\tbackgroundColorClass = 'warning';\r\n\t\t\t\t\t\t\t\ticonElement = '';\r\n\t\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tconst notificationId: string = this.uuidv4();\r\n\t\t\t\t\t\tcontentTemplate +=\r\n`
` +\r\n\t`
` +\r\n\t\t`
${iconElement}
` +\r\n\t\t`
` +\r\n\t\t\t(notification.title ? `
${notification.title}
` : Seac.Commons.Constants.stringEmpty) +\r\n\t\t\t`
${notification.message}
` +\r\n\t\t`
` +\r\n\t`
`+\r\n`
`;\r\n\t\t\t\t\t\t// Se è definito un metodo per il click sulla notifica eseguo il binding\r\n\t\t\t\t\t\tif (notification.onClick) {\r\n\t\t\t\t\t\t\t$(document).delegate(`.${notificationId}`, Seac.Commons.Constants.clickEvent, (event: JQuery.ClickEvent) => {\r\n\t\t\t\t\t\t\t\tnotification.onClick();\r\n\t\t\t\t\t\t\t\tthis.close();\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\tdata.html(contentTemplate);\r\n\r\n\t\t\t\t\t// Aggiorno il titolo e l'icona nella barra blu in base al numero di notifiche per tipologia\r\n\t\t\t\t\tthis.updateNotificationCount();\r\n\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t\tthis._notificationTooltipInstance = $(`#${this.notificationManagerTooltipContainerId}`).dxTooltip(Seac.Commons.Constants.DevExpress.dxInstance);\r\n\r\n\t\t\t// Se impostato un delay, nascondo il tooltip dopo quell'intervallo\r\n\t\t\tif (delay > 0) {\r\n\t\t\t\t// Se c'è un timeout impostato in precedenza lo rimuovo\r\n\t\t\t\tif (this._closeTimeout) {\r\n\t\t\t\t\tclearTimeout(this._closeTimeout);\r\n\t\t\t\t}\r\n\t\t\t\t// Se le notifiche non contengono errori, imposto il timeout\r\n\t\t\t\tif (this._notifications.filter(notification => notification.notificationType === NotificationType.error).length === 0) {\r\n\t\t\t\t\tthis._closeTimeout = setTimeout(() => {\r\n\t\t\t\t\t\tthis.close();\r\n\t\t\t\t\t\tclearTimeout(this._closeTimeout);\r\n\t\t\t\t\t}, delay);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t/**\r\n\t\t * Metodo che si occupa di aggiornare il pulsante di visualizzazione delle notifiche\r\n\t\t * Imposta l'icona in base al tipo di messaggio prevalente e visualizza il contatore\r\n\t\t */\r\n\t\tprivate updateNotificationCount(): void {\r\n\t\t\tlet notificationTitle\t: string = '';\r\n\t\t\tlet notificationClass\t: string = '';\r\n\t\t\tconst errorCount\t\t: number = this._notifications.filter(n => n.notificationType === NotificationType.error).length;\r\n\t\t\tconst warningCount\t\t: number = this._notifications.filter(n => n.notificationType === NotificationType.warning).length;\r\n\t\t\tconst infoCount\t\t\t: number = this._notifications.filter(n => n.notificationType === NotificationType.info).length;\r\n\t\t\tconst successCount\t\t: number = this._notifications.filter(n => n.notificationType === NotificationType.success).length;\r\n\t\t\tif (errorCount) {\r\n\t\t\t\tnotificationTitle = `${errorCount} ${(errorCount === 1 ? Seac.Resources.Common.errore : Seac.Resources.Common.errori)}`;\r\n\t\t\t\tnotificationClass = 'fas fa-times-circle error';\r\n\t\t\t}else if (warningCount) {\r\n\t\t\t\tnotificationTitle = `${warningCount} ${(warningCount === 1 ? Seac.Resources.Common.segnalazione : Seac.Resources.Common.segnalazioni)}`;\r\n\t\t\t\tnotificationClass = 'fas fa-exclamation-triangle warning';\r\n\t\t\t}else if (infoCount) {\r\n\t\t\t\tnotificationTitle = `${infoCount} ${(infoCount === 1 ? Seac.Resources.Common.informazione : Seac.Resources.Common.informazioni)}`;\r\n\t\t\t\tnotificationClass = 'fas fa-info-circle info';\r\n\t\t\t}else if (successCount) {\r\n\t\t\t\tnotificationClass = 'fas fa-check-circle success';\r\n\t\t\t}\r\n\t\t\tthis._notificationManagerTextContainerInstance.text(notificationTitle);\r\n\t\t\tthis._notificationManagerButtonInstance.removeClass();\r\n\t\t\tthis._notificationManagerButtonInstance.addClass(notificationClass);\r\n\t\t}\r\n\r\n\t\t/** Genera un codice univoco */\r\n\t\tprivate uuidv4(): string {\r\n\t\t\treturn 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\r\n\t\t\t\tlet r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);\r\n\t\t\t\treturn v.toString(16);\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t/** Inverte lo stato di apertura del tooltip delle notifiche */\r\n\t\tpublic toggle(): void {\r\n\t\t\tif (this._isOpen) {\r\n\t\t\t\tthis.close();\r\n\t\t\t}else {\r\n\t\t\t\tthis.open();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/** Chiude il tooltip delle notifiche */\r\n\t\tpublic close(): void {\r\n\t\t\tthis._isOpen = false;\r\n\t\t\tif (this._notificationTooltipInstance) {\r\n\t\t\t\tthis._notificationTooltipInstance.hide();\r\n\t\t\t\t$(`#${this.notificationManagerTooltipContainerId}`).dxTooltip(Seac.Commons.Constants.DevExpress.dxDispose);\r\n\t\t\t\tthis._notificationTooltipInstance = null;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Apre il tooltip delle notifiche\r\n\t\t * @param delay Tempo in millisecondi dopo il quale il tooltip viene chiuso (tempo valido solo nel caso in cui nel tooltip non siano presenti notifiche di errore)\r\n\t\t * @param closeOnOutsideClick Indica se il tooltip deve essere chiuso nel caso in cui si prema al di fuori di esso\r\n\t\t */\r\n\t\tpublic open(delay: number = 0, closeOnOutsideClick: boolean = true): Promise {\r\n\t\t\tthis._isOpen = true;\r\n\t\t\tthis._createTooltip(delay, closeOnOutsideClick);\r\n\t\t\treturn this._notificationTooltipInstance.show();\r\n\t\t}\r\n\r\n\t\t/** Svuota le notifiche, rimuove il contatore e nasconde il tooltip */\r\n\t\tpublic clearNotifications(): void {\r\n\t\t\t// Nel caso in cui la visualizzzione sia da mobile app nascondo il menu contenente il pulsante delle notifiche\r\n\t\t\tthis.hideMenuBarOnMobile();\t\r\n\t\t\tthis._notifications = [];\r\n\t\t\tthis._notificationManagerButtonInstance.bootstrapHide();\r\n\t\t\tthis._notificationManagerTextContainerInstance.text(Seac.Commons.Constants.stringEmpty);\r\n\t\t\tthis.close();\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Aggiunge una notifica al tooltip\r\n\t\t * @param message Messaggio da visualizzare nella notifica\r\n\t\t * @param title Titolo da visualizzare nella notifica\r\n\t\t * @param onClick Metodo che devev venir eseguito al click sulla notifica\r\n\t\t * @param notificationType Tipo di notifica da visualizzare (varia il colore e l'icona della notifica)\r\n\t\t * @param clearExisting Indica se eleiminare le notifiche precedenti prima di aggiungere quella attuale\r\n\t\t */\r\n\t\tpublic addNotification(message: string, title: string, onClick: () => void, notificationType: NotificationType, clearExisting: boolean): void {\r\n\t\t\t// Nel caso in cui la visualizzzione sia da mobile app il menu contenente il pulsante delle notifiche è inizialmente nascosto quindi lo visualizzo\r\n\t\t\tthis.showMenuBarOnMobile();\r\n\r\n\t\t\tif (clearExisting) {\r\n\t\t\t\tthis._notifications = [];\r\n\t\t\t}\r\n\t\t\tthis._notifications.push({\r\n\t\t\t\ttitle\t\t\t\t: title,\r\n\t\t\t\tmessage\t\t\t\t: message,\r\n\t\t\t\tonClick\t\t\t\t: onClick,\r\n\t\t\t\tnotificationType\t: notificationType\r\n\t\t\t});\r\n\t\t\tthis.updateNotificationCount();\r\n\t\t\tlet delay: number = 0;\r\n\t\t\t// Se non si tratta di un errore aggiungo il tempo di delay\r\n\t\t\tif (notificationType !== NotificationType.error) {\r\n\t\t\t\tdelay = this._notificationDelay;\r\n\t\t\t}\r\n\r\n\t\t\tif (this._isOpen) {\r\n\t\t\t\t// Se il tooltip è già aperto, lo chiudo e poi lo riapro in modo che si aggiorni il contenuto\r\n\t\t\t\tthis.close();\r\n\t\t\t\tthis.open(delay);\r\n\t\t\t}else {\r\n\t\t\t\t// Altrimenti lo riapro direttamente\r\n\t\t\t\tthis.open(delay);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Aggiunge una notifica al tooltip\r\n\t\t * @param message Messaggio da visualizzare nella notifica\r\n\t\t * @param notificationType Tipo di notifica da visualizzare (varia il colore e l'icona della notifica)\r\n\t\t * @param clearExisting Indica se eleiminare le notifiche precedenti prima di aggiungere quella attuale\r\n\t\t */\r\n\t\tpublic addSimpleNotification(message: string, notificationType: NotificationType, clearExisting: boolean): void {\r\n\t\t\tthis.addNotification(message, null, null, notificationType, clearExisting);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Aggiunge una notifica al tooltip\r\n\t\t * @param message Messaggio da visualizzare nella notifica\r\n\t\t * @param title Titolo da visualizzare nella notifica\r\n\t\t * @param notificationType Tipo di notifica da visualizzare (varia il colore e l'icona della notifica)\r\n\t\t * @param clearExisting Indica se eleiminare le notifiche precedenti prima di aggiungere quella attuale\r\n\t\t */\r\n\t\tpublic addTitleNotification(message: string, title: string, notificationType: NotificationType, clearExisting: boolean): void {\r\n\t\t\tthis.addNotification(message, title, null, notificationType, clearExisting);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Rimuove una notifica in base al suo titolo\r\n\t\t * @param title Titolo della notifica da rimuovere\r\n\t\t */\r\n\t\tpublic removeNotificationByTitle(title: string): void {\r\n\t\t\tthis._notifications = this._notifications.filter(notification => notification.title != title);\r\n\t\t\tif (!this._notifications) {\r\n\t\t\t\tthis.hideMenuBarOnMobile();\r\n\t\t\t}\r\n\t\t\tthis.updateNotificationCount();\r\n\t\t\tif (this._isOpen) {\r\n\t\t\t\t// Se il tooltip è già aperto, lo chiudo e poi lo riapro in modo che si aggiorni il contenuto\r\n\t\t\t\tthis.close();\r\n\t\t\t\tthis.open();\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Nel caso la visualizzazione sia da mobile app la barra del menu contenente il pulsante delle notifiche è inizialmente nascosta tramite CSS\r\n\t\t * Con questo metodo viene forzata la visualizzazione\r\n\t\t */\r\n\t\tprivate showMenuBarOnMobile(): void {\r\n\t\t\t$(`.${this.topMenuContainerClass}`).css(Seac.Commons.Constants.displayAttribute, Seac.Commons.Constants.displayBlock);\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Nel caso la visualizzazione sia da mobile app la barra del menu contenente il pulsante delle notifiche è inizialmente nascosta tramite CSS\r\n\t\t * La visualizzazione avviene tramite il metodo `showMenuBarOnMobile`, questo metodo si occupa di nasconderla\r\n\t\t */\r\n\t\tprivate hideMenuBarOnMobile(): void {\r\n\t\t\tif ($(`.${this.topMenuContainerClass}`).css(Seac.Commons.Constants.displayAttribute)) {\r\n\t\t\t\t$(`.${this.topMenuContainerClass}`).css(Seac.Commons.Constants.displayAttribute, '');\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// @ts-ignore\r\n\texport let notificationManager: NotificationManager = new Seac.Commons.NotificationManager();\r\n\tjQuery(document).ready(function () {\r\n\t\tnotificationManager.init();\r\n\t\t/** Quando la pagina è stata caricata, controllo se il backend ha impostato delle notifiche da visualizzare e le visualizzo */\r\n\t\tlet notificationListJson: string | null = $('#notification-messages').val()?.toString();\r\n\r\n\t\tif (notificationListJson) {\r\n\t\t\tlet notification: Array = JSON.parse(notificationListJson);\r\n\t\t\tif (notification.length != 0) {\r\n\t\t\t\tnotification.forEach((notification: Notification) => {\r\n\t\t\t\t\tnotificationManager.addTitleNotification(notification.message, notification.title, notification.notificationType, false);\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n}\r\n"]}