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');
$cancellation_reason = request('cancellation_reason');
$cancellation_reason = (string)request('cancellation_reason');
if (empty($appointment_id))
{

View file

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