mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
Improved user experience in defining slots in the calendar management
This commit is contained in:
parent
d7aed3fa1f
commit
35fb991cdb
@ -1,5 +1,6 @@
|
|||||||
# Changelog Fab Manager
|
# Changelog Fab Manager
|
||||||
|
|
||||||
|
- Improved user experience in defining slots in the calendar management
|
||||||
- Improved notification email to the member when a rolling subscription is taken
|
- Improved notification email to the member when a rolling subscription is taken
|
||||||
- Handle Ctrl^C in upgrade scripts
|
- Handle Ctrl^C in upgrade scripts
|
||||||
- Updated moment-timezone
|
- Updated moment-timezone
|
||||||
|
@ -275,46 +275,56 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
|
|||||||
var calendarSelectCb = function (start, end, jsEvent, view) {
|
var calendarSelectCb = function (start, end, jsEvent, view) {
|
||||||
start = moment.tz(start.toISOString(), Fablab.timezone);
|
start = moment.tz(start.toISOString(), Fablab.timezone);
|
||||||
end = moment.tz(end.toISOString(), Fablab.timezone);
|
end = moment.tz(end.toISOString(), Fablab.timezone);
|
||||||
// first we check that the selected slot is an N-hours multiple (ie. not decimal)
|
|
||||||
if (Number.isInteger(parseInt((end.valueOf() - start.valueOf()) / (SLOT_MULTIPLE * 1000), 10) / SLOT_MULTIPLE)) {
|
// check if slot is not in the past
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
if (parseInt((start.valueOf() - today) / (60 * 1000), 10) >= 0) {
|
if (Math.trunc((start.valueOf() - today) / (60 * 1000)) < 0) {
|
||||||
// then we open a modal window to let the admin specify the slot type
|
growl.warning(_t('admin_calendar.event_in_the_past'));
|
||||||
const modalInstance = $uibModal.open({
|
return uiCalendarConfig.calendars.calendar.fullCalendar('unselect');
|
||||||
templateUrl: '<%= asset_path "admin/calendar/eventModal.html" %>',
|
|
||||||
controller: 'CreateEventModalController',
|
|
||||||
resolve: {
|
|
||||||
start () { return start; },
|
|
||||||
end () { return end; },
|
|
||||||
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
|
||||||
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
|
|
||||||
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }]
|
|
||||||
} });
|
|
||||||
// when the modal is closed, we send the slot to the server for saving
|
|
||||||
modalInstance.result.then(
|
|
||||||
function (availability) {
|
|
||||||
uiCalendarConfig.calendars.calendar.fullCalendar(
|
|
||||||
'renderEvent',
|
|
||||||
{
|
|
||||||
id: availability.id,
|
|
||||||
title: availability.title,
|
|
||||||
start: availability.start_at,
|
|
||||||
end: availability.end_at,
|
|
||||||
textColor: 'black',
|
|
||||||
backgroundColor: availability.backgroundColor,
|
|
||||||
borderColor: availability.borderColor,
|
|
||||||
tag_ids: availability.tag_ids,
|
|
||||||
tags: availability.tags,
|
|
||||||
machine_ids: availability.machine_ids
|
|
||||||
},
|
|
||||||
true
|
|
||||||
);
|
|
||||||
},
|
|
||||||
function () { uiCalendarConfig.calendars.calendar.fullCalendar('unselect'); }
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check that the selected slot is an N-hours multiple (ie. not decimal)
|
||||||
|
const slots = Math.trunc((end.valueOf() - start.valueOf()) / (60 * 1000)) / SLOT_MULTIPLE;
|
||||||
|
if (!Number.isInteger(slots)) {
|
||||||
|
// otherwise, round it to nearest decimal
|
||||||
|
const nearest = Math.round(slots) * SLOT_MULTIPLE;
|
||||||
|
end = moment(start).add(nearest, 'minutes');
|
||||||
|
}
|
||||||
|
|
||||||
|
// then we open a modal window to let the admin specify the slot type
|
||||||
|
const modalInstance = $uibModal.open({
|
||||||
|
templateUrl: '<%= asset_path "admin/calendar/eventModal.html" %>',
|
||||||
|
controller: 'CreateEventModalController',
|
||||||
|
resolve: {
|
||||||
|
start () { return start; },
|
||||||
|
end () { return end; },
|
||||||
|
machinesPromise: ['Machine', function (Machine) { return Machine.query().$promise; }],
|
||||||
|
trainingsPromise: ['Training', function (Training) { return Training.query().$promise; }],
|
||||||
|
spacesPromise: ['Space', function (Space) { return Space.query().$promise; }]
|
||||||
|
} });
|
||||||
|
// when the modal is closed, we send the slot to the server for saving
|
||||||
|
modalInstance.result.then(
|
||||||
|
function (availability) {
|
||||||
|
uiCalendarConfig.calendars.calendar.fullCalendar(
|
||||||
|
'renderEvent',
|
||||||
|
{
|
||||||
|
id: availability.id,
|
||||||
|
title: availability.title,
|
||||||
|
start: availability.start_at,
|
||||||
|
end: availability.end_at,
|
||||||
|
textColor: 'black',
|
||||||
|
backgroundColor: availability.backgroundColor,
|
||||||
|
borderColor: availability.borderColor,
|
||||||
|
tag_ids: availability.tag_ids,
|
||||||
|
tags: availability.tags,
|
||||||
|
machine_ids: availability.machine_ids
|
||||||
|
},
|
||||||
|
true
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function () { uiCalendarConfig.calendars.calendar.fullCalendar('unselect'); }
|
||||||
|
);
|
||||||
|
|
||||||
return uiCalendarConfig.calendars.calendar.fullCalendar('unselect');
|
return uiCalendarConfig.calendars.calendar.fullCalendar('unselect');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ en:
|
|||||||
unlockable_because_reservations: "Unable to block booking on this slot because some uncancelled reservations exist on it."
|
unlockable_because_reservations: "Unable to block booking on this slot because some uncancelled reservations exist on it."
|
||||||
delete_slot: "Delete this slot"
|
delete_slot: "Delete this slot"
|
||||||
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?"
|
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?"
|
||||||
|
event_in_the_past: "Unable to create a slot in the past."
|
||||||
|
|
||||||
project_elements:
|
project_elements:
|
||||||
# management of the projects' components
|
# management of the projects' components
|
||||||
|
@ -61,6 +61,7 @@ es:
|
|||||||
unlockable_because_reservations: "No se puede bloquear la reserva en esta ranura porque existen algunas reservas no canceladas."
|
unlockable_because_reservations: "No se puede bloquear la reserva en esta ranura porque existen algunas reservas no canceladas."
|
||||||
delete_slot: "Delete this slot" # translation_missing
|
delete_slot: "Delete this slot" # translation_missing
|
||||||
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?"
|
do_you_really_want_to_delete_this_slot: "Do you really want to delete this slot?"
|
||||||
|
event_in_the_past: "Unable to create a slot in the past." # translation_missing
|
||||||
|
|
||||||
project_elements:
|
project_elements:
|
||||||
# management of the projects' components
|
# management of the projects' components
|
||||||
|
@ -61,6 +61,7 @@ fr:
|
|||||||
unlockable_because_reservations: "Impossible de bloquer les réservations sur ce créneau car il existe des réservations non annulées sur celui-ci."
|
unlockable_because_reservations: "Impossible de bloquer les réservations sur ce créneau car il existe des réservations non annulées sur celui-ci."
|
||||||
delete_slot: "Supprimer le créneau"
|
delete_slot: "Supprimer le créneau"
|
||||||
do_you_really_want_to_delete_this_slot: "Êtes vous sur de vouloir supprimer ce créneau ?"
|
do_you_really_want_to_delete_this_slot: "Êtes vous sur de vouloir supprimer ce créneau ?"
|
||||||
|
event_in_the_past: "Impossible de créer un créneau dans le passé."
|
||||||
|
|
||||||
project_elements:
|
project_elements:
|
||||||
# gestion des éléments constituant les projets
|
# gestion des éléments constituant les projets
|
||||||
|
@ -61,6 +61,7 @@ pt:
|
|||||||
unlockable_because_reservations: "Não é possível bloquear a reserva neste slot porque existem algumas reservas não cancelados nele."
|
unlockable_because_reservations: "Não é possível bloquear a reserva neste slot porque existem algumas reservas não cancelados nele."
|
||||||
delete_slot: "Exclua o slot"
|
delete_slot: "Exclua o slot"
|
||||||
do_you_really_want_to_delete_this_slot: "Você realmente quer excluir esse slot?"
|
do_you_really_want_to_delete_this_slot: "Você realmente quer excluir esse slot?"
|
||||||
|
event_in_the_past: "Unable to create a slot in the past." # translation_missing
|
||||||
|
|
||||||
project_elements:
|
project_elements:
|
||||||
# management of the projects' components
|
# management of the projects' components
|
||||||
|
Loading…
x
Reference in New Issue
Block a user