Start to build edit member form

This commit is contained in:
2023-08-08 13:55:51 +02:00
parent eacf3b0700
commit d07dfd6596
7 changed files with 322 additions and 1 deletions

View File

@ -0,0 +1,88 @@
export type Sex = "M" | "F";
export interface MemberApi {
id: number;
family_id: number;
first_name?: string;
last_name?: string;
birth_last_name?: string;
photo_id?: number;
signed_photo_id?: number;
email?: string;
phone?: string;
address?: string;
city?: string;
postal_code?: string;
country?: string;
sex?: Sex;
time_create?: number;
time_update?: number;
mother?: number;
father?: number;
birth_year?: number;
birth_month?: number;
birth_day?: number;
dead: boolean;
death_year?: number;
death_month?: number;
death_day?: number;
note?: string;
}
export class Member implements MemberApi {
id: number;
family_id: number;
first_name?: string;
last_name?: string;
birth_last_name?: string;
photo_id?: number;
signed_photo_id?: number;
email?: string;
phone?: string;
address?: string;
city?: string;
postal_code?: string;
country?: string;
sex?: Sex;
time_create?: number;
time_update?: number;
mother?: number;
father?: number;
birth_year?: number;
birth_month?: number;
birth_day?: number;
dead!: boolean;
death_year?: number;
death_month?: number;
death_day?: number;
note?: string;
constructor(m: MemberApi) {
this.id = m.id;
this.family_id = m.family_id;
this.first_name = m.first_name;
this.last_name = m.last_name;
this.birth_last_name = m.birth_last_name;
this.photo_id = m.photo_id;
this.signed_photo_id = m.signed_photo_id;
this.email = m.email;
this.phone = m.phone;
this.address = m.address;
this.city = m.city;
this.postal_code = m.postal_code;
this.country = m.country;
this.sex = m.sex;
this.time_create = m.time_create;
this.time_update = m.time_update;
this.mother = m.mother;
this.father = m.father;
this.birth_year = m.birth_year;
this.birth_month = m.birth_month;
this.birth_day = m.birth_day;
this.dead = m.dead;
this.death_year = m.death_year;
this.death_month = m.death_month;
this.death_day = m.death_day;
this.note = m.note;
}
}

View File

@ -1,16 +1,37 @@
import { APIClient } from "./ApiClient";
interface LenConstraint {
interface NumberConstraint {
min: number;
max: number;
}
export interface LenConstraint {
min: number;
max: number;
}
interface Constraints {
date_year: NumberConstraint;
date_month: NumberConstraint;
date_day: NumberConstraint;
photo_allowed_types: string[];
photo_max_size: number;
mail_len: LenConstraint;
user_name_len: LenConstraint;
password_len: LenConstraint;
family_name_len: LenConstraint;
invitation_code_len: LenConstraint;
member_first_name: LenConstraint;
member_last_name: LenConstraint;
member_birth_last_name: LenConstraint;
member_email: LenConstraint;
member_phone: LenConstraint;
member_address: LenConstraint;
member_city: LenConstraint;
member_postal_code: LenConstraint;
member_country: LenConstraint;
member_sex: LenConstraint;
member_note: LenConstraint;
}
interface OIDCProvider {
@ -18,10 +39,24 @@ interface OIDCProvider {
name: string;
}
export interface Country {
code: string;
en: string;
fr: string;
}
export interface CouplesStates {
code: string;
en: string;
fr: string;
}
export interface ServerConfig {
constraints: Constraints;
mail: string;
oidc_providers: OIDCProvider[];
countries: Country[];
couples_states: CouplesStates[];
}
let config: ServerConfig | null = null;