import 'package:flutter/material.dart'; import 'package:ftc_mobile_app/ftc_mobile_app.dart'; import 'package:ftc_mobile_app/models/rota/WeekArrayData.dart'; import 'package:ftc_mobile_app/view/custom_widgets/common_cancel_button.dart'; import 'package:ftc_mobile_app/view/custom_widgets/label_value_box_widget.dart'; class ShowRotaAlertDialog extends StatelessWidget { final DaysArrayData data; final Function? onClaimShiftTap; final Function? onCancelShiftTap; const ShowRotaAlertDialog( {super.key, required this.data, this.onClaimShiftTap, this.onCancelShiftTap}); @override Widget build(BuildContext context) { final isAvailableShift = (data.staffUserId == null); return AlertDialog( insetPadding: REdgeInsets.all(18), contentPadding: REdgeInsets.all(15), surfaceTintColor: CustomAppColors.kPrimaryColor, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2.r)), backgroundColor: CustomAppColors.kPrimaryColor, title: Center( child: CustomTextWidget( text: isAvailableShift ? 'Available Shift' : data.staffUserId?.staffMemberName ?? "", fontWeight: FontWeight.bold, isExpanded: false, alignment: Alignment.center, fontSize: 16.sp, ), ), content: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ LabelValueBoxWidget( label: 'Service User (Patient):', value: data.serviceUserId?.displayName ?? 'Unassigned', borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), ), 10.verticalSpace, // LabelValueBoxWidget( // label: 'Worker Type:', // value: data.workerType, // borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), // ), // 10.verticalSpace, LabelValueBoxWidget( label: 'Location:', value: data.locationId?.shiftLocationName ?? '', borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), ), // 10.verticalSpace, // LabelValueBoxWidget( // label: 'Staff Required:', // value: data.staffRequired, // borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), // ), 10.verticalSpace, LabelValueBoxWidget( label: 'Start Time:', value: DateFormatter() .roasterShiftFormattedTime(time: data.shiftStartTime ?? ""), borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), ), 10.verticalSpace, LabelValueBoxWidget( label: 'End Time:', value: DateFormatter() .roasterShiftFormattedTime(time: data.shiftEndTime ?? ""), borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), ), 10.verticalSpace, // LabelValueBoxWidget( // label: 'Break Time:', // value: data.breakTime, // borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), // ), // 10.verticalSpace, LabelValueBoxWidget( label: 'Notes:', value: data.note ?? "NA", borderColor: CustomAppColors.kLightGreyColor.withOpacity(0.3), ), 10.verticalSpace, ConstrainedBox( constraints: BoxConstraints(minHeight: 30.h, maxHeight: 30.h), child: Row( children: [ data.isRequested == true ? FrequentFunctions.noWidget : Expanded( child: CustomAppButton( onTap: () { Navigator.of(context).pop(); if (isAvailableShift) { if (onClaimShiftTap != null) { onClaimShiftTap!.call(); } } else { if (onCancelShiftTap != null) { onCancelShiftTap!.call(); } } }, buttonText: isAvailableShift ? "Claim Shift" : "Cancel Shift", textColor: Colors.white, borderColor: Colors.transparent, ), ), 10.horizontalSpace, const Expanded(child: CommonCloseTextButton()), ], ), ), ], ), ); } }