feat: update shift action buttons to conditionally display decline and book options based on shift status
This commit is contained in:
@@ -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,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user