From 60f48e24eeb9e0a9e932abe2355be5150109cab9 Mon Sep 17 00:00:00 2001 From: alext Date: Sun, 24 Jun 2018 16:58:03 +0200 Subject: [PATCH] Integrated new legal content settings in the booking page (#480). --- src/application/controllers/Appointments.php | 14 +++++- .../language/english/translations_lang.php | 3 ++ src/application/views/appointments/book.php | 43 +++++++++++++++++- src/assets/css/frontend.css | 2 +- src/assets/js/frontend_book.js | 45 ++++++++++++++++++- 5 files changed, 103 insertions(+), 4 deletions(-) diff --git a/src/application/controllers/Appointments.php b/src/application/controllers/Appointments.php index 2fffbf9f..1c880153 100755 --- a/src/application/controllers/Appointments.php +++ b/src/application/controllers/Appointments.php @@ -76,6 +76,12 @@ class Appointments extends CI_Controller { $company_name = $this->settings_model->get_setting('company_name'); $date_format = $this->settings_model->get_setting('date_format'); $time_format = $this->settings_model->get_setting('time_format'); + $display_cookie_notice = $this->settings_model->get_setting('display_cookie_notice'); + $cookie_notice_content = $this->settings_model->get_setting('cookie_notice_content'); + $display_terms_and_conditions = $this->settings_model->get_setting('display_terms_and_conditions'); + $terms_and_conditions_content = $this->settings_model->get_setting('terms_and_conditions_content'); + $display_privacy_policy = $this->settings_model->get_setting('display_privacy_policy'); + $privacy_policy_content = $this->settings_model->get_setting('privacy_policy_content'); // Remove the data that are not needed inside the $available_providers array. foreach ($available_providers as $index => $provider) @@ -136,7 +142,13 @@ class Appointments extends CI_Controller { 'time_format' => $time_format, 'appointment_data' => $appointment, 'provider_data' => $provider, - 'customer_data' => $customer + 'customer_data' => $customer, + 'display_cookie_notice' => $display_cookie_notice, + 'cookie_notice_content' => $cookie_notice_content, + 'display_terms_and_conditions' => $display_terms_and_conditions, + 'terms_and_conditions_content' => $terms_and_conditions_content, + 'display_privacy_policy' => $display_privacy_policy, + 'privacy_policy_content' => $privacy_policy_content, ]; } catch (Exception $exc) diff --git a/src/application/language/english/translations_lang.php b/src/application/language/english/translations_lang.php index b5a54730..081308af 100755 --- a/src/application/language/english/translations_lang.php +++ b/src/application/language/english/translations_lang.php @@ -292,3 +292,6 @@ $lang['terms_and_conditions_content'] = 'Terms & Conditions Content'; $lang['privacy_policy'] = 'Privacy Policy'; $lang['display_privacy_policy'] = 'Display Privacy Policy'; $lang['privacy_policy_content'] = 'Privacy Policy Content'; +$lang['website_using_cookies_to_ensure_best_experience'] = 'This website uses cookies to ensure you get the best experience on our website.'; +$lang['read_and_agree_to_terms_and_conditions'] = 'I have read and agree to the {$link}Terms & Conditions{/$link}.'; +$lang['read_and_agree_to_privacy_policy'] = 'I have read and agree to the {$link}Privacy Policy{/$link}.'; diff --git a/src/application/views/appointments/book.php b/src/application/views/appointments/book.php index 2aca05ab..6d08a11b 100755 --- a/src/application/views/appointments/book.php +++ b/src/application/views/appointments/book.php @@ -11,6 +11,7 @@ + @@ -244,7 +245,33 @@ - + + +
+ + + + +
+ + + @@ -320,6 +347,18 @@ + + + + + + + + + + + + + diff --git a/src/assets/css/frontend.css b/src/assets/css/frontend.css index 6cd29557..fa474b2f 100644 --- a/src/assets/css/frontend.css +++ b/src/assets/css/frontend.css @@ -66,7 +66,7 @@ body { #book-appointment-wizard .wizard-frame { padding: 10px 20px; - height: 530px; + height: 560px; } #book-appointment-wizard .wizard-frame .frame-container { diff --git a/src/assets/js/frontend_book.js b/src/assets/js/frontend_book.js index ef5fa132..bf12123e 100644 --- a/src/assets/js/frontend_book.js +++ b/src/assets/js/frontend_book.js @@ -47,6 +47,35 @@ window.FrontendBook = window.FrontendBook || {}; window.console = function () { }; // IE compatibility } + + if (GlobalVariables.displayCookieNotice) { + cookieconsent.initialise({ + palette: { + popup: { + background: '#ffffffbd', + text: '#666666' + }, + button: { + background: '#3DD481', + text: '#ffffff' + } + }, + content: { + message: EALang.website_using_cookies_to_ensure_best_experience, + dismiss: 'OK' + }, + }); + + $('.cc-link').replaceWith( + $('', { + 'data-toggle': 'modal', + 'data-target': '#cookie-notice-modal', + 'href': '#', + 'class': 'cc-link', + 'text': $('.cc-link').text() + }) + ); + } FrontendBook.manageMode = manageMode; @@ -346,7 +375,8 @@ window.FrontendBook = window.FrontendBook || {}; * @return {Boolean} Returns the validation result. */ function _validateCustomerForm() { - $('#wizard-frame-3 input').closest('.form-group').removeClass('has-error'); + $('#wizard-frame-3 .has-error').removeClass('has-error'); + $('#wizard-frame-3 label.text-danger').removeClass('text-danger'); try { // Validate required fields. @@ -361,6 +391,19 @@ window.FrontendBook = window.FrontendBook || {}; throw EALang.fields_are_required; } + var $acceptToTermsAndConditions = $('#accept-to-terms-and-conditions'); + if ($acceptToTermsAndConditions.length && !$acceptToTermsAndConditions.prop('checked')) { + $acceptToTermsAndConditions.parents('label').addClass('text-danger'); + throw EALang.fields_are_required; + } + + var $acceptToPrivacyPolicy = $('#accept-to-privacy-policy'); + if ($acceptToPrivacyPolicy.length && !$acceptToPrivacyPolicy.prop('checked')) { + $acceptToPrivacyPolicy.parents('label').addClass('text-danger'); + throw EALang.fields_are_required; + } + + // Validate email address. if (!GeneralFunctions.validateEmail($('#email').val())) { $('#email').parents('.form-group').addClass('has-error');