add admin dashboard with setup checklist and stats

Dashboard at /admin shows setup progress (when not live), stat cards
(orders, revenue, products), and recent paid orders table. Replaces
the old AdminController redirect. Add Dashboard to sidebar nav as
first item, update admin bar and theme editor links to /admin.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-12 14:17:38 +00:00
parent 4514608c07
commit 0dac93ec0b
10 changed files with 321 additions and 21 deletions

View File

@@ -50,6 +50,16 @@ defmodule SimpleshopTheme.Orders do
|> Map.new()
end
@doc """
Returns total revenue (in minor units) from paid orders.
"""
def total_revenue do
Order
|> where(payment_status: "paid")
|> select([o], sum(o.total))
|> Repo.one() || 0
end
@doc """
Creates an order with line items from hydrated cart data.