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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// 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['private'] = 'Private';
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
$lang['reset'] = 'Reset';
// End

View file

@ -66,7 +66,8 @@
<label class="form-label" for="company-logo">
<?= lang('company_logo') ?>
</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">
<small>
<?= lang('company_logo_hint') ?>
@ -74,11 +75,13 @@
</div>
<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 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>
<?= lang('remove') ?>
</button>
@ -89,12 +92,23 @@
<label class="form-label" for="company-color">
<?= lang('company_color') ?>
</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">
<small>
<?= lang('company_color_hint') ?>
</small>
</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>

View file

@ -239,7 +239,7 @@
<h3><?= lang('working_plan') ?></h3>
<button id="reset-working-plan" class="btn btn-primary"
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>
<table class="working-plan table table-striped mt-2">
<thead>

View file

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