new changes in api base url

This commit is contained in:
2026-07-09 15:49:45 +05:30
parent 7cd0ae85ef
commit 4ef9cd9085
29 changed files with 2714 additions and 1191 deletions

View File

@@ -27,7 +27,7 @@ interface OrdersViewProps {
locationid?: number;
/** Merchant tenant to scope to; defaults to the shared constant. */
tenantId?: number;
headerTabs?: React.ReactNode;
date?: string;
}
type StatusKey = 'created' | 'pending' | 'processing' | 'delivered' | 'cancelled';
@@ -40,11 +40,19 @@ const STATUS_TABS: Array<{ key: StatusKey; label: string }> = [
];
const PAGE_SIZE = 25;
export default function OrdersView({ searchQuery = '', locationid, tenantId = FIESTA_TENANT_ID, headerTabs }: OrdersViewProps) {
export default function OrdersView({ searchQuery = '', locationid, tenantId = FIESTA_TENANT_ID, date }: OrdersViewProps) {
const today = new Date();
const monthStart = new Date(today.getFullYear(), today.getMonth(), 1);
const [fromdate, setFromdate] = useState<string>(ymd(today));
const [todate, setTodate] = useState<string>(ymd(today));
const [fromdate, setFromdate] = useState<string>(date || ymd(today));
const [todate, setTodate] = useState<string>(date || ymd(today));
// Sync internal date range if the prop changes from the Hub header
useEffect(() => {
if (date) {
setFromdate(date);
setTodate(date);
}
}, [date]);
const dayOffset = (n: number) => { const d = new Date(); d.setDate(d.getDate() - n); return ymd(d); };
const dayAhead = (n: number) => { const d = new Date(); d.setDate(d.getDate() + n); return ymd(d); };
@@ -256,27 +264,10 @@ export default function OrdersView({ searchQuery = '', locationid, tenantId = FI
return (
<div className="animate-in fade-in duration-300">
<GradientHeader
title="Orders Board"
subtitle="End-to-end lifecycle tracking for current operational period."
status={
ordersQ.isLoading
? <LiveStatus state="loading" label="Loading live orders…" />
: ordersQ.isError
? <LiveStatus state="error" label="Live data unavailable" />
: <LiveStatus state="live" label={`Live · ${total.toLocaleString('en-IN')} orders in range`} />
}
right={
<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>
}
/>
<div className="mb-4">
<div className="mb-4"><KpiStrip items={kpis} loading={summaryQ.isLoading} /></div>
<KpiStrip items={kpis} loading={summaryQ.isLoading} />
</div>
{/* Date filter */}
<FilterBar className="mb-4">