{% do view.registerAssetBundle('craft\\web\\assets\\admintable\\AdminTableAsset') -%}
{% do view.registerTranslations('commerce', [
'Are you sure you want to delete this address?',
'No Addresses available.',
'Set as Primary Billing',
'Set as Primary Shipping',
'Cancellation date',
'Cart',
'Expiration date',
'Is subscription active?',
'No active carts exist for this customer.',
'No inactive carts exist for this customer.',
'No subscriptions exist for this user yet.',
'No',
'Status',
'Subscription date',
'Subscription',
'Subscription',
'Yes',
'View address',
]) %}
{% 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()|join('
') }
}]) %}
{% endfor %}
{% if currentUser.can('commerce-manageOrders') %}