|
@@ -1,8 +1,8 @@
|
1
|
1
|
/*Data loading start here*/
|
2
|
|
-import {getCookie} from "./cookiehelper.js";
|
3
|
|
-
|
|
2
|
+import {getCookie, isAuthenticated} from "./cookiehelper.js";
|
4
|
3
|
import {getData, getDataObj} from "./base.js";
|
5
|
4
|
import {_serverUrl} from "./setting.js";
|
|
5
|
+export var connection;
|
6
|
6
|
|
7
|
7
|
function createLoad(data) {
|
8
|
8
|
let html = "";
|
|
@@ -35,7 +35,7 @@ function createLoad(data) {
|
35
|
35
|
<div class="frm-ifre frm-ifre-${number}" id="frm-ifre-${number}" style="right:${width}px">
|
36
|
36
|
<div>
|
37
|
37
|
<ul class="m-0 p-0">
|
38
|
|
- <li class="frm-hdr">
|
|
38
|
+ <li class="frm-hdr d-none">
|
39
|
39
|
<div class="app-title-ifrm">${appName}</div>
|
40
|
40
|
<div class="ctrl">
|
41
|
41
|
<a href="javascript:;" class="minimize" data-unid="${number}" data-ispopup="true"><span><i class="la la-minus"></i></span></a>
|
|
@@ -45,6 +45,12 @@ function createLoad(data) {
|
45
|
45
|
</div>
|
46
|
46
|
</li>
|
47
|
47
|
<li class="frm-bdy">
|
|
48
|
+ <div class="ctrl-vrtl">
|
|
49
|
+ <a href="javascript:;" class="minimize" data-unid="${number}" data-ispopup="true"><span><i class="la la-minus"></i></span></a>
|
|
50
|
+ <a href="javascript:;" class="maximum" data-unid="${number}"><span><i class="la la-expand"></i></span></a>
|
|
51
|
+ <a href="javascript:;" class="compress d-none" data-unid="${number}"><span><i class="las la-compress"></i></span></a>
|
|
52
|
+ <a href="javascript:;" class="close" data-unid="${number}"><span><i class="la la-times"></i></span></a>
|
|
53
|
+ </div>
|
48
|
54
|
<iframe class="ld-frm-src" data-ispopup="false" src="${serverUrl}#/${unibaseId}/${tenantId}/${userId}/${installedAppId}/${formId}/${pk_id}/${appConfigurationId}/loadform"></iframe>
|
49
|
55
|
</li>
|
50
|
56
|
<li class="frm-ftr"></li>
|
|
@@ -53,7 +59,7 @@ function createLoad(data) {
|
53
|
59
|
</div>
|
54
|
60
|
</div>`;
|
55
|
61
|
}
|
56
|
|
- $("#list-page").append(fomrhtml);
|
|
62
|
+ $("#list-page").parent("body").append(fomrhtml);
|
57
|
63
|
window.window.postMessage("ld-frm-ifrme", "*");
|
58
|
64
|
hdrCrtnClckEvnt(number);
|
59
|
65
|
});
|
|
@@ -65,11 +71,13 @@ function hdrCrtnClckEvnt(number) {
|
65
|
71
|
let isPopUpState = $(this).attr("data-ispopup");
|
66
|
72
|
let height = $(`.frm-ifre-${id}`).find(".frm-hdr").height();
|
67
|
73
|
$(".list-page").css({filter: "unset", opacity: 1});
|
|
74
|
+ $(`.frm-ifre-${id} .frm-hdr`).toggleClass("d-none");
|
68
|
75
|
$(`.frm-ifre-${id} .frm-bdy`).toggleClass("d-none");
|
69
|
76
|
if (isPopUpState == "true") {
|
70
|
77
|
// popup large
|
71
|
78
|
$(this).attr("data-ispopup", "false");
|
72
|
79
|
$(`.frm-ifre-${id} .maximum`).addClass("d-none");
|
|
80
|
+ $(`.frm-ifre-${id} .minimize`).attr("data-ispopup", "false");
|
73
|
81
|
$(`.frm-ifre-${id}`).parent().removeClass("wrap-iframe");
|
74
|
82
|
$(`.frm-ifre-${id}`).attr("data-ispop_up", "false");
|
75
|
83
|
$(`.frm-ifre-${id}`).css({
|
|
@@ -81,6 +89,7 @@ function hdrCrtnClckEvnt(number) {
|
81
|
89
|
// popup small
|
82
|
90
|
$(this).attr("data-ispopup", "true");
|
83
|
91
|
$(`.frm-ifre-${id} .maximum`).removeClass("d-none");
|
|
92
|
+ $(`.frm-ifre-${id} .minimize`).attr("data-ispopup", "true");
|
84
|
93
|
$(`.frm-ifre-${id}`).attr("data-ispop_up", "true");
|
85
|
94
|
$(`.frm-ifre-${id}`).css({
|
86
|
95
|
width: "",
|
|
@@ -120,6 +129,26 @@ function hdrCrtnClckEvnt(number) {
|
120
|
129
|
});
|
121
|
130
|
}
|
122
|
131
|
function loadData() {
|
|
132
|
+ $(".bdy-ul").empty();
|
|
133
|
+ $('[class="refrsh"]')
|
|
134
|
+ .unbind()
|
|
135
|
+ .on("click", function () {
|
|
136
|
+ loadData();
|
|
137
|
+ });
|
|
138
|
+ $('[data-clck="ri-grid-fill"]').on("click", function () {
|
|
139
|
+ $(".apps-list").toggleClass("d-flex");
|
|
140
|
+ });
|
|
141
|
+ getData("apis/v4/unibase/platform/apps/myapps").then(function (response) {
|
|
142
|
+ let result = JSON.parse(response.result);
|
|
143
|
+ let html = "";
|
|
144
|
+ for (var i = 0; i < result.length; i++) {
|
|
145
|
+ html += `<li class="appsBind" data-myappid="${result[i].MyAppId}"><img src="../imgs/${result[i].ImageUrl}" ><span class="appTitle">${result[i].AppTitle}</span></li>`;
|
|
146
|
+ }
|
|
147
|
+ $("#apps-list").html(html);
|
|
148
|
+ $("li.appsBind").on("click", function () {
|
|
149
|
+ $(".apps-list").removeClass("d-flex");
|
|
150
|
+ });
|
|
151
|
+ });
|
123
|
152
|
getData(
|
124
|
153
|
"apis/v4/unibase/reminders/platform/getunreadreminders/ReminderType/6/PageSize/20"
|
125
|
154
|
).then(function (result) {
|
|
@@ -132,17 +161,15 @@ function loadData() {
|
132
|
161
|
<div class="accordion-header" id="accHeader-${response[i].ReminderId}">
|
133
|
162
|
<div class="notifiListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${response[i].ReminderId}" aria-expanded="false" aria-controls="collapseOne">
|
134
|
163
|
<div class="row m-0 w-100 p-0 ">
|
135
|
|
- <div class="col-1 ">
|
136
|
|
- <input class="form-check-input mx-1" type="checkbox" value="" id="flexCheckDefault">
|
137
|
|
- </div>
|
138
|
|
- <div class="col-4 text-truncate">
|
139
|
|
- <span class="mx-1">${response[i].Subject}</span>
|
140
|
|
- </div>
|
141
|
|
- <div class="col-5 text-truncate">
|
142
|
|
- <span class="mx-1">${response[i].Message}</span>
|
|
164
|
+ <div class="col-3 px-0 d-flex flex-row text-truncate">
|
|
165
|
+ <input class="form-check-input mr-2" type="checkbox" value="" id="flexCheckDefault">
|
|
166
|
+ <div class="mx-3 w-75 text-truncate">
|
|
167
|
+ <span class="mx-1">${response[i].Subject}</span>
|
|
168
|
+ </div>
|
143
|
169
|
</div>
|
144
|
|
- <div class="col-2 text-truncate">
|
145
|
|
- <span class="mx-1">22 minutes ago</span>
|
|
170
|
+ <div class="col-9 text-truncate d-flex justify-content-between">
|
|
171
|
+ <span class="mx-1 w-mes">${response[i].Message}</span>
|
|
172
|
+ <span class="mx-1 t-sec-min">22 mins</span>
|
146
|
173
|
</div>
|
147
|
174
|
</div>
|
148
|
175
|
</div>
|
|
@@ -156,7 +183,12 @@ function loadData() {
|
156
|
183
|
}
|
157
|
184
|
bdyUI += "</div>";
|
158
|
185
|
$(".bdy-ul").append(bdyUI);
|
159
|
|
-
|
|
186
|
+ $('.sub-nav-item[data-buttonType="inbox"] .length').remove();
|
|
187
|
+ $('.sub-nav-item[data-buttonType="inbox"]').append(
|
|
188
|
+ `<span class="length badge rounded-pill bg-light text-dark ml-auto">${
|
|
189
|
+ $(".item-li").length
|
|
190
|
+ }</span>`
|
|
191
|
+ );
|
160
|
192
|
$(".notifiListItms").on("click", function () {
|
161
|
193
|
let _this = $(this).parents(".item-li");
|
162
|
194
|
let obj = {
|
|
@@ -236,17 +268,15 @@ function loadData() {
|
236
|
268
|
<div class="accordion-header" id="accHeader-${response[i].ReminderId}">
|
237
|
269
|
<div class="tskListItms accordion-button collapsed" data-bs-toggle="collapse" data-bs-target="#collapse-${response[i].ReminderId}" aria-expanded="false" aria-controls="collapseOne">
|
238
|
270
|
<div class="row m-0 w-100 p-0 ">
|
239
|
|
- <div class="col-1 ">
|
240
|
|
- <input class="form-check-input mx-1" type="checkbox" value="" id="flexCheckDefault">
|
241
|
|
- </div>
|
242
|
|
- <div class="col-4 text-truncate">
|
243
|
|
- <span class="mx-1">${response[i].Subject}</span>
|
244
|
|
- </div>
|
245
|
|
- <div class="col-5 text-truncate">
|
246
|
|
- <span class="mx-1">${response[i].Message}</span>
|
|
271
|
+ <div class="col-3 px-0 d-flex flex-row text-truncate">
|
|
272
|
+ <input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
|
|
273
|
+ <div class="mx-3 w-75 text-truncat">
|
|
274
|
+ <span class="mx-1">${response[i].Subject}</span>
|
|
275
|
+ </div>
|
247
|
276
|
</div>
|
248
|
|
- <div class="col-2 text-truncate">
|
249
|
|
- <span class="mx-1">2 seconds</span>
|
|
277
|
+ <div class="col-9 text-truncate d-flex justify-content-between">
|
|
278
|
+ <span class="mx-1 w-mes">${response[i].Message}</span>
|
|
279
|
+ <span class="mx-1 t-sec-min">22 mins</span>
|
250
|
280
|
</div>
|
251
|
281
|
</div>
|
252
|
282
|
</div>
|
|
@@ -303,10 +333,24 @@ function loadData() {
|
303
|
333
|
await createLoad(appName);
|
304
|
334
|
});
|
305
|
335
|
});
|
|
336
|
+
|
|
337
|
+ getData("apis/v4/unibase/reminders/platform/getunreadreminderscount").then(
|
|
338
|
+ function (response) {
|
|
339
|
+ let result = JSON.parse(response.result);
|
|
340
|
+ let count = Number(result.NotificationCount) + Number(result.TasksCount);
|
|
341
|
+ $('[data-buttontype="inbox"] .length').text(count);
|
|
342
|
+ $('[data-notification="count"]').text(count);
|
|
343
|
+ if (count > 40) {
|
|
344
|
+ $('[data-paggtn="true"]').text(`1-40 of ${count}`);
|
|
345
|
+ } else {
|
|
346
|
+ $(".li-pgn").empty();
|
|
347
|
+ }
|
|
348
|
+ }
|
|
349
|
+ );
|
306
|
350
|
}
|
307
|
351
|
function iFrmeWdth() {
|
308
|
352
|
let width = 0,
|
309
|
|
- erwdth = 20;
|
|
353
|
+ erwdth = 32;
|
310
|
354
|
$(".frm-ifre").each(function (i, e) {
|
311
|
355
|
if ($(this).length == 0) {
|
312
|
356
|
erwdth = 0;
|
|
@@ -319,7 +363,7 @@ function iFrmeWdth() {
|
319
|
363
|
}
|
320
|
364
|
function resetwidth() {
|
321
|
365
|
let width = 0,
|
322
|
|
- erwdth = 20;
|
|
366
|
+ erwdth = 32;
|
323
|
367
|
$(".frm-ifre").each(function (i, e) {
|
324
|
368
|
if (i == 0) {
|
325
|
369
|
$(this).css("right", width + "px");
|
|
@@ -342,7 +386,6 @@ export function detailClick() {
|
342
|
386
|
const cookie = getCookie("_idty");
|
343
|
387
|
if (cookie) {
|
344
|
388
|
const {unibaseId, tenantId, userId} = JSON.parse(cookie);
|
345
|
|
- debugger;
|
346
|
389
|
$("#detailIframe").html(
|
347
|
390
|
`<iframe width="100%" style="min-height:calc(100vh - ${$(
|
348
|
391
|
".tp-bar"
|
|
@@ -351,22 +394,82 @@ export function detailClick() {
|
351
|
394
|
}
|
352
|
395
|
});
|
353
|
396
|
}
|
|
397
|
+export function signaRInit() {
|
|
398
|
+ var huburl = _serverUrl() + "notificationhub";
|
|
399
|
+ connection = new window["signalR"].HubConnectionBuilder()
|
|
400
|
+ .withUrl(huburl)
|
|
401
|
+ .build();
|
|
402
|
+ register();
|
|
403
|
+}
|
|
404
|
+export async function register() {
|
|
405
|
+ connection.on("sendnotification", (obj) => {
|
|
406
|
+ $(".ctr-lst-pge .bdy-ul").empty();
|
|
407
|
+ loadData();
|
|
408
|
+ });
|
|
409
|
+ const cookie = getCookie("_idty");
|
|
410
|
+ const {unibaseId, tenantId, userId, sessionId, name} = JSON.parse(cookie);
|
|
411
|
+ let packet = {
|
|
412
|
+ UserId: Number(userId),
|
|
413
|
+ UserName: name,
|
|
414
|
+ UnibaseId: unibaseId,
|
|
415
|
+ TenantId: Number(tenantId),
|
|
416
|
+ SessionId: sessionId,
|
|
417
|
+ };
|
|
418
|
+ try {
|
|
419
|
+ const stringConnection = await connection.start();
|
|
420
|
+ await connection.invoke("Connect", packet);
|
|
421
|
+ } catch (error) {
|
|
422
|
+ console.log(error);
|
|
423
|
+ }
|
|
424
|
+}
|
|
425
|
+
|
|
426
|
+export function resetClckEvnt() {
|
|
427
|
+ $(".ChtAppIfrme").remove();
|
|
428
|
+ $(".lft-nav-bar .lft-nav-bar-2").removeClass("d-none");
|
|
429
|
+ $(".ctr-lst-pge, .rtr-nav-bar").removeClass("d-none");
|
|
430
|
+ $(".lft-nav-bar").css("width", "");
|
|
431
|
+}
|
354
|
432
|
|
355
|
433
|
export function initListIndex() {
|
356
|
434
|
let _userInfo = atob(document.cookie.split("=")[1]);
|
357
|
435
|
let userInfo = " JSON.parse(_userInfo).result";
|
358
|
436
|
let sessionId = "userInfo.sessionId";
|
359
|
|
-
|
|
437
|
+ signaRInit();
|
360
|
438
|
let usrinfoHTML = `<li><a class="dropdown-item" href="javascript:void(0);">${userInfo.name}</a></li>
|
361
|
439
|
<li><a class="dropdown-item" href="javascript:void(0);">Cloud Settings</a></li>
|
362
|
440
|
<li><a class="dropdown-item" href="javascript:void(0);">Help</a></li>
|
363
|
|
- <li><a class="dropdown-item" href="javascript:void(0);">Logoff</a></li>`;
|
|
441
|
+ <li><a class="dropdown-item" href="javascript:void(0);" data-btn="logoff">Logoff</a></li>`;
|
364
|
442
|
$(".icn-circle").text(userInfo?.name?.charAt(0)?.toUpperCase());
|
365
|
443
|
$(".uindtls").html(usrinfoHTML);
|
366
|
|
-
|
|
444
|
+ $('[data-btn="logoff"]').on("click", function () {
|
|
445
|
+ document.cookie = "_idty=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
|
|
446
|
+ window.location = "../login";
|
|
447
|
+ });
|
367
|
448
|
// List Page loading
|
368
|
449
|
|
369
|
450
|
/*Data loading start here*/
|
|
451
|
+ $(".nav-lft-item").on("click", function () {
|
|
452
|
+ $(".nav-lft-item").removeClass("active");
|
|
453
|
+ $(this).addClass("active");
|
|
454
|
+ if ($(this).attr("data-application") != "Chat Application") {
|
|
455
|
+ resetClckEvnt();
|
|
456
|
+ }
|
|
457
|
+ });
|
|
458
|
+ $(".nav-lft-item[data-application='Chat Application']").on(
|
|
459
|
+ "click",
|
|
460
|
+ function () {
|
|
461
|
+ const serverUrl = _serverUrl();
|
|
462
|
+ const cookie = getCookie("_idty");
|
|
463
|
+ const {unibaseId, tenantId, userId} = JSON.parse(cookie);
|
|
464
|
+ $(".lft-nav-bar .lft-nav-bar-2").addClass("d-none");
|
|
465
|
+ $(".ctr-lst-pge, .rtr-nav-bar").addClass("d-none");
|
|
466
|
+ $(".lft-nav-bar").css("width", "var(--rtrWidth)");
|
|
467
|
+ $(".btm-bar .ChtAppIfrme").remove();
|
|
468
|
+ $(".btm-bar").append(`<div class="ChtAppIfrme w-100">
|
|
469
|
+ <iframe class="" style="height:100%; width:100%" data-ispopup="false" src="${serverUrl}#/${unibaseId}/${tenantId}/${userId}/loadChat"></iframe>
|
|
470
|
+ </div>`);
|
|
471
|
+ }
|
|
472
|
+ );
|
370
|
473
|
$(".mnNvIcn").click(function () {
|
371
|
474
|
$(".lft-nav-bar").toggleClass("lft-nav-bar-Wrap");
|
372
|
475
|
$(".ctr-lst-pge").toggleClass("lft-nav-bar-Wrap");
|
|
@@ -388,5 +491,10 @@ export function initListIndex() {
|
388
|
491
|
$(".sub-nav-item").not(".more.active").removeClass("active");
|
389
|
492
|
$(this).addClass("active");
|
390
|
493
|
});
|
391
|
|
- loadData();
|
|
494
|
+
|
|
495
|
+ try {
|
|
496
|
+ loadData();
|
|
497
|
+ } catch (error) {
|
|
498
|
+ console.log("LoadData Method is not loading, and getting error");
|
|
499
|
+ }
|
392
|
500
|
}
|