Co-authored-by: wolfoftyreso-debug <250630591+wolfoftyreso-debug@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-07-11 13:57:43 +00:00
parent 8b554bb16c
commit 3c79784ff4
+33 -8
View File
@@ -93,6 +93,7 @@ export function OrdersTable() {
<TableRow> <TableRow>
<TableHead>Ordernummer</TableHead> <TableHead>Ordernummer</TableHead>
<TableHead>Kund</TableHead> <TableHead>Kund</TableHead>
<TableHead>Leveransadress</TableHead>
<TableHead>Datum</TableHead> <TableHead>Datum</TableHead>
<TableHead>Status</TableHead> <TableHead>Status</TableHead>
<TableHead className="text-right">Belopp</TableHead> <TableHead className="text-right">Belopp</TableHead>
@@ -101,33 +102,57 @@ export function OrdersTable() {
<TableBody> <TableBody>
{filteredOrders?.length === 0 ? ( {filteredOrders?.length === 0 ? (
<TableRow> <TableRow>
<TableCell colSpan={5} className="text-center py-8 text-muted-foreground"> <TableCell colSpan={6} className="text-center py-8 text-muted-foreground">
Inga ordrar hittades Inga ordrar hittades
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
filteredOrders?.map((order) => ( filteredOrders?.map((order) => {
const item = Array.isArray(order.items) ? order.items[0] : null;
const lev = item?.leverans;
const phone = item?.telefon;
const comments = item?.kommentarer;
return (
<TableRow key={order.id}> <TableRow key={order.id}>
<TableCell className="font-medium">{order.order_number}</TableCell> <TableCell className="font-medium align-top">{order.order_number}</TableCell>
<TableCell> <TableCell className="align-top">
<div> <div>
<div className="font-medium">{order.customer_name || "—"}</div> <div className="font-medium">{order.customer_name || "—"}</div>
<div className="text-sm text-muted-foreground">{order.customer_email}</div> <div className="text-sm text-muted-foreground">{order.customer_email}</div>
{phone && <div className="text-sm text-muted-foreground">{phone}</div>}
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell className="align-top">
{lev ? (
<div className="text-sm">
<div>{lev.adress || "—"}</div>
<div className="text-muted-foreground">
{[lev.postnummer, lev.stad].filter(Boolean).join(" ")}
</div>
{comments && (
<div className="text-xs text-muted-foreground mt-1 italic">
"{comments}"
</div>
)}
</div>
) : (
<span className="text-muted-foreground text-sm"></span>
)}
</TableCell>
<TableCell className="align-top">
{format(new Date(order.created_at), "d MMM yyyy, HH:mm", { locale: sv })} {format(new Date(order.created_at), "d MMM yyyy, HH:mm", { locale: sv })}
</TableCell> </TableCell>
<TableCell> <TableCell className="align-top">
<Badge variant="outline" className={statusColors[order.status] || ""}> <Badge variant="outline" className={statusColors[order.status] || ""}>
{statusLabels[order.status] || order.status} {statusLabels[order.status] || order.status}
</Badge> </Badge>
</TableCell> </TableCell>
<TableCell className="text-right font-medium"> <TableCell className="text-right font-medium align-top">
{Number(order.total_amount).toLocaleString("sv-SE")} {order.currency} {Number(order.total_amount).toLocaleString("sv-SE")} {order.currency}
</TableCell> </TableCell>
</TableRow> </TableRow>
)) );
})
)} )}
</TableBody> </TableBody>
</Table> </Table>