Skip to main content

Examples

Treasury Dashboard

A real-time financial dashboard with summary cards, cash flow table, exchange rates, and auto-refresh.

Treasury Dashboard

import random
from datetime import datetime, timedelta
from abstra.pages import register_function

def _rate(base, spread=0.02):
return round(base * (1 + random.uniform(-spread, spread)), 4)

def _cash_flow_item():
items = [
("Accounts Receivable", "inflow"), ("Loan Repayment", "outflow"),
("Supplier Payment", "outflow"), ("Investment Return", "inflow"),
("Payroll", "outflow"), ("Service Revenue", "inflow"),
("Tax Payment", "outflow"), ("Client Deposit", "inflow"),
]
name, direction = random.choice(items)
return {
"description": name, "direction": direction,
"amount": round(random.uniform(10_000, 500_000), 2),
"due_date": (datetime.now() + timedelta(days=random.randint(0, 30))).strftime("%Y-%m-%d"),
}

@register_function
def get_dashboard_data():
inflows = round(random.uniform(200_000, 900_000), 2)
outflows = round(random.uniform(100_000, 600_000), 2)
return {
"balance": round(random.uniform(2_000_000, 8_000_000), 2),
"inflows": inflows, "outflows": outflows,
"net": round(inflows - outflows, 2),
"pending_approvals": random.randint(2, 12),
"rates": {"USD/BRL": _rate(5.12), "EUR/BRL": _rate(5.54), "GBP/BRL": _rate(6.41)},
"cash_flow": [_cash_flow_item() for _ in range(6)],
"updated_at": datetime.now().strftime("%H:%M:%S"),
}

@register_function
def approve_payment(index: int):
return {"status": "approved", "index": index}

@register_function
def __render__():
return """
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { margin:0; font-family:'Inter',system-ui,sans-serif; background:#f8fafc; }
.fade { animation: fadeIn .3s ease-in } @keyframes fadeIn { from{opacity:.5} to{opacity:1} }
</style>
<div class="min-h-screen p-8 max-w-6xl mx-auto">
<div class="flex items-center justify-between mb-8">
<div>
<h1 class="text-2xl font-bold text-slate-800">Treasury Dashboard</h1>
<p class="text-sm text-slate-400 mt-1">Updated at <span id="time" class="font-medium text-slate-500">--:--:--</span></p>
</div>
<button onclick="refreshData()" id="refresh-btn"
class="bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium px-5 py-2.5 rounded-lg transition-all active:scale-95 flex items-center gap-2 shadow-sm shadow-indigo-200">
<svg id="refresh-icon" class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
Refresh
</button>
</div>

<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-5 mb-8">
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition-shadow">
<div class="flex items-center gap-2 mb-3">
<div class="w-8 h-8 rounded-lg bg-slate-100 flex items-center justify-center">
<svg class="w-4 h-4 text-slate-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
</div>
<p class="text-xs font-semibold text-slate-400 uppercase tracking-wider">Balance</p>
</div>
<p id="balance" class="text-2xl font-bold text-slate-800">--</p>
</div>
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition-shadow">
<div class="flex items-center gap-2 mb-3">
<div class="w-8 h-8 rounded-lg bg-emerald-50 flex items-center justify-center">
<svg class="w-4 h-4 text-emerald-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 11l5-5m0 0l5 5m-5-5v12"/></svg>
</div>
<p class="text-xs font-semibold text-emerald-500 uppercase tracking-wider">Inflows</p>
</div>
<p id="inflows" class="text-2xl font-bold text-emerald-600">--</p>
</div>
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition-shadow">
<div class="flex items-center gap-2 mb-3">
<div class="w-8 h-8 rounded-lg bg-rose-50 flex items-center justify-center">
<svg class="w-4 h-4 text-rose-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 13l-5 5m0 0l-5-5m5 5V6"/></svg>
</div>
<p class="text-xs font-semibold text-rose-400 uppercase tracking-wider">Outflows</p>
</div>
<p id="outflows" class="text-2xl font-bold text-rose-600">--</p>
</div>
<div class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 hover:shadow-md transition-shadow">
<div class="flex items-center gap-2 mb-3">
<div class="w-8 h-8 rounded-lg bg-amber-50 flex items-center justify-center">
<svg class="w-4 h-4 text-amber-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/></svg>
</div>
<p class="text-xs font-semibold text-amber-500 uppercase tracking-wider">Pending</p>
</div>
<p id="pending" class="text-2xl font-bold text-amber-600">--</p>
</div>
</div>

<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<div class="lg:col-span-2 bg-white rounded-2xl shadow-sm border border-slate-100 overflow-hidden">
<div class="px-6 py-4 border-b border-slate-100 flex items-center justify-between">
<h2 class="font-semibold text-slate-800">Upcoming Cash Flow</h2>
<span id="net-badge" class="text-xs font-bold px-3 py-1 rounded-full">--</span>
</div>
<table class="w-full text-sm">
<thead>
<tr class="text-left text-xs font-semibold text-slate-400 uppercase tracking-wider border-b border-slate-50">
<th class="px-6 py-3">Description</th><th class="px-6 py-3">Due</th>
<th class="px-6 py-3 text-right">Amount</th><th class="px-6 py-3 text-center">Action</th>
</tr>
</thead>
<tbody id="cash-flow"></tbody>
</table>
</div>

<div class="bg-white rounded-2xl shadow-sm border border-slate-100">
<div class="px-6 py-4 border-b border-slate-100">
<h2 class="font-semibold text-slate-800">Exchange Rates</h2>
</div>
<div id="rates" class="divide-y divide-slate-50"></div>
</div>
</div>
</div>

<script>
const fmt = n => new Intl.NumberFormat('pt-BR',{style:'currency',currency:'BRL'}).format(n);

async function refreshData() {
document.getElementById('refresh-icon').classList.add('animate-spin');
try {
const d = await get_dashboard_data();
document.getElementById('time').textContent = d.updated_at;
document.getElementById('balance').textContent = fmt(d.balance);
document.getElementById('inflows').textContent = fmt(d.inflows);
document.getElementById('outflows').textContent = fmt(d.outflows);
document.getElementById('pending').textContent = d.pending_approvals;

const badge = document.getElementById('net-badge');
badge.textContent = (d.net>=0?'+':'') + fmt(d.net);
badge.className = d.net>=0
? 'text-xs font-bold px-3 py-1 rounded-full bg-emerald-50 text-emerald-700'
: 'text-xs font-bold px-3 py-1 rounded-full bg-rose-50 text-rose-700';

document.getElementById('cash-flow').innerHTML = d.cash_flow.map((item,i) => `
<tr class="border-b border-slate-50 hover:bg-slate-50/50 transition-colors fade">
<td class="px-6 py-3.5 font-medium text-slate-700">${item.description}</td>
<td class="px-6 py-3.5 text-slate-400">${item.due_date}</td>
<td class="px-6 py-3.5 text-right font-mono tabular-nums ${item.direction==='inflow'?'text-emerald-600':'text-rose-600'}">
${item.direction==='inflow'?'+':'-'} ${fmt(item.amount)}
</td>
<td class="px-6 py-3.5 text-center">
${item.direction==='outflow'
? `<button onclick="handleApprove(${i})" class="text-xs bg-indigo-50 text-indigo-700 hover:bg-indigo-100 font-medium px-3 py-1.5 rounded-lg transition-colors">Approve</button>`
: '<span class="text-slate-300">—</span>'}
</td>
</tr>`).join('');

document.getElementById('rates').innerHTML = Object.entries(d.rates).map(([pair,rate]) => `
<div class="px-6 py-4 flex items-center justify-between fade">
<div class="flex items-center gap-3">
<div class="w-8 h-8 rounded-full bg-slate-100 flex items-center justify-center text-xs font-bold text-slate-500">
${pair.split('/')[0]}
</div>
<span class="text-sm font-medium text-slate-700">${pair}</span>
</div>
<span class="text-sm font-mono font-semibold text-slate-800 tabular-nums">${Number(rate).toFixed(4)}</span>
</div>`).join('');
} finally { document.getElementById('refresh-icon').classList.remove('animate-spin'); }
}

async function handleApprove(i) { await approve_payment(i); refreshData(); }

refreshData();
setInterval(refreshData, 10000);
</script>
"""

Key patterns: setInterval for auto-refresh, Tailwind CSS, summary cards with icons, cash flow table with actions, exchange rate list.


Authenticated Task Manager

A page that requires login and displays tasks assigned to the current user with complete/dismiss actions.

from abstra.pages import register_function, get_user
from abstra.tables import select, update

@register_function
def get_my_tasks():
user = get_user()
tasks = select("tasks", where={"assignee_email": user.email, "status": "pending"})
return [{"id": t["id"], "title": t["title"], "due": str(t["due_date"]), "priority": t.get("priority","medium")} for t in tasks]

@register_function
def complete_task(task_id: str):
user = get_user()
update("tasks", where={"id": task_id}, set={"status": "done", "completed_by": user.email})
return {"ok": True}

@register_function
def __render__():
user = get_user()
return f"""
<script src="https://cdn.tailwindcss.com"></script>
<style>body {{ margin:0; font-family:'Inter',system-ui,sans-serif; background:#f8fafc; }}</style>
<div class="min-h-screen p-8 max-w-2xl mx-auto">
<div class="flex items-center justify-between mb-8">
<div>
<h1 class="text-2xl font-bold text-slate-800">My Tasks</h1>
<p class="text-sm text-slate-400 mt-1">Logged in as <span class="font-medium text-slate-500">{user.email}</span></p>
</div>
<div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-700 font-bold text-sm">
{user.email[0].upper()}
</div>
</div>
<div id="tasks">
<div class="flex justify-center py-12"><div class="animate-spin w-6 h-6 border-2 border-indigo-600 border-t-transparent rounded-full"></div></div>
</div>
</div>
<script>
const priorities = {{ high:'rose', medium:'amber', low:'slate' }};
async function load() {{
const tasks = await get_my_tasks();
const el = document.getElementById('tasks');
if (!tasks.length) {{
el.innerHTML = `<div class="text-center py-16">
<div class="w-16 h-16 rounded-full bg-emerald-50 flex items-center justify-center mx-auto mb-4">
<svg class="w-8 h-8 text-emerald-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
</div>
<p class="text-slate-500 font-medium">All caught up!</p>
<p class="text-sm text-slate-400 mt-1">No pending tasks for you</p>
</div>`;
return;
}}
el.innerHTML = '<div class="space-y-3">' + tasks.map(t => {{
const c = priorities[t.priority] || 'slate';
return `<div class="bg-white rounded-xl p-5 border border-slate-100 shadow-sm hover:shadow-md transition-all group">
<div class="flex items-start justify-between">
<div class="flex-1">
<div class="flex items-center gap-2 mb-1">
<span class="w-2 h-2 rounded-full bg-${{c}}-500"></span>
<span class="text-xs font-medium text-${{c}}-600 uppercase">${{t.priority}}</span>
</div>
<p class="font-medium text-slate-800">${{t.title}}</p>
<p class="text-xs text-slate-400 mt-1">Due ${{t.due}}</p>
</div>
<button onclick="done('${{t.id}}')"
class="opacity-0 group-hover:opacity-100 transition-opacity bg-emerald-50 hover:bg-emerald-100 text-emerald-700 text-sm font-medium px-4 py-2 rounded-lg">
Complete
</button>
</div>
</div>`;
}}).join('') + '</div>';
}}
async function done(id) {{ await complete_task(id); load(); }}
load();
</script>
"""

Key patterns: get_user() in __render__ and functions, priority badges, hover-reveal action buttons, empty state with icon.


Expense Submission Form

A custom HTML form with client-side validation, loading states, and backend processing with database insert and task routing.

from abstra.pages import register_function, get_user
from abstra.tables import insert
from abstra.tasks import send_task

@register_function
def submit_expense(description: str, amount: float, category: str):
user = get_user()
record = insert("expenses", {
"description": description,
"amount_cents": int(amount * 100),
"category": category,
"submitted_by": user.email,
"status": "pending",
})
send_task("expense_submitted", {"expense_id": str(record["id"]), "amount": amount, "submitted_by": user.email})
return {"id": str(record["id"])}

@register_function
def __render__():
user = get_user()
return f"""
<script src="https://cdn.tailwindcss.com"></script>
<style>body {{ margin:0; font-family:'Inter',system-ui,sans-serif; background:#f8fafc; }}</style>
<div class="min-h-screen flex items-start justify-center pt-16 px-4">
<div class="w-full max-w-md">
<div class="text-center mb-8">
<div class="w-14 h-14 rounded-2xl bg-indigo-100 flex items-center justify-center mx-auto mb-4">
<svg class="w-7 h-7 text-indigo-600" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 14l6-6m-5.5.5h.01m4.99 5h.01M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16l3.5-2 3.5 2 3.5-2 3.5 2z"/></svg>
</div>
<h1 class="text-xl font-bold text-slate-800">Submit Expense</h1>
<p class="text-sm text-slate-400 mt-1">{user.email}</p>
</div>

<form id="form" class="bg-white rounded-2xl p-6 shadow-sm border border-slate-100 space-y-5" onsubmit="handleSubmit(event)">
<div>
<label class="block text-sm font-medium text-slate-700 mb-1.5">Description</label>
<input id="desc" type="text" required minlength="3" placeholder="Lunch with client"
class="w-full border border-slate-200 rounded-xl px-4 py-2.5 text-sm focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-shadow">
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1.5">Amount (R$)</label>
<input id="amount" type="number" required min="0.01" step="0.01" placeholder="150.00"
class="w-full border border-slate-200 rounded-xl px-4 py-2.5 text-sm focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-shadow font-mono">
</div>
<div>
<label class="block text-sm font-medium text-slate-700 mb-1.5">Category</label>
<select id="cat" required
class="w-full border border-slate-200 rounded-xl px-4 py-2.5 text-sm focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 outline-none transition-shadow bg-white">
<option value="">Select category...</option>
<option value="travel">Travel</option>
<option value="meals">Meals & Entertainment</option>
<option value="office">Office Supplies</option>
<option value="software">Software & Subscriptions</option>
<option value="other">Other</option>
</select>
</div>
<button type="submit" id="btn"
class="w-full bg-indigo-600 hover:bg-indigo-700 text-white py-2.5 rounded-xl font-medium text-sm transition-all active:scale-[0.98] shadow-sm shadow-indigo-200">
Submit Expense
</button>
</form>

<div id="result" class="mt-4 hidden">
<div class="bg-emerald-50 border border-emerald-200 text-emerald-700 p-4 rounded-xl text-sm flex items-center gap-3">
<svg class="w-5 h-5 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
<span id="result-text"></span>
</div>
</div>
</div>
</div>
<script>
async function handleSubmit(e) {{
e.preventDefault();
const btn = document.getElementById('btn');
btn.disabled = true; btn.textContent = 'Submitting...'; btn.classList.add('opacity-75');
try {{
const r = await submit_expense(
document.getElementById('desc').value,
parseFloat(document.getElementById('amount').value),
document.getElementById('cat').value
);
document.getElementById('result').classList.remove('hidden');
document.getElementById('result-text').textContent = 'Expense #' + r.id + ' submitted for approval.';
document.getElementById('form').reset();
}} catch(err) {{ alert(err.message); }}
btn.disabled = false; btn.textContent = 'Submit Expense'; btn.classList.remove('opacity-75');
}}
</script>
"""

Key patterns: Centered card layout, native form validation, loading state, success banner, insert() + send_task() on submit.


System Status Monitor

A public status page with color-coded health indicators, latency metrics, and 5-second polling.

import random
from datetime import datetime
from abstra.pages import register_function

SERVICES = ["API Gateway", "Database", "Queue Worker", "Email Service", "Payment Processor"]

@register_function
def get_status():
return {
"services": [{
"name": s,
"status": random.choice(["healthy","healthy","healthy","degraded","down"]),
"latency_ms": random.randint(5, 500),
"uptime": round(random.uniform(99.0, 100.0), 2),
} for s in SERVICES],
"timestamp": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
}

@register_function
def __render__():
return """
<script src="https://cdn.tailwindcss.com"></script>
<style>
body { margin:0; font-family:'Inter',system-ui,sans-serif; background:#f8fafc; }
.fade { animation: fadeIn .3s ease-in } @keyframes fadeIn { from{opacity:.5} to{opacity:1} }
</style>
<div class="min-h-screen p-8 max-w-3xl mx-auto">
<div class="flex items-center justify-between mb-8">
<div class="flex items-center gap-3">
<div id="global-dot" class="w-3 h-3 rounded-full bg-slate-300 animate-pulse"></div>
<h1 class="text-2xl font-bold text-slate-800">System Status</h1>
</div>
<span id="ts" class="text-sm text-slate-400 font-mono"></span>
</div>
<div id="services" class="space-y-3"></div>
</div>
<script>
const cfg = {
healthy: { color:'emerald', label:'Operational', icon:'&#10003;' },
degraded: { color:'amber', label:'Degraded', icon:'&#9888;' },
down: { color:'red', label:'Down', icon:'&#10007;' },
};
async function poll() {
const data = await get_status();
document.getElementById('ts').textContent = data.timestamp;

const allHealthy = data.services.every(s => s.status === 'healthy');
const dot = document.getElementById('global-dot');
dot.className = 'w-3 h-3 rounded-full ' + (allHealthy ? 'bg-emerald-500' : 'bg-amber-500 animate-pulse');

document.getElementById('services').innerHTML = data.services.map(s => {
const c = cfg[s.status];
const latencyColor = s.latency_ms < 100 ? 'text-emerald-600' : s.latency_ms < 300 ? 'text-amber-600' : 'text-rose-600';
return `<div class="bg-white rounded-xl p-5 border border-slate-100 shadow-sm hover:shadow-md transition-all fade">
<div class="flex items-center justify-between">
<div class="flex items-center gap-4">
<div class="w-10 h-10 rounded-xl bg-${c.color}-50 flex items-center justify-center text-${c.color}-600 font-bold">
${c.icon}
</div>
<div>
<p class="font-medium text-slate-800">${s.name}</p>
<p class="text-xs text-${c.color}-600 font-medium mt-0.5">${c.label}</p>
</div>
</div>
<div class="flex items-center gap-6 text-sm">
<div class="text-right">
<p class="font-mono font-semibold tabular-nums ${latencyColor}">${s.latency_ms}ms</p>
<p class="text-xs text-slate-400">latency</p>
</div>
<div class="text-right">
<p class="font-mono font-semibold tabular-nums text-slate-700">${s.uptime}%</p>
<p class="text-xs text-slate-400">uptime</p>
</div>
</div>
</div>
</div>`;
}).join('');
}
poll();
setInterval(poll, 5000);
</script>
"""

Key patterns: Global health indicator, per-service status icons, latency color coding, 5-second polling, no auth required.


Filtered Orders Table

A page that reads URL query parameters for tab-based filtering with a clean data table.

from abstra.pages import register_function, get_query_params
from abstra.tables import select

@register_function
def get_orders(status: str):
where = {"status": status} if status and status != "all" else {}
orders = select("orders", where=where)
return [{"id": o["id"], "customer": o["customer"], "total": o["total_cents"]/100, "status": o["status"], "date": str(o["created_at"])} for o in orders]

@register_function
def __render__():
params = get_query_params()
current = params.get("status", "all")
tabs = [("all","All Orders"), ("pending","Pending"), ("completed","Completed"), ("cancelled","Cancelled")]
tab_html = "".join(
f'<a href="?status={val}" class="px-4 py-2 text-sm font-medium rounded-lg transition-colors '
f'{"bg-indigo-600 text-white shadow-sm" if current == val else "text-slate-500 hover:bg-slate-100"}">{label}</a>'
for val, label in tabs
)
return f"""
<script src="https://cdn.tailwindcss.com"></script>
<style>body {{ margin:0; font-family:'Inter',system-ui,sans-serif; background:#f8fafc; }}</style>
<div class="min-h-screen p-8 max-w-5xl mx-auto">
<div class="flex items-center justify-between mb-8">
<h1 class="text-2xl font-bold text-slate-800">Orders</h1>
<div class="flex gap-1 bg-slate-100 p-1 rounded-xl">{tab_html}</div>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-slate-100 overflow-hidden">
<div id="table-content">
<div class="flex justify-center py-12"><div class="animate-spin w-6 h-6 border-2 border-indigo-600 border-t-transparent rounded-full"></div></div>
</div>
</div>
</div>
<script>
const fmt = n => new Intl.NumberFormat('pt-BR',{{style:'currency',currency:'BRL'}}).format(n);
const statusStyles = {{
pending: 'bg-amber-50 text-amber-700',
completed: 'bg-emerald-50 text-emerald-700',
cancelled: 'bg-rose-50 text-rose-700',
}};
async function load() {{
const orders = await get_orders("{current}");
const el = document.getElementById('table-content');
if (!orders.length) {{
el.innerHTML = '<div class="text-center py-16 text-slate-400"><p class="font-medium">No orders found</p><p class="text-sm mt-1">Try a different filter</p></div>';
return;
}}
el.innerHTML = `<table class="w-full text-sm">
<thead><tr class="text-left text-xs font-semibold text-slate-400 uppercase tracking-wider border-b border-slate-100">
<th class="px-6 py-3">Order</th><th class="px-6 py-3">Customer</th>
<th class="px-6 py-3">Date</th><th class="px-6 py-3 text-right">Total</th>
<th class="px-6 py-3">Status</th>
</tr></thead>
<tbody>${{orders.map(o => `<tr class="border-b border-slate-50 hover:bg-slate-50/50 transition-colors">
<td class="px-6 py-4 font-mono text-xs text-slate-500">#${{o.id.slice(0,8)}}</td>
<td class="px-6 py-4 font-medium text-slate-700">${{o.customer}}</td>
<td class="px-6 py-4 text-slate-400">${{o.date}}</td>
<td class="px-6 py-4 text-right font-mono tabular-nums">${{fmt(o.total)}}</td>
<td class="px-6 py-4"><span class="text-xs font-medium px-2.5 py-1 rounded-full ${{statusStyles[o.status] || 'bg-slate-50 text-slate-600'}}">${{o.status}}</span></td>
</tr>`).join('')}}</tbody>
</table>`;
}}
load();
</script>
"""

Key patterns: get_query_params() for server-side filter state, pill-style tab navigation, status badges, empty state, formatted currency.