1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-22 11:52:21 +01:00

(feat) add birthday alert for event reservation

This commit is contained in:
Du Peng 2023-05-29 15:10:22 +02:00
parent 1d4a06efa8
commit 010da264e8
4 changed files with 20 additions and 1 deletions

View File

@ -647,6 +647,10 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
return true; return true;
} }
$scope.isUnder18YearsAgo = (date) => {
return moment(date).isAfter(moment().subtract(18, 'year'));
}
/* PRIVATE SCOPE */ /* PRIVATE SCOPE */
/** /**
@ -738,7 +742,8 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
name: child.first_name + ' ' + child.last_name, name: child.first_name + ' ' + child.last_name,
id: child.id, id: child.id,
type: 'Child', type: 'Child',
validatedAt: child.validated_at validatedAt: child.validated_at,
birthday: child.birthday
}); });
} }
} }

View File

@ -142,6 +142,12 @@
<span translate>{{ 'app.shared.cart.child_validation_required_alert' }}</span> <span translate>{{ 'app.shared.cart.child_validation_required_alert' }}</span>
</p> </p>
</uib-alert> </uib-alert>
<uib-alert type="danger" ng-if="user.booked && user.booked.type === 'Child' && !isUnder18YearsAgo(user.booked.birthday)">
<p class="text-sm">
<i class="fa fa-warning"></i>
<span translate>{{ 'app.shared.cart.child_birthday_must_be_under_18_years_ago_alert' }}</span>
</p>
</uib-alert>
</div> </div>
</div> </div>
</div> </div>
@ -174,6 +180,12 @@
<span translate>{{ 'app.shared.cart.child_validation_required_alert' }}</span> <span translate>{{ 'app.shared.cart.child_validation_required_alert' }}</span>
</p> </p>
</uib-alert> </uib-alert>
<uib-alert type="danger" ng-if="user.booked && user.booked.type === 'Child' && !isUnder18YearsAgo(user.booked.birthday)">
<p class="text-sm">
<i class="fa fa-warning"></i>
<span translate>{{ 'app.shared.cart.child_birthday_must_be_under_18_years_ago_alert' }}</span>
</p>
</uib-alert>
</div> </div>
</div> </div>
</div> </div>

View File

@ -370,6 +370,7 @@ en:
no_tags: "No tags" no_tags: "No tags"
user_validation_required_alert: "Warning!<br>Your administrator must validate your account. Then, you'll then be able to access all the booking features." user_validation_required_alert: "Warning!<br>Your administrator must validate your account. Then, you'll then be able to access all the booking features."
child_validation_required_alert: "Warning!<br>Your administrator must validate your child account. Then, you'll then be able to book the event." child_validation_required_alert: "Warning!<br>Your administrator must validate your child account. Then, you'll then be able to book the event."
child_birthday_must_be_under_18_years_ago_alert: "Warning!<br>Your child must be under 18 years ago. Then, you'll then be able to book the event."
# feature-tour modal # feature-tour modal
tour: tour:
previous: "Previous" previous: "Previous"

View File

@ -370,6 +370,7 @@ fr:
no_tags: "Aucune étiquette" no_tags: "Aucune étiquette"
user_validation_required_alert: "Attention !<br>Votre administrateur doit valider votre compte. Vous pourrez alors accéder à l'ensemble des fonctionnalités de réservation." user_validation_required_alert: "Attention !<br>Votre administrateur doit valider votre compte. Vous pourrez alors accéder à l'ensemble des fonctionnalités de réservation."
child_validation_required_alert: "Attention !<br>Votre administrateur doit valider votre compte enfant. Vous pourrez alors réserver l'événement." child_validation_required_alert: "Attention !<br>Votre administrateur doit valider votre compte enfant. Vous pourrez alors réserver l'événement."
child_birthday_must_be_under_18_years_ago_alert: "Attention !<br>La date de naissance de l'enfant doit être inférieure à 18 ans. Vous pourrez alors réserver l'événement."
#feature-tour modal #feature-tour modal
tour: tour:
previous: "Précédent" previous: "Précédent"