var Unibase; (function (Unibase) { let Themes; (function (Themes) { let Compact; (function (Compact) { let KpiWidgets; (function (KpiWidgets) { class TwoValue extends Unibase.Platform.Core.BaseComponent { jsFiles() { return []; } cssFiles() { return []; } html(id, containerid) { let title = id[0].WidgetName; let html = '
' + ' ' + '
' + '' + title + '' + '' + '' + '' + '' + '' + '
' + '000000' + '000
' + '
' + '
'; 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.loadResponseData(id[0].PortletWidgetId, containerid, parameters); } loadResponseData(portletwidgetid, detailContainer, parameters) { let instance = this; instance.inputParameters = parameters.InputParameters; Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getKpiWidgetData(parameters).then(function (response) { instance.loadData(portletwidgetid, detailContainer, parameters, false, response); }); } loadData(portletwidgetid, detailcontainer, parameters, IsPreview, response) { detailcontainer = '.' + detailcontainer; var post = response.result; if (post != null) { if (post.IsMaximize == true) { $("#kpi_FullScreen_" + portletwidgetid).removeClass("hidden"); } if (post.Data == null || post.Data == "" || post.Data == '[]') { $(detailcontainer).find("#kpi_Twovalue_1_" + portletwidgetid).removeClass('display-6'); $(detailcontainer).find("#kpi_Twovalue_1_" + portletwidgetid).addClass('display-8'); $(detailcontainer).find("#kpi_Twovalue_1_" + portletwidgetid).text("No Data"); } else { var data = JSON.parse(post.Data)[0]; var selected_values = post.Selected_Columns; if (selected_values != null) { var sp = selected_values.split(','); var column1 = sp[0]; var column2 = sp[1]; } var Value_1 = data[column1]; var Value_2 = data[column2]; if (isNaN(Value_1)) { } else { Value_1 = Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(Value_1, 2); } $(detailcontainer).find("#kpi_Twovalue_1_" + portletwidgetid).text(Value_1); $(detailcontainer).find("#kpi_Twovalue_2_" + portletwidgetid).text(Value_2); if (post.Icon != "" || post.Icon != null) { let iconhtml = ''; $("#span_kpi_icon_" + portletwidgetid).html(iconhtml); } } var color = post.Color; if (post.Color != "" && post.Color != null) { $(detailcontainer).find("#kpi_Twovalue_1_" + portletwidgetid).addClass("text-" + color); } var colors = ["primary", "success", "warning", "danger", "info", "light", "secondary", "dark"]; if (response.result.AppConfigurations != null) { if (response.result.AppConfigurations.length != 0) { var designhtml = ""; var appconfig = response.result.AppConfigurations; for (var i = 0; i < appconfig.length; i++) { var onlickurl = ""; var sname = appconfig[i].SettingName.replace(/ /g, ''); designhtml += ' ' + '' + ' '; } designhtml += ""; $(detailcontainer).find("#config_widget_" + portletwidgetid).html(designhtml); } } if (response.result.ReportId == 0 || response.result.ReportId == null) { $(detailcontainer).find("#showreport_" + portletwidgetid).addClass("hidden"); } if (post.LinkReportId != 0 && post.LinkReportId != null) { } else { $(detailcontainer).find("#showreport_" + portletwidgetid).addClass('hidden'); } } $(detailcontainer).siblings('.line-loader').remove(); $(detailcontainer).removeClass('hidden'); } linkReport(widgetid, portletwidgetid, containerid) { var instance = this; Unibase.Platform.Widgets.Managers.WidgetManager.Instance().getKPIWidget(widgetid).then(function (response) { var res = response.result; if (res != null) { let containerid = "div_kpireport_" + portletwidgetid; var rv_obj = Unibase.Platform.Analytics.Components.ReportViewer.Instance(); instance.navigationHelper.popup(res.LinkReportId, containerid, rv_obj, null, Unibase.Platform.Helpers.Size.ExtraLarge); } }); } static Instance() { if (this.instance === null || this.instance === undefined) this.instance = new TwoValue(); return this.instance; } } KpiWidgets.TwoValue = TwoValue; })(KpiWidgets = Compact.KpiWidgets || (Compact.KpiWidgets = {})); })(Compact = Themes.Compact || (Themes.Compact = {})); })(Themes = Unibase.Themes || (Unibase.Themes = {})); })(Unibase || (Unibase = {}));