1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

fix move & cancel training reservation + fix display after cancel for machines & training

This commit is contained in:
Sylvain 2017-02-22 17:45:22 +01:00
parent 40ec38465c
commit 03758d336c
5 changed files with 22 additions and 8 deletions

View File

@ -381,6 +381,14 @@ Application.Controllers.controller "ReserveMachineController", ["$scope", "$stat
##
# Callback when a slot was successfully cancelled. Reset the slot style as 'ready to book'
##
$scope.slotCancelled = ->
$scope.markSlotAsRemoved($scope.selectedEvent)
##
# Change the last selected slot's appearence to looks like 'currently looking for a new destination to exchange'
##

View File

@ -173,7 +173,7 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
slot.backgroundColor = 'white'
slot.title = slot.training.name
slot.borderColor = FREE_SLOT_BORDER_COLOR
slot.slot_id = null
slot.id = null
slot.isValid = false
slot.is_reserved = false
slot.can_modify = false
@ -183,6 +183,13 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
##
# Callback when a slot was successfully cancelled. Reset the slot style as 'ready to book'
##
$scope.slotCancelled = ->
$scope.markSlotAsRemoved($scope.selectedEvent)
##
# Change the last selected slot's appearence to looks like 'currently looking for a new destination to exchange'
@ -214,14 +221,14 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
$scope.events.placable.title = if $scope.currentUser.role isnt 'admin' then $scope.events.placable.training.name + " - " + _t('i_ve_reserved') else $scope.events.placable.training.name
$scope.events.placable.backgroundColor = 'white'
$scope.events.placable.borderColor = $scope.events.modifiable.borderColor
$scope.events.placable.slot_id = $scope.events.modifiable.slot_id
$scope.events.placable.id = $scope.events.modifiable.id
$scope.events.placable.is_reserved = true
$scope.events.placable.can_modify = true
$scope.events.modifiable.backgroundColor = 'white'
$scope.events.modifiable.title = $scope.events.modifiable.training.name
$scope.events.modifiable.borderColor = FREE_SLOT_BORDER_COLOR
$scope.events.modifiable.slot_id = null
$scope.events.modifiable.id = null
$scope.events.modifiable.is_reserved = false
$scope.events.modifiable.can_modify = false
$scope.events.modifiable.is_completed = false if $scope.events.modifiable.is_completed
@ -378,7 +385,7 @@ Application.Controllers.controller "ReserveTrainingController", ["$scope", "$sta
updateTrainingSlotId = (slot, reservation)->
angular.forEach reservation.slots, (s)->
if slot.start_at == slot.start_at
slot.slot_id = s.id
slot.id = s.id

View File

@ -43,7 +43,7 @@
on-slot-modify-success="modifyMachineSlot"
on-slot-modify-cancel="cancelModifyMachineSlot"
on-slot-modify-unselect="changeModifyMachineSlot"
on-slot-cancel-success="markSlotAsRemoved"
on-slot-cancel-success="slotCancelled"
after-payment="afterPayment"
reservable-id="{{machine.id}}"
reservable-type="Machine"

View File

@ -53,7 +53,7 @@
on-slot-modify-success="modifyTrainingSlot"
on-slot-modify-cancel="cancelModifyTrainingSlot"
on-slot-modify-unselect="changeModifyTrainingSlot"
on-slot-cancel-success="markSlotAsRemoved"
on-slot-cancel-success="slotCancelled"
after-payment="afterPayment"
reservable-id="{{training.id}}"
reservable-type="Training"

View File

@ -1,6 +1,5 @@
json.array!(@availabilities) do |a|
json.id a.id
json.slot_id a.slot_id if a.slot_id
json.id a.slot_id if a.slot_id
if a.is_reserved
json.is_reserved true
json.title "#{a.trainings[0].name}' - #{t('trainings.i_ve_reserved')}"