Add reset company color button so that the color can be easily switched back to the original state.

This commit is contained in:
Alex Tselegidis 2022-01-24 20:58:15 +01:00
parent 2f41c28786
commit d580463977
30 changed files with 81 additions and 15 deletions

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -358,4 +358,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -359,4 +359,5 @@ $lang['login_button'] = 'Login Button';
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.'; $lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
$lang['private'] = 'Private'; $lang['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.'; $lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End // End

View file

@ -10,7 +10,7 @@
<fieldset> <fieldset>
<legend class="d-flex justify-content-between align-items-center border-bottom mb-4 py-2"> <legend class="d-flex justify-content-between align-items-center border-bottom mb-4 py-2">
<?= lang('general_settings') ?> <?= lang('general_settings') ?>
<?php if (can('edit', PRIV_SYSTEM_SETTINGS)): ?> <?php if (can('edit', PRIV_SYSTEM_SETTINGS)): ?>
<button type="button" id="save-settings" class="btn btn-primary"> <button type="button" id="save-settings" class="btn btn-primary">
<i class="fas fa-check-square me-2"></i> <i class="fas fa-check-square me-2"></i>
@ -22,7 +22,7 @@
<div class="row mb-5"> <div class="row mb-5">
<div class="col-12"> <div class="col-12">
<h4><?= lang('company') ?></h4> <h4><?= lang('company') ?></h4>
<div class="mb-3"> <div class="mb-3">
<label class="form-label" for="company-name"> <label class="form-label" for="company-name">
<?= lang('company_name') ?> <?= lang('company_name') ?>
@ -66,19 +66,22 @@
<label class="form-label" for="company-logo"> <label class="form-label" for="company-logo">
<?= lang('company_logo') ?> <?= lang('company_logo') ?>
</label> </label>
<input type="file" id="company-logo" data-field="company_logo" class="form-control" accept="image/*"> <input type="file" id="company-logo" data-field="company_logo" class="form-control"
accept="image/*">
<div class="form-text text-muted"> <div class="form-text text-muted">
<small> <small>
<?= lang('company_logo_hint') ?> <?= lang('company_logo_hint') ?>
</small> </small>
</div> </div>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<img src="#" alt="Company Logo Preview" id="company-logo-preview" class="img-thumbnail my-3" hidden> <img src="#" alt="Company Logo Preview" id="company-logo-preview"
class="img-thumbnail my-3" hidden>
</div> </div>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<button type="button" class="btn btn-danger btn-sm mb-3" id="remove-company-logo" hidden> <button type="button" class="btn btn-danger btn-sm mb-3"
id="remove-company-logo" hidden>
<i class="fas fa-trash me-2"></i> <i class="fas fa-trash me-2"></i>
<?= lang('remove') ?> <?= lang('remove') ?>
</button> </button>
@ -89,16 +92,27 @@
<label class="form-label" for="company-color"> <label class="form-label" for="company-color">
<?= lang('company_color') ?> <?= lang('company_color') ?>
</label> </label>
<input type="color" id="company-color" data-field="company_color" class="form-control">
<input type="color" id="company-color" data-field="company_color"
class="form-control">
<div class="form-text text-muted"> <div class="form-text text-muted">
<small> <small>
<?= lang('company_color_hint') ?> <?= lang('company_color_hint') ?>
</small> </small>
</div> </div>
<div class="d-flex justify-content-center">
<button type="button" class="btn btn-danger btn-sm my-3"
id="reset-company-color" hidden>
<i class="fas fa-undo-alt me-2"></i>
<?= lang('reset') ?>
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-5"> <div class="row mb-5">
<div class="col-12"> <div class="col-12">
<h4><?= lang('localization') ?></h4> <h4><?= lang('localization') ?></h4>
@ -157,7 +171,7 @@
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">
<h4><?= lang('integrations') ?></h4> <h4><?= lang('integrations') ?></h4>
<div class="mb-3"> <div class="mb-3">
<label class="form-label" for="google-analytics-code"> <label class="form-label" for="google-analytics-code">
Google Analytics Code Google Analytics Code
@ -182,7 +196,7 @@
</small> </small>
</div> </div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label class="form-label" for="api-token">API Token</label> <label class="form-label" for="api-token">API Token</label>
<input id="api-token" data-field="api_token" class="form-control"> <input id="api-token" data-field="api_token" class="form-control">

View file

@ -239,7 +239,7 @@
<h3><?= lang('working_plan') ?></h3> <h3><?= lang('working_plan') ?></h3>
<button id="reset-working-plan" class="btn btn-primary" <button id="reset-working-plan" class="btn btn-primary"
data-tippy-content="<?= lang('reset_working_plan') ?>"> data-tippy-content="<?= lang('reset_working_plan') ?>">
<i class="fas fa-redo-alt me-2"></i> <i class="fas fa-undo-alt me-2"></i>
<?= lang('reset_plan') ?></button> <?= lang('reset_plan') ?></button>
<table class="working-plan table table-striped mt-2"> <table class="working-plan table table-striped mt-2">
<thead> <thead>

View file

@ -19,6 +19,8 @@ App.Pages.GeneralSettings = (function () {
const $companyLogo = $('#company-logo'); const $companyLogo = $('#company-logo');
const $companyLogoPreview = $('#company-logo-preview'); const $companyLogoPreview = $('#company-logo-preview');
const $removeCompanyLogo = $('#remove-company-logo'); const $removeCompanyLogo = $('#remove-company-logo');
const $companyColor = $('#company-color');
const $resetCompanyColor = $('#reset-company-color');
let companyLogoBase64 = ''; let companyLogoBase64 = '';
/** /**
@ -64,6 +66,11 @@ App.Pages.GeneralSettings = (function () {
return; return;
} }
if (generalSetting.name === 'company_color' && generalSetting.value !== '#ffffff') {
$resetCompanyColor.prop('hidden', false);
return;
}
$('[data-field="' + generalSetting.name + '"]').val(generalSetting.value); $('[data-field="' + generalSetting.name + '"]').val(generalSetting.value);
}); });
} }
@ -135,20 +142,38 @@ App.Pages.GeneralSettings = (function () {
$removeCompanyLogo.prop('hidden', true); $removeCompanyLogo.prop('hidden', true);
} }
/**
* Toggle the reset company color button.
*/
function onCompanyColorChange() {
$resetCompanyColor.prop('hidden', $companyColor.val() !== '#ffffff');
}
/**
* Set the company color value to "#ffffff" which is the default one.
*/
function onResetCompanyColorClick() {
$companyColor.val('#ffffff');
}
/** /**
* Initialize the module. * Initialize the module.
*/ */
function initialize() { function initialize() {
const generalSettings = vars('general_settings');
deserialize(generalSettings);
$saveSettings.on('click', onSaveSettingsClick); $saveSettings.on('click', onSaveSettingsClick);
$companyLogo.on('change', onCompanyLogoChange); $companyLogo.on('change', onCompanyLogoChange);
$removeCompanyLogo.on('click', onRemoveCompanyLogoClick); $removeCompanyLogo.on('click', onRemoveCompanyLogoClick);
$companyColor.on('change', onCompanyColorChange);
$resetCompanyColor.on('click', onResetCompanyColorClick);
const generalSettings = vars('general_settings');
deserialize(generalSettings);
App.Layouts.Backend.placeFooterToBottom(); App.Layouts.Backend.placeFooterToBottom();
} }