requester info added.

main_design2.0
Sikander Saleem 1 year ago
parent 9c7653109d
commit 7b6b170f23

@ -9,6 +9,8 @@ import 'package:test_sa/models/lookup.dart';
class ServiceRequest {
String id;
String requestCode;
CallCreatedBy callCreatedBy;
String deviceSerialNumber;
int deviceId;
String deviceArName;
@ -51,6 +53,7 @@ class ServiceRequest {
this.id,
this.date,
this.requestCode,
this.callCreatedBy,
this.hospitalName,
this.deviceArName,
this.deviceEnName,
@ -98,6 +101,10 @@ class ServiceRequest {
return ServiceRequest(
id: parsedJson["id"].toString(),
requestCode: parsedJson["callNo"].toString(),
callCreatedBy: parsedJson['callCreatedBy'] != null
? CallCreatedBy.fromJson(parsedJson['callCreatedBy'])
: null,
hospitalName: parsedJson["asset"]["site"]["custName"],
deviceNumber: parsedJson["asset"]["assetNumber"].toString(),
deviceId: parsedJson["asset"]["id"],
@ -123,12 +130,16 @@ class ServiceRequest {
engineerMobile: parsedJson["assignedEmployee"] == null ? null : parsedJson["assignedEmployee"]["phone"],
faultDescription: parsedJson["workOrder"] != null
? parsedJson["workOrder"]["faultDescription"] != null
? FaultDescription.fromJson(parsedJson["workOrder"]["faultDescription"])
: null
? FaultDescription.fromJson(parsedJson["workOrder"]["faultDescription"])
: null
: null,
jobSheetNumber: parsedJson["workOrder"] != null ? parsedJson["workOrder"]["jobSheetNumber"] : null,
visitDate: DateTime.tryParse(parsedJson["visitDate"] ?? "").toString().split(" ").first,
visitDate: DateTime
.tryParse(parsedJson["visitDate"] ?? "")
.toString()
.split(" ")
.first,
nextVisitDate: DateTime.tryParse(parsedJson["nextVisitDate"] ?? ""),
//workPerformed: parsedJson["workOrder"] != null ? parsedJson["workOrder"]["workPerformed"] : null,
device: Asset.fromJson(parsedJson["asset"]),
@ -142,6 +153,7 @@ class ServiceRequest {
);
}
Future<bool> validateNewRequest(BuildContext context) async {
if (device == null) {
await Fluttertoast.showToast(msg: "${context.translation.youHaveToSelect} ${context.translation.device}");
@ -162,3 +174,22 @@ class ServiceRequest {
return true;
}
}
class CallCreatedBy {
String id;
String name;
CallCreatedBy({this.id, this.name});
CallCreatedBy.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}

@ -97,7 +97,8 @@ class _PpmDetailsPageState extends State<PpmDetailsPage> {
const Divider().defaultStyle(context),
'${context.translation.assignedTo}: ${ppm.assignedToName ?? ""}'.bodyText(context),
'${context.translation.engineerName}: ${ppm.assignedEmployeeName ?? ""}'.bodyText(context),
'${context.translation.site}: ${ppm.siteName}'.bodyText(context),
'${context.translation.site}: ${ppm.siteName?.cleanupWhitespace?.capitalizeFirstOfEach}'.bodyText(context),
'${context.translation.department}: ${ppm.departmentName?.cleanupWhitespace?.capitalizeFirstOfEach}'.bodyText(context),
],
).toShadowContainer(context).paddingAll(16),
).expanded,

@ -109,10 +109,10 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
'${context.translation.requestNo}: ${serviceRequest.requestCode}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
// Text(
// '${context.translation.visitDate}: ${serviceRequest.visitDate}',
// style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
// ),
Text(
'${context.translation.requesterName}: ${serviceRequest.callCreatedBy?.name ?? "-"}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
],
).expanded,
Column(
@ -143,6 +143,14 @@ class _ServiceRequestDetailsPageState extends State<ServiceRequestDetailsPage> {
'${context.translation.model}: ${serviceRequest.device.modelDefinition.modelName?.cleanupWhitespace?.capitalizeFirstOfEach}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
Text(
'${context.translation.site}: ${serviceRequest.device.site.custName?.cleanupWhitespace?.capitalizeFirstOfEach}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
Text(
'${context.translation.department}: ${serviceRequest.device.department.departmentName?.cleanupWhitespace?.capitalizeFirstOfEach}',
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral20),
),
8.height,
if ((serviceRequest.callComments ?? "").isNotEmpty) ...[
const Divider().defaultStyle(context),

Loading…
Cancel
Save