Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //@PRESS DEL TagsCustomListItem
- var list = [];
- var item = {};
- item.ID_CHAR = 'COLLECTION_FLAG';
- item.ID_CHAR_VALUE_DESCR = 'In Collection';
- list.push(item);
- if (typeof(modelOrdAuthPage.getData().O_BEST_SELLER) !== "undefined" && modelOrdAuthPage.getData().O_BEST_SELLER) {
- var item = {};
- item.ID_CHAR = 'BEST_SELLER';
- item.ID_CHAR_VALUE_DESCR = 'Best Seller';
- list.push(item);
- }
- var item = {};
- item.ID_CHAR = '3';
- item.ID_CHAR_VALUE_DESCR = 'PROPOSAL';
- list.push(item);
- var item = {};
- item.ID_CHAR = 'POLARIZED_NEPT';
- item.ID_CHAR_VALUE_DESCR = 'Polarized';
- list.push(item);
- var item = {};
- item.ID_CHAR = 'NEW_MATERIAL_NEPT';
- item.ID_CHAR_VALUE_DESCR = 'New Material';
- list.push(item);
- //IF IS UNDER POLICY CHECK THAT USER HAS IT
- var item = {};
- item.ID_CHAR = 'IDEAL_ASSORTMENT';
- item.ID_CHAR_VALUE_DESCR = 'Ideal Assortment';
- list.push(item);
- modelTagsDetailFilterList.setData(list);
- DetailFilterProductListText.setText(TagsObjectHeader.getTitle());
- _filterProductsRule = TagsCodeObjectAttribute.getTitle();
- TagsDetailFilterList.setVisible(true);
- DetailFilterBrandList.setVisible(false);
- App.to(DetailFilterPage);
- //--------------------------------------
- //@SELECTION CHANGE TagsDetailFilterList
- //--------------------------------------
- var selChangeItems = oEvent.getParameters().listItems;
- if (selChangeItems.length === 1) {
- var model2Update = _filterProductsRule + 'FilterActiveList';
- // var data2Update = window[model2Update].getData();
- var data2Update = sap.ui.getCore().byId(sap.n.currentView.createId(model2Update)).getModel().getData();
- var object = JSON.parse(JSON.stringify(selChangeItems[0].getBindingContext().getObject()));
- // Add selected item
- if (oEvent.getParameters().selected === true) {
- if (typeof(data2Update.length) === "undefined")
- data2Update = [];
- data2Update.push(object);
- // window[model2Update].setData(data2Update);
- sap.ui.getCore().byId(sap.n.currentView.createId(model2Update)).getModel().setData(data2Update);
- } else {
- // Remove item deselected
- for (i = 0; i < data2Update.length; i++) {
- if (data2Update[i].ID_CHAR === object.ID_CHAR) {
- data2Update.splice(i, 1);
- // window[model2Update].setData(data2Update);
- sap.ui.getCore().byId(sap.n.currentView.createId(model2Update)).getModel().setData(data2Update);
- return;
- }
- }
- }
- }
- //--------------------------------------
- //@ PRESS DetailFilterProductListBackBut
- //--------------------------------------
- var modelFilterApply = _filterProductsRule + 'FilterActiveList';
- var objAttributeApply = _filterProductsRule + 'ObjectAttribute';
- var cancelButApply = _filterProductsRule + 'CancelButton';
- var modelData = sap.ui.getCore().byId(sap.n.currentView.createId(modelFilterApply)).getModel().getData();
- if (modelData.length > 0) {
- sap.ui.getCore().byId(sap.n.currentView.createId(objAttributeApply)).setVisible(true);
- sap.ui.getCore().byId(sap.n.currentView.createId(cancelButApply)).setVisible(true);
- if (modelData.length > 3) {
- sap.ui.getCore().byId(sap.n.currentView.createId(objAttributeApply)).setText(modelData.length + " " + NoItemsSelectedText.getText());
- } else {
- var textToApply = "";
- for (i = 0; i < modelData.length; i++) {
- if (i !== modelData.length - 1)
- textToApply = textToApply + modelData[i].ID_CHAR_VALUE_DESCR + ", ";
- else
- textToApply = textToApply + modelData[i].ID_CHAR_VALUE_DESCR
- }
- sap.ui.getCore().byId(sap.n.currentView.createId(objAttributeApply)).setText(textToApply);
- }
- } else {
- sap.ui.getCore().byId(sap.n.currentView.createId(objAttributeApply)).setVisible(false);
- sap.ui.getCore().byId(sap.n.currentView.createId(objAttributeApply)).setText("");
- sap.ui.getCore().byId(sap.n.currentView.createId(cancelButApply)).setVisible(false);
- }
- switch (_filterProductsRule) {
- case FrontColourCodeObjectAttribute.getTitle():
- _frontColourFilter = [];
- if (modelData.length > 0) {
- var selectConditionConc = "";
- for (i = 0; i < modelData.length; i++) {
- if (i !== modelData.length - 1)
- selectConditionConc = selectConditionConc + ' FRONT_COLOUR = "' + modelData[i].ID_CHAR_VALUE + '" OR ';
- else
- selectConditionConc = selectConditionConc + ' FRONT_COLOUR = "' + modelData[i].ID_CHAR_VALUE + '")';
- }
- var selectStatement = 'SELECT * FROM GT_PRD_GRD_LIST_DATA WHERE (' + selectConditionConc +
- //AT Grids
- ' AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER <> "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG +
- '" AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER = "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG + '"))';
- AppDB.transaction(function(tx) {
- tx.executeSql(selectStatement, [], function(tx, res) {
- var filter;
- var filterSet = [];
- for (var j = 0; j < res.rows.length; j++) {
- filter = new sap.ui.model.Filter("PRODUCT", "EQ", res.rows.item(j).PRODUCT);
- filterSet.push(filter);
- }
- _frontColourFilter = new sap.ui.model.Filter(filterSet, false);
- });
- });
- }
- break;
- case LensMatCodeObjectAttribute.getTitle():
- _lensMatFilter = [];
- if (modelData.length > 0) {
- var selectConditionConc = "";
- for (i = 0; i < modelData.length; i++) {
- if (i !== modelData.length - 1)
- selectConditionConc = selectConditionConc + ' LENS_MATERIAL = "' + modelData[i].ID_CHAR_VALUE + '" OR ';
- else
- selectConditionConc = selectConditionConc + ' LENS_MATERIAL = "' + modelData[i].ID_CHAR_VALUE + '")';
- }
- var selectStatement = 'SELECT * FROM GT_PRD_GRD_LIST_DATA WHERE (' + selectConditionConc +
- //AT Grids
- ' AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER <> "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG +
- '" AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER = "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG + '"))';
- AppDB.transaction(function(tx) {
- tx.executeSql(selectStatement, [], function(tx, res) {
- var filter;
- var filterSet = [];
- for (var j = 0; j < res.rows.length; j++) {
- filter = new sap.ui.model.Filter("PRODUCT", "EQ", res.rows.item(j).PRODUCT);
- filterSet.push(filter);
- }
- _lensMatFilter = new sap.ui.model.Filter(filterSet, false);
- });
- });
- }
- break;
- case LensPropCodeObjectAttribute.getTitle():
- _lensPropFilter = [];
- if (modelData.length > 0) {
- var selectConditionConc = "";
- for (i = 0; i < modelData.length; i++) {
- if (i !== modelData.length - 1)
- selectConditionConc = selectConditionConc + ' LENS_PROPERTIES = "' + modelData[i].ID_CHAR_VALUE + '" OR ';
- else
- selectConditionConc = selectConditionConc + ' LENS_PROPERTIES = "' + modelData[i].ID_CHAR_VALUE + '")';
- }
- var selectStatement = 'SELECT * FROM GT_PRD_GRD_LIST_DATA WHERE (' + selectConditionConc +
- //AT Grids
- ' AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER <> "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG +
- '" AND GT_PRD_GRD_LIST_DATA.GRID_VALUE NOT IN (SELECT GRID_VALUE FROM GT_PRD_GRD_CAT_EXCL WHERE PARTNER = "' +
- modelOrderDetailPage.getData().CUSTOMER + '" AND SALES_ORG = "' + modelUserProfilePage.getData().ZVKORG + '"))';
- AppDB.transaction(function(tx) {
- tx.executeSql(selectStatement, [], function(tx, res) {
- var filter;
- var filterSet = [];
- for (var j = 0; j < res.rows.length; j++) {
- filter = new sap.ui.model.Filter("PRODUCT", "EQ", res.rows.item(j).PRODUCT);
- filterSet.push(filter);
- }
- _lensPropFilter = new sap.ui.model.Filter(filterSet, false);
- });
- });
- }
- break;
- //MT:ACX fix compatibility filter
- case CompAcxCodeObjectAttribute.getTitle():
- //Hiding Compatibility List
- DetailFilterList.setVisible(true);
- BrandProductListFiltAcxSubBar.setVisible(false);
- BrandPrdFiltAcxScrollContainer.setVisible(false);
- _compAcxFilter = [];
- if (modelData.length > 0) {
- var selectConditionConc = "";
- for (i = 0; i < modelData.length; i++) {
- if (i !== modelData.length - 1)
- selectConditionConc = selectConditionConc + ' PRODUCT = "' + modelData[i].ID_CHAR_VALUE + '" OR ';
- else
- selectConditionConc = selectConditionConc + ' PRODUCT = "' + modelData[i].ID_CHAR_VALUE + '")';
- }
- AppDB.transaction(function(tx) {
- tx.executeSql('SELECT PRODUCT_ACX FROM GT_ACX_RELATIONSHIP WHERE (' + selectConditionConc, [], function(tx, res) {
- var filter;
- var filterSet = [];
- for (var j = 0; j < res.rows.length; j++) {
- filter = new sap.ui.model.Filter("PRODUCT", "EQ", res.rows.item(j).PRODUCT_ACX);
- filterSet.push(filter);
- }
- _compAcxFilter = new sap.ui.model.Filter(filterSet, false);
- });
- });
- }
- break;
- }
- App.back();
- //-------------------------------------------------
- //@ FilterProductListApplyButton PRESS EVENT
- //-------------------------------------------------
- var filterSet = [];
- var globalFilter = [];
- var filter;
- var filterValue;
- var countFilterActive = 0;
- _counterFilterAcx = 0;
- // Remove all filters as first step
- var binding = BrandProductFiltGrid.getBinding("items");
- binding.filter([]);
- var bindingList = BrandProductFiltList.getBinding("items");
- bindingList.filter([]);
- if (modelGenderFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelGenderFilterActiveList.getData().length; i++) {
- filterValue = modelGenderFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("GENDER", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelCollectionFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelCollectionFilterActiveList.getData().length; i++) {
- filterValue = modelCollectionFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("CATEGORY", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelAgeFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelAgeFilterActiveList.getData().length; i++) {
- filterValue = modelAgeFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("AGE_RANGE", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelTagsFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelTagsFilterActiveList.getData().length; i++) {
- var fieldName = modelTagsFilterActiveList.getData()[i].ID_CHAR;
- filter = new sap.ui.model.Filter(fieldName, "EQ", true);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelShapeFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelShapeFilterActiveList.getData().length; i++) {
- filterValue = modelShapeFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("SHAPE", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelMaterialFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelMaterialFilterActiveList.getData().length; i++) {
- filterValue = modelMaterialFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("FRONT_MATERIAL", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelGeoFitFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelGeoFitFilterActiveList.getData().length; i++) {
- filterValue = modelGeoFitFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("GEOFIT", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelLensBaseFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelLensBaseFilterActiveList.getData().length; i++) {
- filterValue = modelLensBaseFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("BASE", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelBrandFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelBrandFilterActiveList.getData().length; i++) {
- filterValue = modelBrandFilterActiveList.getData()[i].BRAND_ID;
- filter = new sap.ui.model.Filter("BRAND_ID", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- }
- if (modelColourAcxFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelColourAcxFilterActiveList.getData().length; i++) {
- filterValue = modelColourAcxFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("NORMALIZED_COLTX", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- _counterFilterAcx += 1;
- }
- if (modelLensPropAcxFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelLensPropAcxFilterActiveList.getData().length; i++) {
- filterValue = modelLensPropAcxFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("LENS_PROPERTY", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- _counterFilterAcx += 1;
- }
- if (modelCategoryAcxFilterActiveList.getData().length > 0) {
- filterSet = [];
- for (i = 0; i < modelCategoryAcxFilterActiveList.getData().length; i++) {
- filterValue = modelCategoryAcxFilterActiveList.getData()[i].ID_CHAR_VALUE;
- filter = new sap.ui.model.Filter("SUBCATEGORY", "EQ", filterValue);
- filterSet.push(filter);
- }
- globalFilter.push(new sap.ui.model.Filter(filterSet, false));
- countFilterActive += 1;
- _counterFilterAcx += 1;
- }
- if (_compAcxFilter.length !== 0) {
- globalFilter.push(_compAcxFilter);
- countFilterActive += 1;
- _counterFilterAcx += 1;
- }
- if (_frontColourFilter.length !== 0) {
- globalFilter.push(_frontColourFilter);
- countFilterActive += 1;
- }
- if (_lensMatFilter.length !== 0) {
- globalFilter.push(_lensMatFilter);
- countFilterActive += 1;
- }
- if (_lensPropFilter.length !== 0) {
- globalFilter.push(_lensPropFilter);
- countFilterActive += 1;
- }
- // Final filter
- if (globalFilter.length > 0) {
- _filterByPage = _filterByPage.concat(globalFilter);
- var bindingList = BrandProductFiltList.getBinding("items");
- var binding = BrandProductFiltGrid.getBinding("items");
- if (_filterBySearch.length > 0) {
- globalFilter.push(_filterBySearch[0]);
- }
- //change filter for acx
- if (_counterFilterAcx > 0) {
- var bindingAcx = BrandProductAcxSupportList.getBinding("items");
- bindingAcx.filter(new sap.ui.model.Filter(globalFilter, true));
- var unique = {};
- var distinct = [];
- var array = [];
- var totalArray = modelBrandProductAcxSupportList.getData();
- if (bindingAcx.aIndices.length > 0) {
- for (i = 0; i < bindingAcx.aIndices.length; i++) {
- var indexAcx = bindingAcx.aIndices[i];
- array.push(JSON.parse(JSON.stringify(modelBrandProductAcxSupportList.getData()[indexAcx])));
- }
- }
- var cartId = modelOrderDetailPage.getData().CART_ID;
- var parkedItems = modelSaParkedItemsList.getData();
- if (parkedItems.length > 0) {
- parkedItems = parkedItems.filter(function(el) {
- return el.CART_ID === cartId;
- });
- }
- if (array.length > 0) {
- distinct = array.filter(function(el) {
- if (typeof(unique[el.PRODUCT]) === "undefined") {
- unique[el.PRODUCT] = 0;
- if (parkedItems.length > 0) {
- el.QTY_ORDER_PROD = parkedItems.reduce(function(n, obj) {
- return n + (el.PRODUCT == obj.PRODUCT) * parseFloat(obj.QTY_ORDER);
- }, 0);
- }
- if (el.QTY_ORDER_PROD > 0) {
- el.QTY_ORDER_VISIBLE = true;
- }
- var priceMin = el.O_PRICE;
- var newMat = false;
- var bestSell = false;
- el.COLOURS_NUM = totalArray.reduce(function(n, col) {
- if (el.PRODUCT === col.PRODUCT && col.O_PRICE < priceMin) {
- priceMin = col.O_PRICE;
- }
- if (el.PRODUCT === col.PRODUCT && col.NEW_MATERIAL_NEPT === true) {
- newMat = true;
- el.NEW_MATERIAL = "X";
- }
- if (el.PRODUCT === col.PRODUCT && col.BEST_SELLER === true) {
- bestSell = true;
- }
- return n + (el.PRODUCT === col.PRODUCT);
- }, 0);
- el.O_PRICE = priceMin;
- el.NEW_MATERIAL_NEPT = newMat;
- el.BEST_SELLER = bestSell;
- el.SIZES_NUM = 1;
- var coloursNum;
- var sizesNum;
- if (typeof(el.COLOURS_NUM) === "undefined" || el.COLOURS_NUM === null || el.COLOURS_NUM === "") {
- coloursNum = 0;
- } else {
- coloursNum = el.COLOURS_NUM;
- }
- if (typeof(el.SIZES_NUM) === "undefined" || el.SIZES_NUM === null || el.SIZES_NUM === "") {
- sizesNum = 0;
- } else {
- sizesNum = el.SIZES_NUM;
- }
- var MyColSize = ColourSizeLabel.getText();
- MyColSize = MyColSize.replace("&1", coloursNum);
- MyColSize = MyColSize.replace("&2", sizesNum);
- el.COLOURS_NUM = MyColSize;
- return el;
- }
- })
- }
- modelBrandProductFiltGrid.setData(JSON.parse(JSON.stringify(distinct)));
- modelBrandProductFiltList.setData(JSON.parse(JSON.stringify(distinct)));
- BrandProductListText.setText(SelectAccessories.getText() + ' (' + distinct.length + ')');
- var indices = BrandProductFiltGrid.getBinding("items").aIndices;
- var productModel = modelBrandProductFiltGrid.getData();
- _log = [];
- indicesLength = indices.length;
- for (i = indicesLength; i--;) {
- var index = indices[i];
- _log.push(JSON.parse(JSON.stringify(productModel[index])));
- }
- } else {
- bindingList.filter(new sap.ui.model.Filter(globalFilter, true));
- binding.filter(new sap.ui.model.Filter(globalFilter, true));
- }
- } else {
- if (_isAccessory) {
- _counterFilterAcx = 1; //dummy needed to clear the filter inside called function
- removeFilters();
- }
- _filterByPage = [];
- var bindingList = BrandProductFiltList.getBinding("items");
- var binding = BrandProductFiltGrid.getBinding("items");
- if (_filterBySearch.length > 0) {
- globalFilter.push(_filterBySearch[0]);
- bindingList.filter(_filterBySearch[0]);
- binding.filter(_filterBySearch[0]);
- }
- }
- var bindingList = BrandProductFiltList.getBinding("items");
- var binding = BrandProductFiltGrid.getBinding("items");
- if (globalFilter.length > 0) {
- // bindingList.filter(new sap.ui.model.Filter(globalFilter, true));
- } else {
- bindingList.filter([]);
- binding.filter([]);
- }
- App.backToPage(BrandProductListPage);
- ProductFilterButton.setText(FilterButtonBaseText.getText() + " (" + countFilterActive + ")");
- ProductFilterButton.setType("Emphasized");
- //Reset the Customers List page label
- BrandProductListText.setText(ProductText.getText() + " (" + sap.ui.getCore().byId(sap.n.currentView.createId("BrandProductFiltGrid")).getBinding("items").aIndices.length + ")");
- //-----------------------------------------------------------------------
- //@global script
- //-----------------------------------------------------------------------
- function removeFilters() {
- var bindingDet = DetailFilterList.getBinding("items");
- bindingDet.filter([]);
- var binding = BrandProductFiltGrid.getBinding("items");
- binding.filter([]);
- var bindingList = BrandProductFiltList.getBinding("items");
- bindingList.filter([]);
- var bindingAcx = BrandProductAcxSupportList.getBinding("items");
- bindingAcx.filter([]);
- _frontColourFilter = [];
- _lensMatFilter = [];
- _lensPropFilter = [];
- modelBrandFilterActiveList.setData([]);
- BrandObjectAttribute.setVisible(false);
- BrandCancelButton.setVisible(false);
- modelCollectionFilterActiveList.setData([]);
- CollectionObjectAttribute.setVisible(false);
- CollectionCancelButton.setVisible(false);
- modelAgeFilterActiveList.setData([]);
- AgeObjectAttribute.setVisible(false);
- AgeCancelButton.setVisible(false);
- modelTagsFilterActiveList.setData([]);
- TagsObjectAttribute.setVisible(false);
- TagsCancelButton.setVisible(false);
- modelGenderFilterActiveList.setData([]);
- GenderObjectAttribute.setVisible(false);
- GenderCancelButton.setVisible(false);
- modelShapeFilterActiveList.setData([]);
- ShapeObjectAttribute.setVisible(false);
- ShapeCancelButton.setVisible(false);
- modelFrontColourFilterActiveList.setData([]);
- FrontColourObjectAttribute.setVisible(false);
- FrontColourCancelButton.setVisible(false);
- modelMaterialFilterActiveList.setData([]);
- MaterialObjectAttribute.setVisible(false);
- MaterialCancelButton.setVisible(false);
- modelGeoFitFilterActiveList.setData([]);
- GeoFitObjectAttribute.setVisible(false);
- GeoFitCancelButton.setVisible(false);
- modelLensPropFilterActiveList.setData([]);
- LensPropObjectAttribute.setVisible(false);
- LensPropCancelButton.setVisible(false);
- modelLensMatFilterActiveList.setData([]);
- LensMatObjectAttribute.setVisible(false);
- LensMatCancelButton.setVisible(false);
- modelLensBaseFilterActiveList.setData([]);
- LensBaseObjectAttribute.setVisible(false);
- LensBaseCancelButton.setVisible(false);
- modelCategoryAcxFilterActiveList.setData([]);
- CategoryAcxObjectAttribute.setVisible(false);
- CategoryAcxCancelButton.setVisible(false);
- modelLensPropAcxFilterActiveList.setData([]);
- LensPropAcxObjectAttribute.setVisible(false);
- LensPropAcxCancelButton.setVisible(false);
- modelColourAcxFilterActiveList.setData([]);
- ColourAcxObjectAttribute.setVisible(false);
- ColourAcxCancelButton.setVisible(false);
- modelCompAcxFilterActiveList.setData([]);
- CompAcxObjectAttribute.setVisible(false);
- CompAcxCancelButton.setVisible(false);
- if (_counterFilterAcx > 0) {
- var unique = {};
- var distinct = [];
- var array = [];
- array = JSON.parse(JSON.stringify(modelBrandProductAcxSupportList.getData()));
- var cartId = modelOrderDetailPage.getData().CART_ID;
- var parkedItems = modelSaParkedItemsList.getData();
- if (parkedItems.length > 0) {
- parkedItems = parkedItems.filter(function(el) {
- return el.CART_ID === cartId;
- });
- }
- if (array.length > 0) {
- distinct = array.filter(function(el) {
- if (typeof(unique[el.PRODUCT]) === "undefined") {
- unique[el.PRODUCT] = 0;
- if (parkedItems.length > 0) {
- el.QTY_ORDER_PROD = parkedItems.reduce(function(n, obj) {
- return n + (el.PRODUCT == obj.PRODUCT) * parseFloat(obj.QTY_ORDER);
- }, 0);
- }
- var priceMin = el.O_PRICE;
- var newMat = false;
- var bestSell = false;
- el.COLOURS_NUM = array.reduce(function(n, col) {
- if (el.PRODUCT === col.PRODUCT && col.O_PRICE < priceMin) {
- priceMin = col.O_PRICE;
- }
- if (el.PRODUCT === col.PRODUCT && col.NEW_MATERIAL_NEPT === true) {
- newMat = true;
- el.NEW_MATERIAL = "X";
- }
- if (el.PRODUCT === col.PRODUCT && col.BEST_SELLER === true) {
- bestSell = true;
- }
- return n + (el.PRODUCT === col.PRODUCT);
- }, 0);
- el.O_PRICE = priceMin;
- el.NEW_MATERIAL_NEPT = newMat;
- el.BEST_SELLER = bestSell;
- el.SIZES_NUM = 1;
- var coloursNum;
- var sizesNum;
- if (typeof(el.COLOURS_NUM) === "undefined" || el.COLOURS_NUM === null || el.COLOURS_NUM === "") {
- coloursNum = 0;
- } else {
- coloursNum = el.COLOURS_NUM;
- }
- if (typeof(el.SIZES_NUM) === "undefined" || el.SIZES_NUM === null || el.SIZES_NUM === "") {
- sizesNum = 0;
- } else {
- sizesNum = el.SIZES_NUM;
- }
- var MyColSize = ColourSizeLabel.getText();
- MyColSize = MyColSize.replace("&1", coloursNum);
- MyColSize = MyColSize.replace("&2", sizesNum);
- el.COLOURS_NUM = MyColSize;
- if (el.QTY_ORDER_PROD > 0) {
- el.QTY_ORDER_VISIBLE = true;
- }
- return el;
- }
- })
- }
- modelBrandProductFiltGrid.setData(JSON.parse(JSON.stringify(distinct)));
- modelBrandProductFiltList.setData(JSON.parse(JSON.stringify(distinct)));
- BrandProductListText.setText(SelectAccessories.getText() + ' (' + distinct.length + ')');
- var indices = BrandProductFiltGrid.getBinding("items").aIndices;
- var productModel = modelBrandProductFiltGrid.getData();
- _log = [];
- indicesLength = indices.length;
- for (i = indicesLength; i--;) {
- // for (i = 0; i < indices.length; i++) {
- var index = indices[i];
- _log.push(JSON.parse(JSON.stringify(productModel[index])));
- }
- }
- _counterFilterAcx = 0;
- DetailFilterList.removeSelections();
- TagsDetailFilterList.removeSelections();
- BrandPrdFiltCompAcx.removeSelections();
- ProductFilterButton.setText(FilterButtonBaseText.getText());
- ProductFilterButton.setType("Default");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement