forked from mirrors/easyappointments
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/bootstrap/js/bootstrap.bundle.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>
|
||||
|
@ -80,6 +82,7 @@
|
|||
csrfToken: <?= json_encode($this->security->get_csrf_hash()) ?>,
|
||||
appointmentData: <?= json_encode($appointment_data) ?>,
|
||||
providerData: <?= json_encode($provider_data) ?>,
|
||||
customerData: <?= json_encode($customer_data) ?>,
|
||||
serviceData: <?= json_encode($service_data) ?>,
|
||||
companyName: <?= json_encode($company_name) ?>,
|
||||
googleApiKey: <?= json_encode(config('google_api_key')) ?>,
|
||||
|
|
|
@ -40,27 +40,21 @@ $(document).ready(function () {
|
|||
throw new Error('Could not authorize user.');
|
||||
}
|
||||
|
||||
// The user has granted access, add the appointment to his calendar.
|
||||
// Before making the event.insert request the the event resource data
|
||||
// must be prepared.
|
||||
var appointmentData = GlobalVariables.appointmentData;
|
||||
// The user has granted access, add the appointment to his calendar. Before making the event.insert request
|
||||
// the the event resource data must be prepared.
|
||||
var providerData = GlobalVariables.providerData;
|
||||
|
||||
appointmentData.start_datetime = GeneralFunctions.ISODateString(
|
||||
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'));
|
||||
var appointmentData = GlobalVariables.appointmentData;
|
||||
|
||||
// Create a valid Google Calendar API resource for the new event.
|
||||
var resource = {
|
||||
summary: GlobalVariables.serviceData.name,
|
||||
location: GlobalVariables.companyName,
|
||||
start: {
|
||||
dateTime: appointmentData.start_datetime
|
||||
dateTime: moment.tz(appointmentData.start_datetime, providerData.timezone).format()
|
||||
},
|
||||
end: {
|
||||
dateTime: appointmentData.end_datetime
|
||||
dateTime: moment.tz(appointmentData.end_datetime, providerData.timezone).format()
|
||||
},
|
||||
attendees: [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue