feat(F-148): completed feature
This commit is contained in:
45
work/artifacts/F-148/architect.md
Normal file
45
work/artifacts/F-148/architect.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# F-148 — Architect
|
||||
|
||||
## Feature
|
||||
Admin: sales dashboard and channel views.
|
||||
|
||||
## Background
|
||||
F-146 implementó ReportingService (summary + sales endpoints). F-147 creó la shell admin (filters, KPI grid, dataAvailability). F-148 presenta los datos reales en un dashboard con tendencias, desglose por canal y ranking de tiendas/terminales.
|
||||
|
||||
## Objetivo
|
||||
- Dashboard `/reporting/dashboard` con:
|
||||
- Tendencias de ventas (bar chart por día/semana)
|
||||
- Desglose por canal (ecommerce vs POS vs admin)
|
||||
- Top tiendas por ventas
|
||||
- Top terminales POS
|
||||
- Reusar: DateRangePicker de F-147, reporting-client.ts
|
||||
|
||||
## Diseño
|
||||
|
||||
### Tendencias (bar chart SVG)
|
||||
- Fetch `/api/reporting/sales?groupBy=day&pageSize=90` (últimos 90 días)
|
||||
- Render barras SVG con altura proporcional al grossSalesCents
|
||||
- Tooltip on hover (día + importe)
|
||||
- Período configurable (7d / 30d / 90d)
|
||||
|
||||
### Desglose por canal
|
||||
- Fetch con `groupBy=channel`
|
||||
- Mostrar 3 cards: ecommerce / POS / admin
|
||||
- Cada una con: importe total, % del total, número de pedidos
|
||||
|
||||
### Top tiendas
|
||||
- Fetch con `groupBy=store&pageSize=10`
|
||||
- Tabla: tienda, pedidos, importe, % del total
|
||||
- Solo se muestra si el usuario tiene acceso a múltiples tiendas
|
||||
|
||||
### Top terminales
|
||||
- Fetch con `groupBy=terminal&pageSize=10`
|
||||
- Tabla: terminal, tienda, pedidos, importe
|
||||
|
||||
## Acceptance Criteria
|
||||
AC1: Dashboard muestra tendencias con barra SVG.
|
||||
AC2: Desglose por canal muestra ecommerce/POS/admin con %.
|
||||
AC3: Top tiendas con tabla ordenada por importe.
|
||||
AC4: Filtros de rango de fechas y canal (reutiliza DateRangePicker de F-147).
|
||||
AC5: Estados loading/empty/error explícitos.
|
||||
AC6: tsc 0, verify.sh verde.
|
||||
4
work/artifacts/F-148/documenter.md
Normal file
4
work/artifacts/F-148/documenter.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# F-148 — Documenter evidence
|
||||
|
||||
## Scope of documentation change
|
||||
F-148 implements the sales dashboard described in `docs/reporting/REPORTING_ARCHITECTURE.md` §8 (Frontend Admin): `SalesChart`, `ChannelBreakdown`, `ReportingTable` components. The architecture doc already describes these; no doc update needed. Scope zero for documenter.
|
||||
23
work/artifacts/F-148/implementer.md
Normal file
23
work/artifacts/F-148/implementer.md
Normal file
@@ -0,0 +1,23 @@
|
||||
# F-148 — Implementer evidence
|
||||
|
||||
## What
|
||||
F-148 build evidence: Admin reporting dashboard with sales trends (SVG bar chart), channel breakdown (ecommerce/POS/admin), and top stores/terminals tables. Built on F-147 DateRangePicker and F-146 ReportingService.
|
||||
|
||||
## Files
|
||||
- `apps/admin/src/app/(dashboard)/reporting/dashboard/page.tsx` (created) — main dashboard
|
||||
- `apps/admin/src/components/reporting/TrendChart.tsx` (created) — SVG bar chart
|
||||
- `apps/admin/src/components/reporting/ChannelBreakdown.tsx` (created) — channel cards
|
||||
|
||||
## Verification
|
||||
- `npx tsc --noEmit` (admin app) → 0 TypeScript errors.
|
||||
- `./scripts/verify.sh` → green (F-148 in_progress, runtime-consistent).
|
||||
|
||||
## AC traceability
|
||||
| AC | Estado | Evidencia |
|
||||
|----|--------|-----------|
|
||||
| AC1 trend chart | ✅ | TrendChart.tsx SVG bar chart from sales groupBy=day data |
|
||||
| AC2 channel breakdown | ✅ | ChannelBreakdown.tsx shows ecommerce/POS/admin cards with % bar |
|
||||
| AC3 top stores table | ✅ | StoresTable fetches groupBy=store, sorted by grossSalesCents |
|
||||
| AC4 date/channel filters | ✅ | Reuses DateRangePicker + channel selector; URL persistence |
|
||||
| AC5 loading/empty/error | ✅ | Per-section loading skeletons, error messages |
|
||||
| AC6 tsc/verify | ✅ | tsc 0, verify verde |
|
||||
12
work/artifacts/F-148/leader-close.json
Normal file
12
work/artifacts/F-148/leader-close.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"feature_id": "F-148",
|
||||
"agent": "leader",
|
||||
"stage": "close",
|
||||
"verdict": "APPROVED",
|
||||
"summary": "F-148 completed: sales dashboard with trend SVG chart, channel breakdown, top stores/terminals tables. tsc 0, verify.sh green.",
|
||||
"checks": [
|
||||
{"item": "Gates approved", "ok": true, "evidence": "reviewer.json, security.json, qa.json -> APPROVED"},
|
||||
{"item": "verify.sh", "ok": true, "evidence": "exit 0"}
|
||||
],
|
||||
"issues": []
|
||||
}
|
||||
12
work/artifacts/F-148/qa.json
Normal file
12
work/artifacts/F-148/qa.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"feature_id": "F-148",
|
||||
"agent": "qa",
|
||||
"stage": "qa_gate",
|
||||
"verdict": "APPROVED",
|
||||
"summary": "tsc 0 (admin app); verify.sh green. No regressions.",
|
||||
"checks": [
|
||||
{"item": "tsc 0", "ok": true, "evidence": "npx tsc --noEmit 0 errors"},
|
||||
{"item": "verify.sh", "ok": true, "evidence": "exit 0"}
|
||||
],
|
||||
"issues": []
|
||||
}
|
||||
16
work/artifacts/F-148/reviewer.json
Normal file
16
work/artifacts/F-148/reviewer.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"feature_id": "F-148",
|
||||
"agent": "reviewer",
|
||||
"stage": "review_gate",
|
||||
"verdict": "APPROVED",
|
||||
"summary": "Reporting dashboard with trend SVG chart, channel breakdown cards, top stores/terminals tables. All sections have loading skeletons and error handling. Filters reuse DateRangePicker from F-147. tsc 0, verify.sh green.",
|
||||
"checks": [
|
||||
{"item": "AC1 trend chart", "ok": true, "evidence": "TrendChart.tsx renders SVG bars; fetches groupBy=day; tooltip on hover"},
|
||||
{"item": "AC2 channel breakdown", "ok": true, "evidence": "ChannelBreakdown.tsx shows ecommerce/POS/admin cards with sales amount + % bar + order count"},
|
||||
{"item": "AC3 top stores", "ok": true, "evidence": "StoresTable fetches groupBy=store, sorts by grossSalesCents desc, shows % of total"},
|
||||
{"item": "AC4 filters", "ok": true, "evidence": "Reuses DateRangePicker; channel + trend period selectors; URL persistence"},
|
||||
{"item": "AC5 loading/error", "ok": true, "evidence": "Per-section animate-pulse skeletons; error messages per section"},
|
||||
{"item": "tsc/verify", "ok": true, "evidence": "tsc --noEmit 0 errors; verify.sh green"}
|
||||
],
|
||||
"issues": []
|
||||
}
|
||||
13
work/artifacts/F-148/security.json
Normal file
13
work/artifacts/F-148/security.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"feature_id": "F-148",
|
||||
"agent": "security",
|
||||
"stage": "security_gate",
|
||||
"verdict": "APPROVED",
|
||||
"summary": "Frontend-only admin dashboard. All data fetching uses existing reporting-client (authenticated via /api/* proxy). No new auth, no new secrets, no user input in queries.",
|
||||
"checks": [
|
||||
{"item": "No new auth paths", "ok": true, "evidence": "Same auth as F-147 admin app"},
|
||||
{"item": "No user input in queries", "ok": true, "evidence": "All data via reporting-client (typed API calls)"},
|
||||
{"item": "No new secrets", "ok": true, "evidence": "No env vars or credentials added"}
|
||||
],
|
||||
"issues": []
|
||||
}
|
||||
Reference in New Issue
Block a user