init
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/** @var \Magento\Customer\Block\Address\Book $block */
|
||||
?>
|
||||
<div class="block block-addresses-default">
|
||||
<div class="block-title"><strong><?= $block->escapeHtml(__('Default Addresses')) ?></strong></div>
|
||||
<div class="block-content">
|
||||
<?php if ($_pAddsses = $block->getDefaultBilling()) : ?>
|
||||
<div class="box box-address-billing">
|
||||
<strong class="box-title">
|
||||
<span><?= $block->escapeHtml(__('Default Billing Address')) ?></span>
|
||||
</strong>
|
||||
<div class="box-content">
|
||||
<address>
|
||||
<?= $block->getAddressHtml($block->getAddressById($_pAddsses)) ?>
|
||||
</address>
|
||||
</div>
|
||||
<div class="box-actions">
|
||||
<a class="action edit" href="<?= $block->escapeUrl($block->getAddressEditUrl($_pAddsses)) ?>">
|
||||
<span><?= $block->escapeHtml(__('Change Billing Address')) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="box box-billing-address">
|
||||
<strong class="box-title"><span><?= $block->escapeHtml(__('Default Billing Address')) ?></span></strong>
|
||||
<div class="box-content">
|
||||
<p><?= $block->escapeHtml(__('You have no default billing address in your address book.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($_pAddsses = $block->getDefaultShipping()) : ?>
|
||||
<div class="box box-address-shipping">
|
||||
<strong class="box-title">
|
||||
<span><?= $block->escapeHtml(__('Default Shipping Address')) ?></span>
|
||||
</strong>
|
||||
<div class="box-content">
|
||||
<address>
|
||||
<?= $block->getAddressHtml($block->getAddressById($_pAddsses)) ?>
|
||||
</address>
|
||||
</div>
|
||||
<div class="box-actions">
|
||||
<a class="action edit" href="<?= $block->escapeUrl($block->getAddressEditUrl($_pAddsses)) ?>">
|
||||
<span><?= $block->escapeHtml(__('Change Shipping Address')) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="box box-shipping-address">
|
||||
<strong class="box-title"><span><?= $block->escapeHtml(__('Default Shipping Address')) ?></span></strong>
|
||||
<div class="box-content">
|
||||
<p><?= $block->escapeHtml(__('You have no default shipping address in your address book.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/** @var \Magento\Customer\Block\Address\Edit $block */
|
||||
/** @var \Magento\Customer\ViewModel\Address $viewModel */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
|
||||
/** @var \Magento\Customer\ViewModel\Address\RegionProvider $regionProvider */
|
||||
$viewModel = $block->getViewModel();
|
||||
$regionProvider = $block->getRegionProvider();
|
||||
?>
|
||||
<?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?>
|
||||
<?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?>
|
||||
<?php $_fax = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Fax::class) ?>
|
||||
<?php $_country_id = $block->getAttributeData()->getFrontendLabel('country_id'); ?>
|
||||
<?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?>
|
||||
<?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?>
|
||||
<?php $_region = $block->getAttributeData()->getFrontendLabel('region'); ?>
|
||||
<?php $_selectRegion = 'Please select a region, state or province.'; ?>
|
||||
<?php $_displayAll = $block->getConfig('general/region/display_all'); ?>
|
||||
|
||||
<?php $_vatidValidationClass = $viewModel->addressGetAttributeValidationClass('vat_id'); ?>
|
||||
<?php $_cityValidationClass = $viewModel->addressGetAttributeValidationClass('city'); ?>
|
||||
<?php $_postcodeValidationClass_value = $viewModel->addressGetAttributeValidationClass('postcode'); ?>
|
||||
<?php $_postcodeValidationClass = $_postcodeValidationClass_value; ?>
|
||||
<?php $_streetValidationClass = $viewModel->addressGetAttributeValidationClass('street'); ?>
|
||||
<?php $_streetValidationClassNotRequired = $_streetValidationClass !== null ?
|
||||
trim(str_replace('required-entry', '', $_streetValidationClass)) : ''; ?>
|
||||
<?php $_regionValidationClass = $viewModel->addressGetAttributeValidationClass('region'); ?>
|
||||
<form class="form-address-edit"
|
||||
action="<?= $escaper->escapeUrl($block->getSaveUrl()) ?>"
|
||||
method="post"
|
||||
id="form-validate"
|
||||
enctype="multipart/form-data"
|
||||
data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="legend"><span><?= $escaper->escapeHtml(__('Contact Information')) ?></span></legend><br>
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<input type="hidden" name="success_url" value="<?= $escaper->escapeUrl($block->getSuccessUrl()) ?>">
|
||||
<input type="hidden" name="error_url" value="<?= $escaper->escapeUrl($block->getErrorUrl()) ?>">
|
||||
<?= $block->getNameBlockHtml() ?>
|
||||
|
||||
<?php if ($_company->isEnabled()): ?>
|
||||
<?= $_company->setCompany($block->getAddress()->getCompany())->toHtml() ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($_telephone->isEnabled()): ?>
|
||||
<?= $_telephone->setTelephone($block->getAddress()->getTelephone())->toHtml() ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($_fax->isEnabled()): ?>
|
||||
<?= $_fax->setFax($block->getAddress()->getFax())->toHtml() ?>
|
||||
<?php endif ?>
|
||||
|
||||
</fieldset>
|
||||
<fieldset class="fieldset">
|
||||
<legend class="legend"><span><?= $escaper->escapeHtml(__('Address')) ?></span></legend><br>
|
||||
<div class="field street required">
|
||||
<label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label>
|
||||
<div class="control">
|
||||
<div class="field primary">
|
||||
<label for="street_1" class="label">
|
||||
<span>
|
||||
<?= $escaper->escapeHtml(__('Street Address: Line %1', 1)) ?>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
<input type="text"
|
||||
name="street[0]"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getStreetLine(1)) ?>"
|
||||
title="<?= /* @noEscape */ $_street ?>"
|
||||
id="street_1"
|
||||
class="input-text <?= $escaper->escapeHtmlAttr($_streetValidationClass) ?>"/>
|
||||
<div class="nested">
|
||||
<?php for ($_i = 1, $_n = $viewModel->addressGetStreetLines(); $_i < $_n; $_i++): ?>
|
||||
<div class="field additional">
|
||||
<label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Street Address: Line %1', $_i + 1)) ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="text" name="street[<?= /* @noEscape */ $_i ?>]"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>"
|
||||
title="<?= $escaper->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>"
|
||||
id="street_<?= /* @noEscape */ $_i + 1 ?>"
|
||||
class="input-text
|
||||
<?= $escaper->escapeHtmlAttr($_streetValidationClassNotRequired) ?>">
|
||||
</div>
|
||||
</div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($viewModel->addressIsVatAttributeVisible()): ?>
|
||||
<div class="field taxvat">
|
||||
<label class="label" for="vat_id">
|
||||
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="text"
|
||||
name="vat_id"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getVatId()) ?>"
|
||||
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
|
||||
class="input-text <?= $escaper->escapeHtmlAttr($_vatidValidationClass) ?>"
|
||||
id="vat_id">
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="field country required">
|
||||
<label class="label" for="country">
|
||||
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<?= $block->getCountryHtmlSelect() ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field region required">
|
||||
<label class="label" for="region_id">
|
||||
<span><?= /* @noEscape */ $_region ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<select id="region_id" name="region_id"
|
||||
title="<?= /* @noEscape */ $_region ?>"
|
||||
class="validate-select region_id"
|
||||
<?= /* @noEscape */ !$_displayAll ? ' disabled="disabled"' : '' ?>>
|
||||
<option value=""><?= $escaper->escapeHtml(__($_selectRegion)) ?></option>
|
||||
</select>
|
||||
<input type="text"
|
||||
id="region"
|
||||
name="region"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getRegion()) ?>"
|
||||
title="<?= /* @noEscape */ $_region ?>"
|
||||
class="input-text validate-not-number-first
|
||||
<?= $escaper->escapeHtmlAttr($_regionValidationClass) ?>"
|
||||
<?= !$_displayAll ? ' disabled="disabled"' : '' ?>/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field city required">
|
||||
<label class="label" for="city">
|
||||
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="text"
|
||||
name="city"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getCity()) ?>"
|
||||
title="<?= $escaper->escapeHtmlAttr(__('City')) ?>"
|
||||
class="input-text <?= $escaper->escapeHtmlAttr($_cityValidationClass) ?>"
|
||||
id="city">
|
||||
</div>
|
||||
</div>
|
||||
<div class="field zip required">
|
||||
<label class="label" for="zip">
|
||||
<span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?></span>
|
||||
</label>
|
||||
<div class="control">
|
||||
<input type="text"
|
||||
name="postcode"
|
||||
value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
|
||||
title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
|
||||
id="zip"
|
||||
class="input-text validate-zip-international
|
||||
<?= $escaper->escapeHtmlAttr($_postcodeValidationClass) ?>">
|
||||
<div role="alert" class="message warning">
|
||||
<span></span>
|
||||
</div>
|
||||
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display: none;", 'div.message.warning') ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($block->isDefaultBilling()): ?>
|
||||
<div class="message info">
|
||||
<span><?= $escaper->escapeHtml(__("It's a default billing address.")) ?></span>
|
||||
</div>
|
||||
<?php elseif ($block->canSetAsDefaultBilling()): ?>
|
||||
<div class="field choice set billing">
|
||||
<input type="checkbox" id="primary_billing" name="default_billing" value="1" class="checkbox">
|
||||
<label class="label" for="primary_billing">
|
||||
<span><?= $escaper->escapeHtml(__('Use as my default billing address')) ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="default_billing" value="1" />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($block->isDefaultShipping()): ?>
|
||||
<div class="message info">
|
||||
<span><?= $escaper->escapeHtml(__("It's a default shipping address.")) ?></span>
|
||||
</div>
|
||||
<?php elseif ($block->canSetAsDefaultShipping()): ?>
|
||||
<div class="field choice set shipping">
|
||||
<input type="checkbox" id="primary_shipping" name="default_shipping" value="1" class="checkbox">
|
||||
<label class="label" for="primary_shipping">
|
||||
<span><?= $escaper->escapeHtml(__('Use as my default shipping address')) ?></span>
|
||||
</label>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="default_shipping" value="1">
|
||||
<?php endif; ?>
|
||||
</fieldset>
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button type="submit"
|
||||
class="action save primary"
|
||||
data-action="save-address"
|
||||
disabled="disabled"
|
||||
title="<?= $escaper->escapeHtmlAttr(__('Save Address')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Save Address')) ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="secondary">
|
||||
<a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Go back')) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"#form-validate": {
|
||||
"addressValidation": {
|
||||
"postCodes": <?= /* @noEscape */ $block->getPostCodeConfig()->getSerializedPostCodes() ?>
|
||||
}
|
||||
},
|
||||
"#country": {
|
||||
"directoryRegionUpdater": {
|
||||
"optionalRegionAllowed": <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>,
|
||||
"regionListId": "#region_id",
|
||||
"regionInputId": "#region",
|
||||
"postcodeId": "#zip",
|
||||
"form": "#form-validate",
|
||||
"regionJson": <?= /* @noEscape */ $regionProvider->getRegionJson(); ?>,
|
||||
"defaultRegion": "<?= (int) $block->getRegionId() ?>",
|
||||
"countriesWithOptionalZip": <?= /* @noEscape */ $viewModel->dataGetCountriesWithOptionalZip(true) ?>
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright © Magento, Inc. All rights reserved.
|
||||
* See COPYING.txt for license details.
|
||||
*/
|
||||
|
||||
/** @var \Magento\Customer\Block\Address\Grid $block */
|
||||
$customerAddressView = $block->getData('customer_address');
|
||||
?>
|
||||
|
||||
<div class="block block-addresses-list">
|
||||
<div class="block-title"><strong><?= $block->escapeHtml(__('Additional Address Entries')) ?></strong></div>
|
||||
<div class="block-content">
|
||||
<?php if ($_pAddsses = $block->getAdditionalAddresses()) : ?>
|
||||
|
||||
<div class="table-wrapper additional-addresses">
|
||||
<table class="data table table-additional-addresses-items history" id="additional-addresses-table">
|
||||
<caption class="table-caption"><?= $block->escapeHtml(__('Additional addresses')) ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="col firstname"><?= $block->escapeHtml(__('First Name')) ?></th>
|
||||
<th scope="col" class="col lastname"><?= $block->escapeHtml(__('Last Name')) ?></th>
|
||||
<th scope="col" class="col streetaddress"><?= $block->escapeHtml(__('Street Address')) ?></th>
|
||||
<th scope="col" class="col city"><?= $block->escapeHtml(__('City')) ?></th>
|
||||
<th scope="col" class="col country"><?= $block->escapeHtml(__('Country')) ?></th>
|
||||
<th scope="col" class="col state"><?= $block->escapeHtml(__('State')) ?></th>
|
||||
<th scope="col" class="col zip"><?= $block->escapeHtml(__('Zip/Postal Code')) ?></th>
|
||||
<th scope="col" class="col phone"><?= $block->escapeHtml(__('Phone')) ?></th>
|
||||
<th scope="col" class="col actions"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($_pAddsses as $address) : ?>
|
||||
<tr>
|
||||
<td data-th="<?= $block->escapeHtml(__('First Name')) ?>" class="col firstname"><?= $block->escapeHtml($address->getFirstname()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Last Name')) ?>" class="col lastname"><?= $block->escapeHtml($address->getLastname()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Street Address')) ?>" class="col streetaddress"><?= $block->escapeHtml($block->getStreetAddress($address)) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('City')) ?>" class="col city"><?= $block->escapeHtml($address->getCity()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Country')) ?>" class="col country"><?= $block->escapeHtml($block->getCountryByCode($address->getCountryId())) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('State')) ?>" class="col state"><?= $block->escapeHtml($address->getRegion()->getRegion()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Zip/Postal Code')) ?>" class="col zip"><?= $block->escapeHtml($address->getPostcode()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Phone')) ?>" class="col phone"><?= $block->escapeHtml($address->getTelephone()) ?></td>
|
||||
<td data-th="<?= $block->escapeHtml(__('Actions')) ?>" class="col actions">
|
||||
<a class="action edit" href="<?= $block->escapeUrl($block->getUrl('customer/address/edit', ['id' => $address->getId()])) ?>"><span><?= $block->escapeHtml(__('Edit')) ?></span></a>
|
||||
<a class="action delete" href="#" role="delete-address" data-address="<?= $block->escapeHtmlAttr($address->getId()) ?>"><span><?= $block->escapeHtml(__('Delete')) ?></span></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php if ($block->getChildHtml('pager')) : ?>
|
||||
<div class="customer-addresses-toolbar toolbar bottom"><?= $block->getChildHtml('pager') ?></div>
|
||||
<?php endif ?>
|
||||
<?php else : ?>
|
||||
<p class="empty"><?= $block->escapeHtml(__('You have no other address entries in your address book.')) ?></p>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions-toolbar">
|
||||
<div class="primary">
|
||||
<button type="button" role="add-address" title="<?= $block->escapeHtmlAttr(__('Add New Address')) ?>" class="action primary add"><span><?= $block->escapeHtml(__('Add New Address')) ?></span></button>
|
||||
</div>
|
||||
<div class="secondary">
|
||||
<a class="action back" href="<?= $block->escapeUrl($block->getUrl('customer/account')) ?>"><span><?= $block->escapeHtml(__('Back')) ?></span></a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
".page-main": {
|
||||
"address": {
|
||||
"deleteAddress": "td a[role='delete-address']",
|
||||
"deleteUrlPrefix": "<?= $block->escapeJs($block->escapeUrl($block->getDeleteUrl())) ?>id/",
|
||||
"addAddress": "button[role='add-address']",
|
||||
"addAddressLocation": "<?= $block->escapeJs($block->escapeUrl($block->getAddAddressUrl())) ?>"
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user