truck type detantion

This commit is contained in:
Hagernesh
2026-07-07 10:02:43 +00:00
parent 48b36a2621
commit 35ccf1bc95
8 changed files with 228 additions and 41 deletions

View File

@@ -37,6 +37,7 @@ import {
FEE_RULE_BASIS_LABELS,
FEE_RULE_TYPES,
FEE_RULE_TYPE_LABELS,
VEHICLE_TYPES,
type FeeRuleBasis,
type FeeRuleType,
} from '@/types/warehouse';
@@ -372,6 +373,7 @@ function FeeRules() {
tradeDirection: '',
cargoTypeCode: '',
containerType: '',
vehicleType: '',
freeDays: 3,
freeHours: 3,
ratePerDay: 0,
@@ -399,6 +401,7 @@ function FeeRules() {
tradeDirection: '',
cargoTypeCode: '',
containerType: '',
vehicleType: '',
freeDays: 3,
freeHours: 3,
ratePerDay: 0,
@@ -469,7 +472,7 @@ function FeeRules() {
ratePerDay: form.ratePerDay,
currency: form.currency || 'USD',
...(isDoubleHandling ? { basis: form.basis } : {}),
...(isTruckDetention ? { freeHours: form.freeHours } : {}),
...(isTruckDetention ? { freeHours: form.freeHours, vehicleType: clean(form.vehicleType) ?? null } : {}),
...(!isDoubleHandling && tiers.length ? { tiers } : {}),
};
@@ -638,6 +641,16 @@ function FeeRules() {
onChange={(value) => setForm((f) => ({ ...f, tradeDirection: selectValue(value) }))}
clearable
/>
{isTruckDetention && (
<Select
label="Truck type"
placeholder="Any truck type"
data={VEHICLE_TYPES.map((v) => ({ value: v, label: v.charAt(0) + v.slice(1).toLowerCase() }))}
value={form.vehicleType || null}
onChange={(value) => setForm((f) => ({ ...f, vehicleType: selectValue(value) }))}
clearable
/>
)}
{isBulkRule && (
<Select
label="Cargo type"