Corrected updateConfirmFrame method definition.

This commit is contained in:
Alex Tselegidis 2016-05-14 11:36:17 +02:00
parent f228410c36
commit d7831fc9fa
2 changed files with 11 additions and 13 deletions

View file

@ -85,7 +85,7 @@ window.FrontendBook = window.FrontendBook || {};
onSelect: function(dateText, instance) { onSelect: function(dateText, instance) {
FrontendBookApi.getAvailableHours(dateText); FrontendBookApi.getAvailableHours(dateText);
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
}, },
onChangeMonthYear: function(year, month, instance) { onChangeMonthYear: function(year, month, instance) {
@ -125,7 +125,7 @@ window.FrontendBook = window.FrontendBook || {};
$('#select-provider').change(function() { $('#select-provider').change(function() {
FrontendBookApi.getUnavailableDates($(this).val(), $('#select-service').val(), FrontendBookApi.getUnavailableDates($(this).val(), $('#select-service').val(),
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); $('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
}); });
/** /**
@ -158,7 +158,7 @@ window.FrontendBook = window.FrontendBook || {};
FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(), FrontendBookApi.getUnavailableDates($('#select-provider').val(), $(this).val(),
$('#select-date').datepicker('getDate').toString('yyyy-MM-dd')); $('#select-date').datepicker('getDate').toString('yyyy-MM-dd'));
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
_updateServiceDescription($('#select-service').val(), $('#service-description')); _updateServiceDescription($('#select-service').val(), $('#service-description'));
}); });
@ -196,7 +196,7 @@ window.FrontendBook = window.FrontendBook || {};
if (!_validateCustomerForm()) { if (!_validateCustomerForm()) {
return; // Validation failed, do not continue. return; // Validation failed, do not continue.
} else { } else {
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
} }
} }
@ -235,7 +235,7 @@ window.FrontendBook = window.FrontendBook || {};
$('#available-hours').on('click', '.available-hour', function() { $('#available-hours').on('click', '.available-hour', function() {
$('.selected-hour').removeClass('selected-hour'); $('.selected-hour').removeClass('selected-hour');
$(this).addClass('selected-hour'); $(this).addClass('selected-hour');
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
}); });
if (FrontendBook.manageMode) { if (FrontendBook.manageMode) {
@ -328,11 +328,10 @@ window.FrontendBook = window.FrontendBook || {};
} }
/** /**
* Every time this function is executed, it updates the confirmation * Every time this function is executed, it updates the confirmation page with the latest
* page with the latest customer settigns and input for the appointment * customer settigns and input for the appointment booking.
* booking.
*/ */
function _updateConfirmFrame() { exports.updateConfirmFrame = function() {
// Appointment Details // Appointment Details
var selectedDate = $('#select-date').datepicker('getDate'); var selectedDate = $('#select-date').datepicker('getDate');
if (selectedDate !== null) { if (selectedDate !== null) {
@ -363,7 +362,6 @@ window.FrontendBook = window.FrontendBook || {};
$('#appointment-details').html(html); $('#appointment-details').html(html);
// Customer Details // Customer Details
var firstname = GeneralFunctions.escapeHtml($('#first-name').val()), var firstname = GeneralFunctions.escapeHtml($('#first-name').val()),
lastname = GeneralFunctions.escapeHtml($('#last-name').val()), lastname = GeneralFunctions.escapeHtml($('#last-name').val()),
phoneNumber = GeneralFunctions.escapeHtml($('#phone-number').val()), phoneNumber = GeneralFunctions.escapeHtml($('#phone-number').val()),
@ -390,7 +388,7 @@ window.FrontendBook = window.FrontendBook || {};
// Update appointment form data for submission to server when the user confirms // Update appointment form data for submission to server when the user confirms
// the appointment. // the appointment.
var postData = new Object(); var postData = {};
postData['customer'] = { postData['customer'] = {
last_name: $('#last-name').val(), last_name: $('#last-name').val(),
@ -486,7 +484,7 @@ window.FrontendBook = window.FrontendBook || {};
? appointment['notes'] : ''; ? appointment['notes'] : '';
$('#notes').val(appointmentNotes); $('#notes').val(appointmentNotes);
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
return true; return true;
} catch(exc) { } catch(exc) {

View file

@ -90,7 +90,7 @@ window.FrontendBookApi = window.FrontendBookApi || {};
$('.available-hour:eq(0)').addClass('selected-hour'); $('.available-hour:eq(0)').addClass('selected-hour');
} }
_updateConfirmFrame(); FrontendBook.updateConfirmFrame();
} else { } else {
$('#available-hours').text(EALang['no_available_hours']); $('#available-hours').text(EALang['no_available_hours']);