From 4f2927fb672ca5742599389504526296baa07216 Mon Sep 17 00:00:00 2001 From: Alex Tselegidis Date: Wed, 7 Feb 2024 10:45:04 +0100 Subject: [PATCH] Store and process the custom field value in the booking page --- application/controllers/Booking.php | 5 +++++ assets/js/pages/booking.js | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/application/controllers/Booking.php b/application/controllers/Booking.php index 10cba132..5a1b0743 100755 --- a/application/controllers/Booking.php +++ b/application/controllers/Booking.php @@ -406,6 +406,11 @@ class Booking extends EA_Controller 'zip_code', 'timezone', 'language', + 'custom_field_1', + 'custom_field_2', + 'custom_field_3', + 'custom_field_4', + 'custom_field_5', ]); $customer_id = $this->customers_model->save($customer); diff --git a/assets/js/pages/booking.js b/assets/js/pages/booking.js index 05a3b188..855e47b5 100644 --- a/assets/js/pages/booking.js +++ b/assets/js/pages/booking.js @@ -34,6 +34,11 @@ App.Pages.Booking = (function () { const $availableHours = $('#available-hours'); const $bookAppointmentSubmit = $('#book-appointment-submit'); const $deletePersonalInformation = $('#delete-personal-information'); + const $customField1 = $('#custom-field-1'); + const $customField2 = $('#custom-field-2'); + const $customField3 = $('#custom-field-3'); + const $customField4 = $('#custom-field-4'); + const $customField5 = $('#custom-field-5'); const tippy = window.tippy; const moment = window.moment; @@ -711,6 +716,11 @@ App.Pages.Booking = (function () { city: $city.val(), zip_code: $zipCode.val(), timezone: $selectTimezone.val(), + custom_field_1: $customField1.val(), + custom_field_2: $customField2.val(), + custom_field_3: $customField3.val(), + custom_field_4: $customField4.val(), + custom_field_5: $customField5.val(), }; data.appointment = { @@ -804,6 +814,12 @@ App.Pages.Booking = (function () { const appointmentNotes = appointment.notes !== null ? appointment.notes : ''; $notes.val(appointmentNotes); + $customField1.val(customer.custom_field_1); + $customField2.val(customer.custom_field_2); + $customField3.val(customer.custom_field_3); + $customField4.val(customer.custom_field_4); + $customField5.val(customer.custom_field_5); + updateConfirmFrame(); return true;