weekend update

This commit is contained in:
Gokul
2026-06-12 18:04:10 +05:30
parent 0519e3b19c
commit 896561245d
8 changed files with 235 additions and 157 deletions

View File

@@ -27,6 +27,7 @@ interface OrdersViewProps {
locationid?: number;
/** Merchant tenant to scope to; defaults to the shared constant. */
tenantId?: number;
headerTabs?: React.ReactNode;
}
type StatusKey = 'created' | 'pending' | 'processing' | 'delivered' | 'cancelled';
@@ -39,7 +40,7 @@ const STATUS_TABS: Array<{ key: StatusKey; label: string }> = [
];
const PAGE_SIZE = 25;
export default function OrdersView({ searchQuery = '', locationid, tenantId = FIESTA_TENANT_ID }: OrdersViewProps) {
export default function OrdersView({ searchQuery = '', locationid, tenantId = FIESTA_TENANT_ID, headerTabs }: OrdersViewProps) {
const today = new Date();
const monthStart = new Date(today.getFullYear(), today.getMonth(), 1);
const [fromdate, setFromdate] = useState<string>(ymd(today));
@@ -54,6 +55,7 @@ export default function OrdersView({ searchQuery = '', locationid, tenantId = FI
// a wide window — from the platform's earliest plausible data to a year ahead.
const presets = [
{ key: 'today', label: 'Today', from: ymd(today), to: ymd(today) },
{ key: 'yesterday', label: 'Yesterday', from: dayOffset(1), to: dayOffset(1) },
{ key: '7d', label: 'Last 7 Days', from: dayOffset(6), to: ymd(today) },
{ key: 'month', label: 'This Month', from: ymd(monthStart), to: dayAhead(7) },
];
@@ -252,8 +254,8 @@ export default function OrdersView({ searchQuery = '', locationid, tenantId = FI
return (
<div className="animate-in fade-in duration-300">
<GradientHeader
title="Orders"
subtitle="Live order board across the lifecycle — created, pending, processing, delivered, and cancelled."
title="Orders Board"
subtitle="End-to-end lifecycle tracking for current operational period."
status={
ordersQ.isLoading
? <LiveStatus state="loading" label="Loading live orders…" />
@@ -262,9 +264,12 @@ export default function OrdersView({ searchQuery = '', locationid, tenantId = FI
: <LiveStatus state="live" label={`Live · ${total.toLocaleString('en-IN')} orders in range`} />
}
right={
<span className="inline-flex items-center gap-1.5 rounded-full font-extrabold" style={{ padding: '6px 12px', fontSize: 12, background: tint(BRAND), border: `1.5px solid ${edge(BRAND)}`, color: BRAND }}>
<MapPin size={13} /> Coimbatore
</span>
<div className="flex items-center gap-3">
{headerTabs}
<span className="inline-flex items-center gap-1.5 rounded-full font-extrabold" style={{ padding: '6px 12px', fontSize: 12, background: tint(BRAND), border: `1.5px solid ${edge(BRAND)}`, color: BRAND }}>
<MapPin size={13} /> Coimbatore
</span>
</div>
}
/>