Add customer language and timezone fields to the appointments modal (#1094)
This commit is contained in:
parent
c5ab2849cd
commit
669aa2f6c6
6 changed files with 54 additions and 8 deletions
|
@ -137,6 +137,7 @@ class Calendar extends EA_Controller {
|
||||||
'user_display_name' => $this->accounts->get_user_display_name($user_id),
|
'user_display_name' => $this->accounts->get_user_display_name($user_id),
|
||||||
'timezone' => session('timezone'),
|
'timezone' => session('timezone'),
|
||||||
'timezones' => $this->timezones->to_array(),
|
'timezones' => $this->timezones->to_array(),
|
||||||
|
'grouped_timezones' => $this->timezones->to_grouped_array(),
|
||||||
'privileges' => $privileges,
|
'privileges' => $privileges,
|
||||||
'calendar_view' => $calendar_view,
|
'calendar_view' => $calendar_view,
|
||||||
'available_providers' => $available_providers,
|
'available_providers' => $available_providers,
|
||||||
|
|
|
@ -243,6 +243,20 @@
|
||||||
<input type="text" id="phone-number" maxlength="60"
|
<input type="text" id="phone-number" maxlength="60"
|
||||||
class="<?= $require_phone_number ? 'required' : '' ?> form-control"/>
|
class="<?= $require_phone_number ? 'required' : '' ?> form-control"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="language">
|
||||||
|
<?= lang('language') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<select id="language" class="form-control required">
|
||||||
|
<?php foreach (vars('available_languages') as $available_language): ?>
|
||||||
|
<option value="<?= $available_language ?>">
|
||||||
|
<?= ucfirst($available_language) ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach ?>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-12 col-sm-6">
|
<div class="col-12 col-sm-6">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
@ -281,6 +295,17 @@
|
||||||
maxlength="120"/>
|
maxlength="120"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label" for="timezone">
|
||||||
|
<?= lang('timezone') ?>
|
||||||
|
<span class="text-danger" hidden>*</span>
|
||||||
|
</label>
|
||||||
|
<?php component('timezone_dropdown', [
|
||||||
|
'attributes' => 'id="timezone" class="form-control required"',
|
||||||
|
'grouped_timezones' => vars('grouped_timezones')
|
||||||
|
]) ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="customer-notes" class="form-label">
|
<label for="customer-notes" class="form-label">
|
||||||
<?= lang('notes') ?>
|
<?= lang('notes') ?>
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
* Local variables.
|
* Local variables.
|
||||||
*
|
*
|
||||||
* @var string $attributes
|
* @var string $attributes
|
||||||
* @var array $timezones
|
* @var array $grouped_timezones
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<select <?= $attributes ?>>
|
<select <?= $attributes ?>>
|
||||||
<?php foreach ($timezones as $continent => $entries): ?>
|
<?php foreach ($grouped_timezones as $continent => $entries): ?>
|
||||||
<optgroup label="<?= $continent ?>">
|
<optgroup label="<?= $continent ?>">
|
||||||
<?php foreach ($entries as $value => $name): ?>
|
<?php foreach ($entries as $value => $name): ?>
|
||||||
<option value="<?= $value ?>"><?= $name ?></option>
|
<option value="<?= $value ?>"><?= $name ?></option>
|
||||||
|
|
|
@ -29,6 +29,8 @@ App.Components.AppointmentsModal = (function () {
|
||||||
const $address = $('#address');
|
const $address = $('#address');
|
||||||
const $city = $('#city');
|
const $city = $('#city');
|
||||||
const $zipCode = $('#zip-code');
|
const $zipCode = $('#zip-code');
|
||||||
|
const $language = $('#language');
|
||||||
|
const $timezone = $('#timezone');
|
||||||
const $customerNotes = $('#customer-notes');
|
const $customerNotes = $('#customer-notes');
|
||||||
const $selectCustomer = $('#select-customer');
|
const $selectCustomer = $('#select-customer');
|
||||||
const $saveAppointment = $('#save-appointment');
|
const $saveAppointment = $('#save-appointment');
|
||||||
|
@ -104,6 +106,8 @@ App.Components.AppointmentsModal = (function () {
|
||||||
address: $address.val(),
|
address: $address.val(),
|
||||||
city: $city.val(),
|
city: $city.val(),
|
||||||
zip_code: $zipCode.val(),
|
zip_code: $zipCode.val(),
|
||||||
|
language: $language.val(),
|
||||||
|
timezone: $timezone.val(),
|
||||||
notes: $customerNotes.val()
|
notes: $customerNotes.val()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -248,6 +252,8 @@ App.Components.AppointmentsModal = (function () {
|
||||||
$address.val(customer.address);
|
$address.val(customer.address);
|
||||||
$city.val(customer.city);
|
$city.val(customer.city);
|
||||||
$zipCode.val(customer.zip_code);
|
$zipCode.val(customer.zip_code);
|
||||||
|
$language.val(customer.language);
|
||||||
|
$timezone.val(customer.timezone);
|
||||||
$customerNotes.val(customer.notes);
|
$customerNotes.val(customer.notes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,12 +384,17 @@ App.Components.AppointmentsModal = (function () {
|
||||||
* Event: Enter New Customer Button "Click"
|
* Event: Enter New Customer Button "Click"
|
||||||
*/
|
*/
|
||||||
$newCustomer.on('click', () => {
|
$newCustomer.on('click', () => {
|
||||||
$appointmentsModal
|
$customerId.val('');
|
||||||
.find(
|
$firstName.val('');
|
||||||
'#customer-id, #first-name, #last-name, #email, ' +
|
$lastName.val('');
|
||||||
'#phone-number, #address, #city, #zip-code, #customer-notes'
|
$email.val('');
|
||||||
)
|
$phoneNumber.val('');
|
||||||
.val('');
|
$address.val('');
|
||||||
|
$city.val('');
|
||||||
|
$zipCode.val('');
|
||||||
|
$language.val('english');
|
||||||
|
$timezone.val('UTC');
|
||||||
|
$customerNotes.val('');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,6 +409,9 @@ App.Components.AppointmentsModal = (function () {
|
||||||
$appointmentsModal.find('input, textarea').val('');
|
$appointmentsModal.find('input, textarea').val('');
|
||||||
$appointmentsModal.find('.modal-message').fadeOut();
|
$appointmentsModal.find('.modal-message').fadeOut();
|
||||||
|
|
||||||
|
$language.val('english');
|
||||||
|
$timezone.val('UTC');
|
||||||
|
|
||||||
// Reset color.
|
// Reset color.
|
||||||
$appointmentColor.find('.color-selection-option:first').trigger('click');
|
$appointmentColor.find('.color-selection-option:first').trigger('click');
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,8 @@ App.Utils.CalendarDefaultView = (function () {
|
||||||
$appointmentsModal.find('#address').val(customer.address);
|
$appointmentsModal.find('#address').val(customer.address);
|
||||||
$appointmentsModal.find('#city').val(customer.city);
|
$appointmentsModal.find('#city').val(customer.city);
|
||||||
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
||||||
|
$appointmentsModal.find('#language').val(customer.language);
|
||||||
|
$appointmentsModal.find('#timezone').val(customer.timezone);
|
||||||
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
||||||
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
||||||
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
||||||
|
@ -1666,6 +1668,8 @@ App.Utils.CalendarDefaultView = (function () {
|
||||||
$appointmentsModal.find('#address').val(customer.address);
|
$appointmentsModal.find('#address').val(customer.address);
|
||||||
$appointmentsModal.find('#city').val(customer.city);
|
$appointmentsModal.find('#city').val(customer.city);
|
||||||
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
||||||
|
$appointmentsModal.find('#language').val(customer.language);
|
||||||
|
$appointmentsModal.find('#timezone').val(customer.timezone);
|
||||||
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
||||||
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
||||||
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
||||||
|
|
|
@ -217,6 +217,8 @@ App.Utils.CalendarTableView = (function () {
|
||||||
$appointmentsModal.find('#address').val(customer.address);
|
$appointmentsModal.find('#address').val(customer.address);
|
||||||
$appointmentsModal.find('#city').val(customer.city);
|
$appointmentsModal.find('#city').val(customer.city);
|
||||||
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
$appointmentsModal.find('#zip-code').val(customer.zip_code);
|
||||||
|
$appointmentsModal.find('#language').val(customer.language);
|
||||||
|
$appointmentsModal.find('#timezone').val(customer.timezone);
|
||||||
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
$appointmentsModal.find('#appointment-location').val(appointment.location);
|
||||||
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
$appointmentsModal.find('#appointment-notes').val(appointment.notes);
|
||||||
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
$appointmentsModal.find('#customer-notes').val(customer.notes);
|
||||||
|
|
Loading…
Reference in a new issue