var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Themes; (function (Themes) { let Compact; (function (Compact) { let Components; (function (Components) { class NotificationWidget extends Unibase.Platform.Core.BaseComponent { load(id, containerid, callback) { var instance = this; } jsFiles() { return ['tenants/themes/compact/components/notifications/userdesignnotificationwidget.js']; } cssFiles() { return []; } html(id, containerid) { var instance = this; let html = ``; return html; } init(containerid) { return __awaiter(this, void 0, void 0, function* () { let instance = this; yield instance.loadnotificationDetails(containerid); yield instance.loadReminders(null, containerid); }); } loadnotificationDetails(containerid) { let instance = this; let html = `
Notifications
`; $('#' + containerid).html(html); if (screen.width > 1120) { $('#' + containerid).find(".userDesignWidgetCardBody").css("height", "308px"); } } loadReminders(tabview, count) { return __awaiter(this, void 0, void 0, function* () { let remindertype = Unibase.Platform.Communications.Enums.ReminderType.Notification; return yield Unibase.Platform.Communications.Managers.ReminderManager.Instance().getReminders(remindertype, 10).then(function (response) { let html = ""; if (response.length != '' || response.length != 0) { for (let i = 0; i < response.length; i++) { let createformid = 0, installedappid = 0, refid = 0; if (response[i].RedirectOptions == null || response[i].RedirectOptions == undefined) { installedappid = response[i].InstalledAppId; refid = response[i].RefId; } else { createformid = response[i].RedirectOptions.CreateFormId; installedappid = response[i].RedirectOptions.InstalledAppId; refid = response[i].RedirectOptions.RefId; } let ReminderUrl = response[i].ReminderUrl; let IconUrl = response[i].IconUrl; if (IconUrl == undefined || IconUrl == null) { IconUrl = "tenants/themes/compact/imgs/defaultnotification.png"; } if (IconUrl == "") { IconUrl = "tenants/themes/compact/imgs/notification.png"; } let ReminderId = response[i].ReminderId; if (ReminderUrl == "") { ReminderUrl = null; } html = `
${response[i].Subject}
${response[i].Message} - ${Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocal(response[i].ReminderDate)}
`; $(".UserdesignNotifiactionDetails").append(html); } } else { let emptyhtml = `

You don't have any Notifications yet.

Will notify you when Something arrives'

`; $(".UserdesignNotifiactionDetails").html(emptyhtml); } $(".notification_click").click(function () { $(this).parents(".notification_card").remove(); if ($(".UserdesignNotifiactionDetails").html().length == 0) { let emptyhtml = `

You don't have any Notifications yet.

Will notify you when Something arrives'

`; $(".UserdesignNotifiactionDetails").html(emptyhtml); } }); }); }); } static Instance() { if (this.instance === undefined) this.instance = new NotificationWidget(); return this.instance; } } Components.NotificationWidget = NotificationWidget; })(Components = Compact.Components || (Compact.Components = {})); })(Compact = Themes.Compact || (Themes.Compact = {})); })(Themes = Unibase.Themes || (Unibase.Themes = {})); })(Unibase || (Unibase = {}));