Ready to implement member select

This commit is contained in:
Pierre HUBERT 2023-08-10 14:13:27 +02:00
parent 39c7163290
commit e237abe4e1
2 changed files with 37 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import { SexSelection } from "../../widgets/forms/SexSelection";
import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { MemberPhoto } from "../../widgets/MemberPhoto";
import { RouterLink } from "../../widgets/RouterLink";
import { MemberInput } from "../../widgets/forms/MemberInput";
/**
* Create a new member route
@ -399,7 +400,7 @@ export function MemberPage(p: {
<PropCheckbox
checked={member.dead}
editable={p.editing}
label="Décédé"
label={member.sex === "F" ? "Décédée" : "Décédé"}
onValueChange={(v) => {
member.dead = v;
updatedMember();
@ -423,6 +424,30 @@ export function MemberPage(p: {
updatedMember();
}}
/>
{/* Father */}
<MemberInput
editable={p.editing}
label="Père"
onValueChange={(m) => {
member.father = m;
updatedMember();
}}
filter={(m) => m.sex === "M" || m.sex === undefined}
current={member.father}
/>
{/* Mother */}
<MemberInput
editable={p.editing}
label="Mère"
onValueChange={(m) => {
member.father = m;
updatedMember();
}}
filter={(m) => m.sex === "F" || m.sex === undefined}
current={member.father}
/>
</PropertiesBox>
</Grid>

View File

@ -0,0 +1,11 @@
import { Member } from "../../api/MemberApi";
export function MemberInput(p: {
editable: boolean;
current?: number;
onValueChange: (n?: number) => void;
label: string;
filter: (m: Member) => boolean;
}): React.ReactElement {
return <>CHOOSE</>;
}