diff --git a/app/frontend/src/javascript/controllers/machines.js.erb b/app/frontend/src/javascript/controllers/machines.js.erb index c7d026334..a5e771465 100644 --- a/app/frontend/src/javascript/controllers/machines.js.erb +++ b/app/frontend/src/javascript/controllers/machines.js.erb @@ -554,7 +554,24 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$tran $scope.updateMember = function () { $scope.plansAreShown = false; $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' + } + ); + }); + }); }; /** diff --git a/app/frontend/src/javascript/directives/cart.js b/app/frontend/src/javascript/directives/cart.js index 6c097dff6..c1f678cfb 100644 --- a/app/frontend/src/javascript/directives/cart.js +++ b/app/frontend/src/javascript/directives/cart.js @@ -556,7 +556,12 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', // slot is reserved and currently modified // -> we cancel the modification $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 // 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 diff --git a/app/services/members/members_service.rb b/app/services/members/members_service.rb index 0adacf571..f89a2c459 100644 --- a/app/services/members/members_service.rb +++ b/app/services/members/members_service.rb @@ -36,7 +36,7 @@ class Members::MembersService end end - MembersService.handle_organization(params) + Members::MembersService.handle_organization(params) not_complete = member.need_completion? up_result = member.update(params)