Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

userdesignnotificationwidget.js 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Themes;
  13. (function (Themes) {
  14. let Compact;
  15. (function (Compact) {
  16. let Components;
  17. (function (Components) {
  18. class NotificationWidget extends Unibase.Platform.Core.BaseComponent {
  19. load(id, containerid, callback) {
  20. var instance = this;
  21. }
  22. jsFiles() {
  23. return ['tenants/themes/compact/components/notifications/userdesignnotificationwidget.js'];
  24. }
  25. cssFiles() {
  26. return [];
  27. }
  28. html(id, containerid) {
  29. var instance = this;
  30. let html = ``;
  31. return html;
  32. }
  33. init(containerid) {
  34. return __awaiter(this, void 0, void 0, function* () {
  35. let instance = this;
  36. yield instance.loadnotificationDetails(containerid);
  37. yield instance.loadReminders(null, containerid);
  38. });
  39. }
  40. loadnotificationDetails(containerid) {
  41. let instance = this;
  42. let html = `<div class="card mb-0 border-0 BindData_` + containerid + ` findcontainer h-100" style="background:0 0">
  43. <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 + `">
  44. <div class="card-header-top line-loader-container p-relative">
  45. <div class=line-loader></div>
  46. <div id=div_ErrorMessage class=form-error-message style=margin-left:-5px;z-index:100></div>
  47. <div class="d-flex align-items-center biz-highlight-bg-color widget-font text-truncate">Notifications</div>
  48. </div>
  49. </div>
  50. <div class="card-body px-1 py-0 border-removed border-white-removed show userDesignWidgetCardBody simple-scroll-bar" id="Viewer_` + containerid + `" data-iscollapseapplied=false>
  51. <ul class="UserdesignNotifiactionDetails" id="UserdesignNotifiactionDetails"></ul>
  52. </div>
  53. <div class="border-0 card-footer d-flex justify-content-center position-sticky pt-10 z-index-2 bg-white ">
  54. <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>
  55. </div>
  56. </div>`;
  57. $('#' + containerid).html(html);
  58. if (screen.width > 1120) {
  59. $('#' + containerid).find(".userDesignWidgetCardBody").css("height", "308px");
  60. }
  61. }
  62. loadReminders(tabview, count) {
  63. return __awaiter(this, void 0, void 0, function* () {
  64. let remindertype = Unibase.Platform.Communications.Enums.ReminderType.Notification;
  65. return yield Unibase.Platform.Communications.Managers.ReminderManager.Instance().getReminders(remindertype, 10).then(function (response) {
  66. let html = "";
  67. if (response.length != '' || response.length != 0) {
  68. for (let i = 0; i < response.length; i++) {
  69. let createformid = 0, installedappid = 0, refid = 0;
  70. if (response[i].RedirectOptions == null || response[i].RedirectOptions == undefined) {
  71. installedappid = response[i].InstalledAppId;
  72. refid = response[i].RefId;
  73. }
  74. else {
  75. createformid = response[i].RedirectOptions.CreateFormId;
  76. installedappid = response[i].RedirectOptions.InstalledAppId;
  77. refid = response[i].RedirectOptions.RefId;
  78. }
  79. let ReminderUrl = response[i].ReminderUrl;
  80. let IconUrl = response[i].IconUrl;
  81. if (IconUrl == undefined || IconUrl == null) {
  82. IconUrl = "tenants/themes/compact/imgs/defaultnotification.png";
  83. }
  84. if (IconUrl == "") {
  85. IconUrl = "tenants/themes/compact/imgs/notification.png";
  86. }
  87. let ReminderId = response[i].ReminderId;
  88. if (ReminderUrl == "") {
  89. ReminderUrl = null;
  90. }
  91. html = `<div class="rem-item-wrap notification_card widget-card p-0">
  92. <div class="d-flex w-100">
  93. <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">
  94. <div class="d-flex w-100">
  95. <div class="flex-grow-1 overflow-hide">
  96. <div class="notifications-text word-break">
  97. <div class="d-flex justify-content-between align-items-center">
  98. <div class="w-60p p-2 mr-1 flex-shrink-0">
  99. <img src="${IconUrl}" data-dynamic="1" onerror="ReloadImage(event)" class="img-fluid" data-loaded="0">
  100. </div>
  101. <div class="w-90">
  102. <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>
  103. <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>
  104. </div>
  105. <span>
  106. </div>
  107. </div>
  108. <div>
  109. </div>
  110. </div>
  111. </div>
  112. </a>
  113. </div>
  114. </div>`;
  115. $(".UserdesignNotifiactionDetails").append(html);
  116. }
  117. }
  118. else {
  119. let emptyhtml = `<div class="card-body text-center h-295p px-0">
  120. <div class="biz-custom-scrollbar" style="height: -webkit-fill-available;">
  121. <img src="tenants/themes/compact/imgs/notification.png" onerror="ReloadImage(event)" class="h-125p w-125p">
  122. <p class="text-dark my-1 font-weight-600">You don't have any Notifications yet.</p>
  123. <p class="font-14">Will notify you when Something arrives'</p>
  124. </div>
  125. </div>
  126. `;
  127. $(".UserdesignNotifiactionDetails").html(emptyhtml);
  128. }
  129. $(".notification_click").click(function () {
  130. $(this).parents(".notification_card").remove();
  131. if ($(".UserdesignNotifiactionDetails").html().length == 0) {
  132. let emptyhtml = `<div class="card-body text-center">
  133. <img src="tenants/themes/compact/imgs/notification.png" onerror="ReloadImage(event)" class="h-125p w-125p">
  134. <p class="text-dark my-1 font-weight-600">You don't have any Notifications yet.</p>
  135. <p class="font-14">Will notify you when Something arrives'</p>
  136. </div>`;
  137. $(".UserdesignNotifiactionDetails").html(emptyhtml);
  138. }
  139. });
  140. });
  141. });
  142. }
  143. static Instance() {
  144. if (this.instance === undefined)
  145. this.instance = new NotificationWidget();
  146. return this.instance;
  147. }
  148. }
  149. Components.NotificationWidget = NotificationWidget;
  150. })(Components = Compact.Components || (Compact.Components = {}));
  151. })(Compact = Themes.Compact || (Themes.Compact = {}));
  152. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  153. })(Unibase || (Unibase = {}));