Fix the rescheduling functionality in the booking page

This commit is contained in:
Alex Tselegidis 2022-10-16 18:07:45 +03:00
parent c8ebfae7ff
commit 8449fd3d28
3 changed files with 7 additions and 4 deletions

View file

@ -225,6 +225,9 @@ class Booking extends EA_Controller {
'first_weekday' => $first_weekday,
'display_cookie_notice' => $display_cookie_notice,
'display_any_provider' => setting('display_any_provider'),
'appointment_data' => $appointment,
'provider_data' => $provider,
'customer_data' => $customer,
]);
html_vars([
@ -316,7 +319,7 @@ class Booking extends EA_Controller {
// If manage mode is TRUE then the following we should not consider the selected appointment when
// calculating the available time periods of the provider.
$exclude_appointment_id = request('manage_mode') === 'true' ? request('appointment_id') : NULL;
$exclude_appointment_id = request('manage_mode') ? request('appointment_id') : NULL;
// If the user has selected the "any-provider" option then we will need to search for an available provider
// that will provide the requested service.

View file

@ -52,7 +52,7 @@ App.Http.Booking = (function () {
}
// If the manage mode is true then the appointment's start date should return as available too.
const appointmentId = App.Pages.Booking.manageMode ? vars('appointment_data').id : null;
const appointmentId = vars('manage_mode') ? vars('appointment_data').id : null;
// Make ajax post request and get the available hours.
const url = App.Utils.Url.siteUrl('booking/get_available_hours');
@ -63,7 +63,7 @@ App.Http.Booking = (function () {
provider_id: $selectProvider.val(),
selected_date: selectedDate,
service_duration: serviceDuration,
manage_mode: App.Pages.Booking.manageMode,
manage_mode: Number(vars('manage_mode') || 0),
appointment_id: appointmentId
};

View file

@ -40,7 +40,7 @@ App.Pages.Booking = (function () {
*
* @type {Boolean}
*/
let manageMode = false;
let manageMode = vars('manage_mode') || false;
/**
* Initialize the module.