feat(dashboard): add QR code support to fuel attention items and alerts
- Updated FuelAttentionItem type to include qrCodeId for better tracking. - Enhanced loadOverview function to fetch and include qrCodeId in vehicle data. - Modified UI components in dashboard and fuel-view to display QR code information when available, improving visibility for users.
This commit is contained in:
parent
488f38ad38
commit
fca95ef4bd
2 changed files with 26 additions and 1 deletions
|
|
@ -648,6 +648,11 @@ function AlertCard({ v, href }: { v: VehicleSummary; href: string }) {
|
|||
</span>
|
||||
<span className="truncate font-medium">{v.description}</span>
|
||||
</div>
|
||||
{v.qrCodeId && (
|
||||
<p className="ml-9 mt-1 font-mono text-[10px] text-muted-foreground">
|
||||
QR {v.qrCodeId}
|
||||
</p>
|
||||
)}
|
||||
<Badge variant="outline" className="mt-2 font-mono text-xs">
|
||||
{v.projectCode || "—"}
|
||||
</Badge>
|
||||
|
|
@ -708,6 +713,11 @@ function AlertListRow({ v, href }: { v: VehicleSummary; href: string }) {
|
|||
/>
|
||||
<div className="flex min-w-0 items-center gap-2">
|
||||
<span className="truncate font-medium">{v.description}</span>
|
||||
{v.qrCodeId && (
|
||||
<span className="hidden shrink-0 font-mono text-[10px] text-muted-foreground sm:inline">
|
||||
QR {v.qrCodeId}
|
||||
</span>
|
||||
)}
|
||||
<Badge variant="outline" className="shrink-0 font-mono text-[10px]">
|
||||
{v.projectCode || "—"}
|
||||
</Badge>
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ type FuelAttentionItem = {
|
|||
vehicleId: string;
|
||||
description: string;
|
||||
projectCode: string;
|
||||
qrCodeId: string;
|
||||
alert: number;
|
||||
warn: number;
|
||||
href: string;
|
||||
|
|
@ -124,7 +125,14 @@ async function loadOverview() {
|
|||
// Per-vehicle flagged counts.
|
||||
const flaggedByVehicle = new Map<
|
||||
string,
|
||||
{ alert: number; warn: number; siteId: string; description: string; projectCode: string }
|
||||
{
|
||||
alert: number;
|
||||
warn: number;
|
||||
siteId: string;
|
||||
description: string;
|
||||
projectCode: string;
|
||||
qrCodeId: string;
|
||||
}
|
||||
>();
|
||||
for (const [vehicleId, list] of logsByVehicle) {
|
||||
const veh = list[0]?.expand?.vehicle;
|
||||
|
|
@ -151,6 +159,7 @@ async function loadOverview() {
|
|||
siteId,
|
||||
description: veh?.description ?? "(unknown vehicle)",
|
||||
projectCode: veh?.project_code ?? "",
|
||||
qrCodeId: veh?.qr_code_id ?? "",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -184,6 +193,7 @@ async function loadOverview() {
|
|||
vehicleId,
|
||||
description: info.description,
|
||||
projectCode: info.projectCode,
|
||||
qrCodeId: info.qrCodeId,
|
||||
alert: info.alert,
|
||||
warn: info.warn,
|
||||
href: `/dashboard/fuel/${vehicleId}`,
|
||||
|
|
@ -543,6 +553,11 @@ function AttentionItemRow({ item }: { item: FuelAttentionItem }) {
|
|||
<span className="min-w-0 flex-1 truncate font-medium">
|
||||
{item.description}
|
||||
</span>
|
||||
{item.qrCodeId && (
|
||||
<span className="hidden shrink-0 font-mono text-[10px] text-muted-foreground lg:inline">
|
||||
QR {item.qrCodeId}
|
||||
</span>
|
||||
)}
|
||||
<Badge variant="outline" className="hidden font-mono text-[10px] sm:inline-flex">
|
||||
{item.projectCode}
|
||||
</Badge>
|
||||
|
|
|
|||
Loading…
Reference in a new issue