Fixed wrong overwrite of Additional Mission info
This commit is contained in:
@@ -355,9 +355,14 @@ export const MissionForm = () => {
|
|||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
form.setValue("hpgMissionString", e.target.value);
|
form.setValue("hpgMissionString", e.target.value);
|
||||||
const [name] = e.target.value.split(":");
|
const [name] = e.target.value.split(":");
|
||||||
|
const allHpgMissionTypes = keywords?.map((k) => k.hpgMissionTypes).flat();
|
||||||
|
console.log("Selected HPG Mission String:", name, allHpgMissionTypes);
|
||||||
if (
|
if (
|
||||||
!form.watch("missionAdditionalInfo") ||
|
!form.watch("missionAdditionalInfo") ||
|
||||||
form.watch("missionAdditionalInfo") === name
|
allHpgMissionTypes?.find((t) => {
|
||||||
|
const [hpgName] = t.split(":");
|
||||||
|
return hpgName === form.watch("missionAdditionalInfo");
|
||||||
|
})
|
||||||
) {
|
) {
|
||||||
form.setValue("missionAdditionalInfo", name || "");
|
form.setValue("missionAdditionalInfo", name || "");
|
||||||
}
|
}
|
||||||
@@ -393,7 +398,7 @@ export const MissionForm = () => {
|
|||||||
/>
|
/>
|
||||||
{form.watch("type") === "sekundär" && (
|
{form.watch("type") === "sekundär" && (
|
||||||
<input
|
<input
|
||||||
{...form.register("addressMissionLocation")}
|
{...form.register("addressMissionDestination")}
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Zielkrankenhaus"
|
placeholder="Zielkrankenhaus"
|
||||||
className="input input-primary input-bordered w-full"
|
className="input input-primary input-bordered w-full"
|
||||||
|
|||||||
Reference in New Issue
Block a user