E Nr, Karte Zentrieren, Statin-select
This commit is contained in:
@@ -50,9 +50,9 @@ export function StationsSelect({
|
||||
useEffect(() => {
|
||||
setValue([
|
||||
...(selectedStations || []).map((id) => String(id)),
|
||||
...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED ? ["RTW"] : []),
|
||||
...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED ? ["FW"] : []),
|
||||
...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED ? ["POL"] : []),
|
||||
...(vehicleStates.hpgAmbulanceState !== HpgState.NOT_REQUESTED || undefined ? ["RTW"] : []),
|
||||
...(vehicleStates.hpgFireEngineState !== HpgState.NOT_REQUESTED || undefined ? ["FW"] : []),
|
||||
...(vehicleStates.hpgPoliceState !== HpgState.NOT_REQUESTED || undefined ? ["POL"] : []),
|
||||
]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [selectedStations, vehicleStates]);
|
||||
@@ -110,18 +110,9 @@ export function StationsSelect({
|
||||
onChange={(v) => {
|
||||
setValue(v);
|
||||
if (!isMulti) return onChange?.(v);
|
||||
const hpgAmbulanceState =
|
||||
vehicleStates.hpgAmbulanceState === "NOT_REQUESTED" && v.includes("RTW")
|
||||
? HpgState.DISPATCHED
|
||||
: vehicleStates.hpgAmbulanceState;
|
||||
const hpgFireEngineState =
|
||||
vehicleStates.hpgFireEngineState === "NOT_REQUESTED" && v.includes("FW")
|
||||
? HpgState.DISPATCHED
|
||||
: vehicleStates.hpgFireEngineState;
|
||||
const hpgPoliceState =
|
||||
vehicleStates.hpgPoliceState === "NOT_REQUESTED" && v.includes("POL")
|
||||
? HpgState.DISPATCHED
|
||||
: vehicleStates.hpgPoliceState;
|
||||
const hpgAmbulanceState = v.includes("RTW") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
const hpgFireEngineState = v.includes("FW") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
const hpgPoliceState = v.includes("POL") ? HpgState.DISPATCHED : HpgState.NOT_REQUESTED;
|
||||
|
||||
onChange?.({
|
||||
selectedStationIds: v
|
||||
|
||||
Reference in New Issue
Block a user