fix: make the button to add an address unusable when the address form is open
This commit is contained in:
@@ -48,13 +48,20 @@
|
||||
var $list = $('#addresses_list_{{ $prefix }}');
|
||||
var storeUrl = '{{ route('Shop.Customers.address.store') }}';
|
||||
|
||||
$('#add_address_{{ $prefix }}').on('click', function() {
|
||||
$formContainer.toggleClass('d-none');
|
||||
var $toggleBtn = $('#add_address_{{ $prefix }}');
|
||||
|
||||
$toggleBtn.on('click', function() {
|
||||
var isHidden = $formContainer.hasClass('d-none');
|
||||
if (isHidden) {
|
||||
$formContainer.removeClass('d-none');
|
||||
$toggleBtn.prop('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
$('#cancel_address_{{ $prefix }}').on('click', function() {
|
||||
$formContainer.addClass('d-none');
|
||||
$formContainer.find('input[type="text"]').val('');
|
||||
$toggleBtn.prop('disabled', false);
|
||||
});
|
||||
|
||||
$('#save_address_{{ $prefix }}').on('click', function() {
|
||||
@@ -69,6 +76,7 @@
|
||||
}
|
||||
$formContainer.addClass('d-none');
|
||||
$formContainer.find('input[type="text"]').val('');
|
||||
$toggleBtn.prop('disabled', false);
|
||||
if (response.id) {
|
||||
const $newRadio = $list.find('#address_' + response.id);
|
||||
$list.find('input[type="radio"]').not($newRadio).prop('checked', false);
|
||||
|
||||
Reference in New Issue
Block a user