feat: add location handling for TTO orders and update related components
This commit is contained in:
@@ -53,14 +53,14 @@ async function OrdersPage() {
|
||||
/>
|
||||
<PageBody>
|
||||
{medusaOrders.map((medusaOrder) => {
|
||||
const analysisOrder = analysisOrders.find(
|
||||
({ medusa_order_id }) => medusa_order_id === medusaOrder.id,
|
||||
);
|
||||
|
||||
if (!medusaOrder) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const analysisOrder = analysisOrders.find(
|
||||
({ medusa_order_id }) => medusa_order_id === medusaOrder.id,
|
||||
);
|
||||
|
||||
const medusaOrderItems = medusaOrder.items || [];
|
||||
const medusaOrderItemsAnalysisPackages = medusaOrderItems.filter(
|
||||
(item) => item.product_type_id === analysisPackagesTypeId,
|
||||
|
||||
@@ -11,6 +11,7 @@ import OrderItemsTable from './order-items-table';
|
||||
|
||||
export default function OrderBlock({
|
||||
analysisOrder,
|
||||
ttoLocation,
|
||||
medusaOrderStatus,
|
||||
itemsAnalysisPackage,
|
||||
itemsTtoService,
|
||||
@@ -18,6 +19,7 @@ export default function OrderBlock({
|
||||
medusaOrderId,
|
||||
}: {
|
||||
analysisOrder?: AnalysisOrder;
|
||||
ttoLocation?: { name: string };
|
||||
medusaOrderStatus: string;
|
||||
itemsAnalysisPackage: StoreOrderLineItem[];
|
||||
itemsTtoService: StoreOrderLineItem[];
|
||||
@@ -67,6 +69,7 @@ export default function OrderBlock({
|
||||
order={{
|
||||
status: medusaOrderStatus.toUpperCase(),
|
||||
medusaOrderId,
|
||||
location: ttoLocation?.name,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -61,6 +61,11 @@ export default function OrderItemsTable({
|
||||
<TableHead className="px-6">
|
||||
<Trans i18nKey="orders:table.createdAt" />
|
||||
</TableHead>
|
||||
{order.location && (
|
||||
<TableHead className="px-6">
|
||||
<Trans i18nKey="orders:table.location" />
|
||||
</TableHead>
|
||||
)}
|
||||
<TableHead className="px-6">
|
||||
<Trans i18nKey="orders:table.status" />
|
||||
</TableHead>
|
||||
@@ -83,7 +88,11 @@ export default function OrderItemsTable({
|
||||
<TableCell className="px-6 whitespace-nowrap">
|
||||
{formatDate(orderItem.created_at, 'dd.MM.yyyy HH:mm')}
|
||||
</TableCell>
|
||||
|
||||
{order.location && (
|
||||
<TableCell className="min-w-[180px] px-6">
|
||||
{order.location}
|
||||
</TableCell>
|
||||
)}
|
||||
<TableCell className="min-w-[180px] px-6">
|
||||
<Trans
|
||||
i18nKey={`orders:status.${type}.${order?.status ?? 'CONFIRMED'}`}
|
||||
|
||||
Reference in New Issue
Block a user