forked from mirrors/easyappointments
Removed old settings files
This commit is contained in:
parent
1cd0d45153
commit
d6debb40f5
4 changed files with 0 additions and 1406 deletions
|
@ -1,691 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* @var string $first_weekday
|
||||
* @var array $system_settings
|
||||
* @var array $user_settings
|
||||
* @var string $date_format
|
||||
* @var string $time_format
|
||||
* @var string $base_url
|
||||
* @var string $timezones
|
||||
* @var string $user_id
|
||||
* @var string $user_email
|
||||
* @var string $timezone
|
||||
* @var string $role_slug
|
||||
* @var array $privileges
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php extend('layouts/backend/backend_layout') ?>
|
||||
|
||||
<?php section('content') ?>
|
||||
|
||||
<script src="<?= asset_url('assets/js/backend_settings_system.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/backend_settings_user.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/backend_settings.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/js/working_plan.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/vendor/jquery-ui-timepicker-addon/jquery-ui-timepicker-addon.min.js') ?>"></script>
|
||||
<script src="<?= asset_url('assets/vendor/jquery-jeditable/jquery.jeditable.min.js') ?>"></script>
|
||||
<script>
|
||||
var GlobalVariables = {
|
||||
csrfToken: <?= json_encode($this->security->get_csrf_hash()) ?>,
|
||||
baseUrl: <?= json_encode($base_url) ?>,
|
||||
dateFormat: <?= json_encode($date_format) ?>,
|
||||
firstWeekday: <?= json_encode($first_weekday); ?>,
|
||||
timeFormat: <?= json_encode($time_format) ?>,
|
||||
userSlug: <?= json_encode($role_slug) ?>,
|
||||
timezones: <?= json_encode($timezones) ?>,
|
||||
settings: {
|
||||
system: <?= json_encode($system_settings) ?>,
|
||||
user: <?= json_encode($user_settings) ?>
|
||||
},
|
||||
user: {
|
||||
id: <?= $user_id ?>,
|
||||
email: <?= json_encode($user_email) ?>,
|
||||
timezone: <?= json_encode($timezone) ?>,
|
||||
role_slug: <?= json_encode($role_slug) ?>,
|
||||
privileges: <?= json_encode($privileges) ?>
|
||||
}
|
||||
};
|
||||
|
||||
$(function () {
|
||||
BackendSettings.initialize(true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<div id="settings-page" class="container-fluid backend-page">
|
||||
<ul class="nav nav-pills">
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#general" data-toggle="tab"><?= lang('general') ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#client-form" data-toggle="tab"><?= lang('client_form') ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#business-logic" data-toggle="tab"><?= lang('business_logic') ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#legal-contents" data-toggle="tab"><?= lang('legal_contents') ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<?php if ($privileges[PRIV_USER_SETTINGS]['view'] == TRUE): ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#current-user" data-toggle="tab"><?= lang('current_user') ?></a>
|
||||
</li>
|
||||
<?php endif ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#about-app" data-toggle="tab"><?= lang('about_app') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
<!-- GENERAL TAB -->
|
||||
|
||||
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE) ? '' : 'd-none' ?>
|
||||
<div class="tab-pane active <?= $hidden ?>" id="general">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('general_settings') ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['edit'] == TRUE): ?>
|
||||
<button type="button" class="save-settings btn btn-primary btn-sm mb-2"
|
||||
data-tippy-content="<?= lang('save') ?>">
|
||||
<i class="fas fa-check-square mr-2"></i>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</legend>
|
||||
|
||||
<div class="wrapper row">
|
||||
<div class="col-12 col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="company-name">
|
||||
<?= lang('company_name') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="company-name" data-field="company_name" class="required form-control">
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('company_name_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="company-email">
|
||||
<?= lang('company_email') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="company-email" data-field="company_email" class="required form-control">
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('company_email_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="company-link">
|
||||
<?= lang('company_link') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="company-link" data-field="company_link" class="required form-control">
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('company_link_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="date-format">
|
||||
<?= lang('date_format') ?>
|
||||
</label>
|
||||
<select class="form-control" id="date-format" data-field="date_format">
|
||||
<option value="DMY">DMY</option>
|
||||
<option value="MDY">MDY</option>
|
||||
<option value="YMD">YMD</option>
|
||||
</select>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('date_format_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="time-format">
|
||||
<?= lang('time_format') ?>
|
||||
</label>
|
||||
<select class="form-control" id="time-format" data-field="time_format">
|
||||
<option value="<?= TIME_FORMAT_REGULAR ?>">H:MM AM/PM</option>
|
||||
<option value="<?= TIME_FORMAT_MILITARY ?>">HH:MM</option>
|
||||
</select>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('time_format_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="first-weekday">
|
||||
<?= lang('first_weekday') ?>
|
||||
</label>
|
||||
<select class="form-control" id="first-weekday" data-field="first_weekday">
|
||||
<option value="sunday"><?= lang('sunday') ?></option>
|
||||
<option value="monday"><?= lang('monday') ?></option>
|
||||
<option value="tuesday"><?= lang('tuesday') ?></option>
|
||||
<option value="wednesday"><?= lang('wednesday') ?></option>
|
||||
<option value="thursday"><?= lang('thursday') ?></option>
|
||||
<option value="friday"><?= lang('friday') ?></option>
|
||||
<option value="saturday"><?= lang('saturday') ?></option>
|
||||
</select>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('first_weekday_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-6">
|
||||
<div class="form-group">
|
||||
<label for="google-analytics-code">
|
||||
Google Analytics ID</label>
|
||||
<input id="google-analytics-code" placeholder="UA-XXXXXXXX-XX or G-XXXXXXXXXX"
|
||||
data-field="google_analytics_code" class="form-control">
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('google_analytics_code_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="api-token">API Token</label>
|
||||
<input id="api-token" data-field="api_token" class="form-control">
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('api_token_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- CLIENT FORM TAB -->
|
||||
|
||||
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE) ? '' : 'd-none' ?>
|
||||
<div class="tab-pane <?= $hidden ?>" id="client-form">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('client_form') ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['edit'] == TRUE): ?>
|
||||
<button type="button" class="save-settings btn btn-primary btn-sm mb-2"
|
||||
data-tippy-content="<?= lang('save') ?>">
|
||||
<i class="fas fa-check-square mr-2"></i>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</legend>
|
||||
|
||||
<div class="wrapper row">
|
||||
<div class="col-12 col-sm-3">
|
||||
<div class="form-group">
|
||||
<label for="show-phone-number"><?= lang('phone_number') ?></label>
|
||||
<button id="show-phone-number" data-field="show_phone_number" type="button" class="hide-toggle form-control form-sub-button">
|
||||
<span class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></span>
|
||||
<span class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="show-address"><?= lang('address') ?></label>
|
||||
<button id="show-address" data-field="show_address" type="button" class="hide-toggle form-control form-sub-button">
|
||||
<span class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></span>
|
||||
<span class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="show-city"><?= lang('city') ?></label>
|
||||
<button id="show-city" data-field="show_city" type="button" class="hide-toggle form-control form-sub-button">
|
||||
<span class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></span>
|
||||
<span class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="show-zip-code"><?= lang('zip_code') ?></label>
|
||||
<button id="show-zip-code" data-field="show_zip_code" type="button" class="hide-toggle form-control form-sub-button">
|
||||
<span class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></span>
|
||||
<span class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="show-notes"><?= lang('notes') ?></label>
|
||||
<button id="show-notes" data-field="show_notes" type="button" class="hide-toggle form-control form-sub-button">
|
||||
<span class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></span>
|
||||
<span class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 col-sm-9">
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="customer-notifications">
|
||||
<label class="custom-control-label" for="customer-notifications">
|
||||
<?= lang('customer_notifications') ?>
|
||||
</label>
|
||||
</div>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('customer_notifications_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="require-captcha">
|
||||
<label class="custom-control-label" for="require-captcha">
|
||||
CAPTCHA
|
||||
</label>
|
||||
</div>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('require_captcha_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="require-phone-number">
|
||||
<label class="custom-control-label" for="require-phone-number">
|
||||
<?= lang('phone_number') ?>
|
||||
</label>
|
||||
</div>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('require_phone_number_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="display-any-provider">
|
||||
<label class="custom-control-label" for="display-any-provider">
|
||||
<?= lang('any_provider') ?>
|
||||
</label>
|
||||
</div>
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('display_any_provider_hint') ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- BUSINESS LOGIC TAB -->
|
||||
|
||||
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE) ? '' : 'd-none' ?>
|
||||
<div class="tab-pane <?= $hidden ?>" id="business-logic">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('business_logic') ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['edit'] == TRUE): ?>
|
||||
<button type="button" class="save-settings btn btn-primary btn-sm mb-2"
|
||||
data-tippy-content="<?= lang('save') ?>">
|
||||
<i class="fas fa-check-square mr-2"></i>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</legend>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-7 working-plan-wrapper">
|
||||
<h4><?= lang('working_plan') ?></h4>
|
||||
<span class="form-text text-muted mb-4">
|
||||
<?= lang('edit_working_plan_hint') ?>
|
||||
</span>
|
||||
|
||||
<table class="working-plan table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('day') ?></th>
|
||||
<th><?= lang('start') ?></th>
|
||||
<th><?= lang('end') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><!-- Dynamic Content --></tbody>
|
||||
</table>
|
||||
|
||||
<div class="text-right">
|
||||
<button class="btn btn-outline-secondary" id="apply-global-working-plan" type="button">
|
||||
<i class="fas fa-check"></i>
|
||||
<?= lang('apply_to_all_providers') ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<h4><?= lang('book_advance_timeout') ?></h4>
|
||||
<div class="form-group">
|
||||
<label for="book-advance-timeout"
|
||||
class="control-label"><?= lang('timeout_minutes') ?></label>
|
||||
<input id="book-advance-timeout" data-field="book_advance_timeout" class="form-control"
|
||||
type="number" min="15">
|
||||
<p class="form-text text-muted">
|
||||
<?= lang('book_advance_timeout_hint') ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-sm-5 breaks-wrapper">
|
||||
<h4><?= lang('breaks') ?></h4>
|
||||
|
||||
<span class="form-text text-muted">
|
||||
<?= lang('edit_breaks_hint') ?>
|
||||
</span>
|
||||
|
||||
<div class="mt-2">
|
||||
<button type="button" class="add-break btn btn-primary">
|
||||
<i class="fas fa-plus-square"></i>
|
||||
<?= lang('add_break'); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class="breaks table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?= lang('day') ?></th>
|
||||
<th><?= lang('start') ?></th>
|
||||
<th><?= lang('end') ?></th>
|
||||
<th><?= lang('actions') ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody><!-- Dynamic Content --></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- LEGAL CONTENTS TAB -->
|
||||
|
||||
<?php $hidden = ($privileges[PRIV_SYSTEM_SETTINGS]['view'] == TRUE) ? '' : 'd-none' ?>
|
||||
<div class="tab-pane <?= $hidden ?>" id="legal-contents">
|
||||
<form>
|
||||
<fieldset>
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('legal_contents') ?>
|
||||
<?php if ($privileges[PRIV_SYSTEM_SETTINGS]['edit'] == TRUE): ?>
|
||||
<button type="button" class="save-settings btn btn-primary btn-sm mb-2"
|
||||
data-tippy-content="<?= lang('save') ?>">
|
||||
<i class="fas fa-check-square mr-2"></i>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</legend>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12 col-sm-11 col-md-10 col-lg-9">
|
||||
<h4><?= lang('cookie_notice') ?></h4>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="display-cookie-notice">
|
||||
<label class="custom-control-label" for="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="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox"
|
||||
id="display-terms-and-conditions">
|
||||
<label class="custom-control-label" for="display-terms-and-conditions">
|
||||
<?= lang('display_terms_and_conditions') ?>
|
||||
</label>
|
||||
</div>
|
||||
</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="form-group">
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input class="custom-control-input" type="checkbox" id="display-privacy-policy">
|
||||
<label class="custom-control-label" for="display-privacy-policy">
|
||||
<?= lang('display_privacy_policy') ?>
|
||||
</label>
|
||||
</div>
|
||||
</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) ? '' : 'd-none' ?>
|
||||
<div class="tab-pane <?= $hidden ?>" id="current-user">
|
||||
<form>
|
||||
<div class="row">
|
||||
<fieldset class="col-12 col-sm-6 personal-info-wrapper">
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('personal_information') ?>
|
||||
<?php if ($privileges[PRIV_USER_SETTINGS]['edit'] == TRUE): ?>
|
||||
<button type="button" class="save-settings btn btn-primary btn-sm mb-2"
|
||||
data-tippy-content="<?= lang('save') ?>">
|
||||
<i class="fas fa-check-square mr-2"></i>
|
||||
<?= lang('save') ?>
|
||||
</button>
|
||||
<?php endif ?>
|
||||
</legend>
|
||||
|
||||
<input type="hidden" id="user-id">
|
||||
|
||||
<div class="form-group">
|
||||
<label for="first-name">
|
||||
<?= lang('first_name') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="first-name" class="form-control required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="last-name">
|
||||
<?= lang('last_name') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="last-name" class="form-control required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="email">
|
||||
<?= lang('email') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="email" class="form-control required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="phone-number">
|
||||
<?= lang('phone_number') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="phone-number" class="form-control required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="mobile-number">
|
||||
<?= lang('mobile_number') ?>
|
||||
</label>
|
||||
<input id="mobile-number" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="address">
|
||||
<?= lang('address') ?>
|
||||
</label>
|
||||
<input id="address" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="city">
|
||||
<?= lang('city') ?>
|
||||
</label>
|
||||
<input id="city" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="state">
|
||||
<?= lang('state') ?>
|
||||
</label>
|
||||
<input id="state" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="zip-code">
|
||||
<?= lang('zip_code') ?>
|
||||
</label>
|
||||
<input id="zip-code" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="notes">
|
||||
<?= lang('notes') ?>
|
||||
</label>
|
||||
<textarea id="notes" class="form-control" rows="3"></textarea>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="col-12 col-sm-6 miscellaneous-wrapper">
|
||||
<legend class="border-bottom mb-4">
|
||||
<?= lang('system_login') ?>
|
||||
</legend>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="username">
|
||||
<?= lang('username') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<input id="username" class="form-control required">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="password">
|
||||
<?= lang('password') ?>
|
||||
</label>
|
||||
<input type="password" id="password" class="form-control" autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="retype-password">
|
||||
<?= lang('retype_password') ?>
|
||||
</label>
|
||||
<input type="password" id="retype-password" class="form-control"
|
||||
autocomplete="new-password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="calendar-view"><?= lang('calendar') ?>
|
||||
<span class="text-danger">*</span>
|
||||
</label>
|
||||
<select id="calendar-view" class="form-control required">
|
||||
<option value="default">Default</option>
|
||||
<option value="table">Table</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="timezone">
|
||||
<?= lang('timezone') ?>
|
||||
</label>
|
||||
<?= render_timezone_dropdown('id="timezone" class="form-control"') ?>
|
||||
</div>
|
||||
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="user-notifications">
|
||||
<label class="custom-control-label" for="user-notifications">
|
||||
<?= lang('receive_notifications') ?>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- ABOUT TAB -->
|
||||
|
||||
<div class="tab-pane" id="about-app">
|
||||
<h3>Easy!Appointments</h3>
|
||||
|
||||
<p>
|
||||
<?= lang('about_app_info') ?>
|
||||
</p>
|
||||
|
||||
<div class="current-version card card-body bg-light border-light mb-3">
|
||||
<?= lang('current_version') ?>
|
||||
<?= config('version') ?>
|
||||
<?php if (config('release_label')): ?>
|
||||
- <?= config('release_label') ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
|
||||
<h3><?= lang('support') ?></h3>
|
||||
<p>
|
||||
<?= lang('about_app_support') ?>
|
||||
|
||||
<br><br>
|
||||
|
||||
<a href="https://easyappointments.org">
|
||||
<?= lang('official_website') ?>
|
||||
</a>
|
||||
|
|
||||
<a href="https://groups.google.com/forum/#!forum/easy-appointments">
|
||||
<?= lang('support_group') ?>
|
||||
</a>
|
||||
|
|
||||
<a href="https://github.com/alextselegidis/easyappointments/issues">
|
||||
<?= lang('project_issues') ?>
|
||||
</a>
|
||||
|
|
||||
<a href="https://facebook.com/easyappts">
|
||||
Facebook
|
||||
</a>
|
||||
|
|
||||
<a href="https://twitter.com/easyappts">
|
||||
Twitter
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<h3><?= lang('license') ?></h3>
|
||||
|
||||
<p>
|
||||
<?= lang('about_app_license') ?>
|
||||
<a href="http://www.gnu.org/copyleft/gpl.html">http://www.gnu.org/copyleft/gpl.html</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php section('content') ?>
|
|
@ -1,335 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
window.BackendSettings = window.BackendSettings || {};
|
||||
|
||||
/**
|
||||
* Backend Settings
|
||||
*
|
||||
* Contains the functionality of the backend settings page. Can either work for system or user settings,
|
||||
* but the actions allowed to the user are restricted to his role (only admin has full privileges).
|
||||
*
|
||||
* @module BackendSettings
|
||||
*/
|
||||
(function (exports) {
|
||||
'use strict';
|
||||
|
||||
// Constants
|
||||
exports.SETTINGS_SYSTEM = 'SETTINGS_SYSTEM';
|
||||
exports.SETTINGS_USER = 'SETTINGS_USER';
|
||||
|
||||
/**
|
||||
* Use this WorkingPlan class instance to perform actions on the page's working plan tables.
|
||||
*
|
||||
* @type {WorkingPlan}
|
||||
*/
|
||||
exports.wp = {};
|
||||
|
||||
/**
|
||||
* Tab settings object.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
var settings = {};
|
||||
|
||||
/**
|
||||
* Initialize Page
|
||||
*
|
||||
* @param {bool} defaultEventHandlers Optional (true), determines whether to bind the default event handlers.
|
||||
*/
|
||||
exports.initialize = function (defaultEventHandlers) {
|
||||
defaultEventHandlers = defaultEventHandlers || true;
|
||||
|
||||
$('#cookie-notice-content, #terms-and-conditions-content, #privacy-policy-content').trumbowyg();
|
||||
|
||||
// Apply setting values from database.
|
||||
var workingPlan = {};
|
||||
|
||||
GlobalVariables.settings.system.forEach(function (setting) {
|
||||
$('input[data-field="' + setting.name + '"]').val(setting.value);
|
||||
$('select[data-field="' + setting.name + '"]').val(setting.value);
|
||||
|
||||
if (setting.name === 'company_working_plan') {
|
||||
workingPlan = $.parseJSON(setting.value);
|
||||
}
|
||||
|
||||
if (setting.name === 'customer_notifications') {
|
||||
$('#customer-notifications').prop('checked', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
if (setting.name === 'require_captcha') {
|
||||
$('#require-captcha').prop('checked', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
if (setting.name === 'require_phone_number') {
|
||||
$('#require-phone-number').prop('checked', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
if (setting.name === 'display_any_provider') {
|
||||
$('#display-any-provider').prop('checked', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
if (setting.name === 'display_cookie_notice') {
|
||||
$('#display-cookie-notice').prop('checked', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
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', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
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', Boolean(Number(setting.value)));
|
||||
}
|
||||
|
||||
if (setting.name === 'privacy_policy_content') {
|
||||
$('#privacy-policy-content').trumbowyg('html', setting.value);
|
||||
}
|
||||
|
||||
if (setting.name === 'show_phone_number' && setting.value === '1') {
|
||||
$('#show-phone-number').find('div').toggleClass('hidden');
|
||||
}
|
||||
|
||||
if (setting.name === 'show_address' && setting.value === '1') {
|
||||
$('#show-address').find('div').toggleClass('hidden');
|
||||
}
|
||||
|
||||
if (setting.name === 'show_city' && setting.value === '1') {
|
||||
$('#show-city').find('div').toggleClass('hidden');
|
||||
}
|
||||
|
||||
if (setting.name === 'show_zip_code' && setting.value === '1') {
|
||||
$('#show-zip-code').find('div').toggleClass('hidden');
|
||||
}
|
||||
|
||||
if (setting.name === 'show_notes' && setting.value === '1') {
|
||||
$('#show-notes').find('div').toggleClass('hidden');
|
||||
}
|
||||
});
|
||||
|
||||
exports.wp = new WorkingPlan();
|
||||
exports.wp.setup(workingPlan);
|
||||
exports.wp.timepickers(false);
|
||||
|
||||
// Load user settings into form
|
||||
$('#user-id').val(GlobalVariables.settings.user.id);
|
||||
$('#first-name').val(GlobalVariables.settings.user.first_name);
|
||||
$('#last-name').val(GlobalVariables.settings.user.last_name);
|
||||
$('#email').val(GlobalVariables.settings.user.email);
|
||||
$('#mobile-number').val(GlobalVariables.settings.user.mobile_number);
|
||||
$('#phone-number').val(GlobalVariables.settings.user.phone_number);
|
||||
$('#address').val(GlobalVariables.settings.user.address);
|
||||
$('#city').val(GlobalVariables.settings.user.city);
|
||||
$('#state').val(GlobalVariables.settings.user.state);
|
||||
$('#zip-code').val(GlobalVariables.settings.user.zip_code);
|
||||
$('#notes').val(GlobalVariables.settings.user.notes);
|
||||
$('#timezone').val(GlobalVariables.settings.user.timezone);
|
||||
$('#username').val(GlobalVariables.settings.user.settings.username);
|
||||
$('#password, #retype-password').val('');
|
||||
$('#calendar-view').val(GlobalVariables.settings.user.settings.calendar_view);
|
||||
$('#user-notifications').prop('checked', Boolean(Number(GlobalVariables.settings.user.settings.notifications)));
|
||||
|
||||
// Set default settings helper.
|
||||
settings = new SystemSettings();
|
||||
|
||||
if (defaultEventHandlers) {
|
||||
bindEventHandlers();
|
||||
var $link = $('#settings-page .nav li').not('.d-none').first().find('a');
|
||||
$link.tab('show');
|
||||
}
|
||||
|
||||
// Apply Privileges
|
||||
if (GlobalVariables.user.privileges.system_settings.edit === false) {
|
||||
$('#general, #business-logic').find('select, input, textarea').prop('readonly', true);
|
||||
$('#general, #business-logic').find('button').prop('disabled', true);
|
||||
}
|
||||
|
||||
if (GlobalVariables.user.privileges.user_settings.edit === false) {
|
||||
$('#user').find('select, input, textarea').prop('readonly', true);
|
||||
$('#user').find('button').prop('disabled', true);
|
||||
}
|
||||
|
||||
Backend.placeFooterToBottom();
|
||||
};
|
||||
|
||||
/**
|
||||
* Bind the backend/settings default event handlers.
|
||||
*
|
||||
* This method depends on the backend/settings html, so do not use this method on a different page.
|
||||
*/
|
||||
function bindEventHandlers() {
|
||||
exports.wp.bindEventHandlers();
|
||||
|
||||
/**
|
||||
* Event: Tab "Click"
|
||||
*
|
||||
* Change the visible tab contents.
|
||||
*/
|
||||
$('a[data-toggle="tab"]').on('shown.bs.tab', function () {
|
||||
var href = $(this).attr('href');
|
||||
|
||||
if (href === '#general') {
|
||||
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();
|
||||
}
|
||||
|
||||
Backend.placeFooterToBottom();
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Save Settings Button "Click"
|
||||
*
|
||||
* Store the setting changes into the database.
|
||||
*/
|
||||
$('.save-settings').on('click', function () {
|
||||
var data = settings.get();
|
||||
settings.save(data);
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Visible/Hidden button "Click"
|
||||
*
|
||||
* Change the state of the Visible/Hidden button
|
||||
*/
|
||||
$('.hide-toggle').on('click', function () {
|
||||
var $input = $(this);
|
||||
$input.find('div').toggleClass('hidden');
|
||||
});
|
||||
|
||||
/**
|
||||
* set a Visible/Hidden toggle button to a certain state
|
||||
*
|
||||
* @argument $element for which jquery element to set the state for
|
||||
* @argument isVisible a boolean which is true if the button should display 'visible' and false when the button should display 'hidden'
|
||||
*
|
||||
*/
|
||||
function setShowToggleValue($element, isVisible) {
|
||||
if (getShowToggleValue($element) !== isVisible) {
|
||||
$element.find('div').toggleClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* get the Visible/Hidden toggle button
|
||||
*
|
||||
* @argument $element for which jquery element to set the state for
|
||||
*
|
||||
* @return the state of the button. True for visible, false for hidden.
|
||||
*/
|
||||
function getShowToggleValue($element) {
|
||||
var visiblePartArray = $element.find('.hide-toggle-visible');
|
||||
return !visiblePartArray.hasClass('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Event: require phone number switch "Click"
|
||||
*
|
||||
* make sure that our phone number is visible when it is required.
|
||||
*/
|
||||
$('#show-phone-number').on('click', function () {
|
||||
if (!getShowToggleValue($(this))) {
|
||||
//if button is set to hidden
|
||||
$('#require-phone-number').prop('checked', false);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: require phone number switch "Click"
|
||||
*
|
||||
* make sure that our phone number is visible when it is required.
|
||||
*/
|
||||
$('#require-phone-number').on('click', function () {
|
||||
if ($(this).prop('checked')) {
|
||||
setShowToggleValue($('#show-phone-number'), true);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Username "Focusout"
|
||||
*
|
||||
* When the user leaves the username input field we will need to check if the username
|
||||
* is not taken by another record in the system. Usernames must be unique.
|
||||
*/
|
||||
$('#username').focusout(function () {
|
||||
var $input = $(this);
|
||||
|
||||
if ($input.prop('readonly') === true || $input.val() === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_validate_username';
|
||||
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
username: $input.val(),
|
||||
user_id: $input.parents().eq(2).find('#user-id').val()
|
||||
};
|
||||
|
||||
$.post(url, data).done(function (response) {
|
||||
if (response.is_valid === 'false') {
|
||||
$input.closest('.form-group').addClass('has-error');
|
||||
Backend.displayNotification(EALang.username_already_exists);
|
||||
$input.attr('already-exists', 'true');
|
||||
} else {
|
||||
$input.closest('.form-group').removeClass('has-error');
|
||||
$input.attr('already-exists', 'false');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Event: Apply Global Working Plan
|
||||
*/
|
||||
$('#apply-global-working-plan').on('click', function () {
|
||||
var buttons = [
|
||||
{
|
||||
text: EALang.cancel,
|
||||
click: function () {
|
||||
$('#message-box').dialog('close');
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'OK',
|
||||
click: function () {
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_apply_global_working_plan';
|
||||
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
working_plan: JSON.stringify(exports.wp.get())
|
||||
};
|
||||
|
||||
$.post(url, data)
|
||||
.done(function () {
|
||||
Backend.displayNotification(EALang.working_plans_got_updated);
|
||||
})
|
||||
.always(function () {
|
||||
$('#message-box').dialog('close');
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
GeneralFunctions.displayMessageBox(EALang.working_plan, EALang.overwrite_existing_working_plans, buttons);
|
||||
});
|
||||
}
|
||||
})(window.BackendSettings);
|
|
@ -1,249 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* "System Settings" Tab Helper Class
|
||||
*
|
||||
* @class SystemSettings
|
||||
*/
|
||||
var SystemSettings = function () {};
|
||||
|
||||
/**
|
||||
* Save the system settings.
|
||||
*
|
||||
* This method is run after changes are detected on the tab input fields.
|
||||
*
|
||||
* @param {Array} settings Contains the system settings data.
|
||||
*/
|
||||
SystemSettings.prototype.save = function (settings) {
|
||||
if (!this.validate()) {
|
||||
return; // Validation failed, do not proceed.
|
||||
}
|
||||
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings';
|
||||
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
settings: JSON.stringify(settings),
|
||||
type: BackendSettings.SETTINGS_SYSTEM
|
||||
};
|
||||
|
||||
$.post(url, data).done(function () {
|
||||
Backend.displayNotification(EALang.settings_saved);
|
||||
|
||||
// Update the logo title on the header.
|
||||
$('#header-logo span').text($('#company-name').val());
|
||||
|
||||
// Update book_advance_timeout preview
|
||||
var totalMinutes = $('#book-advance-timeout').val();
|
||||
var hours = Math.floor(totalMinutes / 60);
|
||||
var minutes = totalMinutes % 60;
|
||||
$('#book-advance-timeout-helper').text(
|
||||
EALang.book_advance_timeout_hint.replace(
|
||||
'{$limit}',
|
||||
('0' + hours).slice(-2) + ':' + ('0' + minutes).slice(-2)
|
||||
)
|
||||
);
|
||||
|
||||
// Update variables also used in other setting tabs
|
||||
GlobalVariables.timeFormat = $('#time-format').val();
|
||||
GlobalVariables.firstWeekday = $('#first-weekday').val();
|
||||
|
||||
// We need to refresh the working plan.
|
||||
var workingPlan = BackendSettings.wp.get();
|
||||
BackendSettings.wp.setup(workingPlan);
|
||||
BackendSettings.wp.timepickers(false);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the state of a visible/hidden toggle button
|
||||
*
|
||||
* This method uses the DOM elements of the backend/settings page, so it can't be used in another page.
|
||||
*
|
||||
* @argument the element jquery of a button object that is a visible/hidden toggle.
|
||||
*
|
||||
* @return '0' when the button shows 'invisible' and '1' when the button shows 'visible'. Will always return '0' on an error.
|
||||
*/
|
||||
function getToggleButtonState($element) {
|
||||
var visiblePartArray = $element.find('.hide-toggle-visible');
|
||||
var invisiblePartArray = $element.find('.hide-toggle-hidden');
|
||||
if (!(visiblePartArray.length === 0 || invisiblePartArray.length === 0)) {
|
||||
if (visiblePartArray.hasClass('hidden')) {
|
||||
//our button is currently invisible
|
||||
return '0'; //invisible
|
||||
} else {
|
||||
//our button is currently visible
|
||||
return '1'; //visible
|
||||
}
|
||||
} else {
|
||||
return '0'; //invisible
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the system settings array.
|
||||
*
|
||||
* This method uses the DOM elements of the backend/settings page, so it can't be used in another page.
|
||||
*
|
||||
* @return {Array} Returns the system settings array.
|
||||
*/
|
||||
SystemSettings.prototype.get = function () {
|
||||
var settings = [];
|
||||
|
||||
// General Settings Tab
|
||||
|
||||
$('#general')
|
||||
.find('input, select')
|
||||
.not('input:checkbox')
|
||||
.each(function (index, field) {
|
||||
settings.push({
|
||||
name: $(field).attr('data-field'),
|
||||
value: $(field).val()
|
||||
});
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'customer_notifications',
|
||||
value: $('#customer-notifications').prop('checked') ? '1' : '0'
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'require_captcha',
|
||||
value: $('#require-captcha').prop('checked') ? '1' : '0'
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'require_phone_number',
|
||||
value: $('#require-phone-number').prop('checked') ? '1' : '0'
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'display_any_provider',
|
||||
value: $('#display-any-provider').prop('checked') ? '1' : '0'
|
||||
});
|
||||
|
||||
//Client Form Tab
|
||||
|
||||
settings.push({
|
||||
name: 'show_phone_number',
|
||||
value: getToggleButtonState($('#show-phone-number'))
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'show_address',
|
||||
value: getToggleButtonState($('#show-address'))
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'show_city',
|
||||
value: getToggleButtonState($('#show-city'))
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'show_zip_code',
|
||||
value: getToggleButtonState($('#show-zip-code'))
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'show_notes',
|
||||
value: getToggleButtonState($('#show-notes'))
|
||||
});
|
||||
|
||||
// Business Logic Tab
|
||||
|
||||
settings.push({
|
||||
name: 'company_working_plan',
|
||||
value: JSON.stringify(BackendSettings.wp.get())
|
||||
});
|
||||
|
||||
settings.push({
|
||||
name: 'book_advance_timeout',
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the settings data.
|
||||
*
|
||||
* If the validation fails then display a message to the user.
|
||||
*
|
||||
* @return {Boolean} Returns the validation result.
|
||||
*/
|
||||
SystemSettings.prototype.validate = function () {
|
||||
$('#general .has-error').removeClass('has-error');
|
||||
|
||||
try {
|
||||
// Validate required fields.
|
||||
var missingRequired = false;
|
||||
$('#general .required').each(function (index, requiredField) {
|
||||
if (!$(requiredField).val()) {
|
||||
$(requiredField).closest('.form-group').addClass('has-error');
|
||||
missingRequired = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (missingRequired) {
|
||||
throw new Error(EALang.fields_are_required);
|
||||
}
|
||||
|
||||
// Validate company email address.
|
||||
if (!GeneralFunctions.validateEmail($('#company-email').val())) {
|
||||
$('#company-email').closest('.form-group').addClass('has-error');
|
||||
throw new Error(EALang.invalid_email);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
Backend.displayNotification(error.message);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
window.SystemSettings = SystemSettings;
|
||||
})();
|
|
@ -1,131 +0,0 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* Easy!Appointments - Open Source Web Scheduler
|
||||
*
|
||||
* @package EasyAppointments
|
||||
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
|
||||
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||
* @link http://easyappointments.org
|
||||
* @since v1.0.0
|
||||
* ---------------------------------------------------------------------------- */
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* "User Settings" Tab Helper Class
|
||||
*
|
||||
* @class UserSettings
|
||||
*/
|
||||
var UserSettings = function () {};
|
||||
|
||||
/**
|
||||
* Get the settings data for the user settings.
|
||||
*
|
||||
* @return {Object} Returns the user settings array.
|
||||
*/
|
||||
UserSettings.prototype.get = function () {
|
||||
var user = {
|
||||
id: $('#user-id').val(),
|
||||
first_name: $('#first-name').val(),
|
||||
last_name: $('#last-name').val(),
|
||||
email: $('#email').val(),
|
||||
mobile_number: $('#mobile-number').val(),
|
||||
phone_number: $('#phone-number').val(),
|
||||
address: $('#address').val(),
|
||||
city: $('#city').val(),
|
||||
state: $('#state').val(),
|
||||
zip_code: $('#zip-code').val(),
|
||||
notes: $('#notes').val(),
|
||||
timezone: $('#timezone').val(),
|
||||
settings: {
|
||||
username: $('#username').val(),
|
||||
notifications: $('#user-notifications').prop('checked'),
|
||||
calendar_view: $('#calendar-view').val()
|
||||
}
|
||||
};
|
||||
|
||||
if ($('#password').val()) {
|
||||
user.settings.password = $('#password').val();
|
||||
}
|
||||
|
||||
return user;
|
||||
};
|
||||
|
||||
/**
|
||||
* Store the user settings into the database.
|
||||
*
|
||||
* @param {Array} settings Contains the user settings.
|
||||
*/
|
||||
UserSettings.prototype.save = function (settings) {
|
||||
if (!this.validate(settings)) {
|
||||
Backend.displayNotification(EALang.user_settings_are_invalid);
|
||||
return; // Validation failed, do not proceed.
|
||||
}
|
||||
|
||||
var url = GlobalVariables.baseUrl + '/index.php/backend_api/ajax_save_settings';
|
||||
|
||||
var data = {
|
||||
csrfToken: GlobalVariables.csrfToken,
|
||||
type: BackendSettings.SETTINGS_USER,
|
||||
settings: JSON.stringify(settings)
|
||||
};
|
||||
|
||||
$.post(url, data).done(function () {
|
||||
Backend.displayNotification(EALang.settings_saved);
|
||||
|
||||
// Update footer greetings.
|
||||
$('#footer-user-display-name').text('Hello, ' + $('#first-name').val() + ' ' + $('#last-name').val() + '!');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Validate the settings data.
|
||||
*
|
||||
* If the validation fails then display a message to the user.
|
||||
*
|
||||
* @return {Boolean} Returns the validation result.
|
||||
*/
|
||||
UserSettings.prototype.validate = function () {
|
||||
$('#current-user .has-error').removeClass('has-error');
|
||||
|
||||
try {
|
||||
// Validate required fields.
|
||||
var missingRequired = false;
|
||||
$('#current-user .required').each(function (index, requiredField) {
|
||||
if (!$(requiredField).val()) {
|
||||
$(requiredField).closest('.form-group').addClass('has-error');
|
||||
missingRequired = true;
|
||||
}
|
||||
});
|
||||
|
||||
if (missingRequired) {
|
||||
throw new Error(EALang.fields_are_required);
|
||||
}
|
||||
|
||||
// Validate passwords (if provided).
|
||||
if ($('#password').val() !== $('#retype-password').val()) {
|
||||
$('#password, #retype-password').closest('.form-group').addClass('has-error');
|
||||
throw new Error(EALang.passwords_mismatch);
|
||||
}
|
||||
|
||||
// Validate user email.
|
||||
if (!GeneralFunctions.validateEmail($('#email').val())) {
|
||||
$('#email').closest('.form-group').addClass('has-error');
|
||||
throw new Error(EALang.invalid_email);
|
||||
}
|
||||
|
||||
if ($('#username').attr('already-exists') === 'true') {
|
||||
$('#username').closest('.form-group').addClass('has-error');
|
||||
throw new Error(EALang.username_already_exists);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
Backend.displayNotification(error.message);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
window.UserSettings = UserSettings;
|
||||
})();
|
Loading…
Reference in a new issue