Files
2026-09-15 10:35:56 +08:00

56 lines
5.8 KiB
PHTML

<?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>