Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

241 wiersze
12 KiB

  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /** @var \Magento\Customer\Block\Address\Edit $block */
  7. /** @var \Magento\Customer\ViewModel\Address $viewModel */
  8. /** @var \Magento\Framework\Escaper $escaper */
  9. /** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
  10. /** @var \Magento\Customer\ViewModel\Address\RegionProvider $regionProvider */
  11. $viewModel = $block->getViewModel();
  12. $regionProvider = $block->getRegionProvider();
  13. ?>
  14. <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?>
  15. <?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?>
  16. <?php $_fax = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Fax::class) ?>
  17. <?php $_country_id = $block->getAttributeData()->getFrontendLabel('country_id'); ?>
  18. <?php $_street = $block->getAttributeData()->getFrontendLabel('street'); ?>
  19. <?php $_city = $block->getAttributeData()->getFrontendLabel('city'); ?>
  20. <?php $_region = $block->getAttributeData()->getFrontendLabel('region'); ?>
  21. <?php $_selectRegion = 'Please select a region, state or province.'; ?>
  22. <?php $_displayAll = $block->getConfig('general/region/display_all'); ?>
  23. <?php $_vatidValidationClass = $viewModel->addressGetAttributeValidationClass('vat_id'); ?>
  24. <?php $_cityValidationClass = $viewModel->addressGetAttributeValidationClass('city'); ?>
  25. <?php $_postcodeValidationClass_value = $viewModel->addressGetAttributeValidationClass('postcode'); ?>
  26. <?php $_postcodeValidationClass = $_postcodeValidationClass_value; ?>
  27. <?php $_streetValidationClass = $viewModel->addressGetAttributeValidationClass('street'); ?>
  28. <?php $_streetValidationClassNotRequired = $_streetValidationClass !== null ?
  29. trim(str_replace('required-entry', '', $_streetValidationClass)) : ''; ?>
  30. <?php $_regionValidationClass = $viewModel->addressGetAttributeValidationClass('region'); ?>
  31. <form class="form-address-edit"
  32. action="<?= $escaper->escapeUrl($block->getSaveUrl()) ?>"
  33. method="post"
  34. id="form-validate"
  35. enctype="multipart/form-data"
  36. data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>">
  37. <fieldset class="fieldset">
  38. <legend class="legend"><span><?= $escaper->escapeHtml(__('Contact Information')) ?></span></legend><br>
  39. <?= $block->getBlockHtml('formkey') ?>
  40. <input type="hidden" name="success_url" value="<?= $escaper->escapeUrl($block->getSuccessUrl()) ?>">
  41. <input type="hidden" name="error_url" value="<?= $escaper->escapeUrl($block->getErrorUrl()) ?>">
  42. <?= $block->getNameBlockHtml() ?>
  43. <?php if ($_company->isEnabled()): ?>
  44. <?= $_company->setCompany($block->getAddress()->getCompany())->toHtml() ?>
  45. <?php endif ?>
  46. <?php if ($_telephone->isEnabled()): ?>
  47. <?= $_telephone->setTelephone($block->getAddress()->getTelephone())->toHtml() ?>
  48. <?php endif ?>
  49. <?php if ($_fax->isEnabled()): ?>
  50. <?= $_fax->setFax($block->getAddress()->getFax())->toHtml() ?>
  51. <?php endif ?>
  52. </fieldset>
  53. <fieldset class="fieldset">
  54. <legend class="legend"><span><?= $escaper->escapeHtml(__('Address')) ?></span></legend><br>
  55. <div class="field street required">
  56. <label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label>
  57. <div class="control">
  58. <div class="field primary">
  59. <label for="street_1" class="label">
  60. <span>
  61. <?= $escaper->escapeHtml(__('Street Address: Line %1', 1)) ?>
  62. </span>
  63. </label>
  64. </div>
  65. <input type="text"
  66. name="street[0]"
  67. value="<?= $escaper->escapeHtmlAttr($block->getStreetLine(1)) ?>"
  68. title="<?= /* @noEscape */ $_street ?>"
  69. id="street_1"
  70. class="input-text <?= $escaper->escapeHtmlAttr($_streetValidationClass) ?>"/>
  71. <div class="nested">
  72. <?php for ($_i = 1, $_n = $viewModel->addressGetStreetLines(); $_i < $_n; $_i++): ?>
  73. <div class="field additional">
  74. <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>">
  75. <span><?= $escaper->escapeHtml(__('Street Address: Line %1', $_i + 1)) ?></span>
  76. </label>
  77. <div class="control">
  78. <input type="text" name="street[<?= /* @noEscape */ $_i ?>]"
  79. value="<?= $escaper->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>"
  80. title="<?= $escaper->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>"
  81. id="street_<?= /* @noEscape */ $_i + 1 ?>"
  82. class="input-text
  83. <?= $escaper->escapeHtmlAttr($_streetValidationClassNotRequired) ?>">
  84. </div>
  85. </div>
  86. <?php endfor; ?>
  87. </div>
  88. </div>
  89. </div>
  90. <?php if ($viewModel->addressIsVatAttributeVisible()): ?>
  91. <div class="field taxvat">
  92. <label class="label" for="vat_id">
  93. <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?></span>
  94. </label>
  95. <div class="control">
  96. <input type="text"
  97. name="vat_id"
  98. value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getVatId()) ?>"
  99. title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>"
  100. class="input-text <?= $escaper->escapeHtmlAttr($_vatidValidationClass) ?>"
  101. id="vat_id">
  102. </div>
  103. </div>
  104. <?php endif; ?>
  105. <div class="field country required">
  106. <label class="label" for="country">
  107. <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span>
  108. </label>
  109. <div class="control">
  110. <?= $block->getCountryHtmlSelect() ?>
  111. </div>
  112. </div>
  113. <div class="field region required">
  114. <label class="label" for="region_id">
  115. <span><?= /* @noEscape */ $_region ?></span>
  116. </label>
  117. <div class="control">
  118. <select id="region_id" name="region_id"
  119. title="<?= /* @noEscape */ $_region ?>"
  120. class="validate-select region_id"
  121. <?= /* @noEscape */ !$_displayAll ? ' disabled="disabled"' : '' ?>>
  122. <option value=""><?= $escaper->escapeHtml(__($_selectRegion)) ?></option>
  123. </select>
  124. <input type="text"
  125. id="region"
  126. name="region"
  127. value="<?= $escaper->escapeHtmlAttr($block->getRegion()) ?>"
  128. title="<?= /* @noEscape */ $_region ?>"
  129. class="input-text validate-not-number-first
  130. <?= $escaper->escapeHtmlAttr($_regionValidationClass) ?>"
  131. <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/>
  132. </div>
  133. </div>
  134. <div class="field city required">
  135. <label class="label" for="city">
  136. <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span>
  137. </label>
  138. <div class="control">
  139. <input type="text"
  140. name="city"
  141. value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getCity()) ?>"
  142. title="<?= $escaper->escapeHtmlAttr(__('City')) ?>"
  143. class="input-text <?= $escaper->escapeHtmlAttr($_cityValidationClass) ?>"
  144. id="city">
  145. </div>
  146. </div>
  147. <div class="field zip required">
  148. <label class="label" for="zip">
  149. <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?></span>
  150. </label>
  151. <div class="control">
  152. <input type="text"
  153. name="postcode"
  154. value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>"
  155. title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>"
  156. id="zip"
  157. class="input-text validate-zip-international
  158. <?= $escaper->escapeHtmlAttr($_postcodeValidationClass) ?>">
  159. <div role="alert" class="message warning">
  160. <span></span>
  161. </div>
  162. <?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display: none;", 'div.message.warning') ?>
  163. </div>
  164. </div>
  165. <?php if ($block->isDefaultBilling()): ?>
  166. <div class="message info">
  167. <span><?= $escaper->escapeHtml(__("It's a default billing address.")) ?></span>
  168. </div>
  169. <?php elseif ($block->canSetAsDefaultBilling()): ?>
  170. <div class="field choice set billing">
  171. <input type="checkbox" id="primary_billing" name="default_billing" value="1" class="checkbox">
  172. <label class="label" for="primary_billing">
  173. <span><?= $escaper->escapeHtml(__('Use as my default billing address')) ?></span>
  174. </label>
  175. </div>
  176. <?php else: ?>
  177. <input type="hidden" name="default_billing" value="1" />
  178. <?php endif; ?>
  179. <?php if ($block->isDefaultShipping()): ?>
  180. <div class="message info">
  181. <span><?= $escaper->escapeHtml(__("It's a default shipping address.")) ?></span>
  182. </div>
  183. <?php elseif ($block->canSetAsDefaultShipping()): ?>
  184. <div class="field choice set shipping">
  185. <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" class="checkbox">
  186. <label class="label" for="primary_shipping">
  187. <span><?= $escaper->escapeHtml(__('Use as my default shipping address')) ?></span>
  188. </label>
  189. </div>
  190. <?php else: ?>
  191. <input type="hidden" name="default_shipping" value="1">
  192. <?php endif; ?>
  193. </fieldset>
  194. <div class="actions-toolbar">
  195. <div class="primary">
  196. <button type="submit"
  197. class="action save primary"
  198. data-action="save-address"
  199. disabled="disabled"
  200. title="<?= $escaper->escapeHtmlAttr(__('Save Address')) ?>">
  201. <span><?= $escaper->escapeHtml(__('Save Address')) ?></span>
  202. </button>
  203. </div>
  204. <div class="secondary">
  205. <a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>">
  206. <span><?= $escaper->escapeHtml(__('Go back')) ?></span>
  207. </a>
  208. </div>
  209. </div>
  210. </form>
  211. <script type="text/x-magento-init">
  212. {
  213. "#form-validate": {
  214. "addressValidation": {
  215. "postCodes": <?= /* @noEscape */ $block->getPostCodeConfig()->getSerializedPostCodes() ?>
  216. }
  217. },
  218. "#country": {
  219. "directoryRegionUpdater": {
  220. "optionalRegionAllowed": <?= /* @noEscape */ $_displayAll ? 'true' : 'false' ?>,
  221. "regionListId": "#region_id",
  222. "regionInputId": "#region",
  223. "postcodeId": "#zip",
  224. "form": "#form-validate",
  225. "regionJson": <?= /* @noEscape */ $regionProvider->getRegionJson(); ?>,
  226. "defaultRegion": "<?= (int) $block->getRegionId() ?>",
  227. "countriesWithOptionalZip": <?= /* @noEscape */ $viewModel->dataGetCountriesWithOptionalZip(true) ?>
  228. }
  229. }
  230. }
  231. </script>