123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- var Unibase;
- (function (Unibase) {
- let Themes;
- (function (Themes) {
- let Compact;
- (function (Compact) {
- let DetailWidgets;
- (function (DetailWidgets) {
- class Detailwidgetsplitcolumn extends Unibase.Platform.Core.BaseComponent {
- jsFiles() {
- return [];
- }
- cssFiles() {
- return [];
- }
- html(id, containerid) {
- debugger;
- var title = id[0].WidgetName;
- let html = '<section id="widget_details_' + id[0].PortletWidgetId + '" class="card shadow-hover mb-0">' +
- '<div id="hf-widget-title_' + id[0].PortletWidgetId + '" class="card-header"><h6>' + title + '</h6></div>' +
- '<div class="card-body row mx-0">' +
- '<div class="col-sm-12">' +
- '<ul class="list-group no-borders list-group-flush" id="widget_details_' + id[0].PortletWidgetId + '_col1" style="list-style-type:disc">' +
- '<li class="list-group-item no-borders hidden" id="widget_details_item' + id[0].PortletWidgetId + '_col1"></li>' +
- '</ul>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</section>';
- return html;
- }
- load(id, containerid, callback) {
- let instance = this;
- let inputparameters = Unibase.Themes.Providers.DashboardHelper.Instance().replaceWidgetParameterValues(id[0].WidgetParameters, id[0].InstalledAppId);
- let fromDate = "", toDate = "";
- var cf_fromDate = Unibase.Platform.Membership.Infos.Identity.currentUser.fromDate;
- var cf_toDate = Unibase.Platform.Membership.Infos.Identity.currentUser.toDate;
- if (cf_fromDate != null && cf_toDate != null) {
- fromDate = cf_fromDate.toString();
- toDate = cf_toDate.toString();
- }
- else {
- fromDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
- toDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(new Date(Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate()), "YYYY/MM/DD");
- }
- var parameters = {
- WidgetId: id[0].WidgetId,
- PortletWidgetId: id[0].PortletWidgetId,
- InstalledAppId: id[0].InstalledAppId,
- InputParameters: inputparameters,
- FromDate: fromDate,
- ToDate: toDate
- };
- instance.loadData(id[0].PortletWidgetId, containerid, parameters);
- }
- loadData(portletwidgetid, detailcontainer, parameters) {
- debugger;
- var instance = this;
- Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getDetailWidgetData(parameters).then(function (result) {
- if (result.errors != null && result.errors.length > 0) {
- $("." + 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");
- return false;
- }
- var properties = result.result.DetailWidgetProperties;
- var tokenarray = [];
- var propertyarray = [];
- var HyperLink = [];
- var arraylength = 0;
- for (var i = 0; i < properties.length; i++) {
- var model = properties[i];
- var propertyindex = model.PropertyIndex;
- if (model.Value != null) {
- var token = model.Value.replace(/\s/g, "");
- }
- tokenarray.push(token);
- propertyarray.push(propertyindex);
- HyperLink.push(model.HyperLink);
- arraylength = arraylength + 1;
- }
- if (arraylength % 2 === 0) {
- arraylength = arraylength;
- }
- else {
- arraylength = arraylength + 1;
- }
- var arrayindex = (arraylength);
- var slicedarray = tokenarray.splice(0, arrayindex);
- var propertyslice = propertyarray;
- for (var k = 0; k < propertyarray.length; k++) {
- var replace = slicedarray[k];
- var data = result.result.Data[0];
- var templateScript = Handlebars.compile(replace);
- let token1 = Unibase.Core.Helpers.PropertyHelper.Instance().replace(replace, data);
- for (var i = 0; i < token1.split("|").length; i++) {
- var token2 = token1.split("|")[i];
- 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>") {
- token2 = "NA";
- }
- if (result.result.Js != null || result.result.Js != "") {
- eval(result.result.Js);
- }
- if (HyperLink[propertyslice[k]] != null && HyperLink[propertyslice[k]] != "") {
- var HL = Unibase.Core.Helpers.TokenHelper.Instance().replace(HyperLink[propertyslice[k]], data);
- var href = "javascript:;";
- var target = "";
- if (HyperLink[propertyslice[k]].includes('href')) {
- var target = "target='_blank'";
- href = HyperLink[propertyslice[k]].replace(/href=/, '');
- HL = '';
- }
- token2 = '<a href=' + href + ' ' + target + ' onclick="' + HL + '"><font class="text-ul">' + token2 + '</font></a>';
- }
- 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>`;
- $('#widget_details_item' + portletwidgetid + '_col1:last').before(list1);
- }
- }
- });
- $('.' + detailcontainer).siblings('.line-loader').remove();
- $('.' + detailcontainer).removeClass('hidden');
- }
- static Instance() {
- if (this.instance === null || this.instance === undefined)
- this.instance = new Detailwidgetsplitcolumn();
- return this.instance;
- }
- }
- DetailWidgets.Detailwidgetsplitcolumn = Detailwidgetsplitcolumn;
- })(DetailWidgets = Compact.DetailWidgets || (Compact.DetailWidgets = {}));
- })(Compact = Themes.Compact || (Themes.Compact = {}));
- })(Themes = Unibase.Themes || (Unibase.Themes = {}));
- })(Unibase || (Unibase = {}));
|