= ({ icon, dewar, isSe
};
const { iconIndex, color } = getIconProperties(icon, dewar);
- const IconComponent = ICONS[iconIndex];
return (
= ({ icon, dewar, isSe
active={Boolean(rest['aria-activedescendant'])}
error={rest.role === 'error'}
>
- {IconComponent
- ? React.cloneElement(IconComponent, iconIndex === 0 ? { fill: color } : {})
- : Invalid icon
- }
+
+ {ICONS[iconIndex]?.({
+ style: iconIndex === 0 ? { fill: color } : undefined,
+ }) ?? Invalid icon}
+
-
+ {icon === 0 && (
+
+ )}
);
};
-
// Icon properties retrieval based on the status and icon number
const getIconProperties = (icon: number, dewar: Dewar) => {
const status = dewar.status as DewarStatus;
@@ -166,16 +194,41 @@ const CustomStepper: React.FC = ({ dewar, selectedDewarId, r
{steps.map((label, index) => (
}
+ StepIconComponent={(stepProps) => (
+
+ )}
>
- {label}
+
+ {/* Step label */}
+
+ {label}
+
+
+ {/* Optional: Date below the step */}
+
+ {index === 0
+ ? dewar.ready_date
+ : index === 1
+ ? dewar.shipping_date
+ : index === 2
+ ? dewar.arrival_date
+ : index === 3
+ ? dewar.returning_date
+ : ''}
+
-
- {index === 0 ? dewar.ready_date :
- index === 1 ? dewar.shipping_date :
- index === 2 ? dewar.arrival_date :
- index === 3 ? dewar.returning_date : ''}
-
))}
diff --git a/frontend/src/components/ShipmentDetails.tsx b/frontend/src/components/ShipmentDetails.tsx
index 77ccad1..0523184 100644
--- a/frontend/src/components/ShipmentDetails.tsx
+++ b/frontend/src/components/ShipmentDetails.tsx
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
-import { Box, Typography, Button, Stack, TextField, IconButton, Grid } from '@mui/material';
+import {Box, Typography, Button, Stack, TextField, IconButton, Grid, Chip} from '@mui/material';
import QRCode from 'react-qr-code';
import DeleteIcon from "@mui/icons-material/Delete";
import CheckIcon from '@mui/icons-material/Check';
@@ -8,6 +8,9 @@ import { Dewar, DewarsService, Shipment, Contact, ApiError, ShipmentsService } f
import { SxProps } from "@mui/system";
import CustomStepper from "./DewarStepper";
import DewarDetails from './DewarDetails';
+import { PuckDetailsVisual } from '../assets/icons/SimplePuckIcon';
+import CrystalFacetedIcon from "../assets/icons/CrystalIcon.tsx";
+
const MAX_COMMENTS_LENGTH = 200;
@@ -183,6 +186,39 @@ const ShipmentDetails: React.FC = ({
const isCommentsEdited = comments !== initialComments;
const contact = selectedShipment?.contact;
+ const renderPgroupChips = () => {
+ // Safely handle pgroups as an array
+ const pgroupsArray = Array.isArray(selectedShipment?.pgroups)
+ ? selectedShipment.pgroups
+ : selectedShipment?.pgroups?.split(",").map((pgroup: string) => pgroup.trim()) || [];
+
+ if (!pgroupsArray.length) {
+ return No associated pgroups;
+ }
+
+ return pgroupsArray.map((pgroup: string) => (
+
+ ));
+ };
+
return (
{!localSelectedDewar && !isAddingDewar && (
@@ -229,6 +265,9 @@ const ShipmentDetails: React.FC = ({
{selectedShipment.shipment_name}
+
+ {renderPgroupChips()}
+
Main contact person: {contact ? `${contact.firstname} ${contact.lastname}` : 'N/A'}
@@ -293,46 +332,78 @@ const ShipmentDetails: React.FC = ({
border: localSelectedDewar?.id === dewar.id ? '2px solid #000' : undefined,
}}
>
-
- {dewar.unique_id ? (
-
- ) : (
-
- No QR Code
+
+ {/* Left: QR Code */}
+
+ {dewar.unique_id ? (
+
+ ) : (
+
+ No QR Code
+
+ )}
+
+
+ {/* Middle-Left: Dewar Information */}
+
+
+ {dewar.dewar_name}
+
+
+
+
+
+ {dewar.number_of_samples || 0} Samples
+
- )}
-
+
-
- {dewar.dewar_name}
- Number of Pucks: {dewar.number_of_pucks || 0}
- Number of Samples: {dewar.number_of_samples || 0}
- Tracking Number: {dewar.tracking_number}
-
- Contact Person: {dewar.contact?.firstname ? `${dewar.contact.firstname} ${dewar.contact.lastname}` : 'N/A'}
-
-
-
-
-
+ {/* Middle-Right: Contact and Return Information */}
+
+
+ Contact Person: {dewar.contact?.firstname ? `${dewar.contact.firstname} ${dewar.contact.lastname}` : 'N/A'}
+
+
+ Return Address: {dewar.return_address?.house_number
+ ? `${dewar.return_address.street}, ${dewar.return_address.city}`
+ : 'N/A'}
+
+
+ {/* Right: Stepper */}
+
+
+
+
{localSelectedDewar?.id === dewar.id && (
{