mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(feat) display validation before payment
This commit is contained in:
parent
328529809d
commit
940ee06e58
@ -46,6 +46,9 @@ class API::PricesController < API::ApiController
|
||||
cs = CartService.new(current_user)
|
||||
cart = cs.from_hash(params)
|
||||
@amount = cart.total
|
||||
# TODO, remove this when the cart is refactored
|
||||
cart.valid?
|
||||
@errors = cart.errors
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -687,6 +687,13 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs',
|
||||
$scope.amountTotal = res.price;
|
||||
$scope.schedule.payment_schedule = res.schedule;
|
||||
$scope.totalNoCoupon = res.price_without_coupon;
|
||||
if (res.errors && Object.keys(res.errors).length > 0) {
|
||||
for (const error in res.errors) {
|
||||
for (const message of res.errors[error]) {
|
||||
growl.error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
setSlotsDetails(res.details);
|
||||
});
|
||||
} else {
|
||||
|
@ -21,3 +21,4 @@ if @amount[:schedule]
|
||||
end
|
||||
end
|
||||
end
|
||||
json.errors @errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user