mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 07:52:29 +03:00
Sync appointment with customer's Google Calendar in the book success page needs the correct timezone
This commit is contained in:
parent
a7539325e5
commit
bae970d257
2 changed files with 9 additions and 12 deletions
|
@ -73,6 +73,8 @@
|
||||||
<script src="<?= base_url('assets/ext/jquery/jquery.min.js') ?>"></script>
|
<script src="<?= base_url('assets/ext/jquery/jquery.min.js') ?>"></script>
|
||||||
<script src="<?= base_url('assets/ext/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>
|
<script src="<?= base_url('assets/ext/bootstrap/js/bootstrap.bundle.min.js') ?>"></script>
|
||||||
<script src="<?= base_url('assets/ext/datejs/date.min.js') ?>"></script>
|
<script src="<?= base_url('assets/ext/datejs/date.min.js') ?>"></script>
|
||||||
|
<script src="<?= asset_url('assets/ext/moment/moment.min.js') ?>"></script>
|
||||||
|
<script src="<?= asset_url('assets/ext/moment/moment-timezone-with-data.min.js') ?>"></script>
|
||||||
<script src="https://apis.google.com/js/client.js"></script>
|
<script src="https://apis.google.com/js/client.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -80,6 +82,7 @@
|
||||||
csrfToken: <?= json_encode($this->security->get_csrf_hash()) ?>,
|
csrfToken: <?= json_encode($this->security->get_csrf_hash()) ?>,
|
||||||
appointmentData: <?= json_encode($appointment_data) ?>,
|
appointmentData: <?= json_encode($appointment_data) ?>,
|
||||||
providerData: <?= json_encode($provider_data) ?>,
|
providerData: <?= json_encode($provider_data) ?>,
|
||||||
|
customerData: <?= json_encode($customer_data) ?>,
|
||||||
serviceData: <?= json_encode($service_data) ?>,
|
serviceData: <?= json_encode($service_data) ?>,
|
||||||
companyName: <?= json_encode($company_name) ?>,
|
companyName: <?= json_encode($company_name) ?>,
|
||||||
googleApiKey: <?= json_encode(config('google_api_key')) ?>,
|
googleApiKey: <?= json_encode(config('google_api_key')) ?>,
|
||||||
|
|
|
@ -40,27 +40,21 @@ $(document).ready(function () {
|
||||||
throw new Error('Could not authorize user.');
|
throw new Error('Could not authorize user.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// The user has granted access, add the appointment to his calendar.
|
// The user has granted access, add the appointment to his calendar. Before making the event.insert request
|
||||||
// Before making the event.insert request the the event resource data
|
// the the event resource data must be prepared.
|
||||||
// must be prepared.
|
var providerData = GlobalVariables.providerData;
|
||||||
var appointmentData = GlobalVariables.appointmentData;
|
|
||||||
|
|
||||||
appointmentData.start_datetime = GeneralFunctions.ISODateString(
|
var appointmentData = GlobalVariables.appointmentData;
|
||||||
Date.parseExact(appointmentData.start_datetime,
|
|
||||||
'yyyy-MM-dd HH:mm:ss'));
|
|
||||||
appointmentData.end_datetime = GeneralFunctions.ISODateString(
|
|
||||||
Date.parseExact(appointmentData.end_datetime,
|
|
||||||
'yyyy-MM-dd HH:mm:ss'));
|
|
||||||
|
|
||||||
// Create a valid Google Calendar API resource for the new event.
|
// Create a valid Google Calendar API resource for the new event.
|
||||||
var resource = {
|
var resource = {
|
||||||
summary: GlobalVariables.serviceData.name,
|
summary: GlobalVariables.serviceData.name,
|
||||||
location: GlobalVariables.companyName,
|
location: GlobalVariables.companyName,
|
||||||
start: {
|
start: {
|
||||||
dateTime: appointmentData.start_datetime
|
dateTime: moment.tz(appointmentData.start_datetime, providerData.timezone).format()
|
||||||
},
|
},
|
||||||
end: {
|
end: {
|
||||||
dateTime: appointmentData.end_datetime
|
dateTime: moment.tz(appointmentData.end_datetime, providerData.timezone).format()
|
||||||
},
|
},
|
||||||
attendees: [
|
attendees: [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue