PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
ecommerce
/
catalog
define([], function() { return function($scope, communication, popup_product,$dialog, $state,$uibModalStack) { var statuses = [ t('LBL_PRODUCT_STATUS_NOT_AVAILABLE'), t('LBL_PRODUCT_STATUS_ON_SALE') ]; $scope.showStatus = function(status) { return statuses[status]; } $scope.showPrice = function(price) { return price; } $scope.gridInstance={}; $scope.add = function() { popup_product.open().result.then(function(data) { if($state.current.name =='ecommerce.catalog.product.view') $state.go('ecommerce.catalog.product'); $scope.gridInstance.instance.reloadData(); }, function() { if($state.current.name =='ecommerce.catalog.product.view') $state.go('ecommerce.catalog.product'); }); } $scope.filters = {}; $scope.delete = function() { var rows = $scope.gridInstance.selections; if(rows.length > 0) { $dialog.confirm({ title:'', message:window.t('LBL_DELETE_PRODUCTS_CONFIRM_MESSAGE') }).result.then(function() { communication.api('deleteItems', {ids:rows},'ecommerce.catalog.product').then(function() { $scope.gridInstance.instance.reloadData(); }); }); } } $scope.product_categories_list = []; /* communication.getList('product_categories', {},'ecommerce.catalog.category').then(function(json) { $scope.product_categories_list = json; // for(var i = 0;i < $scope.gridOptions.data.length;i++) //{ //$scope.gridOptions.data[i].category_text = $scope.getCategoryString($scope.gridOptions.data[i].category); //} }); var getCategoryString = function(list, id) { var catstring = ''; for(var j = 0; j < list.length;j++) { if( id == list[j].id) { catstring += list[j].name; return catstring; } if(list[j].items) { return getCategoryString(list[j].items, id); } } } $scope.getCategoryString = function(a) { var catstring = ''; a = a.split(','); for(var i = 0; i < a.length;i++) { if( a[i] != '') { var c = getCategoryString( $scope.product_categories_list,a[i] ); if(c) catstring += ',' + c; } } try { catstring = catstring.substring(1); } catch(e) { } return catstring; } $scope.showCategory = function(row,a) { if(a == null || a == undefined) return ''; var a = $scope.getCategoryString(a); return a }*/ $scope.RowButtonClickHandler = { edit : function(id) { communication.api('getFormData',{name:'product', id:id}).then(function(data) { popup_product.open( { data:data }).result.then(function(data) { if($state.current.name =='ecommerce.catalog.product.view') $state.go('ecommerce.catalog.product'); $scope.gridInstance.instance.reloadData(); }, function() { if($state.current.name =='ecommerce.catalog.product.view') $state.go('ecommerce.catalog.product'); }); }) } }; var checkState = function() { if($state.current.name =='ecommerce.catalog.product.view') $scope.RowButtonClickHandler.edit($state.params.productID); } checkState(); $scope.$on("$stateChangeSuccess", function(event, toState, toParams, fromState, fromParams) { checkState(); if(fromState.name =='ecommerce.catalog.product.view') $uibModalStack.dismissAll(1); }); } });
[+]
..
[-] option_set.js
[edit]
[-] manufacturer.js
[edit]
[-] review.js
[edit]
[-] product.js
[edit]
[-] category.js
[edit]
[-] supplier.js
[edit]
[+]
option_set
[-] option_set - Copy.js
[edit]