Integrated new legal content settings in the booking page (#480).

This commit is contained in:
alext 2018-06-24 16:58:03 +02:00
parent 00f1017e35
commit 60f48e24ee
5 changed files with 103 additions and 4 deletions

View file

@ -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)

View file

@ -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}.';

View file

@ -11,6 +11,7 @@
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/bootstrap/css/bootstrap.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/jquery-ui/jquery-ui.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/jquery-qtip/jquery.qtip.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/ext/cookieconsent/cookieconsent.min.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/frontend.css') ?>">
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/general.css') ?>">
@ -244,7 +245,33 @@
</div>
</div>
<em id="form-message" class="text-danger"><?= lang('fields_are_required') ?></em>
<?php if ($display_terms_and_conditions): ?>
<label>
<input type="checkbox" class="required" id="accept-to-terms-and-conditions">
<?= strtr(lang('read_and_agree_to_terms_and_conditions'),
[
'{$link}' => '<a href="#" data-toggle="modal" data-target="#terms-and-conditions-modal">',
'{/$link}' => '</a>'
])
?>
</label>
<br>
<?php endif ?>
<?php if ($display_privacy_policy): ?>
<label>
<input type="checkbox" class="required" id="accept-to-privacy-policy">
<?= strtr(lang('read_and_agree_to_privacy_policy'),
[
'{$link}' => '<a href="#" data-toggle="modal" data-target="#privacy-policy-modal">',
'{/$link}' => '</a>'
])
?>
</label>
<br>
<?php endif ?>
<span id="form-message" class="text-danger"><?= lang('fields_are_required') ?></span>
</div>
</div>
@ -320,6 +347,18 @@
</div>
</div>
<?php if ($display_cookie_notice === '1'): ?>
<?php require 'cookie_notice_modal.php' ?>
<?php endif ?>
<?php if ($display_terms_and_conditions === '1'): ?>
<?php require 'terms_and_conditions_modal.php' ?>
<?php endif ?>
<?php if ($display_privacy_policy === '1'): ?>
<?php require 'privacy_policy_modal.php' ?>
<?php endif ?>
<script>
var GlobalVariables = {
availableServices : <?= json_encode($available_services) ?>,
@ -328,6 +367,7 @@
manageMode : <?= $manage_mode ? 'true' : 'false' ?>,
dateFormat : <?= json_encode($date_format) ?>,
timeFormat : <?= json_encode($time_format) ?>,
displayCookieNotice : <?= json_encode($display_cookie_notice === '1') ?>,
appointmentData : <?= json_encode($appointment_data) ?>,
providerData : <?= json_encode($provider_data) ?>,
customerData : <?= json_encode($customer_data) ?>,
@ -342,6 +382,7 @@
<script src="<?= asset_url('assets/ext/jquery/jquery.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery-ui/jquery-ui.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/jquery-qtip/jquery.qtip.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/cookieconsent/cookieconsent.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/bootstrap/js/bootstrap.min.js') ?>"></script>
<script src="<?= asset_url('assets/ext/datejs/date.js') ?>"></script>
<script src="<?= asset_url('assets/js/frontend_book_api.js') ?>"></script>

View file

@ -66,7 +66,7 @@ body {
#book-appointment-wizard .wizard-frame {
padding: 10px 20px;
height: 530px;
height: 560px;
}
#book-appointment-wizard .wizard-frame .frame-container {

View file

@ -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(
$('<a/>', {
'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');