Compare commits
No commits in common. "16001f695b68110487beae85a450bc0297f1dbab" and "b4b546044d9f63fa3a72f3bb42480441b73ec7f9" have entirely different histories.
16001f695b
...
b4b546044d
@ -48,28 +48,17 @@ class EnfantAdminModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final photoUrl = json['photo_url'] as String? ?? json['photoUrl'] as String?;
|
|
||||||
final hasPhoto = (photoUrl ?? '').trim().isNotEmpty;
|
|
||||||
// L'inscription parent exigeait le consentement pour envoyer la photo, mais
|
|
||||||
// le back a longtemps forcé consent_photo=false (voir reprise_mapper).
|
|
||||||
final consentFromApi = _parseBool(json['consent_photo']) ||
|
|
||||||
_parseBool(json['consentement_photo']) ||
|
|
||||||
_parseBool(json['consentPhoto']);
|
|
||||||
|
|
||||||
return EnfantAdminModel(
|
return EnfantAdminModel(
|
||||||
id: (json['id'] ?? '').toString(),
|
id: (json['id'] ?? '').toString(),
|
||||||
firstName: json['first_name'] as String? ?? json['prenom'] as String?,
|
firstName: json['first_name'] as String?,
|
||||||
lastName: json['last_name'] as String? ?? json['nom'] as String?,
|
lastName: json['last_name'] as String?,
|
||||||
gender: json['gender'] as String? ?? json['genre'] as String?,
|
gender: json['gender'] as String?,
|
||||||
birthDate: _dateString(json['birth_date'] ?? json['date_naissance']),
|
birthDate: _dateString(json['birth_date']),
|
||||||
dueDate: _dateString(json['due_date'] ?? json['date_prevue_naissance']),
|
dueDate: _dateString(json['due_date']),
|
||||||
status: normalizeEnfantStatus(
|
status: normalizeEnfantStatus(json['status']?.toString()),
|
||||||
(json['status'] ?? json['statut'])?.toString(),
|
photoUrl: json['photo_url'] as String?,
|
||||||
),
|
consentPhoto: json['consent_photo'] == true,
|
||||||
photoUrl: photoUrl,
|
isMultiple: json['is_multiple'] == true,
|
||||||
consentPhoto: consentFromApi || hasPhoto,
|
|
||||||
isMultiple: _parseBool(json['is_multiple']) ||
|
|
||||||
_parseBool(json['est_multiple']),
|
|
||||||
parentLinks: links,
|
parentLinks: links,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -87,15 +76,6 @@ class EnfantAdminModel {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _parseBool(dynamic value) {
|
|
||||||
if (value == true || value == 1) return true;
|
|
||||||
if (value is String) {
|
|
||||||
final s = value.trim().toLowerCase();
|
|
||||||
return s == 'true' || s == '1' || s == 't' || s == 'yes';
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static String? _dateString(dynamic v) {
|
static String? _dateString(dynamic v) {
|
||||||
if (v == null) return null;
|
if (v == null) return null;
|
||||||
if (v is String) return v.split('T').first;
|
if (v is String) return v.split('T').first;
|
||||||
|
|||||||
@ -478,25 +478,6 @@ class UserService {
|
|||||||
return EnfantAdminModel.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
return EnfantAdminModel.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> deleteEnfant(String enfantId) async {
|
|
||||||
final response = await http.delete(
|
|
||||||
Uri.parse('${ApiConfig.baseUrl}${ApiConfig.enfants}/$enfantId'),
|
|
||||||
headers: await _headers(),
|
|
||||||
);
|
|
||||||
if (response.statusCode != 200 && response.statusCode != 204) {
|
|
||||||
throw Exception(_extractErrorMessage(response.body, 'Erreur suppression enfant'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// AM dont la liste d'enfants actifs contient [enfantId] (API actuelle).
|
|
||||||
static Future<AssistanteMaternelleModel?> findAmForEnfant(String enfantId) async {
|
|
||||||
final ams = await getAssistantesMaternelles();
|
|
||||||
for (final am in ams) {
|
|
||||||
if (am.children.any((c) => c.id == enfantId)) return am;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ParentModel _parentModelFromBody(String body) {
|
static ParentModel _parentModelFromBody(String body) {
|
||||||
final decoded = jsonDecode(body);
|
final decoded = jsonDecode(body);
|
||||||
return ParentModel.fromJson(
|
return ParentModel.fromJson(
|
||||||
|
|||||||
@ -198,9 +198,6 @@ class ParentRegistrationPayload {
|
|||||||
map['photo_base64'] = photo.$1;
|
map['photo_base64'] = photo.$1;
|
||||||
map['photo_filename'] = photo.$2;
|
map['photo_filename'] = photo.$2;
|
||||||
}
|
}
|
||||||
// Consentement photo enfant (le back l'ignore encore à l'inscription —
|
|
||||||
// à brancher côté API ; en attendant le front admin infère via photo).
|
|
||||||
map['consent_photo'] = c.photoConsent;
|
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,6 @@ class AdminChildrenAffiliationPanel extends StatelessWidget {
|
|||||||
final c = children[i];
|
final c = children[i];
|
||||||
return AdminEnfantUserCard.fromSummary(
|
return AdminEnfantUserCard.fromSummary(
|
||||||
c,
|
c,
|
||||||
onCardTap: () => onOpen(c),
|
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.visibility_outlined),
|
icon: const Icon(Icons.visibility_outlined),
|
||||||
|
|||||||
@ -14,7 +14,6 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
final Color? infoColor;
|
final Color? infoColor;
|
||||||
final String? vigilanceTooltip;
|
final String? vigilanceTooltip;
|
||||||
final VoidCallback? onCardTap;
|
final VoidCallback? onCardTap;
|
||||||
final EdgeInsetsGeometry? margin;
|
|
||||||
|
|
||||||
const AdminUserCard({
|
const AdminUserCard({
|
||||||
super.key,
|
super.key,
|
||||||
@ -29,7 +28,6 @@ class AdminUserCard extends StatefulWidget {
|
|||||||
this.infoColor,
|
this.infoColor,
|
||||||
this.vigilanceTooltip,
|
this.vigilanceTooltip,
|
||||||
this.onCardTap,
|
this.onCardTap,
|
||||||
this.margin,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -61,7 +59,7 @@ class _AdminUserCardState extends State<AdminUserCard> {
|
|||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
hoverColor: const Color(0x149CC5C0),
|
hoverColor: const Color(0x149CC5C0),
|
||||||
child: Card(
|
child: Card(
|
||||||
margin: widget.margin ?? const EdgeInsets.only(bottom: 12),
|
margin: const EdgeInsets.only(bottom: 12),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
color: widget.backgroundColor,
|
color: widget.backgroundColor,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user