mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 13:28:11 +00:00
Merge pull request #1038 from Tria-plc/edrmiles
Empty container enhancement
This commit is contained in:
@@ -558,6 +558,7 @@ interface StandaloneReturnModalProps {
|
|||||||
|
|
||||||
function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: StandaloneReturnModalProps) {
|
function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: StandaloneReturnModalProps) {
|
||||||
const [containerNumber, setContainerNumber] = useState<string>("");
|
const [containerNumber, setContainerNumber] = useState<string>("");
|
||||||
|
const [returnedBy, setReturnedBy] = useState<"EDR" | "CUSTOMER" | null>(null);
|
||||||
const [returnDate, setReturnDate] = useState<string>(new Date().toISOString().split("T")[0]);
|
const [returnDate, setReturnDate] = useState<string>(new Date().toISOString().split("T")[0]);
|
||||||
const [warehouse, setWarehouse] = useState<string | null>(null);
|
const [warehouse, setWarehouse] = useState<string | null>(null);
|
||||||
const [yard, setYard] = useState<string>("");
|
const [yard, setYard] = useState<string>("");
|
||||||
@@ -594,7 +595,7 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
const handleSubmit = () => {
|
const handleSubmit = () => {
|
||||||
if (!containerNumber || !warehouse) return;
|
if (!containerNumber || !warehouse || !returnedBy) return;
|
||||||
|
|
||||||
const selectedWarehouse = Array.isArray(warehouses) ? warehouses.find((wh: any) => wh.id === warehouse) : null;
|
const selectedWarehouse = Array.isArray(warehouses) ? warehouses.find((wh: any) => wh.id === warehouse) : null;
|
||||||
|
|
||||||
@@ -603,7 +604,7 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
{
|
{
|
||||||
bookingId: null,
|
bookingId: null,
|
||||||
customerId: null,
|
customerId: null,
|
||||||
returnType: "CUSTOMER",
|
returnType: returnedBy,
|
||||||
containers: [
|
containers: [
|
||||||
{
|
{
|
||||||
containerNumber,
|
containerNumber,
|
||||||
@@ -618,6 +619,7 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
});
|
});
|
||||||
|
|
||||||
setContainerNumber("");
|
setContainerNumber("");
|
||||||
|
setReturnedBy(null);
|
||||||
setReturnDate(new Date().toISOString().split("T")[0]);
|
setReturnDate(new Date().toISOString().split("T")[0]);
|
||||||
setWarehouse(null);
|
setWarehouse(null);
|
||||||
setYard("");
|
setYard("");
|
||||||
@@ -642,6 +644,18 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Select
|
||||||
|
label="Returned By"
|
||||||
|
placeholder="Select truck type"
|
||||||
|
value={returnedBy}
|
||||||
|
onChange={(val) => setReturnedBy(val as "EDR" | "CUSTOMER" | null)}
|
||||||
|
data={[
|
||||||
|
{ value: "EDR", label: "EDR Truck" },
|
||||||
|
{ value: "CUSTOMER", label: "Customer Truck" },
|
||||||
|
]}
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
|
||||||
<Select
|
<Select
|
||||||
label="Return Warehouse"
|
label="Return Warehouse"
|
||||||
placeholder="Select warehouse for container return"
|
placeholder="Select warehouse for container return"
|
||||||
@@ -698,7 +712,7 @@ function StandaloneReturnModal({ opened, onClose, onSubmit, loading }: Standalon
|
|||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
disabled={!containerNumber || !warehouse}
|
disabled={!containerNumber || !returnedBy || !warehouse}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
>
|
>
|
||||||
Record Return
|
Record Return
|
||||||
|
|||||||
Reference in New Issue
Block a user