Added new setting for toggling the "any provider" option in the booking page (#247).

This commit is contained in:
Alex Tselegidis 2020-04-06 20:36:22 +02:00
parent 653007604f
commit 15757852ec
35 changed files with 113 additions and 7 deletions

View file

@ -37,7 +37,7 @@ $config['migration_table'] = 'ea_migrations';
| be upgraded / downgraded to.
|
*/
$config['migration_version'] = 18; // current
$config['migration_version'] = 19; // current
/*

View file

@ -85,6 +85,7 @@ class Appointments extends CI_Controller {
$terms_and_conditions_content = $this->settings_model->get_setting('terms_and_conditions_content');
$display_privacy_policy = $this->settings_model->get_setting('display_privacy_policy');
$privacy_policy_content = $this->settings_model->get_setting('privacy_policy_content');
$display_any_provider = $this->settings_model->get_setting('display_any_provider');
$timezones = $this->timezones_model->to_array();
// Remove the data that are not needed inside the $available_providers array.
@ -164,6 +165,7 @@ class Appointments extends CI_Controller {
'display_privacy_policy' => $display_privacy_policy,
'privacy_policy_content' => $privacy_policy_content,
'timezones' => $timezones,
'display_any_provider' => $display_any_provider,
];
}
catch (Exception $exc)

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -319,4 +319,5 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['load_more'] = 'Load More';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will get an additional option that allows customers to book without specifying a provider.';
$lang['load_more'] = 'Load More';

View file

@ -313,4 +313,6 @@ $lang['timezone'] = 'Timezone';
$lang['overwrite_existing_working_plans'] = 'This will overwrite the existing provider working plans, are you sure that you want to continue?';
$lang['working_plans_got_updated'] = 'All the working plans got updated.';
$lang['apply_to_all_providers'] = 'Apply To All Providers';
$lang['display_any_provider'] = 'Display Any Provider Option';
$lang['display_any_provider_hint'] = 'The booking page will display an additional option that allows customers to book without selecting a particular provider.';
$lang['load_more'] = 'Load More';

View file

@ -0,0 +1,29 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) 2013 - 2020, Alex Tselegidis
* @license http://opensource.org/licenses/GPL-3.0 - GPLv3
* @link http://easyappointments.org
* @since v1.4.0
* ---------------------------------------------------------------------------- */
class Migration_Add_display_any_provider_setting extends CI_Migration {
public function up()
{
$this->db->insert('ea_settings', [
'name' => 'display_any_provider',
'value' => '1'
]);
}
public function down()
{
$this->db->delete('ea_settings', [
'name' => 'display_any_provider'
]);
}
}

View file

@ -380,6 +380,7 @@
appointmentData : <?= json_encode($appointment_data) ?>,
providerData : <?= json_encode($provider_data) ?>,
customerData : <?= json_encode($customer_data) ?>,
displayAnyProvider : <?= json_encode($display_any_provider) ?>,
csrfToken : <?= json_encode($this->security->get_csrf_hash()) ?>
};

View file

@ -192,7 +192,7 @@
</div>
<div class="form-group">
<label for="require-phone-number">
<?= lang('require_phone_number') ?>
<?= lang('phone_number') ?>
</label>
<br>
<button type="button" id="require-phone-number" class="btn btn-default" data-toggle="button" aria-pressed="false">
@ -203,6 +203,17 @@
<?= lang('require_phone_number_hint') ?>
</span>
</div>
<div class="form-group">
<label><?= lang('any_provider') ?></label>
<br>
<button type="button" id="display-any-provider" class="btn btn-default" data-toggle="button" aria-pressed="false">
<span class="glyphicon glyphicon-user"></span>
<?= lang('display_any_provider') ?>
</button>
<span class="help-block">
<?= lang('display_any_provider_hint') ?>
</span>
</div>
</div>
</div>
</fieldset>

View file

@ -762,12 +762,16 @@ body .form-horizontal .controls {
#settings-page #user-notifications,
#settings-page #customer-notifications,
#settings-page #display-any-provider,
#settings-page #require-phone-number,
#settings-page #require-captcha {
outline: none;
}
#settings-page #user-notifications.active,
#settings-page #customer-notifications.active,
#settings-page #display-any-provider.active,
#settings-page #require-phone-number.active,
#settings-page #require-captcha.active {
background: #B6DCFF;
}

View file

@ -75,6 +75,10 @@ window.BackendSettings = window.BackendSettings || {};
$('#require-phone-number').addClass('active');
}
if (setting.name === 'display_any_provider' && setting.value === '1') {
$('#display-any-provider').addClass('active');
}
if (setting.name === 'display_cookie_notice') {
$('#display-cookie-notice').prop('checked', setting.value === '1');
}

View file

@ -90,6 +90,11 @@
value: $('#require-phone-number').hasClass('active') === true ? '1' : '0'
});
settings.push({
name: 'display_any_provider',
value: $('#display-any-provider').hasClass('active') === true ? '1' : '0'
});
// Business Logic Tab
settings.push({

View file

@ -247,7 +247,7 @@ window.FrontendBook = window.FrontendBook || {};
});
// Add the "Any Provider" entry.
if ($('#select-provider option').length >= 1) {
if ($('#select-provider option').length >= 1 && GlobalVariables.displayAnyProvider === '1') {
$('#select-provider').append(new Option('- ' + EALang.any_provider + ' -', 'any-provider'));
}

View file

@ -25,6 +25,7 @@ VALUES
('privacy_policy_content', 'Privacy policy content.'),
('first_weekday', 'sunday'),
('require_phone_number', '1'),
('api_token', '');
('api_token', ''),
('display_any_provider', '1');
INSERT INTO `ea_migrations` VALUES ('18');
INSERT INTO `ea_migrations` VALUES ('19');