This commit is contained in:
2026-09-15 10:35:56 +08:00
commit 782f8ea7aa
4086 changed files with 631288 additions and 0 deletions
@@ -0,0 +1,11 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-login"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="logo">
<arguments>
<argument name="logo_image_src" xsi:type="string">Esun_Customer::images/logo.png</argument>
</arguments>
</referenceBlock>
</body>
</page>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="header">
<block class="Magento\Backend\Block\Page\Header" name="logo" before="-">
<arguments>
<argument name="show_part" xsi:type="string">logo</argument>
<argument name="edition" translate="true" xsi:type="string">Esun</argument>
<argument name="logo_image_src" xsi:type="string">Esun_Customer::images/esun.png</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

@@ -0,0 +1,65 @@
<?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_Customer::css/iconfont.css"/>
<css src="Esun_Customer::css/account-dashboard.css"/>
</head>
<body>
<referenceBlock name="customer-account-navigation-downloadable-products-link" remove="true"/>
<referenceBlock name="customer-account-navigation-my-credit-cards-link" remove="true"/>
<referenceBlock name="customer-account-navigation-newsletter-subscriptions-link" remove="true"/>
<referenceBlock name="customer-account-navigation-delimiter-2" remove="true"/>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="wishlist_sidebar" remove="true"/>
<referenceBlock name="customer-account-navigation-account-link">
<arguments><argument name="sortOrder" xsi:type="number">300</argument></arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-orders-link">
<arguments><argument name="sortOrder" xsi:type="number">290</argument></arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-product-reviews-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">My Reviews</argument>
<argument name="sortOrder" xsi:type="number">280</argument>
</arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-wish-list-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">My Favorite</argument>
<argument name="sortOrder" xsi:type="number">275</argument>
</arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-coupons-link">
<arguments><argument name="sortOrder" xsi:type="number">270</argument></arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-delimiter-1">
<arguments><argument name="sortOrder" xsi:type="number">260</argument></arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-address-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">Manage Address Book</argument>
<argument name="sortOrder" xsi:type="number">250</argument>
</arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-account-edit-link">
<arguments>
<argument name="label" xsi:type="string" translate="true">Account Settings</argument>
<argument name="sortOrder" xsi:type="number">240</argument>
</arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-messages">
<arguments>
<argument name="label" xsi:type="string" translate="true">Message</argument>
<argument name="sortOrder" xsi:type="number">230</argument>
</arguments>
</referenceBlock>
<referenceBlock name="customer-account-navigation-reward">
<arguments>
<argument name="label" xsi:type="string" translate="true">Points Redemption</argument>
<argument name="sortOrder" xsi:type="number">220</argument>
</arguments>
</referenceBlock>
</body>
</page>
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="customer_account"/>
<head>
<css src="Esun_Customer::css/account-dashboard.css"/>
</head>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="customer_account_dashboard_info" remove="true"/>
<referenceBlock name="customer_account_dashboard_address" remove="true"/>
<referenceBlock name="customer_account_dashboard_top" remove="true"/>
<referenceBlock name="catalog.compare.sidebar" remove="true"/>
<referenceBlock name="wishlist_sidebar" remove="true"/>
<referenceContainer name="content">
<block class="Esun\Customer\Block\Account\Dashboard" name="esun.customer.dashboard"
template="Esun_Customer::account/dashboard.phtml" cacheable="false"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,13 @@
<?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_Customer::css/account-dashboard.css"/></head>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="sales.order.history" remove="true"/>
<referenceContainer name="content">
<block class="Esun\Customer\Block\Order\History" name="esun.sales.order.history"
template="Esun_Customer::order/history.phtml" cacheable="false" before="customer.account.link.back"/>
</referenceContainer>
</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">
<head><css src="Esun_Customer::css/account-dashboard.css"/></head>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="order.comments" remove="true"/>
<referenceBlock name="sales.order.info.links" remove="true"/>
<referenceBlock name="sales.order.view" remove="true"/>
<referenceBlock name="sales.order.info" remove="true"/>
<referenceContainer name="content">
<block class="Esun\Customer\Block\Order\Detail" name="esun.sales.order.detail"
template="Esun_Customer::order/detail.phtml" cacheable="false" before="-"/>
</referenceContainer>
</body>
</page>
@@ -0,0 +1,18 @@
var config = {
config: {
mixins: {
'Magento_Customer/js/customer-data': {
'Esun_Customer/js/customer-data-init-mixin': true
},
'Magento_Ui/js/form/element/region': {
'Esun_Customer/js/checkout/region-mixin': true
},
'Amasty_CheckoutCore/js/form/element/region': {
'Esun_Customer/js/checkout/region-mixin': true
},
'Magento_Checkout/js/model/address-converter': {
'Esun_Customer/js/checkout/address-converter-mixin': true
}
}
}
};
@@ -0,0 +1,55 @@
<?php
/** @var \Esun\Customer\Block\Account\Dashboard $block */
/** @var \Magento\Framework\Escaper $escaper */
$counts = $block->getCounts();
$order = $block->getLatestPending();
?>
<div class="esun-account-dashboard">
<section class="esun-account-welcome">
<i class="esun-account-avatar iconfont icon-member6" aria-hidden="true"></i>
<div><h1><?= $escaper->escapeHtml(__('Welcome, %1', $block->getCustomerName())) ?></h1>
<strong><?= $escaper->escapeHtml(__('Points: %1', $block->getPoints())) ?></strong></div>
<a class="action primary" href="<?= $escaper->escapeUrl($block->getUrl('reward/account')) ?>"><?= $escaper->escapeHtml(__('Points Center')) ?></a>
</section>
<section class="esun-account-panel esun-account-orders">
<header><h2><?= $escaper->escapeHtml(__('My Orders')) ?></h2>
<a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history')) ?>"><?= $escaper->escapeHtml(__('View All')) ?></a></header>
<nav class="esun-order-statuses" aria-label="<?= $escaper->escapeHtmlAttr(__('Order status')) ?>">
<a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status' => 'pending'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_payment1" aria-hidden="true"></i><?php if ($counts['pending']): ?><b><?= (int)$counts['pending'] ?></b><?php endif; ?></span><span><?= $escaper->escapeHtml(__('Awaiting Payment')) ?></span></a>
<a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status' => 'processing'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_shipped1" aria-hidden="true"></i><?php if ($counts['processing']): ?><b><?= (int)$counts['processing'] ?></b><?php endif; ?></span><span><?= $escaper->escapeHtml(__('Awaiting Shipping')) ?></span></a>
<a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status' => 'shipped'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_shipped3" aria-hidden="true"></i><?php if ($counts['shipped']): ?><b><?= (int)$counts['shipped'] ?></b><?php endif; ?></span><span><?= $escaper->escapeHtml(__('Shipped')) ?></span></a>
<a href="<?= $escaper->escapeUrl($block->getUrl('esun_review/customer/awaiting')) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_review1" aria-hidden="true"></i><?php if ($counts['awaiting_review']): ?><b><?= (int)$counts['awaiting_review'] ?></b><?php endif; ?></span><span><?= $escaper->escapeHtml(__('Awaiting Review')) ?></span></a>
</nav>
<?php if ($order): ?>
<article class="esun-recent-order">
<header><span><?= $escaper->escapeHtml(__('Date: %1', $block->formatDate($order->getCreatedAt(), \IntlDateFormatter::MEDIUM, true))) ?></span>
<span><?= $escaper->escapeHtml(__('Order Number: %1', $order->getIncrementId())) ?></span></header>
<div class="esun-recent-order__body"><div class="esun-order-thumbnails">
<?php foreach ($order->getAllVisibleItems() as $item): ?>
<img src="<?= $escaper->escapeUrl($block->getOrderItemImageUrl($item)) ?>" alt="<?= $escaper->escapeHtmlAttr($item->getName()) ?>" loading="lazy">
<?php endforeach; ?>
</div><strong><?= /* @noEscape */ $order->formatPrice($order->getGrandTotal()) ?></strong>
<span><?= $escaper->escapeHtml($order->getStatusLabel()) ?></span>
<a href="<?= $escaper->escapeUrl($block->getUrl('sales/order/view', ['order_id' => $order->getId()])) ?>"><?= $escaper->escapeHtml(__('Order Details')) ?></a></div>
</article>
<?php else: ?><p class="esun-empty-note"><?= $escaper->escapeHtml(__('There are no orders awaiting payment.')) ?></p><?php endif; ?>
</section>
<div class="esun-account-card-grid">
<section class="esun-account-panel esun-account-services">
<article class="esun-service-card">
<a class="esun-service-card__link" href="<?= $escaper->escapeUrl($block->getUrl('customer-coupon/account/index')) ?>"><i class="iconfont icon-coupon1" aria-hidden="true"></i><span><?= $escaper->escapeHtml(__('My Coupons')) ?></span></a>
<?php $coupons = $block->getAvailableCoupons(); if ($coupons): foreach ($coupons as $coupon): ?>
<div class="esun-dashboard-row"><strong><?= $escaper->escapeHtml($coupon['discount_label']) ?></strong><span><?= $escaper->escapeHtml($coupon['code']) ?></span></div>
<?php endforeach; else: ?><p class="esun-empty-note"><?= $escaper->escapeHtml(__('You have no available coupons.')) ?></p><?php endif; ?>
</article>
<?= $block->getChildHtml('messages') ?>
</section>
<section class="esun-account-panel esun-wishlist-card"><header><h2><?= $escaper->escapeHtml(__('Wish List')) ?></h2><a href="<?= $escaper->escapeUrl($block->getUrl('wishlist')) ?>"><?= $escaper->escapeHtml(__('View All')) ?></a></header>
<div class="esun-dashboard-products"><?php $wishlist = $block->getWishlistItems(); if ($wishlist): foreach ($wishlist as $item): $product = $item->getProduct(); ?>
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"><img src="<?= $escaper->escapeUrl($block->getProductImageUrl($product)) ?>" alt="<?= $escaper->escapeHtmlAttr($product->getName()) ?>"><span><?= $escaper->escapeHtml($product->getName()) ?></span></a>
<?php endforeach; else: ?><div class="esun-wishlist-empty"><i class="iconfont icon-favorite4" aria-hidden="true"></i><p><?= $escaper->escapeHtml(__('Your wish list is empty.')) ?></p></div><?php endif; ?></div>
</section>
</div>
</div>
@@ -0,0 +1,98 @@
<?php
/** @var \Esun\Customer\Block\Order\Detail $block */
/** @var \Magento\Framework\Escaper $escaper */
$order = $block->getOrder();
$currentStep = $block->getCurrentStepIndex();
$shippingAddress = $order->getShippingAddress();
$discountAmount = (float)$order->getDiscountAmount();
$rewardDiscount = (float)$order->getData('reward_discount_amount');
?>
<div class="esun-order-detail">
<section class="esun-order-detail__panel esun-order-detail__overview">
<h1><?= $escaper->escapeHtml(__('Order Number %1', $order->getIncrementId())) ?></h1>
<div class="esun-order-progress">
<?php foreach ($block->getSteps() as $index => $step): ?>
<div class="esun-order-progress__step <?= $index <= $currentStep ? 'is-reached' : '' ?> <?= $index === $currentStep ? 'is-current' : '' ?>">
<div class="esun-order-progress__track"><i class="iconfont <?= $escaper->escapeHtmlAttr($step['icon']) ?>" aria-hidden="true"></i></div>
<strong><?= $escaper->escapeHtml($step['label']) ?></strong>
<?php if ($index === $currentStep): ?>
<time><?= $escaper->escapeHtml($block->formatDate($block->getCurrentStepDate(), \IntlDateFormatter::MEDIUM, true)) ?></time>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<div class="esun-order-detail__status-bar">
<strong><?= $escaper->escapeHtml($order->getStatusLabel()) ?></strong>
<?php if ($block->canRepay($order)): ?>
<form method="post" action="<?= $escaper->escapeUrl($block->getRepayUrl($order)) ?>">
<?= $block->getBlockHtml('formkey') ?>
<button class="action primary" type="submit"><?= $escaper->escapeHtml(__('Pay Now')) ?></button>
</form>
<?php elseif ($block->canConfirmReceipt($order)): ?>
<form method="post" action="<?= $escaper->escapeUrl($block->getReceiveUrl()) ?>">
<?= $block->getBlockHtml('formkey') ?>
<input type="hidden" name="order_id" value="<?= (int)$order->getId() ?>">
<button class="action primary" type="submit"><?= $escaper->escapeHtml(__('Confirm Receipt')) ?></button>
</form>
<?php endif; ?>
</div>
</section>
<?= /* @noEscape */ $block->getChildHtml('seventeen_track') ?>
<section class="esun-order-detail__panel esun-order-information">
<h2><?= $escaper->escapeHtml(__('Order Information')) ?></h2>
<dl>
<dt><?= $escaper->escapeHtml(__('Order Date:')) ?></dt>
<dd><?= $escaper->escapeHtml($block->formatDate($order->getCreatedAt(), \IntlDateFormatter::LONG, false)) ?></dd>
<dt><?= $escaper->escapeHtml(__('Payment Method:')) ?></dt>
<dd><?= $escaper->escapeHtml($block->getPaymentMethodTitle()) ?></dd>
<?php if ($shippingAddress): ?>
<dt><?= $escaper->escapeHtml(__('Shipped To:')) ?></dt>
<dd><address><?= /* @noEscape */ $block->getFormattedAddress($shippingAddress) ?></address></dd>
<?php endif; ?>
</dl>
</section>
<section class="esun-order-detail__panel esun-order-summary">
<h2><?= $escaper->escapeHtml(__('Order Summary')) ?></h2>
<?php if (!$order->getIsVirtual()): ?>
<div class="esun-order-summary__shipping">
<span><?= $escaper->escapeHtml(__('Shipping Method: %1', $order->getShippingDescription() ?: __('No shipping information available'))) ?></span>
<span><?= $escaper->escapeHtml(__('Shipping:')) ?> <?= /* @noEscape */ $order->formatPrice($order->getShippingAmount()) ?></span>
</div>
<?php endif; ?>
<div class="esun-order-summary__table">
<div class="esun-order-summary__head">
<span><?= $escaper->escapeHtml(__('Item')) ?></span>
<span><?= $escaper->escapeHtml(__('Price')) ?></span>
<span><?= $escaper->escapeHtml(__('Quantity')) ?></span>
<span><?= $escaper->escapeHtml(__('Subtotal')) ?></span>
</div>
<?php foreach ($order->getAllVisibleItems() as $item): ?>
<div class="esun-order-summary__item">
<div class="esun-order-summary__product">
<img src="<?= $escaper->escapeUrl($block->getItemImageUrl($item)) ?>" alt="<?= $escaper->escapeHtmlAttr($item->getName()) ?>" loading="lazy">
<div><strong><?= $escaper->escapeHtml($item->getName()) ?></strong>
<?php foreach ((array)($item->getProductOptions()['attributes_info'] ?? []) as $option): ?>
<p><?= $escaper->escapeHtml($option['label'] . ': ' . $option['value']) ?></p>
<?php endforeach; ?>
</div>
</div>
<span data-label="<?= $escaper->escapeHtmlAttr(__('Price')) ?>"><?= /* @noEscape */ $order->formatPrice($item->getPrice()) ?></span>
<span data-label="<?= $escaper->escapeHtmlAttr(__('Quantity')) ?>">x<?= $escaper->escapeHtml(rtrim(rtrim(number_format((float)$item->getQtyOrdered(), 2, '.', ''), '0'), '.')) ?></span>
<span data-label="<?= $escaper->escapeHtmlAttr(__('Subtotal')) ?>"><?= /* @noEscape */ $order->formatPrice($item->getRowTotal()) ?></span>
</div>
<?php endforeach; ?>
</div>
<div class="esun-order-summary__totals">
<div><span><?= $escaper->escapeHtml(__('Subtotal:')) ?></span><span><?= /* @noEscape */ $order->formatPrice($order->getSubtotal()) ?></span></div>
<div><span><?= $escaper->escapeHtml(__('Shipping:')) ?></span><span><?= /* @noEscape */ $order->formatPrice($order->getShippingAmount()) ?></span></div>
<?php if ($discountAmount): ?><div><span><?= $escaper->escapeHtml(__('Discount:')) ?></span><span><?= /* @noEscape */ $order->formatPrice($discountAmount) ?></span></div><?php endif; ?>
<?php if ($rewardDiscount): ?><div><span><?= $escaper->escapeHtml(__('Points Discount:')) ?></span><span><?= /* @noEscape */ $order->formatPrice(-abs($rewardDiscount)) ?></span></div><?php endif; ?>
<?php if ((float)$order->getTaxAmount()): ?><div><span><?= $escaper->escapeHtml(__('Tax:')) ?></span><span><?= /* @noEscape */ $order->formatPrice($order->getTaxAmount()) ?></span></div><?php endif; ?>
<?php if ((int)$order->getData('reward_points_earned')): ?><div><span><?= $escaper->escapeHtml(__('Points Earned:')) ?></span><span><?= (int)$order->getData('reward_points_earned') ?></span></div><?php endif; ?>
<div class="grand-total"><strong><?= $escaper->escapeHtml(__('Grand Total:')) ?></strong><strong><?= /* @noEscape */ $order->formatPrice($order->getGrandTotal()) ?></strong></div>
</div>
</section>
</div>
@@ -0,0 +1,63 @@
<?php
/** @var \Esun\Customer\Block\Order\History $block */
/** @var \Magento\Framework\Escaper $escaper */
$orders = $block->getOrders(); $counts = $block->getCounts();
/** @var \Esun\CustomerMessage\ViewModel\OrderUnread|null $messageUnread */
$messageUnread = $block->getData('message_unread_view_model');
$orderUnreadCounts = [];
if ($orders && $messageUnread) {
$orderUnreadCounts = $messageUnread->getUnreadCounts(
array_map('intval', $orders->getColumnValues('entity_id'))
);
}
?>
<div class="esun-order-history">
<h1><?= $escaper->escapeHtml(__('My Orders')) ?></h1>
<nav class="esun-order-statuses esun-order-statuses--history">
<a class="<?= $block->getCurrentStatus() === 'pending' ? 'is-active' : '' ?>" href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status'=>'pending'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_payment1" aria-hidden="true"></i><?php if($counts['pending']):?><b><?= (int)$counts['pending'] ?></b><?php endif;?></span><span><?= $escaper->escapeHtml(__('Awaiting Payment')) ?></span></a>
<a class="<?= $block->getCurrentStatus() === 'processing' ? 'is-active' : '' ?>" href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status'=>'processing'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_shipped1" aria-hidden="true"></i><?php if($counts['processing']):?><b><?= (int)$counts['processing'] ?></b><?php endif;?></span><span><?= $escaper->escapeHtml(__('Awaiting Shipping')) ?></span></a>
<a class="<?= $block->getCurrentStatus() === 'shipped' ? 'is-active' : '' ?>" href="<?= $escaper->escapeUrl($block->getUrl('sales/order/history', ['status'=>'shipped'])) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_shipped3" aria-hidden="true"></i><?php if($counts['shipped']):?><b><?= (int)$counts['shipped'] ?></b><?php endif;?></span><span><?= $escaper->escapeHtml(__('Shipped')) ?></span></a>
<a href="<?= $escaper->escapeUrl($block->getUrl('esun_review/customer/awaiting')) ?>"><span class="esun-status-icon-wrap"><i class="esun-status-icon iconfont icon-order_review1" aria-hidden="true"></i><?php if($counts['awaiting_review']):?><b><?= (int)$counts['awaiting_review'] ?></b><?php endif;?></span><span><?= $escaper->escapeHtml(__('Awaiting Review')) ?></span></a>
</nav>
<form class="esun-order-filters" method="get" action="<?= $escaper->escapeUrl($block->getUrl('sales/order/history')) ?>">
<label><span class="label"><?= $escaper->escapeHtml(__('Search orders')) ?></span><input type="search" name="q" value="<?= $escaper->escapeHtmlAttr($block->getSearchQuery()) ?>" placeholder="<?= $escaper->escapeHtmlAttr(__('Product Name/Order No.')) ?>"></label>
<label><span class="label"><?= $escaper->escapeHtml(__('Order Status')) ?></span><select name="status">
<option value=""><?= $escaper->escapeHtml(__('All Orders')) ?></option>
<?php foreach (['pending'=>__('Awaiting Payment'),'processing'=>__('Awaiting Shipping'),'shipped'=>__('Shipped'),'received'=>__('Received')] as $value=>$label): ?><option value="<?= $escaper->escapeHtmlAttr($value) ?>" <?= $block->getCurrentStatus()===$value?'selected':'' ?>><?= $escaper->escapeHtml($label) ?></option><?php endforeach; ?>
</select></label><button class="action primary" type="submit"><?= $escaper->escapeHtml(__('Search')) ?></button>
</form>
<?php if ($orders && $orders->getSize()): foreach ($orders as $order): ?>
<article class="esun-order-card"><header><span><?= $escaper->escapeHtml(__('Date: %1', $block->formatDate($order->getCreatedAt(), \IntlDateFormatter::MEDIUM, false))) ?></span><span><?= $escaper->escapeHtml(__('Order Number:')) ?> <a class="esun-order-number-link" href="<?= $escaper->escapeUrl($block->getViewUrl($order)) ?>"><?= $escaper->escapeHtml($order->getIncrementId()) ?></a></span></header>
<div class="esun-order-card__content"><div class="esun-order-card__items">
<?php foreach ($order->getAllVisibleItems() as $index=>$item): ?><div class="esun-order-item"><div class="esun-order-item__visual"><img src="<?= $escaper->escapeUrl($block->getItemImageUrl($item)) ?>" alt="<?= $escaper->escapeHtmlAttr($item->getName()) ?>"><span class="esun-item-number"><?= $index+1 ?></span></div><div><h3><?= $escaper->escapeHtml($item->getName()) ?></h3>
<?php foreach ((array)($item->getProductOptions()['attributes_info'] ?? []) as $option): ?><p><?= $escaper->escapeHtml($option['label'].': '.$option['value']) ?></p><?php endforeach; ?>
<strong><?= /* @noEscape */ $order->formatPrice($item->getPrice()) ?></strong></div></div><?php endforeach; ?>
</div><div class="esun-order-card__summary"><strong class="esun-order-card__grand-total"><?= /* @noEscape */ $order->formatPrice($order->getGrandTotal()) ?></strong><span class="esun-order-card__status"><?= $escaper->escapeHtml($order->getStatusLabel()) ?></span><div class="esun-order-card__actions">
<?php if ($block->canRepay($order)): ?><form method="post" action="<?= $escaper->escapeUrl($block->getRepayUrl($order)) ?>"><?= $block->getBlockHtml('formkey') ?><button class="action primary esun-order-pay" type="submit"><?= $escaper->escapeHtml(__('Pay Now')) ?></button></form><?php endif; ?>
<?php if ((string)$order->getStatus()==='shipped'): ?><form method="post" action="<?= $escaper->escapeUrl($block->getUrl('esun_customer/order/receive')) ?>"><?= $block->getBlockHtml('formkey') ?><input type="hidden" name="order_id" value="<?= (int)$order->getId() ?>"><button class="action primary" type="submit"><?= $escaper->escapeHtml(__('Confirm Receipt')) ?></button></form><?php endif; ?>
<?php $unreadCount = $orderUnreadCounts[(int)$order->getId()] ?? 0; ?>
<details class="esun-order-more"><summary><span><?= $escaper->escapeHtml(__('View More')) ?></span><?php if ($unreadCount): ?><b class="esun-unread-badge" aria-label="<?= $escaper->escapeHtmlAttr(__('%1 unread messages', $unreadCount)) ?>"><?= (int)$unreadCount ?></b><?php endif; ?><i aria-hidden="true"></i></summary><div class="esun-order-more__menu">
<a href="#" data-post='<?= /* @noEscape */ $block->getBuyAgainPostData($order) ?>'><?= $escaper->escapeHtml(__('Buy Again')) ?></a>
<a class="esun-order-contact-link" href="<?= $escaper->escapeUrl($block->getUrl('customer-message/order/contact', ['order_id' => (int)$order->getId()])) ?>"><span><?= $escaper->escapeHtml(__('Contact')) ?></span><?php if ($unreadCount): ?><b class="esun-unread-badge" aria-label="<?= $escaper->escapeHtmlAttr(__('%1 unread messages', $unreadCount)) ?>"><?= (int)$unreadCount ?></b><?php endif; ?></a>
<?php if ($block->canCancel($order)): ?><form method="post" action="<?= $escaper->escapeUrl($block->getCancelUrl($order)) ?>"><?= $block->getBlockHtml('formkey') ?><button type="submit"><?= $escaper->escapeHtml(__('Cancel Order')) ?></button></form><?php endif; ?>
</div></details></div></div></div>
</article>
<?php endforeach; echo $block->getPagerHtml(); else: ?><div class="message info empty"><span><?= $escaper->escapeHtml(__('No orders matched your filters.')) ?></span></div><?php endif; ?>
</div>
<script>
require(['jquery'], function ($) {
'use strict';
if (!window.matchMedia('(hover: hover) and (pointer: fine)').matches) {
return;
}
$('.esun-order-more')
.on('mouseenter', function () {
this.open = true;
})
.on('mouseleave', function () {
this.open = false;
});
});
</script>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
@@ -0,0 +1,24 @@
define([
'jquery'
], function ($) {
'use strict';
return function (config, element) {
var $book = $(element);
var $tabs = $book.find('[data-address-tab]');
var $panels = $book.find('[data-address-panel]');
$tabs.on('click', function () {
var $tab = $(this);
var target = $tab.attr('data-address-tab');
$tabs.removeClass('is-active').attr('aria-selected', 'false');
$tab.addClass('is-active').attr('aria-selected', 'true');
$panels.removeClass('is-active').prop('hidden', true);
$panels.filter('[data-address-panel="' + target + '"]')
.addClass('is-active')
.prop('hidden', false);
});
};
});
@@ -0,0 +1,89 @@
define([
'jquery',
'mage/utils/wrapper',
'Magento_Customer/js/customer-data',
'uiRegistry'
], function ($, wrapper, customerData, registry) {
'use strict';
var directoryData = customerData.get('directory-data');
/**
* Resolve a region from customer-data or the checkout provider dictionary.
*
* The provider dictionary is rendered with the checkout page and is
* available before the asynchronous customer-data section has loaded.
*
* @param {Object} addressData
* @returns {Object|null}
*/
function getRegion(addressData) {
var countries = directoryData() || {},
country = countries[addressData.country_id],
provider,
options,
option;
if (country && country.regions) {
option = country.regions[addressData.region_id];
if (option) {
return {
code: option.code,
name: option.name
};
}
}
provider = registry.get('checkoutProvider');
options = provider && provider.dictionaries && provider.dictionaries.region_id;
if (!options && provider && typeof provider.get === 'function') {
options = provider.get('dictionaries.region_id');
}
if (!Array.isArray(options)) {
return null;
}
options.some(function (item) {
if (String(item.value) === String(addressData.region_id) &&
(!item.country_id || item.country_id === addressData.country_id)
) {
option = item;
return true;
}
return false;
});
return option ? {
code: addressData.region_code || '',
name: option.label || option.title
} : null;
}
return function (addressConverter) {
addressConverter.formAddressDataToQuoteAddress = wrapper.wrapSuper(
addressConverter.formAddressDataToQuoteAddress,
function (formData) {
var addressData = $.extend(true, {}, formData),
region;
if (addressData.region_id && !addressData.region) {
region = getRegion(addressData);
if (region) {
addressData.region = region.name;
addressData.region_code = region.code;
}
}
return this._super(addressData);
}
);
return addressConverter;
};
});
@@ -0,0 +1,79 @@
define([], function () {
'use strict';
return function (Region) {
return Region.extend({
/**
* Keep the text region value in sync with the selected region ID.
*
* Magento normally resolves the name later from the asynchronous
* directory-data customer section. When that section has not
* finished loading, a newly-created checkout address has a valid
* regionId but an empty region label, so its address card omits the
* state until the page is reloaded.
*
* @param {*} value
* @returns {Object}
*/
onUpdate: function (value) {
var result = this._super();
this.syncRegionName(value);
return result;
},
/**
* Synchronize addresses restored before their country regions have
* finished loading (most visible when editing a second address).
*
* @param {Array} options
* @returns {Object}
*/
setOptions: function (options) {
var result = this._super(options);
this.syncRegionName(this.value());
return result;
},
/**
* Copy the selected option label to the text region data scope.
*
* @param {*} value
*/
syncRegionName: function (value) {
var option = this.getOption(value),
regionScope = this.customEntry;
if (!regionScope && this.dataScope) {
regionScope = this.dataScope.replace(/region_id$/, 'region');
}
if (option && regionScope && this.source) {
this.source.set(regionScope, option.label);
}
},
/**
* Restore the region selector when switching from a country whose
* regions are hidden to one (such as US) that has region options.
*/
hideRegion: function (option) {
var hasVisibleRegions;
if (!option) {
return;
}
hasVisibleRegions = option.is_region_visible !== false && this.options().length > 1;
this.setVisible(hasVisibleRegions);
if (this.customEntry) {
this.toggleInput(!hasVisibleRegions && option.is_region_visible !== false);
}
}
});
};
});
@@ -0,0 +1,136 @@
define([
'jquery'
], function ($) {
'use strict';
return function (customerData) {
var initialized = false,
initPromise,
guardedMethods = [
'reload',
'set',
'invalidate',
'onAjaxComplete'
],
emptyArrayMethods = [
'getExpiredSectionNames',
'getExpiredKeys'
];
if (!customerData || customerData._esunCustomerDataInitGuard) {
return customerData;
}
customerData._esunCustomerDataInitGuard = true;
initPromise = typeof customerData.getInitCustomerData === 'function' ?
customerData.getInitCustomerData() :
null;
if (initPromise && typeof initPromise.done === 'function') {
initPromise.done(function () {
initialized = true;
});
} else {
initialized = true;
}
function resolveDeferred(deferred, result) {
if (result && typeof result.done === 'function') {
result.done(function () {
deferred.resolve.apply(deferred, arguments);
});
if (typeof result.fail === 'function') {
result.fail(function () {
deferred.reject.apply(deferred, arguments);
});
}
return;
}
deferred.resolve(result);
}
function runAfterInit(callback) {
var deferred = $.Deferred();
if (initialized) {
resolveDeferred(deferred, callback());
return deferred.promise();
}
if (!initPromise || typeof initPromise.done !== 'function') {
initialized = true;
resolveDeferred(deferred, callback());
return deferred.promise();
}
initPromise.done(function () {
initialized = true;
resolveDeferred(deferred, callback());
});
if (typeof initPromise.fail === 'function') {
initPromise.fail(function () {
deferred.reject.apply(deferred, arguments);
});
}
return deferred.promise();
}
guardedMethods.forEach(function (methodName) {
var originalMethod = customerData[methodName];
if (typeof originalMethod !== 'function') {
return;
}
customerData[methodName] = function () {
var context = this,
args = arguments;
if (initialized) {
return originalMethod.apply(context, args);
}
return runAfterInit(function () {
return originalMethod.apply(context, args);
});
};
});
emptyArrayMethods.forEach(function (methodName) {
var originalMethod = customerData[methodName];
if (typeof originalMethod !== 'function') {
return;
}
customerData[methodName] = function () {
if (!initialized) {
return [];
}
return originalMethod.apply(this, arguments);
};
});
if (typeof customerData.needReload === 'function') {
customerData.needReload = function (originalMethod) {
return function () {
if (!initialized) {
return false;
}
return originalMethod.apply(this, arguments);
};
}(customerData.needReload);
}
return customerData;
};
});