123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989 |
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Themes;
- (function (Themes) {
- let Compact;
- (function (Compact) {
- let Components;
- (function (Components) {
- class Dashboard extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this.firstLoad = true;
- this.filterClickBtn = true;
- this.jsindex = 0;
- this.htmlindex = 0;
- this.evalExecuted = 0;
- this._bizgaze_core_activeinstalledappId = 0;
- this._bizgaze_core_activeportletid = 0;
- this._dashboard_first_load = 0;
- }
- jsFiles() {
- return ["platform/bundle/dashboard.min.js"];
- }
- cssFiles() {
- return [];
- }
- html(id, containerid) {
- var _a;
- let width = $(window).width(), mx;
- if (width <= 576) {
- mx = 'mx-2';
- }
- else {
- mx = 'mx-20';
- }
- let isRestrictHidden = '', isSupportHidden = '';
- if (Unibase.Platform.Membership.Infos.Identity.currentUser.isRestrictedUser == true) {
- isRestrictHidden = 'd-none';
- }
- let isSupportHeader = window.location.hash;
- if (isSupportHeader.includes('ticket')) {
- isSupportHidden = 'd-none';
- }
- var html = `<input type="hidden" id="hf_DashboardPortletId" value="" />
- <input type="hidden" id="hf_DashboardPortletName" value="0" />
- <input type="hidden" id="hf_PortletId" />
- <input type="hidden" id="hf_App_DefaultWidgetId" value="0" />
- <input type="hidden" id="hf_AppUniqueId" value="0" />
- <div class="biz-db-header pt-10 pb-2 pb-sm-15 px-sm-0 ${mx} invisible" id="bizDbHeader">
- <div class="db-top-header d-flex justify-content-between align-items-center position-relative px-0 pb-5" id="dbTopHeader"><div class="db-header-left dashboard-tab d-flex align-items-center w-85">
- <div class="d-flex align-items-center biz-highlight-bg-color text-truncate biz-dropdown db-dropdown-wrap">
- <span id="lblDbGroup_Title" class="db-group-title font-20 font-weight-600 font-sm-20 text-truncate ${isSupportHidden}">No Dashboards</span><a class="dp-toggle-icon btn btn-icon btn-flush-biz-theme btn-rounded flush-soft-hover d-xl-none flex-shrink-0 ${isRestrictHidden}" href="javascript:;" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="btn-icon-wrap"><i class="fa fa-caret-down"></i></span></a>
- <div class="dropdown-menu biz-custom-dropdown biz-custom-scrollbar biz-db-groups-dropdown" id="dbGroupsDropdownMenu"><ul id="dbGroupsDropdownList" class="custom-dropdown-body biz-custom-scrollbar db-groups-dropdown-list row mx-0"></ul></div>
- </div>
- </div>
- <div class="db-header-right d-flex align-items-center" id="dbHeaderRight"><div class="dashboard-fav exclude-tab"><a href="javascript:;" class="biz-highlight-bg-color ml-10" onclick="bizgaze.extensions.web.themes.compact.nav.setAsFavorite();" id="Biz_favorite"><span class="glyphicon glyphicon-heart"></span></a><a href="javascript:;" class="hidden ml-10" id="Biz_Unfavorite" onclick="bizgaze.extensions.web.themes.compact.nav.removeFromFavorite();"><span class="glyphicon glyphicon-heart"></span></a>
- </div>
- <a id="filter_toggle_btn${containerid}" class="btn btn-outline-light border d-flex align-items-center rounded biz-highlight-bg-color common-filter-dp-btn line-height-0 order-last ${isRestrictHidden}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-tooltip="true" title="Common Filters"><i class="la la-filter font-weight-700" style="height:auto"></i></a>
- <div class="dropdown-menu biz-custom-dropdown biz-common-filter-dropdown" id="bizCmnFilterDp_${containerid}" onclick="event.stopPropagation();"><div class="cmn-filter-content-wrap position-relative"><div class="custom-dropdown-body biz-custom-scrollbar row mx-0 common-filter-dropdown-body cmn-filters-body" id="dynamic-filters${containerid}"></div><div class="common-filter-footer mt-10" id="commonfilter_footerbuttons${containerid}"></div><div class="cmn-filter-errmsg text-center d-none" id="cmnFilterErrMsg_${containerid}"><p class="text-danger">No Filters Found!</p><a class="btn btn-outline-primary btn-sm mt-10" href="javascript:;" id="btnCreateCommonFilter" onclick="Unibase.Platform.Analytics.Components._CommonFilter.Instance().loadCommonFilterForm(0)">Create Filter</a></div><a href="javascript:;" class="btn btn-icon btn-flush-biz-theme btn-rounded flush-soft-hover h-30p w-30p shadow cmn-filter-panel-pin d-none" id="cmnFilterPanelPin_${containerid}" onclick="Unibase.Themes.Compact.Components.Dashboard.Instance().loadCommonFilterPanel('${containerid}');" data-tooltip="true" title="Pin Filters"><span class="btn-icon-wrap"><i class="las la-thumbtack font-18"></i></span></a></div></div>
- <div class="admin-user-only d-none d-xl-block mr-10">
- <div class="btn-group dropdown dashboard-setting-dp ${!((_a = this.currentUser) === null || _a === void 0 ? void 0 : _a.isAdmin) ? 'd-none' : ''}" id="dashboardSettingsDp">
- <a class="btn btn-outline-light border d-flex align-items-center rounded biz-highlight-bg-color line-height-0 dashboard-settings-btn" data-tooltip="true" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" href="javascript:void(0);" data-tooltip="true" title="Dashboard Settings"><i class="la la-cog"></i></a>
- <div class="dropdown-menu">
- <a class="dropdown-item" href="javascript:;" onclick="Unibase.Themes.Compact.Components.Nav.Instance().addWidget()"><i class="la la-pencil mr-1"></i>Edit Dashboard</a>
- <a class="dropdown-item " href="javascript:;" onclick="Unibase.Themes.Compact.Components.Nav.Instance().manageDashboards()" ><i class="la la-newspaper-o mr-1"></i>Manage Dashboard</a>
- </div></div></div>
- </div></div>
- <div class="layout-dashboard-tab" id="layout-dashboard-tabs">
- <div class="dashboard-tab card-header-filters" id="card-header-filters${containerid}">
- <ul class="biz-report-filters dashboard-options-list" id="filters-list${containerid}"></ul>
- <a href="javascript:;" class="filter-left-icon filter-nav-icon biz-highlight-bg-color hidden" onclick="Unibase.Themes.Compact.Components.Nav.Instance().changeFilterScroll(this,'${containerid}')" data-operation="-"><i class="fa fa-chevron-left"></i></a>
- <a href="javascript:;" class="filter-right-icon filter-nav-icon biz-highlight-bg-color hidden" onclick="Unibase.Themes.Compact.Components.Nav.Instance().changeFilterScroll(this,'${containerid}')" data-operation="+"><i class="fa fa-chevron-right"></i></a>
- </div>
- </div>
- <div class="dashboardfooter hidden" id="dashboardfooter">
- <a class="btn btn-outline-primary bg-white dashboardcreatewidgetbtn mr-10" href="javascript:;" id="AddWidget_btnCreateWidget" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().createWidget(` + id + `)">Create Widget</a>
- <div class="Dashboard_SaveChanges pull-right">
- <a href="javascript:;" class="btn btn-outline-danger mr-10" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().loadportlet();">Close</a>
- <a href="javascript:;" class="btn btn-primary" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().SaveScreen();" data-dismiss="modal">Save changes</a>
- <a class="btn btn-sm btn-success hidden" href="javascript:;" data-toggle="modal" data-target="#SaveEditScreen" onclick="Unibase.Themes.Compact.Components.Dashboard.Instance().confirmSave();" id="AddWidget_btnSelectWidget">Done</a>
- </div></div>
- </div>
- <div id="dashboardwidget-container-outer" class="px-0 flex-grow-1 overflow-auto"><div data-simplebar class="simple-scroll-bar container-fluid scrollable pb-15 px-0" id="dashboardwidget-container-scroll"><div id="dashboardwidget-container" class="row dashboardwidget-container px-2 px-sm-2 px-md-20 px-lg-20 mx-0 mx-sm-1" data-id="dashboardwidget-container"></div></div>
- </div>`;
- return html;
- }
- load(id, containerid, callback) {
- Unibase.Platform.Helpers.FileCacheHelper.Instance().addCacheFiles([
- "tenants/themes/compact/widgets/kpiwidgets/manager/kpimanager.js", "tenants/themes/compact/widgets/kpiwidgets/manager/interfaces/ikpimanager.js", "tenants/themes/compact/widgets/reportwidgets/default.js", "tenants/themes/compact/widgets/kpiwidgets/default.js", "tenants/themes/compact/widgets/detailwidgets/default.js", "tenants/themes/compact/widgets/detailwidgets/singledata.js", "tenants/themes/compact/widgets/detailwidgets/singlecolumn.js", "tenants/themes/compact/widgets/detailwidgets/singlecolumn_noborder.js", "tenants/themes/compact/widgets/kpiwidgets/comparision.js", "tenants/themes/compact/widgets/kpiwidgets/icon.js", "tenants/themes/compact/widgets/kpiwidgets/valuewithpercentage.js", "tenants/themes/compact/widgets/kpiwidgets/twovalue.js", "tenants/themes/compact/widgets/reportwidgets/withnoheaderandfooter.js", "platform/widgets/components/widgetpermission.js", "tenants/themes/compact/widgets/kpiwidgets/twovaluebgcolor.js", "tenants/themes/compact/widgets/kpiwidgets/valuewithpercentagebgcolor.js", "tenants/themes/compact/widgets/kpiwidgets/twovaluecenterline.js", "tenants/themes/compact/widgets/kpiwidgets/owlcarouselslider.js", "tenants/themes/compact/widgets/kpiwidgets/valuewithpercentageprogressbar.js", "tenants/themes/compact/widgets/kpiwidgets/kpi_fulfillment.js", "tenants/themes/compact/widgets/kpiwidgets/carouselslider.js", "tenants/themes/compact/widgets/kpiwidgets/carouselsliderbgcolor.js", "platform/analytics/components/reportviewer/reportviewer.js", "tenants/themes/compact/widgets/detailwidgets/customdesign.js", "tenants/themes/compact/widgets/kpiwidgets/comparisionrightbarcolor.js", "tenants/themes/compact/widgets/kpiwidgets/comparisionbottombarcolor.js", "tenants/themes/compact/widgets/kpiwidgets/singlevalueborder.js", "tenants/themes/compact/widgets/kpiwidgets/twovaluebottombarcolor.js", "tenants/themes/compact/widgets/kpiwidgets/singlevaluepiechart.js", "tenants/themes/compact/widgets/kpiwidgets/iconbgcolor.js", "tenants/themes/compact/widgets/kpiwidgets/iconcolor.js", "tenants/themes/compact/widgets/kpiwidgets/iconleftbarcolor.js", "tenants/themes/compact/components/dashboard/walkthrough.js"
- ]);
- let instance = this;
- if ($(window).outerWidth() <= 575) {
- $("#dashboardwidget-container-outer").css("margin-left", "-15px").css("margin-right", "-15px");
- $("#dashboardwidget-container-scroll").removeClass("px-0");
- }
- $(`#filter_toggle_btn${containerid}`).click(function () {
- if ($(`#bizCmnFilterDp_${containerid}`).hasClass('show')) {
- return;
- }
- let portleId = Number($("#hf_PortletId").val());
- Unibase.Platform.Analytics.Components._CommonFilter.Instance().commonFilter(portleId, containerid);
- });
- $(document).on("click", ".daterangepicker", function (e) {
- e.stopPropagation();
- });
- $('#dbHeaderRight').on('shown.bs.dropdown', function () {
- if ($(this).hasClass('show')) {
- $(`#filter_toggle_btn${containerid}`).find('.la-filter').removeClass('la-filter').addClass('la-times');
- }
- });
- $('#dbHeaderRight').on('hide.bs.dropdown', function () {
- $(`#filter_toggle_btn${containerid}`).find('.la-times').removeClass('la-times').addClass('la-filter');
- });
- Unibase.Platform.Analytics.Components._CommonFilter.Instance().commonFilter(0, containerid);
- if (isMobileApp()) {
- eval(`jquerySwipeHandler.handleSwipe("#dashboardwidget-container-outer", [jquerySwipeHandler.SWIPE_LEFT, jquerySwipeHandler.SWIPE_RIGHT], function (direction) {
- if(direction == 'SWIPE_LEFT' || direction == 'SWIPE_RIGHT'){
- Unibase.Themes.Compact.Components.Dashboard.Instance().DashBoardSwipe(direction);
- }
- });`);
- }
- }
- init(containerid) {
- }
- loadDashboard(dashboardid, containerid, callback) {
- var instance = this;
- }
- loadCreateDashboard() {
- var instance = this;
- instance.fileCacheHelper.loadJsFile('platform/dashboards/components/createdashboard.js', function () {
- instance.navigationHelper.popup(0, "", Unibase.Platform.Dashboards.Components.CreateDashboard.Instance(), null, Unibase.Platform.Helpers.Size.DockLeft);
- });
- }
- confirmSave() {
- var html = '<div class="modal fade" id="SaveEditScreen" tabindex="-1" role="dialog" aria-labelledby="SaveEditScreenLabel" style="display: none;" aria-hidden="true">' +
- '<div class="modal-dialog" role = "document" >' +
- '<div class="modal-content">' +
- '<div class="modal-header d-none">' +
- '<h5 class="modal-title" id="SaveEditScreenLabel"></h5>' +
- '<button type="button" class="close" data-dismiss="modal" aria-label="Close">' +
- '<span aria-hidden="true">×</span>' +
- '</button>' +
- '</div>' +
- '<div class="modal-body">' +
- '<p>Do you want to Save Changes?</p >' +
- '</div>' +
- '<div class="modal-footer">' +
- '<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>' +
- '<button type="button" class="btn btn-secondary" data-dismiss="modal" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().loadportlet()">Discard Changes</button>' +
- '<button type="button" class="btn btn-primary" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().SaveScreen(true)" data-dismiss="modal">Save changes</button>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div >';
- $("#_bizgaze_modal").before(html);
- $("#SaveEditScreen").modal();
- }
- sortportletWidgets(a, b) {
- const sortA = a.PortletWidgetId;
- const sortB = b.PortletWidgetId;
- let comparison = 0;
- if (sortA > sortB) {
- comparison = 1;
- }
- else if (sortA < sortB) {
- comparison = -1;
- }
- return comparison;
- }
- loadWidgetData(portletWidgetdata) {
- let data;
- if (portletWidgetdata != undefined) {
- data = portletWidgetdata.sort(this.sortStructureWidgets);
- }
- if (data != null && data != undefined) {
- var html = "";
- var instance = this;
- var datalength = data.length;
- var isFirstTime = true;
- for (let i = 0; i < datalength; i++) {
- var model = data[i];
- var widgetUrl = model.WidgetUrl;
- var Width = model.Width;
- var WidgetName = "";
- if (model.DisplayText == "" || model.displayText == null) {
- WidgetName = model.WidgetName;
- }
- else {
- WidgetName = model.DisplayText;
- }
- var IsFiltarable = model.IsFilterable;
- var filterhtml = "";
- if (IsFiltarable == null || IsFiltarable == false || IsFiltarable == "") {
- filterhtml = "hidden";
- }
- var widgetdata = '<div class="widgetdataHere w-100 mb-2 mb-sm-15 widgetid-' + model.WidgetId + '" id ="widgetid-' + model.WidgetId + '" data-strctwidgetindex="' + model.StrctWidgetIndex + '" data-boxid="' + model.StructureDesignId + '"><div class="rounded portlet dashboardwidget-item dashboardwidget-addeditem widgetItem-' + model.PortletWidgetId + ' widgetid-' + model.WidgetId + '" id=' + model.WidgetId + '>' +
- '<div class="Border bg-transparent mb-1 mb-sm-3" >' +
- '<div class="Border1 hidden">' +
- '<div class="editwidget card-action-wrap editwidget-' + model.WidgetId + ' pull-right m-t-sm m-r-lg" id="editwidget">' +
- '<a href="javascript:;" data-tooltip="true" title="Edit Widget" onclick="Unibase.Themes.Compact.Components.Dashboard.Instance().EditWidget(' + model.WidgetId + ',' + 0 + ',' + model.PortletWidgetId + ')" ><i class="ti-pencil text-info mr-3" id = "EditWidget-' + model.PortletWidgetId + '" ></i></a>' +
- '<a href="javascript:;" id="WidgetSettings-' + model.PortletWidgetId + '" data-tooltip="true" title="Settings" ><i class="ti-settings mr-3" id = "EditWidget-' + model.PortletWidgetId + '"></i></a>' +
- '<a href = "javascript:;" data-tooltip="true" title="Permissions" onclick = "Unibase.Themes.Compact.Components.Dashboard.Instance().ShowWidgetPermissions(' + model.PortletWidgetId + ')";><i class="ti-key mr-2" id = "ShowWidgetPermissions-' + model.PortletWidgetId + '"></i></a>' +
- '<a href="javascript:;" data-tooltip="true" title="delete widget" onclick="Unibase.Platform.Widgets.Components.Widget.Instance().deletePortletWidgets(' + model.PortletWidgetId + ')"> <i class="ti-trash text-danger mr-2" id = "EditWidget-' + model.PortletWidgetId + '"></i></a>' +
- '<a href="javascript:;" title = "Export Widget" onclick = "Unibase.Platform.Widgets.Components.Widget.Instance().exportWidgetByWidgetId(' + model.WidgetId + ')" > <i class="fa fa-download text-info mr-2" id = "ExportWidget-' + model.PortletWidgetId + '" > </i></a >' +
- '</div>' +
- '<div class="dragWidget dargwidget-' + model.WidgetId + ' pull-left" id="dragWidget">' +
- '<a class="pull-left btn btn-sm">' +
- '<i class="ti-fullscreen"></i>' +
- '</a>' +
- '</div>' +
- '</div>' +
- '<input type="hidden" id="hf_widgetId" value="' + model.WidgetId + '" />' +
- '<input type="hidden" id="hf_widgetId_' + model.WidgetId + '" value="' + model.WidgetId + '" />' +
- '<input type="hidden" id="hf_widgetName_' + model.PortletWidgetId + '" value="' + WidgetName + '" />' +
- '<input type="hidden" id="hf_widgetUniqueId_' + model.PortletWidgetId + '" value="' + model.UniqueId + '" />' +
- '<input type="hidden" class="hf_portletwidgetId" id="hf_portletwidgetId" value="' + model.PortletWidgetId + '" />' +
- '<input type="hidden" class="hf_portletwidgetheight" id="hf_portletwidgetheight" value="' + model.PortletWidgetHeight + 'px" />' +
- '<input type="hidden"id="hf_PortletId" value="' + model.PortletId + '"/>';
- if (model.WidgetLayoutName == 'KPI') {
- widgetdata += '<div class="bg-white d-block position-relative h-90p line-loader"></div><div id="div_dashboardportletwidget_' + model.PortletWidgetId + '" class="widgetsstructure hidden div_dashboardwidget_' + model.PortletWidgetId + ' div_dashboardportletwidget_' + model.PortletWidgetId + '" />';
- }
- else {
- widgetdata += '<div id="div_dashboardportletwidget_' + model.PortletWidgetId + '" class="widgetsstructure div_dashboardwidget_' + model.PortletWidgetId + ' div_dashboardportletwidget_' + model.PortletWidgetId + '" />';
- }
- widgetdata += '</div></div></div></div>';
- let afterchild, beforechild;
- if ($('#structureId_' + model.StructureDesignId).length != 0) {
- if (model.StrctWidgetIndex == 1 || model.StrctWidgetIndex == 0) {
- $('#structureId_' + model.StructureDesignId).find('.widgetplace').first().prepend(widgetdata);
- }
- else {
- afterchild = model.StrctWidgetIndex - 1;
- beforechild = model.StrctWidgetIndex + 1;
- if (($('#structureId_' + model.StructureDesignId + ' .widgetplace').find('[data-strctwidgetindex="' + afterchild + '"][data-boxid="' + model.StructureDesignId + '"]').length) > 0) {
- $('#structureId_' + model.StructureDesignId + ' .widgetplace').find('[data-strctwidgetindex="' + afterchild + '"][data-boxid="' + model.StructureDesignId + '"]').after(widgetdata);
- }
- else if (($('#structureId_' + model.StructureDesignId + ' .widgetplace').find('[data-strctwidgetindex="' + beforechild + '"][data-boxid="' + model.StructureDesignId + '"]').length) > 0) {
- $('#structureId_' + model.StructureDesignId + ' .widgetplace').find('[data-strctwidgetindex="' + beforechild + '"][data-boxid="' + model.StructureDesignId + '"]').before(widgetdata);
- }
- else if (model.StrctWidgetIndex < Number($('#structureId_' + model.StructureDesignId + ' [data-boxid="' + model.StructureDesignId + '"]').attr('data-strctwidgetindex'))) {
- $('#structureId_' + model.StructureDesignId + ' [data-boxid="' + model.StructureDesignId + '"]').before(widgetdata);
- }
- else if (model.StrctWidgetIndex > Number($('#structureId_' + model.StructureDesignId + ' [data-boxid="' + model.StructureDesignId + '"]').attr('data-strctwidgetindex'))) {
- $('#structureId_' + model.StructureDesignId + ' [data-boxid="' + model.StructureDesignId + '"]').after(widgetdata);
- }
- else {
- $('#structureId_' + model.StructureDesignId + ' .widgetplace').append(widgetdata);
- }
- }
- }
- else {
- $('[data-divstructureid="default-structure"]').find('.widgetplace').append(widgetdata);
- }
- var StrWidgetID = '.widgetdataHere.widgetid-' + model.WidgetId + '';
- var FindStrutreLength = $(StrWidgetID).length;
- if (FindStrutreLength >= 2) {
- $('#dashboardwidget-container .widgetdataHere.widgetid-' + model.WidgetId + '').not(':last').remove();
- }
- $(widgetdata).addClass("mb-2");
- $(".structureToDelete .structureToDelete").find(".PaddingMoveRight").addClass("p-0 pr-1").removeClass("p-1");
- $(".structureToDelete .structureToDelete").find(".PaddingMoveLeft").addClass("p-0 pl-1").removeClass("p-1");
- $(".structureToDelete .structureToDelete").find(".PaddingMoveX").addClass("p-0 px-1").removeClass("p-1");
- $(".structureToDelete ").find(".PaddingMoveRight").addClass("p-0 pr-1").removeClass("p-1");
- $(".structureToDelete ").find(".PaddingMoveLeft").addClass("p-0 pl-1").removeClass("p-1");
- $(".structureToDelete ").find(".PaddingMoveX").addClass("p-0 px-1").removeClass("p-1");
- $("#deleteWidget-" + model.PortletWidgetId).click(function () {
- instance.fileCacheHelper.loadJsFile("platform/widgets/components/widget.js", function () {
- Unibase.Platform.Widgets.Components.Widget.Instance().deletePortletWidgets(model.PortletWidgetId);
- });
- });
- }
- var _fileCacheHelper = this.fileCacheHelper;
- this.models = data;
- this.jsindex = 0;
- this.htmlindex = 0;
- this.evalExecuted = 0;
- instance.evaluateJs(data);
- $("#section_bizgaze_main").removeClass("hidden");
- }
- }
- ShowWidgetPermissions(PortletWidgetId) {
- var instance = this;
- $('.btn_addportlt').addClass('hidden');
- $('.btnEdit_portlet').addClass('hidden');
- $('.manage_pPermissions').addClass('hidden');
- $('.btn_dltportlet').addClass('hidden');
- instance.navigationHelper.popup(0, "", Unibase.Platform.Widgets.Components.WidgetPermission.Instance(), function () {
- $("#chkIsWidgetViewable").change(function () {
- Unibase.Platform.Widgets.Components.WidgetPermission.Instance().setViewable();
- });
- Unibase.Platform.Widgets.Components.WidgetPermission.Instance().showPermissions(PortletWidgetId, 'widget', Unibase.Platform.Widgets.WidgetHiddenFields.Instance().unix_pwid);
- }, Unibase.Platform.Helpers.Size.Medium);
- }
- EditWidget(Wid, x, PortletWidgetId, isFromAddWidget) {
- var instance = this;
- $(".biz-submenu").css({ "z-index": "1040" });
- $(".biz-layout-3-left-nav").css({ "z-index": "1040" });
- $(".toplayout-structures-panel").css({ "z-index": "1040" });
- instance.fileCacheHelper.loadJsFile("platform/widgets/components/widget.js", function () {
- Unibase.Platform.Widgets.Components.Widget.Instance().loadWidgetData(Wid, 0, true, PortletWidgetId, isFromAddWidget);
- });
- }
- filterStructures(data, containerid, parentId) {
- let myStructures, instance = this;
- let VisibleContainerId = Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId();
- if (VisibleContainerId.includes('_viewall')) {
- VisibleContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 2];
- }
- $('#' + VisibleContainerId).find('#' + containerid).attr({ 'data-isedit': 'false' });
- if (!parentId) {
- var myStructuresSort = data.filter(structure => structure.ParentId == 0);
- }
- else {
- var myStructuresSort = data.filter(structure => structure.ParentId == parentId);
- }
- if (myStructuresSort.length)
- myStructures = myStructuresSort.sort(this.sortStructureWidgets);
- let width, innerHtml = '', outerHtml = '', ParentDiv, binding, mobileWidth = [], tabWidth = [], _tabWidth = '', _mobileWidth = '', desktopPdng = '', tabPdng = '', MobilePdng = '';
- if (myStructures != undefined) {
- for (var i = 0; i < myStructures.length; i++) {
- if (myStructures[i].ParentId == 0) {
- ParentDiv = containerid;
- outerHtml = '<div class="d-flex flex-wrap structureToDelete w-100 structureDiv" data-divstructureid=' + myStructures[i].StructureId + ' data-clone="clonestruct" data-parent=' + ParentDiv + ' id="divStructure_' + myStructures[i].ParentId + '-' + myStructures[i].StructureId + '-' + myStructures[i].StructureVIndex + '" data-isEdit="false" data-strctwidgetindex=' + myStructures[i].StrctWidgetIndex + ' data-boxid="' + myStructures[i].ParentId + '" data-ParentIndex="' + myStructures[i].ParentId + '"></div>';
- if (myStructures[i].StructureHIndex == 0) {
- $('#' + VisibleContainerId).find('#' + ParentDiv).append(outerHtml);
- }
- }
- else {
- ParentDiv = 'structureId_' + myStructures[i].ParentId;
- outerHtml = '<div class="d-flex flex-wrap structureToDelete w-100 structureDiv" data-divstructureid=' + myStructures[i].StructureId + ' data-clone="clonestruct" data-parent="' + ParentDiv + '" id="divStructure_' + myStructures[i].ParentId + '-' + myStructures[i].StructureId + '-' + myStructures[i].StructureVIndex + '" data-isEdit="false" data-strctwidgetindex=' + myStructures[i].StrctWidgetIndex + ' data-boxid="' + myStructures[i].ParentId + '" data-ParentIndex="' + myStructures[i].ParentId + '"></div>';
- if (myStructures[i].StructureHIndex == 0) {
- $('#' + VisibleContainerId).find('#structureId_' + myStructures[i].ParentId).find('.widgetplace ').first().append(outerHtml);
- }
- }
- width = myStructures[i].StructureWidth.split('|'), _mobileWidth = '', _tabWidth = '';
- let desktopWidth = width[myStructures[i].StructureHIndex];
- if (myStructures[i].StructureMobileWidth != '' && myStructures[i].StructureMobileWidth != null && myStructures[i].StructureMobileWidth != undefined) {
- mobileWidth = myStructures[i].StructureMobileWidth.split('|');
- if (mobileWidth == null || mobileWidth[myStructures[i].StructureHIndex] == '' || mobileWidth[myStructures[i].StructureHIndex] == '0' || mobileWidth[myStructures[i].StructureHIndex] == undefined) {
- _mobileWidth = '';
- }
- else {
- _mobileWidth = ' col-' + mobileWidth[myStructures[i].StructureHIndex] + ' col-xs-' + mobileWidth[myStructures[i].StructureHIndex] + ' col-sm-' + mobileWidth[myStructures[i].StructureHIndex];
- }
- }
- if (myStructures[i].StructureTabWidth != '' && myStructures[i].StructureTabWidth != null && myStructures[i].StructureTabWidth != undefined) {
- tabWidth = myStructures[i].StructureTabWidth.split('|');
- if (tabWidth == null || tabWidth[myStructures[i].StructureHIndex] == '' || tabWidth[myStructures[i].StructureHIndex] == '0' || tabWidth[myStructures[i].StructureHIndex] == undefined) {
- _tabWidth = '';
- }
- else {
- _tabWidth = ' col-md-' + tabWidth[myStructures[i].StructureHIndex] + ' col-lg-' + tabWidth[myStructures[i].StructureHIndex];
- }
- }
- desktopPdng = instance.pdng_Algn(myStructures[i].StructureWidth, myStructures[i].StructureHIndex, "Desktop", myStructures[i].StrctWidgetIndex);
- tabPdng = instance.pdng_Algn(myStructures[i].StructureTabWidth, myStructures[i].StructureHIndex, "Tab", myStructures[i].StrctWidgetIndex);
- MobilePdng = instance.pdng_Algn(myStructures[i].StructureMobileWidth, myStructures[i].StructureHIndex, "Mobile", myStructures[i].StrctWidgetIndex);
- innerHtml = '<div class="' + _mobileWidth + ' ' + _tabWidth + ' col-xl-' + desktopWidth + ' droppablePlaceCol ui-sortable-handle ' + desktopPdng + ' ' + tabPdng + ' ' + MobilePdng + '" data-isblock="1" data-structureindex="' + myStructures[i].StructureHIndex + '" data-parent="divStructure_' + myStructures[i].ParentId + '-' + myStructures[i].StructureId + '-' + myStructures[i].StructureVIndex + '" id="structureId_' + myStructures[i].StructureDesignId + '" data-mobile_settingwidth="' + myStructures[i].StructureMobileWidth + '" data-tab_settingwidth="' + myStructures[i].StructureTabWidth + '" data-parentIndex="' + myStructures[i].ParentId + '"><div class="blocks-droppable-items-place ui-sortable-handle widgetplace ui-sortable" id="12"></div></div>';
- if (myStructures[i].StructureHIndex == 0) {
- binding = 'divStructure_' + myStructures[i].ParentId + '-' + myStructures[i].StructureId + '-' + myStructures[i].StructureVIndex;
- $('#' + VisibleContainerId).find('#divStructure_' + myStructures[i].ParentId + '-' + myStructures[i].StructureId + '-' + myStructures[i].StructureVIndex).append(innerHtml);
- }
- else {
- $('#' + VisibleContainerId).find('#' + binding).append(innerHtml);
- }
- }
- myStructures.forEach(structure => {
- this.filterStructures(data, containerid, structure.StructureDesignId);
- });
- }
- }
- pdng_Algn(width, HIndex, resolution, WSIndex) {
- let instance = this, padding;
- let curIndex = instance.padding(width, HIndex, WSIndex);
- if (resolution == "Desktop") {
- if (width != '') {
- if (curIndex == 0) {
- padding = 'px-xl-0';
- }
- if (curIndex == 1) {
- padding = 'pl-xl-0 pr-xl-10';
- }
- if (curIndex == 2) {
- padding = 'px-xl-10';
- }
- if (curIndex == 3) {
- padding = 'pl-xl-10 pr-xl-0';
- }
- }
- else {
- padding = 'px-xl-0';
- }
- }
- if (resolution == "Tab") {
- if (width != '') {
- if (curIndex == 0) {
- padding = 'px-lg-0 px-md-0';
- }
- if (curIndex == 1) {
- padding = 'pl-md-0 pr-md-10 pl-lg-0 pr-lg-10';
- }
- if (curIndex == 2) {
- padding = 'px-lg-10 px-md-10';
- }
- if (curIndex == 3) {
- padding = 'pl-md-10 pr-md-0 pl-lg-10 pr-lg-0';
- }
- }
- else {
- padding = 'px-md-0 px-lg-0';
- }
- }
- if (resolution == "Mobile") {
- if (width != '') {
- if (curIndex == 0) {
- padding = 'px-0 px-sm-0';
- }
- if (curIndex == 1) {
- padding = 'pl-0 pr-10 pl-sm-0 pr-sm-10';
- }
- if (curIndex == 2) {
- padding = 'px-10 px-sm-10';
- }
- if (curIndex == 3) {
- padding = 'pl-10 pr-0 pl-sm-10 pr-sm-0';
- }
- }
- else {
- padding = 'px-0 px-sm-0';
- }
- }
- return padding;
- }
- padding(width, AcutalIndex, WSIndex) {
- let ElmntWidth = width.split('|'), currentIndex, breakIndex, breakarray = [], _breakarray = [], isBreak = false, sumWidth = ElmntWidth.reduce((x, y) => parseInt(x) + parseInt(y), 0), preBreakIndex = [], sliceWidth = ElmntWidth.slice(0, AcutalIndex + 1), _sliceWidth, _sumSliceWidth, sumSliceWidth = sliceWidth.reduce((x, y) => parseInt(x) + parseInt(y), 0);
- if (parseInt(ElmntWidth[AcutalIndex]) == 12) {
- currentIndex = 0;
- }
- else {
- if (sumSliceWidth < 12 && AcutalIndex == 0) {
- currentIndex = 1;
- }
- if (sumSliceWidth < 12 && AcutalIndex != 0) {
- currentIndex = 2;
- }
- if (sumSliceWidth == 12) {
- currentIndex = 3;
- }
- if (sumSliceWidth > 12) {
- if (parseInt(ElmntWidth[AcutalIndex]) == 12) {
- currentIndex = 0;
- }
- else {
- currentIndex = 1;
- for (let i = 0; i < ElmntWidth.length; i++) {
- breakarray.push(parseInt(ElmntWidth[i]));
- let sumbreakarray = breakarray.reduce((x, y) => parseInt(x) + parseInt(y), 0);
- if (sumbreakarray > 12 && !isBreak) {
- isBreak = true;
- breakIndex = i;
- preBreakIndex.push({ "breakIndex": breakIndex, "isBreak": isBreak, "AcutalIndex": AcutalIndex });
- }
- }
- _sliceWidth = ElmntWidth.slice((breakIndex), (AcutalIndex + 1));
- _sumSliceWidth = _sliceWidth.reduce((x, y) => parseInt(x) + parseInt(y), 0);
- if (_sumSliceWidth < 12 && AcutalIndex == breakIndex) {
- currentIndex = 1;
- }
- if (_sumSliceWidth < 12 && AcutalIndex != breakIndex) {
- currentIndex = 2;
- }
- if (_sumSliceWidth == 12) {
- currentIndex = 3;
- }
- if (_sumSliceWidth > 12) {
- currentIndex = 1;
- isBreak = false;
- for (let k = 0; k < _sliceWidth.length; k++) {
- _breakarray.push(parseInt(_sliceWidth[k]));
- let sumbreakarray = _breakarray.reduce((x, y) => parseInt(x) + parseInt(y), 0);
- if (sumbreakarray > 12 && !isBreak) {
- isBreak = true;
- breakIndex = k;
- preBreakIndex.push({ "breakIndex": breakIndex, "isBreak": isBreak, "AcutalIndex": AcutalIndex });
- }
- }
- _sliceWidth = _sliceWidth.slice((breakIndex), (AcutalIndex + 1));
- _sumSliceWidth = _sliceWidth.reduce((x, y) => parseInt(x) + parseInt(y), 0);
- if (_sumSliceWidth < 12 && _sliceWidth.length == 1) {
- currentIndex = 1;
- }
- if (_sumSliceWidth < 12 && _sliceWidth.length != 1) {
- currentIndex = 2;
- }
- if (_sumSliceWidth == 12) {
- currentIndex = 3;
- }
- }
- }
- }
- }
- return currentIndex;
- }
- sortStructureWidgets(a, b) {
- const sortA = a.StrctWidgetIndex;
- const sortB = b.StrctWidgetIndex;
- let comparison = 0;
- if (sortA > sortB) {
- comparison = 1;
- }
- else if (sortA < sortB) {
- comparison = -1;
- }
- return comparison;
- }
- navigationClickEvent(dashboards, groupid, dashboardOptionList, dashboardId) {
- const instance = this;
- const modalContainerId = instance.navigationHelper.getLastContainerId();
- let optionTemplate = Components.Nav_Template.Instance().DashboardItemTemplate();
- $('li.li-dashboard-item.active-item').removeClass('active-item');
- $('.liDashboardGroup_' + groupid).addClass('active-item');
- let groupTitle = dashboards[0].DashboardGroupName;
- $('#lblDbGroup_Title').text(groupTitle);
- const dbOptionEl = $(dashboardOptionList);
- dbOptionEl.html('');
- dashboards.forEach(function (dashboard, index) {
- let context = dashboard;
- let optiontemplatescript = Handlebars.compile(optionTemplate);
- let optionhtml = optiontemplatescript(context);
- dbOptionEl.append(optionhtml);
- });
- let filterEl;
- if (dashboardId) {
- filterEl = dbOptionEl.find(`#filterItem_${dashboardId}`);
- }
- else {
- filterEl = dbOptionEl.find('.filter-item').first();
- }
- filterEl.addClass("active");
- if (filterEl.attr('data-pincmnfilters') === 'true') {
- instance.loadCommonFilterPanel(modalContainerId);
- }
- if (groupTitle == "") {
- $('#lblDbGroup_Title').text($(`.liDashboardGroup_${groupid} .nav-link`).first().text());
- }
- Unibase.Themes.Compact.Components.Nav.Instance().removeToolTipForFilterItem(dbOptionEl);
- $('.biz-wrapper').removeClass('biz__nav__toggle');
- $('.biz-nav-fullwidth').addClass('hidden');
- }
- loadDashboards(dashboards, dashboardId, IsEvent) {
- const instance = this;
- if (IsEvent) {
- var groupid = dashboards[0].DashboardGroupId, dashboardOptionList = '.dashboard-options-list';
- this.navigationClickEvent(dashboards, groupid, dashboardOptionList, dashboardId);
- }
- $(".layout-dashboard-tabs").removeClass('hidden');
- $(".layout-dashboard-tabs").find('.filter-nav-icon').addClass('hidden');
- if (dashboards.length == 0) {
- $(".layout-dashboard-tabs .tab-addeditem").empty();
- $("#dashboardwidget-container").empty();
- }
- else {
- var html = "";
- $(".tab-addeditem").remove();
- if (this._bizgaze_core_activeinstalledappId != 0) {
- this._bizgaze_core_activeportletid = 0;
- }
- this._bizgaze_core_activeinstalledappId = 0;
- if (dashboardId) {
- this._bizgaze_core_activeportletid = dashboardId;
- }
- var firstdashboardid = this._bizgaze_core_activeportletid;
- var firstdashboardname = "";
- $("#layout-dashboard-tabs").find('.dashboard-tab').first().before(html);
- if (firstdashboardid == 0) {
- var dashboard = dashboards[0];
- var dashboardId = dashboard.DashboardId;
- var dashboardName = dashboard.DashboardName;
- firstdashboardid = dashboardId;
- firstdashboardname = dashboardName;
- }
- $(".tabid-" + firstdashboardid).find(".nav-link").addClass("active");
- this._bizgaze_core_activeportletid = firstdashboardid;
- if (firstdashboardid != 0 && this.firstLoad) {
- this.firstLoad = false;
- let dbContainerId = instance.navigationHelper.getLastContainerId();
- let rvInsArray = Unibase.Platform.Helpers.NavigationHelper.reportViewerInstance.filter(x => x.parentcontainerid == dbContainerId);
- let cmnFilIns = Unibase.Platform.Analytics.Components._CommonFilter.Instance();
- cmnFilIns.appliedFilters = [];
- for (var i = 0; i < rvInsArray.length; i++) {
- rvInsArray[i].instance.inputParameters = [];
- rvInsArray[i].instance.Filter = [];
- rvInsArray[i].instance.dynamicFilters = [];
- }
- cmnFilIns.cascadingFilters = [];
- cmnFilIns.selectedCommonFilters = [];
- cmnFilIns.commonFilter(0, dbContainerId);
- if (!Unibase.Themes.Compact.Components.Nav.Instance().isDshboardBck) {
- Unibase.Themes.Compact.Components.Nav.Instance().isDshboardBckArray.push({
- "DashbaordId": firstdashboardid, "DashboardName": firstdashboardname, "isBack": "Dashboard"
- });
- }
- else {
- Unibase.Themes.Compact.Components.Nav.Instance().isDshboardBck = false;
- }
- this.loadWidgets(firstdashboardid, firstdashboardname);
- }
- $("#collapsed").find("a").removeClass("nav-link").addClass("h-30p");
- $("#div-layout-report").addClass('hidden');
- }
- }
- loadWidgets(portalid, portletName) {
- if ($('.dashboard-options-list .filter-item.active').length) {
- $('.dashboard-options-list .filter-item.active').removeClass('active');
- $(`.dashboard-options-list #filterItem_${portalid}`).addClass('active');
- $(`#nav-dashboards .ligrp-item.active-item`).removeClass('active-item');
- $(`#nav-dashboards .UlItem_${portalid}`).addClass('active-item');
- }
- $(".tabid-" + portalid).find(".nav-link").addClass("active");
- $("#hfLayout_InstalledPageId").val(0);
- $("#hf_DashboardPortletId").val(portalid);
- $("#hf_DashboardPortletName").val(portletName);
- $("#hf_PortletId").val(portalid);
- $("#Stage").removeClass('hidden');
- $(".EditPortlets").addClass('hidden');
- $(".Detail_Configurations").removeClass('hidden');
- $(".portletmenu-addeditem").remove();
- $("#AddPortlet").addClass("hidden");
- $("#SavePortlet").addClass("hidden");
- $("#chkLayout_PortletsSelector").addClass("hidden");
- $("#layout-list").hide();
- $("#layout-dashboard").show();
- $("#layout-report").hide();
- this._bizgaze_core_activeportletid = portalid;
- $("#dashboard-title").html(portletName);
- $("#txt_global_search").val('');
- $("#txt_global_clearSearch").addClass("hidden");
- var instance = this;
- if (this._dashboard_first_load == 0) {
- if ($('.skelton_loader').length == 0) {
- let skelHtml = '<div class="skelton_loader biz-secondary-color position-absolute px-2 px-sm-15 px-md-20 w-100 z-index-10">';
- skelHtml += Unibase.Themes.Compact.Components.Nav_Template.Instance().skelTonDashboardStructure();
- skelHtml += '</div>';
- $("#bizDbHeader").after(skelHtml);
- if (window.innerWidth < 575) {
- $('.skelton_loader').removeClass('px-2');
- }
- }
- $(".dashboardwidget-container").html("");
- $(".dashboardwidget-container").addClass('invisible');
- Unibase.Platform.Portlets.Managers.PortletManager.Instance().getPortletStructureDesign(portalid).then(function (response) {
- return __awaiter(this, void 0, void 0, function* () {
- var data = response.result;
- if (data.length == 0) {
- let VisibleContainerId = Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds[Unibase.Platform.Helpers.NavigationHelper.ModalContainerIds.length - 1];
- let divStructure = 'divStructure_' + Math.floor(Math.random() * Date.now());
- let boxId = 'structureId_' + Math.floor(Math.random() * Date.now());
- let html = `<div class="d-flex flex-wrap structureToDelete w-100 structureDiv" data-divstructureid="default-structure" data-clone="clonestruct" data-parent="dashboardwidget-container" id="${divStructure}" data-isedit="true" data-strctwidgetindex="0" data-parentindex="0"> <div class="col-lg-12 droppablePlaceCol ui-sortable-handle px-md-0 px-0" data-isblock="1" data-structureindex="0" data-parent="${divStructure}" id="${boxId}" data-mobile_settingwidth="" data-tab_settingwidth="" data-parentindex="0"> <div class="blocks-droppable-items-place ui-sortable-handle widgetplace ui-sortable d-flex flex-wrap" id="12"></div></div></div>`;
- $('#' + VisibleContainerId).find('.dashboardwidget-container').html(html);
- Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
- }
- else {
- if (data != null) {
- yield instance.filterStructures(data, 'dashboardwidget-container');
- yield Unibase.Platform.Portlets.Managers.PortletManager.Instance().getPortletWidgets(portalid, 0).then(function (response) {
- return __awaiter(this, void 0, void 0, function* () {
- var data = response.result;
- yield instance.loadWidgetData(data);
- });
- });
- $('#dashboardwidget-container-scroll').css('background-color', 'unset');
- yield instance.navigationHelper.hideLoading();
- }
- else {
- return MessageHelper.Instance().showError(response.message, 'bizgaze_message');
- }
- }
- });
- });
- }
- if (this._dashboard_first_load == 1)
- this._dashboard_first_load = 0;
- this.Biz_FavoriteStatus();
- this.trackPortlet(portalid);
- }
- DashBoardSwipe(direction) {
- let VisibleContainerId = Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId();
- const dbFiltersEl = $(`#${VisibleContainerId} .dashboard-options-list`);
- const filtersLength = dbFiltersEl.find('.filter-item').length;
- let activeIndex = dbFiltersEl.find('.filter-item.active').index();
- if (direction == 'SWIPE_RIGHT') {
- let pos = activeIndex < 1 ? filtersLength - 1 : activeIndex - 1;
- dbFiltersEl.find('.filter-link').eq(pos).trigger('click');
- }
- if (direction == 'SWIPE_LEFT') {
- let pos = activeIndex < filtersLength - 1 ? activeIndex + 1 : 0;
- dbFiltersEl.find('.filter-link').eq(pos).trigger('click');
- }
- }
- Biz_FavoriteStatus() {
- var installedPageaId = $('#hfLayout_InstalledPageId').val();
- var portletId = $('#hf_DashboardPortletId').val();
- if (installedPageaId == 0 && portletId !== null) {
- var url = "/api/v3/Portlets/UserPortletStatus/" + portletId;
- }
- }
- trackPortlet(portletid) {
- var url = "/api/v3/Portlets/SavePortletTrack/" + portletid;
- }
- evaluateJs(data) {
- var currentinstance = this, url;
- this.evalExecuted = 1;
- let k = 0;
- var staticfileaarry = [];
- var staticwidetfiles = data.filter(function (o) { return o.WidgetUrl !== '' && o.WidgetUrl !== null; });
- if (staticwidetfiles != null && staticwidetfiles != '') {
- for (var i = 0; i < staticwidetfiles.length; i++) {
- var staticjs = staticwidetfiles[i].WidgetUrl.split(',');
- staticfileaarry.push(staticjs[0]);
- }
- }
- currentinstance.fileCacheHelper.loadJsFiles(staticfileaarry, function () {
- for (const model of data) {
- let containerid = "div_dashboardportletwidget_" + model.PortletWidgetId;
- if (model.WidgetUrl != null && model.WidgetUrl != '') {
- url = model.WidgetUrl.split(',');
- currentinstance.fileCacheHelper.loadJsFile(url[0], function () {
- eval(url[1] + '.init("' + containerid + '")');
- });
- }
- else {
- if (model != null) {
- if (model.StaticJsPath != null) {
- var instance1 = eval(model.StaticJsPath);
- }
- if (model.Js != null) {
- if (model.JsPath != null && model.Js != "") {
- currentinstance.fileCacheHelper.loadJsFile(model.JsPath, function () {
- var instance = eval(model.Js);
- var wclist = [];
- var wc = instance;
- var DetailContainerId = currentinstance._dashboard_container;
- wclist.push({ PortletWidgetId: model.PortletWidgetId, WidgetId: model.WidgetId, WidgetParameters: model.Parameter, WidgetName: model.WidgetName, InstalledAppId: 0, DetailContainerId: DetailContainerId, StaticJsPath: model.StaticJsPath, ReportId: model.ReportId, StructureDesignId: 'structureId_' + model.StructureDesignId, IsFilterable: model.IsFilterable, WidgetDesignName: model.WidgetDesignName, CustomHtml: model.CustomHtml });
- currentinstance.navigationHelper.loadSection(wclist, containerid, instance, null, null);
- });
- }
- }
- }
- }
- k++;
- if (k == data.length) {
- if (Unibase.Themes.Compact.Components.Index.Instance().isIframe) {
- Unibase.Themes.Compact.Components.Nav.Instance().loadChat();
- $("#bizgaze_body").removeClass('invisible');
- }
- if (Unibase.Platform.Membership.Infos.Identity.currentUser.tenant.isLoggedIn != undefined && !Unibase.Platform.Membership.Infos.Identity.currentUser.tenant.isLoggedIn) {
- Unibase.Themes.Compact.Components.Nav.Instance().wizard();
- }
- else {
- let array = Unibase.Platform.Membership.Infos.Identity.currentUser.settings.filter(function (x) { return x.settingName == "isloginfirsttime"; });
- if (array.length != 0) {
- if (array[0].settingValue != undefined && array[0].settingValue == true) {
- currentinstance.appTourGuide();
- }
- }
- }
- }
- }
- });
- }
- replaceWidgetParameterValues(Parameter, Installedappid) {
- let installedappid = Installedappid;
- let ReplaceText = [];
- if (Parameter != "" && Parameter != null) {
- let identityparameter = [];
- let appparameter = [];
- let Parameters = Parameter.split('|');
- if (Parameters.length > 0) {
- let len = Parameters.length;
- for (let i = 0; i < Parameters.length; i++) {
- if (Parameters[i].includes('identity_'))
- identityparameter.push(Parameters[i]);
- else
- appparameter.push(Parameters[i]);
- }
- }
- if (identityparameter.length > 0) {
- for (let x = 0; x < identityparameter.length; x++) {
- let split = identityparameter[x].split(':');
- ReplaceText.push({
- Key: split[0],
- Value: (Unibase.Themes.Compact.Components.Dashboard.inputparameters[split[2].split('_')[1]]).toString(),
- DataType: split[4]
- });
- }
- }
- if (appparameter.length > 0) {
- for (let x = 0; x < appparameter.length; x++) {
- let split = appparameter[x].split(':');
- if (split[3] == 2) {
- ReplaceText.push({
- Key: split[0],
- Value: split[2],
- DataType: split[4]
- });
- }
- else {
- if (installedappid != 0) {
- for (let obj of Unibase.Themes.Compact.Components.Details.inputparameters) {
- if (obj.Key === "hf_" + installedappid + "_" + split[2])
- ReplaceText.push({
- Key: split[0],
- Value: obj.Value.toString(),
- DataType: obj.DataType.toString()
- });
- }
- }
- }
- }
- }
- }
- return ReplaceText;
- }
- loadIdentity() {
- var identityinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
- var keys = Object.keys(identityinfo);
- for (let i = 0; i < keys.length; i++) {
- let val = identityinfo[keys[i]];
- Unibase.Themes.Compact.Components.Dashboard.inputparameters[keys[i]] = val;
- }
- }
- exportPortlet(portletId) {
- var instance = this;
- if (portletId == 0) {
- portletId = $("#hf_PortletId").val();
- portletId = Number(portletId);
- }
- instance.fileCacheHelper.loadJsFile("platform/dashboards/managers/dashboardmanager.js", function () {
- Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
- Unibase.Platform.Dashboards.Managers.DashboardManager.Instance().getDashboard(portletId).then(function (portletresponse) {
- if (portletresponse.result != null && portletresponse.result != undefined) {
- Unibase.Platform.Dashboards.Managers.DashboardManager.Instance().exportPortlet(portletId).then((response) => {
- if (response.status == Unibase.Data.Status.Error) {
- instance.navigationHelper.hideLoading();
- MessageHelper.Instance().showError(response.message, "divBizgaze_MessagesPlaceholder");
- }
- else if (response.result != null && response.result != undefined && portletresponse.result != null && portletresponse.result != undefined) {
- var filename = portletresponse.result.DashboardName + " - Dashboard.xml";
- var xmltext = response.result;
- var pom = document.createElement('a');
- var bb = new Blob([xmltext], { type: 'text/plain' });
- pom.setAttribute('href', window.URL.createObjectURL(bb));
- pom.setAttribute('download', filename);
- pom.dataset.downloadurl = ['text/plain', pom.download, pom.href].join(':');
- pom.draggable = true;
- pom.classList.add('dragout');
- pom.click();
- Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
- }
- });
- }
- });
- });
- }
- appTourGuide() {
- let instance = this;
- var _fileCacheHelper = Unibase.Platform.Helpers.FileCacheHelper.Instance();
- _fileCacheHelper.loadCssFile("libs/tourguide/tour.min.css", null);
- _fileCacheHelper.loadJsFiles(["libs/tourguide/tour.min.js", "tenants/themes/compact/components/dashboard/walkthrough.js"], function () {
- let layouts = Unibase.Platform.Membership.Infos.Identity.getCurrentUser().settings.filter(function (o) { return o.settingName === "themeobj"; });
- let type, data = [];
- let JSONdata = JSON.parse(layouts[0].settingValue.layoutSettings.settingValue);
- let LayoutName = layouts[0].settingValue.layoutName.replace(/\s/g, '');
- if (Unibase.Themes.Providers.DetailHelper.installedAppId == 0) {
- let detailContid = 'card-header-filters' + Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId();
- let listContid = 'filters-list' + Unibase.Platform.Helpers.NavigationHelper.Instance().getLastContainerId();
- if ($('#' + listContid).length == 1 && $('#' + detailContid).length == 1 && $('#' + detailContid).hasClass('dashboard-tab')) {
- type = `Unibase.Themes.Compact.Components.WalkThrough.Instance().${LayoutName}()`;
- data = eval(type);
- }
- else if ($('#' + listContid).length == 1) {
- type = `Unibase.Themes.Compact.Components.WalkThrough.Instance().app()`;
- data = eval(type);
- }
- }
- else if (Unibase.Themes.Providers.DetailHelper.installedAppId != 0) {
- type = `Unibase.Themes.Compact.Components.WalkThrough.Instance().details()`;
- data = eval(type);
- }
- if (JSONdata.dashboards.IsEnabled == false) {
- data.splice(data.findIndex(obj => obj.title == 'DashBoard'), 1);
- }
- if (JSONdata.apps.IsEnabled == false) {
- data.splice(data.findIndex(obj => obj.title == "Apps"), 1);
- }
- if (JSONdata.reports.IsEnabled == false) {
- data.splice(data.findIndex(obj => obj.title == "Reports"), 1);
- }
- let _data = JSON.stringify(data);
- let script = '';
- script += `window.tour = new Tour({
- padding: 0,
- nextText: 'More',
- doneText: 'Finito',
- prevText: 'Less',
- tipClasses: 'tip-class active',
- steps:${_data}
- });
- $('#bizgaze_body').css('pointer-events', 'none').find('.hk-wrapper').css('z-index','0');
- tour.override('showStep', function(self, step) {
- self(step);
- $('.ttour-header').addClass('d-flex justify-content-between align-items-center').find('h1').addClass('list-item-main-title');
- $('.ttour-header').append('<a href="javascript:;" onclick="tour.end()" title="skip" class="btn btn-flush-biz-theme btn-icon btn-rounded flush-soft-hover"><span class="btn-icon-wrap"><i class="fa fa-fast-forward" ></span></i></a>');
- $('.ttour-footer button').addClass('btn btn-flush-biz-theme btn-icon btn-rounded flush-soft-hover shadow-none');
- $('.ttour-footer .next').html('<span class="btn-icon-wrap" title="Next"><i class="font-20 la la-angle-right"></i></span>')
- $('.ttour-footer .prev').html('<span class="btn-icon-wrap" title="Prev"><i class="font-20 la la-angle-left"></i></span>')
- $('.ttour-bullets').append('<span>(<span class="current_step"></span> Of <span class="total_steps"></span>)</span>');
- let noOfSteps = $('.ttour-bullet').length;
- let currentStep = $('.ttour-bullet.active').index() + 1;
- $('.current_step').html(currentStep);
- $('.total_steps').html(noOfSteps);
- })
-
- tour.override('end', function(self, step) {
- self(step);
- $("#bizgaze_body").css("pointer-events", "auto").find('.hk-wrapper').removeAttr('style');
- })
- tour.start();
- if($('#layoutMainNavbar li.nav-group-container:not(.d-none)').length == 1){
- let offHeight = $("[data-target='#dash_drp']").offset().top - 15;
- // let innerHeight = $("[data-target='#dash_drp']").height() + 20;
- $('.ttour-tip.bottom').css('top', offHeight +'px');
- }`;
- eval(script);
- });
- }
- loadCommonFilterPanel(containerid) {
- const indexInstance = Unibase.Themes.Compact.Components.Index.Instance();
- $(`#bizCmnFilterDp_${containerid}`).removeClass('show');
- $(`#filter_toggle_btn${containerid}`).removeClass('d-flex').addClass('d-none');
- $(`#dynamic-filters${containerid}`).empty();
- $('.biz-pg-wrapper').first().addClass('has-cmn-filter-panel');
- $('#bizCmnFilterPanel').html(`<div class="cmn-filter-panel-wrap h-100 d-flex flex-column pa-0"><div class="cmn-filter-panel-head d-flex justify-content-between align-items-center border-bottom pa-10"><span class="cmn-filter-panel-head-title biz-secondary-text-color font-16">Common Filters</span><a href="javascript:void(0);" id="cmnFilterPanelClose" class="cmn-filter-panel-close btn btn-icon btn-flush-danger btn-rounded flush-soft-hover h-30p w-30p" onclick="Unibase.Themes.Compact.Components.Dashboard.Instance().closeCmnFilterPanel('${containerid}');" data-tooltip="true" title="Unpin Filters"><span class="btn-icon-wrap"><img src="tenants/themes/compact/imgs/unpin.png" class="img-fluid w-75" style="padding:3px;"/></span></a></div><div data-simplebar id="cmnFilterPanelBodyWrap" class="simple-scroll-bar cmn-filter-panel-body-wrap flex-grow-1"><div class="cmn-filter-panel-body cmn-filters-body pb-10" id="dynamic-filters_CmnFilterPanel_${containerid}"></div></div><div class="cmn-filter-panel-footer pa-10 pb-15 border-top" id="commonfilter_footerbuttons_CmnFilterPanel_${containerid}"></div>`).addClass('show');
- if (indexInstance.isTopLeftLayout()) {
- $('.biz-layout-3-top-navbar,.biz-layout-3-biz-pg-wrapper').addClass('hk-nav-toggle');
- $('.biz-layout-3-left-nav').addClass('biz__nav__toggle');
- }
- const portletId = +$("#hf_PortletId").val();
- Unibase.Platform.Analytics.Components._CommonFilter.Instance().commonFilter(portletId, `_CmnFilterPanel_${containerid}`);
- setTimeout(() => {
- Unibase.Themes.Compact.Components.Nav.Instance().showHideFilterNavIcons(containerid);
- }, 400);
- }
- closeCmnFilterPanel(containerid) {
- const indexInstance = Unibase.Themes.Compact.Components.Index.Instance();
- $('.biz-pg-wrapper').first().removeClass('has-cmn-filter-panel');
- $('#bizCmnFilterPanel').empty().removeClass('show');
- $(`.common-filter-dp-btn`).removeClass('d-none').addClass('d-flex');
- $('.common-filter-dropdown-body').removeClass('d-none');
- if (indexInstance.isTopLeftLayout()) {
- }
- let cls_fnav = $("#bizgaze_body").find('.biz-layout-3-top-navbar').hasClass("hk-nav-toggle");
- let cls_nav = $("#bizgaze_body").find('.biz-layout-3-top-navbar').hasClass("biz__nav__toggle");
- if (cls_fnav == true && cls_nav == false) {
- $('.biz-layout-3-top-navbar,.biz-layout-3-biz-pg-wrapper').removeClass('hk-nav-toggle');
- }
- setTimeout(() => {
- Unibase.Themes.Compact.Components.Nav.Instance().showHideFilterNavIcons(containerid);
- }, 400);
- }
- static Instance() {
- return new Dashboard();
- }
- }
- Dashboard.inputparameters = {};
- Components.Dashboard = Dashboard;
- })(Components = Compact.Components || (Compact.Components = {}));
- })(Compact = Themes.Compact || (Themes.Compact = {}));
- })(Themes = Unibase.Themes || (Unibase.Themes = {}));
- })(Unibase || (Unibase = {}));
|