Compare commits
No commits in common. "b936d27445bceccaa83c1d47887fff6329a2bdec" and "f74b14c2039a5980b2e55cec360702150e070f6a" have entirely different histories.
b936d27445
...
f74b14c203
@ -238,13 +238,6 @@ class _AdminAmEditModalState extends State<AdminAmEditModal>
|
|||||||
|
|
||||||
int? _capaciteMax() => _parseIntField(_capaciteCtrl);
|
int? _capaciteMax() => _parseIntField(_capaciteCtrl);
|
||||||
|
|
||||||
/// True si plus aucune place d'accueil (enfants ≥ capacité max).
|
|
||||||
bool get _capacityFull {
|
|
||||||
final max = _capaciteMax();
|
|
||||||
if (max == null) return false;
|
|
||||||
return _children.length >= max;
|
|
||||||
}
|
|
||||||
|
|
||||||
int? _computedPlacesAvailable() => amExpectedPlacesAvailable(
|
int? _computedPlacesAvailable() => amExpectedPlacesAvailable(
|
||||||
maxChildren: _capaciteMax(),
|
maxChildren: _capaciteMax(),
|
||||||
childrenCount: _children.length,
|
childrenCount: _children.length,
|
||||||
@ -473,7 +466,7 @@ class _AdminAmEditModalState extends State<AdminAmEditModal>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _attachChild() async {
|
Future<void> _attachChild() async {
|
||||||
if (_capacityFull || !mounted) return;
|
if (!mounted) return;
|
||||||
final selected = await AdminSelectEnfantModal.show(
|
final selected = await AdminSelectEnfantModal.show(
|
||||||
context,
|
context,
|
||||||
excludeIds: _children.map((c) => c.id).toSet(),
|
excludeIds: _children.map((c) => c.id).toSet(),
|
||||||
@ -752,7 +745,6 @@ class _AdminAmEditModalState extends State<AdminAmEditModal>
|
|||||||
|
|
||||||
Widget _buildFooter() {
|
Widget _buildFooter() {
|
||||||
final isChildrenTab = _tabCtrl.index == 2;
|
final isChildrenTab = _tabCtrl.index == 2;
|
||||||
final canAttachChild = !_saving && !_capacityFull;
|
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
@ -761,16 +753,11 @@ class _AdminAmEditModalState extends State<AdminAmEditModal>
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
if (isChildrenTab)
|
if (isChildrenTab)
|
||||||
Tooltip(
|
TextButton.icon(
|
||||||
message: _capacityFull
|
onPressed: _attachChild,
|
||||||
? 'Capacité maximale atteinte'
|
|
||||||
: 'Rattacher un enfant',
|
|
||||||
child: TextButton.icon(
|
|
||||||
onPressed: canAttachChild ? _attachChild : null,
|
|
||||||
icon: const Icon(Icons.link, size: 18),
|
icon: const Icon(Icons.link, size: 18),
|
||||||
label: const Text('Rattacher un enfant'),
|
label: const Text('Rattacher un enfant'),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (isChildrenTab) const SizedBox(width: 12),
|
if (isChildrenTab) const SizedBox(width: 12),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
style: ValidationModalTheme.primaryElevatedStyle,
|
style: ValidationModalTheme.primaryElevatedStyle,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user