PipelineByManufacturerWidget = function( widgetOptions ) { let defaultShowCases = true; let defaultShowLbs = true; let defaultShowDollars = true; let defaultShowCommission = false; let defaultShowOpportunities = false; if( Fse.Portal.appConfiguration.STP.ownerType === "BRO" ) { defaultShowCases = true; defaultShowLbs = false; defaultShowDollars = false; defaultShowCommission = false; } let configDefaults = { showCases : defaultShowCases, showLbs : defaultShowLbs, showDollars : defaultShowDollars, showCommission : defaultShowCommission, showOpportunities : defaultShowOpportunities, topCount : 10, effectiveRepId : null, territoryPath : null, uom : "cases", typeCode : null } if( Fse.Portal.appConfiguration.STP.ownerType === "MFR" ) { configDefaults.budgetCategoryId = null; } if( Fse.Portal.appConfiguration.STP.ownerType !== "MFR" ) { configDefaults.mfr_id = null; } this.widgetOptions = widgetOptions; this.widgetOptions.config = $.extend( true, {}, configDefaults, this.widgetOptions.config ); this.dataGrid = null; // this.preferencesPopup = null; this.activeFilterPreferences = {}; this.init(); } PipelineByManufacturerWidget.prototype.constructor = PipelineByManufacturerWidget; PipelineByManufacturerWidget.prototype.element = function() { return this.dataGrid.element(); } PipelineByManufacturerWidget.prototype.init = function() { let widget = this; // create a copy of the config to use for the datasource creationg (scrum 46030) let configForDataSource = $.extend( true, {}, widget.widgetOptions.config ); // begin apply filter preferences (scrum 46030) // global filters suppored by this widget, when the global filters are expressed with different variable names, they need to translated to this widgets variable names const globalFilters = { // widgetVariableName : "globalFilterVariableName" effectiveRepId : "salesRepId", mfr_id : "mfr_id", territoryPath : "territoryPath", budgetCategoryId : "budgetCategoryId", }; for( let p in globalFilters ) { // apply translation - global filter param is not the same name as widget param let gp = globalFilters[p]; // if the global filter preferences have the propery and it has a value, update the objectparams if( widget.widgetOptions.filterPreferences.hasOwnProperty( gp ) && widget.widgetOptions.filterPreferences[gp]) { if( configForDataSource[p] == null ) { configForDataSource[p] = widget.widgetOptions.filterPreferences[gp]; widget.activeFilterPreferences[p] = configForDataSource[p]; // indicate that this widget parameter has an active filter preference - used when displaying the edit page } } } // end apply filter preferences (scrum 46030) let objectParams = { territoryPath : configForDataSource.territoryPath, effectiveRepId : configForDataSource.effectiveRepId, uom : configForDataSource.uom, typeCode : configForDataSource.typeCode, topCount : configForDataSource.topCount } if( Fse.Portal.appConfiguration.STP.ownerType === "MFR" ) { objectParams.budgetCategoryId = configForDataSource.budgetCategoryId; } if( Fse.Portal.appConfiguration.STP.ownerType !== "MFR" ) { objectParams.mfr_id = configForDataSource.mfr_id; } let dataSource = Fse.Data.newDataSource( { object : "SPL.pipelineByManufacturer", objectParams : objectParams } ); widget.dataGrid = $("