Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

index.notifications.min.js 34KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i extends n.Platform.Core.BaseComponent{static Instance(){return new i}init(t){n.Themes.Compact.Components.Notification.containerid=t;n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount();n.Platform.Apps.Managers.AppManager.Instance().getInstallAppId("Unibase_Platform_Communications_Reminders_App_Reminders").then(function(t){t.result!=null&&(n.Themes.Compact.Components.Notification.ReminderAppid=t.result.InstalledAppId)});n.Platform.Apps.Managers.AppManager.Instance().getInstallAppId("Unibase_Platform_Communications_Reminders_App_TaskReminders").then(function(t){t.result!=null&&(n.Themes.Compact.Components.Notification.TaskReminderAppid=t.result.InstalledAppId)});$("#Active_Process").click(function(){$("#Active_Process").addClass("active");$("#Active_Notification").removeClass("active");$("#Active_Tasks").removeClass("active");$(".Reminders").remove();n.Themes.Compact.Components.Notification.Instance().GetRunnningProcess()})}tabView(t){var i=`<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>`,r=`<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 u=this;$(".tab-view").removeClass("biz-notification-mobile-view border");$("#"+t).addClass("biz-notification-mobile-view border-0");t=="notification-tab"&&(n.Themes.Compact.Components.Notification.Instance().loadReminders("tab-view"),$(".biz-settings-panel").css("background","#fff9f9"));t=="task-tab"?($(".clearall-checkbox").addClass("d-none"),$(".clear_alldiv").addClass("d-none"),n.Themes.Compact.Components.Notification.Instance().loadTasks("tab-view"),$(".biz-settings-panel").css("background","#fff9f9"),$(".notification-footer").html(r)):(n.Themes.Compact.Components.Notification.UnReadNotificationsCount==0?($(".clearall-checkbox").addClass("d-none"),$(".clear_alldiv").addClass("d-none")):($(".clearall-checkbox").removeClass("d-none"),$(".clear_alldiv").removeClass("d-none")),$(".biz-settings-panel").css("background","#f7fbff"),$(".notification-footer").html(i),$("#notificationTabView .rem-item-wrap").length?$(".notification-footer").removeClass("d-none"):$(".notification-footer").addClass("d-none"))}loadNotificationsTask(n,t,i){let r=`
  2. <ul class="nav nav-tabs border-0 text-center mr-auto" id="myTab" role="tablist">
  3. <li class="nav-item task-litab">
  4. <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>
  5. </li>
  6. <li class="nav-item">
  7. <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>
  8. </li>
  9. <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>
  10. </ul><ul class="clear-all-checkbox"><input type="checkbox" class="mb-1 clearall-checkbox" style="position:absolute;right:12px;top:13px"></ul>`,u=`
  11. <div class="tab-content m-0" id="myTabContent">
  12. <div class="tab-pane show active" id="taskTabView" role="tabpanel" aria-labelledby="profile-tab"></div>
  13. <div class="tab-pane " id="notificationTabView" role="tabpanel" aria-labelledby="home-tab"></div>
  14. </div>`;i==1&&($("#settings-panel-head-title").remove(),$("#myTab").remove(),$("#settings_panel_close").after(r),$("#settings-panel-body").html(u).parent().addClass("p-0"),$(".settings-panel-head").removeClass("px-3").addClass("pr-3 pl-1"));t=="notification"&&$("#notificationTabView").html(n);t=="task"&&($("#taskTabView").html(n),this.GetUnreadRemindersCount(!1))}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(t){if(t)n.Platform.Communications.Managers.ReminderManager.Instance().ChangeAllReminderStatusAsRead().then(function(t){if(t.status==n.Data.Status.Success){var i=undefined;isMobileApp()&&(i="tab-view");n.Themes.Compact.Components.Notification.Instance().loadReminders(i,null)}else alert("failed to clear notifications")});else return}})}loadReminders(t,i){return __awaiter(this,void 0,void 0,function*(){$(".clear-all-checkbox").removeClass("d-none");$("#settingsPanelBodyWrap").removeClass("d-none");$("#chatPanelBodyWrap").addClass("d-none");$(".biz__nav__toggle").is(":visible")&&$("#biz_nav_close").click();let u=this,r="";i=i!=null?'<span class="badge border rounded-circle badge-sm badge-link mr-4 font-14 " id="notification_count">0<\/span>':'<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>${i}<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 f=n.Platform.Communications.Enums.ReminderType.Notification;return n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount(!0),yield n.Platform.Communications.Managers.ReminderManager.Instance().getReminders(f,20).then(function(i){r="";for(let t=0;t<i.length;t++){let c=0,o=0,s=0;i[t].RedirectOptions==null||i[t].RedirectOptions==undefined?(o=i[t].InstalledAppId,s=i[t].RefId):(c=i[t].RedirectOptions.CreateFormId,o=i[t].RedirectOptions.InstalledAppId,s=i[t].RedirectOptions.RefId);let h=i[t].ReminderUrl,u=i[t].IconUrl;(u==undefined||u==null)&&(u="tenants/themes/compact/imgs/defaultnotification.png");u==""&&(u="tenants/themes/compact/imgs/notification.png");let e=i[t].ReminderId;h==""&&(h=null);r+=`<div class="rem-item-wrap">
  15. <div class="d-flex w-100">
  16. <a href="javascript:void(0);" class="w-100 px-2 text-dark" id="Rem-item-${e}" data-id="${e}" onclick="Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(${s},${o},'${i[t].UrlType}','${h}',${f},${c},null)"
  17. class="text-dark py-1 w-90">
  18. <div class="d-flex w-100">
  19. <div class="w-60p p-2 mr-2 flex-shrink-0">
  20. <img src="${u}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0">
  21. </div>
  22. <div class="flex-grow-1 overflow-hide">
  23. <div class="notifications-text word-break">
  24. <div class="d-flex justify-content-between">
  25. <span class="w-90">
  26. <p class="text-dark text-capitalize font-12 font-weight-600 text-truncate w-95 notification-subject" title="${i[t].Subject}">${i[t].Subject}</p>
  27. </span><span>
  28. <div class="d-flex pb-0 px-2">
  29. <div class="checkbox_div w-10 "><input type="checkbox" class="check_allreminders notify_check" style="position:relative;left:5px;top:5px" id="checkid_${e}"></div>
  30. </div>
  31. </div> </div>
  32. <div><span class="font-12 font-weight-400 word-break notifi_message_overflow">${i[t].Message}</span></div>
  33. <div class="d-flex align-items-center justify-content-between z-index-10">
  34. <div class="notifications-time font-12 font-weight-600">${n.Platform.Helpers.DateTimeHelper.Instance().formatLocal(i[t].ReminderDate)}</div>
  35. <span class="font-12 font-weight-600 text-dark py-1 z-index-2" data-id="${e}" onclick="Unibase.Themes.Compact.Components.Notification.Instance().UpdateReminderStatus('${e}','Read');event.stopPropagation();">Mark as read</span>
  36. </div>
  37. </div>
  38. </div>
  39. </a>
  40. </div></div>`;t!=i.length-1&&(r+='<div class="dropdown-divider mx-3 m-0 p-0"><\/div>')}var e=Number(`${i.length}`),o=`<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>`,s=`<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>`;t=="tab-view"?($(".clearall-checkbox").removeClass("d-none"),e==0?(u.loadNotificationsTask(o,"notification",0),$(".clear_alldiv").addClass("d-none"),$(".notification-footer").addClass("d-none"),$(".clearall-checkbox").addClass("d-none")):(u.loadNotificationsTask(r,"notification",0),$(".clear_alldiv").removeClass("d-none"),$(".notification-footer").removeClass("d-none").html(s))):e==0?($(".clearall-checkbox").addClass("d-none"),$(".clear_alldiv").addClass("d-none"),$("#settings-panel-body").html(o).addClass("no-data"),$(".notification-footer").addClass("d-none")):($(".clear_alldiv").removeClass("d-none"),$(".clearall-checkbox").removeClass("d-none"),$("#settings-panel-body").html(r).removeClass("no-data"),$(".notification-footer").removeClass("d-none").html(s));$(".biz-settings-panel #notification_count").text(n.Themes.Compact.Components.Notification.UnReadNotificationsCount);$(".biz-settings-panel #tasks_count").text(n.Themes.Compact.Components.Notification.UnReadTasksCount);n.Themes.Compact.Components.Index.Instance().layoutIndex==1&&$(".biz-settings-panel").addClass("layout-1");n.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(n,t){$(t).prop("scrollWidth")<$(t).outerWidth()+2&&$(t).removeAttr("title")});$(".notify_check").on("click",function(){var n=!0;$(".notify_check").each(function(){if($(this).is(":checked"))n=!0;else return n=!1,!1});n?$(".clearall-checkbox").prop("checked",!0):$(".clearall-checkbox").prop("checked",!1);$(".notify_check").is(":checked")?($(".task-litab").addClass("d-none"),$("#notificationsViewAllBtn").addClass("d-none"),$("#clearNotificationCount").text($(".notify_check:checked").length),$("#notificationClearBtn").removeClass("d-none")):($(".task-litab").removeClass("d-none"),$(".clearall-checkbox").prop("checked",!1),$("#notificationsViewAllBtn").removeClass("d-none"),$("#notificationClearBtn").addClass("d-none"))});$(".clearall-checkbox").click(function(){$(".clearall-checkbox").is(":checked")?($(".task-litab").addClass("d-none"),$(".check_allreminders").prop("checked",!0),$("#notificationsViewAllBtn").addClass("d-none"),$("#clearNotificationCount").text($(".notify_check:checked").length),$("#notificationClearBtn").removeClass("d-none")):($(".task-litab").removeClass("d-none"),$(".check_allreminders").prop("checked",!1),$("#notificationsViewAllBtn").removeClass("d-none"),$("#notificationClearBtn").addClass("d-none"))})})})}markAsReadUnReadReminders(t){var i=[],r;$(".check_allreminders").each(function(){if($(this).is(":checked")){var n=$(this).attr("id"),t=n.split("_")[1];i.push(t)}});r={Reminders:i};n.Platform.Communications.Managers.ReminderManager.Instance().markAsReadUnreadReminders(r).then(function(i){if(i.status==n.Data.Status.Success){var r=undefined;t&&(r="tab-view");n.Themes.Compact.Components.Notification.Instance().loadReminders(r,null)}})}GetUnreadRemindersCount(){const t=this;let i=n.Platform.Membership.Infos.Identity.getCurrentUser();n.Platform.Communications.Managers.ReminderManager.Instance().getUnreadRemindersCountByUserId().then(function(i){var r=i.result;n.Themes.Compact.Components.Notification.UnReadNotificationsCount=r.NotificationCount;n.Themes.Compact.Components.Notification.UnReadTasksCount=r.TasksCount;const u=Number(r.NotificationCount),f=Number(r.TasksCount);if(n.Themes.Compact.Components.Index.Instance().tabMode)t.bindCountHtml(u,"#notificatonIconBadge"),t.bindCountHtml(f,"#taskIconBadge");else{let n=u+f;t.bindCountHtml(n,"#notificatonIconBadge")}$(".biz-settings-panel #notification_count").text(r.NotificationCount);$(".biz-settings-panel #tasks_count").text(r.TasksCount)})}bindCountHtml(n,t){if(n>0){let i=n.toString();if(n>99&&(i='99<sup class="fa fa-plus" style="font-size: 8px;"><\/sup>'),n>9||n>99){let i="count-double-digit";n>99&&(i="count-overflow");$(t).closest(".dropdown-notifications").addClass(i)}$(t).html(i).removeClass("d-none")}else $(t).empty().addClass("d-none")}loadTasks(t){return __awaiter(this,void 0,void 0,function*(){let i=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 r=n.Platform.Communications.Enums.ReminderType.Task;return n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount(!1),yield n.Platform.Communications.Managers.ReminderManager.Instance().getReminders(r,20).then(function(u){let f="";for(let t=0;t<u.length;t++){let c=0,o=0,s=0;u[t].RedirectOptions==null||u[t].RedirectOptions==undefined?(o=u[t].InstalledAppId,s=u[t].RefId):(c=u[t].RedirectOptions.CreateFormId,o=u[t].RedirectOptions.InstalledAppId,s=u[t].RedirectOptions.RefId);let h=u[t].ReminderUrl,e=u[t].IconUrl;(e==""||e==null)&&(e="tenants/themes/compact/imgs/task.png");let i=u[t].ReminderId;h==""&&(h=null);f+='<div id="Taskmedia_'+i+'" class="task-list-item"><div class="cursor-pointer d-flex pr-3 py-1 w-100" id="Rem-item-'+i+'" data-id="'+i+'" onclick="Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails('+s+","+o+",'"+u[t].UrlType+"','"+h+"',"+r+","+c+',null)">'+`<div class="w-60p p-2 mr-2 flex-shrink-0"><img src="${e}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0"></div>
  41. <div class="notifications-text flex-grow-1 overflow-hide word-break">
  42. <p class="text-dark text-capitalize font-12 font-weight-600 w-95 text-truncate word-break task-subject" title="${u[t].Subject}">${u[t].Subject}</p>
  43. <p class="font-12 text-dark notifi_message_overflow"> ${u[t].Message}</p>
  44. <div class="d-flex align-items-center justify-content-between my-2">
  45. <div class="notifications-time font-12">${n.Platform.Helpers.DateTimeHelper.Instance().formatLocal(u[t].ReminderDate)}</div>`+'<div><a class="pull-right text-primary Collapse_Manage'+i+' font-12" style="text-decoration: none;" data-toggle="collapse" onclick="Unibase.Themes.Compact.Components.Notification.Instance().LoadApprovals(\''+u[t].RefGuid+"','"+i+"',"+u[t].TaskId+');event.stopPropagation();"> Manage <i class="text-dark fa fa-angle-down"><\/i>'+`</a></div></div></div></div>
  46. <div class="box collaps" id="collapseManageBtn_${i}">
  47. </div>
  48. </div>`;t!=u.length-1&&(f+='<div class="dropdown-divider mx-3 m-0 p-0"><\/div>')}$(".biz-settings-panel #tasks_count").text(n.Themes.Compact.Components.Notification.UnReadTasksCount);var e=Number(`${u.length}`),o=`<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>`,s=`<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>`;t=="tab-view"?e==0?(i.loadNotificationsTask(o,"task",1),$(".notification-footer").addClass("d-none")):(i.loadNotificationsTask(f,"task",1),$(".notification-footer").removeClass("d-none").html(s)):($(".biz-settings-panel").toggleClass("show"),e==0?($("#settings-panel-body").html(o).addClass("no-data"),$(".notification-footer").addClass("d-none")):($("#settings-panel-body").html(f).removeClass("no-data"),$(".notification-footer").removeClass("d-none").html(s)));$(".biz-settings-panel .task-subject").each(function(n,t){$(t).prop("scrollWidth")<$(t).outerWidth()+2&&$(t).removeAttr("title")});n.Themes.Compact.Components.Index.Instance().layoutIndex==1&&$(".biz-settings-panel").addClass("layout-1");n.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(t,i,r){var u="";if($(`#manageBtnWrap_${i}`).length){$("#collapseManageBtn_"+i).collapse("toggle");return}n.Platform.Communications.Managers.TaskManager.Instance().getTaskByRefId(t,r).then(function(n){if(n.result!=null){var t="Approve",f="Reject",e="Unibase.Themes.Compact.Components.Notification.Instance().SaveTaskReason('"+i+"',"+n.result.TaskId+",'Reject');";n.result.ConfirmKeyText!=null&&n.result.ConfirmKeyText!=undefined&&n.result.ConfirmKeyText!=""&&(t=n.result.ConfirmKeyText);n.result.RejectKeyText!=null&&n.result.RejectKeyText!=undefined&&n.result.RejectKeyText!=""&&(f=n.result.RejectKeyText);Number(n.result.RejectFormId)!=0&&(e="Unibase.Themes.Compact.Components.Notification.Instance().ChangeApprovalStatus('"+i+"',"+n.result.TaskId+",'Reject',"+n.result.RejectFormId+","+n.result.RejectFormPkId+")");u+=`<div class="d-flex justify-content-center align-items-center mb-2 mt-1 ml-3 accordion-header" id="manageBtnWrap_${i}">`+'<button class="btn btn-outline-success mr-2 ml-auto px-4 py-1 font-12" onclick="Unibase.Themes.Compact.Components.Notification.Instance().ChangeApprovalStatus(\''+i+"',"+n.result.TaskId+",'Accept',"+n.result.ApprovalFormId+","+n.result.ApprovalFormPkId+')">'+t+'<\/button><button class="btn btn-outline-danger mr-2 ml-auto px-4 py-1 font-12 collapsed" data-toggle="collapse" href="#collapseReject_'+i+'">'+f+'<\/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('+r+",'"+i+'\')">Close<\/button><\/div><div class="collapse py-1" id="collapseReject_'+i+'" data-parent="#collapseManageBtn_'+i+'"><div class="d-flex justify-content-start mt-1 px-3"><input type="text" id="Reason_'+r+'" 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="'+e+'"><i class="fa fa-send-o font-11"><\/i><\/a><\/div><\/div>';$("#collapseManageBtn_"+i).html(u).collapse("show")}})}ChangeApprovalStatus(t,i,r,u,f){var e=r=="Reject"?$("#Reason_"+i).val().toString():"Accepted";u!=0?(n.Themes.Compact.Components.Notification.TaskId=i,n.Themes.Compact.Components.Notification.TaskReminderId=t,n.Platform.Helpers.NavigationHelper.Instance().loadForm(u,f,0,0,function(u){u!=null&&n.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(n.Themes.Compact.Components.Notification.TaskId,r,e).then(function(){n.Themes.Compact.Components.Notification.TaskId=0;n.Themes.Compact.Components.Notification.TaskReminderId="";$("#Taskmedia_"+t).remove();$("#notification_list_"+i).remove();n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount()})})):n.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(i,r,e).then(function(){$("#Taskmedia_"+t).remove();n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount()})}SaveTaskReason(t,i,r){let u=$("#Reason_"+i).val().toString();n.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(i,r,u).then(function(){$("#Taskmedia_"+t).remove();n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount()})}GetRunnningProcess(){$(".notifications-nicescroll-bar").html("")}loadReminderDetails(t,i,r,u,f,e){let o=$(event.currentTarget).attr("id").split("-")[2],s=this;f!=Number(n.Platform.Communications.Enums.ReminderType.Task)&&n.Platform.Communications.Managers.ReminderManager.Instance().changeReminderStatus(o,"Read").then(function(){$(".Reminders").remove();f==Number(n.Platform.Communications.Enums.ReminderType.Notification)?n.Themes.Compact.Components.Notification.Instance().loadReminders():f==Number(n.Platform.Communications.Enums.ReminderType.Task)?n.Themes.Compact.Components.Notification.Instance().loadTasks():f==Number(n.Platform.Communications.Enums.ReminderType.Process)&&n.Themes.Compact.Components.Notification.Instance().GetRunnningProcess()});r=="List"?n.Platform.Helpers.NavigationHelper.Instance().loadList(i,null):r=="Details"?n.Platform.Helpers.NavigationHelper.Instance().loadDetail(t,i,null):r=="FileDownload"?n.Themes.Compact.Components.Notification.Instance().Downloadfile(u):r=="FilePreview"?n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js",function(){n.Apps.Collaboration.Components.UniCloud.Instance().notificationFilePreview(t)}):r=="FolderPreview"?n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js",function(){n.Apps.Collaboration.Components.UniCloud.Instance().notificationFolderPreview(t,i)}):r=="Create"&&this.fileCacheHelper.loadJsFile("platform/forms/managers/formmanager.js",function(){n.Platform.Forms.Managers.FormManager.Instance().getFormRoleByAppConfiguration(Number(e)).then(function(t){t.result!=null&&n.Platform.Helpers.NavigationHelper.Instance().loadForm(t.result.FormId,0,Number(e),0,null)})});s.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(t){n.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["platform/communications/enums/reminders/remindertype.js","platform/communications/managers/reminders/remindermanager.js"],function(){let r=0,u=0,f=0;if(t.RedirectOptions==null||t.RedirectOptions==undefined)u=Number(t.installedappid),r=Number(t.recordid);else{var e=t.RedirectOptions;typeof t.RedirectOptions=="string"&&e.includes("CreateFormId")&&(t.RedirectOptions=JSON.parse(t.RedirectOptions));u=Number(t.RedirectOptions.InstalledAppId);f=Number(t.RedirectOptions.CreateFormId);r=Number(t.RedirectOptions.RefId)}let i=t.urltype,o=t.reminderurl,s=Number(t.remindertype),h=t.reminderid;i=="List"?(n.Platform.Helpers.NavigationHelper.Instance().closeAllModals(),n.Platform.Helpers.NavigationHelper.Instance().loadList(u,null)):i=="Details"?(n.Platform.Helpers.NavigationHelper.Instance().closeAllModals(),n.Platform.Helpers.NavigationHelper.Instance().loadDetail(r,u,null)):i=="FileDownload"?n.Themes.Compact.Components.Notification.Instance().Downloadfile(o):i=="FilePreview"?n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js",function(){n.Apps.Collaboration.Components.UniCloud.Instance().notificationFilePreview(r)}):i=="FolderPreview"?n.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/unicloud.js",function(){n.Apps.Collaboration.Components.UniCloud.Instance().notificationFolderPreview(r,u)}):i=="Create"&&this.fileCacheHelper.loadJsFile("platform/forms/managers/formmanager.js",function(){n.Platform.Forms.Managers.FormManager.Instance().getFormRoleByAppConfiguration(f).then(function(t){t.result!=null&&n.Platform.Helpers.NavigationHelper.Instance().loadForm(t.result.FormId,0,Number(f),0,null)})})})}confirmclosetask(t,i){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(r){if(r)n.Themes.Compact.Components.Notification.Instance().CloseTask(t,i,"Completed");else return}})}CloseTask(t,i,r){var u=n.Platform.Membership.Infos.Identity.currentUser.name;let f="Task is Closed by "+u;n.Platform.Communications.Managers.TaskManager.Instance().changeApprovalStatus(t,r,f).then(function(){$("#Taskmedia_"+i+"").remove();n.Themes.Compact.Components.Notification.UnReadTasksCount=n.Themes.Compact.Components.Notification.UnReadTasksCount-1;$("#tasks_count").text(n.Themes.Compact.Components.Notification.UnReadTasksCount)})}UpdateReminderStatus(t,i){n.Platform.Communications.Managers.ReminderManager.Instance().changeReminderStatus(t,i).then(function(){var t=undefined;isMobileApp()&&(t="tab-view");n.Themes.Compact.Components.Notification.Instance().loadReminders(t,null)})}Downloadfile(t){n.Platform.Helpers.AssetHelper.Instance().download(t)}ViewAll(t){let i=0,r=this;i=t===Number(n.Platform.Communications.Enums.ReminderType.Notification)?n.Themes.Compact.Components.Notification.ReminderAppid:n.Themes.Compact.Components.Notification.TaskReminderAppid;i!=0&&n.Platform.Helpers.NavigationHelper.Instance().loadList(i,null);r.closeClickEvent()}GetInstalledAppId(t){return __awaiter(this,void 0,void 0,function*(){let i;return n.Platform.Apps.Managers.AppManager.Instance().getInstallAppId(t).then(function(n){i=n}),yield i})}}i.Status="Accept";i.Reason="Accepted";i.TaskId=0;i.TaskReminderId="";i.UnReadNotificationsCount=0;i.UnReadTasksCount=0;t.Notification=i})(i=t.Components||(t.Components={}))})(i=t.Compact||(t.Compact={}))})(t=n.Themes||(n.Themes={}))})(Unibase||(Unibase={})),function(n){let t;(function(n){let t;(function(n){let t;(function(n){class t{}n.Connect=t})(t=n.Packets||(n.Packets={}))})(t=n.Automation||(n.Automation={}))})(t=n.Platform||(n.Platform={}))}(Unibase||(Unibase={})),function(n){let t;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){n[n.Alert=1]="Alert";n[n.CouponApplied=2]="CouponApplied";n[n.CouponAlreadyRedeemed=3]="CouponAlreadyRedeemed";n[n.InvalidDuplicateCoupon=4]="InvalidDuplicateCoupon";n[n.UnAuthenticCoupon=5]="UnAuthenticCoupon";n[n.CouponBeep=6]="CouponBeep";n[n.CouponScrapped=7]="CouponScrapped";n[n.Congratulations=8]="Congratulations"})(t=n.NotifyAlerts||(n.NotifyAlerts={}))})(t=n.Enums||(n.Enums={}))})(t=n.Automation||(n.Automation={}))})(t=n.Platform||(n.Platform={}))}(Unibase||(Unibase={}));__awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},function(n){let t;(function(t){let i;(function(i){let r;(function(r){class u{constructor(){this.methods={sendNotifiation:function(i){var r=!1,u;if(!isMobileApp()){if(i.reminderType==Number(n.Platform.Communications.Enums.ReminderType.Notification))n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount();else if(i.reminderType==Number(n.Platform.Communications.Enums.ReminderType.Task))n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount();else if(i.reminderType==Number(n.Platform.Communications.Enums.ReminderType.Chat)&&(r=!0,u=n.Platform.Connect.Components.Chat,u.chatGroupId==i.refId&&u.privatewindow))return;n.Platform.Automation.Components.Notifier.Instance().playAudio(t.Automation.Enums.NotifyAlerts.Alert);Notification.permission!="granted"&&Notification.requestPermission();new Notification(i.subject,{body:i.message});r||MessageHelper.Instance().showSuccess(i.subject,"")}r?$("#chatIconBadge").text(Number($("#chatIconBadge").text())+1).removeClass("d-none"):n.Themes.Compact.Components.Notification.Instance().GetUnreadRemindersCount()}}}init(){this.seedAudioLibrary();this._notificationHub=i.Hubs.NotificationHub.Instance(_appsettings.notification_url());this.connection=this._notificationHub;this.start()}playAudio(n){var t=document.createElement("audio");t.src=this.getAudioUrl(n);t.volume=.1;t.autoplay=!1;t.play()}getAudioUrl(n){return this.audiolibrary[Number(n)]}seedAudioLibrary(){this.audiolibrary===undefined&&(this.audiolibrary=[]);this.audiolibrary[t.Automation.Enums.NotifyAlerts.Alert]="tenants/alerts/alert.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.CouponApplied]="tenants/alerts/coupon_applied.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.CouponAlreadyRedeemed]="tenants/alerts/coupon_already_redeemed.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.InvalidDuplicateCoupon]="tenants/alerts/invalid_duplicate_coupon.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.UnAuthenticCoupon]="tenants/alerts/unauthentic_coupon.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.CouponBeep]="tenants/alerts/coupon_beep.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.CouponScrapped]="tenants/alerts/coupon_scrapped.mp3";this.audiolibrary[t.Automation.Enums.NotifyAlerts.Congratulations]="tenants/alerts/congratulations_sprllproject.mp3"}getClientMethods(){return[{MethodName:"sendnotification",Method:this.methods.sendNotifiation}]}registerClientMethods(){let n=this.getClientMethods();if(n)for(var t=0;t<n.length;t++)this.connection.register(n[t].MethodName,n[t].Method)}start(){return __awaiter(this,void 0,void 0,function*(){try{this.registerClientMethods();this.connection.connect(function(){let i=n.Platform.Membership.Infos.Identity.getCurrentUser();console.log("connection started");let t=new n.Platform.Automation.Packets.Connect;t.UnibaseId=i.unibaseId;t.UserName=i.name;t.UserId=i.userId;t.TenantId=i.tenantId;t.SessionId=i.sessionId;n.Platform.Automation.Components.Notifier.Instance()._notificationHub.server.Connect(t,null)})}catch(t){console.log(t);setTimeout(this.start,5e3)}})}static Instance(){return this.instance===undefined&&(this.instance=new u),this.instance}}r.Notifier=u})(r=i.Components||(i.Components={}))})(i=t.Automation||(t.Automation={}))})(t=n.Platform||(n.Platform={}))}(Unibase||(Unibase={})),function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i{constructor(t){this.server={Connect:function(t,i){n.Platform.Automation.Hubs.NotificationHub.Instance(_appsettings.notification_url()).invoke("Connect",t,i)}};this.huburl=t;this.connection=(new window.signalR.HubConnectionBuilder).withUrl(this.huburl).withAutomaticReconnect().build()}getConnection(){return this.connection}connect(n){this.getConnection().start().then(function(){n()})}register(n,t){this.getConnection().on(n,t)}invoke(t,i){n.Platform.Automation.Hubs.NotificationHub.Instance(_appsettings.notification_url()).getConnection().invoke(t,i).catch(function(n){return console.error(n.toString())})}static Instance(n){return this.instance===undefined&&(this.instance=new i(n)),this.instance}}t.NotificationHub=i})(i=t.Hubs||(t.Hubs={}))})(i=t.Automation||(t.Automation={}))})(t=n.Platform||(n.Platform={}))}(Unibase||(Unibase={}));