/*Data loading start here*/
import {
getCookie
} from "./cookiehelper.js";
import {
getData,
getDataObj
} from "./base.js";
function loadData() {
getData(
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/6/PageSize/20"
).then(function(result) {
let response = JSON.parse(result.result);
if (response.length != 0) {
// Notifcations
let bdyUI = '
';
for (var i = 0; i < response.length; i++) {
bdyUI += `
`;
}
bdyUI += "";
$(".bdy-ul").append(bdyUI);
$(".notifiListItms").on("click", function() {
let _this = $(this).parents(".item-li");
let obj = {
FromDate: "2022/11/30",
InstalledAppId: Number($(_this).attr("data-installedAppId")),
RecordId: Number($(_this).attr("data-ref")),
ToDate: "2022/11/30",
};
//let obj = { "FromDate": "2022/11/30", "InstalledAppId": 102530270000109, "RecordId": 102533490346298, "ToDate": "2022/11/30" };
getDataObj(
"apis/v4/unibase/platform/widgets/getdefaultwidget",
obj,
true,
"POST"
).then(function(response) {
let res = JSON.parse(response.result),
html = "";
if (response.message == "200" && response.errors == null) {
html = ``;
if (
res.AppConfigurations != null &&
res.AppConfigurations.length > 0
) {
for (var k = 0; k < res.AppConfigurations.length; k++) {
html += `- ${res.AppConfigurations[k].SettingName}
`;
}
} else {
html += `-
App Configurations Not configure
`;
}
if (res.Stages != null) {
for (var x = 0; x < res.Stages.length; x++) {
if (res.Stages[x].IsDefault) {
html += `-
${res.Stages[x].StageName}
";
} else {
html += `-
No Stages
`;
}
html += `- Details-Page
`;
} else {
html += `
${response.message} ${response.errors}
`;
}
$(_this).find(".accordion-body").html(html);
detailClick();
});
});
}
});
getData(
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/1/PageSize/20"
).then(function(tskResp) {
let response = JSON.parse(tskResp.result);
if (response.length != 0) {
let _tskhtml = '';
for (var i = 0; i < response.length; i++) {
_tskhtml += `
`;
}
_tskhtml += "";
$(".bdy-ul").append(_tskhtml);
detailClick()
}
});
}
export function detailClick(){
$('.detailBtn').click(function() {
$('.bdy-ul').addClass('d-none');
let installedAppId = +$(this).attr('data-appId');
let recordId = +$(this).attr('data-recordId')
// Unibase.Themes.Compact.Components.Notification.Instance().loadReminderDetails(105013010001972,105010260000090,'Details','null',6,0,null)
const cookie = getCookie('_idty');
if (cookie) {
const {
unibaseId,
tenantId,
userId
} = JSON.parse(cookie);
debugger;
$('#detailIframe').html(
``
);
}
});
}
export function initListIndex() {
let _userInfo = atob(document.cookie.split("=")[1]);
let userInfo = " JSON.parse(_userInfo).result";
let sessionId = "userInfo.sessionId";
let usrinfoHTML = `${userInfo.name}
Cloud Settings
Help
Logoff`;
$(".icn-circle").text(userInfo?.name?.charAt(0)?.toUpperCase());
$(".uindtls").html(usrinfoHTML);
// List Page loading
/*Data loading start here*/
$(".mnNvIcn").click(function() {
$(".lft-nav-bar").toggleClass("lft-nav-bar-Wrap");
$(".ctr-lst-pge").toggleClass("lft-nav-bar-Wrap");
});
loadData();
}