diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index b779f334..548913b8 100755 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -279,6 +279,12 @@ class Appointments extends CI_Controller { $this->load->model('settings_model'); 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 // appointment when calculating the available time periods of the provider. $exclude_appointments = ($_POST['manage_mode'] === 'true') diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index 495bf63d..6d873512 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -158,6 +158,12 @@ var FrontendBook = { * be perfomed, depending the current wizard step. */ $('.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 // selected. if ($(this).attr('data-step_index') === '2') {