From fe6f85eb7c7ae85244cd0532c149a95d6a4cc432 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Tue, 21 Feb 2017 14:48:59 +0100 Subject: [PATCH] fix after payment update calendar --- .../javascripts/controllers/machines.coffee.erb | 10 +++++----- app/assets/javascripts/directives/cart.coffee.erb | 15 --------------- app/assets/templates/machines/reserve.html.erb | 12 ++++++------ 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/controllers/machines.coffee.erb b/app/assets/javascripts/controllers/machines.coffee.erb index ac8b296e0..19d996cf6 100644 --- a/app/assets/javascripts/controllers/machines.coffee.erb +++ b/app/assets/javascripts/controllers/machines.coffee.erb @@ -281,13 +281,13 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", "$stat ### PRIVATE STATIC CONSTANTS ### - # Slot already booked by the current user + # Slot free to be booked FREE_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::MACHINE_COLOR %>' # Slot already booked by another user UNAVAILABLE_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::MACHINE_IS_RESERVED_BY_USER %>' - # Slot free to be booked + # Slot already booked by the current user BOOKED_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::IS_RESERVED_BY_CURRENT_USER %>' @@ -509,7 +509,7 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", "$stat # @param reservation {Object} ## $scope.afterPayment = (reservation)-> - angular.forEach $scope.eventsReserved, (machineSlot, key) -> + angular.forEach $scope.events.reserved, (machineSlot, key) -> machineSlot.is_reserved = true machineSlot.can_modify = true if $scope.currentUser.role isnt 'admin' @@ -521,9 +521,9 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", "$stat machineSlot.borderColor = UNAVAILABLE_SLOT_BORDER_COLOR updateMachineSlot(machineSlot, reservation, $scope.ctrl.member) machineSlot.backgroundColor = 'white' - $scope.paidMachineSlots = $scope.eventsReserved + $scope.paidMachineSlots = $scope.events.reserved - $scope.eventsReserved = [] + $scope.events.reserved = [] $scope.coupon.applied = null if $scope.selectedPlan diff --git a/app/assets/javascripts/directives/cart.coffee.erb b/app/assets/javascripts/directives/cart.coffee.erb index 1680cf572..050ac214e 100644 --- a/app/assets/javascripts/directives/cart.coffee.erb +++ b/app/assets/javascripts/directives/cart.coffee.erb @@ -1,15 +1,3 @@ -### PRIVATE STATIC CONSTANTS ### - -# Slot already booked by the current user -FREE_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::MACHINE_COLOR %>' - -# Slot already booked by another user -UNAVAILABLE_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::MACHINE_IS_RESERVED_BY_USER %>' - -# Slot free to be booked -BOOKED_SLOT_BORDER_COLOR = '<%= AvailabilityHelper::IS_RESERVED_BY_CURRENT_USER %>' - - Application.Directives.directive 'cart', [ '$rootScope', '$uibModal', 'dialogs', 'growl', 'Auth', 'Price', 'Wallet', 'CustomAsset', 'Slot', 'helpers', '_t' , ($rootScope, $uibModal, dialogs, growl, Auth, Price, Wallet, CustomAsset, Slot, helpers, _t) -> { @@ -34,9 +22,6 @@ Application.Directives.directive 'cart', [ '$rootScope', '$uibModal', 'dialogs', settings: '=' templateUrl: '<%= asset_path "shared/_cart.html" %>' link: ($scope, element, attributes) -> - - $scope.paidMachineSlots = null - ## will store the user's plan if he choosed to buy one $scope.selectedPlan = null diff --git a/app/assets/templates/machines/reserve.html.erb b/app/assets/templates/machines/reserve.html.erb index 4f103a02d..741c8ebf1 100644 --- a/app/assets/templates/machines/reserve.html.erb +++ b/app/assets/templates/machines/reserve.html.erb @@ -43,6 +43,11 @@ + after-payment="afterPayment">