From 8da6304f263c761768fa5c14aa249f23578426d5 Mon Sep 17 00:00:00 2001 From: "alextselegidis@gmail.com" Date: Fri, 18 Oct 2013 14:56:12 +0000 Subject: [PATCH] * Fixed bugs in backend and front end (booking process) * Made css changes to backend. * Applied qtip into backend control tootips. --- src/application/config/config.php | 1 + src/application/controllers/appointments.php | 54 +++--- src/application/controllers/backend_api.php | 2 +- src/application/views/appointments/book.php | 4 + src/application/views/backend/footer.php | 9 +- src/application/views/backend/header.php | 5 +- src/application/views/backend/services.php | 14 +- src/application/views/backend/settings.php | 62 +++---- src/assets/css/backend.css | 166 ++++++++++++++----- src/assets/css/general.css | 9 + src/assets/js/backend.js | 10 ++ src/assets/js/backend_calendar.js | 29 +++- src/assets/js/backend_customers.js | 2 + src/assets/js/backend_settings.js | 47 +++++- src/assets/js/backend_users.js | 10 ++ src/assets/js/backend_users_providers.js | 1 + src/assets/js/frontend_book.js | 14 +- src/assets/sql/structure.sql | 2 +- 18 files changed, 312 insertions(+), 129 deletions(-) diff --git a/src/application/config/config.php b/src/application/config/config.php index e02350c7..0dc05abb 100644 --- a/src/application/config/config.php +++ b/src/application/config/config.php @@ -20,6 +20,7 @@ include dirname(dirname(dirname(__FILE__))) . '/configuration.php'; require_once dirname(dirname(dirname(__FILE__))) . '/configuration.php'; $config['base_url'] = SystemConfiguration::$base_url; $config['ea_version'] = '0.6'; // This must be changed manually. +$config['ea_release_title'] = 'Alpha'; // Leave empty for no title or add BETA, TEST etc ... /* |-------------------------------------------------------------------------- diff --git a/src/application/controllers/appointments.php b/src/application/controllers/appointments.php index 879faca6..c9d28702 100644 --- a/src/application/controllers/appointments.php +++ b/src/application/controllers/appointments.php @@ -303,6 +303,8 @@ class Appointments extends CI_Controller { * available hours we want to see. * @param numeric $_POST['service_duration'] The selected service duration in * minutes. + * @param string $$_POST['manage_mode'] Contains either 'true' or 'false' and determines + * the if current user is managing an already booked appointment or not. * @return Returns a json object with the available hours. */ public function ajax_get_available_hours() { @@ -320,16 +322,15 @@ class Appointments extends CI_Controller { $empty_periods = $this->get_provider_available_time_periods($_POST['provider_id'], $_POST['selected_date'], $exclude_appointments); - // Calculate the available appointment hours for the given date. - // The empty spaces are broken down to 15 min and if the service - // fit in each quarter then a new available hour is added to the - // $available hours array. + // Calculate the available appointment hours for the given date. The empty spaces + // are broken down to 15 min and if the service fit in each quarter then a new + // available hour is added to the "$available_hours" array. $available_hours = array(); - foreach($empty_periods as $period) { + foreach ($empty_periods as $period) { $start_hour = new DateTime($_POST['selected_date'] . ' ' . $period['start']); - $end_hour = new DateTime($_POST['selected_date'] . ' ' . $period['end']); + $end_hour = new DateTime($_POST['selected_date'] . ' ' . $period['end']); $minutes = $start_hour->format('i'); @@ -347,13 +348,13 @@ class Appointments extends CI_Controller { } } - $curr_hour = $start_hour; - $diff = $curr_hour->diff($end_hour); + $current_hour = $start_hour; + $diff = $current_hour->diff($end_hour); - while(($diff->h * 60 + $diff->i) > intval($_POST['service_duration'])) { - $available_hours[] = $curr_hour->format('H:i'); - $curr_hour->add(new DateInterval("PT15M")); - $diff = $curr_hour->diff($end_hour); + while (($diff->h * 60 + $diff->i) > intval($_POST['service_duration'])) { + $available_hours[] = $current_hour->format('H:i'); + $current_hour->add(new DateInterval("PT15M")); + $diff = $current_hour->diff($end_hour); } } @@ -366,15 +367,12 @@ class Appointments extends CI_Controller { if ($_POST['manage_mode'] === 'true') { $book_advance_timeout = 0; } else { - $book_advance_timeout = $this->settings_model->get_setting( - 'book_advance_timeout'); + $book_advance_timeout = $this->settings_model->get_setting('book_advance_timeout'); } - foreach($available_hours as $index=>$value) { + foreach($available_hours as $index => $value) { $available_hour = strtotime($value); - $current_hour = strtotime('+' . $book_advance_timeout . ' minutes', - strtotime('now')); - + $current_hour = strtotime('+' . $book_advance_timeout . ' minutes', strtotime('now')); if ($available_hour <= $current_hour) { unset($available_hours[$index]); } @@ -382,12 +380,11 @@ class Appointments extends CI_Controller { } $available_hours = array_values($available_hours); - echo json_encode($available_hours); } catch(Exception $exc) { echo json_encode(array( - 'exceptions' => array( exceptionToJavaScript($exc) ) + 'exceptions' => array(exceptionToJavaScript($exc)) )); } } @@ -463,8 +460,7 @@ class Appointments extends CI_Controller { $this->load->model('providers_model'); // Get the provider's working plan and reserved appointments. - $working_plan = json_decode($this->providers_model->get_setting('working_plan', - $provider_id), true); + $working_plan = json_decode($this->providers_model->get_setting('working_plan', $provider_id), true); $where_clause = array( 'DATE(start_datetime)' => date('Y-m-d', strtotime($selected_date)), @@ -474,10 +470,10 @@ class Appointments extends CI_Controller { $reserved_appointments = $this->appointments_model->get_batch($where_clause); // Sometimes it might be necessary to not take into account some appointment records - // in order to display what the providers available time periods would be without them. - foreach($exclude_appointments as $excluded_appointment) { - foreach($reserved_appointments as $index=>$appointment) { - if ($appointment['id'] == $excluded_appointment['id']) { + // in order to display what the providers' available time periods would be without them. + foreach ($exclude_appointments as $excluded_id) { + foreach ($reserved_appointments as $index => $reserved) { + if ($reserved['id'] == $excluded_id) { unset($reserved_appointments[$index]); } } @@ -523,9 +519,9 @@ class Appointments extends CI_Controller { foreach($available_periods_with_breaks as $period) { - foreach($reserved_appointments as $index=>$appointment) { - $appointment_start = date('H:i', strtotime($appointment['start_datetime'])); - $appointment_end = date('H:i', strtotime($appointment['end_datetime'])); + foreach($reserved_appointments as $index=>$reserved) { + $appointment_start = date('H:i', strtotime($reserved['start_datetime'])); + $appointment_end = date('H:i', strtotime($reserved['end_datetime'])); $period_start = date('H:i', strtotime($period['start'])); $period_end = date('H:i', strtotime($period['end'])); diff --git a/src/application/controllers/backend_api.php b/src/application/controllers/backend_api.php index eec38de2..4b85f7a7 100644 --- a/src/application/controllers/backend_api.php +++ b/src/application/controllers/backend_api.php @@ -187,7 +187,7 @@ class Backend_api extends CI_Controller { $provider_title = 'A new appointment has been added to your plan.'; $provider_message = 'You can make changes by clicking the appointment ' . 'link below'; - $provider_link = $this->config->item('base_url') . 'backend/' + $provider_link = $this->config->item('base_url') . 'backend/index/' . $appointment['hash']; } else { $customer_title = 'Appointment changes have been successfully saved!'; diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index b8c6c9b9..264fb3da 100644 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -28,6 +28,10 @@ rel="stylesheet" type="text/css" href="config->base_url(); ?>assets/css/frontend.css"> + Easy!Appointments - vconfig->item('ea_version'); ?> + config->item('ea_version'); + + $release_title = $this->config->item('ea_release_title'); + if ($release_title != '') { + echo ' - ' . $release_title; + } + ?> | Licensed Under GPLv3 diff --git a/src/application/views/backend/header.php b/src/application/views/backend/header.php index 5fbdea53..407ee426 100644 --- a/src/application/views/backend/header.php +++ b/src/application/views/backend/header.php @@ -129,8 +129,9 @@ - - Logout + + Log Out diff --git a/src/application/views/backend/services.php b/src/application/views/backend/services.php index 23b9db53..e2934243 100644 --- a/src/application/views/backend/services.php +++ b/src/application/views/backend/services.php @@ -81,22 +81,22 @@ - + - + - + - + - +

Fields with * are required! @@ -158,10 +158,10 @@ - + - + \ No newline at end of file diff --git a/src/application/views/backend/settings.php b/src/application/views/backend/settings.php index 61ccc020..f2a26aba 100644 --- a/src/application/views/backend/settings.php +++ b/src/application/views/backend/settings.php @@ -39,7 +39,7 @@ -
  • User
  • +
  • Current User
  • @@ -61,31 +61,33 @@ - - - Company name will be displayed everywhere on the system - (required). - -
    - - - - This will be the company email address. It will be used - as the sender and the reply address of the system emails (required). - -
    - - - - Company link should point to the official website of - the company (optional). - -
    - - - - Go To Booking Page - +
    + + + Company name will be displayed everywhere on the system + (required). + +
    + + + + This will be the company email address. It will be used + as the sender and the reply address of the system emails (required). + +
    + + + + Company link should point to the official website of + the company (optional). + +
    + + + + Go To Booking Page + +
    @@ -109,7 +111,7 @@
    -
    +

    Working Plan

    Mark below the days and hours that your company will accept appointments. @@ -179,7 +181,7 @@
    -
    +

    Breaks

    @@ -224,7 +226,7 @@
    -
    +
    Personal Info @@ -265,7 +267,7 @@
    -
    +
    Miscellaneous diff --git a/src/assets/css/backend.css b/src/assets/css/backend.css index e64c00e9..8af2afe0 100644 --- a/src/assets/css/backend.css +++ b/src/assets/css/backend.css @@ -28,10 +28,12 @@ root { } #header #header-logo span { - float: left; - font-size: 20px; - color: white; - margin-top: 16px; + float: left; + font-size: 20px; + color: white; + margin-top: 16px; + font-weight: bold; + text-shadow: 1px 1px 0px rgb(32, 99, 48); } #header #header-menu { @@ -41,25 +43,28 @@ root { } #header #header-menu .menu-item { - float: left; - margin-right: 8px; - margin-top: 10px; - padding: 15px 12px; - min-width: 68px; - text-align: center; - font-weight: bold; - color: #FFF; + float: left; + margin-right: 8px; + margin-top: 11px; + padding: 13px 12px; + min-width: 68px; + text-align: center; + font-weight: bold; + color: #FFF; text-decoration: none; - font-size: 16px; + font-size: 16px; + border-radius: 3px; } #header #header-menu .menu-item:hover:not(.active) { - background-color: #247A4B; + background-color: #2A8F57; + border-bottom: 2px solid #2E7244; } #header #header-menu .active { - color: #E7FFB3; - text-shadow: 1px 1px 0px #57814D; + color: #C5FFD6; + background: #29A067; + border-bottom: 2px solid #2A7751; } #footer { @@ -154,6 +159,13 @@ body .ui-dialog .ui-dialog-buttonpane { background: #FFFFC2 !important; } +.working-plan td { + vertical-align: middle; +} + +.breaks td { + vertical-align: middle; +} /* BACKEND CALENDAR PAGE -------------------------------------------------------------------- */ @@ -278,8 +290,13 @@ body .ui-dialog .ui-dialog-buttonpane { /* BACKEND CUSTOMERS PAGE -------------------------------------------------------------------- */ +#customers-page h2 { + color: #525252; +} + #customers-page #filter-customers { margin: 15px 0px 15px 15px; + width: 350px; } #customers-page .filter-records .results { @@ -289,11 +306,11 @@ body .ui-dialog .ui-dialog-buttonpane { } #customers-page #filter-customers .results .customer-row { - padding: 10px 7px; border-radius: 3px; + padding: 10px 7px; } -#customers-page #filter-customers .results .customer-row:hover { - background-color: #C6E7D5; +#customers-page #filter-customers .results .customer-row:hover:not(.selected-row) { + background-color: #F3F3F3; cursor: pointer; } @@ -303,6 +320,7 @@ body .ui-dialog .ui-dialog-buttonpane { #customers-page .details { margin: 15px 0 15px 15px; + max-width: 710px; } #customers-page .details .btn-toolbar { @@ -315,22 +333,32 @@ body .ui-dialog .ui-dialog-buttonpane { #customers-page #customer-appointments { height: 250px; - border: 1px solid #CCC; - border-radius: 3px; + width: 330px; + border: 4px solid #E2E2E2; margin-bottom: 20px; overflow-y: auto; } #customers-page #customer-appointments .appointment-row { padding: 7px; - border-bottom: 1px solid #CCC; + border-bottom: 4px solid #E2E2E2;; } -#customers-page #customer-appointments .appointment-row:hover { - background-color: #C6E7D5; +#customers-page #customer-appointments .appointment-row:hover:not(.selected-row) { + background-color: #F3F3F3; cursor: pointer; } +#customers-page #appointment-details { + width: 338px; +} + +#customers-page #appointment-details div { + padding: 10px; + background: #F8F8F8; + border-bottom: 4px solid #EEE; +} + #customers-page .details input, #customers-page .details textarea { background-color: white; @@ -338,12 +366,16 @@ body .ui-dialog .ui-dialog-buttonpane { } #customers-page .selected-row { - background-color: #EFFDF7; + background-color: #CBFFD8; } /* BACKEND SERVICES PAGE -------------------------------------------------------------------- */ +#services-page h2 { + color: #525252; +} + #services-page .tab-content { margin: 15px; } @@ -356,6 +388,10 @@ body .ui-dialog .ui-dialog-buttonpane { cursor: pointer; } +#services-page .filter-records { + width: 350px; +} + #services-page .filter-records .results { overflow-y: auto; max-height: 650px; @@ -364,16 +400,15 @@ body .ui-dialog .ui-dialog-buttonpane { #services-page .service-row { padding: 10px 7px; - border-radius: 3px; } -#services-page .service-row:hover { +#services-page .service-row:hover:not(.selected-row) { cursor: pointer; - background-color: #C6E7D5; + background-color: #F3F3F3; } #services-page .selected-row { - background-color: #EFFDF7; + background-color: #CBFFD8; } #services-page .filter-records .results hr { @@ -406,11 +441,10 @@ body .ui-dialog .ui-dialog-buttonpane { #services-page #categories .category-row { padding: 10px 7px; - border-radius: 3px; } -#services-page #categories .category-row:hover { - background-color: #C6E7D5; +#services-page #categories .category-row:hover:not(.selected-row) { + background-color: #F3F3F3; cursor: pointer; } @@ -421,8 +455,16 @@ body .ui-dialog .ui-dialog-buttonpane { box-shadow: none; } +#services-page .details { + max-width: 370px; +} + /* BACKEND USERS PAGE -------------------------------------------------------------------- */ +#users-page h2 { + color: #525252; +} + #users-page .tab-content { margin: 15px; } @@ -435,6 +477,10 @@ body .ui-dialog .ui-dialog-buttonpane { cursor: pointer; } +#users-page .filter-records { + width: 380px; +} + #users-page .filter-records .results { overflow-y: auto; max-height: 650px; @@ -445,25 +491,24 @@ body .ui-dialog .ui-dialog-buttonpane { #users-page .provider-row, #users-page .admin-row { padding: 10px 7px; - border-radius: 3px; } -#users-page .secretary-row:hover, -#users-page .provider-row:hover, -#users-page .admin-row:hover { +#users-page .secretary-row:hover:not(.selected-row), +#users-page .provider-row:hover:not(.selected-row), +#users-page .admin-row:hover:not(.selected-row) { cursor: pointer; - background-color: #C6E7D5; + background-color: #F3F3F3; } #users-page .selected-row { - background-color: #EFFDF7; + background-color: #CBFFD8; } #users-page .details input, #users-page .details select, #users-page .details textarea { background-color: white; - cursor: pointer; + cursor: pointer; } #users-page #secretary-notifications.active, @@ -475,8 +520,8 @@ body .ui-dialog .ui-dialog-buttonpane { #users-page #secretary-providers, #users-page #provider-services { - border: 2px solid #ccc; - width: 320px; + border: 4px solid #ccc; + width: 340px; height: 140px; overflow-y: scroll; padding: 7px; @@ -510,7 +555,7 @@ body .ui-dialog .ui-dialog-buttonpane { #users-page #providers .switch-view .current { color: #FFF; -background: #95E4A8; + background: #95E4A8; } #users-page #providers .details-view, @@ -536,8 +581,22 @@ padding: 4px 7px; #users-page .filter-records .results hr { margin: 5px 0; } + +#users-page .details { + max-width: 700px; +} + +#users-page .working-plan td input[type="text"] { + width: 85px; + margin-bottom: 0px; +} + /* BACKEND SETTINGS PAGE -------------------------------------------------------------------- */ +#settings-page h2 { + color: #525252; +} + #settings-page .tab-content { margin: 15px; } @@ -553,6 +612,7 @@ padding: 4px 7px; #business-logic .working-plan td input[type="text"] { margin-bottom: 0; cursor: pointer; + width: 85px; } #business-logic .working-plan label.checkbox { @@ -581,13 +641,35 @@ padding: 4px 7px; #business-logic #book-advance-timeout { margin: 0; + width: 131px; } #business-logic .ui-spinner { border: none; + width: 145px; } #settings-page #user-notifications.active { background: #B6DCFF; box-shadow: none; +} + +#settings-page #general fieldset .wrapper { + max-width: 400px; +} + +#settings-page .working-plan-wrapper { + max-width: 600px; +} + +#settings-page .breaks-wrapper { + max-width: 500px; +} + +#settings-page .personal-info-wrapper { + max-width: 400px; +} + +#settings-page .miscellaneous-wrapper { + max-width: 400px; } \ No newline at end of file diff --git a/src/assets/css/general.css b/src/assets/css/general.css index 3a532a35..3abb2673 100644 --- a/src/assets/css/general.css +++ b/src/assets/css/general.css @@ -1,3 +1,12 @@ +body .custom-qtip { + border: 2px solid #AFD8C1; + background: #EFFDF6; + font-size: 12px; + line-height: 20px; + color: #258D53; + border-radius: 6px; +} + /* JQUERY UI DATETIME PICKER ADDON ------------------------------------------------------------------------- */ .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } diff --git a/src/assets/js/backend.js b/src/assets/js/backend.js index c5c90f0e..2e6e3945 100644 --- a/src/assets/js/backend.js +++ b/src/assets/js/backend.js @@ -13,6 +13,16 @@ $(document).ready(function() { $(document).ajaxStop(function() { $('#loading').hide(); }); + + $('.menu-item').qtip({ + position: { + my: 'top center', + at: 'bottom center' + }, + style: { + classes: 'qtip-green qtip-shadow custom-qtip' + } + }); }); /** diff --git a/src/assets/js/backend_calendar.js b/src/assets/js/backend_calendar.js index ae56e2ea..6d6ad5f1 100644 --- a/src/assets/js/backend_calendar.js +++ b/src/assets/js/backend_calendar.js @@ -101,6 +101,10 @@ var BackendCalendar = { $('#select-filter-item').prop('disabled', true); } + if (GlobalVariables.user.role_slug == Backend.DB_SLUG_SECRETARY) { + $('#select-filter-item optgroup:eq(1)').remove(); + } + if (GlobalVariables.user.role_slug == Backend.DB_SLUG_SECRETARY) { // Remove the providers that are not connected to the secretary. $('#select-filter-item option[type="provider"]').each(function(index, option) { @@ -160,6 +164,27 @@ var BackendCalendar = { $dialog.modal('show'); } + + // Apply qtip to control tooltips. + $('#calendar-toolbar button').qtip({ + position: { + my: 'top center', + at: 'bottom center' + }, + style: { + classes: 'qtip-green qtip-shadow custom-qtip' + } + }); + + $('#select-filter-item').qtip({ + position: { + my: 'middle left', + at: 'middle right' + }, + style: { + classes: 'qtip-green qtip-shadow custom-qtip' + } + }); }, /** @@ -380,8 +405,8 @@ var BackendCalendar = { GeneralFunctions.displayMessageBox('Delete Appointment', 'Please take a minute ' + 'to write the reason you are deleting the appointment:', messageButtons); - $('#message_box').append(''); - $('#delete-reason').css('width', '320px'); + $('#message_box').append(''); + $('#delete-reason').css('width', '353px'); } else { // Do not display confirmation promt. var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_delete_unavailable'; diff --git a/src/assets/js/backend_customers.js b/src/assets/js/backend_customers.js index 06686205..f7b82599 100644 --- a/src/assets/js/backend_customers.js +++ b/src/assets/js/backend_customers.js @@ -343,6 +343,8 @@ CustomersHelper.prototype.display = function(customer) { $('#customer-appointments').append(html); }); $('#customer-appointments').jScrollPane({ mouseWheelSpeed: 70 }); + + $('#appointment-details').empty(); }; /** diff --git a/src/assets/js/backend_settings.js b/src/assets/js/backend_settings.js index 27faba88..5831d28d 100644 --- a/src/assets/js/backend_settings.js +++ b/src/assets/js/backend_settings.js @@ -96,7 +96,6 @@ var BackendSettings = { $('#user').find('button').prop('disabled', true); } - Backend.placeFooterToBottom(); }, @@ -152,9 +151,40 @@ var BackendSettings = { var settings = BackendSettings.settings.get(); BackendSettings.settings.save(settings); ////////////////////////////////////////////// - console.log('Settings To Save: ', settings); + //console.log('Settings To Save: ', settings); ////////////////////////////////////////////// }); + + /** + * Event: Username "Focusout" + * + * When the user leaves the username input field we will need to check if the username + * is not taken by another record in the system. Usernames must be unique. + */ + $('#username').focusout(function() { + var $input = $(this); + + if ($input.prop('readonly') == true || $input.val() == '') return; + + var postUrl = GlobalVariables.baseUrl + 'backend_api/ajax_validate_username'; + var postData = { + 'username': $input.val(), + 'record_exists': ($input.parents().eq(2).find('#user-id').val() != '') ? true : false + }; + + $.post(postUrl, postData, function(response) { + /////////////////////////////////////////////////////// + //console.log('Validate Username Response:', response); + /////////////////////////////////////////////////////// + if (!GeneralFunctions.handleAjaxExceptions(response)) return; + if (response == false) { + $input.css('border', '2px solid red'); + Backend.displayNotification('Username already exists.'); + } else { + $input.css('border', ''); + } + }, 'json'); + }); } }; @@ -185,6 +215,16 @@ SystemSettings.prototype.save = function(settings) { if (!GeneralFunctions.handleAjaxExceptions(response)) return; Backend.displayNotification('Settings saved successfully!'); + + // Update the logo title on the header. + $('#header-logo span').text($('#company-name').val()); + + // We need to refresh the working plan. + var workingPlan = BackendSettings.wp.get(); + $('.breaks').empty(); + BackendSettings.wp.setup(workingPlan); + BackendSettings.wp.timepickers(false); + }, 'json'); }; @@ -317,6 +357,9 @@ UserSettings.prototype.save = function(settings) { if (!GeneralFunctions.handleAjaxExceptions(response)) return; Backend.displayNotification('Settings saved successfully!'); + // Update footer greetings. + $('#footer-user-display-name').text('Hello, ' + $('#first-name').val() + ' ' + $('#last-name').val()); + }, 'json'); }; diff --git a/src/assets/js/backend_users.js b/src/assets/js/backend_users.js index 6e2d7d55..041a830a 100644 --- a/src/assets/js/backend_users.js +++ b/src/assets/js/backend_users.js @@ -58,6 +58,16 @@ var BackendUsers = { }); $('#secretary-providers').jScrollPane({ mouseWheelSpeed: 70 }); + $('#reset-working-plan').qtip({ + position: { + my: 'top center', + at: 'bottom center' + }, + style: { + classes: 'qtip-green qtip-shadow custom-qtip' + } + }); + // Bind event handlers. if (defaultEventHandlers) BackendUsers.bindEventHandlers(); }, diff --git a/src/assets/js/backend_users_providers.js b/src/assets/js/backend_users_providers.js index b88541d0..48cc322e 100644 --- a/src/assets/js/backend_users_providers.js +++ b/src/assets/js/backend_users_providers.js @@ -72,6 +72,7 @@ ProvidersHelper.prototype.bindEventHandlers = function() { $('#providers .details').find('input, textarea').prop('readonly', false); $('#provider-password, #provider-password-confirm').addClass('required'); $('#provider-notifications').prop('disabled', false); + $('#providers').find('.add-break, .edit-break, .delete-break, #reset-working-plan').prop('disabled', false); $('#provider-services input[type="checkbox"]').prop('disabled', false); $('#providers input[type="checkbox"]').prop('disabled', false); diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index e25e39fd..e1fcd62a 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -302,24 +302,14 @@ var FrontendBook = { var ajaxurl = GlobalVariables.baseUrl + 'appointments/ajax_get_available_hours'; jQuery.post(ajaxurl, postData, function(response) { /////////////////////////////////////////////////////////////// - //console.log('Get Available Hours JSON Response :', response); + //console.log('Get Available Hours JSON Response:', response); /////////////////////////////////////////////////////////////// - if (response.exceptions) { - // Display a friendly message to the user with the exceptions information. - response.exceptions = GeneralFunctions.parseExceptions(response.exceptions); - GeneralFunctions.displayMessageBox('Unexpected Error', 'An unexpected ' - + 'error occured during the available hours calculation. Please ' - + 'refresh the page and try again.'); - $('#message_box').append(GeneralFunctions.exceptionsToHtml(response.exceptions)); - console.log('Get Available Hours Exceptions:', response.exceptions); - return; - } + if (!GeneralFunctions.handleAjaxExceptions(response)) return; // The response contains the available hours for the selected provider and // service. Fill the available hours div with response data. if (response.length > 0) { - var currColumn = 1; $('#available-hours').html('
    '); diff --git a/src/assets/sql/structure.sql b/src/assets/sql/structure.sql index be542d6d..9bafd599 100644 --- a/src/assets/sql/structure.sql +++ b/src/assets/sql/structure.sql @@ -230,7 +230,7 @@ INSERT INTO `ea_roles` (`id`, `name`, `slug`, `is_admin`, `appointments`, `custo (1, 'Administrator', 'admin', 1, 15, 15, 15, 15, 15, 15), (2, 'Provider', 'provider', 0, 15, 15, 0, 0, 0, 15), (3, 'Customer', 'customer', 0, 0, 0, 0, 0, 0, 0), -(4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 15, 15); +(4, 'Secretary', 'secretary', 0, 15, 15, 0, 0, 0, 15); INSERT INTO `ea_settings` (`name`, `value`) VALUES ('company_working_plan', '{"monday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"tuesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"wednesday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"thursday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"friday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"saturday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]},"sunday":{"start":"09:00","end":"18:00","breaks":[{"start":"11:20","end":"11:30"},{"start":"14:30","end":"15:00"}]}}'),