mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-29 03:12:39 +03:00
Various fixes in the Calendar controller
This commit is contained in:
parent
eb19482c1f
commit
840286899a
1 changed files with 23 additions and 11 deletions
|
@ -50,7 +50,7 @@ class Calendar extends EA_Controller
|
|||
*
|
||||
* @param string $appointment_hash Appointment hash.
|
||||
*/
|
||||
public function reschedule(string $appointment_hash)
|
||||
public function reschedule(string $appointment_hash): void
|
||||
{
|
||||
$this->index($appointment_hash);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ class Calendar extends EA_Controller
|
|||
*
|
||||
* @param string $appointment_hash Appointment hash.
|
||||
*/
|
||||
public function index(string $appointment_hash = '')
|
||||
public function index(string $appointment_hash = ''): void
|
||||
{
|
||||
session(['dest_url' => site_url('backend/index' . (!empty($appointment_hash) ? '/' . $appointment_hash : ''))]);
|
||||
|
||||
|
@ -178,7 +178,7 @@ class Calendar extends EA_Controller
|
|||
/**
|
||||
* Save appointment changes that are made from the backend calendar page.
|
||||
*/
|
||||
public function save_appointment()
|
||||
public function save_appointment(): void
|
||||
{
|
||||
try {
|
||||
$customer_data = request('customer_data');
|
||||
|
@ -211,6 +211,11 @@ class Calendar extends EA_Controller
|
|||
'timezone',
|
||||
'language',
|
||||
'notes',
|
||||
'custom_field_1',
|
||||
'custom_field_2',
|
||||
'custom_field_3',
|
||||
'custom_field_4',
|
||||
'custom_field_5',
|
||||
]);
|
||||
|
||||
$customer['id'] = $this->customers_model->save($customer);
|
||||
|
@ -248,7 +253,6 @@ class Calendar extends EA_Controller
|
|||
'notes',
|
||||
'color',
|
||||
'status',
|
||||
'notes',
|
||||
'is_unavailability',
|
||||
'id_users_provider',
|
||||
'id_users_customer',
|
||||
|
@ -320,7 +324,7 @@ class Calendar extends EA_Controller
|
|||
* Notification emails are send to both provider and customer and the delete action is executed to the Google
|
||||
* Calendar account of the provider, if the "google_sync" setting is enabled.
|
||||
*/
|
||||
public function delete_appointment()
|
||||
public function delete_appointment(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', 'appointments')) {
|
||||
|
@ -378,7 +382,7 @@ class Calendar extends EA_Controller
|
|||
/**
|
||||
* Insert of update unavailability to database.
|
||||
*/
|
||||
public function save_unavailability()
|
||||
public function save_unavailability(): void
|
||||
{
|
||||
try {
|
||||
// Check privileges
|
||||
|
@ -418,7 +422,7 @@ class Calendar extends EA_Controller
|
|||
/**
|
||||
* Delete an unavailability from database.
|
||||
*/
|
||||
public function delete_unavailability()
|
||||
public function delete_unavailability(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('delete', PRIV_APPOINTMENTS)) {
|
||||
|
@ -450,7 +454,7 @@ class Calendar extends EA_Controller
|
|||
/**
|
||||
* Insert of update working plan exceptions to database.
|
||||
*/
|
||||
public function save_working_plan_exception()
|
||||
public function save_working_plan_exception(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('edit', PRIV_USERS)) {
|
||||
|
@ -480,7 +484,7 @@ class Calendar extends EA_Controller
|
|||
/**
|
||||
* Delete a working plan exceptions time period to database.
|
||||
*/
|
||||
public function delete_working_plan_exception()
|
||||
public function delete_working_plan_exception(): void
|
||||
{
|
||||
try {
|
||||
$required_permissions = can('edit', PRIV_CUSTOMERS);
|
||||
|
@ -508,7 +512,7 @@ class Calendar extends EA_Controller
|
|||
*
|
||||
* This method will return all the calendar events within a specified period.
|
||||
*/
|
||||
public function get_calendar_appointments_for_table_view()
|
||||
public function get_calendar_appointments_for_table_view(): void
|
||||
{
|
||||
try {
|
||||
$required_permissions = can('view', PRIV_APPOINTMENTS);
|
||||
|
@ -584,6 +588,12 @@ class Calendar extends EA_Controller
|
|||
$response['unavailabilities'] = array_values($response['unavailabilities']);
|
||||
}
|
||||
|
||||
foreach ($response['unavailabilities'] as &$unavailability) {
|
||||
$unavailability['provider'] = $this->providers_model->find($unavailability['id_users_provider']);
|
||||
}
|
||||
|
||||
unset($unavailability);
|
||||
|
||||
// Add blocked periods to the response.
|
||||
$start_date = request('start_date');
|
||||
$end_date = request('end_date');
|
||||
|
@ -601,7 +611,7 @@ class Calendar extends EA_Controller
|
|||
* This method returns the database appointments and unavailability periods for the user selected date period and
|
||||
* record type (provider or service).
|
||||
*/
|
||||
public function get_calendar_appointments()
|
||||
public function get_calendar_appointments(): void
|
||||
{
|
||||
try {
|
||||
if (cannot('view', PRIV_APPOINTMENTS)) {
|
||||
|
@ -722,6 +732,8 @@ class Calendar extends EA_Controller
|
|||
}
|
||||
}
|
||||
|
||||
unset($unavailability);
|
||||
|
||||
$response['unavailabilities'] = array_values($response['unavailabilities']);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue