1functionalAreas.factory('productService', ['Http', '$q', 'FUNNEL_CONSTANTS', function (Http, $q, FUNNEL_CONSTANTS) { 2 var selectableProduct = null; 3 var currentProduct = null; 4 var currentProductBkp = null; 5 var tecnicalIdMap = {}; 6 var reverseCompatibleProducts = []; 7 8 return { 9 10 setCurrentProduct: setCurrentProductFn, 11 getCurrentProduct: getCurentProductFn, 12 getSelectableProduct: getSelectableProductFn, 13 setSelectableProduct: setSelectableProductFn, 14 setCurrentSelectedProduct: setCurrentSelectedProductFn, 15 getReverseCompatibleProducts: getReverseCompatibleProducts, 16 getTecnicalIdByProductCode: getTecnicalIdByProductCode 17 }; 18 19 function setCurrentProductFn(productCode) { 20 currentProduct = productCode; 21 } 22 23 function getCurentProductFn() { 24 return currentProduct; 25 } 26 27 function setSelectableProductFn(products) { 28 selectableProduct = angular.copy(products); 29 selectableProduct.forEach( 30 function (product) { 31 tecnicalIdMap[product.productCode] = product.technicalId; 32 if (product.selectableServices 33 && (product.selectableServices.indexOf(FUNNEL_CONSTANTS.APTUS_CODES.REVERSE_INTERNAZIONALE) != -1 34 || product.selectableServices.indexOf(FUNNEL_CONSTANTS.APTUS_CODES.REVERSE_PLUS_CODE) != -1)) { 35 reverseCompatibleProducts.push(product.productCode); 36 } 37 } 38 ); 39 } 40 41 function getSelectableProductFn() { 42 return selectableProduct; 43 } 44 45 function setCurrentSelectedProductFn(productCode) { 46 currentProductBkp = currentProduct; 47 currentProduct = productCode; 48 } 49 50 function getReverseCompatibleProducts() { 51 return reverseCompatibleProducts; 52 } 53 54 function getTecnicalIdByProductCode(productCode) { 55 return tecnicalIdMap[productCode]; 56 } 57}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.