Add wedding and divorce inputs
This commit is contained in:
parent
ac2004a51d
commit
dd18ee129d
@ -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 {
|
||||
|
@ -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 */}
|
||||
<PropSelect
|
||||
editing={p.editing}
|
||||
label="Status"
|
||||
value={couple.state}
|
||||
onValueChange={(s) => {
|
||||
couple.state = s;
|
||||
updatedCouple();
|
||||
}}
|
||||
options={ServerApi.Config.couples_states.map((s) => {
|
||||
return { label: s.fr, value: s.code };
|
||||
})}
|
||||
/>
|
||||
|
||||
{/* Wedding day */}
|
||||
<DateInput
|
||||
label="Date du mariage"
|
||||
editable={p.editing}
|
||||
id="dow"
|
||||
value={couple.dateOfWedding}
|
||||
onValueChange={(d) => {
|
||||
couple.wedding_year = d.year;
|
||||
couple.wedding_month = d.month;
|
||||
couple.wedding_day = d.day;
|
||||
updatedCouple();
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Divorce day */}
|
||||
<DateInput
|
||||
label="Date du divorce"
|
||||
editable={p.editing}
|
||||
id="dod"
|
||||
value={couple.dateOfDivorce}
|
||||
onValueChange={(d) => {
|
||||
couple.divorce_year = d.year;
|
||||
couple.divorce_month = d.month;
|
||||
couple.divorce_day = d.day;
|
||||
updatedCouple();
|
||||
}}
|
||||
/>
|
||||
</PropertiesBox>
|
||||
</Grid>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user