Add feedback for member creation
This commit is contained in:
parent
c6d0ff187c
commit
b828fce039
@ -98,6 +98,14 @@ export class Member implements MemberApi {
|
||||
family_id: family_id,
|
||||
});
|
||||
}
|
||||
|
||||
get fullName(): string {
|
||||
const firstName = this.first_name ?? "";
|
||||
|
||||
return firstName.length === 0
|
||||
? this.last_name ?? ""
|
||||
: `${firstName} ${this.last_name ?? ""}`;
|
||||
}
|
||||
}
|
||||
|
||||
export class MemberApi {
|
||||
|
@ -12,12 +12,14 @@ import { FamilyPageTitle } from "../../widgets/FamilyPageTitle";
|
||||
import { PropEdit } from "../../widgets/PropEdit";
|
||||
import { PropertiesBox } from "../../widgets/PropertiesBox";
|
||||
import { SexSelection } from "../../widgets/SexSelection";
|
||||
import { useSnackbar } from "../../context_providers/SnackbarProvider";
|
||||
|
||||
/**
|
||||
* Create a new member route
|
||||
*/
|
||||
export function FamilyCreateMemberRoute(): React.ReactElement {
|
||||
const alert = useAlert();
|
||||
const snackbar = useSnackbar();
|
||||
|
||||
const n = useNavigate();
|
||||
const family = useFamily();
|
||||
@ -29,6 +31,7 @@ export function FamilyCreateMemberRoute(): React.ReactElement {
|
||||
// TODO : trigger update
|
||||
|
||||
n(family.family.URL(`member/${r.id}`));
|
||||
snackbar(`La fiche pour ${r.fullName} a été créée avec succès !`);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
alert("Echec de la création de la personne !");
|
||||
|
Loading…
Reference in New Issue
Block a user