feat: update shift action buttons to conditionally display decline and book options based on shift status

This commit is contained in:
Achintha Isuru
2026-02-01 12:54:50 -05:00
parent 54f28a85ce
commit 6d70bcc5d0

View File

@@ -443,12 +443,20 @@ class ShiftDetailsPage extends StatelessWidget {
), ),
], ],
const SizedBox(height: 20), const SizedBox(height: 20),
if (displayShift!.status != 'confirmed' &&
(displayShift!.hasApplied == true ||
(displayShift!.requiredSlots == null ||
displayShift!.filledSlots == null ||
displayShift!.filledSlots! <
displayShift!.requiredSlots!)))
Row( Row(
children: [ children: [
Expanded( Expanded(
child: OutlinedButton( child: OutlinedButton(
onPressed: () => onPressed: () => _declineShift(
_declineShift(context, displayShift!.id), context,
displayShift!.id,
),
style: OutlinedButton.styleFrom( style: OutlinedButton.styleFrom(
foregroundColor: const Color(0xFFEF4444), foregroundColor: const Color(0xFFEF4444),
side: const BorderSide( side: const BorderSide(
@@ -476,7 +484,9 @@ class ShiftDetailsPage extends StatelessWidget {
DateTime.tryParse(displayShift!.date), DateTime.tryParse(displayShift!.date),
), ),
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF10B981), backgroundColor: const Color(
0xFF10B981,
),
foregroundColor: Colors.white, foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
vertical: 16, vertical: 16,