Properly set the selected date when editing an existing appointment in the booking page.

This commit is contained in:
Alex Tselegidis 2020-08-31 17:35:27 +03:00
parent 7a496f0166
commit 76755a286d
2 changed files with 5 additions and 5 deletions

View file

@ -690,7 +690,7 @@ window.FrontendBook = window.FrontendBook || {};
// Set Appointment Date // Set Appointment Date
$('#select-date').datepicker('setDate', $('#select-date').datepicker('setDate',
Date.parseExact(appointment.start_datetime, 'yyyy-MM-dd HH:mm:ss')); Date.parseExact(appointment.start_datetime, 'yyyy-MM-dd HH:mm:ss'));
FrontendBookApi.getAvailableHours($('#select-date').val()); FrontendBookApi.getAvailableHours(moment(appointment.start_datetime).format('YYYY-MM-DD'));
// Apply Customer's Data // Apply Customer's Data
$('#last-name').val(customer.last_name); $('#last-name').val(customer.last_name);

View file

@ -32,9 +32,9 @@ window.FrontendBookApi = window.FrontendBookApi || {};
* This function makes an AJAX call and returns the available hours for the selected service, * This function makes an AJAX call and returns the available hours for the selected service,
* provider and date. * provider and date.
* *
* @param {String} selDate The selected date of which the available hours we need to receive. * @param {String} selectedDate The selected date of the available hours we need.
*/ */
exports.getAvailableHours = function (selDate) { exports.getAvailableHours = function (selectedDate) {
$('#available-hours').empty(); $('#available-hours').empty();
// Find the selected service duration (it is going to be send within the "data" object). // Find the selected service duration (it is going to be send within the "data" object).
@ -61,7 +61,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
csrfToken: GlobalVariables.csrfToken, csrfToken: GlobalVariables.csrfToken,
service_id: $('#select-service').val(), service_id: $('#select-service').val(),
provider_id: $('#select-provider').val(), provider_id: $('#select-provider').val(),
selected_date: selDate, selected_date: selectedDate,
service_duration: serviceDuration, service_duration: serviceDuration,
manage_mode: FrontendBook.manageMode, manage_mode: FrontendBook.manageMode,
appointment_id: appointmentId appointment_id: appointmentId
@ -117,7 +117,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
} }
var availableHourMoment = moment var availableHourMoment = moment
.tz(selDate + ' ' + availableHour + ':00', providerTimezone) .tz(selectedDate + ' ' + availableHour + ':00', providerTimezone)
.tz(selectedTimezone); .tz(selectedTimezone);
$('#available-hours div:eq(' + (currentColumn - 1) + ')').append( $('#available-hours div:eq(' + (currentColumn - 1) + ')').append(