init
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head><css src="Esun_CustomerVat::css/vat-prompt.css"/></head>
|
||||
<body><referenceBlock name="checkout.cart">
|
||||
<block class="Esun\CustomerVat\Block\Cart\VatPrompt" name="esun.cart.vat.prompt" as="vat_prompt"
|
||||
template="Esun_CustomerVat::cart/vat-prompt.phtml" cacheable="false"/>
|
||||
</referenceBlock></body>
|
||||
</page>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceBlock name="customer_account_navigation">
|
||||
<block class="Magento\Customer\Block\Account\SortLinkInterface"
|
||||
name="customer-account-navigation-vat-link">
|
||||
<arguments>
|
||||
<argument name="path" xsi:type="string">esun_customer_vat/vat/index</argument>
|
||||
<argument name="label" xsi:type="string" translate="true">VAT Number Management</argument>
|
||||
<argument name="sortOrder" xsi:type="number">245</argument>
|
||||
</arguments>
|
||||
</block>
|
||||
</referenceBlock>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<head><css src="Esun_CustomerVat::css/vat-prompt.css"/></head>
|
||||
</page>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="esun_customer_vat_vat_new"/>
|
||||
</page>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="customer_account"/>
|
||||
<head><css src="Esun_CustomerVat::css/vat-account.css"/></head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Esun\CustomerVat\Block\Account\Vat" name="esun.customer.vat.list"
|
||||
template="Esun_CustomerVat::account/vat/list.phtml" cacheable="false"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="customer_account"/>
|
||||
<head><css src="Esun_CustomerVat::css/vat-account.css"/></head>
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Esun\CustomerVat\Block\Account\Vat" name="esun.customer.vat.form"
|
||||
template="Esun_CustomerVat::account/vat/form.phtml" cacheable="false"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerVat\Block\Account\Vat $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$application = $block->getCurrentApplication();
|
||||
?>
|
||||
<div class="esun-vat-account esun-vat-form-page">
|
||||
<?php if ($application && $application->getData('status') === 'approved'): ?>
|
||||
<div class="message warning"><span><?= $escaper->escapeHtml(__('Changing an approved VAT number will return it to Pending Review and suspend its tax exemption eligibility.')) ?></span></div>
|
||||
<?php endif; ?>
|
||||
<form class="form vat-number-form" method="post"
|
||||
action="<?= $escaper->escapeUrl($block->getUrl('esun_customer_vat/vat/save')) ?>"
|
||||
data-mage-init='{"validation":{}}'>
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<?php if ($application): ?><input type="hidden" name="id" value="<?= (int)$application->getId() ?>"/><?php endif; ?>
|
||||
<fieldset class="fieldset esun-vat-form__fields">
|
||||
<div class="field company-name required">
|
||||
<label class="label" for="vat-company-name"><span><?= $escaper->escapeHtml(__('Company Name')) ?></span></label>
|
||||
<div class="control"><input class="input-text" id="vat-company-name" name="company_name" required maxlength="255" value="<?= $escaper->escapeHtmlAttr((string)($application?->getData('company_name') ?? '')) ?>"/></div>
|
||||
</div>
|
||||
<div class="field country required">
|
||||
<label class="label" for="vat-country"><span><?= $escaper->escapeHtml(__('Country')) ?></span></label>
|
||||
<div class="control">
|
||||
<select id="vat-country" name="country_id" required>
|
||||
<option value=""><?= $escaper->escapeHtml(__('Please select a country')) ?></option>
|
||||
<?php foreach ($block->getCountryOptions() as $option): ?>
|
||||
<option value="<?= $escaper->escapeHtmlAttr((string)$option['value']) ?>" <?= $application?->getData('country_id') === $option['value'] ? 'selected' : '' ?>><?= $escaper->escapeHtml((string)$option['label']) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field vat-number required">
|
||||
<label class="label" for="vat-number"><span><?= $escaper->escapeHtml(__('VAT Number')) ?></span></label>
|
||||
<div class="control"><input class="input-text" id="vat-number" name="vat_number" required maxlength="64" value="<?= $escaper->escapeHtmlAttr((string)($application?->getData('vat_number') ?? '')) ?>"/></div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div class="actions-toolbar esun-vat-form__actions">
|
||||
<div class="primary"><button type="submit" class="action primary"><span><?= $escaper->escapeHtml(__('Submit for Review')) ?></span></button></div>
|
||||
<div class="secondary"><a class="action back" href="<?= $escaper->escapeUrl($block->getUrl('esun_customer_vat/vat/index')) ?>"><span><?= $escaper->escapeHtml(__('Back')) ?></span></a></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerVat\Block\Account\Vat $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
?>
|
||||
<div class="esun-vat-account">
|
||||
<div class="esun-vat-account__heading">
|
||||
<p><?= $escaper->escapeHtml(__('Submit VAT numbers for review. You can register a different VAT number for each EU country.')) ?></p>
|
||||
<a class="action primary" href="<?= $escaper->escapeUrl($block->getUrl('esun_customer_vat/vat/new')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Add VAT Number')) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if ($block->getApplications()->getSize()): ?>
|
||||
<div class="table-wrapper vat-applications">
|
||||
<table class="data table table-vat-applications">
|
||||
<caption class="table-caption"><?= $escaper->escapeHtml(__('VAT Number Applications')) ?></caption>
|
||||
<thead><tr>
|
||||
<th scope="col"><?= $escaper->escapeHtml(__('Company Name')) ?></th>
|
||||
<th scope="col"><?= $escaper->escapeHtml(__('VAT Number')) ?></th>
|
||||
<th scope="col"><?= $escaper->escapeHtml(__('Country')) ?></th>
|
||||
<th scope="col"><?= $escaper->escapeHtml(__('Status')) ?></th>
|
||||
<th scope="col"><?= $escaper->escapeHtml(__('Actions')) ?></th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<?php foreach ($block->getApplications() as $application): ?>
|
||||
<tr>
|
||||
<td data-th="<?= $escaper->escapeHtmlAttr(__('Company Name')) ?>"><?= $escaper->escapeHtml((string)$application->getData('company_name')) ?></td>
|
||||
<td data-th="<?= $escaper->escapeHtmlAttr(__('VAT Number')) ?>"><?= $escaper->escapeHtml((string)$application->getData('vat_number')) ?></td>
|
||||
<td data-th="<?= $escaper->escapeHtmlAttr(__('Country')) ?>"><?= $escaper->escapeHtml($block->getCountryName((string)$application->getData('country_id'))) ?></td>
|
||||
<td data-th="<?= $escaper->escapeHtmlAttr(__('Status')) ?>">
|
||||
<span class="vat-status vat-status--<?= $escaper->escapeHtmlAttr((string)$application->getData('status')) ?>">
|
||||
<?= $escaper->escapeHtml($block->getStatusLabel((string)$application->getData('status'))) ?>
|
||||
</span>
|
||||
<?php if ($application->getData('review_note')): ?>
|
||||
<small><?= $escaper->escapeHtml((string)$application->getData('review_note')) ?></small>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td data-th="<?= $escaper->escapeHtmlAttr(__('Actions')) ?>" class="actions">
|
||||
<a href="<?= $escaper->escapeUrl($block->getUrl('esun_customer_vat/vat/edit', ['id' => $application->getId()])) ?>"><?= $escaper->escapeHtml(__('Edit')) ?></a>
|
||||
<form method="post" action="<?= $escaper->escapeUrl($block->getUrl('esun_customer_vat/vat/delete')) ?>" data-mage-init='{"validation":{}}'>
|
||||
<?= $block->getBlockHtml('formkey') ?>
|
||||
<input type="hidden" name="id" value="<?= (int)$application->getId() ?>"/>
|
||||
<button type="submit" class="action delete" data-confirm="<?= $escaper->escapeHtmlAttr(__('Deleting an approved VAT number immediately removes its exemption eligibility. Continue?')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Delete')) ?></span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="message info empty"><span><?= $escaper->escapeHtml(__('You have not submitted any VAT numbers.')) ?></span></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/** @var \Esun\CustomerVat\Block\Cart\VatPrompt $block */
|
||||
/** @var \Magento\Framework\Escaper $escaper */
|
||||
$prompt = $block->getPromptData();
|
||||
?>
|
||||
<?php if (!empty($prompt['show'])): ?>
|
||||
<div class="cart_list_tips">
|
||||
<?= $escaper->escapeHtml(__('If you are an EU VAT registered business, please contact Customer Service to')) ?>
|
||||
<a href="<?= $escaper->escapeUrl((string)$prompt['apply_url']) ?>"><?= $escaper->escapeHtml(__('Apply for Tax Exemption')) ?></a>
|
||||
<?= $escaper->escapeHtml(__('and make your purchases through the B2B account to apply the appropriate tax exemption provisions.')) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,232 @@
|
||||
.esun-vat-account {
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.esun-vat-account__heading {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.esun-vat-account__heading p {
|
||||
color: #666;
|
||||
line-height: 1.7;
|
||||
margin: 0;
|
||||
max-width: 720px;
|
||||
}
|
||||
|
||||
.esun-vat-account__heading .action.primary,
|
||||
.esun-vat-form__actions .action.primary {
|
||||
border-radius: 24px;
|
||||
box-sizing: border-box;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 22px;
|
||||
min-height: 46px;
|
||||
padding: 11px 28px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.vat-number-form {
|
||||
max-width: 860px;
|
||||
}
|
||||
|
||||
.esun-vat-form-page > .message {
|
||||
margin-bottom: 26px;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields {
|
||||
border: 0;
|
||||
display: grid;
|
||||
gap: 24px 28px;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields .field {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields .company-name {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields .field > .label {
|
||||
box-sizing: border-box;
|
||||
color: #555;
|
||||
display: block !important;
|
||||
float: none !important;
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
margin: 0 0 9px;
|
||||
padding: 0 !important;
|
||||
text-align: left !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields .field > .control {
|
||||
float: none !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields input.input-text,
|
||||
.esun-vat-form__fields select {
|
||||
background-color: #fff;
|
||||
border: 1px solid #d7d7d7;
|
||||
border-radius: 4px;
|
||||
box-shadow: none;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
height: 48px;
|
||||
padding: 0 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields input.input-text:focus,
|
||||
.esun-vat-form__fields select:focus {
|
||||
border-color: #18aa59;
|
||||
box-shadow: 0 0 0 1px #18aa59;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
gap: 22px;
|
||||
margin-left: 0 !important;
|
||||
margin-top: 34px !important;
|
||||
text-align: left;
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions::before,
|
||||
.esun-vat-form__actions::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions .primary,
|
||||
.esun-vat-form__actions .secondary {
|
||||
float: none !important;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions .action.back {
|
||||
color: #666;
|
||||
font-size: 15px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions .action.back:hover,
|
||||
.esun-vat-form__actions .action.back:focus {
|
||||
color: #18aa59;
|
||||
}
|
||||
|
||||
.table-vat-applications td,
|
||||
.table-vat-applications th {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions a {
|
||||
color: #555;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions a:hover,
|
||||
.table-vat-applications .actions a:focus {
|
||||
color: #18aa59;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions form {
|
||||
display: inline;
|
||||
margin-left: 14px;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions button {
|
||||
background: none;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
color: #d32f2f;
|
||||
font: inherit;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.vat-status {
|
||||
display: inline-block;
|
||||
border-radius: 14px;
|
||||
padding: 3px 10px;
|
||||
font-size: 12px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.vat-status--pending {
|
||||
background: #fff4d6;
|
||||
color: #8a6200;
|
||||
}
|
||||
|
||||
.vat-status--approved {
|
||||
background: #dff5e8;
|
||||
color: #14713c;
|
||||
}
|
||||
|
||||
.vat-status--rejected {
|
||||
background: #fde5e5;
|
||||
color: #a12828;
|
||||
}
|
||||
|
||||
.table-vat-applications small {
|
||||
color: #777;
|
||||
display: block;
|
||||
margin-top: 5px;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.esun-vat-account > .message.empty {
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
margin: 0;
|
||||
padding: 28px 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.esun-vat-account__heading {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.esun-vat-form__fields .company-name {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions .primary,
|
||||
.esun-vat-form__actions .action.primary {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.esun-vat-form__actions .secondary {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.table-vat-applications .actions form {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.cart_list_tips{font-size:14px;line-height:25px;color:#555;opacity:.7}.cart_list_tips a{color:inherit;text-decoration:underline}.cart_list_tips a:hover{color:inherit;opacity:.8}.esun-cart-page>.cart_list_tips{margin:-10px 0 20px}.esun-cart-drawer__contents>.cart_list_tips{padding:8px 20px 10px}
|
||||
Reference in New Issue
Block a user