diff --git a/geneit_app/src/api/CoupleApi.ts b/geneit_app/src/api/CoupleApi.ts index acbede1..00f7ab7 100644 --- a/geneit_app/src/api/CoupleApi.ts +++ b/geneit_app/src/api/CoupleApi.ts @@ -1,4 +1,5 @@ import { APIClient } from "./ApiClient"; +import { DateValue } from "./MemberApi"; interface CoupleApiInterface { id: number; @@ -76,6 +77,28 @@ export class Couple implements CoupleApiInterface { if (!this.signed_photo_id) return null; return `${APIClient.backendURL()}/photo/${this.signed_photo_id}/thumbnail`; } + + get dateOfWedding(): DateValue | undefined { + if (!this.wedding_day && !this.wedding_month && !this.wedding_year) + return undefined; + + return { + year: this.wedding_year, + month: this.wedding_month, + day: this.wedding_day, + }; + } + + get dateOfDivorce(): DateValue | undefined { + if (!this.divorce_day && !this.divorce_month && !this.divorce_year) + return undefined; + + return { + year: this.divorce_year, + month: this.divorce_month, + day: this.divorce_day, + }; + } } export class CouplesList { diff --git a/geneit_app/src/routes/family/FamilyCoupleRoute.tsx b/geneit_app/src/routes/family/FamilyCoupleRoute.tsx index da98209..8b3194a 100644 --- a/geneit_app/src/routes/family/FamilyCoupleRoute.tsx +++ b/geneit_app/src/routes/family/FamilyCoupleRoute.tsx @@ -21,6 +21,9 @@ import { PropertiesBox } from "../../widgets/PropertiesBox"; import { RouterLink } from "../../widgets/RouterLink"; import { MemberInput } from "../../widgets/forms/MemberInput"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; +import { PropSelect } from "../../widgets/forms/SelectInput"; +import { ServerApi } from "../../api/ServerApi"; +import { DateInput } from "../../widgets/forms/DateInput"; /** * Create a new couple route @@ -357,6 +360,48 @@ export function CouplePage(p: { filter={(m) => m.sex === "F" || m.sex === undefined} current={couple.wife} /> + + {/* State */} + { + couple.state = s; + updatedCouple(); + }} + options={ServerApi.Config.couples_states.map((s) => { + return { label: s.fr, value: s.code }; + })} + /> + + {/* Wedding day */} + { + couple.wedding_year = d.year; + couple.wedding_month = d.month; + couple.wedding_day = d.day; + updatedCouple(); + }} + /> + + {/* Divorce day */} + { + couple.divorce_year = d.year; + couple.divorce_month = d.month; + couple.divorce_day = d.day; + updatedCouple(); + }} + />