add contact and created by information for asset transfer and gasrefill request

design_3.0_task_module_new
WaseemAbbasi22 6 months ago
parent 330efd90be
commit 56c70671d8

@ -90,7 +90,7 @@ class UserProvider extends ChangeNotifier {
try { try {
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading()); showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
response = await ApiManager.instance.post(URLs.login, body: await user.toLoginJson()); response = await ApiManager.instance.post(URLs.login, body: await user.toLoginJson());
log('login response i got is ${response}');
_loading = false; _loading = false;
if (response.statusCode >= 200 && response.statusCode < 300) { if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received // client's request was successfully received
@ -106,6 +106,7 @@ class UserProvider extends ChangeNotifier {
return response.statusCode; return response.statusCode;
} catch (error) { } catch (error) {
// debugPrint(error); // debugPrint(error);
print('SSL or Network Error: $error');
Navigator.pop(context); Navigator.pop(context);
_loading = false; _loading = false;
notifyListeners(); notifyListeners();

@ -48,6 +48,7 @@ class GasRefillModel {
this.timerModelList, this.timerModelList,
this.gasRefillTimers, this.gasRefillTimers,
this.gasRefillAttachments, this.gasRefillAttachments,
this.gasRefillContactPerson,
this.statusValue, this.statusValue,
}); });
@ -82,11 +83,10 @@ class GasRefillModel {
Uint8List? localNurseSignature; // Now nullable Uint8List? localNurseSignature; // Now nullable
Uint8List? localEngineerSignature; // Now nullable Uint8List? localEngineerSignature; // Now nullable
TimerModel? timer = TimerModel(); TimerModel? timer = TimerModel();
//TODO need to check when api provided..
List<TimerModel>? timerModelList = []; List<TimerModel>? timerModelList = [];
List<GasRefillTimer>? gasRefillTimers = []; List<GasRefillTimer>? gasRefillTimers = [];
List<GasRefillAttachments>? gasRefillAttachments; List<GasRefillAttachments>? gasRefillAttachments;
List<GasRefillContactPerson>? gasRefillContactPerson;
int? statusValue; int? statusValue;
GasRefillModel.fromJson(dynamic json) { GasRefillModel.fromJson(dynamic json) {
@ -118,6 +118,14 @@ class GasRefillModel {
gasRefillAttachments!.add(GasRefillAttachments.fromJson(v)); gasRefillAttachments!.add(GasRefillAttachments.fromJson(v));
}); });
} }
if (json['gasRefillContactPerson'] != null) {
gasRefillContactPerson = [];
json['gasRefillContactPerson'].forEach((v) {
gasRefillContactPerson?.add(GasRefillContactPerson.fromJson(v));
});
}
// try { // try {
// final DateTime? sd = DateTime.tryParse(startDate ?? ""); // final DateTime? sd = DateTime.tryParse(startDate ?? "");
@ -136,9 +144,6 @@ class GasRefillModel {
// } catch (e) { // } catch (e) {
// print(e); // print(e);
// } // }
print('building # ${json['building']}');
print('department # ${json['department']}');
print('floor # ${json['floor']}');
engSignature = json['engSignature']; engSignature = json['engSignature'];
nurseSignature = json['nurseSignature']; nurseSignature = json['nurseSignature'];
@ -471,3 +476,51 @@ class GasRefillAttachments {
return data; return data;
} }
} }
class GasRefillContactPerson {
int? id;
int? gasRefillId;
String? employeeId;
String? employeeCode;
String? name;
String? email;
String? mobilePhone;
String? extension;
GasRefillContactPerson({
this.id,
this.gasRefillId,
this.employeeId,
this.employeeCode,
this.name,
this.email,
this.mobilePhone,
this.extension,
});
factory GasRefillContactPerson.fromJson(Map<String, dynamic> json) {
return GasRefillContactPerson(
id: json['id'],
gasRefillId: json['gasRefillId'],
employeeId: json['employeeId'],
employeeCode: json['employeeCode'],
name: json['name'],
email: json['email'],
mobilePhone: json['mobilePhone'],
extension: json['extension'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'gasRefillId': gasRefillId,
'employeeId': employeeId,
'employeeCode': employeeCode,
'name': name,
'email': email,
'mobilePhone': mobilePhone,
'extension': extension,
};
}
}

@ -1184,4 +1184,123 @@ class ServiceRequestBottomSheet {
); );
})); }));
} }
//TODO need to modify this accroding to FM requirements....
// static Future nurseVerifyAssetTransferBottomSheet({required BuildContext context}) {
// bool acknowledge = false;
// Uint8List? newSignature;
// String? nurseSignature;
// return buildBottomSheetParent(
// context: context,
// childWidget: Consumer<ServiceRequestDetailProvider>(builder: (context, ServiceRequestDetailProvider requestDetailProvider, child) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// const SizedBox().indicatorWidget(),
// 8.height,
// Align(
// alignment: AlignmentDirectional.centerStart,
// child: context.translation.pleaseConfirmTheIssueHasBeenResolved.bottomSheetHeadingTextStyle(context),
// ),
// 10.height,
// 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;
// });
// },
// ),
// 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) {
// if (signature == null || signature.isEmpty) return;
// setState(() {
// newSignature = signature;
// nurseSignature = "${DateTime.now().toIso8601String()}.png|${base64Encode(signature)}";
// });
// },
// onSaved: (signature) {
// if (signature == null || signature.isEmpty) return;
// setState(() {
// 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 {
// Navigator.pop(context);
// nurseRejectBackBottomSheet(context: context);
// },
// ).expanded,
// const SizedBox(
// width: 20,
// ),
// AppFilledButton(
// label: context.translation.confirm,
// maxWidth: true,
// loading: requestDetailProvider.isLoading,
// buttonColor: AppColor.green70,
// onPressed: () async {
// if (newSignature != null) {
// requestDetailProvider.nurseActionHelperModel = NurseActionHelperModel(workOrderId: requestDetailProvider.currentWorkOrder!.data!.requestId!, signatureNurse: nurseSignature);
// WorkOrderDetail? data = await requestDetailProvider.nurseConfirm();
// if (data != null) {
// if (requestDetailProvider.currentWorkOrder!.data!.requestId != null) {
// requestDetailProvider.updateCurrentWorkOrder(data);
// }
// Navigator.pop(context);
// }
// } else {
// context.translation.signaturesAreRequired.showToast;
// }
// },
// ).expanded,
// ],
// )
// ],
// );
// }));
// }
} }

@ -151,7 +151,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
children: [ children: [
SingleItemDropDownMenu<Site, SiteProvider>( SingleItemDropDownMenu<Site, SiteProvider>(
context: context, context: context,
title: context.translation.destinationSite, title: context.translation.site,
initialValue: _assetDestination.site, initialValue: _assetDestination.site,
showShadow: false, showShadow: false,
loading: _deviceTransferProvider.isSiteLoading, loading: _deviceTransferProvider.isSiteLoading,
@ -169,7 +169,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
8.width, 8.width,
SingleItemDropDownMenu<Building, NullableLoadingProvider>( SingleItemDropDownMenu<Building, NullableLoadingProvider>(
context: context, context: context,
title: context.translation.destinationBuilding, title: context.translation.building,
initialValue: _assetDestination.building, initialValue: _assetDestination.building,
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
@ -191,7 +191,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
children: [ children: [
SingleItemDropDownMenu<Floor, NullableLoadingProvider>( SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
context: context, context: context,
title: context.translation.destinationFloor, title: context.translation.floor,
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: _assetDestination.floor, initialValue: _assetDestination.floor,
@ -207,7 +207,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
8.width, 8.width,
SingleItemDropDownMenu<Department, NullableLoadingProvider>( SingleItemDropDownMenu<Department, NullableLoadingProvider>(
context: context, context: context,
title: context.translation.destinationDepartment, title: context.translation.department,
showShadow: false, showShadow: false,
showAsBottomSheet: true, showAsBottomSheet: true,
initialValue: _assetDestination.department, initialValue: _assetDestination.department,

@ -104,7 +104,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_contactInfo(), _contactPersonInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[ if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context), const Divider().defaultStyle(context),
context.translation.callComments.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), context.translation.callComments.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
@ -299,7 +299,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
).toShadowContainer(context); ).toShadowContainer(context);
} }
Widget _contactInfo() { Widget _contactPersonInfo() {
if (_model?.assetTransferContactPersons != null && _model!.assetTransferContactPersons!.isNotEmpty) { if (_model?.assetTransferContactPersons != null && _model!.assetTransferContactPersons!.isNotEmpty) {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,

@ -16,6 +16,7 @@ import 'package:test_sa/models/new_models/assistant_employee.dart';
import 'package:test_sa/models/timer_model.dart'; import 'package:test_sa/models/timer_model.dart';
import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart'; import 'package:test_sa/modules/cm_module/utilities/service_request_utils.dart';
import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart'; import 'package:test_sa/modules/cm_module/views/components/action_button/footer_action_button.dart';
import 'package:test_sa/modules/cm_module/views/components/bottom_sheets/service_request_bottomsheet.dart';
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart'; import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
import 'package:test_sa/views/app_style/sizing.dart'; import 'package:test_sa/views/app_style/sizing.dart';
import 'package:test_sa/views/widgets/date_and_time/date_picker.dart'; import 'package:test_sa/views/widgets/date_and_time/date_picker.dart';
@ -215,13 +216,19 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
AppFilledButton( AppFilledButton(
label: context.translation.complete, label: context.translation.complete,
buttonColor: AppColor.primary10, buttonColor: AppColor.primary10,
onPressed: () => _update(status: 1), onPressed: (){
// ServiceRequestBottomSheet.nurseVerifyAssetTransferBottomSheet(context: context);
_update(status: 1);
}
).expanded, ).expanded,
] else if (widget.isSender) ...[ ] else if (widget.isSender) ...[
AppFilledButton( AppFilledButton(
label: context.translation.complete, label: context.translation.complete,
buttonColor: AppColor.primary10, buttonColor: AppColor.primary10,
onPressed: () => _update(status: 1), onPressed: () {
// ServiceRequestBottomSheet.nurseVerifyAssetTransferBottomSheet(context: context);
_update(status: 1);
},
).expanded, ).expanded,
], ],
], ],

@ -146,14 +146,12 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
infoText(label: context.translation.floor, value: gasRefillModel.floor?.name), infoText(label: context.translation.floor, value: gasRefillModel.floor?.name),
infoText(label: context.translation.department, value: gasRefillModel.department?.name), infoText(label: context.translation.department, value: gasRefillModel.department?.name),
infoText(label: context.translation.requestedQuantity, value: gasRefillModel.gasRefillDetails?[0].requestedQty.toString()), infoText(label: context.translation.requestedQuantity, value: gasRefillModel.gasRefillDetails?[0].requestedQty.toString()),
//need to confirm contact info form backend.. _contactPersonInfo(),
const Divider().defaultStyle(context), if (gasRefillModel.gasRefillDetails?[0].deliverdQty != null) ...[
context.translation.contactInfo.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), const Divider().defaultStyle(context),
infoText(label: context.translation.employeeId, value: gasRefillModel.employeeId), context.translation.workOrderDetails.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
infoText(label: context.translation.name, value: gasRefillModel.name), infoText(label: context.translation.deliveredQuantity, value: gasRefillModel.gasRefillDetails![0].deliverdQty.toString()),
const Divider().defaultStyle(context), ],
context.translation.workOrderDetails.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
infoText(label: context.translation.deliveredQuantity, value: gasRefillModel.gasRefillDetails![0].deliverdQty.toString()),
if (gasRefillModel.techComment?.isNotEmpty ?? false) infoText(label: context.translation.technicalComment, value: gasRefillModel.techComment), if (gasRefillModel.techComment?.isNotEmpty ?? false) infoText(label: context.translation.technicalComment, value: gasRefillModel.techComment),
8.height, 8.height,
if (gasRefillModel.comment?.isNotEmpty ?? false) ...[ if (gasRefillModel.comment?.isNotEmpty ?? false) ...[
@ -197,6 +195,42 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
).toShadowContainer(context, padding: 0); ).toShadowContainer(context, padding: 0);
} }
Widget _contactPersonInfo() {
if (_model.gasRefillContactPerson != null && _model.gasRefillContactPerson!.isNotEmpty) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Divider().defaultStyle(context),
Text(
"Contact Info".addTranslation,
style: AppTextStyles.heading6.copyWith(
color: context.isDark ? AppColor.neutral30 : AppColor.neutral50,
),
),
..._model.gasRefillContactPerson!.asMap().entries.map((entry) {
final index = entry.key;
final person = entry.value;
final isLast = index == _model.gasRefillContactPerson!.length - 1;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 8),
infoText(label: context.translation.employeeId, value: person.employeeId),
infoText(label: context.translation.name, value: person.name),
infoText(label: context.translation.email, value: person.email),
infoText(label: context.translation.phoneNumber, value: person.mobilePhone),
infoText(label: context.translation.extensionNo, value: person.extension),
if (!isLast && _model.gasRefillContactPerson!.length > 1) const Divider().defaultStyle(context),
],
);
}).toList(),
],
);
}
return const SizedBox();
}
Widget infoText({ Widget infoText({
String? label, String? label,
String? value, String? value,

Loading…
Cancel
Save