mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-19 13:54:25 +01:00
Ability to create slots in the past
This commit is contained in:
parent
96f80de4c0
commit
9e742cd1b6
@ -1,6 +1,7 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Ability to cancel a payement schedule from the interface
|
||||
- Ability to create slots in the past
|
||||
- Updated caniuse db
|
||||
- Optimized the load time of the payment schedules list
|
||||
|
||||
|
@ -407,10 +407,30 @@ Application.Controllers.controller('AdminCalendarController', ['$scope', '$state
|
||||
// check if slot is not in the past
|
||||
const today = new Date();
|
||||
if (Math.trunc((start.valueOf() - today) / (60 * 1000)) < 0) {
|
||||
growl.warning(_t('app.admin.calendar.event_in_the_past'));
|
||||
return uiCalendarConfig.calendars.calendar.fullCalendar('unselect');
|
||||
return dialogs.confirm({
|
||||
resolve: {
|
||||
object () {
|
||||
return {
|
||||
title: _t('app.admin.calendar.event_in_the_past'),
|
||||
msg: _t('app.admin.calendar.confirm_create_event_in_the_past')
|
||||
};
|
||||
}
|
||||
}
|
||||
},
|
||||
function () { // confirmed
|
||||
startAvailabilityCreation(start, end);
|
||||
}, function () { // canceled
|
||||
uiCalendarConfig.calendars.calendar.fullCalendar('unselect');
|
||||
});
|
||||
}
|
||||
|
||||
startAvailabilityCreation(start, end);
|
||||
};
|
||||
|
||||
/**
|
||||
* Start the process to create a new availability between the given start and end datetimes
|
||||
*/
|
||||
const startAvailabilityCreation = function (start, end) {
|
||||
// check that the selected slot is an multiple of SLOT_MULTIPLE (ie. not decimal)
|
||||
const slots = Math.trunc((end.valueOf() - start.valueOf()) / (60 * 1000)) / SLOT_MULTIPLE;
|
||||
if (!Number.isInteger(slots)) {
|
||||
|
@ -98,7 +98,8 @@ en:
|
||||
delete_this_slot: "Only this slot"
|
||||
delete_this_and_next: "This slot and the following"
|
||||
delete_all: "All slots"
|
||||
event_in_the_past: "Unable to create a slot in the past."
|
||||
event_in_the_past: "Create a slot in the past"
|
||||
confirm_create_event_in_the_past: "You are about to create a slot in the past. Are you sure you want to do this? Members will not be able to book this slot."
|
||||
edit_event: "Edit the event"
|
||||
view_reservations: "View reservations"
|
||||
legend: "Legend"
|
||||
|
Loading…
x
Reference in New Issue
Block a user