feat(#135): mode édition dossier (PATCH fiche, co-parent, enfants).
Wizard edit famille/AM depuis la liste Dossiers ; save parents + co-parent ; enfants existants en PATCH (photo multipart) sans POST doublon. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -2,20 +2,25 @@ import 'package:flutter/material.dart';
|
||||
import 'package:p_tits_pas/models/dossier_unifie.dart';
|
||||
import 'package:p_tits_pas/services/user_service.dart';
|
||||
import 'package:p_tits_pas/widgets/admin/am_dossier_wizard.dart';
|
||||
import 'package:p_tits_pas/widgets/admin/parent_dossier_wizard.dart';
|
||||
import 'package:p_tits_pas/widgets/admin/validation_am_wizard.dart';
|
||||
import 'package:p_tits_pas/widgets/admin/validation_family_wizard.dart';
|
||||
|
||||
/// Modale (dialog) : charge le dossier par numéro puis affiche le wizard AM ou Famille. Ticket #107, #119.
|
||||
/// Modale (dialog) : charge le dossier par numéro puis affiche le wizard AM ou Famille.
|
||||
/// Ticket #107 / #119 (review), #135 (`openAsEdit`).
|
||||
class ValidationDossierModal extends StatefulWidget {
|
||||
final String numeroDossier;
|
||||
final VoidCallback onClose;
|
||||
final VoidCallback? onSuccess;
|
||||
/// Liste Dossiers actifs → mode edit (#135). Pending reste en review (défaut).
|
||||
final bool openAsEdit;
|
||||
|
||||
const ValidationDossierModal({
|
||||
super.key,
|
||||
required this.numeroDossier,
|
||||
required this.onClose,
|
||||
this.onSuccess,
|
||||
this.openAsEdit = false,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -77,12 +82,12 @@ class _ValidationDossierModalState extends State<ValidationDossierModal> {
|
||||
|
||||
/// Largeur modale = 1,5 × 620.
|
||||
static const double _modalWidth = 930; // 620 * 1.5
|
||||
static const double _familyBodyHeight = 435;
|
||||
|
||||
double get _bodyHeight {
|
||||
final d = _dossier;
|
||||
if (d != null && d.isAm) return AmDossierWizard.shellBodyHeight;
|
||||
return _familyBodyHeight;
|
||||
// Aligné create (#129) / edit (#135) — évite overflow IdentityBlock (8px).
|
||||
return ParentDossierWizard.shellBodyHeight;
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -162,6 +167,14 @@ class _ValidationDossierModalState extends State<ValidationDossierModal> {
|
||||
}
|
||||
final d = _dossier!;
|
||||
if (d.isAm) {
|
||||
if (widget.openAsEdit) {
|
||||
return AmDossierWizard.edit(
|
||||
dossier: d.asAm,
|
||||
onClose: widget.onClose,
|
||||
onSuccess: _onSuccess,
|
||||
onStepChanged: _onStepChanged,
|
||||
);
|
||||
}
|
||||
return ValidationAmWizard(
|
||||
dossier: d.asAm,
|
||||
onClose: widget.onClose,
|
||||
@@ -169,6 +182,14 @@ class _ValidationDossierModalState extends State<ValidationDossierModal> {
|
||||
onStepChanged: _onStepChanged,
|
||||
);
|
||||
}
|
||||
if (widget.openAsEdit) {
|
||||
return ParentDossierWizard.edit(
|
||||
dossier: d.asFamily,
|
||||
onClose: widget.onClose,
|
||||
onSuccess: _onSuccess,
|
||||
onStepChanged: _onStepChanged,
|
||||
);
|
||||
}
|
||||
return ValidationFamilyWizard(
|
||||
dossier: d.asFamily,
|
||||
onClose: widget.onClose,
|
||||
|
||||
Reference in New Issue
Block a user