2021-12-16 10:37:55 +03:00
|
|
|
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------------
|
2022-01-18 15:05:42 +03:00
|
|
|
* Easy!Appointments - Online Appointment Scheduler
|
2021-12-16 10:37:55 +03:00
|
|
|
*
|
|
|
|
* @package EasyAppointments
|
|
|
|
* @author A.Tselegidis <alextselegidis@gmail.com>
|
2021-12-18 19:43:45 +03:00
|
|
|
* @copyright Copyright (c) Alex Tselegidis
|
2021-12-16 10:37:55 +03:00
|
|
|
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
|
|
|
|
* @link https://easyappointments.org
|
|
|
|
* @since v1.5.0
|
|
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Booking confirmation controller.
|
|
|
|
*
|
|
|
|
* Handles the booking confirmation related operations.
|
|
|
|
*
|
|
|
|
* @package Controllers
|
|
|
|
*/
|
|
|
|
class Booking_confirmation extends EA_Controller {
|
|
|
|
/**
|
|
|
|
* Booking constructor.
|
|
|
|
*/
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
|
|
|
|
$this->load->model('appointments_model');
|
|
|
|
$this->load->model('providers_model');
|
|
|
|
$this->load->model('services_model');
|
|
|
|
$this->load->model('customers_model');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Display the appointment registration success page.
|
|
|
|
*/
|
2021-12-18 19:22:40 +03:00
|
|
|
public function of()
|
2021-12-16 10:37:55 +03:00
|
|
|
{
|
2022-01-13 13:33:46 +03:00
|
|
|
$appointment_hash = $this->uri->segment(3);
|
2021-12-18 19:22:40 +03:00
|
|
|
|
2021-12-16 10:37:55 +03:00
|
|
|
$occurrences = $this->appointments_model->get(['hash' => $appointment_hash]);
|
|
|
|
|
|
|
|
if (empty($occurrences))
|
|
|
|
{
|
|
|
|
redirect('appointments'); // The appointment does not exist.
|
2021-12-18 19:22:40 +03:00
|
|
|
|
2021-12-16 10:37:55 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$appointment = $occurrences[0];
|
|
|
|
|
|
|
|
unset($appointment['notes']);
|
|
|
|
|
|
|
|
$provider = $this->providers_model->find($appointment['id_users_provider']);
|
|
|
|
|
2021-12-18 19:22:40 +03:00
|
|
|
$this->providers_model->only($provider, [
|
|
|
|
'id',
|
|
|
|
'first_name',
|
|
|
|
'last_name',
|
|
|
|
'email',
|
|
|
|
'timezone'
|
|
|
|
]);
|
|
|
|
|
2021-12-16 10:37:55 +03:00
|
|
|
$service = $this->services_model->find($appointment['id_services']);
|
|
|
|
|
2021-12-18 19:22:40 +03:00
|
|
|
$this->services_model->only($service, [
|
|
|
|
'id',
|
|
|
|
'first_name',
|
|
|
|
'last_name',
|
|
|
|
'email',
|
|
|
|
'timezone'
|
|
|
|
]);
|
2021-12-16 10:37:55 +03:00
|
|
|
|
2021-12-18 19:22:40 +03:00
|
|
|
$company_name = setting('company_name');
|
2021-12-16 10:37:55 +03:00
|
|
|
|
2022-01-13 13:33:46 +03:00
|
|
|
script_vars([
|
2021-12-16 10:37:55 +03:00
|
|
|
'appointment_data' => $appointment,
|
2021-12-18 19:22:40 +03:00
|
|
|
'provider_data' => $provider,
|
2021-12-16 10:37:55 +03:00
|
|
|
'service_data' => $service,
|
|
|
|
'company_name' => $company_name,
|
2022-01-13 13:33:46 +03:00
|
|
|
'google_api_scope' => 'https://www.googleapis.com/auth/calendar',
|
|
|
|
'google_api_key' => config('google_api_key'),
|
|
|
|
'google_client_id' => config('google_api_key'),
|
|
|
|
]);
|
|
|
|
|
|
|
|
html_vars([
|
|
|
|
'page_title' => lang('success'),
|
2022-01-19 12:18:00 +03:00
|
|
|
'google_analytics_code' => setting('google_analytics_code'),
|
|
|
|
'matomo_analytics_url' => setting('matomo_analytics_url'),
|
2021-12-16 10:37:55 +03:00
|
|
|
]);
|
2022-01-13 13:33:46 +03:00
|
|
|
|
2022-01-19 12:21:05 +03:00
|
|
|
$this->load->view('pages/booking_confirmation');
|
2021-12-16 10:37:55 +03:00
|
|
|
}
|
|
|
|
}
|