Show children of couple
This commit is contained in:
parent
dd18ee129d
commit
ec856b5cb4
@ -1,4 +1,5 @@
|
|||||||
import { APIClient } from "./ApiClient";
|
import { APIClient } from "./ApiClient";
|
||||||
|
import { Couple } from "./CoupleApi";
|
||||||
|
|
||||||
export type Sex = "M" | "F";
|
export type Sex = "M" | "F";
|
||||||
|
|
||||||
@ -213,6 +214,13 @@ export class MembersList {
|
|||||||
return this.list.filter((m) => m.mother === id || m.father === id);
|
return this.list.filter((m) => m.mother === id || m.father === id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
childrenOfCouple(c: Couple): Member[] {
|
||||||
|
if (!c.husband && !c.wife) return [];
|
||||||
|
return this.list.filter(
|
||||||
|
(m) => m.mother === c.wife && m.father === c.husband
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
siblings(id: number): Member[] {
|
siblings(id: number): Member[] {
|
||||||
const p = this.get(id);
|
const p = this.get(id);
|
||||||
return this.list.filter(
|
return this.list.filter(
|
||||||
|
@ -124,7 +124,7 @@ export function FamilyCoupleRoute(): React.ReactElement {
|
|||||||
build={() => (
|
build={() => (
|
||||||
<CouplePage
|
<CouplePage
|
||||||
couple={couple!}
|
couple={couple!}
|
||||||
children={[]} // TODO
|
children={family.members.childrenOfCouple(couple!)}
|
||||||
creating={false}
|
creating={false}
|
||||||
editing={false}
|
editing={false}
|
||||||
onRequestDelete={deleteCouple}
|
onRequestDelete={deleteCouple}
|
||||||
@ -360,6 +360,7 @@ export function CouplePage(p: {
|
|||||||
filter={(m) => m.sex === "F" || m.sex === undefined}
|
filter={(m) => m.sex === "F" || m.sex === undefined}
|
||||||
current={couple.wife}
|
current={couple.wife}
|
||||||
/>
|
/>
|
||||||
|
<br />
|
||||||
|
|
||||||
{/* State */}
|
{/* State */}
|
||||||
<PropSelect
|
<PropSelect
|
||||||
|
Loading…
x
Reference in New Issue
Block a user