1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00

fixed delete coupon + fixed coupon status

This commit is contained in:
Sylvain 2016-08-08 10:11:36 +02:00
parent 7c434db09a
commit 01b77b3179

View File

@ -3,8 +3,8 @@
## ##
# Controller used in the prices edition page # Controller used in the prices edition page
## ##
Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', 'TrainingsPricing', '$filter', 'Credit', 'Pricing', 'Plan', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t' Application.Controllers.controller "EditPricingController", ["$scope", "$state", '$uibModal', 'TrainingsPricing', '$filter', 'Credit', 'Pricing', 'Plan', 'Coupon', 'plans', 'groups', 'growl', 'machinesPricesPromise', 'Price', 'dialogs', 'trainingsPricingsPromise', 'trainingsPromise', 'machineCreditsPromise', 'machinesPromise', 'trainingCreditsPromise', 'couponsPromise', '_t'
, ($scope, $state, $uibModal, TrainingsPricing, $filter, Credit, Pricing, Plan, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) -> , ($scope, $state, $uibModal, TrainingsPricing, $filter, Credit, Pricing, Plan, Coupon, plans, groups, growl, machinesPricesPromise, Price, dialogs, trainingsPricingsPromise, trainingsPromise, machineCreditsPromise, machinesPromise, trainingCreditsPromise, couponsPromise, _t) ->
### PUBLIC SCOPE ### ### PUBLIC SCOPE ###
## List of machines prices (not considering any plan) ## List of machines prices (not considering any plan)
@ -319,9 +319,9 @@ Application.Controllers.controller "EditPricingController", ["$scope", "$state",
$scope.getCouponStatus = (coupon) -> $scope.getCouponStatus = (coupon) ->
unless coupon.active unless coupon.active
return _t('disabled') return _t('disabled')
if coupon.valid_until and moment(coupon.valid_until).isAfter() if coupon.valid_until and moment(coupon.valid_until).isBefore()
return _t('expired') return _t('expired')
if coupon.max_usages and coupon.usages <= coupon.max_usages if coupon.max_usages and coupon.usages >= coupon.max_usages
return _t('sold_out') return _t('sold_out')
return _t('active') return _t('active')