1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) unable to refresh machine/space/training calender after pay an reservation

This commit is contained in:
Du Peng 2023-06-22 11:59:52 +02:00
parent 77035d81e2
commit 11a079b3e2
4 changed files with 11 additions and 42 deletions

View File

@ -1,5 +1,7 @@
# Changelog Fab-manager # Changelog Fab-manager
- Fix a bug: unable to refresh machine/space/training calender after pay an reservation
## v6.0.7 2023 June 20 ## v6.0.7 2023 June 20
- Fix a bug: OpenAPI accounting gateway_object_id missing error - Fix a bug: OpenAPI accounting gateway_object_id missing error

View File

@ -692,20 +692,9 @@ Application.Controllers.controller('ReserveMachineController', ['$scope', '$tran
* Refetch all events from the API and re-populate the calendar with the resulting slots * Refetch all events from the API and re-populate the calendar with the resulting slots
*/ */
const refreshCalendar = function () { const refreshCalendar = function () {
const view = uiCalendarConfig.calendars.calendar.fullCalendar('getView'); $scope.eventSources.splice(0, 1, {
return Availability.machine({ url: `/api/availabilities/machines/${$transition$.params().id}?member_id=${$scope.ctrl.member.id}`,
machineId: $scope.machine.id, textColor: 'black'
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

@ -609,20 +609,9 @@ Application.Controllers.controller('ReserveSpaceController', ['$scope', '$transi
* Refetch all events from the API and re-populate the calendar with the resulting slots * Refetch all events from the API and re-populate the calendar with the resulting slots
*/ */
const refreshCalendar = function () { const refreshCalendar = function () {
const view = uiCalendarConfig.calendars.calendar.fullCalendar('getView'); $scope.eventSources.splice(0, 1, {
return Availability.spaces({ url: `/api/availabilities/spaces/${$transition$.params().id}?member_id=${$scope.ctrl.member.id}`,
spaceId: $scope.space.id, textColor: 'black'
member_id: $scope.ctrl.member.id,
start: view.start,
end: view.end,
timezone: Fablab.timezone
}, function (spaces) {
uiCalendarConfig.calendars.calendar.fullCalendar('removeEvents');
return $scope.eventSources.splice(0, 1, {
events: spaces,
textColor: 'black'
}
);
}); });
}; };

View File

@ -385,20 +385,9 @@ Application.Controllers.controller('ReserveTrainingController', ['$scope', '$tra
* Refetch all events from the API and re-populate the calendar with the resulting slots * Refetch all events from the API and re-populate the calendar with the resulting slots
*/ */
const refreshCalendar = function () { const refreshCalendar = function () {
const view = uiCalendarConfig.calendars.calendar.fullCalendar('getView'); $scope.eventSources.splice(0, 1, {
const id = $transition$.params().id === 'all' ? $transition$.params().id : $scope.training.id; url: `/api/availabilities/trainings/${$transition$.params().id}`,
Availability.trainings({ textColor: 'black'
trainingId: id,
member_id: $scope.ctrl.member.id,
start: view.start,
end: view.end,
timezone: Fablab.timezone
}, function (trainings) {
uiCalendarConfig.calendars.calendar.fullCalendar('removeEvents');
$scope.eventSources.splice(0, 1, {
events: trainings,
textColor: 'black'
});
}); });
} }