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:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user