diff --git a/application/controllers/Booking_settings.php b/application/controllers/Booking_settings.php index c420f5bf..e4426447 100644 --- a/application/controllers/Booking_settings.php +++ b/application/controllers/Booking_settings.php @@ -20,7 +20,7 @@ */ class Booking_settings extends EA_Controller { /** - * Calendar constructor. + * Booking_settings constructor. */ public function __construct() { @@ -54,22 +54,21 @@ class Booking_settings extends EA_Controller { $user_id = session('user_id'); - $role_slug = session('role_slug'); + script_vars([ + 'booking_settings' => $this->settings_model->get_batch() + ]); html_vars([ 'page_title' => lang('settings'), 'active_menu' => PRIV_SYSTEM_SETTINGS, 'user_display_name' => $this->accounts->get_user_display_name($user_id), - 'timezones' => $this->timezones->to_array(), - 'privileges' => $this->roles_model->get_permissions_by_slug($role_slug), - 'system_settings' => $this->settings_model->get(), ]); $this->load->view('pages/booking_settings', html_vars()); } /** - * Save general settings. + * Save booking settings. */ public function save() { @@ -80,26 +79,7 @@ class Booking_settings extends EA_Controller { throw new Exception('You do not have the required permissions for this task.'); } - $settings = json_decode(request('settings', FALSE), TRUE); - - // Check if phone number settings are valid. - - $phone_number_required = setting('phone_number_required'); - - $phone_number_shown = FALSE; - - foreach ($settings as $setting) - { - if ($setting['name'] === 'show_phone_number') - { - $phone_number_shown = $setting['value']; - } - } - - if ($phone_number_required && ! $phone_number_shown) - { - throw new RuntimeException('You cannot hide the phone number in the booking form while it\'s also required!'); - } + $settings = request('booking_settings', []); foreach ($settings as $setting) { diff --git a/application/language/arabic/translations_lang.php b/application/language/arabic/translations_lang.php index d50d566b..f4e5e205 100755 --- a/application/language/arabic/translations_lang.php +++ b/application/language/arabic/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'الموقع الالكتروني للشركة ي $lang['go_to_booking_page'] = 'الذهاب الى صفحة الحجوزات'; $lang['settings_saved'] = 'تم حفظ الاعدادات بنجاح'; $lang['general'] = 'عام'; -$lang['client_form'] = 'نموذج العميل'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'مرئي'; $lang['hidden'] = 'مختفي'; $lang['business_logic'] = 'منطق الأعمال'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/bulgarian/translations_lang.php b/application/language/bulgarian/translations_lang.php index a3cb1676..ae9bc7c1 100755 --- a/application/language/bulgarian/translations_lang.php +++ b/application/language/bulgarian/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'Препратката на организация $lang['go_to_booking_page'] = 'Към страница за запазване.'; $lang['settings_saved'] = 'Настройките записани успешно.'; $lang['general'] = 'Общи'; -$lang['client_form'] = 'Клиентска форма'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'видим'; $lang['hidden'] = 'Скрит'; $lang['business_logic'] = 'Бизнес логика'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/catalan/translations_lang.php b/application/language/catalan/translations_lang.php index 77f23c85..ca416dcd 100644 --- a/application/language/catalan/translations_lang.php +++ b/application/language/catalan/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visible'; $lang['hidden'] = 'Amagat'; $lang['business_logic'] = 'Lògica de negoci'; @@ -333,4 +333,7 @@ $lang['default'] = 'Per defecte'; $lang['table'] = 'Taula'; $lang['date'] = 'Data'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/chinese/translations_lang.php b/application/language/chinese/translations_lang.php index ea8a2f60..e3c74b00 100755 --- a/application/language/chinese/translations_lang.php +++ b/application/language/chinese/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = '公司的网址应当指向公司的官方网页 ( $lang['go_to_booking_page'] = '进入预约页面'; $lang['settings_saved'] = '设置成功保存.'; $lang['general'] = '一般设置'; -$lang['client_form'] = '客户形态'; +$lang['booking'] = 'Booking'; $lang['visible'] = '可见的'; $lang['hidden'] = '隐'; $lang['business_logic'] = '工作时间'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/czech/translations_lang.php b/application/language/czech/translations_lang.php index cf5b6090..fc59ce15 100644 --- a/application/language/czech/translations_lang.php +++ b/application/language/czech/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Viditelný'; $lang['hidden'] = 'Skrytý'; $lang['business_logic'] = 'Business logika'; @@ -333,4 +333,7 @@ $lang['default'] = 'Výchozí'; $lang['table'] = 'Tabulka'; $lang['date'] = 'Datum'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/danish/translations_lang.php b/application/language/danish/translations_lang.php index 6babb7a7..ee4444c8 100755 --- a/application/language/danish/translations_lang.php +++ b/application/language/danish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Synlig'; $lang['hidden'] = 'Skjult'; $lang['business_logic'] = 'Forretningslogik'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/dutch/translations_lang.php b/application/language/dutch/translations_lang.php index b2df06d4..cbd2916c 100755 --- a/application/language/dutch/translations_lang.php +++ b/application/language/dutch/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Zichtbaar'; $lang['hidden'] = 'Verborgen'; $lang['business_logic'] = 'Bedrijfsinstellingen'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/english/translations_lang.php b/application/language/english/translations_lang.php index 568ab03c..aaf8532f 100755 --- a/application/language/english/translations_lang.php +++ b/application/language/english/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visible'; $lang['hidden'] = 'Hidden'; $lang['business_logic'] = 'Business Logic'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/finnish/translations_lang.php b/application/language/finnish/translations_lang.php index d3ed8a78..978284b6 100755 --- a/application/language/finnish/translations_lang.php +++ b/application/language/finnish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Näkyvä'; $lang['hidden'] = 'Piilotettu'; $lang['business_logic'] = 'Työajat'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/french/translations_lang.php b/application/language/french/translations_lang.php index 9bbcff6c..bcf936c3 100755 --- a/application/language/french/translations_lang.php +++ b/application/language/french/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visible'; $lang['hidden'] = 'Caché'; $lang['business_logic'] = 'Logique commerciale'; @@ -333,4 +333,7 @@ $lang['default'] = 'Défaut'; $lang['table'] = 'Tableau'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/german/translations_lang.php b/application/language/german/translations_lang.php index d590542b..f71108d7 100755 --- a/application/language/german/translations_lang.php +++ b/application/language/german/translations_lang.php @@ -166,7 +166,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Sichtbar'; $lang['hidden'] = 'Versteckt'; $lang['business_logic'] = 'Unternehmerische Logik'; diff --git a/application/language/greek/translations_lang.php b/application/language/greek/translations_lang.php index 3ff1fe03..30ea144e 100755 --- a/application/language/greek/translations_lang.php +++ b/application/language/greek/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'Ο σύνδεσμος εταιρείας θα πρ $lang['go_to_booking_page'] = 'Πλοήγηση Στην Σελίδα Κράτησης'; $lang['settings_saved'] = 'Οι ρυθμίσεις αποθηκεύτηκαν επιτυχώς.'; $lang['general'] = 'Γενικά'; -$lang['client_form'] = 'Μορφή πελάτη'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'Ορατός'; $lang['hidden'] = 'Κρυμμένος'; $lang['business_logic'] = 'Επιχειρηματική Λογική'; @@ -333,4 +333,7 @@ $lang['default'] = 'Προεπιλεγμένο'; $lang['table'] = 'Πίνακας'; $lang['date'] = 'Ημερομηνία'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/hebrew/translations_lang.php b/application/language/hebrew/translations_lang.php index e70e3892..cceafe23 100644 --- a/application/language/hebrew/translations_lang.php +++ b/application/language/hebrew/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'קישור החברה צריך לקשר לאתר $lang['go_to_booking_page'] = 'עבור לדף ההזמנות'; $lang['settings_saved'] = 'ההגדרות נשמרו בהצלחה!'; $lang['general'] = 'כללי'; -$lang['client_form'] = 'טופס הלקוח'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'גלוי'; $lang['hidden'] = 'מוּסתָר'; $lang['business_logic'] = 'לוגיקה עסקית'; @@ -333,4 +333,7 @@ $lang['default'] = 'בְּרִירַת מֶחדָל'; $lang['table'] = 'טבלה'; $lang['date'] = 'תאריך'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/hindi/translations_lang.php b/application/language/hindi/translations_lang.php index 4d4feda1..fbf784c8 100755 --- a/application/language/hindi/translations_lang.php +++ b/application/language/hindi/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'कंपनी की लिंक कंपन $lang['go_to_booking_page'] = 'आरक्षण का पेज पर जाएं'; $lang['settings_saved'] = 'सेटिंग सफलतापूर्वक सेव.'; $lang['general'] = 'सामान्य'; -$lang['client_form'] = 'क्लाइंट फॉर्म'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'दर्शनीय'; $lang['hidden'] = 'छिपा हुआ'; $lang['business_logic'] = 'व्यापार का तर्क'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/hungarian/translations_lang.php b/application/language/hungarian/translations_lang.php index c5b524db..0c6a40d4 100755 --- a/application/language/hungarian/translations_lang.php +++ b/application/language/hungarian/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Látható'; $lang['hidden'] = 'Rejtett'; $lang['business_logic'] = 'Business Logic'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/italian/translations_lang.php b/application/language/italian/translations_lang.php index 0d7f1bdf..84f0d5ba 100755 --- a/application/language/italian/translations_lang.php +++ b/application/language/italian/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visible'; $lang['hidden'] = 'Nascosto'; $lang['business_logic'] = 'Business Logic'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Tabella'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/japanese/translations_lang.php b/application/language/japanese/translations_lang.php index 32e0db76..e0108477 100755 --- a/application/language/japanese/translations_lang.php +++ b/application/language/japanese/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = '会社のウェブサイトへのリンクを設 $lang['go_to_booking_page'] = '予約ページへ'; $lang['settings_saved'] = '設定は保存されました。'; $lang['general'] = '一般'; -$lang['client_form'] = 'お客様のフォーム'; +$lang['booking'] = 'Booking'; $lang['visible'] = '目に見える'; $lang['hidden'] = '目に見えません'; $lang['business_logic'] = '勤務時間設定'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/luxembourgish/translations_lang.php b/application/language/luxembourgish/translations_lang.php index 14948bd2..6495d807 100755 --- a/application/language/luxembourgish/translations_lang.php +++ b/application/language/luxembourgish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Fir siichtbar'; $lang['hidden'] = 'Verstoppen'; $lang['business_logic'] = 'Business Logik'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/marathi/translations_lang.php b/application/language/marathi/translations_lang.php index ca92112d..6101c1f1 100644 --- a/application/language/marathi/translations_lang.php +++ b/application/language/marathi/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'कंपनी दुव्याने कंप $lang['go_to_booking_page'] = 'आरक्षण पृष्ठावर जा'; $lang['settings_saved'] = 'सेव्ह यशस्वीरित्या सेट करीत आहे.'; $lang['general'] = 'सामान्य'; -$lang['client_form'] = 'क्लायंट फॉर्म'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'दृश्यमान'; $lang['hidden'] = 'लपलेले'; $lang['business_logic'] = 'व्यवसाय तर्कशास्त्र'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/persian/translations_lang.php b/application/language/persian/translations_lang.php index 21e25b95..8d33e396 100644 --- a/application/language/persian/translations_lang.php +++ b/application/language/persian/translations_lang.php @@ -169,7 +169,7 @@ $lang['company_link_hint'] = 'لینک شرکت باید حاوی آدرس وب $lang['go_to_booking_page'] = 'برو به صفحه ثبت ملاقات'; $lang['settings_saved'] = 'تنظیمات با موفقیت ذخیره شد'; $lang['general'] = 'عمومی'; -$lang['client_form'] = 'فرم مشتری'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'قابل رویت'; $lang['hidden'] = 'پنهان'; $lang['business_logic'] = 'منطق تجارت'; diff --git a/application/language/polish/translations_lang.php b/application/language/polish/translations_lang.php index ee5e21c8..bde5591c 100755 --- a/application/language/polish/translations_lang.php +++ b/application/language/polish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Widoczny'; $lang['hidden'] = 'Ukryty'; $lang['business_logic'] = 'Podział Firmy'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/portuguese-br/translations_lang.php b/application/language/portuguese-br/translations_lang.php index 64fd5422..939e62d6 100755 --- a/application/language/portuguese-br/translations_lang.php +++ b/application/language/portuguese-br/translations_lang.php @@ -169,7 +169,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visível'; $lang['hidden'] = 'Escondido'; $lang['business_logic'] = 'Lógica de negócio'; @@ -332,4 +332,7 @@ $lang['default'] = 'Padrão'; $lang['table'] = 'Tabela'; $lang['date'] = 'Data'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/portuguese/translations_lang.php b/application/language/portuguese/translations_lang.php index 6804cc9a..afc26cb5 100755 --- a/application/language/portuguese/translations_lang.php +++ b/application/language/portuguese/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visível'; $lang['hidden'] = 'Escondido'; $lang['business_logic'] = 'Lógica de negócio'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/romanian/translations_lang.php b/application/language/romanian/translations_lang.php index 4be4d4c7..0c91ad04 100755 --- a/application/language/romanian/translations_lang.php +++ b/application/language/romanian/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Vizibil'; $lang['hidden'] = 'Ascuns'; $lang['business_logic'] = 'Logica afacerii'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/russian/translations_lang.php b/application/language/russian/translations_lang.php index 4b43aada..244e986d 100755 --- a/application/language/russian/translations_lang.php +++ b/application/language/russian/translations_lang.php @@ -170,7 +170,7 @@ $lang['company_link_hint'] = 'Сайт компании должен указы $lang['go_to_booking_page'] = 'Перейти на страницу заказов'; $lang['settings_saved'] = 'Настройки сохранены.'; $lang['general'] = 'Основные'; -$lang['client_form'] = 'Форма клиента'; +$lang['booking'] = 'Booking'; $lang['visible'] = 'Видимый'; $lang['hidden'] = 'Скрытый'; $lang['business_logic'] = 'Бизнес-логика'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/slovak/translations_lang.php b/application/language/slovak/translations_lang.php index a1e9874e..4fc7ee3c 100755 --- a/application/language/slovak/translations_lang.php +++ b/application/language/slovak/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Viditeľný'; $lang['hidden'] = 'Skrytý'; $lang['business_logic'] = 'Firemné údaje'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/spanish/translations_lang.php b/application/language/spanish/translations_lang.php index f03f0adc..9a50ae88 100755 --- a/application/language/spanish/translations_lang.php +++ b/application/language/spanish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Visible'; $lang['hidden'] = 'Oculto'; $lang['business_logic'] = 'Lógica del negocio'; @@ -333,4 +333,7 @@ $lang['default'] = 'Predeterminado'; $lang['table'] = 'Tabla'; $lang['date'] = 'Fecha'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/swedish/translations_lang.php b/application/language/swedish/translations_lang.php index 0b5a0ac8..403a4a56 100644 --- a/application/language/swedish/translations_lang.php +++ b/application/language/swedish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Synlig'; $lang['hidden'] = 'Dold'; $lang['business_logic'] = 'Affärsregler'; @@ -333,4 +333,7 @@ $lang['default'] = 'Standard'; $lang['table'] = 'Tabell'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/language/turkish/translations_lang.php b/application/language/turkish/translations_lang.php index be59d0a0..dfbd38b9 100755 --- a/application/language/turkish/translations_lang.php +++ b/application/language/turkish/translations_lang.php @@ -170,7 +170,7 @@ $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['booking'] = 'Booking'; $lang['visible'] = 'Gözle görülür'; $lang['hidden'] = 'Gizli'; $lang['business_logic'] = 'İş Mantığı'; @@ -333,4 +333,7 @@ $lang['default'] = 'Default'; $lang['table'] = 'Table'; $lang['date'] = 'Date'; $lang['about'] = 'About'; +$lang['booking_settings'] = 'Booking Settings'; +$lang['display'] = 'Display'; +$lang['require'] = 'Require'; // End diff --git a/application/views/components/backend_header.php b/application/views/components/backend_header.php index 1f6f2859..124c5282 100755 --- a/application/views/components/backend_header.php +++ b/application/views/components/backend_header.php @@ -95,7 +95,7 @@ = lang('business_logic') ?> - = lang('client_form') ?> + = lang('booking') ?> = lang('legal_contents') ?> diff --git a/application/views/pages/booking_settings.php b/application/views/pages/booking_settings.php index 92a59806..f9fb2100 100755 --- a/application/views/pages/booking_settings.php +++ b/application/views/pages/booking_settings.php @@ -1,197 +1,292 @@ - - - - - - - - = lang('Bookingsettings') ?> - - - - - = lang('save') ?> - - - + + + + + + + + = lang('booking_settings') ?> - - - - - = lang('phone_number') ?> - - - - - = lang('visible') ?> - - - - = lang('hidden') ?> - - - - - - = lang('address') ?> - - - - - = lang('visible') ?> - - - - = lang('hidden') ?> - - - - - - = lang('city') ?> - - - - - = lang('visible') ?> - - - - = lang('hidden') ?> - - - - - - = lang('zip_code') ?> - - - - - = lang('visible') ?> - - - - = lang('hidden') ?> - - - - - - = lang('notes') ?> - - - - - = lang('visible') ?> - - - - = lang('hidden') ?> - - - - + + + + = lang('save') ?> + + + - - - - - - = lang('customer_notifications') ?> - + + + + + = lang('first_name') ?> + * + + + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('last_name') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('email') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('phone_number') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + - - = lang('customer_notifications_hint') ?> - - - - - - - CAPTCHA - + + + + + = lang('address') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('city') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('zip_code') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + + + + = lang('notes') ?> + * + + + + + + + = lang('display') ?> + + + + + + + = lang('require') ?> + + + + - - = lang('require_captcha_hint') ?> - - - - - - = lang('phone_number') ?> - + + + + + + + + = lang('customer_notifications') ?> + + + + + + = lang('customer_notifications_hint') ?> + + + + + + + + + CAPTCHA + + + + + + = lang('require_captcha_hint') ?> + + + + + + + + + = lang('any_provider') ?> + + + + + + = lang('display_any_provider_hint') ?> + + + - - = lang('require_phone_number_hint') ?> - - - - - - = lang('any_provider') ?> - - - - = lang('display_any_provider_hint') ?> - - - - - - + + + + - - - + + + + diff --git a/assets/js/http/booking_settings_http_client.js b/assets/js/http/booking_settings_http_client.js new file mode 100644 index 00000000..a5dddfc5 --- /dev/null +++ b/assets/js/http/booking_settings_http_client.js @@ -0,0 +1,34 @@ +/* ---------------------------------------------------------------------------- + * Easy!Appointments - Open Source Web Scheduler + * + * @package EasyAppointments + * @author A.Tselegidis + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.5.0 + * ---------------------------------------------------------------------------- */ + +App.Http.BookingSettings = (function () { + /** + * Save booking settings. + * + * @param {Object} bookingSettings + * + * @return {Object} + */ + function save(bookingSettings) { + const url = App.Utils.Url.siteUrl('booking_settings/save'); + + const data = { + csrf_token: App.Vars.csrf_token, + booking_settings: bookingSettings + }; + + return $.post(url, data); + } + + return { + save + }; +})(); diff --git a/assets/js/pages/booking_settings.js b/assets/js/pages/booking_settings.js new file mode 100644 index 00000000..d532667d --- /dev/null +++ b/assets/js/pages/booking_settings.js @@ -0,0 +1,202 @@ +/* ---------------------------------------------------------------------------- + * Easy!Appointments - Open Source Web Scheduler + * + * @package EasyAppointments + * @author A.Tselegidis + * @copyright Copyright (c) Alex Tselegidis + * @license https://opensource.org/licenses/GPL-3.0 - GPLv3 + * @link https://easyappointments.org + * @since v1.5.0 + * ---------------------------------------------------------------------------- */ + +/** + * Booking Settings + * + * Contains the functionality of the booking settings page. + */ +App.Pages.BookingSettings = (function () { + const $bookingSettings = $('#booking-settings'); + const $saveSettings = $('#save-settings'); + + /** + * Check if the form has invalid values. + * + * @return {Boolean} + */ + function isInvalid() { + try { + $('#booking-settings .is-invalid').removeClass('is-invalid'); + + // Validate required fields. + + let missingRequiredFields = false; + + $('#booking-settings .required').each((index, requiredField) => { + const $requiredField = $(requiredField); + + if (!$requiredField.val()) { + $requiredField.addClass('is-invalid'); + missingRequiredFields = true; + } + }); + + if (missingRequiredFields) { + throw new Error(App.Lang.fields_are_required); + } + + return false; + } catch (error) { + Backend.displayNotification(error.message); + return true; + } + } + + /** + * Apply the booking settings into the page. + * + * @param {Object} bookingSettings + */ + function deserialize(bookingSettings) { + bookingSettings.forEach((bookingSetting) => { + const $field = $('[data-field="' + bookingSetting.name + '"]'); + + if ($field.is(':checkbox')) { + $field.prop('checked', Boolean(Number(bookingSetting.value))); + } else { + $field.val(bookingSetting.value); + } + }); + } + + /** + * Serialize the page values into an array. + * + * @returns {Array} + */ + function serialize() { + const bookingSettings = []; + + $('[data-field]').each((index, field) => { + const $field = $(field); + + bookingSettings.push({ + name: $field.data('field'), + value: $field.is(':checkbox') ? Number($field.prop('checked')) : $field.val() + }); + }); + + return bookingSettings; + } + + /** + * Update the UI based on the display switch state. + * + * @param {jQuery} $displaySwitch + */ + function updateDisplaySwitch($displaySwitch) { + const isChecked = $displaySwitch.prop('checked'); + + const $formGroup = $displaySwitch.closest('.form-group'); + + $formGroup.find('.require-switch').prop('disabled', !isChecked); + + $formGroup.find('.form-label, .form-control').toggleClass('opacity-25', !isChecked); + + if (!isChecked) { + $formGroup.find('.require-switch').prop('checked', false); + $formGroup.find('.text-danger').hide(); + } + } + + /** + * Update the UI based on the require switch state. + * + * @param {jQuery} $requireSwitch + */ + function updateRequireSwitch($requireSwitch) { + const isChecked = $requireSwitch.prop('checked'); + + const $formGroup = $requireSwitch.closest('.form-group'); + + $formGroup.find('.text-danger').toggle(isChecked); + } + + /** + * Update the UI based on the initial values. + */ + function applyInitialState() { + $bookingSettings.find('.display-switch').each(function (index, displaySwitch) { + const $displaySwitch = $(displaySwitch); + + updateDisplaySwitch($displaySwitch); + }); + + $bookingSettings.find('.require-switch').each(function (index, requireSwitch) { + const $requireSwitch = $(requireSwitch); + + updateRequireSwitch($requireSwitch); + }); + } + + /** + * Save the account information. + */ + function onSaveSettingsClick() { + if (isInvalid()) { + Backend.displayNotification(App.Lang.settings_are_invalid); + + return; + } + + const bookingSettings = serialize(); + + App.Http.BookingSettings.save(bookingSettings).done(() => { + Backend.displayNotification(App.Lang.settings_saved); + }); + } + + /** + * Update the UI. + * + * @param {jQuery} event + */ + function onDisplaySwitchClick(event) { + const $displaySwitch = $(event.target); + + updateDisplaySwitch($displaySwitch); + } + + /** + * Update the UI. + * + * @param {Event} event + */ + function onRequireSwitchClick(event) { + const $requireSwitch = $(event.target); + + updateRequireSwitch($requireSwitch); + } + + /** + * Initialize on document ready. + */ + function init() { + const bookingSettings = App.Vars.booking_settings; + + deserialize(bookingSettings); + + $saveSettings.on('click', onSaveSettingsClick); + + $bookingSettings + .on('click', '.display-switch', onDisplaySwitchClick) + .on('click', '.require-switch', onRequireSwitchClick); + + applyInitialState(); + + Backend.placeFooterToBottom(); + } + + document.addEventListener('DOMContentLoaded', init); + + return {}; +})();