From c230f839261ff92402bcd1a21c1c043a23a3294c Mon Sep 17 00:00:00 2001 From: Pierre Hubert Date: Wed, 16 Aug 2023 14:57:28 +0200 Subject: [PATCH] Simplify couples interactions --- .../src/routes/family/FamilyCoupleRoute.tsx | 22 ++++++++++++++++++- .../src/routes/family/FamilyMemberRoute.tsx | 12 ++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/geneit_app/src/routes/family/FamilyCoupleRoute.tsx b/geneit_app/src/routes/family/FamilyCoupleRoute.tsx index 94b697a..02dc0db 100644 --- a/geneit_app/src/routes/family/FamilyCoupleRoute.tsx +++ b/geneit_app/src/routes/family/FamilyCoupleRoute.tsx @@ -24,6 +24,7 @@ import { DateInput } from "../../widgets/forms/DateInput"; import { MemberInput } from "../../widgets/forms/MemberInput"; import { PropSelect } from "../../widgets/forms/SelectInput"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; +import { useQuery } from "../../hooks/useQuery"; /** * Create a new couple route @@ -36,6 +37,13 @@ export function FamilyCreateCoupleRoute(): React.ReactElement { const n = useNavigate(); const family = useFamily(); + const params = useQuery(); + const couple = Couple.New(family.family.family_id); + const wife = Number(params.get("wife")); + const husband = Number(params.get("husband")); + if (wife) couple.wife = wife; + if (husband) couple.husband = husband; + const create = async (m: Couple) => { try { const r = await CoupleApi.Create(m); @@ -58,7 +66,7 @@ export function FamilyCreateCoupleRoute(): React.ReactElement { return ( )) )} + + {couple.wife && couple.husband && ( +
+ + + +
+ )} )} diff --git a/geneit_app/src/routes/family/FamilyMemberRoute.tsx b/geneit_app/src/routes/family/FamilyMemberRoute.tsx index 970aed6..ead75c4 100644 --- a/geneit_app/src/routes/family/FamilyMemberRoute.tsx +++ b/geneit_app/src/routes/family/FamilyMemberRoute.tsx @@ -637,6 +637,18 @@ export function MemberPage(p: { )) )} + +
+ + + +
)}