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

(bug) admin can't move/cancel event reservation

This commit is contained in:
Sylvain 2022-09-12 09:57:54 +02:00
parent 507420f96c
commit e3b62df7d4
2 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# Changelog Fab-manager
- Script to download translations from Crowdin
- Fix a bug: admin and managers can't cancel or move event reservations
## v5.4.17 2022 September 06

View File

@ -483,6 +483,8 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
* @param reservation {Reservation}
*/
$scope.reservationCanModify = function (reservation) {
if (AuthService.isAuthorized(['admin', 'manager'])) return true;
const slotStart = moment(reservation.slots_reservations_attributes[0].slot_attributes.start_at);
const now = moment();
@ -498,6 +500,8 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
* @param reservation {Reservation}
*/
$scope.reservationCanCancel = function(reservation) {
if (AuthService.isAuthorized(['admin', 'manager'])) return true;
const slotStart = moment(reservation.slots_reservations_attributes[0].slot_attributes.start_at);
const now = moment();
return $scope.enableBookingCancel && slotStart.diff(now, "hours") >= $scope.cancelBookingDelay;