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.

detailwidgetsplitcolumn.js 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. var Unibase;
  2. (function (Unibase) {
  3. let Themes;
  4. (function (Themes) {
  5. let Compact;
  6. (function (Compact) {
  7. let DetailWidgets;
  8. (function (DetailWidgets) {
  9. class Detailwidgetsplitcolumn extends Unibase.Platform.Core.BaseComponent {
  10. jsFiles() {
  11. return [];
  12. }
  13. cssFiles() {
  14. return [];
  15. }
  16. html(id, containerid) {
  17. debugger;
  18. var title = id[0].WidgetName;
  19. let html = '<section id="widget_details_' + id[0].PortletWidgetId + '" class="card shadow-hover mb-0">' +
  20. '<div id="hf-widget-title_' + id[0].PortletWidgetId + '" class="card-header"><h6>' + title + '</h6></div>' +
  21. '<div class="card-body row mx-0">' +
  22. '<div class="col-sm-12">' +
  23. '<ul class="list-group no-borders list-group-flush" id="widget_details_' + id[0].PortletWidgetId + '_col1" style="list-style-type:disc">' +
  24. '<li class="list-group-item no-borders hidden" id="widget_details_item' + id[0].PortletWidgetId + '_col1"></li>' +
  25. '</ul>' +
  26. '</div>' +
  27. '</div>' +
  28. '</div>' +
  29. '</section>';
  30. return html;
  31. }
  32. load(id, containerid, callback) {
  33. let instance = this;
  34. let inputparameters = Unibase.Themes.Providers.DashboardHelper.Instance().replaceWidgetParameterValues(id[0].WidgetParameters, id[0].InstalledAppId);
  35. let fromDate = "", toDate = "";
  36. var cf_fromDate = Unibase.Platform.Membership.Infos.Identity.currentUser.fromDate;
  37. var cf_toDate = Unibase.Platform.Membership.Infos.Identity.currentUser.toDate;
  38. if (cf_fromDate != null && cf_toDate != null) {
  39. fromDate = cf_fromDate.toString();
  40. toDate = cf_toDate.toString();
  41. }
  42. else {
  43. fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  44. toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
  45. }
  46. var parameters = {
  47. WidgetId: id[0].WidgetId,
  48. PortletWidgetId: id[0].PortletWidgetId,
  49. InstalledAppId: id[0].InstalledAppId,
  50. InputParameters: inputparameters,
  51. FromDate: fromDate,
  52. ToDate: toDate
  53. };
  54. instance.loadData(id[0].PortletWidgetId, containerid, parameters);
  55. }
  56. loadData(portletwidgetid, detailcontainer, parameters) {
  57. debugger;
  58. var instance = this;
  59. Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getDetailWidgetData(parameters).then(function (result) {
  60. if (result.errors != null && result.errors.length > 0) {
  61. $("." + detailcontainer).parent().find(".div_LineLoader").before(`<div id="Bizgaze-messageInfo" class="alert alert-danger mb-0 details_ErrorMsg"><strong>Error! </strong>` + result.message + `</div>`).removeClass("line-loader");
  62. return false;
  63. }
  64. var properties = result.result.DetailWidgetProperties;
  65. var tokenarray = [];
  66. var propertyarray = [];
  67. var HyperLink = [];
  68. var arraylength = 0;
  69. for (var i = 0; i < properties.length; i++) {
  70. var model = properties[i];
  71. var propertyindex = model.PropertyIndex;
  72. if (model.Value != null) {
  73. var token = model.Value.replace(/\s/g, "");
  74. }
  75. tokenarray.push(token);
  76. propertyarray.push(propertyindex);
  77. HyperLink.push(model.HyperLink);
  78. arraylength = arraylength + 1;
  79. }
  80. if (arraylength % 2 === 0) {
  81. arraylength = arraylength;
  82. }
  83. else {
  84. arraylength = arraylength + 1;
  85. }
  86. var arrayindex = (arraylength);
  87. var slicedarray = tokenarray.splice(0, arrayindex);
  88. var propertyslice = propertyarray;
  89. for (var k = 0; k < propertyarray.length; k++) {
  90. var replace = slicedarray[k];
  91. var data = result.result.Data[0];
  92. var templateScript = Handlebars.compile(replace);
  93. let token1 = Unibase.Core.Helpers.PropertyHelper.Instance().replace(replace, data);
  94. for (var i = 0; i < token1.split("|").length; i++) {
  95. var token2 = token1.split("|")[i];
  96. if (token2 == "" || token2 == "null" || token2 == "Invalid date" || token2 == "1900/01/01" || token2 == "01/01/1900" || token2 == "[object Object]" || token2 == " " || token2 == "01/01/0001" || token2 == "0001/01/01" || token2 == "<p><br></p>") {
  97. token2 = "NA";
  98. }
  99. if (result.result.Js != null || result.result.Js != "") {
  100. eval(result.result.Js);
  101. }
  102. if (HyperLink[propertyslice[k]] != null && HyperLink[propertyslice[k]] != "") {
  103. var HL = Unibase.Core.Helpers.TokenHelper.Instance().replace(HyperLink[propertyslice[k]], data);
  104. var href = "javascript:;";
  105. var target = "";
  106. if (HyperLink[propertyslice[k]].includes('href')) {
  107. var target = "target='_blank'";
  108. href = HyperLink[propertyslice[k]].replace(/href=/, '');
  109. HL = '';
  110. }
  111. token2 = '<a href=' + href + ' ' + target + ' onclick="' + HL + '"><font class="text-ul">' + token2 + '</font></a>';
  112. }
  113. let list1 = `<li class="list-group-item no-borders Singlecolumn-NoBorder-listgroup-item Singlecolumn-NoBorder-listgroup-addeditem m-t-lg p-2 li-${propertyslice[k]}" style="border: none;display:list-item"> ${token2} </div></div></li>`;
  114. $('#widget_details_item' + portletwidgetid + '_col1:last').before(list1);
  115. }
  116. }
  117. });
  118. $('.' + detailcontainer).siblings('.line-loader').remove();
  119. $('.' + detailcontainer).removeClass('hidden');
  120. }
  121. static Instance() {
  122. if (this.instance === null || this.instance === undefined)
  123. this.instance = new Detailwidgetsplitcolumn();
  124. return this.instance;
  125. }
  126. }
  127. DetailWidgets.Detailwidgetsplitcolumn = Detailwidgetsplitcolumn;
  128. })(DetailWidgets = Compact.DetailWidgets || (Compact.DetailWidgets = {}));
  129. })(Compact = Themes.Compact || (Themes.Compact = {}));
  130. })(Themes = Unibase.Themes || (Unibase.Themes = {}));
  131. })(Unibase || (Unibase = {}));