|
|
|
|
@ -31,11 +31,12 @@ import '../../../../new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import '../../../../new_views/common_widgets/app_text_form_field.dart';
|
|
|
|
|
|
|
|
|
|
class ServiceRequestBottomSheet {
|
|
|
|
|
static buildBottomSheetParent({required BuildContext context, required Widget childWidget}) {
|
|
|
|
|
static buildBottomSheetParent({required BuildContext context, required Widget childWidget,bool ?isDismissible}) {
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
isDismissible:isDismissible??true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => SingleChildScrollView(
|
|
|
|
|
child: childWidget,
|
|
|
|
|
@ -1044,120 +1045,9 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// return showModalBottomSheet(
|
|
|
|
|
// context: context,
|
|
|
|
|
// useSafeArea: true,
|
|
|
|
|
// isScrollControlled: true,
|
|
|
|
|
// backgroundColor: Colors.transparent,
|
|
|
|
|
// builder: (context) => Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) {
|
|
|
|
|
// return Form(
|
|
|
|
|
// key: _formKey,
|
|
|
|
|
// child: SingleChildScrollView(
|
|
|
|
|
// child: StatefulBuilder(builder: (context, setState) {
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
// children: [
|
|
|
|
|
// const SizedBox().indicatorWidget(),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// Align(
|
|
|
|
|
// alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
// child: context.translation.pleaseConfirmTheIssueHasBeenResolved.bottomSheetHeadingTextStyle(context),
|
|
|
|
|
// ),
|
|
|
|
|
// 10.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// InkWell(
|
|
|
|
|
// child: acknowledge
|
|
|
|
|
// ? const Icon(
|
|
|
|
|
// Icons.check_box,
|
|
|
|
|
// color: AppColor.primary10,
|
|
|
|
|
// )
|
|
|
|
|
// : const Icon(
|
|
|
|
|
// Icons.check_box_outline_blank,
|
|
|
|
|
// color: AppColor.neutral120,
|
|
|
|
|
// ),
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// acknowledge = !acknowledge;
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 6.width,
|
|
|
|
|
// Flexible(child: context.translation.nurseAcknowledge.bodyText(context).custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// 17.height,
|
|
|
|
|
// ESignature(
|
|
|
|
|
// title: '',
|
|
|
|
|
// oldSignature: '',
|
|
|
|
|
// newSignature: newSignature,
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onSaved: (signature) {
|
|
|
|
|
// if (signature == null || signature.isEmpty) return;
|
|
|
|
|
// newSignature = signature;
|
|
|
|
|
// nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 36.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// AppFilledButton(
|
|
|
|
|
// label: context.translation.reject,
|
|
|
|
|
// maxWidth: true,
|
|
|
|
|
// buttonColor: Colors.white54,
|
|
|
|
|
// textColor: AppColor.red30,
|
|
|
|
|
// showBorder: true,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// _formKey.currentState?.save();
|
|
|
|
|
// if (newSignature != null && acknowledge) {
|
|
|
|
|
// //TODO replace provider with new provider and also check workorder id is not correct.
|
|
|
|
|
// Provider.of<RequestDetailProvider>(context, listen: false).nurseReject(
|
|
|
|
|
// model: NurseActionModel(
|
|
|
|
|
// workOrderId: int.parse(serviceRequestProvider.currentSelectedRequest!.id!),
|
|
|
|
|
// signatureNurse: nurseSignature,
|
|
|
|
|
// ));
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// width: 20,
|
|
|
|
|
// ),
|
|
|
|
|
// AppFilledButton(
|
|
|
|
|
// label: context.translation.confirm,
|
|
|
|
|
// maxWidth: true,
|
|
|
|
|
// buttonColor: AppColor.green70,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// _formKey.currentState?.save();
|
|
|
|
|
// if (newSignature != null && acknowledge) {
|
|
|
|
|
// //TODO replace provider with new provider and also check workorder id is not correct.
|
|
|
|
|
// Provider.of<RequestDetailProvider>(context, listen: false).nurseConfirm(
|
|
|
|
|
// model: NurseActionModel(
|
|
|
|
|
// workOrderId: int.parse(serviceRequestProvider.currentSelectedRequest!.id!),
|
|
|
|
|
// signatureNurse: nurseSignature,
|
|
|
|
|
// ));
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// ],
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
// ),
|
|
|
|
|
// ).bottomSheetContainer(context);
|
|
|
|
|
// }));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
static Future nurseVerifyArrivalBottomSheet({required BuildContext context}) {
|
|
|
|
|
bool acknowledge = false;
|
|
|
|
|
Uint8List? newSignature;
|
|
|
|
|
String? nurseSignature;
|
|
|
|
|
return buildBottomSheetParent(
|
|
|
|
|
context: context,
|
|
|
|
|
childWidget: Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
|
|
|
|
|
@ -1187,8 +1077,11 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
textColor: AppColor.red30,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
//TODO call the api ..
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
int? status = await requestDetailProvider.nurseRejectEngineerArrival(workOrderId: requestDetailProvider.currentWorkOrder?.data?.requestId ?? 0);
|
|
|
|
|
if (status == 200) {
|
|
|
|
|
requestDetailProvider.getWorkOrderById(id: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
const SizedBox(
|
|
|
|
|
@ -1200,8 +1093,11 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
loading: requestDetailProvider.isLoading,
|
|
|
|
|
buttonColor: AppColor.green70,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
// int? status = await requestDetailProvider.nurseConfirmArrival(workOrderId: requestDetailProvider.currentWorkOrder?.data?.requestId ?? 0);
|
|
|
|
|
// if (status == 200) {}
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
int? status = await requestDetailProvider.nurseConfirmEngineerArrival(workOrderId: requestDetailProvider.currentWorkOrder?.data?.requestId ?? 0);
|
|
|
|
|
if (status == 200) {
|
|
|
|
|
requestDetailProvider.getWorkOrderById(id: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
@ -1210,113 +1106,33 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// return showModalBottomSheet(
|
|
|
|
|
// context: context,
|
|
|
|
|
// useSafeArea: true,
|
|
|
|
|
// isScrollControlled: true,
|
|
|
|
|
// backgroundColor: Colors.transparent,
|
|
|
|
|
// builder: (context) => Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) {
|
|
|
|
|
// return Form(
|
|
|
|
|
// key: _formKey,
|
|
|
|
|
// child: SingleChildScrollView(
|
|
|
|
|
// child: StatefulBuilder(builder: (context, setState) {
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
// children: [
|
|
|
|
|
// const SizedBox().indicatorWidget(),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// Align(
|
|
|
|
|
// alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
// child: context.translation.pleaseConfirmTheIssueHasBeenResolved.bottomSheetHeadingTextStyle(context),
|
|
|
|
|
// ),
|
|
|
|
|
// 10.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// InkWell(
|
|
|
|
|
// child: acknowledge
|
|
|
|
|
// ? const Icon(
|
|
|
|
|
// Icons.check_box,
|
|
|
|
|
// color: AppColor.primary10,
|
|
|
|
|
// )
|
|
|
|
|
// : const Icon(
|
|
|
|
|
// Icons.check_box_outline_blank,
|
|
|
|
|
// color: AppColor.neutral120,
|
|
|
|
|
// ),
|
|
|
|
|
// onTap: () {
|
|
|
|
|
// setState(() {
|
|
|
|
|
// acknowledge = !acknowledge;
|
|
|
|
|
// });
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 6.width,
|
|
|
|
|
// Flexible(child: context.translation.nurseAcknowledge.bodyText(context).custom(color: context.isDark ? AppColor.primary50 : AppColor.neutral120)),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// 17.height,
|
|
|
|
|
// ESignature(
|
|
|
|
|
// title: '',
|
|
|
|
|
// oldSignature: '',
|
|
|
|
|
// newSignature: newSignature,
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// showShadow: false,
|
|
|
|
|
// onSaved: (signature) {
|
|
|
|
|
// if (signature == null || signature.isEmpty) return;
|
|
|
|
|
// newSignature = signature;
|
|
|
|
|
// nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 36.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// AppFilledButton(
|
|
|
|
|
// label: context.translation.reject,
|
|
|
|
|
// maxWidth: true,
|
|
|
|
|
// buttonColor: Colors.white54,
|
|
|
|
|
// textColor: AppColor.red30,
|
|
|
|
|
// showBorder: true,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// _formKey.currentState?.save();
|
|
|
|
|
// if (newSignature != null && acknowledge) {
|
|
|
|
|
// //TODO replace provider with new provider and also check workorder id is not correct.
|
|
|
|
|
// Provider.of<RequestDetailProvider>(context, listen: false).nurseReject(
|
|
|
|
|
// model: NurseActionModel(
|
|
|
|
|
// workOrderId: int.parse(serviceRequestProvider.currentSelectedRequest!.id!),
|
|
|
|
|
// signatureNurse: nurseSignature,
|
|
|
|
|
// ));
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// const SizedBox(
|
|
|
|
|
// width: 20,
|
|
|
|
|
// ),
|
|
|
|
|
// AppFilledButton(
|
|
|
|
|
// label: context.translation.confirm,
|
|
|
|
|
// maxWidth: true,
|
|
|
|
|
// buttonColor: AppColor.green70,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// _formKey.currentState?.save();
|
|
|
|
|
// if (newSignature != null && acknowledge) {
|
|
|
|
|
// //TODO replace provider with new provider and also check workorder id is not correct.
|
|
|
|
|
// Provider.of<RequestDetailProvider>(context, listen: false).nurseConfirm(
|
|
|
|
|
// model: NurseActionModel(
|
|
|
|
|
// workOrderId: int.parse(serviceRequestProvider.currentSelectedRequest!.id!),
|
|
|
|
|
// signatureNurse: nurseSignature,
|
|
|
|
|
// ));
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// ],
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
// ),
|
|
|
|
|
// ).bottomSheetContainer(context);
|
|
|
|
|
// }));
|
|
|
|
|
}
|
|
|
|
|
static Future waitingForApprovalBottomSheet({required BuildContext context}) {
|
|
|
|
|
return buildBottomSheetParent(
|
|
|
|
|
context: context,
|
|
|
|
|
childWidget: Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Waiting...".heading4(context),
|
|
|
|
|
12.height,
|
|
|
|
|
Text(
|
|
|
|
|
"Request Sent, Waiting for requester to confirm arrival",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16.toScreenWidth,
|
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
|
fontStyle: FontStyle.normal,
|
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
"waiting".toLottieAsset(height: 100).center,
|
|
|
|
|
12.height,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|