diff --git a/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart b/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart index 7bb81a4e..67f0f267 100644 --- a/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart +++ b/apps/mobile/packages/features/staff/shifts/lib/src/presentation/pages/shift_details_page.dart @@ -443,50 +443,60 @@ class ShiftDetailsPage extends StatelessWidget { ), ], const SizedBox(height: 20), - Row( - children: [ - Expanded( - child: OutlinedButton( - onPressed: () => - _declineShift(context, displayShift!.id), - style: OutlinedButton.styleFrom( - foregroundColor: const Color(0xFFEF4444), - side: const BorderSide( - color: Color(0xFFEF4444), - ), - padding: const EdgeInsets.symmetric( - vertical: 16, - ), - ), - child: const Text("Decline"), - ), - ), - const SizedBox(width: 16), - if ((displayShift!.hasApplied != true) && + if (displayShift!.status != 'confirmed' && + (displayShift!.hasApplied == true || (displayShift!.requiredSlots == null || displayShift!.filledSlots == null || displayShift!.filledSlots! < - displayShift!.requiredSlots!)) + displayShift!.requiredSlots!))) + Row( + children: [ Expanded( - child: ElevatedButton( - onPressed: () => _bookShift( + child: OutlinedButton( + onPressed: () => _declineShift( context, displayShift!.id, - displayShift!.roleId, - DateTime.tryParse(displayShift!.date), ), - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF10B981), - foregroundColor: Colors.white, + style: OutlinedButton.styleFrom( + foregroundColor: const Color(0xFFEF4444), + side: const BorderSide( + color: Color(0xFFEF4444), + ), padding: const EdgeInsets.symmetric( vertical: 16, ), ), - child: const Text("Book Shift"), + child: const Text("Decline"), ), ), - ], - ), + const SizedBox(width: 16), + if ((displayShift!.hasApplied != true) && + (displayShift!.requiredSlots == null || + displayShift!.filledSlots == null || + displayShift!.filledSlots! < + displayShift!.requiredSlots!)) + Expanded( + child: ElevatedButton( + onPressed: () => _bookShift( + context, + displayShift!.id, + displayShift!.roleId, + DateTime.tryParse(displayShift!.date), + ), + style: ElevatedButton.styleFrom( + backgroundColor: const Color( + 0xFF10B981, + ), + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric( + vertical: 16, + ), + ), + child: const Text("Book Shift"), + ), + ), + ], + ), SizedBox( height: MediaQuery.of(context).padding.bottom + 10, ),