new: add persistence of default address selection

This commit is contained in:
Valentin Lab
2025-10-04 11:49:26 +02:00
parent ccc477f291
commit f094411f10
3 changed files with 87 additions and 15 deletions

View File

@@ -70,10 +70,18 @@
$formContainer.addClass('d-none');
$formContainer.find('input[type="text"]').val('');
if (response.id) {
$list.find('#address_' + response.id).prop('checked', true);
const $newRadio = $list.find('#address_' + response.id);
$list.find('input[type="radio"]').not($newRadio).prop('checked', false);
$newRadio.prop('checked', true);
}
if (typeof initIcheck === 'function') {
initIcheck('#addresses_list_{{ $prefix }} input[type="radio"]');
if (typeof $.fn.iCheck === 'function') {
$list.find('input[type="radio"]').iCheck('destroy');
if (typeof initIcheck === 'function') {
initIcheck('#addresses_list_{{ $prefix }} input[type="radio"]');
if (response.id) {
$list.find('#address_' + response.id).iCheck('check');
}
}
}
const message = response.message || '{{ __('Adresse enregistrée.') }}';
if (typeof growl === 'function') {