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=`View All`,r=`View All`;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=` `,u=`
`;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:"Clear All Notifications?<\/span>",message:"Are you sure! Do you want to clear all notifications? ",buttons:{cancel:{label:'<\/i> Cancel'},confirm:{label:'<\/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?'0<\/span>':'<\/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(`Notifications${i}`).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 `;t!=i.length-1&&(r+='`;t!=u.length-1&&(f+='