|
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/app_strings/app_asset.dart';
|
|
|
|
|
import 'package:test_sa/dashboard_latest/widgets/request_category_list.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/int_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
@ -611,6 +612,62 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
static Future nurseRejectBackBottomSheet({required BuildContext context}) {
|
|
|
|
|
String feedback = '';
|
|
|
|
|
return buildBottomSheetParent(
|
|
|
|
|
context: context,
|
|
|
|
|
childWidget: Consumer<RequestDetailProvider>(builder: (context, RequestDetailProvider requestDetailProvider, child) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
const SizedBox().indicatorWidget(),
|
|
|
|
|
8.height,
|
|
|
|
|
Align(
|
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
|
child: context.translation.rejectionReason.bottomSheetHeadingTextStyle(context),
|
|
|
|
|
),
|
|
|
|
|
21.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) {
|
|
|
|
|
feedback = text;
|
|
|
|
|
},
|
|
|
|
|
onSaved: (text) {
|
|
|
|
|
feedback = text;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
16.height,
|
|
|
|
|
AppFilledButton(
|
|
|
|
|
label: context.translation.reject,
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
buttonColor: Colors.white54,
|
|
|
|
|
textColor: AppColor.red30,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (feedback.isNotEmpty) {
|
|
|
|
|
requestDetailProvider.nurseActionHelperModel = NurseActionHelperModel(
|
|
|
|
|
workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId,
|
|
|
|
|
feedback: feedback,
|
|
|
|
|
);
|
|
|
|
|
requestDetailProvider.nurseReject();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
if(requestDetailProvider.currentWorkOrder!.data!.requestId!=null){
|
|
|
|
|
requestDetailProvider.getWorkOrderById(id: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
// requestDetailProvider.engineerMarkAsFixed(workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId!, feedback: feedback);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future nurseTakeActionBottomSheet({required BuildContext context}) {
|
|
|
|
|
bool acknowledge = false;
|
|
|
|
|
@ -618,7 +675,7 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
String? nurseSignature;
|
|
|
|
|
return buildBottomSheetParent(
|
|
|
|
|
context: context,
|
|
|
|
|
childWidget: Consumer<RequestDetailProvider>(builder: (context, requestDetailProvider, child) {
|
|
|
|
|
childWidget: Consumer<RequestDetailProvider>(builder: (context, RequestDetailProvider requestDetailProvider, child) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
@ -629,37 +686,63 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
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,
|
|
|
|
|
StatefulBuilder(
|
|
|
|
|
builder: (context, setState) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
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;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
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)}";
|
|
|
|
|
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,
|
|
|
|
|
onChange:(signature){
|
|
|
|
|
setState(() {
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
newSignature = signature;
|
|
|
|
|
nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
print('signature i got is ${newSignature}');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onSaved: (signature) {
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
if (signature == null || signature.isEmpty) return;
|
|
|
|
|
newSignature = signature;
|
|
|
|
|
nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
|
|
|
|
|
print('signature i got is ${newSignature}');
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
36.height,
|
|
|
|
|
@ -674,14 +757,8 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
textColor: AppColor.red30,
|
|
|
|
|
showBorder: true,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (newSignature != null && acknowledge) {
|
|
|
|
|
requestDetailProvider.nurseActionHelperModel = NurseActionHelperModel(
|
|
|
|
|
workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId,
|
|
|
|
|
signatureNurse: nurseSignature,
|
|
|
|
|
);
|
|
|
|
|
requestDetailProvider.nurseReject();
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
nurseRejectBackBottomSheet(context: context);
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
const SizedBox(
|
|
|
|
|
@ -692,14 +769,18 @@ class ServiceRequestBottomSheet {
|
|
|
|
|
maxWidth: true,
|
|
|
|
|
buttonColor: AppColor.green70,
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (newSignature != null && acknowledge) {
|
|
|
|
|
//TODO replace provider with new provider and also check workorder id is not correct.
|
|
|
|
|
if (newSignature != null) {
|
|
|
|
|
requestDetailProvider.nurseActionHelperModel = NurseActionHelperModel(
|
|
|
|
|
workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId!,
|
|
|
|
|
signatureNurse: nurseSignature,
|
|
|
|
|
);
|
|
|
|
|
requestDetailProvider.nurseConfirm();
|
|
|
|
|
if(requestDetailProvider.currentWorkOrder!.data!.requestId!=null){
|
|
|
|
|
requestDetailProvider.getWorkOrderById(id: requestDetailProvider.currentWorkOrder!.data!.requestId!);
|
|
|
|
|
}
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
}else{
|
|
|
|
|
//show some toast...
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
).expanded,
|
|
|
|
|
|