mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-22 11:52:21 +01:00
(feat) some improvements for family account
This commit is contained in:
parent
9dafc9f221
commit
59fb10753d
@ -116,6 +116,7 @@ export const ChildForm: React.FC<ChildFormProps> = ({ child, onSubmit, supportin
|
||||
defaultFile={sf as FileType}
|
||||
id={`supporting_document_files_attributes.${index}`}
|
||||
accept="application/pdf"
|
||||
rules={{ required: true }}
|
||||
setValue={setValue}
|
||||
label={getSupportingDocumentsTypeName(sf.supporting_document_type_id)}
|
||||
showRemoveButton={false}
|
||||
|
@ -28,14 +28,15 @@ export const ChildModal: React.FC<ChildModalProps> = ({ child, isOpen, toggleMod
|
||||
* Save the child to the API
|
||||
*/
|
||||
const handleSaveChild = async (data: Child): Promise<void> => {
|
||||
let c: Child = data;
|
||||
try {
|
||||
if (child?.id) {
|
||||
await ChildAPI.update(data);
|
||||
c = await ChildAPI.update(data);
|
||||
} else {
|
||||
await ChildAPI.create(data);
|
||||
c = await ChildAPI.create(data);
|
||||
}
|
||||
toggleModal();
|
||||
onSuccess(data, '');
|
||||
onSuccess(c, '');
|
||||
} catch (error) {
|
||||
onError(error);
|
||||
}
|
||||
@ -56,7 +57,7 @@ export const ChildModal: React.FC<ChildModalProps> = ({ child, isOpen, toggleMod
|
||||
onSubmit={handleSaveChild}
|
||||
supportingDocumentsTypes={supportingDocumentsTypes}
|
||||
operator={operator}
|
||||
onSuccess={onSuccess}
|
||||
onSuccess={(msg) => onSuccess(child, msg)}
|
||||
onError={onError}
|
||||
/>
|
||||
</FabModal>
|
||||
|
@ -9,7 +9,7 @@ import { TDateISO } from '../../typings/date-iso';
|
||||
|
||||
interface ChildValidationProps {
|
||||
child: Child
|
||||
onSuccess: (message: string) => void,
|
||||
onSuccess: (child: Child, msg: string) => void;
|
||||
onError: (message: string) => void,
|
||||
}
|
||||
|
||||
@ -37,8 +37,8 @@ export const ChildValidation: React.FC<ChildValidationProps> = ({ child, onSucce
|
||||
_child.validated_at = null;
|
||||
}
|
||||
ChildAPI.validate(_child)
|
||||
.then(() => {
|
||||
onSuccess(t(`app.admin.child_validation.${_value ? 'validate' : 'invalidate'}_child_success`));
|
||||
.then((c) => {
|
||||
onSuccess(c, t(`app.admin.child_validation.${_value ? 'validate' : 'invalidate'}_child_success`));
|
||||
}).catch(err => {
|
||||
setValue(!_value);
|
||||
onError(t(`app.admin.child_validation.${_value ? 'validate' : 'invalidate'}_child_error`) + err);
|
||||
|
@ -30,8 +30,15 @@ export const MembersListItem: React.FC<MembersListItemProps> = ({ member, onErro
|
||||
window.location.href = `/#!/admin/members/${memberId}/edit`;
|
||||
};
|
||||
|
||||
/**
|
||||
* member and all his children are validated
|
||||
*/
|
||||
const memberIsValidated = (): boolean => {
|
||||
return member.validated_at && member.children.every((child) => child.validated_at);
|
||||
};
|
||||
|
||||
return (
|
||||
<div key={member.id} className={`members-list-item ${member.validated_at ? 'is-validated' : ''} ${member.need_completion ? 'is-incomplet' : ''}`}>
|
||||
<div key={member.id} className={`members-list-item ${memberIsValidated() ? 'is-validated' : ''} ${member.need_completion ? 'is-incomplet' : ''}`}>
|
||||
<div className="left-col">
|
||||
<div className='status'>
|
||||
{(member.children.length > 0)
|
||||
|
@ -322,7 +322,6 @@ Application.Controllers.controller('AdminMembersController', ['$scope', '$sce',
|
||||
}
|
||||
return c;
|
||||
});
|
||||
console.log(member.children);
|
||||
return member;
|
||||
}
|
||||
return member;
|
||||
|
@ -50,10 +50,10 @@
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<span ng-if="event.event_type === 'standard'" class="v-middle badge text-base bg-stage" translate="">{{ 'app.admin.events.event_type.standard' }}</span>
|
||||
<span ng-if="event.event_type === 'nominative'" class="v-middle badge text-base bg-event" translate="">{{ 'app.admin.events.event_type.nominative' }}</span>
|
||||
<span ng-if="event.event_type === 'family'" class="v-middle badge text-base bg-atelier" translate="">{{ 'app.admin.events.event_type.family' }}</span>
|
||||
<span ng-if="event.pre_registration" class="v-middle badge text-base bg-info" translate="">{{ 'app.admin.events.pre_registration' }}</span>
|
||||
<span ng-if="event.event_type === 'standard'" class="v-middle badge text-sm bg-stage" translate="">{{ 'app.admin.events.event_type.standard' }}</span>
|
||||
<span ng-if="event.event_type === 'nominative'" class="v-middle badge text-sm bg-event" translate="">{{ 'app.admin.events.event_type.nominative' }}</span>
|
||||
<span ng-if="event.event_type === 'family'" class="v-middle badge text-sm bg-atelier" translate="">{{ 'app.admin.events.event_type.family' }}</span>
|
||||
<span ng-if="event.pre_registration" class="v-middle badge text-sm bg-info" translate="">{{ 'app.admin.events.pre_registration' }}</span>
|
||||
</td>
|
||||
|
||||
<td style="vertical-align:middle">
|
||||
|
@ -46,10 +46,10 @@
|
||||
<span ng-repeat="ticket in reservation.tickets_attributes">{{ticket.event_price_category.price_category.name}} : {{ticket.booked}}</span>
|
||||
</td>
|
||||
<td ng-if="event.pre_registration">
|
||||
<span ng-if="!isValidated(reservation) && !isCancelled(reservation) && !reservation.is_paid" class="v-middle badge text-base bg-info" translate="">{{ 'app.admin.event_reservations.event_status.pre_registered' }}</span>
|
||||
<span ng-if="isValidated(reservation) && !isCancelled(reservation) && !reservation.is_paid" class="v-middle badge text-base bg-stage" translate="">{{ 'app.admin.event_reservations.event_status.to_pay' }}</span>
|
||||
<span ng-if="reservation.is_paid && !isCancelled(reservation)" class="v-middle badge text-base bg-success" translate="">{{ 'app.admin.event_reservations.event_status.paid' }}</span>
|
||||
<span ng-if="isCancelled(reservation)" class="v-middle badge text-base bg-event" translate="">{{ 'app.admin.event_reservations.event_status.canceled' }}</span>
|
||||
<span ng-if="!isValidated(reservation) && !isCancelled(reservation) && !reservation.is_paid" class="v-middle badge text-sm bg-info" translate="">{{ 'app.admin.event_reservations.event_status.pre_registered' }}</span>
|
||||
<span ng-if="isValidated(reservation) && !isCancelled(reservation) && !reservation.is_paid" class="v-middle badge text-sm bg-stage" translate="">{{ 'app.admin.event_reservations.event_status.to_pay' }}</span>
|
||||
<span ng-if="reservation.is_paid && !isCancelled(reservation)" class="v-middle badge text-sm bg-success" translate="">{{ 'app.admin.event_reservations.event_status.paid' }}</span>
|
||||
<span ng-if="isCancelled(reservation)" class="v-middle badge text-sm bg-event" translate="">{{ 'app.admin.event_reservations.event_status.canceled' }}</span>
|
||||
</td>
|
||||
<td ng-if="event.pre_registration">
|
||||
<button class="btn btn-default" ng-click="validateReservation(reservation)" ng-if="!isValidated(reservation) && !isCancelled(reservation) && !reservation.is_paid" translate>
|
||||
|
@ -73,9 +73,9 @@
|
||||
|
||||
<div class="panel-content wrapper">
|
||||
<div>
|
||||
<span ng-if="event.event_type === 'nominative'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.nominative' }}</span>
|
||||
<span ng-if="event.event_type === 'family'" class="v-middle badge text-base bg-event" translate="">{{ 'app.public.events_show.event_type.family' }}</span>
|
||||
<span ng-if="event.pre_registration" class="v-middle badge text-base bg-info" translate="">{{ 'app.public.events_show.pre_registration' }}</span>
|
||||
<span ng-if="event.event_type === 'nominative'" class="v-middle badge text-xs bg-event" translate="">{{ 'app.public.events_show.event_type.nominative' }}</span>
|
||||
<span ng-if="event.event_type === 'family'" class="v-middle badge text-xs bg-event" translate="">{{ 'app.public.events_show.event_type.family' }}</span>
|
||||
<span ng-if="event.pre_registration" class="v-middle badge text-xs bg-info" translate="">{{ 'app.public.events_show.pre_registration' }}</span>
|
||||
</div>
|
||||
|
||||
<dl class="text-sm">
|
||||
|
@ -1824,8 +1824,9 @@ en:
|
||||
public_registrations: "Public registrations"
|
||||
show_username_in_admin_list: "Show the username in the list"
|
||||
family_account: "family account"
|
||||
family_account_info_html: "By activating this option, you offer your members the possibility to add their child(ren) to their own account. You can also request proof if you wish to validate them."
|
||||
family_account_info_html: "The Family account allows your members to add their children under 18 years old to their own account and directly register them for Family events. You can also request supporting documents for each child and validate their account."
|
||||
enable_family_account: "Enable the Family Account option"
|
||||
child_validation_required: "the account validation option for children"
|
||||
child_validation_required_label: "Activate the account validation option for children"
|
||||
overlapping_options:
|
||||
training_reservations: "Trainings"
|
||||
|
@ -1816,8 +1816,9 @@ fr:
|
||||
public_registrations: "Inscriptions publiques"
|
||||
show_username_in_admin_list: "Afficher le nom d'utilisateur dans la liste"
|
||||
family_account: "Compte famille"
|
||||
family_account_info_html: "En activant cette option, vous offrez à vos membres la possibilité d'ajouter sur leur propre compte leur(s) enfants. Vous pouvez aussi demander un justificatif si vous souhaitez les valider."
|
||||
family_account_info_html: "Le compte Famille permet à vos membres d'ajouter leurs enfants de moins de 18 ans sur leur propre compte et de les inscrire directement aux évènements de type Famille. Vous pouvez aussi demander des justificatifs pour chaque enfant et valider leur compte."
|
||||
enable_family_account: "Activer l'option Compte Famille"
|
||||
child_validation_required: "l'option de validation des comptes enfants"
|
||||
child_validation_required_label: "Activer l'option de validation des comptes enfants"
|
||||
overlapping_options:
|
||||
training_reservations: "Formations"
|
||||
|
@ -494,7 +494,7 @@ en:
|
||||
edit_child: "Edit child"
|
||||
new_child: "New child"
|
||||
child_form:
|
||||
child_form_info: "Please note that you can only add a child under the age of 18. Supporting documents are requested by your administrator, they will be useful to validate your child's account and authorize the reservation of events."
|
||||
child_form_info: "Only children under 18 years old can be added to your Family account. Supporting documents may be requested to validate your child's account and allow you to register them for events."
|
||||
first_name: "First name"
|
||||
last_name: "Last name"
|
||||
birthday: "Birthday"
|
||||
|
@ -487,13 +487,14 @@ fr:
|
||||
select_a_member: "Sélectionnez un membre"
|
||||
start_typing: "Commencez à écrire..."
|
||||
children_dashboard:
|
||||
heading: "Mes enfants"
|
||||
heading: "Enfants"
|
||||
member_heading: "Mes enfants"
|
||||
add_child: "Ajouter un enfant"
|
||||
child_modal:
|
||||
edit_child: "Modifier un enfant"
|
||||
new_child: "Ajouter un enfant"
|
||||
child_form:
|
||||
child_form_info: "Notez que vous ne pouvez ajouter que vos enfants de moins de 18 ans. Des pièces justificatives sont demandés par votre administrateur, elles lui seront utiles pour valider le compte de votre enfant et ainsi autoriser la réservation d'événements."
|
||||
child_form_info: "Seuls les enfants de moins de 18 ans peuvent être ajoutés au sein de votre compte Famille. Des justificatifs peuvent être demandés afin de valider le compte de votre enfant et de vous permettre ensuite de l'inscrire à des évènements."
|
||||
first_name: "Prénom"
|
||||
last_name: "Nom"
|
||||
birthday: "Date de naissance"
|
||||
|
@ -317,7 +317,7 @@ fr:
|
||||
notify_admin_when_user_is_created:
|
||||
a_new_user_account_has_been_created_NAME_EMAIL_html: "Un nouveau compte utilisateur vient d'être créé : <strong><em>%{NAME} <%{EMAIL}></strong></em>."
|
||||
notify_admin_child_created:
|
||||
a_new_child_has_been_created_NAME_html: "Un nouveau enfant vient d'être créé : <strong><em>%{NAME}</em></strong>."
|
||||
a_new_child_has_been_created_NAME_html: "Un nouvel enfant vient d'être créé : <strong><em>%{NAME}</em></strong>."
|
||||
notify_admin_when_user_is_imported:
|
||||
a_new_user_account_has_been_imported_from_PROVIDER_UID_html: "Un nouveau compte utilisateur vient d'être importé depuis : <strong><em>%{PROVIDER}</strong> (%{UID})</em>."
|
||||
notify_member_create_reservation:
|
||||
|
Loading…
x
Reference in New Issue
Block a user