From 689c4509b511dbe244eaaeedd8906f569cea2bae Mon Sep 17 00:00:00 2001 From: ty kayn Date: Thu, 4 Jul 2019 19:08:40 +0200 Subject: [PATCH] fix category without product --- assets/js/parts/main.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/assets/js/parts/main.js b/assets/js/parts/main.js index 4a81e101..c8f07e4a 100755 --- a/assets/js/parts/main.js +++ b/assets/js/parts/main.js @@ -48,7 +48,7 @@ angular */ $scope.toggleSimpleDisplay = function () { // debugger; - $scope.simpleDisplay = ! $scope.simpleDisplay; + $scope.simpleDisplay = !$scope.simpleDisplay; } /** * set the right paid amount @@ -168,12 +168,15 @@ angular $scope.refreshDeduplicateSellings(); } $scope.removeAll = function () { -$scope.categories.forEach(category => { - category.products.forEach(product => { - product.enabled = false + $scope.categories.forEach(category => { + if (category.products && category.products.length) { - }) -}); + category.products.forEach(product => { + product.enabled = false + }); + } + + }); $scope.activeSelling = []; $scope.regenActiveSellingIds(); $scope.refreshDeduplicateSellings(); @@ -238,6 +241,7 @@ $scope.categories.forEach(category => { * @param product */ $scope.expressSell = function (product) { + $scope.removeAll(); $scope.addProduct(product); $scope.sendForm(); };