From cddff25a07efd4b40d03a5cb72bde60fb5e27d2b Mon Sep 17 00:00:00 2001 From: Laurent <95299697+LaurentMag@users.noreply.github.com> Date: Wed, 31 Jan 2024 14:25:47 +0100 Subject: [PATCH] fix(mobile_absence): do not display team chips along with an afternoon absence (#1274) --- .../view/cell_opened_iconchips.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/yaki_mobile/lib/presentation/features/teams_declarations_summary/view/cell_opened_iconchips.dart b/yaki_mobile/lib/presentation/features/teams_declarations_summary/view/cell_opened_iconchips.dart index 244be92ef..057015579 100644 --- a/yaki_mobile/lib/presentation/features/teams_declarations_summary/view/cell_opened_iconchips.dart +++ b/yaki_mobile/lib/presentation/features/teams_declarations_summary/view/cell_opened_iconchips.dart @@ -55,6 +55,9 @@ class CellOpenedIconChips extends ConsumerWidget { final bool absentOrUndeclared = status == StatusEnum.undeclared || status == StatusEnum.absence; + final bool isUserIsInAfternoonTeamAndNotAbsent = + isUserIsInAfternoonTeam && statusAfternoon != StatusEnum.absence; + return Column( mainAxisSize: MainAxisSize.min, children: [ @@ -105,7 +108,8 @@ class CellOpenedIconChips extends ConsumerWidget { Row( mainAxisAlignment: MainAxisAlignment.start, children: [ - if (isUserIsInAfternoonTeam) ...[ + // do not display team chip if the user is not in the afternoon team or if he is absent + if (isUserIsInAfternoonTeamAndNotAbsent) ...[ IconChip( label: teamNameAfternoon!, backgroundColor: AppColors.cellChipDefault, @@ -121,8 +125,14 @@ class CellOpenedIconChips extends ConsumerWidget { ), const SizedBox( width: 4, + height: 8, ), - const SizedBox(height: 8), + ], + // no need to display this chip if the user neither is into the morning team (only one unavailable chip is enough for the day) + if (!isUserIsInAfternoonTeam && isUserIsInTeam) + const UnavailableIconChip(), + + if (isUserIsInAfternoonTeam || absentOrUndeclared) IconChip( label: tr(statusAfternoon!.name), backgroundColor: setStatusColor(statusAfternoon!), @@ -134,10 +144,6 @@ class CellOpenedIconChips extends ConsumerWidget { ), ), ), - ], - // no need to display this chip if the user neither is into the morning team (only one unavailable chip is enough for the day) - if (!isUserIsInAfternoonTeam && isUserIsInTeam) - const UnavailableIconChip(), ], ), ],