Store and process the custom field value in the booking page

This commit is contained in:
Alex Tselegidis 2024-02-07 10:45:04 +01:00
parent d680d9cde6
commit 4f2927fb67
2 changed files with 21 additions and 0 deletions

View file

@ -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);

View file

@ -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;