Improvements in the user language storage feature.

This commit is contained in:
Alex Tselegidis 2020-09-23 13:48:07 +03:00
parent 5706447ea6
commit a3dfb91550
4 changed files with 7 additions and 16 deletions

View file

@ -1041,7 +1041,7 @@ class Appointments extends CI_Controller {
$appointment['location'] = $service['location']; $appointment['location'] = $service['location'];
} }
// save customer language (the language which is used to render the booking page) // Save customer language (the language which is used to render the booking page).
$customer['language'] = $this->config->item('language'); $customer['language'] = $this->config->item('language');
$customer_id = $this->customers_model->add($customer); $customer_id = $this->customers_model->add($customer);

View file

@ -29,7 +29,7 @@ class Migration_Add_language_to_users extends CI_Migration {
'language' => [ 'language' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => '256', 'constraint' => '256',
'default' => '', 'default' => 'english',
'after' => 'timezone' 'after' => 'timezone'
] ]
]; ];

View file

@ -42,13 +42,11 @@ window.BackendCustomers = window.BackendCustomers || {};
exports.initialize = function (defaultEventHandlers) { exports.initialize = function (defaultEventHandlers) {
defaultEventHandlers = defaultEventHandlers || false; defaultEventHandlers = defaultEventHandlers || false;
// Fill available service categories listbox. // Add the available languages to the language dropdown.
availableLanguages.forEach(function (language) { availableLanguages.forEach(function (language) {
$('#language').append(new Option(language, language)); $('#language').append(new Option(language, language));
}); });
$('#language').append(new Option('- ' + EALang.no_language + ' -', null)).val('null');
helper = new CustomersHelper(); helper = new CustomersHelper();
helper.resetForm(); helper.resetForm();
helper.filter(''); helper.filter('');

View file

@ -125,15 +125,10 @@
city: $('#city').val(), city: $('#city').val(),
zip_code: $('#zip-code').val(), zip_code: $('#zip-code').val(),
notes: $('#notes').val(), notes: $('#notes').val(),
timezone: $('#timezone').val() timezone: $('#timezone').val(),
language: $('#language').val() || 'english'
}; };
if ($('#language').val() !== 'null') {
customer.language = $('#language').val();
} else {
customer.language = '';
}
if ($('#customer-id').val()) { if ($('#customer-id').val()) {
customer.id = $('#customer-id').val(); customer.id = $('#customer-id').val();
} }
@ -265,7 +260,7 @@
.val('') .val('')
.prop('disabled', true); .prop('disabled', true);
$('#language').val('null'); $('#language').val('english');
$('#customer-appointments').empty(); $('#customer-appointments').empty();
$('#edit-customer, #delete-customer').prop('disabled', true); $('#edit-customer, #delete-customer').prop('disabled', true);
@ -296,9 +291,7 @@
$('#zip-code').val(customer.zip_code); $('#zip-code').val(customer.zip_code);
$('#notes').val(customer.notes); $('#notes').val(customer.notes);
$('#timezone').val(customer.timezone); $('#timezone').val(customer.timezone);
$('#language').val(customer.language || 'english');
var language = (customer.language !== '') ? customer.language : 'null';
$('#language').val(language);
$('#customer-appointments').empty(); $('#customer-appointments').empty();