BookOfBusinessWidgetPreferences = function( widget ) { this.widget = widget; } BookOfBusinessWidgetPreferences.prototype.constructor = BookOfBusinessWidgetPreferences; BookOfBusinessWidgetPreferences.prototype.show = function( applyFn ) { let instance = this; let widget = this.widget; let preferencesForm = null; let preferencePopup = null; const items = []; items.push( { dataField : "partnerType", label : { text : "Account Type" }, editorType : "dxSelectBox", editorOptions : { showClearButton : true, placeholder : "Operators & Distributors", displayExpr : "text", valueExpr : "partnerType", dataSource : { store : { type : "array", data : [ { partnerType : "OPR", text : "Operators" }, { partnerType : "CDR", text : "Distributors" }], key : "partnerType" } } } } ); items.push( { dataField : "estOrderDateRange", label : { location : "left", text : "Est. Order Dt." }, editorType : "dxDropDownBox", editorOptions : Fse.UI.dateRangePickerOptions( { applyCustomDateRange : function( startDate, endDate ) { preferencesForm.updateData( { estOrderDateStart : startDate, estOrderDateEnd : endDate } ) } } ) } ); items.push( { label : { location : "left", text : "Territory" }, dataField : "territoryPath", cssClass : widget.activeFilterPreferences.territoryPath ? 'fx-active-preference' : null, editorType : "dxDropDownBox", editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "TER.salesTerritories", keyField : "territoryPath" } ), searchExpr : "territoryPath", searchMode : "contains", displayExpr : "territoryPath", multipleSelectedDisplay : "Multiple Territories Selected", keyExpr : "territoryPath", title : "Select Territories" }) }); items.push( { label : { location : "left", text : "Sales Rep" }, dataField : "salesRepId", editorType : "dxDropDownBox", cssClass : widget.activeFilterPreferences.salesRepId ? 'fx-active-preference' : null, editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "CRM.salesRepList", keyField : "valueId", objectParams : { version : 2 } } ), searchExpr : "valueName", searchMode : "contains", displayExpr : "valueName", multipleSelectedDisplay : "Multiple Sales Reps Selected", keyExpr : "valueId", title : "Select Sales Reps" }) }); items.push( { dataField : "productHierarchyPath", label : { location : "left", text : "Product" }, editorType : "dxDropDownBox", cssClass : widget.activeFilterPreferences.productHierarchyPath ? 'fx-active-preference' : null, // scrum 46030 editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "PRD.productHierarchyPaths", keyField : "productHierarchyPath" } ), searchExpr : "productHierarchyPath", searchMode : "contains", displayExpr : "productHierarchyPath", multipleSelectedDisplay : "Multiple Product Hierarchy Paths Selected", keyExpr : "productHierarchyPath", title : "Select Product Hierarchy Path", searchTemplate : function( applyFilters ) { return Fse.UI.productHierarchyPathMultiSelectSearchTemplate( applyFilters ) } }) }); items.push( { dataField : "productSetTags", label : { location : "left", text : "Product Set" }, editorType : "dxDropDownBox", cssClass : widget.activeFilterPreferences.productSetTags ? 'fx-active-preference' : null, editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "PRD.productSets", keyField : "productSetTag" } ), searchExpr : "productSetName", searchMode : "contains", displayExpr : "productSetName", multipleSelectedDisplay : "Multiple Product Sets Selected", keyExpr : "productSetTag", title : "Select Product Set" }) }); items.push({ dataField : "clientSegPath", label : { location : "left", text : "Segment" }, editorType : "dxDropDownBox", cssClass : widget.activeFilterPreferences.clientSegPath ? 'fx-active-preference' : null, // scrum 46030 editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "SPL.segments", keyField : "clientSegPath" } ), searchExpr : "clientSegPath", searchMode : "contains", displayExpr : "clientSegPath", multipleSelectedDisplay : "Multiple Segments Selected", keyExpr : "clientSegPath", title : "Select Segments" }) }); // begin objective filter items.push( { dataField : "objPath", label : { location : "left", text : "Objective" }, editorType : "dxDropDownBox", editorOptions : Fse.UI.multiSelectDropDownBoxEditorOptions( { dataSource : Fse.Data.newDataSource( { object : "BOM.objectives", keyField : "objPath" } ), searchExpr : "objPath", searchMode : "contains", displayExpr : "objPath", searchTemplate : function( userFilterCallback ) { // this is a custom search widget for the available side let searchWidget = $( "