feat: Add 'ready_for_pickup' status to OrdersTab and implement corresponding translations across multiple locales

This commit is contained in:
sebseb7
2026-03-24 06:15:34 +01:00
parent a9bf1aee5f
commit e6f3fb7c18
24 changed files with 262 additions and 22 deletions

View File

@@ -25,6 +25,7 @@ import SearchIcon from "@mui/icons-material/Search";
import CancelIcon from "@mui/icons-material/Cancel";
import OrderDetailsDialog from "./OrderDetailsDialog.js";
import WireOrderGirocode from "./WireOrderGirocode.js";
import ReadyForPickupNotice from "./ReadyForPickupNotice.js";
import {
isWireGirocodeEligible,
hasPendingWirePaymentOrder,
@@ -42,6 +43,7 @@ const getStatusTranslation = (status, t) => {
shipped: t ? t('orders.status.shipped') : "Verschickt",
delivered: t ? t('orders.status.delivered') : "Geliefert",
awaiting_tracking: t ? t('orders.status.awaiting_tracking') : "Wird gepackt",
ready_for_pickup: t ? t('orders.status.ready_for_pickup') : "Abholbereit",
};
return statusMap[status] || status;
};
@@ -55,6 +57,7 @@ const statusEmojis = {
shipped: "🚚",
delivered: "✅",
awaiting_tracking: "📦",
ready_for_pickup: "🏪",
};
const statusColors = {
@@ -66,6 +69,7 @@ const statusColors = {
shipped: "#2e7d32", // green
delivered: "#2e7d32", // green
awaiting_tracking: "#1565c0", // blue — packing / pre-ship
ready_for_pickup: "#2e7d32", // green — ready at store
};
const currencyFormatter = new Intl.NumberFormat("de-DE", {
@@ -334,6 +338,22 @@ const OrdersTab = ({ orderIdFromHash, t }) => {
</TableCell>
</TableRow>
)}
{order.status === "ready_for_pickup" && (
<TableRow>
<TableCell
colSpan={6}
sx={{
py: 2,
px: { xs: 1, sm: 2 },
verticalAlign: "top",
bgcolor: "action.hover",
borderTop: (theme) => `1px solid ${theme.palette.divider}`,
}}
>
<ReadyForPickupNotice order={order} t={t} />
</TableCell>
</TableRow>
)}
</Fragment>
);
})}

View File

@@ -0,0 +1,44 @@
import React from "react";
import { Box, Typography } from "@mui/material";
/**
* Store pickup instructions when order status is ready_for_pickup.
*/
const ReadyForPickupNotice = ({ order, t }) => {
return (
<Box
sx={{
p: 1.5,
borderRadius: 1,
bgcolor: (theme) =>
theme.palette.mode === "dark"
? "rgba(46, 125, 50, 0.18)"
: "rgba(46, 125, 50, 0.08)",
border: "1px solid",
borderColor: "success.main",
}}
>
<Typography variant="body2" sx={{ mb: 1, lineHeight: 1.5 }}>
{t
? t("orders.readyForPickup.line1", { orderId: order.orderId })
: `Deine Bestellung ${order.orderId} ist gepackt und wartet auf dich.`}
</Typography>
<Typography variant="body2" sx={{ mb: 1, lineHeight: 1.5 }}>
{t
? t("orders.readyForPickup.line2")
: "Du kannst sie ab sofort bei uns im Store abholen:"}
</Typography>
<Typography variant="body2" fontWeight="bold">
{t ? t("orders.readyForPickup.storeName") : "Growheads"}
</Typography>
<Typography variant="body2">
{t ? t("orders.readyForPickup.addressLine1") : "Trachenberger Straße 14"}
</Typography>
<Typography variant="body2">
{t ? t("orders.readyForPickup.addressLine2") : "01129 Dresden"}
</Typography>
</Box>
);
};
export default ReadyForPickupNotice;