Integrated legal contents in backend settings page (#480).

This commit is contained in:
alext 2018-06-24 15:46:58 +02:00
parent 37cb57ac94
commit 54076bd244
4 changed files with 151 additions and 3 deletions

View file

@ -282,3 +282,13 @@ $lang['flexible'] = 'Flexible';
$lang['fixed'] = 'Fixed';
$lang['attendants_number'] = 'Attendants Number';
$lang['reset_working_plan'] = 'Reset the working plan back to the default values.';
$lang['legal_contents'] = 'Legal Contents';
$lang['cookie_notice'] = 'Cookie Notice';
$lang['display_cookie_notice'] = 'Display Cookie Notice';
$lang['cookie_notice_content'] = 'Cookie Notice Content';
$lang['terms_and_conditions'] = 'Terms & Conditions';
$lang['display_terms_and_conditions'] = 'Display Terms & Conditions';
$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';

View file

@ -40,6 +40,11 @@
<a href="#business-logic" aria-controls="business-logic" role="tab" data-toggle="tab"><?= lang('business_logic') ?></a>
</li>
<?php endif ?>
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE): ?>
<li role="presentation">
<a href="#legal-contents" aria-controls="legal-contents" role="tab" data-toggle="tab"><?= lang('legal_contents') ?></a>
</li>
<?php endif ?>
<?php if ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE): ?>
<li role="presentation">
<a href="#current-user" aria-controls="current-user" role="tab" data-toggle="tab"><?= lang('current_user') ?></a>
@ -324,6 +329,80 @@
</form>
</div>
<!-- LEGAL CONTENTS TAB -->
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE) ? '' : 'hidden' ?>
<div role="tabpanel" class="tab-pane <?= $hidden ?>" id="legal-contents">
<form>
<fieldset>
<legend>
<?= lang('legal_contents') ?>
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['edit'] == TRUE): ?>
<button type="button" class="save-settings btn btn-primary btn-xs"
title="<?= lang('save') ?>">
<span class="glyphicon glyphicon-floppy-disk"></span>
<?= lang('save') ?>
</button>
<?php endif ?>
</legend>
<div class="row">
<div class="col-xs-12 col-sm-11 col-md-10 col-lg-9">
<h4><?= lang('cookie_notice') ?></h4>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" id="display-cookie-notice">
<?= lang('display_cookie_notice') ?>
</label>
</div>
</div>
<div class="form-group">
<label><?= lang('cookie_notice_content') ?></label>
<textarea id="cookie-notice-content" cols="30" rows="10" class="form-group"></textarea>
</div>
<br>
<h4><?= lang('terms_and_conditions') ?></h4>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" id="display-terms-and-conditions">
<?= lang('display_terms_and_conditions') ?>
</label>
</div>
</div>
<div class="form-group">
<label><?= lang('terms_and_conditions_content') ?></label>
<textarea id="terms-and-conditions-content" cols="30" rows="10" class="form-group"></textarea>
</div>
<h4><?= lang('privacy_policy') ?></h4>
<div class="form-group">
<div class="checkbox">
<label>
<input type="checkbox" id="display-privacy-policy">
<?= lang('display_privacy_policy') ?>
</label>
</div>
</div>
<div class="form-group">
<label><?= lang('privacy_policy_content') ?></label>
<textarea id="privacy-policy-content" cols="30" rows="10" class="form-group"></textarea>
</div>
</div>
</div>
</fieldset>
</form>
</div>
<!-- CURRENT USER TAB -->
<?php $hidden = ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE) ? '' : 'hidden' ?>

View file

@ -49,6 +49,8 @@ window.BackendSettings = window.BackendSettings || {};
exports.initialize = function (bindEventHandlers) {
bindEventHandlers = bindEventHandlers || true;
$('#cookie-notice-content, #terms-and-conditions-content, #privacy-policy-content').trumbowyg();
// Apply setting values from database.
$.each(GlobalVariables.settings.system, function (index, setting) {
$('input[data-field="' + setting.name + '"]').val(setting.value);
@ -57,17 +59,41 @@ window.BackendSettings = window.BackendSettings || {};
var workingPlan = {};
$.each(GlobalVariables.settings.system, function (index, setting) {
if (setting.name == 'company_working_plan') {
if (setting.name === 'company_working_plan') {
workingPlan = $.parseJSON(setting.value);
}
if (setting.name == 'customer_notifications' && setting.value == '1') {
if (setting.name === 'customer_notifications' && setting.value === '1') {
$('#customer-notifications').addClass('active');
}
if (setting.name == 'require_captcha' && setting.value == '1') {
if (setting.name === 'require_captcha' && setting.value === '1') {
$('#require-captcha').addClass('active');
}
if (setting.name === 'display_cookie_notice') {
$('#display-cookie-notice').prop('checked', setting.value === '1');
}
if (setting.name === 'cookie_notice_content') {
$('#cookie-notice-content').trumbowyg('html', setting.value);
}
if (setting.name === 'display_terms_and_conditions') {
$('#display-terms-and-conditions').prop('checked', setting.value === '1');
}
if (setting.name === 'terms_and_conditions_content') {
$('#terms-and-conditions-content').trumbowyg('html', setting.value);
}
if (setting.name === 'display_privacy_policy') {
$('#display-privacy-policy').prop('checked', setting.value === '1');
}
if (setting.name === 'privacy_policy_content') {
$('#privacy-policy-content').trumbowyg('html', setting.value);
}
});
exports.wp = new WorkingPlan();
@ -144,6 +170,8 @@ window.BackendSettings = window.BackendSettings || {};
settings = new SystemSettings();
} else if (href === '#business-logic') {
settings = new SystemSettings();
} else if (href === '#legal-contents') {
settings = new SystemSettings();
} else if (href === '#current-user') {
settings = new UserSettings();

View file

@ -93,6 +93,37 @@
value: $('#book-advance-timeout').val()
});
// Legal Contents Tab
settings.push({
name: 'display_cookie_notice',
value: $('#display-cookie-notice').prop('checked') ? '1' : '0'
});
settings.push({
name: 'cookie_notice_content',
value: $('#cookie-notice-content').trumbowyg('html')
});
settings.push({
name: 'display_terms_and_conditions',
value: $('#display-terms-and-conditions').prop('checked') ? '1' : '0'
});
settings.push({
name: 'terms_and_conditions_content',
value: $('#terms-and-conditions-content').trumbowyg('html')
});
settings.push({
name: 'display_privacy_policy',
value: $('#display-privacy-policy').prop('checked') ? '1' : '0'
});
settings.push({
name: 'privacy_policy_content',
value: $('#privacy-policy-content').trumbowyg('html')
});
return settings;
};