Improved event selection for both default and table calendar views

This commit is contained in:
Alex Tselegidis 2020-12-08 14:16:58 +02:00
parent 22ac631995
commit b291a2bb24
2 changed files with 42 additions and 7 deletions

View file

@ -1456,8 +1456,25 @@ window.BackendCalendarDefaultView = window.BackendCalendarDefaultView || {};
return provider.services.indexOf(service.id) !== -1
});
$('#select-service').val(service.id).trigger('change');
$('#select-provider').val(provider.id).trigger('change');
if (service) {
$('#select-service').val(service.id);
}
if (!$('#select-service').val()) {
$('#select-service option:first').prop('selected', true);
}
$('#select-service').trigger('change');
if (provider) {
$('#select-provider').val(provider.id);
}
if (!$('#select-provider').val()) {
$('#select-provider option:first').prop('selected', true);
}
$('#select-provider').trigger('change');
}
// Preselect time

View file

@ -206,6 +206,8 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
$dialog.find('#appointment-location').val(appointment.location);
$dialog.find('#appointment-notes').val(appointment.notes);
$dialog.find('#customer-notes').val(customer.notes);
$dialog.modal('show');
} else {
var unavailable = lastFocusedEventData.data;
@ -225,10 +227,9 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
$dialog.find('#unavailable-provider').val(unavailable.id_users_provider);
$dialog.find('#unavailable-end').datetimepicker('setDate', endDatetime);
$dialog.find('#unavailable-notes').val(unavailable.notes);
}
// :: DISPLAY EDIT DIALOG
$dialog.modal('show');
}
});
/**
@ -730,8 +731,25 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
return provider.services.indexOf(service.id) !== -1
});
$('#select-service').val(service.id).trigger('change');
$('#select-provider').val(provider.id).trigger('change');
if (service) {
$('#select-service').val(service.id);
}
if (!$('#select-service').val()) {
$('#select-service option:first').prop('selected', true);
}
$('#select-service').trigger('change');
if (provider) {
$('#select-provider').val(provider.id);
}
if (!$('#select-provider').val()) {
$('#select-provider option:first').prop('selected', true);
}
$('#select-provider').trigger('change');
// Preselect time
$('#start-datetime').datepicker('setDate', new Date(start.format('YYY/MM/DD HH:mm:ss')));