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 Notification extends Unibase.Platform.Core.BaseComponent { static Instance() { return new Notification(); } init(containerid) { Unibase.Themes.Compact.Components.Notification.containerid = containerid; Unibase.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount(); let remindersuniqueid = "Unibase_Platform_Communications_Reminders_App_Reminders"; Unibase.Platform.Apps.Managers.AppManager.Instance().getInstallAppId(remindersuniqueid).then(function (response) { if (response.result != null) { Unibase.Themes.Compact.Components.Notification.ReminderAppid = response.result.InstalledAppId; } }); let taskremindersuniqueid = "Unibase_Platform_Communications_Reminders_App_TaskReminders"; Unibase.Platform.Apps.Managers.AppManager.Instance().getInstallAppId(taskremindersuniqueid).then(function (response) { if (response.result != null) { Unibase.Themes.Compact.Components.Notification.TaskReminderAppid = response.result.InstalledAppId; } }); $("#Active_Process").click(function () { $("#Active_Process").addClass("active"); $("#Active_Notification").removeClass("active"); $("#Active_Tasks").removeClass("active"); $(".Reminders").remove(); Unibase.Themes.Compact.Components.Notification.Instance().GetRunnningProcess(); }); } tabView(id) { var viewallbtn = `View All`; var viewallbtntask = `View All`; let instance = this; $('.tab-view').removeClass('biz-notification-mobile-view border'); $("#" + id).addClass('biz-notification-mobile-view border-0'); if (id == 'notification-tab') { Unibase.Themes.Compact.Components.Notification.Instance().loadReminders('tab-view'); $(".biz-settings-panel").css("background", "#fff9f9"); } if (id == 'task-tab') { $('.clearall-checkbox').addClass('d-none'); $('.clear_alldiv').addClass('d-none'); Unibase.Themes.Compact.Components.Notification.Instance().loadTasks('tab-view'); $(".biz-settings-panel").css("background", "#fff9f9"); $(".notification-footer").html(viewallbtntask); } else { if (Unibase.Themes.Compact.Components.Notification.UnReadNotificationsCount == 0) { $('.clearall-checkbox').addClass('d-none'); $('.clear_alldiv').addClass('d-none'); } else { $('.clearall-checkbox').removeClass('d-none'); $('.clear_alldiv').removeClass('d-none'); } $(".biz-settings-panel").css("background", "#f7fbff"); $(".notification-footer").html(viewallbtn); if ($('#notificationTabView .rem-item-wrap').length) { $(".notification-footer").removeClass('d-none'); } else { $(".notification-footer").addClass('d-none'); } } } loadNotificationsTask(html, tabType, binding) { let tabViewHeaderHTML = ` `; let tabViewBodyHTML = `
`; if (binding == 1) { $('#settings-panel-head-title').remove(); $('#myTab').remove(); $('#settings_panel_close').after(tabViewHeaderHTML); $("#settings-panel-body").html(tabViewBodyHTML).parent().addClass('p-0'); $('.settings-panel-head').removeClass('px-3').addClass('pr-3 pl-1'); } if (tabType == 'notification') { $('#notificationTabView').html(html); } if (tabType == 'task') { $('#taskTabView').html(html); this.GetUnreadRemindersCount(false); } } changeReminderStatusAsRead() { bootbox.confirm({ title: "Clear All Notifications?", message: "Are you sure! Do you want to clear all notifications? ", buttons: { cancel: { label: ' Cancel' }, confirm: { label: ' Confirm' } }, callback: function (result) { if (result) { Unibase.Platform.Communications.Managers.ReminderManager.Instance().ChangeAllReminderStatusAsRead().then(function (response) { if (response.status == Unibase.Data.Status.Success) { var html = Unibase.Themes.Compact.Components.Notification.Instance().noremaindershtml(); var finalcount = 0; var checkboxclass = "clearall-checkbox"; if (isMobileApp()) { checkboxclass = "clear-all-checkbox"; var count = Number($('#notificatonIconBadge').text()); var tabcount = Number($('#notification_count').text()); finalcount = count - tabcount; $('#notificationTabView').html(html); } else { $("#settings-panel-body").html(html).addClass('no-data'); } if (finalcount <= 0) { $('#notificatonIconBadge').addClass('d-none'); finalcount = 0; } $('#notificatonIconBadge').text(finalcount); $('.clear_alldiv').addClass('d-none'); $('.' + checkboxclass).addClass('d-none'); $('#notification_count').text(0); $('#notificationsViewAllBtn').addClass('d-none'); } else { alert("failed to clear notifications"); } }); } else { return; } } }); } loadReminders(tabview, count) { return __awaiter(this, void 0, void 0, function* () { $('.clear-all-checkbox').removeClass('d-none'); $('#settingsPanelBodyWrap').removeClass('d-none'); $('#chatPanelBodyWrap').addClass('d-none'); if ($('.biz__nav__toggle').is(':visible')) { $('#biz_nav_close').click(); } let instance = this, html = ""; if (count != null) { count = '0'; } else { count = ''; } $(".biz-settings-panel").css("background", "#f7fbff"); $(".settings-panel-head").removeClass("d-none py-2"); $('#settings-panel-head-title').addClass('d-flex flex-row align-items-center py-1').empty().append(`Notifications${count}
Clear All
`).parent().addClass('px-3 border-bottom').removeClass('py-10'); $('#settings-panel-body').removeClass('px-3').addClass("biz-body-height"); $(".notification-footer").removeClass("d-none"); let remindertype = Unibase.Platform.Communications.Enums.ReminderType.Notification; Unibase.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount(true); return yield Unibase.Platform.Communications.Managers.ReminderManager.Instance().getReminders(remindertype, 20).then(function (response) { html = ""; 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)}
Mark as read
`; if (i != response.length - 1) html += ''; } var checkcount = Number(`${response.length}`); var noreminders = Unibase.Themes.Compact.Components.Notification.Instance().noremaindershtml(); var viewallbtn = `View AllClear (0)`; if (tabview == 'tab-view') { $('.clearall-checkbox').removeClass('d-none'); if (checkcount == 0) { instance.loadNotificationsTask(noreminders, 'notification', 0); $('.clear_alldiv').addClass('d-none'); $(".notification-footer").addClass("d-none"); $('.clearall-checkbox').addClass('d-none'); } else { instance.loadNotificationsTask(html, 'notification', 0); $('.clear_alldiv').removeClass('d-none'); $(".notification-footer").removeClass("d-none").html(viewallbtn); } } else { if (checkcount == 0) { $('.clearall-checkbox').addClass('d-none'); $('.clear_alldiv').addClass('d-none'); $("#settings-panel-body").html(noreminders).addClass('no-data'); $(".notification-footer").addClass("d-none"); } else { $('.clear_alldiv').removeClass('d-none'); $('.clearall-checkbox').removeClass('d-none'); $("#settings-panel-body").html(html).removeClass('no-data'); $(".notification-footer").removeClass("d-none").html(viewallbtn); } } $('.biz-settings-panel #notification_count').text(Unibase.Themes.Compact.Components.Notification.UnReadNotificationsCount); $('.biz-settings-panel #tasks_count').text(Unibase.Themes.Compact.Components.Notification.UnReadTasksCount); if (Unibase.Themes.Compact.Components.Index.Instance().layoutIndex == 1) { $('.biz-settings-panel').addClass('layout-1'); } if (Unibase.Themes.Compact.Components.Index.Instance().layoutIndex == 2) { $('.biz-settings-panel').addClass('layout-2'); } $('.biz-settings-panel').addClass('notifications-tasks-panel'); $('.biz-settings-panel .notification-subject').each(function (i, e) { if ($(e).prop('scrollWidth') < $(e).outerWidth() + 2) { $(e).removeAttr('title'); } }); $('.notify_check').on('click', function (e) { e.stopPropagation(); var ischecked = true; $('.notify_check').each(function () { if ($(this).is(':checked')) { ischecked = true; } else { ischecked = false; return false; } }); if (ischecked) { $('.clearall-checkbox').prop('checked', true); } else { $('.clearall-checkbox').prop('checked', false); } if ($('.notify_check').is(":checked")) { $('.task-litab').addClass('d-none'); $('#notificationsViewAllBtn').addClass('d-none'); $('#clearNotificationCount').text($('.notify_check:checked').length); $('#notificationClearBtn').removeClass('d-none'); } else { $('.task-litab').removeClass('d-none'); $('.clearall-checkbox').prop("checked", false); $('#notificationsViewAllBtn').removeClass('d-none'); $('#notificationClearBtn').addClass('d-none'); } }); $('.clearall-checkbox').click(function () { if ($('.clearall-checkbox').is(":checked")) { $('.task-litab').addClass('d-none'); $('.check_allreminders').prop("checked", true); $('#notificationsViewAllBtn').addClass('d-none'); $('#clearNotificationCount').text($('.notify_check:checked').length); $('#notificationClearBtn').removeClass('d-none'); } else { $('.task-litab').removeClass('d-none'); $('.check_allreminders').prop("checked", false); $('#notificationsViewAllBtn').removeClass('d-none'); $('#notificationClearBtn').addClass('d-none'); } }); }); }); } markAsReadUnReadReminders(ismobile) { var Reminders = []; $('.check_allreminders').each(function () { if ($(this).is(":checked")) { var id = $(this).attr("id"); var reminderid = id.split("_")[1]; Reminders.push(reminderid); } }); var Reminder = { Reminders }; Unibase.Platform.Communications.Managers.ReminderManager.Instance().markAsReadUnreadReminders(Reminder).then(function (response) { if (response.status == Unibase.Data.Status.Success) { var tab = undefined; if (ismobile) { tab = 'tab-view'; } Unibase.Themes.Compact.Components.Notification.Instance().loadReminders(tab, null); } }); } GetUnreadRemindersCount(isnotification) { const instance = this; let user = Unibase.Platform.Membership.Infos.Identity.getCurrentUser(); Unibase.Platform.Communications.Managers.ReminderManager.Instance().getUnreadRemindersCountByUserId().then(function (response) { var obj = response.result; Unibase.Themes.Compact.Components.Notification.UnReadNotificationsCount = obj.NotificationCount; Unibase.Themes.Compact.Components.Notification.UnReadTasksCount = obj.TasksCount; const notificationCount = Number(obj.NotificationCount); const taskCount = Number(obj.TasksCount); if (Unibase.Themes.Compact.Components.Index.Instance().tabMode) { instance.bindCountHtml(notificationCount, '#notificatonIconBadge'); instance.bindCountHtml(taskCount, '#taskIconBadge'); } else { let totalCount = notificationCount + taskCount; instance.bindCountHtml(totalCount, '#notificatonIconBadge'); } $(".biz-settings-panel #notification_count").text(obj.NotificationCount); $(".biz-settings-panel #tasks_count").text(obj.TasksCount); }); } bindCountHtml(count, countEl) { if (count > 0) { let countHtml = count.toString(); if (count > 99) { countHtml = '99'; } if (count > 9 || count > 99) { let countClass = 'count-double-digit'; if (count > 99) { countClass = 'count-overflow'; } $(countEl).closest('.dropdown-notifications').addClass(countClass); } $(countEl).html(countHtml).removeClass("d-none"); } else { $(countEl).empty().addClass("d-none"); } } loadTasks(tabView) { return __awaiter(this, void 0, void 0, function* () { let instance = this; $('#settingsPanelBodyWrap').removeClass('d-none'); $('#chatPanelBodyWrap').addClass('d-none'); $('#settings-panel-head-title').addClass('d-flex flex-row align-items-center py-1').empty().append('Tasks0').parent().addClass('px-3 border-bottom').removeClass('py-10'); $(".biz-settings-panel").css("background", "#fff9f9"); $('.settings-panel-head').removeClass('py-2 mobileChat-view d-none'); $('#settings-panel-body').removeClass('px-3').addClass("biz-body-height"); let remindertype = Unibase.Platform.Communications.Enums.ReminderType.Task; Unibase.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount(false); return yield Unibase.Platform.Communications.Managers.ReminderManager.Instance().getReminders(remindertype, 20).then(function (response) { let html = ""; 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 == "" || IconUrl == null) { IconUrl = "tenants/themes/compact/imgs/task.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)}
` + '
Manage ' + `
`; if (i != response.length - 1) html += ''; } $('.biz-settings-panel #tasks_count').text(Unibase.Themes.Compact.Components.Notification.UnReadTasksCount); var checkcount = Number(`${response.length}`); var noreminders = Unibase.Themes.Compact.Components.Notification.Instance().notaskshtml(); var viewallbtntask = `View All`; if (tabView == 'tab-view') { if (checkcount == 0) { instance.loadNotificationsTask(noreminders, 'task', 1); $(".notification-footer").addClass("d-none"); } else { instance.loadNotificationsTask(html, 'task', 1); $(".notification-footer").removeClass("d-none").html(viewallbtntask); } } else { $(".biz-settings-panel").toggleClass("show"); if (checkcount == 0) { $("#settings-panel-body").html(noreminders).addClass('no-data'); $(".notification-footer").addClass("d-none"); } else { $("#settings-panel-body").html(html).removeClass('no-data'); $(".notification-footer").removeClass("d-none").html(viewallbtntask); } } $('.biz-settings-panel .task-subject').each(function (i, e) { if ($(e).prop('scrollWidth') < $(e).outerWidth() + 2) { $(e).removeAttr('title'); } }); if (Unibase.Themes.Compact.Components.Index.Instance().layoutIndex == 1) { $('.biz-settings-panel').addClass('layout-1'); } if (Unibase.Themes.Compact.Components.Index.Instance().layoutIndex == 2) { $('.biz-settings-panel').addClass('layout-2'); } $('.biz-settings-panel').addClass('notifications-tasks-panel'); $('.clear-all-checkbox').addClass('d-none'); }); }); } LoadApprovals(RefId, ReminderId, TaskId) { var html = ""; if ($(`#manageBtnWrap_${ReminderId}`).length) { $("#collapseManageBtn_" + ReminderId).collapse('toggle'); return; } Unibase.Platform.Communications.Managers.TaskManager.Instance().getTaskByRefId(RefId, TaskId).then(function (response) { if (response.result != null) { var Approvedbtn = "Approve"; var Rejectbtn = "Reject"; var rejectonclick = 'Unibase.Themes.Compact.Components.Notification.Instance().SaveTaskReason(\'' + ReminderId + '\',' + response.result.TaskId + ',\'Reject\');'; if (response.result.ConfirmKeyText != null && response.result.ConfirmKeyText != undefined && response.result.ConfirmKeyText != "") { Approvedbtn = response.result.ConfirmKeyText; } if (response.result.RejectKeyText != null && response.result.RejectKeyText != undefined && response.result.RejectKeyText != "") { Rejectbtn = response.result.RejectKeyText; } if (Number(response.result.RejectFormId) != 0) { rejectonclick = 'Unibase.Themes.Compact.Components.Notification.Instance().ChangeApprovalStatus(\'' + ReminderId + '\',' + response.result.TaskId + ',\'Reject\',' + response.result.RejectFormId + ',' + response.result.RejectFormPkId + ')'; } html += `
` + '' + '' + '' + '
' + '
' + '
' + '' + '' + '' + '' + '
' + '
'; $("#collapseManageBtn_" + ReminderId).html(html).collapse('show'); } }); } ChangeApprovalStatus(reminderid, taskid, status, formid, formpkid) { var reason = status == "Reject" ? $("#Reason_" + taskid).val().toString() : "Accepted"; var obj = { TaskId: taskid, Reason: reason, Status: status }; if (formid != 0) { Unibase.Themes.Compact.Components.Notification.TaskId = taskid; Unibase.Themes.Compact.Components.Notification.TaskReminderId = reminderid; Unibase.Platform.Helpers.NavigationHelper.Instance().loadForm(formid, formpkid, 0, 0, function (response) { if (response != null) { Unibase.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(obj).then(function (response) { Unibase.Themes.Compact.Components.Notification.TaskId = 0; Unibase.Themes.Compact.Components.Notification.TaskReminderId = ''; Unibase.Themes.Compact.Components.Notification.UnReadTasksCount = Unibase.Themes.Compact.Components.Notification.UnReadTasksCount - 1; var refguid = $('.TaskLi_' + taskid).attr('data-refid'); Unibase.Themes.Compact.Components.Notification.Instance().reloadPage(refguid); Unibase.Themes.Compact.Components.Notification.Instance().removetask(taskid); }); } }); } else { Unibase.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(obj).then(function (response) { Unibase.Themes.Compact.Components.Notification.UnReadTasksCount = Unibase.Themes.Compact.Components.Notification.UnReadTasksCount - 1; var refguid = $('.TaskLi_' + taskid).attr('data-refid'); Unibase.Themes.Compact.Components.Notification.Instance().reloadPage(refguid); Unibase.Themes.Compact.Components.Notification.Instance().removetask(taskid); }); } } SaveTaskReason(reminderid, taskid, status) { let reason = $("#Reason_" + taskid).val().toString(); var obj = { TaskId: taskid, Reason: reason, Status: status }; Unibase.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(obj).then(function (response) { Unibase.Themes.Compact.Components.Notification.UnReadTasksCount = Unibase.Themes.Compact.Components.Notification.UnReadTasksCount - 1; var refguid = $('.TaskLi_' + taskid).attr('data-refid'); Unibase.Themes.Compact.Components.Notification.Instance().reloadPage(refguid); Unibase.Themes.Compact.Components.Notification.Instance().removetask(taskid); }); } GetRunnningProcess() { $(".notifications-nicescroll-bar").html(""); } loadReminderDetails(id, installedappid, urltype, reminderurl, remindertype, CreateFormId, callback) { let reminderid = $(event.currentTarget).attr('id').split('-')[2], instance = this; let status = "Read"; if (remindertype != Number(Unibase.Platform.Communications.Enums.ReminderType.Task)) { Unibase.Platform.Communications.Managers.ReminderManager.Instance().changeReminderStatus(reminderid, status).then(function (response) { $(".Reminders").remove(); if (remindertype == Number(Unibase.Platform.Communications.Enums.ReminderType.Notification)) { Unibase.Themes.Compact.Components.Notification.Instance().loadReminders(); } else if (remindertype == Number(Unibase.Platform.Communications.Enums.ReminderType.Task)) { Unibase.Themes.Compact.Components.Notification.Instance().loadTasks(); } else if (remindertype == Number(Unibase.Platform.Communications.Enums.ReminderType.Process)) { Unibase.Themes.Compact.Components.Notification.Instance().GetRunnningProcess(); } }); } if (urltype == "List") { Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(installedappid, null); } else if (urltype == "Details") { Unibase.Platform.Helpers.NavigationHelper.Instance().loadDetail(id, installedappid, null); } else if (urltype == "FileDownload") { Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(reminderurl); } else if (urltype == "FilePreview") { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js", function () { Unibase.Apps.Collaboration.Components.UniCloud.Instance().notificationFilePreview(id); }); } else if (urltype == "FolderPreview") { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js", function () { Unibase.Apps.Collaboration.Components.UniCloud.Instance().notificationFolderPreview(id, installedappid); }); } else if (urltype == "Create") { this.fileCacheHelper.loadJsFile("platform/forms/managers/formmanager.js", function () { Unibase.Platform.Forms.Managers.FormManager.Instance().getFormRoleByAppConfiguration(Number(CreateFormId)).then(function (response) { if (response.result != null) { Unibase.Platform.Helpers.NavigationHelper.Instance().loadForm(response.result.FormId, 0, Number(CreateFormId), 0, null); } }); }); } else if (urltype == "Link") { Unibase.Themes.Compact.Components.Notification.Instance().openLink(reminderurl); } instance.closeClickEvent(); } closeClickEvent() { $('.settings-panel-head').find('.notification-viewall').html(""); $(".biz-wrapper").removeClass("biz-settings-toggle"); $(".hk-wrapper").removeClass("biz-settings-toggle"); $('.hk-settings-panel').removeClass('show'); $('.right-side-menu-content-wrap').find('.nav-item').removeClass('right-sunbnav-active'); $('.biz-nav-fullwidth').addClass('hidden'); } loadReminder_mobile(params) { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(['platform/communications/enums/reminders/remindertype.js', 'platform/communications/managers/reminders/remindermanager.js'], function () { let id = 0; let installedappid = 0; let createformid = 0; if (params.RedirectOptions == null || params.RedirectOptions == undefined) { installedappid = Number(params.installedappid); id = Number(params.recordid); } else { var redirectoption = params.RedirectOptions; if (typeof (params.RedirectOptions) == 'string') { if (redirectoption.includes('CreateFormId')) params.RedirectOptions = JSON.parse(params.RedirectOptions); } installedappid = Number(params.RedirectOptions.InstalledAppId); createformid = Number(params.RedirectOptions.CreateFormId); id = Number(params.RedirectOptions.RefId); } let urltype = params.urltype; let reminderurl = params.reminderurl; let remindertype = Number(params.remindertype); let reminderid = params.reminderid; let status = "Read"; if (urltype == "List") { Unibase.Platform.Helpers.NavigationHelper.Instance().closeAllModals(); Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(installedappid, null); } else if (urltype == "Details") { Unibase.Platform.Helpers.NavigationHelper.Instance().closeAllModals(); Unibase.Platform.Helpers.NavigationHelper.Instance().loadDetail(id, installedappid, null); } else if (urltype == "FileDownload") { Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(reminderurl); } else if (urltype == "FilePreview") { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js", function () { Unibase.Apps.Collaboration.Components.UniCloud.Instance().notificationFilePreview(id); }); } else if (urltype == "FolderPreview") { Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js", function () { Unibase.Apps.Collaboration.Components.UniCloud.Instance().notificationFolderPreview(id, installedappid); }); } else if (urltype == "Create") { this.fileCacheHelper.loadJsFile("platform/forms/managers/formmanager.js", function () { Unibase.Platform.Forms.Managers.FormManager.Instance().getFormRoleByAppConfiguration(createformid).then(function (response) { if (response.result != null) { Unibase.Platform.Helpers.NavigationHelper.Instance().loadForm(response.result.FormId, 0, Number(createformid), 0, null); } }); }); } else if (urltype == "Link") { Unibase.Themes.Compact.Components.Notification.Instance().openLink(reminderurl); } }); } confirmclosetask(taskid, reminderid) { bootbox.confirm({ title: "Close Task?", message: "Are you sure? If you are deleting this task.Then work flow will override", buttons: { cancel: { label: ' Cancel' }, confirm: { label: ' Confirm' } }, callback: function (result) { if (result) { Unibase.Themes.Compact.Components.Notification.Instance().CloseTask(taskid, reminderid, "Completed"); } else { return; } } }); } CloseTask(taskid, reminderid, status) { var username = Unibase.Platform.Membership.Infos.Identity.currentUser.name; let reason = "Task is Closed by " + username; var obj = { TaskId: taskid, Reason: reason, Status: status }; Unibase.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(obj).then(function (response) { Unibase.Themes.Compact.Components.Notification.UnReadTasksCount = Unibase.Themes.Compact.Components.Notification.UnReadTasksCount - 1; Unibase.Themes.Compact.Components.Notification.Instance().removetask(taskid); }); } UpdateReminderStatus(reminderid, status) { Unibase.Platform.Communications.Managers.ReminderManager.Instance().changeReminderStatus(reminderid, status).then(function (response) { var tab = undefined; if (isMobileApp()) { tab = 'tab-view'; } Unibase.Themes.Compact.Components.Notification.Instance().loadReminders(tab, null); }); } Downloadfile(url) { Unibase.Platform.Helpers.AssetHelper.Instance().download(url); } ViewAll(Type) { let installedappid = 0, instance = this; if (Type === Number(Unibase.Platform.Communications.Enums.ReminderType.Notification)) { installedappid = Unibase.Themes.Compact.Components.Notification.ReminderAppid; } else { installedappid = Unibase.Themes.Compact.Components.Notification.TaskReminderAppid; } if (installedappid != 0) { Unibase.Platform.Helpers.NavigationHelper.Instance().loadList(installedappid, null); } instance.closeClickEvent(); } GetInstalledAppId(uniqueid) { return __awaiter(this, void 0, void 0, function* () { let result; Unibase.Platform.Apps.Managers.AppManager.Instance().getInstallAppId(uniqueid).then(function (response) { result = response; }); return yield result; }); } notaskshtml() { return `

You don't have any Tasks Right Now.

Will notify you when Something arrives'

`; } noremaindershtml() { return `

You don't have any Notifications yet.

Will notify you when Something arrives'

`; } reloadPage(refguid) { if (Unibase.Themes.Providers.DetailHelper.installedAppId != 0) { var versionguid = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + Unibase.Themes.Providers.DetailHelper.installedAppId + "_versionguid").Value; if (refguid == versionguid) { var obj = Unibase.Themes.Compact.Components.Details.Instance(); obj._recordId = Unibase.Themes.Providers.DetailHelper.recordId; obj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId; Unibase.Themes.Compact.Components.Details.Instance().loadPortlets(obj); } } } removetask(taskid) { var count = 0; var html = Unibase.Themes.Compact.Components.Notification.Instance().notaskshtml(); if (isMobileApp()) { count = Number($('#notificatonIconBadge').text()) - 1; $('#notificatonIconBadge').text(count); if (count == 0) { $('#notificatonIconBadge').addClass('d-none'); $('#taskTabView').html(html); $(".notification-footer").addClass("d-none"); } } else { count = Number($('#taskIconBadge').text()) - 1; $('#taskIconBadge').text(count); if (count == 0) { $('#taskIconBadge').addClass('d-none'); $("#settings-panel-body").html(html).addClass('no-data'); $(".notification-footer").addClass("d-none"); } } $('#tasks_count').text(count); $('#notification_list_' + taskid).remove(); $('.TaskLi_' + taskid).remove(); } openLink(link) { var linkelement = document.createElement('a'); linkelement.href = link; $(linkelement).attr("target", "_blank"); linkelement.click(); } } Notification.Status = "Accept"; Notification.Reason = "Accepted"; Notification.TaskId = 0; Notification.TaskReminderId = ''; Notification.UnReadNotificationsCount = 0; Notification.UnReadTasksCount = 0; Components.Notification = Notification; })(Components = Compact.Components || (Compact.Components = {})); })(Compact = Themes.Compact || (Themes.Compact = {})); })(Themes = Unibase.Themes || (Unibase.Themes = {})); })(Unibase || (Unibase = {}));