The calendar will ask for the kind of event to be added after selecting time slots with the mouse.

This commit is contained in:
Alex Tselegidis 2022-01-24 22:55:35 +01:00
parent b968970fa6
commit 4c0793129d
28 changed files with 132 additions and 38 deletions

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -363,4 +363,6 @@ $lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['copy'] = 'Copy';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -361,4 +361,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -362,4 +362,6 @@ $lang['private_hint'] = 'Private records will not be displayed or processed in p
$lang['reset'] = 'Reset';
$lang['all'] = 'All';
$lang['booking_link'] = 'Booking Link';
$lang['add_new_event'] = 'Add New Event';
$lang['what_kind_of_event'] = 'What kind of event would you like to add?';
// End

View file

@ -1474,51 +1474,91 @@ App.Utils.CalendarDefaultView = (function () {
return;
}
$('#insert-appointment').trigger('click');
const isProviderDisplayed =
$selectFilterItem.find('option:selected').attr('type') === FILTER_TYPE_PROVIDER;
// Preselect service & provider.
let service;
const buttons = [
{
text: lang('close'),
click: () => {
$('#message-box').dialog('close');
}
},
{
text: lang('unavailability'),
click: () => {
$('#insert-unavailability').trigger('click');
if ($selectFilterItem.find('option:selected').attr('type') === FILTER_TYPE_SERVICE) {
service = vars('available_services').find(
(availableService) => Number(availableService.id) === Number($selectFilterItem.val())
);
$appointmentsModal.find('#select-service').val(service.id).trigger('change');
} else {
const provider = vars('available_providers').find(
(availableProvider) => Number(availableProvider.id) === Number($selectFilterItem.val())
);
if (isProviderDisplayed) {
$('#unavailability-provider').val($selectFilterItem.val());
} else {
$('#unavailability-provider option:first').prop('selected', true);
}
if (provider) {
service = vars('available_services').find(
(availableService) => provider.services.indexOf(availableService.id) !== -1
);
$('#unavailability-start').datepicker('setDate', info.start);
if (service) {
$appointmentsModal.find('#select-service').val(service.id);
$('#unavailability-end').datepicker('setDate', info.end);
$('#message-box').dialog('close');
}
},
{
text: lang('appointment'),
click: () => {
$('#insert-appointment').trigger('click');
// Preselect service & provider.
let service;
if (isProviderDisplayed) {
const provider = vars('available_providers').find(
(availableProvider) =>
Number(availableProvider.id) === Number($selectFilterItem.val())
);
if (provider) {
service = vars('available_services').find(
(availableService) => provider.services.indexOf(availableService.id) !== -1
);
if (service) {
$appointmentsModal.find('#select-service').val(service.id);
}
}
if (!$appointmentsModal.find('#select-service').val()) {
$('#select-service option:first').prop('selected', true);
}
$appointmentsModal.find('#select-service').trigger('change');
if (provider) {
$appointmentsModal.find('#select-provider').val(provider.id);
}
if (!$appointmentsModal.find('#select-provider').val()) {
$appointmentsModal.find('#select-provider option:first').prop('selected', true);
}
$appointmentsModal.find('#select-provider').trigger('change');
} else {
service = vars('available_services').find(
(availableService) =>
Number(availableService.id) === Number($selectFilterItem.val())
);
$appointmentsModal.find('#select-service').val(service.id).trigger('change');
}
// Preselect time
$('#start-datetime').datepicker('setDate', info.start);
$('#end-datetime').datepicker('setDate', info.end);
$('#message-box').dialog('close');
}
}
];
if (!$appointmentsModal.find('#select-service').val()) {
$('#select-service option:first').prop('selected', true);
}
$appointmentsModal.find('#select-service').trigger('change');
if (provider) {
$appointmentsModal.find('#select-provider').val(provider.id);
}
if (!$appointmentsModal.find('#select-provider').val()) {
$appointmentsModal.find('#select-provider option:first').prop('selected', true);
}
$appointmentsModal.find('#select-provider').trigger('change');
}
// Preselect time
$('#start-datetime').datepicker('setDate', info.start);
$('#end-datetime').datepicker('setDate', info.end);
App.Utils.Message.show(lang('add_new_event'), lang('what_kind_of_event'), buttons);
return false;
},