{% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%}
{% do view.registerTranslations('commerce', [
'Address 1',
'Are you sure you want to delete this address?',
'Cancellation date',
'Cart',
'Date Updated',
'Expiration date',
'Is subscription active?',
'No Addresses available.',
'No active carts exist for this customer.',
'No inactive carts exist for this customer.',
'No subscriptions exist for this user yet.',
'No',
'Primary Billing Address',
'Primary Shipping Address',
'Set as Primary Billing',
'Set as Primary Shipping',
'Status',
'Subscription date',
'Subscription',
'Subscription',
'Total',
'View address',
'Yes',
]) %}
{% set addresses = customer.getAddresses() ?? null %}
{% set tableData = [] %}
{% for address in addresses %}
{% set tableData = tableData|merge([{
id: address.id,
title: address.address1 != '' ? address.address1|e : 'View address'|t('commerce'),
url: address.cpEditUrl ~ (addressRedirect is defined and addressRedirect ? '?redirect=' ~ addressRedirect : ''),
zipCode: address.zipCode|e,
billing: (customer.primaryBillingAddressId == address.id),
shipping: (customer.primaryShippingAddressId == address.id),
detail: { handle: tag('span', { 'data-icon': 'info', title: 'Show full address'|t('commerce')|e }) , content: address.getAddressLines(true)|join('
') }
}]) %}
{% endfor %}
{% if currentUser.can('commerce-manageOrders') %}