e2e testing

This commit is contained in:
Gokul
2026-06-15 19:17:13 +05:30
parent 896561245d
commit 01685f14c2
18 changed files with 1102 additions and 198 deletions

View File

@@ -35,7 +35,8 @@ const str = (v: unknown): string => (v == null ? '' : String(v));
export default function DashboardView({ searchQuery, tenantId = FIESTA_TENANT_ID }: DashboardViewProps) {
// Live data — month-to-date order summary + tenant identity + store locations.
const today = new Date();
const monthStart = new Date(today.getFullYear(), today.getMonth(), 1);
const monthStart = new Date(today);
monthStart.setDate(today.getDate() - 30); // Last 30 days to include May orders
const fromdate = ymd(monthStart);
const todate = ymd(today);
@@ -54,10 +55,10 @@ export default function DashboardView({ searchQuery, tenantId = FIESTA_TENANT_ID
// returns two distinct figures (revenue and profit); we surface both rather than
// repeating one. When the tenant has no invoice records we show "—" instead of a
// misleading ₹0.
const insight = insightQ.data;
const insight = insightQ.data as any;
const money = (v: number | null) => (v == null ? '—' : `${Math.round(v).toLocaleString('en-IN')}`);
const monthlyRevenue = insight ? insight.revenue : null;
const monthlyProfit = insight ? insight.profit : null;
const monthlyRevenue = insight ? Number(insight.grossrevenue || insight.overallrevenue || insight.revenue || 0) : null;
const monthlyProfit = insight ? Number(insight.profit || insight.netrevenue || insight.margin || 0) : null;
const locSummaryQ = useFiestaLocationSummary(tenantId);
const summaries = locSummaryQ.data ?? [];