Merge pull request #1082 from Tthecreator/1081_hide_data_fields

Feature: #1081 Add a way to hide unneeded form fields from clients
This commit is contained in:
Alex Tselegidis 2021-10-21 12:31:31 +02:00 committed by GitHub
commit 4646a03ab4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 414 additions and 1 deletions

View file

@ -21,7 +21,7 @@ $config['migration_enabled'] = TRUE;
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 21;
$config['migration_version'] = 22;
/*

View file

@ -66,6 +66,11 @@ class Appointments extends EA_Controller {
$time_format = $this->settings_model->get_setting('time_format');
$first_weekday = $this->settings_model->get_setting('first_weekday');
$require_phone_number = $this->settings_model->get_setting('require_phone_number');
$show_field['phone-number'] = $this->settings_model->get_setting('show_phone_number');
$show_field['address'] = $this->settings_model->get_setting('show_address');
$show_field['city'] = $this->settings_model->get_setting('show_city');
$show_field['zip-code'] = $this->settings_model->get_setting('show_zip_code');
$show_field['notes'] = $this->settings_model->get_setting('show_notes');
$display_cookie_notice = $this->settings_model->get_setting('display_cookie_notice');
$cookie_notice_content = $this->settings_model->get_setting('cookie_notice_content');
$display_terms_and_conditions = $this->settings_model->get_setting('display_terms_and_conditions');
@ -163,6 +168,7 @@ class Appointments extends EA_Controller {
'time_format' => $time_format,
'first_weekday' => $first_weekday,
'require_phone_number' => $require_phone_number,
'show_field' => $show_field,
'appointment_data' => $appointment,
'provider_data' => $provider,
'customer_data' => $customer,
@ -442,6 +448,12 @@ class Appointments extends EA_Controller {
$appointment = $post_data['appointment'];
$customer = $post_data['customer'];
if (!array_key_exists('address', $customer)){ $customer['address'] = ""; }
if (!array_key_exists('city', $customer)){ $customer['city'] = ""; }
if (!array_key_exists('zip_code', $customer)){ $customer['zip_code'] = ""; }
if (!array_key_exists('notes', $customer)){ $customer['notes'] = ""; }
if (!array_key_exists('phone_number', $customer)){ $customer['address'] = ""; }
// Check appointment availability before registering it to the database.
$appointment['id_users_provider'] = $this->check_datetime_availability();

View file

@ -1355,6 +1355,24 @@ class Backend_api extends EA_Controller {
$settings = json_decode($this->input->post('settings', FALSE), TRUE);
//check if phone number settings are valid
$phone_number_required = false;
$phone_number_shown = false;
foreach ($settings as $setting)
{
if ($setting['name'] == "require_phone_number"){
$phone_number_required = $setting['value'];
}
if ($setting['name'] == "show_phone_number"){
$phone_number_shown = $setting['value'];
}
}
if ($phone_number_required && !$phone_number_shown){//we have settings that break the appointments field.
throw new Exception("You cannot hide the phone number in the booking form while it's also required!");
}
$this->settings_model->save_settings($settings);
}
else

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'الموقع الالكتروني للشركة ي
$lang['go_to_booking_page'] = 'الذهاب الى صفحة الحجوزات';
$lang['settings_saved'] = 'تم حفظ الاعدادات بنجاح';
$lang['general'] = 'عام';
$lang['client_form'] = 'نموذج العميل';
$lang['visible'] = 'مرئي';
$lang['hidden'] = 'مختفي';
$lang['business_logic'] = 'منطق الأعمال';
$lang['current_user'] = 'المستخدم الحالي';
$lang['about_app'] = 'About E!A';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Препратката на организация
$lang['go_to_booking_page'] = 'Към страница за запазване.';
$lang['settings_saved'] = 'Настройките записани успешно.';
$lang['general'] = 'Общи';
$lang['client_form'] = 'Клиентска форма';
$lang['visible'] = 'видим';
$lang['hidden'] = 'Скрит';
$lang['business_logic'] = 'Бизнес логика';
$lang['current_user'] = 'Текущ потребител';
$lang['about_app'] = 'Относно';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'L\'enllaç a l\'organització hauria d\'enllaçar
$lang['go_to_booking_page'] = 'Ves a la pàgina de reserves';
$lang['settings_saved'] = 'Les configuracions s\'han desat correctament.';
$lang['general'] = 'General';
$lang['client_form'] = 'Formulari del client';
$lang['visible'] = 'Visible';
$lang['hidden'] = 'Amagat';
$lang['business_logic'] = 'Lògica de negoci';
$lang['current_user'] = 'Usuari actual';
$lang['about_app'] = 'Quant a Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = '公司的网址应当指向公司的官方网页 (
$lang['go_to_booking_page'] = '进入预约页面';
$lang['settings_saved'] = '设置成功保存.';
$lang['general'] = '一般设置';
$lang['client_form'] = '客户形态';
$lang['visible'] = '可见的';
$lang['hidden'] = '隐';
$lang['business_logic'] = '工作时间';
$lang['current_user'] = '目前登录用户';
$lang['about_app'] = '关于网上预约系统';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Odkaz na web společnosti by měl vést na oficál
$lang['go_to_booking_page'] = 'Přejít na stránku rezervací';
$lang['settings_saved'] = 'Nastavení úspěšně uložena.';
$lang['general'] = 'Obecné';
$lang['client_form'] = 'Formulář klienta';
$lang['visible'] = 'Viditelný';
$lang['hidden'] = 'Skrytý';
$lang['business_logic'] = 'Business logika';
$lang['current_user'] = 'Přihlášený uživatel';
$lang['about_app'] = 'O aplikaci Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Firma linket skal gå ind på den officielle websi
$lang['go_to_booking_page'] = 'Gå til booking siden';
$lang['settings_saved'] = 'Indstillingerne er gemt';
$lang['general'] = 'Generelt';
$lang['client_form'] = 'Klientform';
$lang['visible'] = 'Synlig';
$lang['hidden'] = 'Skjult';
$lang['business_logic'] = 'Forretningslogik';
$lang['current_user'] = 'Nuværende bruger';
$lang['about_app'] = 'Om Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'De link naar het bedrijf moet verwijzen naar de of
$lang['go_to_booking_page'] = 'Ga naar de boekingspagina';
$lang['settings_saved'] = 'Instellingen succesvol opgeslagen.';
$lang['general'] = 'Algemeen';
$lang['client_form'] = 'Klantformulier';
$lang['visible'] = 'Zichtbaar';
$lang['hidden'] = 'Verborgen';
$lang['business_logic'] = 'Bedrijfsinstellingen';
$lang['current_user'] = 'Huidige gebruiker';
$lang['about_app'] = 'Over Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Company link should point to the official website
$lang['go_to_booking_page'] = 'Go To Booking Page';
$lang['settings_saved'] = 'Settings saved successfully.';
$lang['general'] = 'General';
$lang['client_form'] = 'Client Form';
$lang['visible'] = 'Visible';
$lang['hidden'] = 'Hidden';
$lang['business_logic'] = 'Business Logic';
$lang['current_user'] = 'Current User';
$lang['about_app'] = 'About Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Kotisivulinkin tulisi ohjata yrityksen kotisivuill
$lang['go_to_booking_page'] = 'Palaa ajanvaraussivulle';
$lang['settings_saved'] = 'Asetukset tallennettiin onnistuneesti.';
$lang['general'] = 'Yleinen';
$lang['client_form'] = 'Asiakaslomake';
$lang['visible'] = 'Näkyvä';
$lang['hidden'] = 'Piilotettu';
$lang['business_logic'] = 'Työajat';
$lang['current_user'] = 'Nykyinen käyttäjä';
$lang['about_app'] = 'Tietoja Easy!Appointments:sta';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Le lien de la société doit pointer vers le site
$lang['go_to_booking_page'] = 'Aller à la page de rendez-vous';
$lang['settings_saved'] = 'Paramètres sauvegardés avec succès.';
$lang['general'] = 'Général';
$lang['client_form'] = 'Formulaire de clientèle';
$lang['visible'] = 'Visible';
$lang['hidden'] = 'Caché';
$lang['business_logic'] = 'Logique commerciale';
$lang['current_user'] = 'Utilisateur actuel';
$lang['about_app'] = 'Au sujet d\'Easy!Appointments';

View file

@ -166,6 +166,9 @@ $lang['company_link_hint'] = 'Der Firmen-Link sollte auf die offizielle Webseite
$lang['go_to_booking_page'] = 'Weiter zur Buchungsseite';
$lang['settings_saved'] = 'Einstellungen erfolgreich gesichert.';
$lang['general'] = 'Allgemeines';
$lang['client_form'] = 'Kundenformular';
$lang['visible'] = 'Sichtbar';
$lang['hidden'] = 'Versteckt';
$lang['business_logic'] = 'Unternehmerische Logik';
$lang['current_user'] = 'Aktueller Nutzer';
$lang['about_app'] = 'Über Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Ο σύνδεσμος εταιρείας θα πρ
$lang['go_to_booking_page'] = 'Πλοήγηση Στην Σελίδα Κράτησης';
$lang['settings_saved'] = 'Οι ρυθμίσεις αποθηκεύτηκαν επιτυχώς.';
$lang['general'] = 'Γενικά';
$lang['client_form'] = 'Μορφή πελάτη';
$lang['visible'] = 'Ορατός';
$lang['hidden'] = 'Κρυμμένος';
$lang['business_logic'] = 'Επιχειρηματική Λογική';
$lang['current_user'] = 'Τρέχων Χρήστης';
$lang['about_app'] = 'Σχετικά με το Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'קישור החברה צריך לקשר לאתר
$lang['go_to_booking_page'] = 'עבור לדף ההזמנות';
$lang['settings_saved'] = 'ההגדרות נשמרו בהצלחה!';
$lang['general'] = 'כללי';
$lang['client_form'] = 'טופס הלקוח';
$lang['visible'] = 'גלוי';
$lang['hidden'] = 'מוּסתָר';
$lang['business_logic'] = 'לוגיקה עסקית';
$lang['current_user'] = 'משתמש נוכחי';
$lang['about_app'] = 'אודות Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'कंपनी की लिंक कंपन
$lang['go_to_booking_page'] = 'आरक्षण का पेज पर जाएं';
$lang['settings_saved'] = 'सेटिंग सफलतापूर्वक सेव.';
$lang['general'] = 'सामान्य';
$lang['client_form'] = 'क्लाइंट फॉर्म';
$lang['visible'] = 'दर्शनीय';
$lang['hidden'] = 'छिपा हुआ';
$lang['business_logic'] = 'व्यापार का तर्क';
$lang['current_user'] = 'तात्कालिक प्रयोगकर्ता';
$lang['about_app'] = 'ई ए के बारे में';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'A vállalkozás linkje a cég hivatalos weblapjár
$lang['go_to_booking_page'] = 'Ugrás a foglalási oldalra';
$lang['settings_saved'] = 'Beállítások sikeresen mentve.';
$lang['general'] = 'Általános';
$lang['client_form'] = 'Ügyfélforma';
$lang['visible'] = 'Látható';
$lang['hidden'] = 'Rejtett';
$lang['business_logic'] = 'Business Logic';
$lang['current_user'] = 'Jelenlegi felhasználó';
$lang['about_app'] = 'Easy!Appointments-ról';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Il link aziendale dovrebbe puntare al sito ufficia
$lang['go_to_booking_page'] = 'Vai alla pagina delle prenotazioni';
$lang['settings_saved'] = 'Impostazioni salvate con successo.';
$lang['general'] = 'Generale';
$lang['client_form'] = 'Forma del cliente';
$lang['visible'] = 'Visible';
$lang['hidden'] = 'Nascosto';
$lang['business_logic'] = 'Business Logic';
$lang['current_user'] = 'Utente corrente';
$lang['about_app'] = 'Info su Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = '会社のウェブサイトへのリンクを設
$lang['go_to_booking_page'] = '予約ページへ';
$lang['settings_saved'] = '設定は保存されました。';
$lang['general'] = '一般';
$lang['client_form'] = 'お客様のフォーム';
$lang['visible'] = '目に見える';
$lang['hidden'] = '目に見えません';
$lang['business_logic'] = '勤務時間設定';
$lang['current_user'] = '現在のユーザー';
$lang['about_app'] = 'Easy!Appointmentsとは。';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'De Firmelink sollt op déi offiziell Websäit vun
$lang['go_to_booking_page'] = 'Gitt op d\'Buchungssäit';
$lang['settings_saved'] = 'Astellungen erfollegräich gespäichert.';
$lang['general'] = 'Allgemenges';
$lang['client_form'] = 'Client Form';
$lang['visible'] = 'Fir siichtbar';
$lang['hidden'] = 'Verstoppen';
$lang['business_logic'] = 'Business Logik';
$lang['current_user'] = 'Ugemellte Benotzer';
$lang['about_app'] = 'Iwwert Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'कंपनी दुव्याने कंप
$lang['go_to_booking_page'] = 'आरक्षण पृष्ठावर जा';
$lang['settings_saved'] = 'सेव्ह यशस्वीरित्या सेट करीत आहे.';
$lang['general'] = 'सामान्य';
$lang['client_form'] = 'क्लायंट फॉर्म';
$lang['visible'] = 'दृश्यमान';
$lang['hidden'] = 'लपलेले';
$lang['business_logic'] = 'व्यवसाय तर्कशास्त्र';
$lang['current_user'] = 'तात्कालिक प्रयोगकर्ता';
$lang['about_app'] = 'अ‍ॅप बद्दल...';

View file

@ -169,6 +169,9 @@ $lang['company_link_hint'] = 'لینک شرکت باید حاوی آدرس وب
$lang['go_to_booking_page'] = 'برو به صفحه ثبت ملاقات';
$lang['settings_saved'] = 'تنظیمات با موفقیت ذخیره شد';
$lang['general'] = 'عمومی';
$lang['client_form'] = 'فرم مشتری';
$lang['visible'] = 'قابل رویت';
$lang['hidden'] = 'پنهان';
$lang['business_logic'] = 'منطق تجارت';
$lang['current_user'] = 'کاربر جاری';
$lang['about_app'] = 'درباره Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Link firmowy powinien wskazywać na firmowe www. (
$lang['go_to_booking_page'] = 'Idź do strony bookowania';
$lang['settings_saved'] = 'Ustawienia zapisano.';
$lang['general'] = 'Ogólne';
$lang['client_form'] = 'Formularz klienta';
$lang['visible'] = 'Widoczny';
$lang['hidden'] = 'Ukryty';
$lang['business_logic'] = 'Podział Firmy';
$lang['current_user'] = 'Bieżący Użytkownik';
$lang['about_app'] = 'O Easy!Appointments';

View file

@ -169,6 +169,9 @@ $lang['company_link_hint'] = 'Endereço da empresa deve apontar para o site ofic
$lang['go_to_booking_page'] = 'Ir para a página de reserva';
$lang['settings_saved'] = 'Definições salvas com sucesso.';
$lang['general'] = 'Geral';
$lang['client_form'] = 'Forma de cliente';
$lang['visible'] = 'Visível';
$lang['hidden'] = 'Escondido';
$lang['business_logic'] = 'Lógica de negócio';
$lang['current_user'] = 'Usuário Atual';
$lang['about_app'] = 'Sobre o Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Endereço da empresa deve apontar para o site ofic
$lang['go_to_booking_page'] = 'Ir para a página de reserva';
$lang['settings_saved'] = 'Definições guardadas com sucesso.';
$lang['general'] = 'Geral';
$lang['client_form'] = 'Forma de cliente';
$lang['visible'] = 'Visível';
$lang['hidden'] = 'Escondido';
$lang['business_logic'] = 'Lógica de negócio';
$lang['current_user'] = 'Utilizador Actual';
$lang['about_app'] = 'Sobre o Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Linkul trebuie sa indice website-ul oficial al com
$lang['go_to_booking_page'] = 'La pagina de înregistrari';
$lang['settings_saved'] = 'Setari salvate.';
$lang['general'] = 'General';
$lang['client_form'] = 'Client Formular';
$lang['visible'] = 'Vizibil';
$lang['hidden'] = 'Ascuns';
$lang['business_logic'] = 'Logica afacerii';
$lang['current_user'] = 'Utilizator curent';
$lang['about_app'] = 'Despre Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Сайт компании должен указы
$lang['go_to_booking_page'] = 'Перейти на страницу заказов';
$lang['settings_saved'] = 'Настройки сохранены.';
$lang['general'] = 'Основные';
$lang['client_form'] = 'Форма клиента';
$lang['visible'] = 'Видимый';
$lang['hidden'] = 'Скрытый';
$lang['business_logic'] = 'Бизнес-логика';
$lang['current_user'] = 'Текущий пользователь';
$lang['about_app'] = 'О приложении Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Link firmy by mal odkazovať na oficiálnu stránk
$lang['go_to_booking_page'] = 'Prejsť na stránku rezervácií';
$lang['settings_saved'] = 'Nastavenie úspešne uložené.';
$lang['general'] = 'Všeobecný';
$lang['client_form'] = 'Tvar klienta';
$lang['visible'] = 'Viditeľný';
$lang['hidden'] = 'Skrytý';
$lang['business_logic'] = 'Firemné údaje';
$lang['current_user'] = 'Prihlásený užívateľ';
$lang['about_app'] = 'O Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'El enlace de la empresa debe dirigir al sitio web
$lang['go_to_booking_page'] = 'Ir a la página para agendar';
$lang['settings_saved'] = 'Configuración guardada exitosamente';
$lang['general'] = 'General';
$lang['client_form'] = 'Formulario del cliente';
$lang['visible'] = 'Visible';
$lang['hidden'] = 'Oculto';
$lang['business_logic'] = 'Lógica del negocio';
$lang['current_user'] = 'Usuario actual';
$lang['about_app'] = 'Acerca de Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Länk till företagets hemsida. (obligatorisk)';
$lang['go_to_booking_page'] = 'Gå till bokningssidan.';
$lang['settings_saved'] = 'Inställningarna är sparade.';
$lang['general'] = 'Generellt';
$lang['client_form'] = 'Klientform';
$lang['visible'] = 'Synlig';
$lang['hidden'] = 'Dold';
$lang['business_logic'] = 'Affärsregler';
$lang['current_user'] = 'Nuvarande användare';
$lang['about_app'] = 'Om Easy!Appointments';

View file

@ -170,6 +170,9 @@ $lang['company_link_hint'] = 'Şirket web sitesi, şirketin resmi web sitesine y
$lang['go_to_booking_page'] = 'Rezervasyon Sayfasına Git';
$lang['settings_saved'] = 'Ayarlar başarıyla kaydedildi.';
$lang['general'] = 'Genel';
$lang['client_form'] = 'Müşteri formu';
$lang['visible'] = 'Gözle görülür';
$lang['hidden'] = 'Gizli';
$lang['business_logic'] = 'İş Mantığı';
$lang['current_user'] = 'Mevcut Kullanıcı';
$lang['about_app'] = 'Easy!Appointments Hakkında';

View file

@ -0,0 +1,65 @@
<?php defined('BASEPATH') or exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author T. Saedt <https://github.com/Tthecreator>
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.4.2
* ---------------------------------------------------------------------------- */
/**
* Class Migration_Add_show_fields_setting
*
* @property CI_DB_query_builder $db
* @property CI_DB_forge $dbforge
*/
class Migration_Add_show_fields_setting extends CI_Migration {
/**
* Upgrade method.
*/
public function up()
{
$this->db->insert('settings', [
'name' => 'show_phone_number',
'value' => '1'
]);
$this->db->insert('settings', [
'name' => 'show_address',
'value' => '1'
]);
$this->db->insert('settings', [
'name' => 'show_city',
'value' => '1'
]);
$this->db->insert('settings', [
'name' => 'show_zip_code',
'value' => '1'
]);
$this->db->insert('settings', [
'name' => 'show_notes',
'value' => '1'
]);
}
/**
* Downgrade method.
*/
public function down()
{
$this->db->delete('settings', ['name' => 'show_phone_number']);
$this->db->delete('settings', ['name' => 'show_address']);
$this->db->delete('settings', ['name' => 'show_city']);
$this->db->delete('settings', ['name' => 'show_zip_code']);
$this->db->delete('settings', ['name' => 'show_notes']);
}
}

View file

@ -268,6 +268,7 @@
</label>
<input type="text" id="email" class="required form-control" maxlength="120"/>
</div>
<?php if ($show_field['phone-number']) : ?>
<div class="form-group">
<label for="phone-number" class="control-label">
<?= lang('phone_number') ?>
@ -276,33 +277,42 @@
<input type="text" id="phone-number" maxlength="60"
class="<?= $require_phone_number === '1' ? 'required' : '' ?> form-control"/>
</div>
<?php endif; ?>
</div>
<div class="col-12 col-md-6">
<?php if ($show_field['address']) : ?>
<div class="form-group">
<label for="address" class="control-label">
<?= lang('address') ?>
</label>
<input type="text" id="address" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['city']):?>
<div class="form-group">
<label for="city" class="control-label">
<?= lang('city') ?>
</label>
<input type="text" id="city" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['zip-code']) : ?>
<div class="form-group">
<label for="zip-code" class="control-label">
<?= lang('zip_code') ?>
</label>
<input type="text" id="zip-code" class="form-control" maxlength="120"/>
</div>
<?php endif; ?>
<?php if ($show_field['notes']) : ?>
<div class="form-group">
<label for="notes" class="control-label">
<?= lang('notes') ?>
</label>
<textarea id="notes" maxlength="500" class="form-control" rows="1"></textarea>
</div>
<?php endif; ?>
</div>
</div>
</div>

View file

@ -38,6 +38,11 @@
<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>
@ -172,6 +177,70 @@
</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">
<div class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></div>
<div class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></div>
</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">
<div class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></div>
<div class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></div>
</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">
<div class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></div>
<div class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></div>
</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">
<div class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></div>
<div class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></div>
</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">
<div class="hide-toggle-visible hidden"><img src="<?= base_url('assets/img/eye.svg') ?>"/> <?= lang('visible') ?></div>
<div class="hide-toggle-hidden"><img src="<?= base_url('assets/img/eye-hidden.svg') ?>"/> <?= lang('hidden') ?></div>
</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">
@ -218,6 +287,8 @@
</div>
</div>
</div>
</fieldset>
</form>
</div>

View file

@ -280,6 +280,23 @@ body legend {
margin: 5px;
}
.form-sub-button {
width: auto;
}
.form-sub-button img{
margin-top: -.25rem;
}
.hidden{
visibility: hidden;
height: 0;
}
.hide-toggle div{
display: flex;
}
@media (min-width: 768px) {
.backend-page .nav-pills li {
width: auto;
@ -846,6 +863,10 @@ body .form-horizontal .controls {
max-width: 1024px;
}
#settings-page #client-form fieldset .wrapper {
max-width: 1024px;
}
#settings-page .working-plan-wrapper {
max-width: 600px;
}

View file

@ -0,0 +1 @@
<?xml version="1.0" ?><svg height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#157EFB" id="icon-21-eye-hidden"><path d="M8.10869891,20.8913011 C4.61720816,18.8301147 3,16 3,16 C3,16 7,9 16,9 C17.3045107,9 18.5039752,9.14706466 19.6014388,9.39856122 L18.7519017,10.2480983 C17.8971484,10.0900546 16.9800929,10 16,10 C8,10 4.19995117,16 4.19995117,16 C4.19995117,16 5.71472808,18.3917225 8.84492713,20.1550729 L8.10869891,20.8913011 L8.10869891,20.8913011 L8.10869891,20.8913011 Z M12.398561,22.601439 C13.4960246,22.8529356 14.6954892,23.0000001 16,23 C25,22.999999 29,16 29,16 C29,16 27.3827918,13.1698856 23.8913008,11.1086992 L23.1550727,11.8449273 C26.2852719,13.6082776 27.8000488,16 27.8000488,16 C27.8000488,16 24,21.999999 16,22 C15.019907,22.0000001 14.1028515,21.9099455 13.2480981,21.7519019 L12.398561,22.601439 L12.398561,22.601439 L12.398561,22.601439 Z M19.8986531,15.1013469 C19.9649658,15.3902115 20,15.6910144 20,16 C20,18.2091391 18.2091391,20 16,20 C15.6910144,20 15.3902115,19.9649658 15.1013469,19.8986531 L16,19 C16.7677669,19.0000001 17.5355339,18.7071068 18.1213203,18.1213203 C18.7071068,17.5355339 19.0000001,16.7677669 19,16 L19.8986531,15.1013469 L19.8986531,15.1013469 L19.8986531,15.1013469 Z M16.8986531,12.1013469 C16.6097885,12.0350342 16.3089856,12 16,12 C13.7908609,12 12,13.7908609 12,16 C12,16.3089856 12.0350342,16.6097885 12.1013469,16.8986531 L13,16 C12.9999999,15.2322331 13.2928932,14.4644661 13.8786797,13.8786797 C14.4644661,13.2928932 15.2322331,12.9999999 16,13 L16.8986531,12.1013469 L16.8986531,12.1013469 L16.8986531,12.1013469 Z M24,7 L7,24 L8,25 L25,8 L24,7 L24,7 Z" id="eye-hidden"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

1
assets/img/eye.svg Normal file
View file

@ -0,0 +1 @@
<?xml version="1.0" ?><svg height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#157EFB" id="icon-22-eye"><path d="M17,9 C8,9 4,16 4,16 C4,16 8,23.000001 17,23 C26,22.999999 30,16 30,16 C30,16 26,9 17,9 L17,9 Z M17,20 C19.2091391,20 21,18.2091391 21,16 C21,13.7908609 19.2091391,12 17,12 C14.7908609,12 13,13.7908609 13,16 C13,18.2091391 14.7908609,20 17,20 L17,20 Z M17,19 C18.6568543,19 20,17.6568543 20,16 C20,14.3431457 18.6568543,13 17,13 C15.3431457,13 14,14.3431457 14,16 C14,17.6568543 15.3431457,19 17,19 L17,19 Z M17,17 C17.5522848,17 18,16.5522848 18,16 C18,15.4477152 17.5522848,15 17,15 C16.4477152,15 16,15.4477152 16,16 C16,16.5522848 16.4477152,17 17,17 L17,17 Z" id="eye"/></g></g></svg>

After

Width:  |  Height:  |  Size: 954 B

View file

@ -101,6 +101,26 @@ window.BackendSettings = window.BackendSettings || {};
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();
@ -187,6 +207,63 @@ window.BackendSettings = window.BackendSettings || {};
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"
*

View file

@ -67,6 +67,29 @@
});
};
/**
* 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.
*
@ -106,6 +129,33 @@
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