mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-10 10:02:33 +03:00
Add a new "is_private" flag to services and providers so that they do not appear in the booking page (#378).
This commit is contained in:
parent
86d3ce8dc9
commit
2f41c28786
38 changed files with 220 additions and 20 deletions
|
@ -86,8 +86,8 @@ class Booking extends EA_Controller {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$available_services = $this->services_model->get_available_services();
|
$available_services = $this->services_model->get_available_services(TRUE);
|
||||||
$available_providers = $this->providers_model->get_available_providers();
|
$available_providers = $this->providers_model->get_available_providers(TRUE);
|
||||||
|
|
||||||
foreach ($available_providers as &$available_provider)
|
foreach ($available_providers as &$available_provider)
|
||||||
{
|
{
|
||||||
|
@ -224,7 +224,7 @@ class Booking extends EA_Controller {
|
||||||
'available_providers' => $available_providers,
|
'available_providers' => $available_providers,
|
||||||
'company_name' => $company_name,
|
'company_name' => $company_name,
|
||||||
'company_logo' => $company_logo,
|
'company_logo' => $company_logo,
|
||||||
'company_color' => $company_color,
|
'company_color' => $company_color === '#ffffff' ? '' : $company_color,
|
||||||
'date_format' => $date_format,
|
'date_format' => $date_format,
|
||||||
'time_format' => $time_format,
|
'time_format' => $time_format,
|
||||||
'first_weekday' => $first_weekday,
|
'first_weekday' => $first_weekday,
|
||||||
|
@ -364,7 +364,7 @@ class Booking extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
protected function search_any_provider(int $service_id, string $date, string $hour = NULL): ?int
|
protected function search_any_provider(int $service_id, string $date, string $hour = NULL): ?int
|
||||||
{
|
{
|
||||||
$available_providers = $this->providers_model->get_available_providers();
|
$available_providers = $this->providers_model->get_available_providers(TRUE);
|
||||||
|
|
||||||
$service = $this->services_model->find($service_id);
|
$service = $this->services_model->find($service_id);
|
||||||
|
|
||||||
|
@ -652,7 +652,7 @@ class Booking extends EA_Controller {
|
||||||
*/
|
*/
|
||||||
protected function search_providers_by_service(int $service_id): array
|
protected function search_providers_by_service(int $service_id): array
|
||||||
{
|
{
|
||||||
$available_providers = $this->providers_model->get_available_providers();
|
$available_providers = $this->providers_model->get_available_providers(TRUE);
|
||||||
$provider_list = [];
|
$provider_list = [];
|
||||||
|
|
||||||
foreach ($available_providers as $provider)
|
foreach ($available_providers as $provider)
|
||||||
|
|
|
@ -99,8 +99,8 @@ class Calendar extends EA_Controller {
|
||||||
$available_providers = $this->providers_model->get_available_providers();
|
$available_providers = $this->providers_model->get_available_providers();
|
||||||
|
|
||||||
$available_services = $this->services_model->get_available_services();
|
$available_services = $this->services_model->get_available_services();
|
||||||
|
|
||||||
$calendar_view = request('view', $user['settings']['calendar_view']);
|
$calendar_view = request('view', $user['settings']['calendar_view']);
|
||||||
|
|
||||||
script_vars([
|
script_vars([
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -356,4 +356,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -357,4 +357,6 @@ $lang['company'] = 'Company';
|
||||||
$lang['remove'] = 'Remove';
|
$lang['remove'] = 'Remove';
|
||||||
$lang['login_button'] = 'Login Button';
|
$lang['login_button'] = 'Login Button';
|
||||||
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
$lang['display_login_button_hint'] = 'Defines whether the login button is being displayed in the booking page.';
|
||||||
|
$lang['private'] = 'Private';
|
||||||
|
$lang['private_hint'] = 'Private records will not be displayed or processed in public pages such as the booking page.';
|
||||||
// End
|
// End
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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_is_private_column_to_services_table extends CI_Migration {
|
||||||
|
/**
|
||||||
|
* Upgrade method.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->field_exists('is_private', 'services'))
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
'is_private' => [
|
||||||
|
'type' => 'TINYINT',
|
||||||
|
'constraint' => '4',
|
||||||
|
'default' => '0',
|
||||||
|
'after' => 'attendants_number'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->dbforge->add_column('services', $fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downgrade method.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->field_exists('is_private', 'services'))
|
||||||
|
{
|
||||||
|
$this->dbforge->drop_column('services', 'is_private');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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_is_private_column_to_users_table extends CI_Migration {
|
||||||
|
/**
|
||||||
|
* Upgrade method.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->field_exists('is_private', 'users'))
|
||||||
|
{
|
||||||
|
$fields = [
|
||||||
|
'is_private' => [
|
||||||
|
'type' => 'TINYINT',
|
||||||
|
'constraint' => '4',
|
||||||
|
'default' => '0',
|
||||||
|
'after' => 'language'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->dbforge->add_column('users', $fields);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Downgrade method.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
if ( ! $this->db->field_exists('is_private', 'users'))
|
||||||
|
{
|
||||||
|
$this->dbforge->drop_column('users', 'is_private');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,7 @@ class Providers_model extends EA_Model {
|
||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
|
'is_private' => 'boolean',
|
||||||
'id_roles' => 'integer',
|
'id_roles' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ class Providers_model extends EA_Model {
|
||||||
'timezone' => 'timezone',
|
'timezone' => 'timezone',
|
||||||
'language' => 'language',
|
'language' => 'language',
|
||||||
'notes' => 'notes',
|
'notes' => 'notes',
|
||||||
|
'isPrivate' => 'is_private',
|
||||||
'roleId' => 'id_roles',
|
'roleId' => 'id_roles',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -609,10 +611,17 @@ class Providers_model extends EA_Model {
|
||||||
/**
|
/**
|
||||||
* Get all the provider records that are assigned to at least one service.
|
* Get all the provider records that are assigned to at least one service.
|
||||||
*
|
*
|
||||||
|
* @param bool $without_private Only include the public providers.
|
||||||
|
*
|
||||||
* @return array Returns an array of providers.
|
* @return array Returns an array of providers.
|
||||||
*/
|
*/
|
||||||
public function get_available_providers(): array
|
public function get_available_providers(bool $without_private = FALSE): array
|
||||||
{
|
{
|
||||||
|
if ($without_private)
|
||||||
|
{
|
||||||
|
$this->db->where('users.is_private', FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
$providers = $this
|
$providers = $this
|
||||||
->db
|
->db
|
||||||
->select('users.*')
|
->select('users.*')
|
||||||
|
|
|
@ -26,6 +26,7 @@ class Services_model extends EA_Model {
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
'price' => 'float',
|
'price' => 'float',
|
||||||
'attendants_number' => 'integer',
|
'attendants_number' => 'integer',
|
||||||
|
'is_private' => 'boolean',
|
||||||
'id_categories' => 'integer',
|
'id_categories' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ class Services_model extends EA_Model {
|
||||||
'color' => 'color',
|
'color' => 'color',
|
||||||
'availabilitiesType' => 'availabilities_type',
|
'availabilitiesType' => 'availabilities_type',
|
||||||
'attendantsNumber' => 'attendants_number',
|
'attendantsNumber' => 'attendants_number',
|
||||||
|
'isPrivate' => 'is_private',
|
||||||
'categoryId' => 'id_categories',
|
'categoryId' => 'id_categories',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -211,9 +213,9 @@ class Services_model extends EA_Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
$service = $this->db->get_where('services', ['id' => $service_id])->row_array();
|
$service = $this->db->get_where('services', ['id' => $service_id])->row_array();
|
||||||
|
|
||||||
$this->cast($service);
|
$this->cast($service);
|
||||||
|
|
||||||
return $service;
|
return $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +251,7 @@ class Services_model extends EA_Model {
|
||||||
|
|
||||||
// Check if the required field is part of the service data.
|
// Check if the required field is part of the service data.
|
||||||
$service = $query->row_array();
|
$service = $query->row_array();
|
||||||
|
|
||||||
$this->cast($service);
|
$this->cast($service);
|
||||||
|
|
||||||
if ( ! array_key_exists($field, $service))
|
if ( ! array_key_exists($field, $service))
|
||||||
|
@ -283,22 +285,29 @@ class Services_model extends EA_Model {
|
||||||
}
|
}
|
||||||
|
|
||||||
$services = $this->db->get('services', $limit, $offset)->result_array();
|
$services = $this->db->get('services', $limit, $offset)->result_array();
|
||||||
|
|
||||||
foreach ($services as $service)
|
foreach ($services as &$service)
|
||||||
{
|
{
|
||||||
$this->cast($service);
|
$this->cast($service);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $services;
|
return $services;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all the service records that are assigned to at least one provider.
|
* Get all the service records that are assigned to at least one provider.
|
||||||
*
|
*
|
||||||
|
* @param bool $without_private Only include the public services.
|
||||||
|
*
|
||||||
* @return array Returns an array of services.
|
* @return array Returns an array of services.
|
||||||
*/
|
*/
|
||||||
public function get_available_services(): array
|
public function get_available_services(bool $without_private = FALSE): array
|
||||||
{
|
{
|
||||||
|
if ($without_private)
|
||||||
|
{
|
||||||
|
$this->db->where('services.is_private', FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
$services = $this
|
$services = $this
|
||||||
->db
|
->db
|
||||||
->distinct()
|
->distinct()
|
||||||
|
@ -310,7 +319,7 @@ class Services_model extends EA_Model {
|
||||||
->get()
|
->get()
|
||||||
->result_array();
|
->result_array();
|
||||||
|
|
||||||
foreach ($services as $service)
|
foreach ($services as &$service)
|
||||||
{
|
{
|
||||||
$this->cast($service);
|
$this->cast($service);
|
||||||
}
|
}
|
||||||
|
@ -351,8 +360,8 @@ class Services_model extends EA_Model {
|
||||||
->order_by($order_by)
|
->order_by($order_by)
|
||||||
->get()
|
->get()
|
||||||
->result_array();
|
->result_array();
|
||||||
|
|
||||||
foreach ($services as $service)
|
foreach ($services as &$service)
|
||||||
{
|
{
|
||||||
$this->cast($service);
|
$this->cast($service);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/general.css') ?>">
|
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/general.css') ?>">
|
||||||
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/layouts/booking_layout.css') ?>">
|
<link rel="stylesheet" type="text/css" href="<?= asset_url('assets/css/layouts/booking_layout.css') ?>">
|
||||||
|
|
||||||
<?php component('company_color_style', ['company_color' => vars('company_color')]) ?>
|
<?php if (vars('company_color')): ?>
|
||||||
|
<?php component('company_color_style', ['company_color' => vars('company_color')]) ?>
|
||||||
|
<?php endif ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -146,6 +146,21 @@
|
||||||
<input id="zip-code" class="form-control" maxlength="64" disabled>
|
<input id="zip-code" class="form-control" maxlength="64" disabled>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="private">
|
||||||
|
<label class="form-check-label" for="private">
|
||||||
|
<?= lang('private') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text text-muted">
|
||||||
|
<small>
|
||||||
|
<?= lang('private_hint') ?>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="notes">
|
<label class="form-label" for="notes">
|
||||||
<?= lang('notes') ?>
|
<?= lang('notes') ?>
|
||||||
|
|
|
@ -128,6 +128,21 @@
|
||||||
<?php component('color_selection', ['attributes' => 'id="color"']) ?>
|
<?php component('color_selection', ['attributes' => 'id="color"']) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input class="form-check-input" type="checkbox" id="private">
|
||||||
|
<label class="form-check-label" for="private">
|
||||||
|
<?= lang('private') ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-text text-muted">
|
||||||
|
<small>
|
||||||
|
<?= lang('private_hint') ?>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="description">
|
<label class="form-label" for="description">
|
||||||
<?= lang('description') ?>
|
<?= lang('description') ?>
|
||||||
|
|
|
@ -26,6 +26,7 @@ App.Pages.Providers = (function () {
|
||||||
const $city = $('#city');
|
const $city = $('#city');
|
||||||
const $state = $('#state');
|
const $state = $('#state');
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
|
const $private = $('#private');
|
||||||
const $notes = $('#notes');
|
const $notes = $('#notes');
|
||||||
const $timezone = $('#timezone');
|
const $timezone = $('#timezone');
|
||||||
const $username = $('#username');
|
const $username = $('#username');
|
||||||
|
@ -162,6 +163,7 @@ App.Pages.Providers = (function () {
|
||||||
city: $city.val(),
|
city: $city.val(),
|
||||||
state: $state.val(),
|
state: $state.val(),
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
|
is_private: Number($private.prop('checked')),
|
||||||
notes: $notes.val(),
|
notes: $notes.val(),
|
||||||
timezone: $timezone.val(),
|
timezone: $timezone.val(),
|
||||||
settings: {
|
settings: {
|
||||||
|
@ -381,6 +383,7 @@ App.Pages.Providers = (function () {
|
||||||
$city.val(provider.city);
|
$city.val(provider.city);
|
||||||
$state.val(provider.state);
|
$state.val(provider.state);
|
||||||
$zipCode.val(provider.zip_code);
|
$zipCode.val(provider.zip_code);
|
||||||
|
$private.prop('checked', provider.is_private);
|
||||||
$notes.val(provider.notes);
|
$notes.val(provider.notes);
|
||||||
$timezone.val(provider.timezone);
|
$timezone.val(provider.timezone);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ App.Pages.Services = (function () {
|
||||||
const $category = $('#category');
|
const $category = $('#category');
|
||||||
const $availabilitiesType = $('#availabilities-type');
|
const $availabilitiesType = $('#availabilities-type');
|
||||||
const $attendantsNumber = $('#attendants-number');
|
const $attendantsNumber = $('#attendants-number');
|
||||||
|
const $private = $('#private');
|
||||||
const $location = $('#location');
|
const $location = $('#location');
|
||||||
const $description = $('#description');
|
const $description = $('#description');
|
||||||
const $filterServices = $('#filter-services');
|
const $filterServices = $('#filter-services');
|
||||||
|
@ -134,6 +135,7 @@ App.Pages.Services = (function () {
|
||||||
color: App.Components.ColorSelection.getColor($color),
|
color: App.Components.ColorSelection.getColor($color),
|
||||||
availabilities_type: $availabilitiesType.val(),
|
availabilities_type: $availabilitiesType.val(),
|
||||||
attendants_number: $attendantsNumber.val(),
|
attendants_number: $attendantsNumber.val(),
|
||||||
|
is_private: Number($private.prop('checked')),
|
||||||
id_categories: $category.val() || null
|
id_categories: $category.val() || null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -288,6 +290,7 @@ App.Pages.Services = (function () {
|
||||||
$location.val(service.location);
|
$location.val(service.location);
|
||||||
$availabilitiesType.val(service.availabilities_type);
|
$availabilitiesType.val(service.availabilities_type);
|
||||||
$attendantsNumber.val(service.attendants_number);
|
$attendantsNumber.val(service.attendants_number);
|
||||||
|
$private.prop('checked', service.is_private);
|
||||||
App.Components.ColorSelection.setColor($color, service.color);
|
App.Components.ColorSelection.setColor($color, service.color);
|
||||||
|
|
||||||
const categoryId = service.id_categories !== null ? service.id_categories : '';
|
const categoryId = service.id_categories !== null ? service.id_categories : '';
|
||||||
|
|
Loading…
Reference in a new issue