views: add account order history and wishlist pages
This commit is contained in:
1 parent
2ef134cb22
commit
e6c381a732
3 files changed
+92
No files matched your search
@@ -0,0 +1,35 @@
|
||||
<section class="block">
|
||||
<div class="wrap" style="max-width:760px">
|
||||
<p class="small muted"><a href="/account/orders">Orders</a> / #<?= (int) $order['id'] ?></p>
|
||||
<div class="row row--between" style="align-items:flex-end">
|
||||
<h1 style="margin:6px 0">Order #<?= (int) $order['id'] ?></h1>
|
||||
<span class="badge badge--<?= e($order['status']) ?>"><?= e($order['status']) ?></span>
|
||||
</div>
|
||||
<p class="muted">Placed <?= e(date('F j, Y \a\t H:i', strtotime($order['createdAt']))) ?></p>
|
||||
|
||||
<div class="panel mt-lg">
|
||||
<div class="table-wrap" style="border:none">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr><th>Item</th><th class="num">Unit price</th><th class="num">Qty</th><th class="num">Total</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($items as $orderItem): ?>
|
||||
<tr>
|
||||
<td style="font-weight:600"><?= e($orderItem['productName']) ?></td>
|
||||
<td class="num mono"><?= e(formatMoney((int) $orderItem['unitPriceCents'], $order['currency'])) ?></td>
|
||||
<td class="num mono"><?= (int) $orderItem['quantity'] ?></td>
|
||||
<td class="num mono"><?= e(formatMoney((int) $orderItem['unitPriceCents'] * (int) $orderItem['quantity'], $order['currency'])) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="panel--pad" style="border-top:1px solid var(--line)">
|
||||
<div class="summary-row summary-row--total" style="border:none;margin:0;padding:0">
|
||||
<span>Total</span><span class="mono"><?= e(formatMoney((int) $order['totalCents'], $order['currency'])) ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,38 @@
|
||||
<section class="block">
|
||||
<div class="wrap">
|
||||
<h1>Your orders</h1>
|
||||
|
||||
<?php if (empty($orders)): ?>
|
||||
<div class="empty">
|
||||
<h3>No orders yet</h3>
|
||||
<p class="muted">When you place an order it will show up here.</p>
|
||||
<a class="btn btn--primary mt" href="/products">Browse the catalog</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="table-wrap mt">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Order</th>
|
||||
<th>Placed</th>
|
||||
<th>Status</th>
|
||||
<th class="num">Total</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($orders as $order): ?>
|
||||
<tr>
|
||||
<td style="font-weight:600">#<?= (int) $order['id'] ?></td>
|
||||
<td class="muted"><?= e(date('M j, Y', strtotime($order['createdAt']))) ?></td>
|
||||
<td><span class="badge badge--<?= e($order['status']) ?>"><?= e($order['status']) ?></span></td>
|
||||
<td class="num mono"><?= e(formatMoney((int) $order['totalCents'], $order['currency'])) ?></td>
|
||||
<td><a class="btn btn--sm" href="/account/orders/<?= (int) $order['id'] ?>">View</a></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,19 @@
|
||||
<section class="block">
|
||||
<div class="wrap">
|
||||
<h1><?= e($t('wishlist.title')) ?></h1>
|
||||
|
||||
<?php if (empty($products)): ?>
|
||||
<div class="empty">
|
||||
<svg class="icon empty__icon" viewBox="0 0 24 24"><path d="M20.8 4.6a5.5 5.5 0 0 0-7.8 0L12 5.7l-1-1.1a5.5 5.5 0 0 0-7.8 7.8l1 1.1L12 21l7.8-7.5 1-1.1a5.5 5.5 0 0 0 0-7.8z"/></svg>
|
||||
<h3><?= e($t('wishlist.empty')) ?></h3>
|
||||
<a class="btn btn--primary mt" href="/products"><?= e($t('nav.shop')) ?></a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="product-grid">
|
||||
<?php foreach ($products as $product): ?>
|
||||
<?= $view->renderPartial('partials.productCard', ['product' => $product, 'currency' => $currency, 'wishlisted' => array_map('intval', array_column($products, 'id'))]) ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
Reference in new issue
Block a user