|
|
|
@@ -407,12 +407,14 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
shopCode: String(matchingShop.code || ""), |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// If no matching shop found, allow free text input for shop name |
|
|
|
setNewShop({ |
|
|
|
...newShop, |
|
|
|
shopName: newValue, |
|
|
|
}); |
|
|
|
} |
|
|
|
} else if (newValue === null) { |
|
|
|
} else { |
|
|
|
// Clear shop name when selection is cleared (but keep shop code if it exists) |
|
|
|
setNewShop({ |
|
|
|
...newShop, |
|
|
|
shopName: "", |
|
|
|
@@ -431,14 +433,17 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
shopName: String(matchingShop.name || ""), |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// If no matching shop found, still set the code (shouldn't happen with restricted selection) |
|
|
|
setNewShop({ |
|
|
|
...newShop, |
|
|
|
shopCode: newValue, |
|
|
|
}); |
|
|
|
} |
|
|
|
} else if (newValue === null) { |
|
|
|
} else { |
|
|
|
// Clear both fields when selection is cleared |
|
|
|
setNewShop({ |
|
|
|
...newShop, |
|
|
|
shopName: "", |
|
|
|
shopCode: "", |
|
|
|
}); |
|
|
|
} |
|
|
|
@@ -633,7 +638,7 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
<CardContent> |
|
|
|
<Paper sx={{ p: 3 }}> |
|
|
|
<Grid container spacing={3}> |
|
|
|
<Grid item xs={12} sm={6}> |
|
|
|
<Grid item xs={12} sm={4}> |
|
|
|
<Typography variant="subtitle2" color="text.secondary"> |
|
|
|
{t("TruckLance Code")} |
|
|
|
</Typography> |
|
|
|
@@ -642,7 +647,7 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} sm={6}> |
|
|
|
<Grid item xs={12} sm={4}> |
|
|
|
<Typography variant="subtitle2" color="text.secondary"> |
|
|
|
{t("Departure Time")} |
|
|
|
</Typography> |
|
|
|
@@ -655,7 +660,7 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
</Typography> |
|
|
|
</Grid> |
|
|
|
|
|
|
|
<Grid item xs={12} sm={6}> |
|
|
|
<Grid item xs={12} sm={4}> |
|
|
|
<Typography variant="subtitle2" color="text.secondary"> |
|
|
|
{t("Store ID")} |
|
|
|
</Typography> |
|
|
|
@@ -943,12 +948,13 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
<Autocomplete |
|
|
|
freeSolo |
|
|
|
options={uniqueShopNames} |
|
|
|
value={newShop.shopName} |
|
|
|
value={newShop.shopName || null} |
|
|
|
onChange={(event, newValue) => { |
|
|
|
handleNewShopNameChange(newValue); |
|
|
|
}} |
|
|
|
onInputChange={(event, newInputValue, reason) => { |
|
|
|
if (reason === 'input') { |
|
|
|
// Allow free text input for shop name |
|
|
|
setNewShop({ ...newShop, shopName: newInputValue }); |
|
|
|
} |
|
|
|
}} |
|
|
|
@@ -966,17 +972,11 @@ const TruckLaneDetail: React.FC = () => { |
|
|
|
</Grid> |
|
|
|
<Grid item xs={12}> |
|
|
|
<Autocomplete |
|
|
|
freeSolo |
|
|
|
options={uniqueShopCodes} |
|
|
|
value={newShop.shopCode} |
|
|
|
value={newShop.shopCode || null} |
|
|
|
onChange={(event, newValue) => { |
|
|
|
handleNewShopCodeChange(newValue); |
|
|
|
}} |
|
|
|
onInputChange={(event, newInputValue, reason) => { |
|
|
|
if (reason === 'input') { |
|
|
|
setNewShop({ ...newShop, shopCode: newInputValue }); |
|
|
|
} |
|
|
|
}} |
|
|
|
renderInput={(params) => ( |
|
|
|
<TextField |
|
|
|
{...params} |
|
|
|
|