Skip to content

Commit

Permalink
Fix min quantity validation bug #9, small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
megafreeman committed Sep 22, 2017
1 parent 7093153 commit 35945cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions VirtoCommerce.PricingModule.Web/Content/css/pricing.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
width: calc(100% - 120px);
}

button.btn.head-button {
button.btn.add-price-button {
background: #43b0e6;
color: #fff;
height: 30px;
line-height: 28px;
padding: 0 10px;
}

button.btn.head-button:hover {
button.btn.add-price-button:hover {
background: #43b0e6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
});
});

priceValidatorsService.setAllPrices(blade.currentEntities);
blade.currentEntities = angular.copy(blade.origEntity);
priceValidatorsService.setAllPrices(blade.currentEntities);
blade.isLoading = false;
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="blade-static __expanded">
<div class="form-group">
<label class="form-label head-label">{{'pricing.blades.item-prices.head-label' | translate}} <a href="" ng-click="createNewPricelist()" class="form-edit" va-permission="pricing:read"><i class="form-ico fa fa-pencil"></i></a></label>
<label class="form-label head-label">{{'pricing.blades.item-prices.head-label' | translate}} <a href="" ng-click="createNewPricelist()" class="form-edit" va-permission="pricing:read"><em class="form-ico fa fa-pencil"></em></a></label>

<div class="form-input">
<ui-select ng-model="blade.selectedPricelist" class="head-select" required>
Expand All @@ -10,7 +10,7 @@
</ui-select-choices>
</ui-select>

<button class="btn head-button" type="button" ng-disabled="!blade.selectedPricelist" ng-click="blade.addNewPrice(blade.selectedPricelist)">Add new price</button>
<button class="btn add-price-button" type="button" ng-disabled="!blade.selectedPricelist" ng-click="blade.addNewPrice(blade.selectedPricelist)">Add new price</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,7 @@
return Math.round(data.minQuantity) > 0 && _.all(allPrices, function (x) { return x === data || Math.round(x.minQuantity) !== Math.round(data.minQuantity) });
},
isUniqueQtyForPricelist: function (data) {
var result = Math.round(data.minQuantity) > 0 && _.all(_.where(allPrices, { pricelistId: data.pricelistId }), function (x) { return x === data || Math.round(x.minQuantity) !== Math.round(data.minQuantity) });
return result;
return _.filter(allPrices, function (price) { return price.pricelistId == data.pricelistId && price.minQuantity == data.minQuantity }).length == 1;
}
};
}])
Expand Down

0 comments on commit 35945cc

Please sign in to comment.