mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-11-29 10:24:20 +01:00
fix bug: code promotion change slot's price original
This commit is contained in:
parent
afb026bdc9
commit
cfd92cdc40
@ -400,6 +400,7 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
|
||||
if $scope.ctrl.member
|
||||
# reserve a training if this training will not be reserved and is not about to move and not is completed
|
||||
if !event.is_reserved && !$scope.slotToModify && !event.is_completed
|
||||
$scope.coupon.applied = null
|
||||
if event != $scope.selectedTraining
|
||||
$scope.selectedTraining = event
|
||||
$scope.selectedTraining.offered = false
|
||||
|
@ -5,6 +5,7 @@ Application.Directives.directive 'coupon', [ 'Coupon', 'growl', '_t', (Coupon, g
|
||||
show: '='
|
||||
coupon: '='
|
||||
userId: '@'
|
||||
hasSelectSlot: '='
|
||||
templateUrl: '<%= asset_path "shared/_coupon.html" %>'
|
||||
link: ($scope, element, attributes) ->
|
||||
|
||||
@ -18,6 +19,11 @@ Application.Directives.directive 'coupon', [ 'Coupon', 'growl', '_t', (Coupon, g
|
||||
# Binding for the code inputed
|
||||
$scope.couponCode = null
|
||||
|
||||
$scope.$watch 'hasSelectSlot', (newValue) ->
|
||||
unless newValue
|
||||
$scope.coupon = null
|
||||
$scope.couponCode = null
|
||||
$scope.code.input = false
|
||||
|
||||
|
||||
##
|
||||
|
@ -78,7 +78,7 @@
|
||||
<div class="clear"><a class="pull-right m-b-sm text-u-l ng-scope m-r-sm" href="#" ng-click="removeMachineSlot(machineSlot, $event)" ng-if="machineSlot.isValid" translate>{{ 'remove_this_slot' }}</a></div>
|
||||
</div>
|
||||
|
||||
<coupon show="machineSlotsValid() && (!plansAreShown || selectedPlan)" coupon="coupon.applied" user-id="{{ctrl.member.id}}"></coupon>
|
||||
<coupon show="machineSlotsValid() && (!plansAreShown || selectedPlan)" coupon="coupon.applied" has-select-slot="machineSlotsValid()" user-id="{{ctrl.member.id}}"></coupon>
|
||||
|
||||
<span ng-hide="fablabWithoutPlans">
|
||||
<div ng-if="machineSlotsValid() && !ctrl.member.subscribed_plan" ng-show="!plansAreShown">
|
||||
|
@ -1,5 +1,5 @@
|
||||
<div class="form-group m-b-lg" ng-show="show">
|
||||
<a ng-click="code. input = true" ng-hide="code.input" class="b-b" translate>{{ 'i_have_a_coupon' }}</a>
|
||||
<a ng-click="code.input = true" ng-hide="code.input" class="b-b" translate>{{ 'i_have_a_coupon' }}</a>
|
||||
|
||||
<div ng-show="code.input">
|
||||
<label for="coupon_code" translate>{{ 'code_' }}</label>
|
||||
@ -18,4 +18,4 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@
|
||||
<a class="pull-right m-t-xs text-u-l" href="#" ng-click="removeTraining($event)" ng-if="trainingIsValid" translate>{{ 'remove_this_slot' }}</a>
|
||||
</div>
|
||||
|
||||
<coupon show="trainingIsValid && (!plansIsShow || selectedPlan)" coupon="coupon.applied" user-id="{{ctrl.member.id}}"></coupon>
|
||||
<coupon show="trainingIsValid && (!plansIsShow || selectedPlan)" coupon="coupon.applied" has-select-slot="trainingIsValid" user-id="{{ctrl.member.id}}"></coupon>
|
||||
|
||||
<span ng-hide="fablabWithoutPlans">
|
||||
<div ng-if="trainingIsValid && !ctrl.member.subscribed_plan" ng-show="!plansIsShow">
|
||||
|
Loading…
Reference in New Issue
Block a user