123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- 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 = `<div class="card mb-0 border-0 BindData_` + containerid + ` findcontainer h-100" style="background:0 0">
- <div class="card-header py-2 px-2 border-bottom search-bar-main-wrapper viewer-header position-sticky t-0 bg-white z-index-2" id="ViewerHeader_` + containerid + `">
- <div class="card-header-top line-loader-container p-relative">
- <div class=line-loader></div>
- <div id=div_ErrorMessage class=form-error-message style=margin-left:-5px;z-index:100></div>
- <div class="d-flex align-items-center biz-highlight-bg-color widget-font text-truncate">Notifications</div>
- </div>
- </div>
- <div class="card-body px-1 py-0 border-removed border-white-removed show userDesignWidgetCardBody simple-scroll-bar" id="Viewer_` + containerid + `" data-iscollapseapplied=false>
- <ul class="UserdesignNotifiactionDetails" id="UserdesignNotifiactionDetails"></ul>
- </div>
- <div class="border-0 card-footer d-flex justify-content-center position-sticky pt-10 z-index-2 bg-white ">
- <a class="btn btn-outline-primary btn-xs rounded-4" href="javascript:;" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(6)" id="AddWidget_btnCreateWidget"> View Earlier Notifications </a>
- </div>
- </div>`;
- $('#' + 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 = `<div class="rem-item-wrap notification_card widget-card p-0">
- <div class="d-flex w-100">
- <a href="javascript:void(0);" class="w-100 text-dark notification_click" id="Rem-item-${ReminderId}" data-id="${ReminderId}" onclick="Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(${refid},${installedappid},'${response[i].UrlType}','${ReminderUrl}',${remindertype},${createformid},null)" class="text-dark py-1 w-90">
- <div class="d-flex w-100">
- <div class="flex-grow-1 overflow-hide">
- <div class="notifications-text word-break">
- <div class="d-flex justify-content-between align-items-center">
- <div class="w-60p p-2 mr-1 flex-shrink-0">
- <img src="${IconUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0">
- </div>
- <div class="w-90">
- <div class="text-dark text-capitalize font-12 font-weight-600 text-truncate w-95 notification-subject" title="${response[i].Subject}">${response[i].Subject}</div>
- <div class=" word-break notifi_message_overflow">${response[i].Message} <span class="notifications-time text-secondary">-</span> <span class="notifications-time text-secondary"> ${Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocal(response[i].ReminderDate)}</div>
- </div>
- <span>
- </div>
- </div>
- <div>
- </div>
-
- </div>
- </div>
- </a>
- </div>
- </div>`;
- $(".UserdesignNotifiactionDetails").append(html);
- }
- }
- else {
- let emptyhtml = `<div class="card-body text-center h-295p px-0">
- <div class="biz-custom-scrollbar" style="height: -webkit-fill-available;">
- <img src="tenants/themes/compact/imgs/notification.png" onerror="ReloadImage(event)" class="h-125p w-125p">
- <p class="text-dark my-1 font-weight-600">You don't have any Notifications yet.</p>
- <p class="font-14">Will notify you when Something arrives'</p>
- </div>
- </div>
- `;
- $(".UserdesignNotifiactionDetails").html(emptyhtml);
- }
- $(".notification_click").click(function () {
- $(this).parents(".notification_card").remove();
- if ($(".UserdesignNotifiactionDetails").html().length == 0) {
- let emptyhtml = `<div class="card-body text-center">
- <img src="tenants/themes/compact/imgs/notification.png" onerror="ReloadImage(event)" class="h-125p w-125p">
- <p class="text-dark my-1 font-weight-600">You don't have any Notifications yet.</p>
- <p class="font-14">Will notify you when Something arrives'</p>
- </div>`;
- $(".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 = {}));
|