|
|
|
|
@ -32,7 +32,7 @@ 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, bool? isFromFixRemotely}) {
|
|
|
|
|
static buildBottomSheetParent({required BuildContext context, required Widget childWidget}) {
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
@ -41,12 +41,7 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
builder: (context) => SingleChildScrollView(
|
|
|
|
|
child: childWidget,
|
|
|
|
|
).bottomSheetContainer(context),
|
|
|
|
|
).then((value) {
|
|
|
|
|
if (isFromFixRemotely != null && isFromFixRemotely) {
|
|
|
|
|
RequestDetailProvider requestDetailProvider = Provider.of<RequestDetailProvider>(context, listen: false);
|
|
|
|
|
requestDetailProvider.fixRemotelyHelperModel = FixRemotelyHelperModel();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future fixRemotelyBottomSheet({required BuildContext context}) {
|
|
|
|
|
@ -55,7 +50,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
if (startTime != null && endTime != null) {
|
|
|
|
|
Duration difference = endTime.difference(startTime);
|
|
|
|
|
int hours = difference.inHours;
|
|
|
|
|
int minutes = difference.inMinutes % 60;
|
|
|
|
|
return hours;
|
|
|
|
|
} else {
|
|
|
|
|
return -1;
|
|
|
|
|
@ -72,7 +66,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
|
|
|
|
|
return buildBottomSheetParent(
|
|
|
|
|
context: context,
|
|
|
|
|
isFromFixRemotely: true,
|
|
|
|
|
childWidget: Consumer<RequestDetailProvider>(builder: (context, RequestDetailProvider requestDetailProvider, child) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
@ -105,11 +98,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
selectedTime.hour,
|
|
|
|
|
selectedTime.minute,
|
|
|
|
|
);
|
|
|
|
|
//serviceRequestProvider.currentSelectedRequest?.date
|
|
|
|
|
// if (selectedDateTime.isBefore(DateTime.parse(serviceRequestProvider.currentSelectedRequest!.date!))) {
|
|
|
|
|
// "Visit Date time must be greater then request date".showToast;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
requestDetailProvider.fixRemotelyHelperModel?.startDate = selectedDateTime;
|
|
|
|
|
requestDetailProvider.updateFixRemotelyHelperModel(requestDetailProvider.fixRemotelyHelperModel);
|
|
|
|
|
@ -232,136 +220,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
// 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(),
|
|
|
|
|
// 16.height,
|
|
|
|
|
// Align(
|
|
|
|
|
// alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
// child: context.translation.fillDetails.bottomSheetHeadingTextStyle(context),
|
|
|
|
|
// ),
|
|
|
|
|
// 16.height,
|
|
|
|
|
// ADatePicker(
|
|
|
|
|
// label: context.translation.date,
|
|
|
|
|
// hideShadow: true,
|
|
|
|
|
// // height: 60.toScreenHeight,
|
|
|
|
|
// backgroundColor: AppColor.neutral100,
|
|
|
|
|
// date: DateTime.tryParse(serviceRequestProvider.currentSelectedRequest?.startDate ?? ""),
|
|
|
|
|
// formatDateWithTime: true,
|
|
|
|
|
// onDatePicker: (selectedDate) {
|
|
|
|
|
// if (selectedDate != null) {
|
|
|
|
|
// showTimePicker(
|
|
|
|
|
// context: context,
|
|
|
|
|
// initialTime: TimeOfDay.now(),
|
|
|
|
|
// ).then((selectedTime) {
|
|
|
|
|
// // Handle the selected date and time here.
|
|
|
|
|
// if (selectedTime != null) {
|
|
|
|
|
// DateTime selectedDateTime = DateTime(
|
|
|
|
|
// selectedDate.year,
|
|
|
|
|
// selectedDate.month,
|
|
|
|
|
// selectedDate.day,
|
|
|
|
|
// selectedTime.hour,
|
|
|
|
|
// selectedTime.minute,
|
|
|
|
|
// );
|
|
|
|
|
// //serviceRequestProvider.currentSelectedRequest?.date
|
|
|
|
|
// if (selectedDateTime.isBefore(DateTime.parse(serviceRequestProvider.currentSelectedRequest!.date!))) {
|
|
|
|
|
// "Visit Date time must be greater then request date".showToast;
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// setState(() {
|
|
|
|
|
// serviceRequestProvider.currentSelectedRequest?.startDate = selectedDateTime.toIso8601String();
|
|
|
|
|
// });
|
|
|
|
|
// print('start date i got is ${serviceRequestProvider.currentSelectedRequest?.startDate}');
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
// height: 56.toScreenHeight,
|
|
|
|
|
// // padding: EdgeInsets.symmetric(horizontal: 20.toScreenWidth, vertical: 10.toScreenHeight),
|
|
|
|
|
// child: AppTimer(
|
|
|
|
|
// label: context.translation.workingHours,
|
|
|
|
|
// timer: TimerModel(),
|
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
|
// color: context.isDark ? AppColor.neutral20 : AppColor.neutral100,
|
|
|
|
|
// borderRadius: BorderRadius.circular(10),
|
|
|
|
|
// // boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.05), blurRadius: 10)],
|
|
|
|
|
// ),
|
|
|
|
|
// // enabled: serviceRequestProvider.currentSelectedRequest.date == null,
|
|
|
|
|
// enabled: true,
|
|
|
|
|
// onChange: (timer) async {
|
|
|
|
|
// print('timer i got is ${timer.toString()}');
|
|
|
|
|
// return true;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// AppTextFormField(
|
|
|
|
|
// labelText: context.translation.comments,
|
|
|
|
|
// textInputType: TextInputType.multiline,
|
|
|
|
|
// labelStyle: AppTextStyles.textFieldLabelStyle,
|
|
|
|
|
// showWithoutDecoration: true,
|
|
|
|
|
// backgroundColor: context.isDark ? AppColor.neutral20 : AppColor.neutral100,
|
|
|
|
|
// alignLabelWithHint: true,
|
|
|
|
|
// onChange: (text) {
|
|
|
|
|
// serviceRequestProvider.currentSelectedRequest?.comments = text;
|
|
|
|
|
// },
|
|
|
|
|
// onSaved: (text) {
|
|
|
|
|
// serviceRequestProvider.currentSelectedRequest?.comments = text;
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// 16.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
// children: [
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// width: 200.toScreenHeight,
|
|
|
|
|
// child: AppFilledButton(
|
|
|
|
|
// label: context.translation.cancel,
|
|
|
|
|
// loading: false,
|
|
|
|
|
// buttonColor: Colors.transparent,
|
|
|
|
|
// showBorder: true,
|
|
|
|
|
// textColor: AppColor.black20,
|
|
|
|
|
// onPressed: () async {
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// // await snapshot.updateRequest(user: userProvider.user, request: serviceRequestProvider.serviceRequest);
|
|
|
|
|
// // Navigator.pop(context, true);
|
|
|
|
|
// },
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// SizedBox(
|
|
|
|
|
// width: 200.toScreenHeight,
|
|
|
|
|
// child: AppFilledButton(
|
|
|
|
|
// label: context.translation.fixed,
|
|
|
|
|
// buttonColor: AppColor.green70,
|
|
|
|
|
// loading: false,
|
|
|
|
|
// onPressed: () {},
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// 16.height,
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
// ),
|
|
|
|
|
// ).bottomSheetContainer(context);
|
|
|
|
|
// }));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future initialVisitBottomSheet({required BuildContext context}) {
|
|
|
|
|
@ -438,7 +296,7 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
visitDate: requestDetailProvider.needVisitHelperModel?.visitDate,
|
|
|
|
|
comment: requestDetailProvider.needVisitHelperModel?.comment,
|
|
|
|
|
));
|
|
|
|
|
await requestDetailProvider.engineerUpdateNeedVisit();
|
|
|
|
|
requestDetailProvider.engineerUpdateNeedVisit();
|
|
|
|
|
} else {
|
|
|
|
|
requestDetailProvider.needVisitHelperModel?.workOrderId = requestDetailProvider.currentWorkOrder!.data!.requestId;
|
|
|
|
|
requestDetailProvider.engineerNeedVisit();
|
|
|
|
|
@ -648,8 +506,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
onPressed: button1Tap ??
|
|
|
|
|
() async {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
// await snapshot.updateRequest(user: userProvider.user, request: serviceRequestProvider.serviceRequest);
|
|
|
|
|
// Navigator.pop(context, true);
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
12.width,
|
|
|
|
|
@ -665,49 +521,6 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => Consumer<ServiceRequestsProvider>(builder: (context, serviceRequestProvider, child) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox().indicatorWidget(),
|
|
|
|
|
8.height,
|
|
|
|
|
Align(
|
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
child: title.bottomSheetHeadingTextStyle(context),
|
|
|
|
|
),
|
|
|
|
|
41.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
label: button1Text ?? context.translation.no,
|
|
|
|
|
loading: false,
|
|
|
|
|
buttonColor: AppColor.white60,
|
|
|
|
|
textColor: AppColor.black10,
|
|
|
|
|
onPressed: button1Tap ??
|
|
|
|
|
() async {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
// await snapshot.updateRequest(user: userProvider.user, request: serviceRequestProvider.serviceRequest);
|
|
|
|
|
// Navigator.pop(context, true);
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
12.width,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
label: context.translation.yes,
|
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
|
loading: false,
|
|
|
|
|
onPressed: button2Tap,
|
|
|
|
|
).expanded,
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).bottomSheetContainer(context);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future addAnotherSpareRequestBottomSheet({required BuildContext context}) {
|
|
|
|
|
|