Corrected error if there is no provider or service to select.

This commit is contained in:
Alex Tselegidis 2015-12-10 23:29:15 +01:00
parent c60a0feeaf
commit de872cfc36
2 changed files with 12 additions and 0 deletions

View file

@ -279,6 +279,12 @@ class Appointments extends CI_Controller {
$this->load->model('settings_model'); $this->load->model('settings_model');
try { try {
// Do not continue if there was no provider selected.
if (empty($_POST['provider_id'])) {
echo json_encode(array());
return;
}
// If manage mode is TRUE then the following we should not consider the selected // If manage mode is TRUE then the following we should not consider the selected
// appointment when calculating the available time periods of the provider. // appointment when calculating the available time periods of the provider.
$exclude_appointments = ($_POST['manage_mode'] === 'true') $exclude_appointments = ($_POST['manage_mode'] === 'true')

View file

@ -158,6 +158,12 @@ var FrontendBook = {
* be perfomed, depending the current wizard step. * be perfomed, depending the current wizard step.
*/ */
$('.button-next').click(function() { $('.button-next').click(function() {
// If we are on the first step and there is not provider selected do not continue
// with the next step.
if ($(this).attr('data-step_index') === '1' && $('#select-provider').val() == null) {
return;
}
// If we are on the 2nd tab then the user should have an appointment hour // If we are on the 2nd tab then the user should have an appointment hour
// selected. // selected.
if ($(this).attr('data-step_index') === '2') { if ($(this).attr('data-step_index') === '2') {