feat(inscription AM #120): UI étape pro, photo unifiée, scripts et données test
- Panneau AM : validation NIR alignée API, date d’agrément requise côté app, capacité 1–10, n° agrément + date sur une ligne, ville/pays formatés au blur. - Widget RegistrationPhotoSlot (cadre, croix) partagé avec les cartes enfant. - AuthService : MIME PNG/JPEG pour la photo ; payload date_agrement. - Scripts register-am-dubois / mansouri ; chemins tests/ressources/photos ; doc test-data + seed ; smoke curl inscription AM. Made-with: Cursor
This commit is contained in:
parent
12bf85b7bd
commit
58607cdbc9
@ -1,27 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test POST /auth/register/am (ticket #90)
|
# Inscription AM complète : jeux officiels alignés sur database/seed/03_seed_test_data.sql
|
||||||
|
# node tests/scripts/register-am-dubois-test.mjs [BASE_URL]
|
||||||
|
# node tests/scripts/register-am-mansouri-test.mjs [BASE_URL]
|
||||||
|
#
|
||||||
|
# Smoke curl (email + NIR jetables, hors seed — ne pas mélanger avec Marie / Fatima) :
|
||||||
# Usage: ./scripts/test-register-am.sh [BASE_URL]
|
# Usage: ./scripts/test-register-am.sh [BASE_URL]
|
||||||
# Exemple: ./scripts/test-register-am.sh https://app.ptits-pas.fr/api/v1
|
# Exemple: ./scripts/test-register-am.sh http://localhost:3000/api/v1
|
||||||
# ./scripts/test-register-am.sh http://localhost:3000/api/v1
|
|
||||||
|
|
||||||
BASE_URL="${1:-http://localhost:3000/api/v1}"
|
BASE_URL="${1:-http://localhost:3000/api/v1}"
|
||||||
echo "Testing POST $BASE_URL/auth/register/am"
|
echo "POST $BASE_URL/auth/register/am (profil smoke, pas les AM du seed)"
|
||||||
echo "---"
|
echo "---"
|
||||||
|
|
||||||
curl -s -w "\n\nHTTP %{http_code}\n" -X POST "$BASE_URL/auth/register/am" \
|
curl -s -w "\n\nHTTP %{http_code}\n" -X POST "$BASE_URL/auth/register/am" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"email": "marie.dupont.test@ptits-pas.fr",
|
"email": "smoke.am.curl@ptits-pas.fr",
|
||||||
"prenom": "Marie",
|
"prenom": "Smoke",
|
||||||
"nom": "DUPONT",
|
"nom": "CURLTEST",
|
||||||
"telephone": "0612345678",
|
"telephone": "0612345678",
|
||||||
"adresse": "1 rue Test",
|
"adresse": "1 rue Smoke",
|
||||||
"code_postal": "75001",
|
"code_postal": "95870",
|
||||||
"ville": "Paris",
|
"ville": "Bezons",
|
||||||
"consentement_photo": true,
|
"consentement_photo": false,
|
||||||
"nir": "123456789012345",
|
"date_naissance": "1986-12-15",
|
||||||
"numero_agrement": "AGR-2024-001",
|
"nir": "186127500100279",
|
||||||
"capacite_accueil": 4,
|
"numero_agrement": "AGR-SMOKE-CURL-001",
|
||||||
|
"capacite_accueil": 3,
|
||||||
"acceptation_cgu": true,
|
"acceptation_cgu": true,
|
||||||
"acceptation_privacy": true
|
"acceptation_privacy": true
|
||||||
}'
|
}'
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
-- NIR : numéros de test (non réels), cohérents avec les données (date naissance, genre).
|
-- NIR : numéros de test (non réels), cohérents avec les données (date naissance, genre).
|
||||||
-- - Marie Dubois : née en Corse à Ajaccio → NIR 2A (test exception Corse).
|
-- - Marie Dubois : née en Corse à Ajaccio → NIR 2A (test exception Corse).
|
||||||
-- - Fatima El Mansouri : née à l'étranger → NIR 99.
|
-- - Fatima El Mansouri : née à l'étranger → NIR 99.
|
||||||
|
-- Même jeu : docs/test-data/README.md, utilisateurs-test.csv/.html, tests/scripts/register-am-*-test.mjs
|
||||||
-- À exécuter après BDD.sql (init DB)
|
-- À exécuter après BDD.sql (init DB)
|
||||||
-- ============================================================
|
-- ============================================================
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@ Fichier CSV contenant les utilisateurs de test pour valider le workflow de créa
|
|||||||
|
|
||||||
## 👥 Utilisateurs de test
|
## 👥 Utilisateurs de test
|
||||||
|
|
||||||
|
**Source de vérité (identités, NIR, agréments, adresses)** : `database/seed/03_seed_test_data.sql`, complété par `utilisateurs-test.csv` et ce README. Les scripts Node `tests/scripts/register-am-*-test.mjs` reprennent les mêmes valeurs.
|
||||||
|
|
||||||
### 1. Administrateur
|
### 1. Administrateur
|
||||||
|
|
||||||
| Nom | Prénom | Email | Téléphone | Mobile |
|
| Nom | Prénom | Email | Téléphone | Mobile |
|
||||||
@ -49,7 +51,14 @@ Fichier CSV contenant les utilisateurs de test pour valider le workflow de créa
|
|||||||
**Rôle** : `assistante_maternelle`
|
**Rôle** : `assistante_maternelle`
|
||||||
**Spécialité** : Bébés 0-18 mois
|
**Spécialité** : Bébés 0-18 mois
|
||||||
**Agrément** : 4 enfants
|
**Agrément** : 4 enfants
|
||||||
**Places disponibles** : 2
|
**Places disponibles** : 2
|
||||||
|
**Date de naissance** : 1980-06-08
|
||||||
|
**Lieu de naissance (inscription)** : Ajaccio (Corse, France) — NIR de test avec code département **2A**
|
||||||
|
**NIR (fictif, clé valide)** : `280062A00100191`
|
||||||
|
**N° d'agrément** : `AGR-2019-095001`
|
||||||
|
**Date d'agrément** : 2019-09-01
|
||||||
|
**Adresse** : 25 Rue de la République, 95870 Bezons
|
||||||
|
**Script d'inscription** : `tests/scripts/register-am-dubois-test.mjs`
|
||||||
|
|
||||||
#### Fatima EL MANSOURI
|
#### Fatima EL MANSOURI
|
||||||
|
|
||||||
@ -60,7 +69,14 @@ Fichier CSV contenant les utilisateurs de test pour valider le workflow de créa
|
|||||||
**Rôle** : `assistante_maternelle`
|
**Rôle** : `assistante_maternelle`
|
||||||
**Spécialité** : 1-3 ans
|
**Spécialité** : 1-3 ans
|
||||||
**Agrément** : 3 enfants
|
**Agrément** : 3 enfants
|
||||||
**Places disponibles** : 1
|
**Places disponibles** : 1
|
||||||
|
**Date de naissance** : 1975-11-12
|
||||||
|
**Lieu de naissance (inscription)** : exemple Casablanca (Maroc) — NIR de test avec code **99** (naissance à l'étranger)
|
||||||
|
**NIR (fictif, clé valide)** : `275119900100102`
|
||||||
|
**N° d'agrément** : `AGR-2017-095002`
|
||||||
|
**Date d'agrément** : 2017-06-15
|
||||||
|
**Adresse** : 17 Boulevard Aristide Briand, 95870 Bezons
|
||||||
|
**Script d'inscription** : `tests/scripts/register-am-mansouri-test.mjs`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -160,20 +176,14 @@ POST /api/v1/gestionnaires
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Scénario 2 : Inscription assistante maternelle
|
#### Scénario 2 : Inscription assistante maternelle (complète)
|
||||||
|
|
||||||
```typescript
|
Inscription en un flux : `POST /api/v1/auth/register/am` (identité, NIR, agrément, photo optionnelle, CGU). Voir le DTO backend `RegisterAMCompletDto`.
|
||||||
// Marie DUBOIS s'inscrit
|
|
||||||
POST /api/v1/auth/register
|
```bash
|
||||||
{
|
# Jeux alignés sur le seed (mêmes NIR / dates / agréments que 03_seed_test_data.sql) :
|
||||||
"email": "marie.dubois@ptits-pas.fr",
|
node tests/scripts/register-am-dubois-test.mjs [BASE_URL]
|
||||||
"password": "Test1234!",
|
node tests/scripts/register-am-mansouri-test.mjs [BASE_URL]
|
||||||
"prenom": "Marie",
|
|
||||||
"nom": "DUBOIS",
|
|
||||||
"telephone": "01 39 98 67 89",
|
|
||||||
"mobile": "06 96 34 56 78",
|
|
||||||
"role": "assistante_maternelle"
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Scénario 3 : Inscription parent
|
#### Scénario 3 : Inscription parent
|
||||||
|
|||||||
@ -177,10 +177,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="info-section">
|
<div class="info-section">
|
||||||
<div class="info-title">Profession</div>
|
<div class="info-title">Profession</div>
|
||||||
<p><strong>Agrément :</strong> 4 enfants max</p>
|
<p><strong>Agrément :</strong> 4 enfants max (n° AGR-2019-095001, depuis le 01/09/2019)</p>
|
||||||
<p><strong>Expérience :</strong> 12 ans</p>
|
<p><strong>Expérience :</strong> 12 ans</p>
|
||||||
<p><strong>Spécialité :</strong> Bébés 0-18 mois</p>
|
<p><strong>Spécialité :</strong> Bébés 0-18 mois</p>
|
||||||
<p><strong>Places disponibles :</strong> 2</p>
|
<p><strong>Places disponibles :</strong> 2</p>
|
||||||
|
<p><strong>NIR (test, fictif) :</strong> 280062A00100191</p>
|
||||||
|
<p><strong>Lieu de naissance :</strong> Ajaccio (Corse)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -207,10 +209,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="info-section">
|
<div class="info-section">
|
||||||
<div class="info-title">Profession</div>
|
<div class="info-title">Profession</div>
|
||||||
<p><strong>Agrément :</strong> 3 enfants max</p>
|
<p><strong>Agrément :</strong> 3 enfants max (n° AGR-2017-095002, depuis le 15/06/2017)</p>
|
||||||
<p><strong>Expérience :</strong> 15 ans</p>
|
<p><strong>Expérience :</strong> 15 ans</p>
|
||||||
<p><strong>Spécialité :</strong> Enfants 1-3 ans</p>
|
<p><strong>Spécialité :</strong> Enfants 1-3 ans</p>
|
||||||
<p><strong>Places disponibles :</strong> 1</p>
|
<p><strong>Places disponibles :</strong> 1</p>
|
||||||
|
<p><strong>NIR (test, fictif) :</strong> 275119900100102</p>
|
||||||
|
<p><strong>Lieu de naissance :</strong> à l'étranger (ex. Casablanca, Maroc — inscription)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -24,6 +24,8 @@ class AmRegistrationData extends ChangeNotifier {
|
|||||||
// String placeOfBirth = ''; // Remplacé par birthCity et birthCountry
|
// String placeOfBirth = ''; // Remplacé par birthCity et birthCountry
|
||||||
String nir = ''; // Numéro de Sécurité Sociale
|
String nir = ''; // Numéro de Sécurité Sociale
|
||||||
String agrementNumber = ''; // Numéro d'agrément
|
String agrementNumber = ''; // Numéro d'agrément
|
||||||
|
/// Date d'obtention de l'agrément — obligatoire (API `date_agrement`).
|
||||||
|
DateTime? agreementDate;
|
||||||
int? capacity; // Number of children the AM can look after
|
int? capacity; // Number of children the AM can look after
|
||||||
|
|
||||||
// Step 3: Presentation & CGU
|
// Step 3: Presentation & CGU
|
||||||
@ -68,6 +70,7 @@ class AmRegistrationData extends ChangeNotifier {
|
|||||||
// String? placeOfBirth, // Remplacé
|
// String? placeOfBirth, // Remplacé
|
||||||
String? nir,
|
String? nir,
|
||||||
String? agrementNumber,
|
String? agrementNumber,
|
||||||
|
DateTime? agreementDate,
|
||||||
int? capacity,
|
int? capacity,
|
||||||
}) {
|
}) {
|
||||||
this.photoPath = photoPath;
|
this.photoPath = photoPath;
|
||||||
@ -80,6 +83,7 @@ class AmRegistrationData extends ChangeNotifier {
|
|||||||
// this.placeOfBirth = placeOfBirth ?? this.placeOfBirth; // Remplacé
|
// this.placeOfBirth = placeOfBirth ?? this.placeOfBirth; // Remplacé
|
||||||
this.nir = nir ?? this.nir;
|
this.nir = nir ?? this.nir;
|
||||||
this.agrementNumber = agrementNumber ?? this.agrementNumber;
|
this.agrementNumber = agrementNumber ?? this.agrementNumber;
|
||||||
|
this.agreementDate = agreementDate ?? this.agreementDate;
|
||||||
this.capacity = capacity ?? this.capacity;
|
this.capacity = capacity ?? this.capacity;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@ -118,7 +122,10 @@ class AmRegistrationData extends ChangeNotifier {
|
|||||||
birthCountry.isNotEmpty &&
|
birthCountry.isNotEmpty &&
|
||||||
nir.isNotEmpty && // Basic check, could add validation
|
nir.isNotEmpty && // Basic check, could add validation
|
||||||
agrementNumber.isNotEmpty &&
|
agrementNumber.isNotEmpty &&
|
||||||
capacity != null && capacity! > 0;
|
agreementDate != null &&
|
||||||
|
capacity != null &&
|
||||||
|
capacity! >= 1 &&
|
||||||
|
capacity! <= 10;
|
||||||
|
|
||||||
bool get isStep3Complete =>
|
bool get isStep3Complete =>
|
||||||
// presentationText is optional as per CDC (message au gestionnaire)
|
// presentationText is optional as per CDC (message au gestionnaire)
|
||||||
@ -135,7 +142,7 @@ class AmRegistrationData extends ChangeNotifier {
|
|||||||
'phone: $phone, email: $email, '
|
'phone: $phone, email: $email, '
|
||||||
// 'photoPath: $photoPath, photoConsent: $photoConsent, ' // Commenté car déplacé/modifié
|
// 'photoPath: $photoPath, photoConsent: $photoConsent, ' // Commenté car déplacé/modifié
|
||||||
'dateOfBirth: $dateOfBirth, birthCity: $birthCity, birthCountry: $birthCountry, '
|
'dateOfBirth: $dateOfBirth, birthCity: $birthCity, birthCountry: $birthCountry, '
|
||||||
'nir: $nir, agrementNumber: $agrementNumber, capacity: $capacity, '
|
'nir: $nir, agrementNumber: $agrementNumber, agreementDate: $agreementDate, capacity: $capacity, '
|
||||||
'photoPath (step2): $photoPath, photoConsent (step2): $photoConsent, '
|
'photoPath (step2): $photoPath, photoConsent (step2): $photoConsent, '
|
||||||
'presentationText: $presentationText, cguAccepted: $cguAccepted)';
|
'presentationText: $presentationText, cguAccepted: $cguAccepted)';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,6 +23,7 @@ class AmRegisterStep2Screen extends StatelessWidget {
|
|||||||
birthCountry: registrationData.birthCountry,
|
birthCountry: registrationData.birthCountry,
|
||||||
nir: registrationData.nir,
|
nir: registrationData.nir,
|
||||||
agrementNumber: registrationData.agrementNumber,
|
agrementNumber: registrationData.agrementNumber,
|
||||||
|
agreementDate: registrationData.agreementDate,
|
||||||
capacity: registrationData.capacity,
|
capacity: registrationData.capacity,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ class AmRegisterStep2Screen extends StatelessWidget {
|
|||||||
birthCountry: data.birthCountry,
|
birthCountry: data.birthCountry,
|
||||||
nir: data.nir,
|
nir: data.nir,
|
||||||
agrementNumber: data.agrementNumber,
|
agrementNumber: data.agrementNumber,
|
||||||
|
agreementDate: data.agreementDate,
|
||||||
capacity: data.capacity,
|
capacity: data.capacity,
|
||||||
);
|
);
|
||||||
context.go('/am-register-step3');
|
context.go('/am-register-step3');
|
||||||
|
|||||||
@ -204,6 +204,7 @@ class _AmRegisterStep4ScreenState extends State<AmRegisterStep4Screen> {
|
|||||||
birthCountry: data.birthCountry,
|
birthCountry: data.birthCountry,
|
||||||
nir: data.nir,
|
nir: data.nir,
|
||||||
agrementNumber: data.agrementNumber,
|
agrementNumber: data.agrementNumber,
|
||||||
|
agreementDate: data.agreementDate,
|
||||||
capacity: data.capacity,
|
capacity: data.capacity,
|
||||||
photoConsent: data.photoConsent,
|
photoConsent: data.photoConsent,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
@ -22,6 +23,17 @@ class AuthService {
|
|||||||
return name.isEmpty ? null : name;
|
return name.isEmpty ? null : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String _imageMimeForBytes(Uint8List bytes) {
|
||||||
|
if (bytes.length >= 8 &&
|
||||||
|
bytes[0] == 0x89 &&
|
||||||
|
bytes[1] == 0x50 &&
|
||||||
|
bytes[2] == 0x4E &&
|
||||||
|
bytes[3] == 0x47) {
|
||||||
|
return 'image/png';
|
||||||
|
}
|
||||||
|
return 'image/jpeg';
|
||||||
|
}
|
||||||
|
|
||||||
/// Connexion de l'utilisateur
|
/// Connexion de l'utilisateur
|
||||||
/// Retourne l'utilisateur connecté avec le flag changement_mdp_obligatoire
|
/// Retourne l'utilisateur connecté avec le flag changement_mdp_obligatoire
|
||||||
static Future<AppUser> login(String email, String password) async {
|
static Future<AppUser> login(String email, String password) async {
|
||||||
@ -150,11 +162,15 @@ class AuthService {
|
|||||||
/// Inscription AM complète (POST /auth/register/am).
|
/// Inscription AM complète (POST /auth/register/am).
|
||||||
/// En cas de succès (201), aucune donnée utilisateur retournée ; rediriger vers login.
|
/// En cas de succès (201), aucune donnée utilisateur retournée ; rediriger vers login.
|
||||||
static Future<void> registerAM(AmRegistrationData data) async {
|
static Future<void> registerAM(AmRegistrationData data) async {
|
||||||
|
if (data.agreementDate == null) {
|
||||||
|
throw Exception('La date d\'obtention de l\'agrément est requise.');
|
||||||
|
}
|
||||||
String? photoBase64;
|
String? photoBase64;
|
||||||
String? photoFilename;
|
String? photoFilename;
|
||||||
|
|
||||||
if (data.photoBytes != null && data.photoBytes!.isNotEmpty) {
|
if (data.photoBytes != null && data.photoBytes!.isNotEmpty) {
|
||||||
photoBase64 = 'data:image/jpeg;base64,${base64Encode(data.photoBytes!)}';
|
final mime = _imageMimeForBytes(data.photoBytes!);
|
||||||
|
photoBase64 = 'data:$mime;base64,${base64Encode(data.photoBytes!)}';
|
||||||
final fn = (data.photoFilename ?? '').trim();
|
final fn = (data.photoFilename ?? '').trim();
|
||||||
photoFilename = fn.isNotEmpty ? fn : 'photo_am.jpg';
|
photoFilename = fn.isNotEmpty ? fn : 'photo_am.jpg';
|
||||||
} else if (data.photoPath != null &&
|
} else if (data.photoPath != null &&
|
||||||
@ -165,7 +181,8 @@ class AuthService {
|
|||||||
final file = File(data.photoPath!);
|
final file = File(data.photoPath!);
|
||||||
if (await file.exists()) {
|
if (await file.exists()) {
|
||||||
final bytes = await file.readAsBytes();
|
final bytes = await file.readAsBytes();
|
||||||
photoBase64 = 'data:image/jpeg;base64,${base64Encode(bytes)}';
|
final mime = _imageMimeForBytes(bytes);
|
||||||
|
photoBase64 = 'data:$mime;base64,${base64Encode(bytes)}';
|
||||||
photoFilename =
|
photoFilename =
|
||||||
_basenameFromPath(data.photoPath!) ?? 'photo_am.jpg';
|
_basenameFromPath(data.photoPath!) ?? 'photo_am.jpg';
|
||||||
}
|
}
|
||||||
@ -191,6 +208,8 @@ class AuthService {
|
|||||||
'lieu_naissance_pays': data.birthCountry.isNotEmpty ? data.birthCountry : null,
|
'lieu_naissance_pays': data.birthCountry.isNotEmpty ? data.birthCountry : null,
|
||||||
'nir': normalizeNir(data.nir),
|
'nir': normalizeNir(data.nir),
|
||||||
'numero_agrement': data.agrementNumber,
|
'numero_agrement': data.agrementNumber,
|
||||||
|
'date_agrement':
|
||||||
|
'${data.agreementDate!.year}-${data.agreementDate!.month.toString().padLeft(2, '0')}-${data.agreementDate!.day.toString().padLeft(2, '0')}',
|
||||||
'capacite_accueil': data.capacity ?? 1,
|
'capacite_accueil': data.capacity ?? 1,
|
||||||
'biographie': data.presentationText.isNotEmpty ? data.presentationText : null,
|
'biographie': data.presentationText.isNotEmpty ? data.presentationText : null,
|
||||||
'acceptation_cgu': data.cguAccepted,
|
'acceptation_cgu': data.cguAccepted,
|
||||||
|
|||||||
@ -57,20 +57,22 @@ String formatNir(String raw) {
|
|||||||
return '${r.substring(0, 1)} ${r.substring(1, 3)} ${r.substring(3, 5)} ${r.substring(5, 7)} ${r.substring(7, 10)} ${r.substring(10, 13)} - ${r.substring(13, 15)}';
|
return '${r.substring(0, 1)} ${r.substring(1, 3)} ${r.substring(3, 5)} ${r.substring(5, 7)} ${r.substring(7, 10)} ${r.substring(10, 13)} - ${r.substring(13, 15)}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Vérifie le format : 15 caractères, structure 1+2+2+2+3+3+2, département 2A/2B autorisé.
|
/// Aligné sur le backend (NIR côté API / nir.util.ts) : sexe 1–3, département 2A ou 2B pour la Corse.
|
||||||
bool _isFormatValid(String raw) {
|
bool _isFormatValid(String raw) {
|
||||||
if (raw.length != 15) return false;
|
final r = raw.toUpperCase();
|
||||||
final dept = raw.substring(5, 7);
|
if (r.length != 15) return false;
|
||||||
final restDigits = raw.substring(0, 5) + (dept == '2A' ? '19' : dept == '2B' ? '18' : dept) + raw.substring(7, 15);
|
return RegExp(r'^[1-3]\d{4}(?:2A|2B|\d{2})\d{6}\d{2}$').hasMatch(r);
|
||||||
if (!RegExp(r'^[12]\d{12}\d{2}$').hasMatch(restDigits)) return false;
|
|
||||||
return RegExp(r'^[12]\d{4}(?:\d{2}|2A|2B)\d{8}$').hasMatch(raw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Calcule la clé de contrôle (97 - (NIR13 mod 97)). Pour 2A→19, 2B→18.
|
/// Clé INSEE : 97 - (NIR13 mod 97). Corse : 2A→19, 2B→20 (aligné backend).
|
||||||
int _controlKey(String raw13) {
|
int _controlKey(String raw13) {
|
||||||
String n = raw13;
|
String n;
|
||||||
if (raw13.length >= 7 && (raw13.substring(5, 7) == '2A' || raw13.substring(5, 7) == '2B')) {
|
if (raw13.length >= 7 && raw13.substring(5, 7) == '2A') {
|
||||||
n = raw13.substring(0, 5) + (raw13.substring(5, 7) == '2A' ? '19' : '18') + raw13.substring(7);
|
n = '${raw13.substring(0, 5)}19${raw13.substring(7)}';
|
||||||
|
} else if (raw13.length >= 7 && raw13.substring(5, 7) == '2B') {
|
||||||
|
n = '${raw13.substring(0, 5)}20${raw13.substring(7)}';
|
||||||
|
} else {
|
||||||
|
n = '${raw13.substring(0, 5)}${raw13.substring(5, 7)}${raw13.substring(7)}';
|
||||||
}
|
}
|
||||||
final big = int.tryParse(n);
|
final big = int.tryParse(n);
|
||||||
if (big == null) return -1;
|
if (big == null) return -1;
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import '../models/user_registration_data.dart';
|
|||||||
import '../models/card_assets.dart';
|
import '../models/card_assets.dart';
|
||||||
import 'custom_app_text_field.dart';
|
import 'custom_app_text_field.dart';
|
||||||
import 'form_field_wrapper.dart';
|
import 'form_field_wrapper.dart';
|
||||||
import 'hover_relief_widget.dart';
|
import 'registration_photo_slot.dart';
|
||||||
import '../config/display_config.dart';
|
import '../config/display_config.dart';
|
||||||
import 'package:p_tits_pas/utils/name_format_utils.dart';
|
import 'package:p_tits_pas/utils/name_format_utils.dart';
|
||||||
|
|
||||||
@ -16,13 +16,12 @@ const String _photoConsentTooltip =
|
|||||||
'Suivi du dossier et organisation de l’accueil (affichage interne, outils pédagogiques).\n'
|
'Suivi du dossier et organisation de l’accueil (affichage interne, outils pédagogiques).\n'
|
||||||
'Dans le respect de la politique de confidentialité.';
|
'Dans le respect de la politique de confidentialité.';
|
||||||
|
|
||||||
/// Cadre photo (centre transparent), même dossier que `photo.png`.
|
|
||||||
const String _photoSketchFrameAsset = 'assets/images/photo_frame.png';
|
|
||||||
|
|
||||||
bool _hasChildPhoto(ChildData c) {
|
bool _hasChildPhoto(ChildData c) {
|
||||||
final b = c.imageBytes;
|
return registrationPhotoSlotHasImage(
|
||||||
if (b != null && b.isNotEmpty) return true;
|
imageBytes: c.imageBytes,
|
||||||
return c.imageFile != null;
|
imageFile: c.imageFile,
|
||||||
|
imagePathOrAsset: null,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildChildPhotoImage(ChildData c, {required BoxFit fit}) {
|
Widget _buildChildPhotoImage(ChildData c, {required BoxFit fit}) {
|
||||||
@ -194,11 +193,6 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
final Color baseCardColorForShadow = widget.childData.cardColor == CardColorVertical.lavender
|
final Color baseCardColorForShadow = widget.childData.cardColor == CardColorVertical.lavender
|
||||||
? Colors.purple.shade200
|
? Colors.purple.shade200
|
||||||
: (widget.childData.cardColor == CardColorVertical.pink ? Colors.pink.shade200 : Colors.grey.shade200);
|
: (widget.childData.cardColor == CardColorVertical.pink ? Colors.pink.shade200 : Colors.grey.shade200);
|
||||||
final Color initialPhotoShadow =
|
|
||||||
Color.alphaBlend(Colors.black.withOpacity(0.22), baseCardColorForShadow);
|
|
||||||
final Color hoverPhotoShadow =
|
|
||||||
Color.alphaBlend(Colors.black.withOpacity(0.32), baseCardColorForShadow);
|
|
||||||
|
|
||||||
final double photoSide = 200.0 * (config.isMobile ? 0.8 : 1.0);
|
final double photoSide = 200.0 * (config.isMobile ? 0.8 : 1.0);
|
||||||
final double editableCardWidth = config.isMobile
|
final double editableCardWidth = config.isMobile
|
||||||
? double.infinity
|
? double.infinity
|
||||||
@ -222,14 +216,15 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
_buildEditablePhotoArea(
|
RegistrationPhotoSlot(
|
||||||
context: context,
|
side: photoSide,
|
||||||
config: config,
|
|
||||||
scaleFactor: scaleFactor,
|
scaleFactor: scaleFactor,
|
||||||
photoSide: photoSide,
|
imageBytes: widget.childData.imageBytes,
|
||||||
childData: widget.childData,
|
imageFile: widget.childData.imageFile,
|
||||||
initialPhotoShadow: initialPhotoShadow,
|
onTapPick: !config.isReadonly ? widget.onPickImage : null,
|
||||||
hoverPhotoShadow: hoverPhotoShadow,
|
onClear: !config.isReadonly ? widget.onClearImage : null,
|
||||||
|
baseShadowColor: baseCardColorForShadow,
|
||||||
|
isMobile: config.isMobile,
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0 * scaleFactor),
|
SizedBox(height: 8.0 * scaleFactor),
|
||||||
_buildPhotoConsentRow(
|
_buildPhotoConsentRow(
|
||||||
@ -321,96 +316,6 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEditablePhotoArea({
|
|
||||||
required BuildContext context,
|
|
||||||
required DisplayConfig config,
|
|
||||||
required double scaleFactor,
|
|
||||||
required double photoSide,
|
|
||||||
required ChildData childData,
|
|
||||||
required Color initialPhotoShadow,
|
|
||||||
required Color hoverPhotoShadow,
|
|
||||||
}) {
|
|
||||||
final canInteract = !config.isReadonly;
|
|
||||||
final hasPhoto = _hasChildPhoto(childData);
|
|
||||||
final outerRadius = BorderRadius.circular(10 * scaleFactor);
|
|
||||||
// Arrondi photo (sous le cadre) : proportionnel au carré, plus fort qu’avant (~10×scaleFactor).
|
|
||||||
final photoClipRadius = BorderRadius.circular(photoSide * 0.14);
|
|
||||||
|
|
||||||
return Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
HoverReliefWidget(
|
|
||||||
onPressed: canInteract ? widget.onPickImage : null,
|
|
||||||
borderRadius: outerRadius,
|
|
||||||
initialElevation: 10,
|
|
||||||
hoverElevation: 16,
|
|
||||||
initialShadowColor: initialPhotoShadow,
|
|
||||||
hoverShadowColor: hoverPhotoShadow,
|
|
||||||
// Pas de clip Material sur la pile : l’arrondi de la photo est géré par ClipRRect (plus marqué).
|
|
||||||
clipBehavior: hasPhoto ? Clip.none : Clip.antiAlias,
|
|
||||||
child: SizedBox(
|
|
||||||
width: photoSide,
|
|
||||||
height: photoSide,
|
|
||||||
child: !hasPhoto
|
|
||||||
? ClipRRect(
|
|
||||||
borderRadius: outerRadius,
|
|
||||||
child: Center(
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/photo.png',
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
width: photoSide,
|
|
||||||
height: photoSide,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Stack(
|
|
||||||
fit: StackFit.expand,
|
|
||||||
children: [
|
|
||||||
// Pas de fond opaque : les coins hors ClipRRect laissent voir la carte (aquarelle).
|
|
||||||
Positioned.fill(
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: photoClipRadius,
|
|
||||||
child: _buildChildPhotoImage(childData, fit: BoxFit.cover),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned.fill(
|
|
||||||
child: Image.asset(
|
|
||||||
_photoSketchFrameAsset,
|
|
||||||
fit: BoxFit.fill,
|
|
||||||
errorBuilder: (context, error, stackTrace) =>
|
|
||||||
const SizedBox.shrink(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (hasPhoto && canInteract)
|
|
||||||
Positioned(
|
|
||||||
top: 8 * scaleFactor,
|
|
||||||
right: 8 * scaleFactor,
|
|
||||||
child: Material(
|
|
||||||
color: Colors.transparent,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: widget.onClearImage,
|
|
||||||
customBorder: const CircleBorder(),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
child: Image.asset(
|
|
||||||
'assets/images/cross.png',
|
|
||||||
width: config.isMobile ? 26 : 30,
|
|
||||||
height: config.isMobile ? 26 : 30,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Layout SPÉCIAL Readonly Desktop (Ancien Design Horizontal)
|
/// Layout SPÉCIAL Readonly Desktop (Ancien Design Horizontal)
|
||||||
Widget _buildReadonlyDesktopCard(BuildContext context, DisplayConfig config, Size screenSize) {
|
Widget _buildReadonlyDesktopCard(BuildContext context, DisplayConfig config, Size screenSize) {
|
||||||
// Convertir la couleur verticale (pour mobile) en couleur horizontale (pour desktop/récap)
|
// Convertir la couleur verticale (pour mobile) en couleur horizontale (pour desktop/récap)
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class NirTextField extends StatelessWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.controller,
|
required this.controller,
|
||||||
this.labelText = 'N° Sécurité Sociale (NIR)',
|
this.labelText = 'N° Sécurité Sociale (NIR)',
|
||||||
this.hintText = '15 car. (ex. 1 12 34 56 789 012 - 34 ou 2A Corse)',
|
this.hintText = '15 caractères dont clé valide (dépt 2A ou 2B si Corse)',
|
||||||
this.validator,
|
this.validator,
|
||||||
this.fieldWidth = double.infinity,
|
this.fieldWidth = double.infinity,
|
||||||
this.fieldHeight = 53.0,
|
this.fieldHeight = 53.0,
|
||||||
|
|||||||
@ -10,12 +10,14 @@ import 'dart:io';
|
|||||||
import '../models/card_assets.dart';
|
import '../models/card_assets.dart';
|
||||||
import '../config/display_config.dart';
|
import '../config/display_config.dart';
|
||||||
import '../utils/nir_utils.dart';
|
import '../utils/nir_utils.dart';
|
||||||
|
import '../utils/name_format_utils.dart';
|
||||||
import 'custom_app_text_field.dart';
|
import 'custom_app_text_field.dart';
|
||||||
import 'nir_text_field.dart';
|
import 'nir_text_field.dart';
|
||||||
import 'form_field_wrapper.dart';
|
import 'form_field_wrapper.dart';
|
||||||
import 'app_custom_checkbox.dart';
|
import 'app_custom_checkbox.dart';
|
||||||
import 'hover_relief_widget.dart';
|
import 'hover_relief_widget.dart';
|
||||||
import 'custom_navigation_button.dart';
|
import 'custom_navigation_button.dart';
|
||||||
|
import 'registration_photo_slot.dart';
|
||||||
|
|
||||||
/// Données pour le formulaire d'informations professionnelles
|
/// Données pour le formulaire d'informations professionnelles
|
||||||
class ProfessionalInfoData {
|
class ProfessionalInfoData {
|
||||||
@ -29,6 +31,8 @@ class ProfessionalInfoData {
|
|||||||
final String birthCountry;
|
final String birthCountry;
|
||||||
final String nir;
|
final String nir;
|
||||||
final String agrementNumber;
|
final String agrementNumber;
|
||||||
|
/// Date d'obtention de l'agrément (obligatoire, API `date_agrement`).
|
||||||
|
final DateTime? agreementDate;
|
||||||
final int? capacity;
|
final int? capacity;
|
||||||
|
|
||||||
ProfessionalInfoData({
|
ProfessionalInfoData({
|
||||||
@ -42,6 +46,7 @@ class ProfessionalInfoData {
|
|||||||
this.birthCountry = '',
|
this.birthCountry = '',
|
||||||
this.nir = '',
|
this.nir = '',
|
||||||
this.agrementNumber = '',
|
this.agrementNumber = '',
|
||||||
|
this.agreementDate,
|
||||||
this.capacity,
|
this.capacity,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -87,9 +92,14 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
final _birthCountryController = TextEditingController();
|
final _birthCountryController = TextEditingController();
|
||||||
final _nirController = TextEditingController();
|
final _nirController = TextEditingController();
|
||||||
final _agrementController = TextEditingController();
|
final _agrementController = TextEditingController();
|
||||||
|
final _agreementDateController = TextEditingController();
|
||||||
final _capacityController = TextEditingController();
|
final _capacityController = TextEditingController();
|
||||||
|
|
||||||
|
FocusNode? _birthCityFocus;
|
||||||
|
FocusNode? _birthCountryFocus;
|
||||||
|
|
||||||
DateTime? _selectedDate;
|
DateTime? _selectedDate;
|
||||||
|
DateTime? _selectedAgreementDate;
|
||||||
String? _photoPathFramework;
|
String? _photoPathFramework;
|
||||||
File? _photoFile;
|
File? _photoFile;
|
||||||
Uint8List? _photoBytes;
|
Uint8List? _photoBytes;
|
||||||
@ -118,6 +128,10 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
final nirRaw = nirToRaw(data.nir);
|
final nirRaw = nirToRaw(data.nir);
|
||||||
_nirController.text = nirRaw.length == 15 ? formatNir(nirRaw) : data.nir;
|
_nirController.text = nirRaw.length == 15 ? formatNir(nirRaw) : data.nir;
|
||||||
_agrementController.text = data.agrementNumber;
|
_agrementController.text = data.agrementNumber;
|
||||||
|
_selectedAgreementDate = data.agreementDate;
|
||||||
|
_agreementDateController.text = data.agreementDate != null
|
||||||
|
? DateFormat('dd/MM/yyyy').format(data.agreementDate!)
|
||||||
|
: '';
|
||||||
_capacityController.text = data.capacity?.toString() ?? '';
|
_capacityController.text = data.capacity?.toString() ?? '';
|
||||||
_photoPathFramework = data.photoPath;
|
_photoPathFramework = data.photoPath;
|
||||||
_photoFile = data.photoFile;
|
_photoFile = data.photoFile;
|
||||||
@ -125,15 +139,46 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
_photoFilename = data.photoFilename;
|
_photoFilename = data.photoFilename;
|
||||||
_photoConsent = data.photoConsent;
|
_photoConsent = data.photoConsent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (widget.mode == DisplayMode.editable) {
|
||||||
|
_birthCityFocus = FocusNode();
|
||||||
|
_birthCountryFocus = FocusNode();
|
||||||
|
_birthCityFocus!.addListener(_onBirthCityFocusChange);
|
||||||
|
_birthCountryFocus!.addListener(_onBirthCountryFocusChange);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onBirthCityFocusChange() {
|
||||||
|
if (_birthCityFocus == null || _birthCityFocus!.hasFocus) return;
|
||||||
|
_applyPlaceNameFormat(_birthCityController);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _onBirthCountryFocusChange() {
|
||||||
|
if (_birthCountryFocus == null || _birthCountryFocus!.hasFocus) return;
|
||||||
|
_applyPlaceNameFormat(_birthCountryController);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _applyPlaceNameFormat(TextEditingController controller) {
|
||||||
|
final formatted = formatPersonNameCase(controller.text);
|
||||||
|
if (formatted == controller.text) return;
|
||||||
|
controller.value = TextEditingValue(
|
||||||
|
text: formatted,
|
||||||
|
selection: TextSelection.collapsed(offset: formatted.length),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_birthCityFocus?.removeListener(_onBirthCityFocusChange);
|
||||||
|
_birthCountryFocus?.removeListener(_onBirthCountryFocusChange);
|
||||||
|
_birthCityFocus?.dispose();
|
||||||
|
_birthCountryFocus?.dispose();
|
||||||
_dateOfBirthController.dispose();
|
_dateOfBirthController.dispose();
|
||||||
_birthCityController.dispose();
|
_birthCityController.dispose();
|
||||||
_birthCountryController.dispose();
|
_birthCountryController.dispose();
|
||||||
_nirController.dispose();
|
_nirController.dispose();
|
||||||
_agrementController.dispose();
|
_agrementController.dispose();
|
||||||
|
_agreementDateController.dispose();
|
||||||
_capacityController.dispose();
|
_capacityController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@ -154,6 +199,22 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _selectAgreementDate(BuildContext context) async {
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: _selectedAgreementDate ?? DateTime.now().subtract(const Duration(days: 365 * 5)),
|
||||||
|
firstDate: DateTime(1970, 1),
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
locale: const Locale('fr', 'FR'),
|
||||||
|
);
|
||||||
|
if (picked != null) {
|
||||||
|
setState(() {
|
||||||
|
_selectedAgreementDate = picked;
|
||||||
|
_agreementDateController.text = DateFormat('dd/MM/yyyy').format(picked);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _pickPhoto() async {
|
Future<void> _pickPhoto() async {
|
||||||
if (widget.onPickPhoto != null) {
|
if (widget.onPickPhoto != null) {
|
||||||
await widget.onPickPhoto!();
|
await widget.onPickPhoto!();
|
||||||
@ -190,7 +251,19 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _clearRegistrationPhoto() {
|
||||||
|
setState(() {
|
||||||
|
_photoBytes = null;
|
||||||
|
_photoFile = null;
|
||||||
|
_photoPathFramework = null;
|
||||||
|
_photoFilename = null;
|
||||||
|
_photoConsent = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void _submitForm() {
|
void _submitForm() {
|
||||||
|
_applyPlaceNameFormat(_birthCityController);
|
||||||
|
_applyPlaceNameFormat(_birthCountryController);
|
||||||
if (_formKey.currentState!.validate()) {
|
if (_formKey.currentState!.validate()) {
|
||||||
if (_hasRealPhoto && !_photoConsent) {
|
if (_hasRealPhoto && !_photoConsent) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@ -210,6 +283,7 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
birthCountry: _birthCountryController.text,
|
birthCountry: _birthCountryController.text,
|
||||||
nir: normalizeNir(_nirController.text),
|
nir: normalizeNir(_nirController.text),
|
||||||
agrementNumber: _agrementController.text,
|
agrementNumber: _agrementController.text,
|
||||||
|
agreementDate: _selectedAgreementDate,
|
||||||
capacity: int.tryParse(_capacityController.text),
|
capacity: int.tryParse(_capacityController.text),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -491,35 +565,24 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
children: [
|
children: [
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: 1,
|
aspectRatio: 1,
|
||||||
child: Container(
|
child: LayoutBuilder(
|
||||||
decoration: BoxDecoration(
|
builder: (context, constraints) {
|
||||||
borderRadius: BorderRadius.circular(18),
|
final side = constraints.biggest.shortestSide;
|
||||||
boxShadow: [
|
return RegistrationPhotoSlot(
|
||||||
BoxShadow(
|
side: side,
|
||||||
color: Colors.black.withOpacity(0.1),
|
imageBytes: _photoBytes,
|
||||||
blurRadius: 10,
|
imageFile: _photoFile,
|
||||||
offset: const Offset(0, 5),
|
imagePathOrAsset: _photoPathFramework,
|
||||||
),
|
baseShadowColor: Colors.green.shade300,
|
||||||
],
|
);
|
||||||
),
|
},
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(18),
|
|
||||||
child: _photoBytes != null && _photoBytes!.isNotEmpty
|
|
||||||
? Image.memory(_photoBytes!, fit: BoxFit.cover)
|
|
||||||
: _photoFile != null
|
|
||||||
? Image.file(_photoFile!, fit: BoxFit.cover)
|
|
||||||
: (_photoPathFramework != null &&
|
|
||||||
_photoPathFramework!.startsWith('assets/')
|
|
||||||
? Image.asset(_photoPathFramework!, fit: BoxFit.contain)
|
|
||||||
: Image.asset('assets/images/photo.png', fit: BoxFit.contain)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
AppCustomCheckbox(
|
AppCustomCheckbox(
|
||||||
label: 'J\'accepte l\'utilisation\nde ma photo.',
|
label: 'J\'accepte l\'utilisation\nde ma photo.',
|
||||||
value: _photoConsent,
|
value: _photoConsent,
|
||||||
onChanged: (v) {}, // Readonly
|
onChanged: (_) {}, // Readonly
|
||||||
checkboxSize: 22.0,
|
checkboxSize: 22.0,
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
),
|
),
|
||||||
@ -534,32 +597,49 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
// Ligne 1 : Ville + Pays
|
// Ligne 1 : Date de naissance + Ville
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: _buildReadonlyField('Ville de naissance', _birthCityController.text)),
|
Expanded(flex: 2, child: _buildReadonlyField('Date de naissance', _dateOfBirthController.text)),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Expanded(child: _buildReadonlyField('Pays de naissance', _birthCountryController.text)),
|
Expanded(flex: 3, child: _buildReadonlyField('Ville de naissance', _birthCityController.text)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Ligne 2 : Date + NIR (NIR prend plus de place si possible ou 50/50)
|
// Ligne 2 : Pays + NIR
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(flex: 2, child: _buildReadonlyField('Date de naissance', _dateOfBirthController.text)),
|
Expanded(flex: 2, child: _buildReadonlyField('Pays de naissance', _birthCountryController.text)),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Expanded(flex: 3, child: _buildReadonlyField('NIR', _formatNirForDisplay(_nirController.text))),
|
Expanded(flex: 3, child: _buildReadonlyField('NIR', _formatNirForDisplay(_nirController.text))),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
// Ligne 3 : Agrément + Capacité
|
// Ligne 3 : N° agrément + Date d'obtention
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(flex: 3, child: _buildReadonlyField('N° Agrément', _agrementController.text)),
|
Expanded(
|
||||||
|
flex: 3,
|
||||||
|
child: _buildReadonlyField('N° d\'agrément', _agrementController.text),
|
||||||
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Expanded(flex: 2, child: _buildReadonlyField('Capacité', _capacityController.text)),
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: _buildReadonlyField(
|
||||||
|
'Date d\'obtention de l\'agrément',
|
||||||
|
_agreementDateController.text.isNotEmpty ? _agreementDateController.text : '—',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: _buildReadonlyField('Capacité d\'accueil', _capacityController.text),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -633,22 +713,6 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_buildField(
|
|
||||||
config: config,
|
|
||||||
label: 'Ville de naissance',
|
|
||||||
controller: _birthCityController,
|
|
||||||
hint: 'Votre ville de naissance',
|
|
||||||
validator: (v) => v!.isEmpty ? 'Ville requise' : null,
|
|
||||||
),
|
|
||||||
SizedBox(height: verticalSpacing),
|
|
||||||
_buildField(
|
|
||||||
config: config,
|
|
||||||
label: 'Pays de naissance',
|
|
||||||
controller: _birthCountryController,
|
|
||||||
hint: 'Votre pays de naissance',
|
|
||||||
validator: (v) => v!.isEmpty ? 'Pays requis' : null,
|
|
||||||
),
|
|
||||||
SizedBox(height: verticalSpacing),
|
|
||||||
_buildField(
|
_buildField(
|
||||||
config: config,
|
config: config,
|
||||||
label: 'Date de naissance',
|
label: 'Date de naissance',
|
||||||
@ -659,6 +723,24 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
suffixIcon: Icons.calendar_today,
|
suffixIcon: Icons.calendar_today,
|
||||||
validator: (v) => _selectedDate == null ? 'Date requise' : null,
|
validator: (v) => _selectedDate == null ? 'Date requise' : null,
|
||||||
),
|
),
|
||||||
|
SizedBox(height: verticalSpacing),
|
||||||
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Ville de naissance',
|
||||||
|
controller: _birthCityController,
|
||||||
|
hint: 'Ex. Ajaccio, Paris, Casablanca…',
|
||||||
|
validator: (v) => v!.isEmpty ? 'Ville requise' : null,
|
||||||
|
focusNode: _birthCityFocus,
|
||||||
|
),
|
||||||
|
SizedBox(height: verticalSpacing),
|
||||||
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Pays de naissance',
|
||||||
|
controller: _birthCountryController,
|
||||||
|
hint: 'Ex. France, Maroc…',
|
||||||
|
validator: (v) => v!.isEmpty ? 'Pays requis' : null,
|
||||||
|
focusNode: _birthCountryFocus,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -674,6 +756,7 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
),
|
),
|
||||||
SizedBox(height: verticalSpacing),
|
SizedBox(height: verticalSpacing),
|
||||||
Row(
|
Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: _buildField(
|
child: _buildField(
|
||||||
@ -688,20 +771,33 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: _buildField(
|
child: _buildField(
|
||||||
config: config,
|
config: config,
|
||||||
label: 'Capacité d\'accueil',
|
label: 'Date d\'obtention de l\'agrément',
|
||||||
controller: _capacityController,
|
controller: _agreementDateController,
|
||||||
hint: 'Ex: 3',
|
hint: 'JJ/MM/AAAA',
|
||||||
keyboardType: TextInputType.number,
|
readOnly: true,
|
||||||
validator: (v) {
|
onTap: () => _selectAgreementDate(context),
|
||||||
if (v == null || v.isEmpty) return 'Capacité requise';
|
suffixIcon: Icons.calendar_today,
|
||||||
final n = int.tryParse(v);
|
validator: (_) =>
|
||||||
if (n == null || n <= 0) return 'Nombre invalide';
|
_selectedAgreementDate == null ? 'Date d\'obtention requise' : null,
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
SizedBox(height: verticalSpacing),
|
||||||
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Capacité d\'accueil',
|
||||||
|
controller: _capacityController,
|
||||||
|
hint: 'De 1 à 10 enfants',
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
validator: (v) {
|
||||||
|
if (v == null || v.isEmpty) return 'Capacité requise';
|
||||||
|
final n = int.tryParse(v);
|
||||||
|
if (n == null || n < 1) return 'Entrez un nombre entre 1 et 10';
|
||||||
|
if (n > 10) return 'Maximum 10 (plafond agrément)';
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -715,24 +811,6 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
_buildPhotoSection(context, config),
|
_buildPhotoSection(context, config),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
_buildField(
|
|
||||||
config: config,
|
|
||||||
label: 'Ville de naissance',
|
|
||||||
controller: _birthCityController,
|
|
||||||
hint: 'Votre ville de naissance',
|
|
||||||
validator: (v) => v!.isEmpty ? 'Ville requise' : null,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
_buildField(
|
|
||||||
config: config,
|
|
||||||
label: 'Pays de naissance',
|
|
||||||
controller: _birthCountryController,
|
|
||||||
hint: 'Votre pays de naissance',
|
|
||||||
validator: (v) => v!.isEmpty ? 'Pays requis' : null,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 12),
|
|
||||||
|
|
||||||
_buildField(
|
_buildField(
|
||||||
config: config,
|
config: config,
|
||||||
label: 'Date de naissance',
|
label: 'Date de naissance',
|
||||||
@ -745,6 +823,26 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Ville de naissance',
|
||||||
|
controller: _birthCityController,
|
||||||
|
hint: 'Ex. Ajaccio, Paris, Casablanca…',
|
||||||
|
validator: (v) => v!.isEmpty ? 'Ville requise' : null,
|
||||||
|
focusNode: _birthCityFocus,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Pays de naissance',
|
||||||
|
controller: _birthCountryController,
|
||||||
|
hint: 'Ex. France, Maroc…',
|
||||||
|
validator: (v) => v!.isEmpty ? 'Pays requis' : null,
|
||||||
|
focusNode: _birthCountryFocus,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
NirTextField(
|
NirTextField(
|
||||||
controller: _nirController,
|
controller: _nirController,
|
||||||
fieldWidth: double.infinity,
|
fieldWidth: double.infinity,
|
||||||
@ -754,25 +852,46 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
_buildField(
|
Row(
|
||||||
config: config,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
label: 'N° d\'agrément',
|
children: [
|
||||||
controller: _agrementController,
|
Expanded(
|
||||||
hint: 'Votre numéro d\'agrément',
|
child: _buildField(
|
||||||
validator: (v) => v!.isEmpty ? 'Agrément requis' : null,
|
config: config,
|
||||||
|
label: 'N° d\'agrément',
|
||||||
|
controller: _agrementController,
|
||||||
|
hint: 'N° agrément',
|
||||||
|
validator: (v) => v!.isEmpty ? 'Agrément requis' : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
Expanded(
|
||||||
|
child: _buildField(
|
||||||
|
config: config,
|
||||||
|
label: 'Date d\'obtention de l\'agrément',
|
||||||
|
controller: _agreementDateController,
|
||||||
|
hint: 'JJ/MM/AAAA',
|
||||||
|
readOnly: true,
|
||||||
|
onTap: () => _selectAgreementDate(context),
|
||||||
|
suffixIcon: Icons.calendar_today,
|
||||||
|
validator: (_) =>
|
||||||
|
_selectedAgreementDate == null ? 'Date d\'obtention requise' : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
|
|
||||||
_buildField(
|
_buildField(
|
||||||
config: config,
|
config: config,
|
||||||
label: 'Capacité d\'accueil',
|
label: 'Capacité d\'accueil',
|
||||||
controller: _capacityController,
|
controller: _capacityController,
|
||||||
hint: 'Ex: 3',
|
hint: 'De 1 à 10 enfants',
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
validator: (v) {
|
validator: (v) {
|
||||||
if (v == null || v.isEmpty) return 'Capacité requise';
|
if (v == null || v.isEmpty) return 'Capacité requise';
|
||||||
final n = int.tryParse(v);
|
final n = int.tryParse(v);
|
||||||
if (n == null || n <= 0) return 'Nombre invalide';
|
if (n == null || n < 1) return 'Entrez un nombre entre 1 et 10';
|
||||||
|
if (n > 10) return 'Maximum 10 (plafond agrément)';
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -780,52 +899,33 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Section photo + checkbox
|
/// Section photo + checkbox (même logique visuelle que les enfants : cadre, croix).
|
||||||
Widget _buildPhotoSection(BuildContext context, DisplayConfig config) {
|
Widget _buildPhotoSection(BuildContext context, DisplayConfig config) {
|
||||||
final Color baseCardColorForShadow = Colors.green.shade300;
|
|
||||||
final Color initialPhotoShadow = baseCardColorForShadow.withAlpha(90);
|
|
||||||
final Color hoverPhotoShadow = baseCardColorForShadow.withAlpha(130);
|
|
||||||
|
|
||||||
ImageProvider? currentImageProvider;
|
|
||||||
if (_photoBytes != null && _photoBytes!.isNotEmpty) {
|
|
||||||
currentImageProvider = MemoryImage(_photoBytes!);
|
|
||||||
} else if (_photoFile != null) {
|
|
||||||
currentImageProvider = FileImage(_photoFile!);
|
|
||||||
} else if (_photoPathFramework != null && _photoPathFramework!.startsWith('assets/')) {
|
|
||||||
currentImageProvider = AssetImage(_photoPathFramework!);
|
|
||||||
}
|
|
||||||
|
|
||||||
final photoSize = config.isMobile ? 200.0 : 270.0;
|
final photoSize = config.isMobile ? 200.0 : 270.0;
|
||||||
|
final scaleFactor = config.isMobile ? 0.9 : 1.1;
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
HoverReliefWidget(
|
RegistrationPhotoSlot(
|
||||||
onPressed: _pickPhoto,
|
side: photoSize,
|
||||||
borderRadius: BorderRadius.circular(10.0),
|
scaleFactor: scaleFactor,
|
||||||
initialShadowColor: initialPhotoShadow,
|
imageBytes: _photoBytes,
|
||||||
hoverShadowColor: hoverPhotoShadow,
|
imageFile: _photoFile,
|
||||||
child: SizedBox(
|
imagePathOrAsset: _photoPathFramework,
|
||||||
height: photoSize,
|
onTapPick: config.isReadonly ? null : _pickPhoto,
|
||||||
width: photoSize,
|
onClear: config.isReadonly ? null : _clearRegistrationPhoto,
|
||||||
child: Container(
|
baseShadowColor: Colors.green.shade300,
|
||||||
decoration: BoxDecoration(
|
isMobile: config.isMobile,
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
image: currentImageProvider != null
|
|
||||||
? DecorationImage(image: currentImageProvider, fit: BoxFit.cover)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
child: currentImageProvider == null
|
|
||||||
? Image.asset('assets/images/photo.png', fit: BoxFit.contain)
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
AppCustomCheckbox(
|
AppCustomCheckbox(
|
||||||
label: 'J\'accepte l\'utilisation\nde ma photo.',
|
label: 'J\'accepte l\'utilisation\nde ma photo.',
|
||||||
value: _photoConsent,
|
value: _photoConsent,
|
||||||
onChanged: (val) => setState(() => _photoConsent = val == true),
|
onChanged: (val) {
|
||||||
|
if (config.isReadonly) return;
|
||||||
|
setState(() => _photoConsent = val == true);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -843,6 +943,7 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
IconData? suffixIcon,
|
IconData? suffixIcon,
|
||||||
String? Function(String?)? validator,
|
String? Function(String?)? validator,
|
||||||
List<TextInputFormatter>? inputFormatters,
|
List<TextInputFormatter>? inputFormatters,
|
||||||
|
FocusNode? focusNode,
|
||||||
}) {
|
}) {
|
||||||
if (config.isReadonly) {
|
if (config.isReadonly) {
|
||||||
return FormFieldWrapper(
|
return FormFieldWrapper(
|
||||||
@ -853,6 +954,7 @@ class _ProfessionalInfoFormScreenState extends State<ProfessionalInfoFormScreen>
|
|||||||
} else {
|
} else {
|
||||||
return CustomAppTextField(
|
return CustomAppTextField(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
focusNode: focusNode,
|
||||||
labelText: label,
|
labelText: label,
|
||||||
hintText: hint ?? label,
|
hintText: hint ?? label,
|
||||||
fieldWidth: double.infinity,
|
fieldWidth: double.infinity,
|
||||||
|
|||||||
169
frontend/lib/widgets/registration_photo_slot.dart
Normal file
169
frontend/lib/widgets/registration_photo_slot.dart
Normal file
@ -0,0 +1,169 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'hover_relief_widget.dart';
|
||||||
|
|
||||||
|
/// Cadre « croquis » par-dessus la photo (même ressource que les cartes enfant).
|
||||||
|
const String kRegistrationPhotoFrameAsset = 'assets/images/photo_frame.png';
|
||||||
|
|
||||||
|
/// Indique si une photo « réelle » est présente (hors seul placeholder asset).
|
||||||
|
bool registrationPhotoSlotHasImage({
|
||||||
|
Uint8List? imageBytes,
|
||||||
|
File? imageFile,
|
||||||
|
String? imagePathOrAsset,
|
||||||
|
}) {
|
||||||
|
if (imageBytes != null && imageBytes.isNotEmpty) return true;
|
||||||
|
if (imageFile != null) return true;
|
||||||
|
if (imagePathOrAsset == null || imagePathOrAsset.isEmpty) return false;
|
||||||
|
return !imagePathOrAsset.startsWith('assets/');
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Zone photo uniforme : cadre gris / placeholder, tap pour choisir, croix pour retirer, cadre dessin si photo.
|
||||||
|
///
|
||||||
|
/// Utilisé inscription **enfants** ([ChildCardWidget]) et **AM** ([ProfessionalInfoFormScreen]).
|
||||||
|
class RegistrationPhotoSlot extends StatelessWidget {
|
||||||
|
final double side;
|
||||||
|
final double scaleFactor;
|
||||||
|
final Uint8List? imageBytes;
|
||||||
|
final File? imageFile;
|
||||||
|
/// Chemin fichier local (hors `assets/`) ou URI asset `assets/...`.
|
||||||
|
final String? imagePathOrAsset;
|
||||||
|
final VoidCallback? onTapPick;
|
||||||
|
final VoidCallback? onClear;
|
||||||
|
final Color baseShadowColor;
|
||||||
|
final String placeholderAsset;
|
||||||
|
final bool isMobile;
|
||||||
|
|
||||||
|
const RegistrationPhotoSlot({
|
||||||
|
super.key,
|
||||||
|
required this.side,
|
||||||
|
this.scaleFactor = 1.0,
|
||||||
|
this.imageBytes,
|
||||||
|
this.imageFile,
|
||||||
|
this.imagePathOrAsset,
|
||||||
|
this.onTapPick,
|
||||||
|
this.onClear,
|
||||||
|
required this.baseShadowColor,
|
||||||
|
this.placeholderAsset = 'assets/images/photo.png',
|
||||||
|
this.isMobile = false,
|
||||||
|
});
|
||||||
|
|
||||||
|
bool get _hasImage => registrationPhotoSlotHasImage(
|
||||||
|
imageBytes: imageBytes,
|
||||||
|
imageFile: imageFile,
|
||||||
|
imagePathOrAsset: imagePathOrAsset,
|
||||||
|
);
|
||||||
|
|
||||||
|
Widget _buildImage({required BoxFit fit}) {
|
||||||
|
final b = imageBytes;
|
||||||
|
if (b != null && b.isNotEmpty) {
|
||||||
|
return Image.memory(b, fit: fit);
|
||||||
|
}
|
||||||
|
final f = imageFile;
|
||||||
|
if (f != null) {
|
||||||
|
return kIsWeb ? Image.network(f.path, fit: fit) : Image.file(f, fit: fit);
|
||||||
|
}
|
||||||
|
final p = imagePathOrAsset;
|
||||||
|
if (p != null && p.isNotEmpty) {
|
||||||
|
if (p.startsWith('assets/')) {
|
||||||
|
return Image.asset(p, fit: fit);
|
||||||
|
}
|
||||||
|
if (!kIsWeb) {
|
||||||
|
try {
|
||||||
|
final file = File(p);
|
||||||
|
if (file.existsSync()) {
|
||||||
|
return Image.file(file, fit: fit);
|
||||||
|
}
|
||||||
|
} catch (_) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Image.asset(placeholderAsset, fit: BoxFit.contain);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final canPick = onTapPick != null;
|
||||||
|
final canClear = onClear != null && _hasImage;
|
||||||
|
final outerRadius = BorderRadius.circular(10 * scaleFactor);
|
||||||
|
final photoClipRadius = BorderRadius.circular(side * 0.14);
|
||||||
|
final initialPhotoShadow =
|
||||||
|
Color.alphaBlend(Colors.black.withOpacity(0.22), baseShadowColor);
|
||||||
|
final hoverPhotoShadow =
|
||||||
|
Color.alphaBlend(Colors.black.withOpacity(0.32), baseShadowColor);
|
||||||
|
|
||||||
|
return Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
HoverReliefWidget(
|
||||||
|
onPressed: canPick ? onTapPick : null,
|
||||||
|
borderRadius: outerRadius,
|
||||||
|
initialElevation: 10,
|
||||||
|
hoverElevation: 16,
|
||||||
|
initialShadowColor: initialPhotoShadow,
|
||||||
|
hoverShadowColor: hoverPhotoShadow,
|
||||||
|
clipBehavior: _hasImage ? Clip.none : Clip.antiAlias,
|
||||||
|
child: SizedBox(
|
||||||
|
width: side,
|
||||||
|
height: side,
|
||||||
|
child: !_hasImage
|
||||||
|
? ClipRRect(
|
||||||
|
borderRadius: outerRadius,
|
||||||
|
child: Center(
|
||||||
|
child: Image.asset(
|
||||||
|
placeholderAsset,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
width: side,
|
||||||
|
height: side,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Stack(
|
||||||
|
fit: StackFit.expand,
|
||||||
|
children: [
|
||||||
|
Positioned.fill(
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: photoClipRadius,
|
||||||
|
child: _buildImage(fit: BoxFit.cover),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Positioned.fill(
|
||||||
|
child: Image.asset(
|
||||||
|
kRegistrationPhotoFrameAsset,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
errorBuilder: (context, error, stackTrace) =>
|
||||||
|
const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (canClear)
|
||||||
|
Positioned(
|
||||||
|
top: 8 * scaleFactor,
|
||||||
|
right: 8 * scaleFactor,
|
||||||
|
child: Material(
|
||||||
|
color: Colors.transparent,
|
||||||
|
child: InkWell(
|
||||||
|
onTap: onClear,
|
||||||
|
customBorder: const CircleBorder(),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(4),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/cross.png',
|
||||||
|
width: isMobile ? 26 : 30,
|
||||||
|
height: isMobile ? 26 : 30,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
127
tests/scripts/register-am-dubois-test.mjs
Normal file
127
tests/scripts/register-am-dubois-test.mjs
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
/**
|
||||||
|
* POST /api/v1/auth/register/am — jeu de test officiel Marie DUBOIS (docs/test-data + seed).
|
||||||
|
* Email : marie.dubois@ptits-pas.fr
|
||||||
|
*
|
||||||
|
* Photo attendue : tests/ressources/photos/dubois-marie.png
|
||||||
|
* Données alignées sur database/seed/03_seed_test_data.sql (NIR, dates, agrément, adresse).
|
||||||
|
* (réduction JPEG locale via sharp-cli si besoin, comme les autres scripts lourds)
|
||||||
|
*
|
||||||
|
* Usage : node tests/scripts/register-am-dubois-test.mjs [BASE_URL]
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import os from 'os';
|
||||||
|
import https from 'https';
|
||||||
|
import http from 'http';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const repoRoot = path.join(__dirname, '..', '..');
|
||||||
|
const photosDir = path.join(__dirname, '..', 'ressources', 'photos');
|
||||||
|
|
||||||
|
function shrinkToJpeg(inputPath, label) {
|
||||||
|
const out = path.join(os.tmpdir(), `ptitspas-${label}-${Date.now()}.jpg`);
|
||||||
|
const cmd = `npx --yes sharp-cli -i ${JSON.stringify(inputPath)} -o ${JSON.stringify(out)} -mq80 resize 600 600`;
|
||||||
|
execSync(cmd, { cwd: repoRoot, stdio: 'inherit', shell: true });
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDataUri(filePath) {
|
||||||
|
const buf = fs.readFileSync(filePath);
|
||||||
|
const ext = path.extname(filePath).toLowerCase();
|
||||||
|
const mime =
|
||||||
|
ext === '.jpg' || ext === '.jpeg' ? 'image/jpeg' : 'image/png';
|
||||||
|
return `data:${mime};base64,${buf.toString('base64')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const photoSrc = path.join(photosDir, 'dubois-marie.png');
|
||||||
|
|
||||||
|
let photoPath;
|
||||||
|
try {
|
||||||
|
console.error('Préparation photo (sharp-cli)…');
|
||||||
|
photoPath = shrinkToJpeg(photoSrc, 'am-dubois');
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
email: 'marie.dubois@ptits-pas.fr',
|
||||||
|
prenom: 'Marie',
|
||||||
|
nom: 'DUBOIS',
|
||||||
|
telephone: '0696345678',
|
||||||
|
adresse: '25 Rue de la République',
|
||||||
|
code_postal: '95870',
|
||||||
|
ville: 'Bezons',
|
||||||
|
photo_base64: toDataUri(photoPath),
|
||||||
|
photo_filename: 'marie_dubois.jpg',
|
||||||
|
consentement_photo: true,
|
||||||
|
date_naissance: '1980-06-08',
|
||||||
|
lieu_naissance_ville: 'Ajaccio',
|
||||||
|
lieu_naissance_pays: 'France',
|
||||||
|
nir: '280062A00100191',
|
||||||
|
numero_agrement: 'AGR-2019-095001',
|
||||||
|
date_agrement: '2019-09-01',
|
||||||
|
capacite_accueil: 4,
|
||||||
|
biographie:
|
||||||
|
"Assistante maternelle agréée depuis 2019. Née en Corse à Ajaccio. Spécialité bébés 0-18 mois. " +
|
||||||
|
'Accueil bienveillant et cadre sécurisant. 2 places disponibles.',
|
||||||
|
acceptation_cgu: true,
|
||||||
|
acceptation_privacy: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const json = JSON.stringify(body);
|
||||||
|
const baseArg = process.argv[2] || 'https://app.ptits-pas.fr';
|
||||||
|
const base = new URL(baseArg.endsWith('/') ? baseArg.slice(0, -1) : baseArg);
|
||||||
|
const url = new URL('/api/v1/auth/register/am', `${base.protocol}//${base.host}`);
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
hostname: url.hostname,
|
||||||
|
port: url.port || (url.protocol === 'https:' ? 443 : 80),
|
||||||
|
path: url.pathname,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Length': Buffer.byteLength(json, 'utf8'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const lib = url.protocol === 'https:' ? https : http;
|
||||||
|
|
||||||
|
console.error(`POST ${url.href} (payload ~${Math.round(json.length / 1024)} Ko)`);
|
||||||
|
|
||||||
|
const req = lib.request(opts, (res) => {
|
||||||
|
let data = '';
|
||||||
|
res.on('data', (c) => {
|
||||||
|
data += c;
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
console.log('HTTP', res.statusCode);
|
||||||
|
try {
|
||||||
|
const j = JSON.parse(data);
|
||||||
|
console.log(JSON.stringify(j, null, 2));
|
||||||
|
} catch {
|
||||||
|
console.log(data.slice(0, 4000));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', (e) => {
|
||||||
|
console.error('Erreur réseau:', e.message);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.setTimeout(120000, () => {
|
||||||
|
req.destroy();
|
||||||
|
console.error('Timeout 120s');
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.write(json);
|
||||||
|
req.end();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (photoPath && fs.existsSync(photoPath)) fs.unlinkSync(photoPath);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
126
tests/scripts/register-am-mansouri-test.mjs
Normal file
126
tests/scripts/register-am-mansouri-test.mjs
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/**
|
||||||
|
* POST /api/v1/auth/register/am — jeu de test officiel Fatima EL MANSOURI (docs/test-data + seed).
|
||||||
|
* Email : fatima.elmansouri@ptits-pas.fr
|
||||||
|
*
|
||||||
|
* Photo attendue : tests/ressources/photos/mansouri-fatima.png
|
||||||
|
* Données alignées sur database/seed/03_seed_test_data.sql (NIR, dates, agrément, adresse).
|
||||||
|
*
|
||||||
|
* Usage : node tests/scripts/register-am-mansouri-test.mjs [BASE_URL]
|
||||||
|
*/
|
||||||
|
|
||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import os from 'os';
|
||||||
|
import https from 'https';
|
||||||
|
import http from 'http';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
const repoRoot = path.join(__dirname, '..', '..');
|
||||||
|
const photosDir = path.join(__dirname, '..', 'ressources', 'photos');
|
||||||
|
|
||||||
|
function shrinkToJpeg(inputPath, label) {
|
||||||
|
const out = path.join(os.tmpdir(), `ptitspas-${label}-${Date.now()}.jpg`);
|
||||||
|
const cmd = `npx --yes sharp-cli -i ${JSON.stringify(inputPath)} -o ${JSON.stringify(out)} -mq80 resize 600 600`;
|
||||||
|
execSync(cmd, { cwd: repoRoot, stdio: 'inherit', shell: true });
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function toDataUri(filePath) {
|
||||||
|
const buf = fs.readFileSync(filePath);
|
||||||
|
const ext = path.extname(filePath).toLowerCase();
|
||||||
|
const mime =
|
||||||
|
ext === '.jpg' || ext === '.jpeg' ? 'image/jpeg' : 'image/png';
|
||||||
|
return `data:${mime};base64,${buf.toString('base64')}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const photoSrc = path.join(photosDir, 'mansouri-fatima.png');
|
||||||
|
|
||||||
|
let photoPath;
|
||||||
|
try {
|
||||||
|
console.error('Préparation photo (sharp-cli)…');
|
||||||
|
photoPath = shrinkToJpeg(photoSrc, 'am-mansouri');
|
||||||
|
|
||||||
|
const body = {
|
||||||
|
email: 'fatima.elmansouri@ptits-pas.fr',
|
||||||
|
prenom: 'Fatima',
|
||||||
|
nom: 'EL MANSOURI',
|
||||||
|
telephone: '0675456789',
|
||||||
|
adresse: '17 Boulevard Aristide Briand',
|
||||||
|
code_postal: '95870',
|
||||||
|
ville: 'Bezons',
|
||||||
|
photo_base64: toDataUri(photoPath),
|
||||||
|
photo_filename: 'fatima_elmansouri.jpg',
|
||||||
|
consentement_photo: true,
|
||||||
|
date_naissance: '1975-11-12',
|
||||||
|
lieu_naissance_ville: 'Casablanca',
|
||||||
|
lieu_naissance_pays: 'Maroc',
|
||||||
|
nir: '275119900100102',
|
||||||
|
numero_agrement: 'AGR-2017-095002',
|
||||||
|
date_agrement: '2017-06-15',
|
||||||
|
capacite_accueil: 3,
|
||||||
|
biographie:
|
||||||
|
"Assistante maternelle expérimentée. Née à l'étranger. Spécialité 1-3 ans. " +
|
||||||
|
'Accueil à la journée. 1 place disponible.',
|
||||||
|
acceptation_cgu: true,
|
||||||
|
acceptation_privacy: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
const json = JSON.stringify(body);
|
||||||
|
const baseArg = process.argv[2] || 'https://app.ptits-pas.fr';
|
||||||
|
const base = new URL(baseArg.endsWith('/') ? baseArg.slice(0, -1) : baseArg);
|
||||||
|
const url = new URL('/api/v1/auth/register/am', `${base.protocol}//${base.host}`);
|
||||||
|
|
||||||
|
const opts = {
|
||||||
|
hostname: url.hostname,
|
||||||
|
port: url.port || (url.protocol === 'https:' ? 443 : 80),
|
||||||
|
path: url.pathname,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Accept: 'application/json',
|
||||||
|
'Content-Length': Buffer.byteLength(json, 'utf8'),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const lib = url.protocol === 'https:' ? https : http;
|
||||||
|
|
||||||
|
console.error(`POST ${url.href} (payload ~${Math.round(json.length / 1024)} Ko)`);
|
||||||
|
|
||||||
|
const req = lib.request(opts, (res) => {
|
||||||
|
let data = '';
|
||||||
|
res.on('data', (c) => {
|
||||||
|
data += c;
|
||||||
|
});
|
||||||
|
res.on('end', () => {
|
||||||
|
console.log('HTTP', res.statusCode);
|
||||||
|
try {
|
||||||
|
const j = JSON.parse(data);
|
||||||
|
console.log(JSON.stringify(j, null, 2));
|
||||||
|
} catch {
|
||||||
|
console.log(data.slice(0, 4000));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', (e) => {
|
||||||
|
console.error('Erreur réseau:', e.message);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.setTimeout(120000, () => {
|
||||||
|
req.destroy();
|
||||||
|
console.error('Timeout 120s');
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
req.write(json);
|
||||||
|
req.end();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (photoPath && fs.existsSync(photoPath)) fs.unlinkSync(photoPath);
|
||||||
|
} catch {
|
||||||
|
/* ignore */
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,7 +2,7 @@
|
|||||||
* POST /api/v1/auth/register/parent — jeu de test officiel couple DURAND / ROUSSEAU (docs/test-data + seed).
|
* POST /api/v1/auth/register/parent — jeu de test officiel couple DURAND / ROUSSEAU (docs/test-data + seed).
|
||||||
* Emails : amelie.durand@ptits-pas.fr, julien.rousseau@ptits-pas.fr
|
* Emails : amelie.durand@ptits-pas.fr, julien.rousseau@ptits-pas.fr
|
||||||
*
|
*
|
||||||
* Les PNG dans ressources/Photos dépassent la limite JSON (~15 Mo) du serveur : réduction locale
|
* Les PNG dans tests/ressources/photos dépassent la limite JSON (~15 Mo) du serveur : réduction locale
|
||||||
* via npx sharp-cli (resize 600 + JPEG q80) avant encodage base64.
|
* via npx sharp-cli (resize 600 + JPEG q80) avant encodage base64.
|
||||||
*
|
*
|
||||||
* Usage : node tests/scripts/register-parent-durand-rousseau-test.mjs [BASE_URL]
|
* Usage : node tests/scripts/register-parent-durand-rousseau-test.mjs [BASE_URL]
|
||||||
@ -18,7 +18,7 @@ import { fileURLToPath } from 'url';
|
|||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const repoRoot = path.join(__dirname, '..', '..');
|
const repoRoot = path.join(__dirname, '..', '..');
|
||||||
const photosDir = path.join(repoRoot, 'ressources', 'Photos');
|
const photosDir = path.join(__dirname, '..', 'ressources', 'photos');
|
||||||
|
|
||||||
function shrinkToJpeg(inputPath, label) {
|
function shrinkToJpeg(inputPath, label) {
|
||||||
const out = path.join(os.tmpdir(), `ptitspas-${label}-${Date.now()}.jpg`);
|
const out = path.join(os.tmpdir(), `ptitspas-${label}-${Date.now()}.jpg`);
|
||||||
@ -41,8 +41,8 @@ const presentationDossier =
|
|||||||
"Nous recherchons une assistante maternelle à Bezons pour accueillir nos enfants dans un cadre bienveillant et stable. " +
|
"Nous recherchons une assistante maternelle à Bezons pour accueillir nos enfants dans un cadre bienveillant et stable. " +
|
||||||
"Merci pour l'étude de notre dossier.";
|
"Merci pour l'étude de notre dossier.";
|
||||||
|
|
||||||
const chloeSrc = path.join(photosDir, 'G_Chloé.png');
|
const chloeSrc = path.join(photosDir, 'rousseau-chloe.png');
|
||||||
const hugoSrc = path.join(photosDir, 'G_Hugo.png');
|
const hugoSrc = path.join(photosDir, 'rousseau-hugo.png');
|
||||||
|
|
||||||
let chloeJpg;
|
let chloeJpg;
|
||||||
let hugoJpg;
|
let hugoJpg;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { fileURLToPath } from 'url';
|
|||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const repoRoot = path.join(__dirname, '..', '..');
|
const repoRoot = path.join(__dirname, '..', '..');
|
||||||
const photosDir = path.join(repoRoot, 'ressources', 'Photos');
|
const photosDir = path.join(__dirname, '..', 'ressources', 'photos');
|
||||||
|
|
||||||
function toDataUri(filePath) {
|
function toDataUri(filePath) {
|
||||||
const buf = fs.readFileSync(filePath);
|
const buf = fs.readFileSync(filePath);
|
||||||
@ -40,7 +40,7 @@ const body = {
|
|||||||
nom: 'LECOMTE',
|
nom: 'LECOMTE',
|
||||||
date_naissance: '2023-04-15',
|
date_naissance: '2023-04-15',
|
||||||
genre: 'H',
|
genre: 'H',
|
||||||
photo_base64: toDataUri(path.join(photosDir, 'C_Maxime.png')),
|
photo_base64: toDataUri(path.join(photosDir, 'lecomte-maxime.png')),
|
||||||
photo_filename: 'maxime_lecomte.png',
|
photo_filename: 'maxime_lecomte.png',
|
||||||
grossesse_multiple: false,
|
grossesse_multiple: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { fileURLToPath } from 'url';
|
|||||||
|
|
||||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
const repoRoot = path.join(__dirname, '..', '..');
|
const repoRoot = path.join(__dirname, '..', '..');
|
||||||
const photosDir = path.join(repoRoot, 'ressources', 'Photos');
|
const photosDir = path.join(__dirname, '..', 'ressources', 'photos');
|
||||||
|
|
||||||
function toDataUri(filePath) {
|
function toDataUri(filePath) {
|
||||||
const buf = fs.readFileSync(filePath);
|
const buf = fs.readFileSync(filePath);
|
||||||
@ -46,7 +46,7 @@ const body = {
|
|||||||
nom: 'MARTIN',
|
nom: 'MARTIN',
|
||||||
date_naissance: '2023-02-15',
|
date_naissance: '2023-02-15',
|
||||||
genre: 'F',
|
genre: 'F',
|
||||||
photo_base64: toDataUri(path.join(photosDir, 'C_Emma MARTIN.png')),
|
photo_base64: toDataUri(path.join(photosDir, 'martin-emma.png')),
|
||||||
photo_filename: 'emma_martin.png',
|
photo_filename: 'emma_martin.png',
|
||||||
grossesse_multiple: true,
|
grossesse_multiple: true,
|
||||||
},
|
},
|
||||||
@ -55,7 +55,7 @@ const body = {
|
|||||||
nom: 'MARTIN',
|
nom: 'MARTIN',
|
||||||
date_naissance: '2023-02-15',
|
date_naissance: '2023-02-15',
|
||||||
genre: 'H',
|
genre: 'H',
|
||||||
photo_base64: toDataUri(path.join(photosDir, 'C_Noah MARTIN_2.png')),
|
photo_base64: toDataUri(path.join(photosDir, 'martin-noah.png')),
|
||||||
photo_filename: 'noah_martin.png',
|
photo_filename: 'noah_martin.png',
|
||||||
grossesse_multiple: true,
|
grossesse_multiple: true,
|
||||||
},
|
},
|
||||||
@ -64,7 +64,7 @@ const body = {
|
|||||||
nom: 'MARTIN',
|
nom: 'MARTIN',
|
||||||
date_naissance: '2023-02-15',
|
date_naissance: '2023-02-15',
|
||||||
genre: 'F',
|
genre: 'F',
|
||||||
photo_base64: toDataUri(path.join(photosDir, 'C_Léa MMARTIN.png')),
|
photo_base64: toDataUri(path.join(photosDir, 'martin-lea.png')),
|
||||||
photo_filename: 'lea_martin.png',
|
photo_filename: 'lea_martin.png',
|
||||||
grossesse_multiple: true,
|
grossesse_multiple: true,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user