feat(#112): reprise après refus via lien e-mail (/reprise?token=)
Branche le flux front : chargement du dossier, session reprise, wizards parent/AM préremplis et resoumission via reprise-resoumettre. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -14,6 +14,7 @@ import '../../widgets/personal_info_form_screen.dart';
|
||||
import '../../widgets/child_card_widget.dart';
|
||||
import '../../widgets/presentation_form_screen.dart';
|
||||
import '../../services/auth_service.dart';
|
||||
import '../../services/reprise_session.dart';
|
||||
|
||||
class ParentRegisterStep5Screen extends StatefulWidget {
|
||||
const ParentRegisterStep5Screen({super.key});
|
||||
@@ -27,8 +28,39 @@ class _ParentRegisterStep5ScreenState extends State<ParentRegisterStep5Screen> {
|
||||
|
||||
Future<void> _submitRegistration(BuildContext context, UserRegistrationData data) async {
|
||||
if (_isSubmitting) return;
|
||||
if (RepriseSession.isActive) {
|
||||
if (!data.isRepriseSubmitReady) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(
|
||||
'Vérifiez vos coordonnées et acceptez les conditions.',
|
||||
style: GoogleFonts.merienda(fontSize: 14),
|
||||
),
|
||||
backgroundColor: Colors.red.shade700,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
setState(() => _isSubmitting = true);
|
||||
try {
|
||||
if (RepriseSession.isActive) {
|
||||
final token = RepriseSession.token!;
|
||||
final p = data.parent1;
|
||||
await AuthService.resoumettreReprise(
|
||||
token: token,
|
||||
prenom: p.firstName,
|
||||
nom: p.lastName,
|
||||
telephone: p.phone,
|
||||
adresse: p.address,
|
||||
ville: p.city,
|
||||
codePostal: p.postalCode,
|
||||
);
|
||||
RepriseSession.clear();
|
||||
if (!context.mounted) return;
|
||||
_showRepriseSuccessModal(context);
|
||||
return;
|
||||
}
|
||||
await AuthService.registerParent(data);
|
||||
if (!context.mounted) return;
|
||||
_showSuccessModal(context);
|
||||
@@ -279,6 +311,34 @@ class _ParentRegisterStep5ScreenState extends State<ParentRegisterStep5Screen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showRepriseSuccessModal(BuildContext context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext dialogContext) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Dossier resoumis',
|
||||
style: GoogleFonts.merienda(fontWeight: FontWeight.bold),
|
||||
),
|
||||
content: Text(
|
||||
'Vos modifications ont été enregistrées. Votre dossier est de nouveau en attente de validation.',
|
||||
style: GoogleFonts.merienda(fontSize: 14),
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('OK', style: GoogleFonts.merienda(fontWeight: FontWeight.bold)),
|
||||
onPressed: () {
|
||||
Navigator.of(dialogContext).pop();
|
||||
context.go('/login');
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _showSuccessModal(BuildContext context) {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
|
||||
Reference in New Issue
Block a user