1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-19 08:52:25 +01:00

(bug) unable to cancel a machine reservation + unable to update member profile

This commit is contained in:
Sylvain 2022-07-20 11:52:38 +02:00
parent 0d072291c7
commit e0944746a9
3 changed files with 25 additions and 3 deletions

View File

@ -554,7 +554,24 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$tran
$scope.updateMember = function () { $scope.updateMember = function () {
$scope.plansAreShown = false; $scope.plansAreShown = false;
$scope.selectedPlan = null; $scope.selectedPlan = null;
Member.get({ id: $scope.ctrl.member.id }, function (member) { $scope.ctrl.member = member; }); Member.get({ id: $scope.ctrl.member.id }, function (member) {
$scope.ctrl.member = member;
const view = uiCalendarConfig.calendars.calendar.fullCalendar('getView');
return Availability.machine({
machineId: $scope.machine.id,
member_id: $scope.ctrl.member.id,
start: view.start,
end: view.end,
timezone: Fablab.timezone
}, function (slots) {
uiCalendarConfig.calendars.calendar.fullCalendar('removeEvents');
return $scope.eventSources.splice(0, 1, {
events: slots,
textColor: 'black'
}
);
});
});
}; };
/** /**

View File

@ -556,7 +556,12 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs',
// slot is reserved and currently modified // slot is reserved and currently modified
// -> we cancel the modification // -> we cancel the modification
$scope.cancelModifySlot(); $scope.cancelModifySlot();
} else if ($scope.slot.is_reserved && (slotCanBeModified($scope.slot) || slotCanBeCanceled($scope.slot)) && !$scope.events.modifiable && ($scope.events.reserved.length === 0)) { } else if ($scope.slot.is_reserved &&
(slotCanBeModified($scope.slot) || slotCanBeCanceled($scope.slot)) &&
!$scope.events.modifiable &&
($scope.events.reserved.length === 0) &&
$scope.user &&
$scope.slot.users.map(u => u.id).includes($scope.user.id)) {
// slot is reserved and is ok to be modified or cancelled // slot is reserved and is ok to be modified or cancelled
// but we are not currently running a modification or having any slots in the cart // but we are not currently running a modification or having any slots in the cart
// -> first affect the modification/cancellation rights attributes to the current slot // -> first affect the modification/cancellation rights attributes to the current slot

View File

@ -36,7 +36,7 @@ class Members::MembersService
end end
end end
MembersService.handle_organization(params) Members::MembersService.handle_organization(params)
not_complete = member.need_completion? not_complete = member.need_completion?
up_result = member.update(params) up_result = member.update(params)