Update the equivalent appointment removal action of the calendar table view.

This commit is contained in:
Alex Tselegidis 2023-06-01 14:30:08 +02:00
parent 8e37e54bdb
commit 2f69be2bd0
2 changed files with 10 additions and 12 deletions

View file

@ -312,7 +312,7 @@ class Calendar extends EA_Controller {
} }
$appointment_id = request('appointment_id'); $appointment_id = request('appointment_id');
$cancellation_reason = request('cancellation_reason'); $cancellation_reason = (string)request('cancellation_reason');
if (empty($appointment_id)) if (empty($appointment_id))
{ {

View file

@ -297,19 +297,19 @@ App.Utils.CalendarTableView = (function () {
const buttons = [ const buttons = [
{ {
text: lang('cancel'), text: lang('cancel'),
click: () => { click: (event, messageModal) => {
$('#message-box').dialog('close'); messageModal.dispose();
} }
}, },
{ {
text: lang('delete'), text: lang('delete'),
click: () => { click: (event, messageModal) => {
const appointmentId = lastFocusedEventData.extendedProps.data.id; const appointmentId = lastFocusedEventData.extendedProps.data.id;
const deleteReason = $('#delete-reason').val(); const cancellationReason = $('#cancellation-reason').val();
App.Http.Calendar.deleteAppointment(appointmentId, deleteReason).done(() => { App.Http.Calendar.deleteAppointment(appointmentId, cancellationReason).done(() => {
$('#message-box').dialog('close'); messageModal.dispose();
// Refresh calendar event items. // Refresh calendar event items.
$reloadAppointments.trigger('click'); $reloadAppointments.trigger('click');
@ -326,16 +326,14 @@ App.Utils.CalendarTableView = (function () {
$('<textarea/>', { $('<textarea/>', {
'class': 'form-control w-100', 'class': 'form-control w-100',
'id': 'delete-reason', 'id': 'cancellation-reason',
'rows': '3' 'rows': '3'
}).appendTo('#message-box'); }).appendTo('#message-modal .modal-body');
} else { } else {
// Do not display confirmation prompt. // Do not display confirmation prompt.
const unavailabilityId = lastFocusedEventData.extendedProps.data.id; const unavailabilityId = lastFocusedEventData.extendedProps.data.id;
App.Http.Calendar.deleteUnavailability(unavailabilityId).done(() => { App.Http.Calendar.deleteUnavailability(unavailabilityId).done(() => {
$('#message-box').dialog('close');
// Refresh calendar event items. // Refresh calendar event items.
$reloadAppointments.trigger('click'); $reloadAppointments.trigger('click');
}); });