fix category without product

This commit is contained in:
ty kayn 2019-07-04 19:08:40 +02:00
parent 887e67c83e
commit 689c4509b5

View File

@ -48,7 +48,7 @@ angular
*/ */
$scope.toggleSimpleDisplay = function () { $scope.toggleSimpleDisplay = function () {
// debugger; // debugger;
$scope.simpleDisplay = ! $scope.simpleDisplay; $scope.simpleDisplay = !$scope.simpleDisplay;
} }
/** /**
* set the right paid amount * set the right paid amount
@ -168,12 +168,15 @@ angular
$scope.refreshDeduplicateSellings(); $scope.refreshDeduplicateSellings();
} }
$scope.removeAll = function () { $scope.removeAll = function () {
$scope.categories.forEach(category => { $scope.categories.forEach(category => {
category.products.forEach(product => { if (category.products && category.products.length) {
product.enabled = false
}) category.products.forEach(product => {
}); product.enabled = false
});
}
});
$scope.activeSelling = []; $scope.activeSelling = [];
$scope.regenActiveSellingIds(); $scope.regenActiveSellingIds();
$scope.refreshDeduplicateSellings(); $scope.refreshDeduplicateSellings();
@ -238,6 +241,7 @@ $scope.categories.forEach(category => {
* @param product * @param product
*/ */
$scope.expressSell = function (product) { $scope.expressSell = function (product) {
$scope.removeAll();
$scope.addProduct(product); $scope.addProduct(product);
$scope.sendForm(); $scope.sendForm();
}; };