mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +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)
|
cs = CartService.new(current_user)
|
||||||
cart = cs.from_hash(params)
|
cart = cs.from_hash(params)
|
||||||
@amount = cart.total
|
@amount = cart.total
|
||||||
|
# TODO, remove this when the cart is refactored
|
||||||
|
cart.valid?
|
||||||
|
@errors = cart.errors
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -687,6 +687,13 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs',
|
|||||||
$scope.amountTotal = res.price;
|
$scope.amountTotal = res.price;
|
||||||
$scope.schedule.payment_schedule = res.schedule;
|
$scope.schedule.payment_schedule = res.schedule;
|
||||||
$scope.totalNoCoupon = res.price_without_coupon;
|
$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);
|
setSlotsDetails(res.details);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,3 +21,4 @@ if @amount[:schedule]
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
json.errors @errors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user