This commit is contained in:
2023-03-11 17:30:20 +00:00
commit b6c4e025bc
5124 changed files with 1153349 additions and 0 deletions
@@ -0,0 +1,32 @@
var Unibase;
(function (Unibase) {
let Themes;
(function (Themes) {
let Compact;
(function (Compact) {
let Components;
(function (Components) {
class TaskParms {
static Instance() {
if (this.instance == undefined) {
this.instance = new TaskParms();
}
return this.instance;
}
SaveTaskParameters(TaskParameters) {
var index = TaskParms.TaskParameters.findIndex(x => x.TaskId = TaskParameters.TaskId);
var result = (index == -1) ? TaskParms.TaskParameters.push(TaskParameters) : null;
}
RemoveTaskParameters(taskid) {
TaskParms.TaskParameters = TaskParms.TaskParameters.filter(x => x.TaskId != taskid);
}
GetTaskParameters(TaskId) {
return TaskParms.TaskParameters.find(x => x.TaskId = TaskId);
}
}
TaskParms.TaskParameters = [];
Components.TaskParms = TaskParms;
})(Components = Compact.Components || (Compact.Components = {}));
})(Compact = Themes.Compact || (Themes.Compact = {}));
})(Themes = Unibase.Themes || (Unibase.Themes = {}));
})(Unibase || (Unibase = {}));
@@ -0,0 +1 @@
{"version":3,"file":"TaskParams.js","sourceRoot":"","sources":["TaskParams.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CA+BhB;AA/BD,WAAU,OAAO;IACb,IAAiB,MAAM,CA6BtB;IA7BD,WAAiB,MAAM;QACnB,IAAiB,OAAO,CA2BvB;QA3BD,WAAiB,OAAO;YACpB,IAAiB,UAAU,CAyB1B;YAzBD,WAAiB,UAAU;gBACvB,MAAa,SAAS;oBAGjB,MAAM,CAAC,QAAQ;wBACZ,IAAI,IAAI,CAAC,QAAQ,IAAI,SAAS,EAAE;4BAC5B,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAC;yBACnC;wBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;oBACxB,CAAC;oBACF,kBAAkB,CAAC,cAAc;wBAE7B,IAAI,KAAK,GAAG,SAAS,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;wBACtF,IAAI,MAAM,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;oBACtF,CAAC;oBACD,oBAAoB,CAAC,MAAM;wBAEvB,SAAS,CAAC,cAAc,GAAG,SAAS,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;oBACxF,CAAC;oBACD,iBAAiB,CAAC,MAAM;wBAEpB,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;oBACjE,CAAC;;gBApBc,wBAAc,GAAG,EAAE,CAAC;gBAD1B,oBAAS,YAuBrB,CAAA;YACL,CAAC,EAzBgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAyB1B;QACL,CAAC,EA3BgB,OAAO,GAAP,cAAO,KAAP,cAAO,QA2BvB;IACL,CAAC,EA7BgB,MAAM,GAAN,cAAM,KAAN,cAAM,QA6BtB;AACL,CAAC,EA/BS,OAAO,KAAP,OAAO,QA+BhB"}
@@ -0,0 +1,804 @@
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 = `<a class="btn btn-outline-primary mr-auto ml-auto px-3 py-1" href="javascript:;" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(6)" id="AddWidget_btnCreateWidget">View All</a>`;
var viewallbtntask = `<a class="btn btn-outline-primary mr-auto ml-auto px-3 py-1" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(1)" href="javascript:;" id="AddWidget_btnCreateWidget">View All</a>`;
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 = `
<ul class="nav nav-tabs border-0 text-center mr-auto" id="myTab" role="tablist">
<li class="nav-item task-litab">
<a class="nav-link tab-view active biz-notification-mobile-view border-0" id="task-tab" data-toggle="tab" href="#taskTabView" id="task-tab" onclick="Unibase.Themes.Compact.Components.Notification.Instance().tabView('task-tab')" role="tab" aria-controls="profile" aria-selected="false"><span>Tasks</span><span class="badge badge-link badge-sm border font-12 ml-2 rounded-circle" id="tasks_count">0</span></a>
</li>
<li class="nav-item">
<a class="nav-link border-0 tab-view" id="notification-tab" data-toggle="tab" href="#notificationTabView" onclick="Unibase.Themes.Compact.Components.Notification.Instance().tabView('notification-tab')" role="tab" aria-controls="home" aria-selected="true"><span>Notification</span><span class="badge badge-link badge-sm border font-12 ml-2 rounded-circle" id="notification_count">0</span></a>
</li>
<li class="nav-item clear_alldiv mt-10 d-none" style="position:absolute;right:32px"><a class="reminderstatus" onclick="Unibase.Themes.Compact.Components.Notification.Instance().changeReminderStatusAsRead()">Clear All</a></li>
</ul><ul class="clear-all-checkbox"><input type="checkbox" class="mb-1 clearall-checkbox" style="position:absolute;right:12px;top:13px"></ul>`;
let tabViewBodyHTML = `
<div class="tab-content m-0" id="myTabContent">
<div class="tab-pane show active" id="taskTabView" role="tabpanel" aria-labelledby="profile-tab"></div>
<div class="tab-pane " id="notificationTabView" role="tabpanel" aria-labelledby="home-tab"></div>
</div>`;
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: "<span class='dstry' style='color:red'>Clear All Notifications?</span>",
message: "Are you sure! Do you want to clear all notifications? ",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> Cancel'
},
confirm: {
label: '<i class="fa fa-check"></i> 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 = '<span class="badge border rounded-circle badge-sm badge-link mr-4 font-14 " id="notification_count">0</span>';
}
else {
count = '<span class="badge border rounded-circle badge-sm badge-link mr-4 font-14 " id="notification_count"></span>';
}
$(".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(`<span class="notification_header my-2 mr-2 font-16 font-weight-400">Notifications</span>${count}<div class="clear_alldiv d-none" style="position:absolute;right:40px"><a class="reminderstatus" onclick="Unibase.Themes.Compact.Components.Notification.Instance().changeReminderStatusAsRead()">Clear All</a></div><input type="checkbox" class="clearall-checkbox ml-2" style="position:absolute;right:10px">`).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 += `<div class="rem-item-wrap">
<div class="d-flex w-100">
<a href="javascript:void(0);" class="w-100 px-2 text-dark" 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="w-60p p-2 mr-2 flex-shrink-0">
<img src="${IconUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0">
</div>
<div class="flex-grow-1 overflow-hide">
<div class="notifications-text word-break">
<div class="d-flex justify-content-between">
<span class="w-90">
<p class="text-dark text-capitalize font-12 font-weight-600 text-truncate w-95 notification-subject" title="${response[i].Subject}">${response[i].Subject}</p>
</span><span>
<div class="d-flex pb-0 px-2">
<div class="checkbox_div w-10 "><input type="checkbox" class="check_allreminders notify_check" style="position:relative;left:5px;top:5px" id="checkid_${ReminderId}"></div>
</div>
</div> </div>
<div><span class="font-12 font-weight-400 word-break notifi_message_overflow">${response[i].Message}</span></div>
<div class="d-flex align-items-center justify-content-between z-index-10">
<div class="notifications-time font-12 font-weight-600">${Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocal(response[i].ReminderDate)}</div>
<span class="font-12 font-weight-600 text-dark py-1 z-index-2" data-id="${ReminderId}" onclick="Unibase.Themes.Compact.Components.Notification.Instance().UpdateReminderStatus('${ReminderId}','Read');event.stopPropagation();">Mark as read</span>
</div>
</div>
</div>
</a>
</div></div>`;
if (i != response.length - 1)
html += '<div class="dropdown-divider mx-3 m-0 p-0"></div>';
}
var checkcount = Number(`${response.length}`);
var noreminders = Unibase.Themes.Compact.Components.Notification.Instance().noremaindershtml();
var viewallbtn = `<a class="btn btn-outline-primary mr-auto ml-auto px-3 py-1 " href="javascript:;" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(6)" id="notificationsViewAllBtn">View All</a><a class="btn btn-outline-danger mr-auto ml-auto px-3 py-1 d-none" href="javascript:;" onclick=" Unibase.Themes.Compact.Components.Notification.Instance().markAsReadUnReadReminders();" id="notificationClearBtn">Clear <span class="d-inline-flex align-items-center font-14">(<span id="clearNotificationCount">0</span>)</span></a>`;
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<sup class="fa fa-plus" style="font-size: 8px;"></sup>';
}
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('<span class="my-2 font-16 font-weight-400">Tasks</span><span class="ml-2 px-2 border rounded-circle font-14" id="tasks_count">0</span>').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 += '<div id="Taskmedia_' + ReminderId + '" data-refid="' + response[i].RefGuid + '" class="task-list-item TaskLi_' + response[i].TaskId + '">' +
'<div class="cursor-pointer d-flex pr-3 py-1 w-100" id="Rem-item-' + ReminderId + '" data-id="' + ReminderId + '" onclick="Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(' + refid + ',' + installedappid + ',\'' + response[i].UrlType + '\',\'' + ReminderUrl + '\',' + remindertype + ',' + createformid + ',null)">' +
`<div class="w-60p p-2 mr-2 flex-shrink-0"><img src="${IconUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0"></div>
<div class="notifications-text flex-grow-1 overflow-hide word-break">
<p class="text-dark text-capitalize font-12 font-weight-600 w-95 text-truncate word-break task-subject" title="${response[i].Subject}">${response[i].Subject}</p>
<p class="font-12 text-dark notifi_message_overflow"> ${response[i].Message}</p>
<div class="d-flex align-items-center justify-content-between my-2">
<div class="notifications-time font-12">${Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocal(response[i].ReminderDate)}</div>` +
'<div><a class="pull-right text-primary Collapse_Manage' + ReminderId + ' font-12" style="text-decoration: none;" data-toggle="collapse" onclick="Unibase.Themes.Compact.Components.Notification.Instance().LoadApprovals(\'' + response[i].RefGuid + '\',\'' + ReminderId + '\',' + response[i].TaskId + ');event.stopPropagation();"> Manage <i class="text-dark fa fa-angle-down"></i>' +
`</a></div></div></div></div>
<div class="box collaps" id="collapseManageBtn_${ReminderId}">
</div>
</div>`;
if (i != response.length - 1)
html += '<div class="dropdown-divider mx-3 m-0 p-0"></div>';
}
$('.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 = `<a class="btn btn-outline-primary mr-auto ml-auto px-3 py-1" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(1)" href="javascript:;" id="AddWidget_btnCreateWidget">View All</a>`;
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 += `<div class="d-flex justify-content-center align-items-center mb-2 mt-1 ml-3 accordion-header" id="manageBtnWrap_${ReminderId}">` +
'<button class="btn btn-outline-success mr-2 ml-auto px-4 py-1 font-12" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ChangeApprovalStatus(\'' + ReminderId + '\',' + response.result.TaskId + ',\'Accept\',' + response.result.ApprovalFormId + ',' + response.result.ApprovalFormPkId + ')">' + Approvedbtn + '</button>' +
'<button class="btn btn-outline-danger mr-2 ml-auto px-4 py-1 font-12 collapsed" data-toggle="collapse" href="#collapseReject_' + ReminderId + '">' + Rejectbtn + '</button>' +
'<button class="btn btn-outline-primary mr-auto ml-auto px-4 py-1 font-12" onclick = "Unibase.Themes.Compact.Components.Notification.Instance().confirmclosetask(' + TaskId + ',\'' + ReminderId + '\')">Close</button>' +
'</div>' +
'<div class="collapse py-1" id="collapseReject_' + ReminderId + '" data-parent="#collapseManageBtn_' + ReminderId + '">' +
'<div class="d-flex justify-content-start mt-1 px-3">' +
'<input type="text" id="Reason_' + TaskId + '" class="form-control focus_blue border-0 w-75 p-0 pl-1 mr-2" placeholder="Add Comment">' +
'<a href="javascript:void(0);" class="btn-sm btn-success px-3 ml-2 p-0 d-flex flex-row align-items-center" onclick="' + rejectonclick + '">' +
'<i class="fa fa-send-o font-11"></i>' +
'</a>' +
'</div>' +
'</div>';
$("#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: "<span class='dstry' style='color:red'>Close Task?</span>",
message: "Are you sure? If you are deleting this task.Then work flow will override",
buttons: {
cancel: {
label: '<i class="fa fa-times"></i> Cancel'
},
confirm: {
label: '<i class="fa fa-check"></i> 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 `<div class="card text-center border-0 shadow-none w-100 notification-empty-card mb-0 bg-transparent" style="z-index:99"><div class="card-body mt-50 text-center" ><img src="tenants/themes/compact/imgs/task.png" onerror="ReloadImage(event)" class="h-200p w-200p"><p class="text-dark my-1 font-weight-600">You don't have any Tasks Right Now.</p><p class="font-14">Will notify you when Something arrives'</p> </div> <div class="card-footer text-center border-0 mb-10"><a class="btn btn-outline-primary mr-auto ml-auto" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(1)" href = "javascript:;" id = "AddWidget_btnCreateWidget">View Earlier Tasks</a></div></div>`;
}
noremaindershtml() {
return `<div class="card text-center border-0 shadow-none w-100 notification-empty-card mb-0 bg-transparent" style = "z-index:99" > <div class="card-body mt-50 text-center"><img src="tenants/themes/compact/imgs/notification.png" onerror = "ReloadImage(event)" class="h-200p w-200p"><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 class="card-footer text-center border-0 mb-10"><a class="btn btn-outline-primary mr-auto ml-auto" href = "javascript:;" onclick = "Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(6)" id = "AddWidget_btnCreateWidget">View Earlier Notifications</a></div></div>`;
}
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 = {}));
File diff suppressed because one or more lines are too long
@@ -0,0 +1,154 @@
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 = {}));
@@ -0,0 +1,181 @@
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 TaskWidget extends Unibase.Platform.Core.BaseComponent {
load(id, containerid, callback) {
var instance = this;
}
jsFiles() {
return [];
}
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">Tasks</div>
</div>
</div>
<div class="card-body px-1 py-0 border-removed border-white-removed show userDesignWidgetCardBody taskDetailsCardBody simple-scroll-bar" id="Viewer_` + containerid + `" data-iscollapseapplied=false>
<ul class="UserdesignTaskDetails" id="UserdesignTaskDetails"></ul>
</div>
<div class="border-0 card-footer d-flex justify-content-center position-sticky pt-10 bg-white z-index-2">
<a class="btn btn-xs rounded-4 btn-outline-primary" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ViewAll(1)" href="javascript:;" id="AddWidget_btnCreateWidget">View Earlier Tasks</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.Task;
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 id="Taskmedia_' + ReminderId + '" class="task-list-item border-bottom border-2">' +
'<div class="cursor-pointer d-flex pr-3 py-1 w-100" id="Rem-item-' + ReminderId + '" data-id="' + ReminderId + '" onclick="Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(' + refid + ',' + installedappid + ',\'' + response[i].UrlType + '\',\'' + ReminderUrl + '\',' + remindertype + ',' + createformid + ',null)">' +
`<div class="w-60p p-2 mr-2 flex-shrink-0"><img src="${IconUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0"></div>
<div class="notifications-text flex-grow-1 overflow-hide word-break">
<p class="text-dark text-capitalize font-12 font-weight-600 w-95 text-truncate word-break task-subject" title="${response[i].Subject}">${response[i].Subject}</p>
<p class="font-12 text-dark notifi_message_overflow"> ${response[i].Message}</p>
<div class="d-flex align-items-center justify-content-between ">
<div class="notifications-time font-12">${Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocal(response[i].ReminderDate)}</div>` +
'<div class="btn btn-outline-primary btn-xs p-2 line-height-10" onclick="Unibase.Themes.Compact.Components.TaskWidget.Instance().LoadApprovals(\'' + response[i].RefGuid + '\',\'' + ReminderId + '\',' + response[i].TaskId + ');event.stopPropagation();"><a class="pull-right TaskCollapse_Manage' + ReminderId + ' font-12" style="text-decoration: none;" data-toggle="collapse" > Manage <i class="text-dark fa fa-angle-down"></i>' +
`</a></div></div></div></div>
<div class="box collaps" id="TaskcollapseManageBtn_${ReminderId}">
</div>
</div>`;
$(".UserdesignTaskDetails").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/task.png" onerror="ReloadImage(event)" class="h-125p w-125p">
<p class="text-dark my-1 font-weight-600">You don't have any Tasks Right Now.</p>
<p class="font-14">Will notify you when Something arrives'</p>
</div>
</div>
`;
$(".UserdesignTaskDetails").html(emptyhtml);
}
});
});
}
LoadApprovals(RefId, ReminderId, TaskId) {
var html = "";
if ($(`#taskManageBtnWrap_${ReminderId}`).length) {
$("#TaskcollapseManageBtn_" + 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 += `<div class="d-flex justify-content-between align-items-center mb-2 mt-1 ml-3 accordion-header" id="taskManageBtnWrap_${ReminderId}">` +
`<div>` +
'<button class="btn btn-outline-success taskbtn_conform mr-2 ml-auto px-4 py-1 font-12" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ChangeApprovalStatus(\'' + ReminderId + '\',' + response.result.TaskId + ',\'Accept\',' + response.result.ApprovalFormId + ',' + response.result.ApprovalFormPkId + ')">' + Approvedbtn + '</button>' +
'<button class="btn btn-outline-danger mr-2 ml-auto px-4 py-1 font-12 collapsed" data-toggle="collapse" href="#collapseReject_' + ReminderId + '">' + Rejectbtn + '</button></div>' +
'<a class="py-1 font-12 text-danger pr-25 taskbtn_end" onclick = "Unibase.Themes.Compact.Components.Notification.Instance().confirmclosetask(' + TaskId + ',\'' + ReminderId + '\')">Close</a>' +
'</div>' +
'<div class="collapse py-1" id="collapseReject_' + ReminderId + '" data-parent="#TaskcollapseManageBtn_' + ReminderId + '">' +
'<div class="d-flex justify-content-start mt-1 px-3">' +
'<input type="text" id="Reason_' + TaskId + '" class="form-control focus_blue border-0 w-75 p-0 pl-1 mr-2" placeholder="Add Comment">' +
'<a href="javascript:void(0);" class="btn-sm btn-success px-3 ml-2 p-0 d-flex flex-row align-items-center taskbtn_send" onclick="' + rejectonclick + '">' +
'<i class="fa fa-send-o font-11"></i>' +
'</a>' +
'</div>' +
'</div>';
$(".taskDetailsCardBody #TaskcollapseManageBtn_" + ReminderId).html(html).collapse('show');
$(".taskbtn_conform,.taskbtn_send").click(function () {
$(this).parents(".task-list-item").remove();
if ($(".UserdesignTaskDetails").html().length == 0) {
let emptyhtml = `<div class="card-body text-center">
<img src="tenants/themes/compact/imgs/task.png" onerror="ReloadImage(event)" class="h-125p w-125p">
<p class="text-dark my-1 font-weight-600">You don't have any Tasks Right Now.</p>
<p class="font-14">Will notify you when Something arrives'</p>
</div>`;
$(".UserdesignTaskDetails").html(emptyhtml);
}
});
}
});
}
static Instance() {
if (this.instance === undefined)
this.instance = new TaskWidget();
return this.instance;
}
}
Components.TaskWidget = TaskWidget;
})(Components = Compact.Components || (Compact.Components = {}));
})(Compact = Themes.Compact || (Themes.Compact = {}));
})(Themes = Unibase.Themes || (Unibase.Themes = {}));
})(Unibase || (Unibase = {}));