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

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

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

@ -48,6 +48,7 @@ class GasRefillModel {
this.timerModelList,
this.gasRefillTimers,
this.gasRefillAttachments,
this.gasRefillContactPerson,
this.statusValue,
});
@ -82,11 +83,10 @@ class GasRefillModel {
Uint8List? localNurseSignature; // Now nullable
Uint8List? localEngineerSignature; // Now nullable
TimerModel? timer = TimerModel();
//TODO need to check when api provided..
List<TimerModel>? timerModelList = [];
List<GasRefillTimer>? gasRefillTimers = [];
List<GasRefillAttachments>? gasRefillAttachments;
List<GasRefillContactPerson>? gasRefillContactPerson;
int? statusValue;
GasRefillModel.fromJson(dynamic json) {
@ -118,6 +118,14 @@ class GasRefillModel {
gasRefillAttachments!.add(GasRefillAttachments.fromJson(v));
});
}
if (json['gasRefillContactPerson'] != null) {
gasRefillContactPerson = [];
json['gasRefillContactPerson'].forEach((v) {
gasRefillContactPerson?.add(GasRefillContactPerson.fromJson(v));
});
}
// try {
// final DateTime? sd = DateTime.tryParse(startDate ?? "");
@ -136,9 +144,6 @@ class GasRefillModel {
// } catch (e) {
// print(e);
// }
print('building # ${json['building']}');
print('department # ${json['department']}');
print('floor # ${json['floor']}');
engSignature = json['engSignature'];
nurseSignature = json['nurseSignature'];
@ -471,3 +476,51 @@ class GasRefillAttachments {
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: [
SingleItemDropDownMenu<Site, SiteProvider>(
context: context,
title: context.translation.destinationSite,
title: context.translation.site,
initialValue: _assetDestination.site,
showShadow: false,
loading: _deviceTransferProvider.isSiteLoading,
@ -169,7 +169,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
8.width,
SingleItemDropDownMenu<Building, NullableLoadingProvider>(
context: context,
title: context.translation.destinationBuilding,
title: context.translation.building,
initialValue: _assetDestination.building,
showShadow: false,
showAsBottomSheet: true,
@ -191,7 +191,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
children: [
SingleItemDropDownMenu<Floor, NullableLoadingProvider>(
context: context,
title: context.translation.destinationFloor,
title: context.translation.floor,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.floor,
@ -207,7 +207,7 @@ class _CreateDeviceTransferRequestState extends State<CreateDeviceTransferReques
8.width,
SingleItemDropDownMenu<Department, NullableLoadingProvider>(
context: context,
title: context.translation.destinationDepartment,
title: context.translation.department,
showShadow: false,
showAsBottomSheet: true,
initialValue: _assetDestination.department,

@ -104,7 +104,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_contactInfo(),
_contactPersonInfo(),
if ((_model?.comment ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),
context.translation.callComments.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
@ -299,7 +299,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
).toShadowContainer(context);
}
Widget _contactInfo() {
Widget _contactPersonInfo() {
if (_model?.assetTransferContactPersons != null && _model!.assetTransferContactPersons!.isNotEmpty) {
return Column(
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/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/bottom_sheets/service_request_bottomsheet.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/widgets/date_and_time/date_picker.dart';
@ -215,13 +216,19 @@ class _UpdateDeviceTransferState extends State<UpdateDeviceTransfer> {
AppFilledButton(
label: context.translation.complete,
buttonColor: AppColor.primary10,
onPressed: () => _update(status: 1),
onPressed: (){
// ServiceRequestBottomSheet.nurseVerifyAssetTransferBottomSheet(context: context);
_update(status: 1);
}
).expanded,
] else if (widget.isSender) ...[
AppFilledButton(
label: context.translation.complete,
buttonColor: AppColor.primary10,
onPressed: () => _update(status: 1),
onPressed: () {
// ServiceRequestBottomSheet.nurseVerifyAssetTransferBottomSheet(context: context);
_update(status: 1);
},
).expanded,
],
],

@ -146,14 +146,12 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
infoText(label: context.translation.floor, value: gasRefillModel.floor?.name),
infoText(label: context.translation.department, value: gasRefillModel.department?.name),
infoText(label: context.translation.requestedQuantity, value: gasRefillModel.gasRefillDetails?[0].requestedQty.toString()),
//need to confirm contact info form backend..
const Divider().defaultStyle(context),
context.translation.contactInfo.heading6(context).custom(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50),
infoText(label: context.translation.employeeId, value: gasRefillModel.employeeId),
infoText(label: context.translation.name, value: gasRefillModel.name),
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()),
_contactPersonInfo(),
if (gasRefillModel.gasRefillDetails?[0].deliverdQty != null) ...[
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),
8.height,
if (gasRefillModel.comment?.isNotEmpty ?? false) ...[
@ -197,6 +195,42 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
).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({
String? label,
String? value,

Loading…
Cancel
Save