berrypod/lib/berrypod_web/components/page_templates/orders.html.heex
jamey 01ff8decd5
All checks were successful
deploy / deploy (push) Successful in 1m17s
add order status lookup for customers
Magic link flow on contact page: customer enters email, gets a
time-limited signed link, clicks through to /orders showing all their
paid orders and full detail pages with thumbnails and product links.

- OrderLookupController generates/verifies Phoenix.Token signed links
- Contact LiveView handles lookup_orders + reset_tracking events
- Orders and OrderDetail LiveViews gated by session email
- Order detail shows thumbnails, links to products still available
- .themed-button gets base padding/font-weight so all usages are consistent
- order-summary-card sticky scoped to .cart-grid (was leaking to orders list)
- 27 new tests (1095 total)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 08:40:08 +00:00

72 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<.shop_layout {layout_assigns(assigns)} active_page="contact">
<main id="main-content" class="page-container orders-main">
<div class="orders-header">
<h1 class="orders-page-title">Your orders</h1>
<%= if @lookup_email do %>
<p class="orders-email-label">
Orders for <strong>{@lookup_email}</strong>
</p>
<% end %>
</div>
<%= cond do %>
<% is_nil(@orders) -> %>
<div class="orders-empty">
<p>This link has expired or is invalid.</p>
<p class="orders-empty-hint">
Head back to the <.link navigate="/contact">contact page</.link> to request a new one.
</p>
</div>
<% @orders == [] -> %>
<div class="orders-empty">
<p>No orders found for that email address.</p>
<p class="orders-empty-hint">
If something doesn't look right, <.link navigate="/contact">get in touch</.link>.
</p>
</div>
<% true -> %>
<div class="orders-list">
<%= for order <- @orders do %>
<.link navigate={"/orders/#{order.order_number}"} class="order-summary-card">
<div class="order-summary-top">
<div>
<p class="order-summary-number">{order.order_number}</p>
<p class="order-summary-date">
{Calendar.strftime(order.inserted_at, "%-d %B %Y")}
</p>
</div>
<span class={"order-status-badge order-status-badge--#{order.fulfilment_status}"}>
{format_order_status(order.fulfilment_status)}
</span>
</div>
<ul class="order-summary-items">
<%= for item <- Enum.take(order.items, 2) do %>
<li class="order-summary-item">
{item.quantity}× {item.product_name}
<%= if item.variant_title && item.variant_title != "" do %>
<span class="order-summary-variant">· {item.variant_title}</span>
<% end %>
</li>
<% end %>
<%= if length(order.items) > 2 do %>
<li class="order-summary-more">
+{length(order.items) - 2} more
</li>
<% end %>
</ul>
<div class="order-summary-footer">
<span class="order-summary-total">
{Berrypod.Cart.format_price(order.total)}
</span>
<span class="order-summary-arrow">→</span>
</div>
</.link>
<% end %>
</div>
<% end %>
</main>
</.shop_layout>