feat(#112): reprise après refus — dossier complet, email resoumission
- GET/PATCH reprise-dossier enrichis (parents, enfants, motivation, fiche AM) - Front: lien mail, modale identify login, wizards préremplis, PATCH complet - Email accusé resoumission aux parents avec n° de dossier - Fixes préremplissage AM (dates, places, ValueKey étape 2) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:p_tits_pas/models/am_registration_data.dart';
|
||||
import 'package:p_tits_pas/models/reprise_dossier.dart';
|
||||
import 'package:p_tits_pas/models/user_registration_data.dart';
|
||||
import 'package:p_tits_pas/services/api/api_config.dart';
|
||||
import 'package:p_tits_pas/utils/reprise_mapper.dart';
|
||||
|
||||
/// Contexte reprise après refus (token e-mail ou identify). Ticket #112.
|
||||
class RepriseSession {
|
||||
RepriseSession._();
|
||||
|
||||
static String? _token;
|
||||
static String? _role;
|
||||
static String? _photoUrl;
|
||||
static String? _photoUrlForApi;
|
||||
|
||||
static bool get isActive =>
|
||||
_token != null && _token!.trim().isNotEmpty;
|
||||
|
||||
static String? get token => _token;
|
||||
|
||||
static bool get isParent => _role == 'parent';
|
||||
|
||||
static bool get isAm => _role == 'assistante_maternelle';
|
||||
|
||||
/// URL absolue pour l'affichage.
|
||||
static String? get photoUrl => _photoUrl;
|
||||
|
||||
/// Chemin relatif API (`/uploads/…`) pour PATCH sans re-upload.
|
||||
static String? get photoUrlForApi => _photoUrlForApi;
|
||||
|
||||
static void start({
|
||||
required String token,
|
||||
required RepriseDossier dossier,
|
||||
}) {
|
||||
_token = token.trim();
|
||||
_role = dossier.role;
|
||||
final raw = dossier.photoUrl?.trim();
|
||||
_photoUrlForApi = raw != null && raw.isNotEmpty ? raw : null;
|
||||
_photoUrl = _photoUrlForApi != null
|
||||
? ApiConfig.absoluteMediaUrl(_photoUrlForApi)
|
||||
: null;
|
||||
}
|
||||
|
||||
static void clear() {
|
||||
_token = null;
|
||||
_role = null;
|
||||
_photoUrl = null;
|
||||
_photoUrlForApi = null;
|
||||
}
|
||||
|
||||
static void applyToParent(UserRegistrationData data, RepriseDossier dossier) {
|
||||
RepriseMapper.applyParentDossier(data, dossier);
|
||||
}
|
||||
|
||||
static void applyToAm(AmRegistrationData data, RepriseDossier dossier) {
|
||||
RepriseMapper.applyAmDossier(data, dossier);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user