chg: use rich address partial in checkout with add/delete support
Replaces the simple address radio list in the checkout page with the richer ``Shop.Customers.partials.addresses`` partial already used on the profile edit page. Customers can now choose among existing addresses, add a new one on-the-fly, or delete an address directly from the checkout flow.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
@include('Shop.Customers.partials.address_item', [
|
||||
'address' => $address,
|
||||
'prefix' => $prefix ?? null,
|
||||
'inputName' => $inputName ?? null,
|
||||
'with_name' => $with_name ?? false,
|
||||
'selected' => $selected ?? null,
|
||||
])
|
||||
@@ -44,6 +45,7 @@
|
||||
<script>
|
||||
(function() {
|
||||
var prefix = '{{ $prefix }}';
|
||||
var inputName = '{{ $inputName ?? '' }}';
|
||||
var $formContainer = $('#add_address_container_{{ $prefix }}');
|
||||
var $list = $('#addresses_list_{{ $prefix }}');
|
||||
var storeUrl = '{{ route('Shop.Customers.address.store') }}';
|
||||
@@ -69,7 +71,7 @@
|
||||
$.ajax({
|
||||
url: storeUrl,
|
||||
method: 'POST',
|
||||
data: data + '&prefix=' + prefix,
|
||||
data: data + '&prefix=' + prefix + (inputName ? '&input_name=' + inputName : ''),
|
||||
success: function(response) {
|
||||
if (response.html) {
|
||||
$list.append(response.html);
|
||||
|
||||
Reference in New Issue
Block a user