Add the ability to temporarily block new appointments / set away message (#940).
This commit is contained in:
parent
e1fe30d73b
commit
083a3e07f6
32 changed files with 264 additions and 5 deletions
|
@ -60,6 +60,30 @@ class Booking extends EA_Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$company_name = setting('company_name');
|
||||||
|
$disable_booking = setting('disable_booking');
|
||||||
|
$google_analytics_code = setting('google_analytics_code');
|
||||||
|
$matomo_analytics_url = setting('matomo_analytics_url');
|
||||||
|
|
||||||
|
if ($disable_booking)
|
||||||
|
{
|
||||||
|
$disable_booking_message = setting('disable_booking_message');
|
||||||
|
|
||||||
|
html_vars([
|
||||||
|
'show_message' => TRUE,
|
||||||
|
'page_title' => lang('page_title') . ' ' . $company_name,
|
||||||
|
'message_title' => lang('booking_is_disabled'),
|
||||||
|
'message_text' => $disable_booking_message,
|
||||||
|
'message_icon' => base_url('assets/img/error.png'),
|
||||||
|
'google_analytics_code' => $google_analytics_code,
|
||||||
|
'matomo_analytics_url' => $matomo_analytics_url
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->load->view('pages/booking_message');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$available_services = $this->services_model->get_available_services();
|
$available_services = $this->services_model->get_available_services();
|
||||||
$available_providers = $this->providers_model->get_available_providers();
|
$available_providers = $this->providers_model->get_available_providers();
|
||||||
|
|
||||||
|
@ -76,7 +100,6 @@ class Booking extends EA_Controller {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$company_name = setting('company_name');
|
|
||||||
$date_format = setting('date_format');
|
$date_format = setting('date_format');
|
||||||
$time_format = setting('time_format');
|
$time_format = setting('time_format');
|
||||||
$first_weekday = setting('first_weekday');
|
$first_weekday = setting('first_weekday');
|
||||||
|
@ -105,8 +128,6 @@ class Booking extends EA_Controller {
|
||||||
$display_any_provider = setting('display_any_provider');
|
$display_any_provider = setting('display_any_provider');
|
||||||
$display_delete_personal_information = setting('display_delete_personal_information');
|
$display_delete_personal_information = setting('display_delete_personal_information');
|
||||||
$book_advance_timeout = setting('book_advance_timeout');
|
$book_advance_timeout = setting('book_advance_timeout');
|
||||||
$google_analytics_code = setting('google_analytics_code');
|
|
||||||
$matomo_analytics_url = setting('matomo_analytics_url');
|
|
||||||
|
|
||||||
$timezones = $this->timezones->to_array();
|
$timezones = $this->timezones->to_array();
|
||||||
$grouped_timezones = $this->timezones->to_grouped_array();
|
$grouped_timezones = $this->timezones->to_grouped_array();
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -341,4 +341,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -342,4 +342,8 @@ $lang['invalid_phone'] = 'Invalid phone number.';
|
||||||
$lang['legal'] = 'Legal';
|
$lang['legal'] = 'Legal';
|
||||||
$lang['business'] = 'Business';
|
$lang['business'] = 'Business';
|
||||||
$lang['account'] = 'Account';
|
$lang['account'] = 'Account';
|
||||||
|
$lang['disable_booking'] = 'Disable Booking';
|
||||||
|
$lang['disable_booking_hint'] = 'The booking page will be disabled for as long as this setting is active and customers will not be able to register new appointments.';
|
||||||
|
$lang['display_message'] = 'Display Message';
|
||||||
|
$lang['booking_is_disabled'] = 'Booking Is Disabled!';
|
||||||
// End
|
// End
|
||||||
|
|
41
application/migrations/030_add_disable_booking_setting.php
Normal file
41
application/migrations/030_add_disable_booking_setting.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Online Appointment Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) Alex Tselegidis
|
||||||
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link https://easyappointments.org
|
||||||
|
* @since v1.4.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
class Migration_Add_disable_booking_setting extends EA_Migration {
|
||||||
|
/**
|
||||||
|
* Upgrade method.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->get_where('settings', ['name' => 'disable_booking'])->num_rows())
|
||||||
|
{
|
||||||
|
$this->db->insert('settings', [
|
||||||
|
'name' => 'disable_booking',
|
||||||
|
'value' => '0'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downgrade method.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->get_where('settings', ['name' => 'disable_booking'])->num_rows())
|
||||||
|
{
|
||||||
|
$this->db->delete('settings', [
|
||||||
|
'name' => 'disable_booking',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
* Easy!Appointments - Online Appointment Scheduler
|
||||||
|
*
|
||||||
|
* @package EasyAppointments
|
||||||
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
||||||
|
* @copyright Copyright (c) Alex Tselegidis
|
||||||
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
||||||
|
* @link https://easyappointments.org
|
||||||
|
* @since v1.4.0
|
||||||
|
* ---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
class Migration_Add_disable_booking_message_setting extends EA_Migration {
|
||||||
|
/**
|
||||||
|
* Upgrade method.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->get_where('settings', ['name' => 'disable_booking_message'])->num_rows())
|
||||||
|
{
|
||||||
|
$this->db->insert('settings', [
|
||||||
|
'name' => 'disable_booking_message',
|
||||||
|
'value' => '<p style="text-align: center;">Thanks for stopping by!</p><p style="text-align: center;">We are not accepting new appointments at the moment, please check back again later.</p>'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downgrade method.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->get_where('settings', ['name' => 'disable_booking_message'])->num_rows())
|
||||||
|
{
|
||||||
|
$this->db->delete('settings', [
|
||||||
|
'name' => 'disable_booking_message',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -286,6 +286,29 @@
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="disable-booking"
|
||||||
|
data-field="disable_booking">
|
||||||
|
<label class="form-check-label" for="disable-booking">
|
||||||
|
<?= lang('disable_booking') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text text-muted">
|
||||||
|
<small>
|
||||||
|
<?= lang('disable_booking_hint') ?>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group mb-3" hidden>
|
||||||
|
<label class="form-label" for="disable-booking-message">
|
||||||
|
<?= lang('display_message') ?>
|
||||||
|
</label>
|
||||||
|
<textarea id="disable-booking-message" cols="30" rows="10" class="mb-3"></textarea>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
App.Pages.BookingSettings = (function () {
|
App.Pages.BookingSettings = (function () {
|
||||||
const $bookingSettings = $('#booking-settings');
|
const $bookingSettings = $('#booking-settings');
|
||||||
const $saveSettings = $('#save-settings');
|
const $saveSettings = $('#save-settings');
|
||||||
|
const $disableBooking = $('#disable-booking');
|
||||||
|
const $disableBookingMessage = $('#disable-booking-message');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the form has invalid values.
|
* Check if the form has invalid values.
|
||||||
|
@ -58,6 +60,11 @@ App.Pages.BookingSettings = (function () {
|
||||||
*/
|
*/
|
||||||
function deserialize(bookingSettings) {
|
function deserialize(bookingSettings) {
|
||||||
bookingSettings.forEach((bookingSetting) => {
|
bookingSettings.forEach((bookingSetting) => {
|
||||||
|
if (bookingSetting.name === 'disable_booking_message') {
|
||||||
|
$disableBookingMessage.trumbowyg('html', bookingSetting.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const $field = $('[data-field="' + bookingSetting.name + '"]');
|
const $field = $('[data-field="' + bookingSetting.name + '"]');
|
||||||
|
|
||||||
if ($field.is(':checkbox')) {
|
if ($field.is(':checkbox')) {
|
||||||
|
@ -85,6 +92,11 @@ App.Pages.BookingSettings = (function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
bookingSettings.push({
|
||||||
|
name: 'disable_booking_message',
|
||||||
|
value: $disableBookingMessage.trumbowyg('html')
|
||||||
|
});
|
||||||
|
|
||||||
return bookingSettings;
|
return bookingSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,6 +148,8 @@ App.Pages.BookingSettings = (function () {
|
||||||
|
|
||||||
updateRequireSwitch($requireSwitch);
|
updateRequireSwitch($requireSwitch);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$disableBookingMessage.closest('.form-group').prop('hidden', !$disableBooking.prop('checked'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,20 +191,31 @@ App.Pages.BookingSettings = (function () {
|
||||||
updateRequireSwitch($requireSwitch);
|
updateRequireSwitch($requireSwitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the message container.
|
||||||
|
*/
|
||||||
|
function onDisableBookingClick() {
|
||||||
|
$disableBookingMessage.closest('.form-group').prop('hidden', !$disableBooking.prop('checked'));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the module.
|
* Initialize the module.
|
||||||
*/
|
*/
|
||||||
function initialize() {
|
function initialize() {
|
||||||
const bookingSettings = vars('booking_settings');
|
const bookingSettings = vars('booking_settings');
|
||||||
|
|
||||||
deserialize(bookingSettings);
|
|
||||||
|
|
||||||
$saveSettings.on('click', onSaveSettingsClick);
|
$saveSettings.on('click', onSaveSettingsClick);
|
||||||
|
|
||||||
|
$disableBooking.on('click', onDisableBookingClick);
|
||||||
|
|
||||||
$bookingSettings
|
$bookingSettings
|
||||||
.on('click', '.display-switch', onDisplaySwitchClick)
|
.on('click', '.display-switch', onDisplaySwitchClick)
|
||||||
.on('click', '.require-switch', onRequireSwitchClick);
|
.on('click', '.require-switch', onRequireSwitchClick);
|
||||||
|
|
||||||
|
$disableBookingMessage.trumbowyg();
|
||||||
|
|
||||||
|
deserialize(bookingSettings);
|
||||||
|
|
||||||
applyInitialState();
|
applyInitialState();
|
||||||
|
|
||||||
App.Layouts.Backend.placeFooterToBottom();
|
App.Layouts.Backend.placeFooterToBottom();
|
||||||
|
|
Loading…
Reference in a new issue