diff --git a/assets/images/back.svg b/assets/images/back.svg
new file mode 100644
index 00000000..d2ee2dcd
--- /dev/null
+++ b/assets/images/back.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/clear.svg b/assets/images/clear.svg
new file mode 100644
index 00000000..a380bde3
--- /dev/null
+++ b/assets/images/clear.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/done.svg b/assets/images/done.svg
new file mode 100644
index 00000000..32580c30
--- /dev/null
+++ b/assets/images/done.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/image_placeholder.svg b/assets/images/image_placeholder.svg
new file mode 100644
index 00000000..34ee5039
--- /dev/null
+++ b/assets/images/image_placeholder.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/images/redo.svg b/assets/images/redo.svg
new file mode 100644
index 00000000..ddf5a670
--- /dev/null
+++ b/assets/images/redo.svg
@@ -0,0 +1,3 @@
+
diff --git a/lib/attachment.dart b/lib/attachment.dart
new file mode 100644
index 00000000..a89ae4a5
--- /dev/null
+++ b/lib/attachment.dart
@@ -0,0 +1,27 @@
+class Attachment {
+ Attachment({
+ this.id,
+ this.name,
+ });
+
+ Attachment.fromJson(dynamic json) {
+ id = json['id'];
+ name = json['name'];
+ }
+ num id;
+ String name;
+ Attachment copyWith({
+ num id,
+ String name,
+ }) =>
+ Attachment(
+ id: id ?? this.id,
+ name: name ?? this.name,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ map['name'] = name;
+ return map;
+ }
+}
diff --git a/lib/controllers/providers/api/gas_refill_provider.dart b/lib/controllers/providers/api/gas_refill_provider.dart
index 4e209591..ff4f190e 100644
--- a/lib/controllers/providers/api/gas_refill_provider.dart
+++ b/lib/controllers/providers/api/gas_refill_provider.dart
@@ -7,9 +7,8 @@ import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
-import 'package:test_sa/models/gas_refill/gas_refill_model.dart';
import 'package:test_sa/models/hospital.dart';
-import 'package:test_sa/models/new_models/gas_refill_model.dart' as gasModel;
+import 'package:test_sa/models/new_models/gas_refill_model.dart';
import 'package:test_sa/models/timer_model.dart';
import 'package:test_sa/models/user.dart';
@@ -39,7 +38,7 @@ class GasRefillProvider extends ChangeNotifier {
bool nextPage = true;
// list of user requests
- List items;
+ List items;
// when requests in-process _loading = true
// done _loading = true
@@ -71,7 +70,7 @@ class GasRefillProvider extends ChangeNotifier {
if (stateCode >= 200 && stateCode < 300) {
// client's request was successfully received
List requestsListJson = json.decode(response.body)["data"];
- List itemsPage = requestsListJson.map((request) => gasModel.GasRefillModel.fromJson(request)).toList();
+ List itemsPage = requestsListJson.map((request) => GasRefillModel.fromJson(request)).toList();
items ??= [];
items.addAll(itemsPage);
notifyListeners();
@@ -96,7 +95,7 @@ class GasRefillProvider extends ChangeNotifier {
Future createModel({
@required BuildContext context,
@required User user,
- @required gasModel.GasRefillModel model,
+ @required GasRefillModel model,
}) async {
Response response;
try {
@@ -128,8 +127,8 @@ class GasRefillProvider extends ChangeNotifier {
Future updateModel({
@required String host,
@required User user,
- @required gasModel.GasRefillModel oldModel,
- @required gasModel.GasRefillModel newModel,
+ @required GasRefillModel oldModel,
+ @required GasRefillModel newModel,
}) async {
Map body = {
"id": newModel.id,
diff --git a/lib/controllers/providers/api/parts_provider.dart b/lib/controllers/providers/api/parts_provider.dart
index de14ce42..aae94750 100644
--- a/lib/controllers/providers/api/parts_provider.dart
+++ b/lib/controllers/providers/api/parts_provider.dart
@@ -5,8 +5,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
-import 'package:test_sa/models/part.dart';
-import 'package:test_sa/models/user.dart';
+import 'package:test_sa/models/service_request/spare_parts.dart';
class PartsProvider extends ChangeNotifier {
// number of items call in each request
@@ -32,9 +31,9 @@ class PartsProvider extends ChangeNotifier {
// contain user data
// when user not login or register _user = null
- List _parts;
+ List _parts;
- List get parts => _parts;
+ List get parts => _parts;
// when categories in-process _loading = true
// done _loading = true
@@ -53,7 +52,7 @@ class PartsProvider extends ChangeNotifier {
/// return state code if request complete may be 200, 404 or 403
/// for more details check http state manager
/// lib\controllers\http_status_manger\http_status_manger.dart
- Future getParts({String host, User user, String title}) async {
+ Future getParts({String title}) async {
if (_loading == true) return -2;
_loading = true;
notifyListeners();
@@ -64,10 +63,9 @@ class PartsProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List categoriesListJson = json.decode(utf8.decode(response.bodyBytes));
- List _page = categoriesListJson.map((part) => Part.fromJson(part)).toList();
- if (parts == null) _parts = [];
-
- _parts.addAll(_page);
+ List _page = categoriesListJson.map((part) => SparePart.fromJson(part)).toList();
+ _parts ??= [];
+ _parts.addAll(_page.map((e) => SparePartsWorkOrders(sparePart: e)).toList());
if (_page.length >= pageItemNumber) {
_nextPage = true;
} else {
@@ -90,19 +88,19 @@ class PartsProvider extends ChangeNotifier {
/// return state code if request complete may be 200, 404 or 403
/// for more details check http state manager
/// lib\controllers\http_status_manger\http_status_manger.dart
- Future> getPartsList({String host, User user, num assetId, String title}) async {
+ Future> getPartsList({num assetId, String title}) async {
Response response;
try {
- if (int.tryParse(title) != null) {
+ if (int.tryParse(title ?? "") != null) {
response = await ApiManager.instance.post(URLs.getPartNumber, body: {if (title != null && title.isNotEmpty) "partNo": title, "assetId": assetId});
} else {
response = await ApiManager.instance.post(URLs.getPartNumber, body: {if (title != null && title.isNotEmpty) "partName": title, "assetId": assetId});
}
- List page = [];
+ List page = [];
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List categoriesListJson = json.decode(response.body)["data"];
- page = categoriesListJson.map((part) => Part.fromJson(part)).toList();
+ page = categoriesListJson.map((part) => SparePart.fromJson(part)).toList();
}
return page;
} catch (error) {
diff --git a/lib/controllers/providers/api/service_requests_provider.dart b/lib/controllers/providers/api/service_requests_provider.dart
index b00f79b6..0d20dde2 100644
--- a/lib/controllers/providers/api/service_requests_provider.dart
+++ b/lib/controllers/providers/api/service_requests_provider.dart
@@ -9,16 +9,15 @@ import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/http_status_manger.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/extensions/context_extension.dart';
-import 'package:test_sa/models/call_request_for_work_order_model.dart';
import 'package:test_sa/models/issue.dart';
import 'package:test_sa/models/lookup.dart';
-import 'package:test_sa/models/service_report.dart';
+import 'package:test_sa/models/service_request/service_report.dart';
import 'package:test_sa/models/service_request/service_request.dart';
import 'package:test_sa/models/service_request/service_request_search.dart';
import 'package:test_sa/models/timer_model.dart';
import '../../../models/service_request/search_work_order.dart';
-import '../../../models/service_request/sub_work_order_details.dart';
+import '../../../models/service_request/wo_call_request.dart';
import '../../../models/user.dart';
import '../../../new_views/common_widgets/app_lazy_loading.dart';
@@ -310,74 +309,69 @@ class ServiceRequestsProvider extends ChangeNotifier {
}
}
- Future createServiceReport({
- @required String host,
- @required User user,
- @required ServiceReport report,
- @required ServiceRequest request,
- }) async {
+ Future createServiceReport({@required ServiceReport report, @required ServiceRequest request}) async {
Response response;
try {
- Map body = {
- "id": 0,
- "parentWOId": null,
- "workOrderNo": "",
- "workOrderYear": null,
- "workOrderSequennce": null,
- "callRequest": {
- "id": request.id,
- },
- "assetType": report.assetType?.toJson(),
- "assignedEmployee": {"id": report.engineer?.id, "name": report.engineer?.name ?? ""},
- "visitDate": report.returnToService?.toIso8601String() ?? "",
- // "assistantEmployees": [
- // {"id": report.engineer.id, "name": report.engineer.name},
- // ],
- "supplier": null,
- "vendorTicketNumber": null,
- "contactPersonWorkOrders": [
- {
- "id": 0,
- // "employeeCode": "",
- "name": user.userName,
- "telephone": user.phoneNumber,
- // "job": "",
- "email": user.email,
- // "land": "",
- "contactUserId": user.userID,
- }
- ],
- "calllastSituation": report.callLastSituation?.toJson(),
- "currentSituation": null,
- "repairLocation": report.repairLocation?.toJson(),
- "reason": report.reason?.toJson(),
- "startofWorkTime": report.timer?.startAt?.toIso8601String() ?? "",
- "endofWorkTime": report.timer?.endAt?.toIso8601String() ?? "",
- "workingHours": report?.workingHours,
- "travelingHours": report.travelingHours,
- "travelingExpenses": report.travelingExpense ?? 0,
- if (report.faultDescription != null) "faultDescription": report.faultDescription.toJson(),
- "sparePartsWorkOrders": report.parts
- ?.map(
- (p) => {
- "id": p.reportPartID ?? 0,
- "sparePart": {"id": p.id, "partNo": p.partNo, "partName": p.partName},
- "qty": p.quantity
- },
- )
- ?.toList(),
- "reviewComment": "",
- "comment": report.comment,
- "attachmentsWorkOrder": request.devicePhotos?.map((e) => {"name": e})?.toList(),
- "equipmentStatus": report.equipmentStatus?.toJson(),
- "suppEngineerWorkOrders": null,
- "engSignature": report.signatureEngineer,
- "nurseSignature": report.signatureNurse,
- "woParentDto": null,
- };
+ // Map body = {
+ // "id": 0,
+ // "parentWOId": null,
+ // "workOrderNo": "",
+ // "workOrderYear": null,
+ // "workOrderSequennce": null,
+ // "callRequest": {
+ // "id": request.id,
+ // },
+ // "assetType": report.assetType?.toJson(),
+ // "assignedEmployee": {"id": report.engineer?.id, "name": report.engineer?.name ?? ""},
+ // "visitDate": report.returnToService?.toIso8601String() ?? "",
+ // // "assistantEmployees": [
+ // // {"id": report.engineer.id, "name": report.engineer.name},
+ // // ],
+ // "supplier": null,
+ // "vendorTicketNumber": null,
+ // "contactPersonWorkOrders": [
+ // {
+ // "id": 0,
+ // // "employeeCode": "",
+ // "name": user.userName,
+ // "telephone": user.phoneNumber,
+ // // "job": "",
+ // "email": user.email,
+ // // "land": "",
+ // "contactUserId": user.userID,
+ // }
+ // ],
+ // "calllastSituation": report.callLastSituation?.toJson(),
+ // "currentSituation": null,
+ // "repairLocation": report.repairLocation?.toJson(),
+ // "reason": report.reason?.toJson(),
+ // "startofWorkTime": report.timer?.startAt?.toIso8601String() ?? "",
+ // "endofWorkTime": report.timer?.endAt?.toIso8601String() ?? "",
+ // "workingHours": report?.workingHours,
+ // "travelingHours": report.travelingHours,
+ // "travelingExpenses": report.travelingExpense ?? 0,
+ // if (report.faultDescription != null) "faultDescription": report.faultDescription.toJson(),
+ // "sparePartsWorkOrders": report.parts
+ // ?.map(
+ // (p) => {
+ // "id": p.reportPartID ?? 0,
+ // "sparePart": {"id": p.id, "partNo": p.partNo, "partName": p.partName},
+ // "qty": p.quantity
+ // },
+ // )
+ // ?.toList(),
+ // "reviewComment": "",
+ // "comment": report.comment,
+ // "attachmentsWorkOrder": request.devicePhotos?.map((e) => {"name": e})?.toList(),
+ // "equipmentStatus": report.equipmentStatus?.toJson(),
+ // "suppEngineerWorkOrders": null,
+ // "engSignature": report.signatureEngineer,
+ // "nurseSignature": report.signatureNurse,
+ // "woParentDto": null,
+ // };
// body["uid"] = user.id;
// body["token"] = user.token;
- response = await ApiManager.instance.post(URLs.createServiceReport, body: body);
+ response = await ApiManager.instance.post(URLs.createServiceReport, body: {});
// response = await post(
// Uri.parse(
// host+URLs.createServiceReport),
@@ -415,9 +409,9 @@ class ServiceRequestsProvider extends ChangeNotifier {
}
}
- CallRequestForWorkOrder callRequestForWorkOrder;
+ CallRequest callRequestForWorkOrder;
- Future getCallRequestForWorkOrder({String callId}) async {
+ Future getCallRequestForWorkOrder({String callId}) async {
Response response;
try {
response = await ApiManager.instance.get(
@@ -428,7 +422,7 @@ class ServiceRequestsProvider extends ChangeNotifier {
// client's request was successfully received
Map listJson = json.decode(response.body)["data"];
log(listJson?.toString());
- callRequestForWorkOrder = CallRequestForWorkOrder.fromJson(listJson);
+ callRequestForWorkOrder = CallRequest.fromJson(listJson);
}
notifyListeners();
@@ -466,7 +460,7 @@ class ServiceRequestsProvider extends ChangeNotifier {
}
}
- Future getSubWorkOrderDetails({@required String parentId}) async {
+ Future getSubWorkOrderDetails({@required String parentId}) async {
Response response;
try {
response = await ApiManager.instance.get(URLs.getSubWorkerInfoAccordingToPreviousStep + "?parentId=$parentId");
@@ -474,7 +468,7 @@ class ServiceRequestsProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
final workOrderJson = json.decode(response.body)["data"];
- return SubWorkOrderDetails.fromJson(workOrderJson);
+ return ServiceReport.fromJson(workOrderJson);
}
return null;
} catch (e) {
@@ -525,7 +519,10 @@ class ServiceRequestsProvider extends ChangeNotifier {
// body["job_id"] = request.id;
// body["report_id"] = request.reportID;
// try {
- Map body = report.toMap(request);
+ Map body = report.toJson();
+
+ /// todo [zaid] : don't forget to add [request] data to [body]
+ // Map body = report.toMap(request);
// body["uid"] = user.id;
// body["token"] = user.token;
response = await ApiManager.instance.put(URLs.updateServiceReport, body: body);
@@ -626,7 +623,8 @@ class ServiceRequestsProvider extends ChangeNotifier {
// If the call to the server was successful, parse the JSON.
if (response.statusCode >= 200 && response.statusCode < 300) {
// If the call to the server was successful, parse the JSON.
- return ServiceReport.fromJson(json.decode(response.body)["data"], reportId);
+ /// todo [zaid]: check [reportId] below
+ return ServiceReport.fromJson(json.decode(response.body)["data"] /*, reportId*/);
} else {
throw (HttpStatusManger.getStatusMessage(status: response.statusCode, subtitle: subtitle));
}
diff --git a/lib/controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart b/lib/controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart
index 922242a9..3dbfc742 100644
--- a/lib/controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart
+++ b/lib/controllers/providers/api/status_drop_down/report/service_report_assistants_employee_provider.dart
@@ -5,7 +5,10 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
-import 'package:test_sa/models/service_request/search_work_order.dart';
+import 'package:test_sa/models/engineer.dart';
+
+import '../../../../../models/new_models/assigned_employee.dart';
+import '../../../../../models/new_models/assistant_employee.dart';
class ServiceReportAssistantsEmployeeProvider extends ChangeNotifier {
//reset provider data
@@ -41,15 +44,13 @@ class ServiceReportAssistantsEmployeeProvider extends ChangeNotifier {
/// return state code if request complete may be 200, 404 or 403
/// for more details check http state manager
/// lib\controllers\http_status_manger\http_status_manger.dart
- Future getAssistantEmployees() async {
+ Future getAssistantEmployees(num assetId) async {
if (_loading == true) return -2;
_loading = true;
notifyListeners();
Response response;
try {
- response = await ApiManager.instance.get(
- "${URLs.getEngineers}",
- );
+ response = await ApiManager.instance.get("${URLs.getEngineers}&assetId=$assetId");
// response = await get(
// Uri.parse(
// URLs.getServiceReportLastCalls
@@ -61,7 +62,7 @@ class ServiceReportAssistantsEmployeeProvider extends ChangeNotifier {
// client's request was successfully received
List usersListJson = json.decode(response.body);
_assistantEmployees = [];
- _assistantEmployees = usersListJson.map((type) => AssistantEmployees.fromJson(type ?? {})).toList();
+ _assistantEmployees = usersListJson.map((type) => Engineer.fromJson(type ?? {})).map((e) => AssistantEmployees(user: AssignedEmployee(id: e.id, name: e.name))).toList();
}
_loading = false;
notifyListeners();
diff --git a/lib/controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart b/lib/controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart
index 7551ad57..8785cbea 100644
--- a/lib/controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart
+++ b/lib/controllers/providers/api/status_drop_down/report/service_report_last_calls_provider.dart
@@ -6,7 +6,6 @@ import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
import 'package:test_sa/models/lookup.dart';
-import 'package:test_sa/models/user.dart';
class ServiceReportLastCallsProvider extends ChangeNotifier {
//reset provider data
@@ -42,29 +41,15 @@ class ServiceReportLastCallsProvider extends ChangeNotifier {
/// return state code if request complete may be 200, 404 or 403
/// for more details check http state manager
/// lib\controllers\http_status_manger\http_status_manger.dart
- Future getCalls({
- String host,
- User user,
- int serviceStatus,
- String woId,
- int id,
- String typeName,
- }) async {
+ Future getCalls({String parentId, int id, String typeName}) async {
if (_loading == true) return -2;
_loading = true;
notifyListeners();
Response response;
try {
- // todo request new api from backend to make filter work
response = await ApiManager.instance.get(
- "${URLs.getServiceReportLastCalls}?parentWOId=${woId ?? id}&isAdd=true&id=${id ?? 0}&typeTransaction=$typeName",
+ "${URLs.getServiceReportLastCalls}?parentWOId=${parentId ?? id}&isAdd=true&id=${id ?? 0}&typeTransaction=$typeName",
);
- // response = await get(
- // Uri.parse(
- // URLs.getServiceReportLastCalls
- // +(serviceStatus == null ? "" : "?service_status=$serviceStatus")
- // ),
- // );
_stateCode = response.statusCode;
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
diff --git a/lib/controllers/providers/api/status_drop_down/report/vendor_provider.dart b/lib/controllers/providers/api/status_drop_down/report/vendor_provider.dart
index 4271e001..8e3549dd 100644
--- a/lib/controllers/providers/api/status_drop_down/report/vendor_provider.dart
+++ b/lib/controllers/providers/api/status_drop_down/report/vendor_provider.dart
@@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:test_sa/controllers/api_routes/api_manager.dart';
import 'package:test_sa/controllers/api_routes/urls.dart';
-import 'package:test_sa/models/service_request/search_work_order.dart';
+import 'package:test_sa/models/service_request/supplier_details.dart';
class VendorProvider extends ChangeNotifier {
void reset() {
@@ -17,8 +17,8 @@ class VendorProvider extends ChangeNotifier {
int _stateCode;
int get stateCode => _stateCode;
- List _vendors;
- List get vendors => _vendors;
+ List _vendors;
+ List get vendors => _vendors;
bool _loading;
bool get isLoading => _loading;
@@ -38,7 +38,7 @@ class VendorProvider extends ChangeNotifier {
if (response.statusCode >= 200 && response.statusCode < 300) {
// client's request was successfully received
List suppliersJson = json.decode(response.body)["data"];
- _vendors = suppliersJson.map((type) => Supplier.fromJson(type)).toList();
+ _vendors = suppliersJson.map((type) => SupplierDetails.fromJson(type)).toList();
}
_loading = false;
notifyListeners();
diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb
index 733a78aa..da3950b4 100644
--- a/lib/l10n/app_ar.arb
+++ b/lib/l10n/app_ar.arb
@@ -171,6 +171,7 @@
"partNumberName": "رقم/اسم القطعة",
"quantity": "كمية",
"reasons": "الاسباب",
+ "reason": "السبب",
"reportStatus": "حالة التقرير",
"reportType": "نوع التقرير",
"callId": "رقم الطلب",
@@ -287,5 +288,10 @@
"pickADate" : "إختر تاريخ",
"firstActionStatus" : "حالة الإجراء الأول",
"loanAvailability" : "توافر القرض",
- "save" : "حفظ"
+ "save" : "حفظ",
+ "serviceType" : "نوع الخدمة",
+ "assistantEmployee" : "موظف مساعد",
+ "assignAssistant" : "تعيين مساعد",
+ "partNo" : "الجزء رقم",
+ "engSign" : "توقيع المهندس"
}
\ No newline at end of file
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index b7ac86ab..8ca93ef9 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -171,6 +171,7 @@
"partNumberName": "Part Number/Name",
"quantity": "Quantity",
"reasons": "Reasons",
+ "reason": "Reason",
"reportStatus": "Report Status",
"reportType": "Report Type",
"callId": "Call Id",
@@ -292,5 +293,10 @@
"pickADate" : "Pick a date",
"firstActionStatus" : "First Action Status",
"loanAvailability" : "Loan Availability",
- "save" : "Save"
+ "save" : "Save",
+ "serviceType" : "Service Type",
+ "assistantEmployee" : "Assistant Employee",
+ "assignAssistant" : "Assign Assistant",
+ "partNo" : "Part No.",
+ "engSign" : "Engineer Signature"
}
\ No newline at end of file
diff --git a/lib/main.dart b/lib/main.dart
index 54a74935..be728ba2 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -59,6 +59,8 @@ import 'package:test_sa/providers/service_request_providers/loan_availability_pr
import 'package:test_sa/providers/service_request_providers/priority_provider.dart';
import 'package:test_sa/providers/service_request_providers/requested_through_provider.dart';
import 'package:test_sa/providers/service_request_providers/type_of_request_provider.dart';
+import 'package:test_sa/providers/work_order/reason_provider.dart';
+import 'package:test_sa/providers/work_order/service_type_provider.dart';
import 'package:test_sa/views/pages/device_transfer/asset_filter_screen.dart';
import 'package:test_sa/views/pages/device_transfer/asset_search_screen.dart';
import 'package:test_sa/views/pages/device_transfer/request_device_transfer.dart';
@@ -170,6 +172,8 @@ class MyApp extends StatelessWidget {
ChangeNotifierProvider(create: (_) => TypeOfRequestProvider()),
ChangeNotifierProvider(create: (_) => FirstActionStatusProvider()),
ChangeNotifierProvider(create: (_) => LoanAvailabilityProvider()),
+ ChangeNotifierProvider(create: (_) => ReasonProvider()),
+ ChangeNotifierProvider(create: (_) => ServiceTypeProvider()),
],
child: GestureDetector(
onTap: () {
diff --git a/lib/models/call_request_for_work_order_model.dart b/lib/models/call_request_for_work_order_model.dart
deleted file mode 100644
index 574bcda4..00000000
--- a/lib/models/call_request_for_work_order_model.dart
+++ /dev/null
@@ -1,320 +0,0 @@
-import 'device/asset.dart';
-
-class CallRequestForWorkOrder {
- int id;
- String callNo;
- Asset asset;
- AssignedEmployee assignedEmployee;
- List callSiteContactPerson;
- Status status;
- Status callLastSituation;
- Status defectType;
- Status firstAction;
- int assetType;
-
- CallRequestForWorkOrder(
- {this.id, this.callNo, this.asset, this.assignedEmployee, this.callSiteContactPerson, this.status, this.callLastSituation, this.defectType, this.firstAction, this.assetType});
-
- CallRequestForWorkOrder.fromJson(Map json) {
- id = json['id'];
- callNo = json['callNo'];
- asset = json['asset'] != null ? new Asset.fromJson(json['asset']) : null;
- assignedEmployee = json['assignedEmployee'] != null ? new AssignedEmployee.fromJson(json['assignedEmployee']) : null;
- if (json['callSiteContactPerson'] != null) {
- callSiteContactPerson = [];
- json['callSiteContactPerson'].forEach((v) {
- callSiteContactPerson.add(new CallSiteContactPerson.fromJson(v));
- });
- }
- status = json['status'] != null ? new Status.fromJson(json['status']) : null;
- callLastSituation = json['callLastSituation'] != null ? new Status.fromJson(json['callLastSituation']) : null;
- defectType = json['defectType'] != null ? new Status.fromJson(json['defectType']) : null;
- firstAction = json['firstAction'] != null ? new Status.fromJson(json['firstAction']) : null;
- assetType = json['assetType'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['callNo'] = this.callNo;
- if (this.asset != null) {
- data['asset'] = this.asset.toJson();
- }
- if (this.assignedEmployee != null) {
- data['assignedEmployee'] = this.assignedEmployee.toJson();
- }
- if (this.callSiteContactPerson != null) {
- data['callSiteContactPerson'] = this.callSiteContactPerson.map((v) => v.toJson()).toList();
- }
- if (this.status != null) {
- data['status'] = this.status.toJson();
- }
- if (this.callLastSituation != null) {
- data['callLastSituation'] = this.callLastSituation.toJson();
- }
- if (this.defectType != null) {
- data['defectType'] = this.defectType.toJson();
- }
- if (this.firstAction != null) {
- data['firstAction'] = this.firstAction.toJson();
- }
- data['assetType'] = this.assetType;
- return data;
- }
-}
-
-class ModelDefinition {
- int id;
- String assetName;
- String modelDefCode;
- String modelName;
- int manufacturerId;
- String manufacturerName;
- String supplierName;
- String replacementDate;
- int lifeSpan;
- List modelDefRelatedDefects;
- List suppliers;
-
- ModelDefinition(
- {this.id,
- this.assetName,
- this.modelDefCode,
- this.modelName,
- this.manufacturerId,
- this.manufacturerName,
- this.supplierName,
- this.replacementDate,
- this.lifeSpan,
- this.modelDefRelatedDefects,
- this.suppliers});
-
- ModelDefinition.fromJson(Map json) {
- id = json['id'];
- assetName = json['assetName'];
- modelDefCode = json['modelDefCode'];
- modelName = json['modelName'];
- manufacturerId = json['manufacturerId'];
- manufacturerName = json['manufacturerName'];
- supplierName = json['supplierName'];
- replacementDate = json['replacementDate'];
- lifeSpan = json['lifeSpan'];
- if (json['modelDefRelatedDefects'] != null) {
- modelDefRelatedDefects = [];
- json['modelDefRelatedDefects'].forEach((v) {
- modelDefRelatedDefects.add(new ModelDefRelatedDefects.fromJson(v));
- });
- }
- if (json['suppliers'] != null) {
- suppliers = [];
- json['suppliers'].forEach((v) {
- // suppliers!.add(new Null.fromJson(v));
- });
- }
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['assetName'] = this.assetName;
- data['modelDefCode'] = this.modelDefCode;
- data['modelName'] = this.modelName;
- data['manufacturerId'] = this.manufacturerId;
- data['manufacturerName'] = this.manufacturerName;
- data['supplierName'] = this.supplierName;
- data['replacementDate'] = this.replacementDate;
- data['lifeSpan'] = this.lifeSpan;
- if (this.modelDefRelatedDefects != null) {
- data['modelDefRelatedDefects'] = this.modelDefRelatedDefects.map((v) => v.toJson()).toList();
- }
- if (this.suppliers != null) {
- data['suppliers'] = this.suppliers.map((v) => v.toJson()).toList();
- }
- return data;
- }
-}
-
-class ModelDefRelatedDefects {
- int id;
- String defectName;
- String workPerformed;
- String estimatedTime;
-
- ModelDefRelatedDefects({this.id, this.defectName, this.workPerformed, this.estimatedTime});
-
- ModelDefRelatedDefects.fromJson(Map json) {
- id = json['id'];
- defectName = json['defectName'];
- workPerformed = json['workPerformed'];
- estimatedTime = json['estimatedTime'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['defectName'] = this.defectName;
- data['workPerformed'] = this.workPerformed;
- data['estimatedTime'] = this.estimatedTime;
- return data;
- }
-}
-
-class Site {
- int id;
- int customerCode;
- String custName;
- List buildings;
-
- Site({this.id, this.customerCode, this.custName, this.buildings});
-
- Site.fromJson(Map json) {
- id = json['id'];
- customerCode = json['customerCode'];
- custName = json['custName'];
- if (json['buildings'] != null) {
- buildings = [];
- json['buildings'].forEach((v) {
- // buildings!.add(new Null.fromJson(v));
- });
- }
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['customerCode'] = this.customerCode;
- data['custName'] = this.custName;
- if (this.buildings != null) {
- data['buildings'] = this.buildings.map((v) => v.toJson()).toList();
- }
- return data;
- }
-}
-
-class Department {
- int id;
- String departmentName;
- String departmentCode;
- String ntCode;
-
- Department({this.id, this.departmentName, this.departmentCode, this.ntCode});
-
- Department.fromJson(Map json) {
- id = json['id'];
- departmentName = json['departmentName'];
- departmentCode = json['departmentCode'];
- ntCode = json['ntCode'];
- }
-
- Map toJson() {
- final Map data = {};
- data['id'] = id;
- data['departmentName'] = departmentName;
- data['departmentCode'] = departmentCode;
- data['ntCode'] = ntCode;
- return data;
- }
-}
-
-class AssignedEmployee {
- String id;
- String name;
-
- AssignedEmployee({this.id, this.name});
-
- AssignedEmployee.fromJson(Map json) {
- id = json['id'];
- name = json['name'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['name'] = this.name;
- return data;
- }
-}
-
-class CallSiteContactPerson {
- int id;
- String employeeCode;
- String name;
- String telephone;
- String job;
- String email;
- String land;
- String contactUserId;
-
- CallSiteContactPerson({this.id, this.employeeCode, this.name, this.telephone, this.job, this.email, this.land, this.contactUserId});
-
- CallSiteContactPerson.fromJson(Map json) {
- id = json['id'];
- employeeCode = json['employeeCode'];
- name = json['name'];
- telephone = json['telephone'];
- job = json['job'];
- email = json['email'];
- land = json['land'];
- contactUserId = json['contactUserId'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['employeeCode'] = this.employeeCode;
- data['name'] = this.name;
- data['telephone'] = this.telephone;
- data['job'] = this.job;
- data['email'] = this.email;
- data['land'] = this.land;
- data['contactUserId'] = this.contactUserId;
- return data;
- }
-}
-
-class Status {
- int id;
- String name;
- int value;
-
- Status({this.id, this.name, this.value});
-
- Status.fromJson(Map json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['name'] = this.name;
- data['value'] = this.value;
- return data;
- }
-}
-
-class Building {
- int id;
- String name;
- int value;
- var floor;
-
- Building({this.id, this.name, this.value, this.floor});
-
- Building.fromJson(Map json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- floor = json['floor'];
- }
-
- Map toJson() {
- final Map data = new Map();
- data['id'] = this.id;
- data['name'] = this.name;
- data['value'] = this.value;
- data['floor'] = this.floor;
- return data;
- }
-}
diff --git a/lib/models/engineer.dart b/lib/models/engineer.dart
index e53b0af5..b285a0c4 100644
--- a/lib/models/engineer.dart
+++ b/lib/models/engineer.dart
@@ -27,10 +27,10 @@ class Engineer {
@override
int get hashCode => id.hashCode;
- Map toMap() {
+ Map toJson({bool userPrefix = false}) {
return {
- 'id': id,
- 'name': name,
+ userPrefix ? "userId" : "id": id,
+ userPrefix ? "userName" : "name": name,
};
}
}
diff --git a/lib/models/gas_refill/gas_refill_details.dart b/lib/models/gas_refill/gas_refill_details.dart
deleted file mode 100644
index 50166779..00000000
--- a/lib/models/gas_refill/gas_refill_details.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-import 'package:test_sa/models/lookup.dart';
-
-@Deprecated("Use the model inside lib/models/new_models folder")
-class GasRefillDetails {
- Lookup type;
- Lookup cylinderSize;
- Lookup cylinderType;
- double requestedQuantity;
- double deliveredQuantity;
- bool selectedForEditing;
-
- GasRefillDetails({
- this.type,
- this.cylinderSize,
- this.cylinderType,
- this.requestedQuantity,
- this.deliveredQuantity,
- this.selectedForEditing,
- });
-
- bool validate() {
- //if(cylinderSize == null) return false;
- if (type == null) return false;
- if (requestedQuantity == null) return false;
- return true;
- }
-
- factory GasRefillDetails.fromJson(Map parsedJson) {
- return GasRefillDetails(
- type: Lookup.fromJson(parsedJson["gasType"]),
- cylinderSize: Lookup.fromJson(parsedJson["cylinderSize"]),
- cylinderType: Lookup.fromJson(parsedJson["cylinderType"]),
- requestedQuantity: parsedJson["requestedQty"],
- deliveredQuantity: parsedJson["deliverdQty"],
- );
- }
-
- factory GasRefillDetails.fromDetails(GasRefillDetails details) {
- return GasRefillDetails(
- type: Lookup.fromStatus(details.type),
- cylinderSize: Lookup.fromStatus(details.cylinderSize),
- cylinderType: Lookup.fromStatus(details.cylinderType),
- requestedQuantity: details.requestedQuantity,
- deliveredQuantity: details.deliveredQuantity,
- );
- }
-}
diff --git a/lib/models/gas_refill/gas_refill_model.dart b/lib/models/gas_refill/gas_refill_model.dart
deleted file mode 100644
index cc34dc6a..00000000
--- a/lib/models/gas_refill/gas_refill_model.dart
+++ /dev/null
@@ -1,108 +0,0 @@
-import 'dart:typed_data';
-
-import 'package:test_sa/models/gas_refill/gas_refill_details.dart';
-import 'package:test_sa/models/lookup.dart';
-
-import '../../controllers/api_routes/urls.dart';
-import '../call_request_for_work_order_model.dart';
-
-@Deprecated("Use the new model [lib/models/new_models/gas_refill_model.dart]")
-class GasRefillModel {
- int id;
-
- //String userId;
- String clientName;
- String title;
- Lookup status;
- Lookup building;
- Lookup floor;
- Department department;
- List details;
- AssignedEmployee assignedEmployee;
- String signatureNurse;
- String signatureEngineer;
- Uint8List localNurseSignature;
- Uint8List localEngineerSignature;
- num workingHours;
- DateTime startDate, endDate, expectedDate;
-
- GasRefillModel({
- this.id,
- //this.userId,
- this.clientName,
- this.title,
- this.status,
- this.details,
- this.building,
- this.floor,
- this.startDate,
- this.endDate,
- this.expectedDate,
- this.department,
- this.assignedEmployee,
- this.signatureNurse,
- this.signatureEngineer,
- this.localEngineerSignature,
- this.localNurseSignature,
- this.workingHours,
- });
-
- bool validate() {
- if (title == null) return false;
- if (status == null) return false;
- // if (building == null) return false;
- // if (floor == null) return false;
- // if (department == null) return false;
- // if (startDate == null) return false;
- // if (endDate == null) return false;
- if (details == null && details.isEmpty) return false;
- return true;
- }
-
- fromGasRefillModel(GasRefillModel model) {
- id = model.id;
- //userId = model.userId;
- clientName = model.clientName;
- title = model.title;
- status = Lookup.fromStatus(model.status);
- details = model.details.map((e) => GasRefillDetails.fromDetails(e)).toList();
- building = model.building;
- floor = model.floor;
- department = model.department;
- startDate = model.startDate;
- endDate = model.endDate;
- expectedDate = model.expectedDate;
- assignedEmployee = model.assignedEmployee;
- localEngineerSignature = model.localEngineerSignature;
- localNurseSignature = model.localNurseSignature;
- signatureEngineer = model.signatureEngineer;
- signatureNurse = model.signatureNurse;
- workingHours = model.workingHours;
- }
-
- factory GasRefillModel.fromJson(Map parsedJson) {
- List details = [];
- if (parsedJson["gazRefillDetails"] != null) {
- List list = parsedJson["gazRefillDetails"];
- details = list.map((e) => GasRefillDetails.fromJson(e)).toList();
- }
- return GasRefillModel(
- id: parsedJson["id"],
- //userId: parsedJson["uid"],
- title: parsedJson["gazRefillNo"],
- clientName: parsedJson["site"] == null ? null : parsedJson["site"]["custName"],
- status: Lookup.fromJson(parsedJson["status"] ?? {}),
- details: details,
- building: Lookup.fromJson(parsedJson["building"] ?? {}),
- floor: Lookup.fromJson(parsedJson["floor"] ?? {}),
- department: Department.fromJson(parsedJson["department"] ?? {}),
- startDate: DateTime.tryParse(parsedJson['startDate'] ?? ""),
- endDate: DateTime.tryParse(parsedJson['endDate'] ?? ""),
- expectedDate: DateTime.tryParse(parsedJson['expectedDate'] ?? ""),
- assignedEmployee: AssignedEmployee.fromJson(parsedJson['assignedEmployee'] ?? {}),
- signatureEngineer: URLs.getFileUrl(parsedJson["engSignature"]),
- signatureNurse: URLs.getFileUrl(parsedJson["nurseSignature"]),
- workingHours: parsedJson["workingHours"],
- );
- }
-}
diff --git a/lib/models/new_models/assistant_employee.dart b/lib/models/new_models/assistant_employee.dart
new file mode 100644
index 00000000..9a351b2f
--- /dev/null
+++ b/lib/models/new_models/assistant_employee.dart
@@ -0,0 +1,31 @@
+import 'package:test_sa/models/new_models/assigned_employee.dart';
+
+class AssistantEmployees {
+ AssistantEmployees({
+ this.id,
+ this.user,
+ });
+
+ AssistantEmployees.fromJson(dynamic json) {
+ id = json['id'];
+ user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null;
+ }
+ num id;
+ AssignedEmployee user;
+ AssistantEmployees copyWith({
+ num id,
+ AssignedEmployee user,
+ }) =>
+ AssistantEmployees(
+ id: id ?? this.id,
+ user: user ?? this.user,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ if (user != null) {
+ map['user'] = user.toJson();
+ }
+ return map;
+ }
+}
diff --git a/lib/models/part.dart b/lib/models/part.dart
deleted file mode 100644
index 9f8b0cad..00000000
--- a/lib/models/part.dart
+++ /dev/null
@@ -1,40 +0,0 @@
-class Part {
- int id;
- int reportPartID;
- String partNo;
- String partName;
- int quantity;
- double returnQty, installQty;
-
- Part({
- this.id,
- this.reportPartID,
- this.partNo,
- this.partName,
- this.quantity = 1,
- this.installQty,
- this.returnQty,
- });
-
- Map toJson() {
- return {
- "id": reportPartID ?? 0,
- "sparePart": {"id": id, "partNo": partNo, "partName": partName},
- "qty": quantity,
- if (returnQty != null) "returnQty": returnQty,
- if (installQty != null) "installQty": installQty,
- };
- }
-
- factory Part.fromJson(Map parsedJson, {Map reportJson}) {
- return Part(
- id: parsedJson["id"],
- reportPartID: reportJson != null ? reportJson["id"] : null,
- partNo: parsedJson["partNo"],
- partName: parsedJson["partName"],
- quantity: reportJson != null ? (reportJson["qty"] ?? 1).toInt() : 1,
- returnQty: parsedJson["returnQty"],
- installQty: parsedJson["installQty"],
- );
- }
-}
diff --git a/lib/models/service_report.dart b/lib/models/service_report.dart
deleted file mode 100644
index 0b128d81..00000000
--- a/lib/models/service_report.dart
+++ /dev/null
@@ -1,250 +0,0 @@
-import 'dart:typed_data';
-
-import 'package:fluttertoast/fluttertoast.dart';
-import 'package:test_sa/controllers/api_routes/urls.dart';
-import 'package:test_sa/models/device/asset.dart';
-import 'package:test_sa/models/engineer.dart';
-import 'package:test_sa/models/fault_description.dart';
-import 'package:test_sa/models/lookup.dart';
-import 'package:test_sa/models/part.dart';
-import 'package:test_sa/models/service_request/service_request.dart';
-import 'package:test_sa/models/timer_model.dart';
-
-class ServiceReport {
- int id;
- double operatingHours;
- DateTime visitDate;
- DateTime returnToService;
-
- // DateTime endDate;
- // DateTime startDate;
- Lookup assetType;
- Lookup callLastSituation;
- Lookup currentSituation;
- Lookup repairLocation;
- Engineer engineer;
- Lookup equipmentStatus;
- Lookup type;
- Lookup reason;
- int faultDescriptionId;
- String workPreformed;
-
- num workingHours;
- double travelingHours;
- String invoiceNumber;
- String invoiceCode;
- List parts;
- List files;
- Asset device;
- String quantity;
- String jobSheetNumber;
- TimerModel timer;
- String signatureNurse;
- String signatureEngineer;
- String comment;
- Uint8List localNurseSignature;
- Uint8List localEngineerSignature;
- num travelingExpense;
- String reviewComment;
- FaultDescription faultDescription;
-
- ServiceReport(
- {this.id,
- this.visitDate,
- // this.endDate,
- this.assetType,
- this.equipmentStatus,
- this.type,
- this.faultDescriptionId,
- this.workingHours,
- this.travelingHours,
- this.parts,
- this.engineer,
- this.workPreformed,
- this.reason,
- this.operatingHours,
- this.callLastSituation,
- this.currentSituation,
- this.jobSheetNumber,
- this.files,
- this.device,
- this.invoiceCode,
- this.invoiceNumber,
- this.quantity = "1",
- this.timer,
- this.signatureNurse,
- this.signatureEngineer,
- this.localNurseSignature,
- this.localEngineerSignature,
- this.comment,
- this.repairLocation,
- this.travelingExpense,
- // this.startDate,
- this.reviewComment,
- this.faultDescription,
- this.returnToService});
-
- Map toMap(ServiceRequest request) {
- Map _map = {};
- if (id != null) _map["id"] = id;
- if (visitDate != null) _map["visitDate"] = visitDate.toIso8601String();
- if (returnToService != null) _map["replacementDate"] = returnToService.toIso8601String();
-
- //if(serviceType != null) _map["service_type"] = serviceType.id.toString();
- if (equipmentStatus != null) _map["equipmentStatus"] = equipmentStatus?.toJson();
- if (type != null) _map["typeOfWO"] = type?.toJson();
- if (assetType != null) _map["TypeOfWO"] = assetType?.toJson();
- //if(faultDescriptionId != null && faultDescriptionId.isNotEmpty) _map["fault_description"] = faultDescriptionId;
- //if(workHours != null && workHours.isNotEmpty) _map["working_hours"] = workHours;
- if (timer != null) {
- _map["startofWorkTime"] = timer.startAt.toIso8601String();
- _map["endofWorkTime"] = (timer.endAt ?? DateTime.now()).toIso8601String();
- _map["workingHours"] = (timer.durationInSecond / 60 / 60).toStringAsFixed(5);
- }
- if (travelingHours != null && travelingHours.toString().isNotEmpty) _map["travelingHours"] = travelingHours;
- // if(workPreformed != null && workPreformed.isNotEmpty){
- // _map["faultDescription"] = {
- // "id":faultDescriptionId ?? 0,
- // "workPerformed":workPreformed
- // };
- // }
- _map["faultDescription"] = faultDescription?.id == null ? null : {"id": faultDescription?.id ?? 0, "workPerformed": faultDescription?.workPerformed};
- if (travelingHours != null) _map["travelingHours"] = travelingHours;
- // if (workingHours != null) _map["workingHours"] = workingHours;
- // if (workPreformed != null && workPreformed.isNotEmpty) {
- // _map["faultDescription"] = faultDescription.toJson();
- // }
- if (jobSheetNumber != null && jobSheetNumber.isNotEmpty) _map["job_sheet_no"] = jobSheetNumber;
- if (parts != null && parts.isNotEmpty) {
- _map["sparePartsWorkOrders"] = parts.map((e) => e.toJson()).toList();
- }
- if (device != null && device.id != null) {
- _map["callRequest"] = {
- "id": request.id,
- // "asset": device?.toJson(assetType),
- "asset": device?.toJson(),
- };
- _map["callRequest"]["asset"]["invoiceNumber"] = invoiceNumber;
- }
- _map["AssignedEmployee"] = engineer?.toMap();
- _map["repairLocation"] = repairLocation?.toJson();
- //if(quantity != null && quantity.isNotEmpty) _map["qty"] = quantity;
- //if(endDate != null) _map["end_date"] = (endDate.millisecondsSinceEpoch ~/ 1000).toString();
- if (reason != null) _map["reason"] = reason.toJson();
- //if(operatingHours != null && operatingHours.isNotEmpty) _map["operation_hours"] = operatingHours;
- if (callLastSituation != null) _map["calllastSituation"] = callLastSituation.toJson();
- if (currentSituation != null) _map["currentSituation"] = currentSituation.toJson();
- //if(image != null) _map["image"] = image;
- //if(invoiceCode != null) _map["invoice_no"] = invoiceCode;
- //if(invoiceNumber != null) _map["invoice_code"] = invoiceNumber;
- if (files != null) {
- _map["attachmentsWorkOrder"] = files.map((e) => {"name": e}).toList();
- }
- _map["nurseSignature"] = signatureNurse;
- _map["engSignature"] = signatureEngineer;
- _map["comment"] = comment;
- _map["travelingExpenses"] = travelingExpense;
- // _map["startofWorkTime"] = startDate.toIso8601String();
- // _map["endofWorkTime"] = endDate.toIso8601String();
- // _map["workingHours"] = endDate?.difference(startDate)?.inHours ?? 0;
- if (timer?.startAt != null) _map["startofWorkTime"] = timer?.startAt?.toIso8601String();
- if (timer?.endAt != null) _map["endofWorkTime"] = timer?.endAt?.toIso8601String();
- _map["workingHours"] = workingHours;
- _map["reviewComment"] = reviewComment;
- return _map;
- }
-
- Future validate() async {
- // if (visitDate == null) {
- // await Fluttertoast.showToast(msg: "Visit Date Required");
- // return false;
- // }
- // if (returnToService == null) {
- // await Fluttertoast.showToast(msg: "Return To Service Date Required");
- // return false;
- // }
- if (timer?.startAt == null) {
- await Fluttertoast.showToast(msg: "Working Hours Required");
- return false;
- }
- if (timer?.endAt == null) {
- await Fluttertoast.showToast(msg: "Please Stop The Timer");
- return false;
- }
- //if(serviceType == null) return false;
- if (equipmentStatus == null) return false;
- //if (type == null && assetType == null) return false;
- // if (engineer == null) return false;
- if (callLastSituation == null) return false;
- if (callLastSituation?.value == 12) {
- // if(invoiceCode != null || invoiceCode?.isEmpty == true) return false;
- if (invoiceNumber != null || invoiceNumber?.isEmpty == true) return false;
- }
- if (parts == null) return false;
- //if(endDate == null) return false;
- if (reason == null) return false;
- //todo uncoment this line
- //if((device?.id == null || device.id.isEmpty) && type?.id != 1) return false;
- //if(quantity == null || quantity.isEmpty) return false;
- //if(image == null) return false;
- return true;
- }
-
- factory ServiceReport.fromJson(Map parsedJson, int id) {
- List _parts = [];
- if (parsedJson["sparePartsWorkOrders"] != null) {
- if ((parsedJson["sparePartsWorkOrders"] as List).isNotEmpty && parsedJson["sparePartsWorkOrders"][0]["id"] != null) {
- List partsList = parsedJson["sparePartsWorkOrders"];
- _parts = partsList.map((e) => Part.fromJson(e["sparePart"], reportJson: e)).toList();
- }
- }
- List _files = [];
- if (parsedJson["attachmentsWorkOrder"] != null && parsedJson["attachmentsWorkOrder"] is List) {
- List list = parsedJson["attachmentsWorkOrder"];
- _files = list.map((e) => (URLs.getFileUrl(e["name"]))).toList();
- }
- return ServiceReport(
- id: id,
- assetType: Lookup.fromJson(parsedJson["assetType"]),
- callLastSituation: Lookup.fromJson(parsedJson["calllastSituation"]),
- currentSituation: Lookup.fromJson(parsedJson["currentSituation"]),
- repairLocation: Lookup.fromJson(parsedJson["repairLocation"]),
- reason: Lookup.fromJson(parsedJson["reason"]),
- equipmentStatus: Lookup.fromJson(parsedJson["equipmentStatus"]),
- type: Lookup.fromJson(parsedJson["typeOfWO"]),
- faultDescription: parsedJson['faultDescription'] != null ? FaultDescription.fromJson(parsedJson['faultDescription']) : null,
- files: _files,
- // faultDescription: parsedJson["faultDescription"],
- // startDate: DateTime.tryParse(parsedJson["startofWorkTime"] ?? ""),
- // endDate: DateTime.tryParse(parsedJson["endofWorkTime"] ?? ""),
- //invoiceCode: parsedJson["invoice_code"],
- //invoiceNumber: parsedJson["invoice_no"],
- //jobSheetNumber: parsedJson["job_sheet_no"],
- // workingHours: parsedJson["workingHours"],
- engineer: Engineer.fromJson(parsedJson["assignedEmployee"]),
- parts: _parts,
- //quantity: parsedJson["nid"],
- travelingHours: parsedJson["travelingHours"],
- travelingExpense: parsedJson["travelingExpenses"],
- visitDate: DateTime.tryParse(parsedJson["visitDate"] ?? ""),
- returnToService: DateTime.tryParse(parsedJson["replacementDate"] ?? ""),
- workingHours: parsedJson["workingHours"],
- timer: TimerModel(
- startAt: DateTime.tryParse(parsedJson["startofWorkTime"] ?? ""),
- endAt: DateTime.tryParse(parsedJson["endofWorkTime"] ?? ""),
- durationInSecond: ((parsedJson["workingHours"] ?? 0) * 60 * 60).toInt(),
- ),
- //workPreformed: parsedJson["work_performed"],
- device: Asset.fromJson(parsedJson["callRequest"]["asset"]),
- signatureNurse: URLs.getFileUrl(parsedJson["nurseSignature"]),
- signatureEngineer: URLs.getFileUrl(parsedJson["engSignature"]),
- comment: parsedJson['comment'],
- reviewComment: parsedJson['reviewComment'],
- );
- }
-
-// static getDate(String date){
-// return date == null || date.isEmpty
-// ? null : DateTime.fromMillisecondsSinceEpoch(int.tryParse(date) * 1000);
-// }
-}
diff --git a/lib/models/service_request/call_site_contact_person.dart b/lib/models/service_request/call_site_contact_person.dart
new file mode 100644
index 00000000..d9246ab2
--- /dev/null
+++ b/lib/models/service_request/call_site_contact_person.dart
@@ -0,0 +1,63 @@
+class CallSiteContactPerson {
+ CallSiteContactPerson({
+ this.id,
+ this.employeeCode,
+ this.name,
+ this.telephone,
+ this.job,
+ this.email,
+ this.land,
+ this.contactUserId,
+ });
+
+ CallSiteContactPerson.fromJson(dynamic json) {
+ id = json['id'];
+ employeeCode = json['employeeCode'];
+ name = json['name'];
+ telephone = json['telephone'];
+ job = json['job'];
+ email = json['email'];
+ land = json['land'];
+ contactUserId = json['contactUserId'];
+ }
+ num id;
+ String employeeCode;
+ String name;
+ String telephone;
+ String job;
+ String email;
+ String land;
+ String contactUserId;
+ CallSiteContactPerson copyWith({
+ num id,
+ String employeeCode,
+ String name,
+ String telephone,
+ String job,
+ String email,
+ String land,
+ String contactUserId,
+ }) =>
+ CallSiteContactPerson(
+ id: id ?? this.id,
+ employeeCode: employeeCode ?? this.employeeCode,
+ name: name ?? this.name,
+ telephone: telephone ?? this.telephone,
+ job: job ?? this.job,
+ email: email ?? this.email,
+ land: land ?? this.land,
+ contactUserId: contactUserId ?? this.contactUserId,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ map['employeeCode'] = employeeCode;
+ map['name'] = name;
+ map['telephone'] = telephone;
+ map['job'] = job;
+ map['email'] = email;
+ map['land'] = land;
+ map['contactUserId'] = contactUserId;
+ return map;
+ }
+}
diff --git a/lib/models/service_request/contact_person_work_order.dart b/lib/models/service_request/contact_person_work_order.dart
new file mode 100644
index 00000000..0fe22b43
--- /dev/null
+++ b/lib/models/service_request/contact_person_work_order.dart
@@ -0,0 +1,63 @@
+class ContactPersonWorkOrder {
+ ContactPersonWorkOrder({
+ this.id,
+ this.employeeCode,
+ this.name,
+ this.telephone,
+ this.job,
+ this.email,
+ this.land,
+ this.contactUserId,
+ });
+
+ ContactPersonWorkOrder.fromJson(dynamic json) {
+ id = json['id'];
+ employeeCode = json['employeeCode'];
+ name = json['name'];
+ telephone = json['telephone'];
+ job = json['job'];
+ email = json['email'];
+ land = json['land'];
+ contactUserId = json['contactUserId'];
+ }
+ num id;
+ String employeeCode;
+ String name;
+ String telephone;
+ String job;
+ String email;
+ String land;
+ String contactUserId;
+ ContactPersonWorkOrder copyWith({
+ num id,
+ String employeeCode,
+ String name,
+ String telephone,
+ String job,
+ String email,
+ String land,
+ String contactUserId,
+ }) =>
+ ContactPersonWorkOrder(
+ id: id ?? this.id,
+ employeeCode: employeeCode ?? this.employeeCode,
+ name: name ?? this.name,
+ telephone: telephone ?? this.telephone,
+ job: job ?? this.job,
+ email: email ?? this.email,
+ land: land ?? this.land,
+ contactUserId: contactUserId ?? this.contactUserId,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ map['employeeCode'] = employeeCode;
+ map['name'] = name;
+ map['telephone'] = telephone;
+ map['job'] = job;
+ map['email'] = email;
+ map['land'] = land;
+ map['contactUserId'] = contactUserId;
+ return map;
+ }
+}
diff --git a/lib/models/service_request/search_work_order.dart b/lib/models/service_request/search_work_order.dart
index 5e85556e..f3b37916 100644
--- a/lib/models/service_request/search_work_order.dart
+++ b/lib/models/service_request/search_work_order.dart
@@ -1,9 +1,17 @@
import 'package:test_sa/models/lookup.dart';
-import 'package:test_sa/models/service_request/sub_work_order_details.dart';
+import 'package:test_sa/models/service_request/service_report.dart';
+import 'package:test_sa/models/service_request/spare_parts.dart';
+import 'package:test_sa/models/service_request/supp_engineer_work_orders.dart';
+import 'package:test_sa/models/service_request/supplier_details.dart';
+import 'package:test_sa/models/service_request/wo_call_request.dart';
+import 'package:test_sa/models/service_request/wo_parent.dart';
import 'package:test_sa/models/timer_model.dart';
-import '../device/asset.dart';
+import '../../attachment.dart';
import '../fault_description.dart';
+import '../new_models/assigned_employee.dart';
+import '../new_models/assistant_employee.dart';
+import 'contact_person_work_order.dart';
class SearchWorkOrder {
SearchWorkOrder({
@@ -60,12 +68,12 @@ class SearchWorkOrder {
assistantEmployees.add(AssistantEmployees.fromJson(v));
});
}
- supplier = json['supplier'] != null ? SupplierModel.fromJson(json['supplier']) : null;
+ supplier = json['supplier'] != null ? SupplierDetails.fromJson(json['supplier']) : null;
vendorTicketNumber = json['vendorTicketNumber'];
if (json['contactPersonWorkOrders'] != null) {
contactPersonWorkOrders = [];
json['contactPersonWorkOrders'].forEach((v) {
- contactPersonWorkOrders.add(ContactPersonWorkOrders.fromJson(v));
+ contactPersonWorkOrders.add(ContactPersonWorkOrder.fromJson(v));
});
}
calllastSituation = json['calllastSituation'] != null ? Lookup.fromJson(json['calllastSituation']) : null;
@@ -94,7 +102,7 @@ class SearchWorkOrder {
if (json['attachmentsWorkOrder'] != null) {
attachmentsWorkOrder = [];
json['attachmentsWorkOrder'].forEach((v) {
- attachmentsWorkOrder.add(AttachmentsWorkOrder.fromJson(v));
+ attachmentsWorkOrder.add(Attachment.fromJson(v));
});
}
equipmentStatus = json['equipmentStatus'] != null ? Lookup.fromJson(json['equipmentStatus']) : null;
@@ -106,7 +114,7 @@ class SearchWorkOrder {
}
engSignature = json['engSignature'];
nurseSignature = json['nurseSignature'];
- woParentDto = json['woParentDto'] != null ? WoParentDto.fromJson(json['woParentDto']) : null;
+ woParentDto = json['woParentDto'] != null ? WoParent.fromJson(json['woParentDto']) : null;
}
void copyFrom(SearchWorkOrder wo) {
@@ -125,9 +133,9 @@ class SearchWorkOrder {
}))
?.toList() ??
[];
- if (wo.supplier != null) supplier = SupplierModel.fromJson((wo.supplier)?.toJson() ?? {});
+ if (wo.supplier != null) supplier = SupplierDetails.fromJson((wo.supplier)?.toJson() ?? {});
vendorTicketNumber = wo.vendorTicketNumber ?? vendorTicketNumber;
- contactPersonWorkOrders = (wo.contactPersonWorkOrders ?? contactPersonWorkOrders)?.map((e) => ContactPersonWorkOrders.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
+ contactPersonWorkOrders = (wo.contactPersonWorkOrders ?? contactPersonWorkOrders)?.map((e) => ContactPersonWorkOrder.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
calllastSituation = Lookup.fromJson((wo.calllastSituation ?? calllastSituation)?.toJson() ?? {});
if (wo.currentSituation != null) currentSituation = Lookup.fromJson((wo.currentSituation)?.toJson() ?? {});
repairLocation = Lookup.fromJson((wo.repairLocation ?? repairLocation)?.toJson() ?? {});
@@ -142,7 +150,7 @@ class SearchWorkOrder {
sparePartsWorkOrders = (wo.sparePartsWorkOrders ?? sparePartsWorkOrders)?.map((e) => SparePartsWorkOrders.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
reviewComment = wo.reviewComment ?? reviewComment;
comment = wo.comment ?? comment;
- attachmentsWorkOrder = (wo.attachmentsWorkOrder ?? attachmentsWorkOrder)?.map((e) => AttachmentsWorkOrder.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
+ attachmentsWorkOrder = (wo.attachmentsWorkOrder ?? attachmentsWorkOrder)?.map((e) => Attachment.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
equipmentStatus = Lookup.fromJson((wo.equipmentStatus ?? equipmentStatus)?.toJson() ?? {});
suppEngineerWorkOrders = (wo.suppEngineerWorkOrders ?? suppEngineerWorkOrders)?.map((e) => SuppEngineerWorkOrders.fromJson(e?.toJson() ?? {}))?.toList() ?? [];
engSignature = wo.engSignature ?? engSignature;
@@ -161,9 +169,9 @@ class SearchWorkOrder {
AssignedEmployee assignedEmployee;
String visitDate;
List assistantEmployees;
- SupplierModel supplier;
+ SupplierDetails supplier;
String vendorTicketNumber;
- List contactPersonWorkOrders;
+ List contactPersonWorkOrders;
Lookup calllastSituation;
Lookup currentSituation;
Lookup repairLocation;
@@ -177,12 +185,12 @@ class SearchWorkOrder {
List sparePartsWorkOrders;
String reviewComment;
String comment;
- List attachmentsWorkOrder;
+ List attachmentsWorkOrder;
Lookup equipmentStatus;
List suppEngineerWorkOrders;
String engSignature;
String nurseSignature;
- WoParentDto woParentDto;
+ WoParent woParentDto;
TimerModel timer;
String mrNumber;
@@ -197,9 +205,9 @@ class SearchWorkOrder {
AssignedEmployee assignedEmployee,
String visitDate,
List assistantEmployees,
- SupplierModel supplier,
+ SupplierDetails supplier,
String vendorTicketNumber,
- List contactPersonWorkOrders,
+ List contactPersonWorkOrders,
Lookup calllastSituation,
Lookup currentSituation,
Lookup repairLocation,
@@ -213,12 +221,12 @@ class SearchWorkOrder {
List sparePartsWorkOrders,
String reviewComment,
String comment,
- List attachmentsWorkOrder,
+ List attachmentsWorkOrder,
Lookup equipmentStatus,
List suppEngineerWorkOrders,
String engSignature,
String nurseSignature,
- WoParentDto woParentDto,
+ WoParent woParentDto,
TimerModel timer,
String mrNumber,
}) =>
@@ -332,7 +340,7 @@ class SearchWorkOrder {
return map;
}
- void copyDetails(SubWorkOrderDetails subWoDetails) {
+ void copyDetails(ServiceReport subWoDetails) {
equipmentStatus = subWoDetails.equipmentStatus;
reason = subWoDetails.reason;
faultDescription = subWoDetails.faultDescription;
@@ -341,2272 +349,3 @@ class SearchWorkOrder {
supplier = subWoDetails.supplier;
}
}
-
-class WoParentDto {
- WoParentDto({
- this.callLastSituation,
- this.supplier,
- this.assetType,
- this.vendorTicketNumber,
- this.callId,
- this.id,
- this.stepsWorkOrderDto,
- this.suppEngineerWorkOrders,
- this.equipmentStatus,
- this.currentSituation,
- });
-
- WoParentDto.fromJson(dynamic json) {
- callLastSituation = json['callLastSituation'] != null ? Lookup.fromJson(json['callLastSituation']) : null;
- supplier = json['supplier'] != null ? SupplierModel.fromJson(json['supplier']) : null;
- assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
- vendorTicketNumber = json['vendorTicketNumber'];
- callId = json['callId'];
- id = json['id'];
- stepsWorkOrderDto = json['stepsWorkOrderDto'] != null ? StepsWorkOrderDto.fromJson(json['stepsWorkOrderDto']) : null;
- if (json['suppEngineerWorkOrders'] != null) {
- suppEngineerWorkOrders = [];
- json['suppEngineerWorkOrders'].forEach((v) {
- suppEngineerWorkOrders.add(SuppEngineerWorkOrders.fromJson(v));
- });
- }
- equipmentStatus = json['equipmentStatus'] != null ? Lookup.fromJson(json['equipmentStatus']) : null;
- currentSituation = json['currentSituation'] != null ? Lookup.fromJson(json['currentSituation']) : null;
- }
-
- Lookup callLastSituation;
- SupplierModel supplier;
- Lookup assetType;
- String vendorTicketNumber;
- num callId;
- num id;
- StepsWorkOrderDto stepsWorkOrderDto;
- List suppEngineerWorkOrders;
- Lookup equipmentStatus;
- Lookup currentSituation;
-
- WoParentDto copyWith({
- Lookup callLastSituation,
- SupplierModel supplier,
- Lookup assetType,
- String vendorTicketNumber,
- num callId,
- num id,
- StepsWorkOrderDto stepsWorkOrderDto,
- List suppEngineerWorkOrders,
- Lookup equipmentStatus,
- Lookup currentSituation,
- }) =>
- WoParentDto(
- callLastSituation: callLastSituation ?? this.callLastSituation,
- supplier: supplier ?? this.supplier,
- assetType: assetType ?? this.assetType,
- vendorTicketNumber: vendorTicketNumber ?? this.vendorTicketNumber,
- callId: callId ?? this.callId,
- id: id ?? this.id,
- stepsWorkOrderDto: stepsWorkOrderDto ?? this.stepsWorkOrderDto,
- suppEngineerWorkOrders: suppEngineerWorkOrders ?? this.suppEngineerWorkOrders,
- equipmentStatus: equipmentStatus ?? this.equipmentStatus,
- currentSituation: currentSituation ?? this.currentSituation,
- );
-
- Map toJson() {
- final map = {};
- if (callLastSituation != null) {
- map['callLastSituation'] = callLastSituation.toJson();
- }
- if (supplier != null) {
- map['supplier'] = supplier.toJson();
- }
- if (assetType != null) {
- map['assetType'] = assetType.toJson();
- }
- map['vendorTicketNumber'] = vendorTicketNumber;
- map['callId'] = callId ?? 0;
- map['id'] = id ?? 0;
- if (stepsWorkOrderDto != null) {
- map['stepsWorkOrderDto'] = stepsWorkOrderDto.toJson();
- }
- if (suppEngineerWorkOrders != null) {
- map['suppEngineerWorkOrders'] = suppEngineerWorkOrders.map((v) => v.toJson()).toList();
- }
- if (equipmentStatus != null) {
- map['equipmentStatus'] = equipmentStatus.toJson();
- }
- if (currentSituation != null) {
- map['currentSituation'] = currentSituation.toJson();
- }
- return map;
- }
-}
-
-class SuppEngineerWorkOrders {
- SuppEngineerWorkOrders({
- this.id,
- this.supplierContactId,
- this.personName,
- this.personRoleName,
- this.contact,
- this.externalEngCode,
- this.email,
- });
-
- SuppEngineerWorkOrders.fromJson(dynamic json) {
- id = json['id'];
- supplierContactId = json['supplierContactId'];
- personName = json['personName'];
- personRoleName = json['personRoleName'];
- contact = json['contact'];
- externalEngCode = json['externalEngCode'];
- email = json['email'];
- }
-
- num id;
- num supplierContactId;
- String personName;
- String personRoleName;
- String contact;
- String externalEngCode;
- String email;
-
- SuppEngineerWorkOrders copyWith({
- num id,
- num supplierContactId,
- String personName,
- String personRoleName,
- String contact,
- String externalEngCode,
- String email,
- }) =>
- SuppEngineerWorkOrders(
- id: id ?? this.id,
- supplierContactId: supplierContactId ?? this.supplierContactId,
- personName: personName ?? this.personName,
- personRoleName: personRoleName ?? this.personRoleName,
- contact: contact ?? this.contact,
- externalEngCode: externalEngCode ?? this.externalEngCode,
- email: email ?? this.email,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierContactId'] = supplierContactId;
- map['personName'] = personName;
- map['personRoleName'] = personRoleName;
- map['contact'] = contact;
- map['externalEngCode'] = externalEngCode;
- map['email'] = email;
- return map;
- }
-}
-
-class StepsWorkOrderDto {
- StepsWorkOrderDto({
- this.sequence,
- this.id,
- this.name,
- this.statusValue,
- this.typeTransaction,
- this.processed,
- this.parentWOId,
- this.callId,
- });
-
- StepsWorkOrderDto.fromJson(dynamic json) {
- sequence = json['sequence'];
- id = json['id'];
- name = json['name'];
- statusValue = json['statusValue'];
- typeTransaction = json['typeTransaction'];
- processed = json['processed'];
- parentWOId = json['parentWOId'];
- callId = json['callId'];
- }
-
- num sequence;
- num id;
- String name;
- num statusValue;
- String typeTransaction;
- bool processed;
- num parentWOId;
- num callId;
-
- StepsWorkOrderDto copyWith({
- num sequence,
- num id,
- String name,
- num statusValue,
- String typeTransaction,
- bool processed,
- num parentWOId,
- num callId,
- }) =>
- StepsWorkOrderDto(
- sequence: sequence ?? this.sequence,
- id: id ?? this.id,
- name: name ?? this.name,
- statusValue: statusValue ?? this.statusValue,
- typeTransaction: typeTransaction ?? this.typeTransaction,
- processed: processed ?? this.processed,
- parentWOId: parentWOId ?? this.parentWOId,
- callId: callId ?? this.callId,
- );
-
- Map toJson() {
- final map = {};
- map['sequence'] = sequence;
- map['id'] = id ?? 0;
- map['name'] = name;
- map['statusValue'] = statusValue;
- map['typeTransaction'] = typeTransaction;
- map['processed'] = processed;
- map['parentWOId'] = parentWOId;
- map['callId'] = callId;
- return map;
- }
-}
-
-class SupplierModel {
- SupplierModel({
- this.id,
- this.suppliername,
- this.name,
- this.website,
- this.email,
- this.code,
- this.suppNo,
- this.suppStatusId,
- this.cityId,
- this.person,
- this.comment,
- this.zipcode,
- this.contact,
- this.telephones,
- this.faxes,
- this.addresses,
- this.attachments,
- this.suppPersons,
- this.suppTCodes,
- });
-
- SupplierModel.fromJson(dynamic json) {
- id = json['id'] ?? 0;
- suppliername = json['suppliername'];
- name = json['name'];
- website = json['website'];
- email = json['email'];
- code = json['code'];
- suppNo = json['suppNo'];
- suppStatusId = json['suppStatusId'];
- cityId = json['cityId'];
- person = json['person'];
- comment = json['comment'];
- zipcode = json['zipcode'];
- contact = json['contact'];
- if (json['telephones'] != null) {
- telephones = [];
- json['telephones'].forEach((v) {
- telephones.add(Telephones.fromJson(v));
- });
- }
- if (json['faxes'] != null) {
- faxes = [];
- json['faxes'].forEach((v) {
- faxes.add(Faxes.fromJson(v));
- });
- }
- if (json['addresses'] != null) {
- addresses = [];
- json['addresses'].forEach((v) {
- addresses.add(Addresses.fromJson(v));
- });
- }
- if (json['attachments'] != null) {
- attachments = [];
- json['attachments'].forEach((v) {
- attachments.add(Attachments.fromJson(v));
- });
- }
- if (json['suppPersons'] != null) {
- suppPersons = [];
- json['suppPersons'].forEach((v) {
- suppPersons.add(SuppPersons.fromJson(v));
- });
- }
- if (json['suppTCodes'] != null) {
- suppTCodes = [];
- json['suppTCodes'].forEach((v) {
- suppTCodes.add(SuppTCodes.fromJson(v));
- });
- }
- }
-
- num id;
- String suppliername;
- String name;
- String website;
- String email;
- String code;
- num suppNo;
- num suppStatusId;
- num cityId;
- String person;
- String comment;
- num zipcode;
- String contact;
- List telephones;
- List faxes;
- List addresses;
- List attachments;
- List suppPersons;
- List suppTCodes;
-
- SupplierModel copyWith({
- num id,
- String suppliername,
- String name,
- String website,
- String email,
- String code,
- num suppNo,
- num suppStatusId,
- num cityId,
- String person,
- String comment,
- num zipcode,
- String contact,
- List telephones,
- List faxes,
- List addresses,
- List attachments,
- List suppPersons,
- List suppTCodes,
- }) =>
- SupplierModel(
- id: id ?? this.id ?? 0,
- suppliername: suppliername ?? this.suppliername,
- name: name ?? this.name,
- website: website ?? this.website,
- email: email ?? this.email,
- code: code ?? this.code,
- suppNo: suppNo ?? this.suppNo,
- suppStatusId: suppStatusId ?? this.suppStatusId,
- cityId: cityId ?? this.cityId,
- person: person ?? this.person,
- comment: comment ?? this.comment,
- zipcode: zipcode ?? this.zipcode,
- contact: contact ?? this.contact,
- telephones: telephones ?? this.telephones,
- faxes: faxes ?? this.faxes,
- addresses: addresses ?? this.addresses,
- attachments: attachments ?? this.attachments,
- suppPersons: suppPersons ?? this.suppPersons,
- suppTCodes: suppTCodes ?? this.suppTCodes,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['suppliername'] = suppliername;
- map['name'] = name;
- map['website'] = website;
- map['email'] = email;
- map['code'] = code;
- map['suppNo'] = suppNo;
- map['suppStatusId'] = suppStatusId;
- map['cityId'] = cityId;
- map['person'] = person;
- map['comment'] = comment;
- map['zipcode'] = zipcode;
- map['contact'] = contact;
- if (telephones != null) {
- map['telephones'] = telephones.map((v) => v.toJson()).toList();
- }
- if (faxes != null) {
- map['faxes'] = faxes.map((v) => v.toJson()).toList();
- }
- if (addresses != null) {
- map['addresses'] = addresses.map((v) => v.toJson()).toList();
- }
- if (attachments != null) {
- map['attachments'] = attachments.map((v) => v.toJson()).toList();
- }
- if (suppPersons != null) {
- map['suppPersons'] = suppPersons.map((v) => v.toJson()).toList();
- }
- if (suppTCodes != null) {
- map['suppTCodes'] = suppTCodes.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class SuppTCodes {
- SuppTCodes({
- this.id,
- this.supplierId,
- this.codeTypeId,
- this.codeValue,
- });
-
- SuppTCodes.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- codeTypeId = json['codeTypeId'];
- codeValue = json['codeValue'];
- }
-
- num id;
- num supplierId;
- num codeTypeId;
- String codeValue;
-
- SuppTCodes copyWith({
- num id,
- num supplierId,
- num codeTypeId,
- String codeValue,
- }) =>
- SuppTCodes(
- id: id ?? this.id ?? 0,
- supplierId: supplierId ?? this.supplierId,
- codeTypeId: codeTypeId ?? this.codeTypeId,
- codeValue: codeValue ?? this.codeValue,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['codeTypeId'] = codeTypeId;
- map['codeValue'] = codeValue;
- return map;
- }
-}
-
-class SuppPersons {
- SuppPersons({
- this.id,
- this.supplierId,
- this.personName,
- this.personRoleId,
- this.contact,
- this.externalEngCode,
- this.email,
- });
-
- SuppPersons.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- personName = json['personName'];
- personRoleId = json['personRoleId'];
- contact = json['contact'];
- externalEngCode = json['externalEngCode'];
- email = json['email'];
- }
-
- num id;
- num supplierId;
- String personName;
- num personRoleId;
- String contact;
- String externalEngCode;
- String email;
-
- SuppPersons copyWith({
- num id,
- num supplierId,
- String personName,
- num personRoleId,
- String contact,
- String externalEngCode,
- String email,
- }) =>
- SuppPersons(
- id: id ?? this.id,
- supplierId: supplierId ?? this.supplierId,
- personName: personName ?? this.personName,
- personRoleId: personRoleId ?? this.personRoleId,
- contact: contact ?? this.contact,
- externalEngCode: externalEngCode ?? this.externalEngCode,
- email: email ?? this.email,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['personName'] = personName;
- map['personRoleId'] = personRoleId;
- map['contact'] = contact;
- map['externalEngCode'] = externalEngCode;
- map['email'] = email;
- return map;
- }
-}
-
-class Attachments {
- Attachments({
- this.id,
- this.supplierId,
- this.attachmentName,
- this.attachmentURL,
- });
-
- Attachments.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- attachmentName = json['attachmentName'];
- attachmentURL = json['attachmentURL'];
- }
-
- num id;
- num supplierId;
- String attachmentName;
- String attachmentURL;
-
- Attachments copyWith({
- num id,
- num supplierId,
- String attachmentName,
- String attachmentURL,
- }) =>
- Attachments(
- id: id ?? this.id,
- supplierId: supplierId ?? this.supplierId,
- attachmentName: attachmentName ?? this.attachmentName,
- attachmentURL: attachmentURL ?? this.attachmentURL,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['attachmentName'] = attachmentName;
- map['attachmentURL'] = attachmentURL;
- return map;
- }
-}
-
-class Addresses {
- Addresses({
- this.id,
- this.supplierId,
- this.address,
- });
-
- Addresses.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- address = json['address'];
- }
-
- num id;
- num supplierId;
- String address;
-
- Addresses copyWith({
- num id,
- num supplierId,
- String address,
- }) =>
- Addresses(
- id: id ?? this.id,
- supplierId: supplierId ?? this.supplierId,
- address: address ?? this.address,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['address'] = address;
- return map;
- }
-}
-
-class Faxes {
- Faxes({
- this.id,
- this.supplierId,
- this.fax,
- });
-
- Faxes.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- fax = json['fax'];
- }
-
- num id;
- num supplierId;
- String fax;
-
- Faxes copyWith({
- num id,
- num supplierId,
- String fax,
- }) =>
- Faxes(
- id: id ?? this.id,
- supplierId: supplierId ?? this.supplierId,
- fax: fax ?? this.fax,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['fax'] = fax;
- return map;
- }
-}
-
-class Telephones {
- Telephones({
- this.id,
- this.supplierId,
- this.telephone,
- });
-
- Telephones.fromJson(dynamic json) {
- id = json['id'];
- supplierId = json['supplierId'];
- telephone = json['telephone'];
- }
-
- num id;
- num supplierId;
- String telephone;
-
- Telephones copyWith({
- num id,
- num supplierId,
- String telephone,
- }) =>
- Telephones(
- id: id ?? this.id,
- supplierId: supplierId ?? this.supplierId,
- telephone: telephone ?? this.telephone,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['supplierId'] = supplierId;
- map['telephone'] = telephone;
- return map;
- }
-}
-
-class AttachmentsWorkOrder {
- AttachmentsWorkOrder({
- this.id,
- this.name,
- });
-
- AttachmentsWorkOrder.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- }
-
- num id;
- String name;
-
- AttachmentsWorkOrder copyWith({
- num id,
- String name,
- }) =>
- AttachmentsWorkOrder(
- id: id ?? this.id,
- name: name ?? this.name,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- return map;
- }
-}
-
-class SparePartsWorkOrders {
- SparePartsWorkOrders({
- this.id,
- this.sparePart,
- this.qty,
- this.returnQty,
- this.installQty,
- });
-
- SparePartsWorkOrders.fromJson(dynamic json) {
- id = json['id'];
- sparePart = json['sparePart'] != null ? SparePart.fromJson(json['sparePart']) : null;
- qty = json['qty'];
- returnQty = json['returnQty'];
- installQty = json['installQty'];
- }
-
- num id;
- SparePart sparePart;
- num qty;
- num returnQty;
- num installQty;
-
- SparePartsWorkOrders copyWith({
- num id,
- SparePart sparePart,
- num qty,
- num returnQty,
- num installQty,
- }) =>
- SparePartsWorkOrders(
- id: id ?? this.id,
- sparePart: sparePart ?? this.sparePart,
- qty: qty ?? this.qty,
- returnQty: returnQty ?? this.returnQty,
- installQty: installQty ?? this.installQty,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- if (sparePart != null) {
- map['sparePart'] = sparePart.toJson();
- }
- map['qty'] = qty;
- map['returnQty'] = returnQty;
- map['installQty'] = installQty;
- return map;
- }
-}
-
-class SparePart {
- SparePart({
- this.id,
- this.partNo,
- this.partName,
- });
-
- SparePart.fromJson(dynamic json) {
- id = json['id'];
- partNo = json['partNo'];
- partName = json['partName'];
- }
-
- num id;
- String partNo;
- String partName;
-
- SparePart copyWith({
- num id,
- String partNo,
- String partName,
- }) =>
- SparePart(
- id: id ?? this.id,
- partNo: partNo ?? this.partNo,
- partName: partName ?? this.partName,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['partNo'] = partNo;
- map['partName'] = partName;
- return map;
- }
-}
-
-class ContactPersonWorkOrders {
- ContactPersonWorkOrders({
- this.id,
- this.employeeCode,
- this.name,
- this.telephone,
- this.job,
- this.email,
- this.land,
- this.contactUserId,
- });
-
- ContactPersonWorkOrders.fromJson(dynamic json) {
- id = json['id'];
- employeeCode = json['employeeCode'];
- name = json['name'];
- telephone = json['telephone'];
- job = json['job'];
- email = json['email'];
- land = json['land'];
- contactUserId = json['contactUserId'];
- }
-
- num id;
- String employeeCode;
- String name;
- String telephone;
- String job;
- String email;
- String land;
- String contactUserId;
-
- ContactPersonWorkOrders copyWith({
- num id,
- String employeeCode,
- String name,
- String telephone,
- String job,
- String email,
- String land,
- String contactUserId,
- }) =>
- ContactPersonWorkOrders(
- id: id ?? this.id,
- employeeCode: employeeCode ?? this.employeeCode,
- name: name ?? this.name,
- telephone: telephone ?? this.telephone,
- job: job ?? this.job,
- email: email ?? this.email,
- land: land ?? this.land,
- contactUserId: contactUserId ?? this.contactUserId,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['employeeCode'] = employeeCode;
- map['name'] = name;
- map['telephone'] = telephone;
- map['job'] = job;
- map['email'] = email;
- map['land'] = land;
- map['contactUserId'] = contactUserId;
- return map;
- }
-}
-
-class AssistantEmployees {
- AssistantEmployees({
- this.id,
- this.user,
- });
-
- AssistantEmployees.fromJson(dynamic json) {
- id = json['id'];
- user = json['user'] != null ? UserModel.fromJson(json['user']) : UserModel(name: json['userName'], id: json['userId']);
- }
-
- num id;
- UserModel user;
-
- AssistantEmployees copyWith({
- num id,
- UserModel user,
- }) =>
- AssistantEmployees(
- id: id ?? this.id,
- user: user ?? this.user,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- if (user != null) {
- map['user'] = user.toJson();
- }
- return map;
- }
-}
-
-class UserModel {
- UserModel({
- this.id,
- this.name,
- });
-
- UserModel.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- }
-
- String id;
- String name;
-
- UserModel copyWith({
- String id,
- String name,
- }) =>
- UserModel(
- id: id ?? this.id,
- name: name ?? this.name,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- return map;
- }
-}
-
-class AssignedEmployee {
- AssignedEmployee({
- this.id,
- this.name,
- });
-
- AssignedEmployee.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- }
-
- String id;
- String name;
-
- AssignedEmployee copyWith({
- String id,
- String name,
- }) =>
- AssignedEmployee(
- id: id ?? this.id,
- name: name ?? this.name,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- return map;
- }
-}
-
-class CallRequest {
- CallRequest({
- this.id,
- this.callNo,
- this.callComments,
- this.asset,
- this.assignedEmployee,
- this.callSiteContactPerson,
- this.status,
- this.callLastSituation,
- this.defectType,
- this.firstAction,
- this.assetType,
- });
-
- CallRequest.fromJson(dynamic json) {
- id = json['id'];
- callNo = json['callNo'];
- callComments = json['callComments'];
- asset = json['asset'] != null ? Asset.fromJson(json['asset']) : null;
- assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
- if (json['callSiteContactPerson'] != null) {
- callSiteContactPerson = [];
- json['callSiteContactPerson'].forEach((v) {
- callSiteContactPerson.add(CallSiteContactPerson.fromJson(v));
- });
- }
- status = json['status'] != null ? Status.fromJson(json['status']) : null;
- callLastSituation = json['callLastSituation'] != null ? Lookup.fromJson(json['callLastSituation']) : null;
- defectType = json['defectType'] != null ? DefectType.fromJson(json['defectType']) : null;
- firstAction = json['firstAction'] != null ? FirstAction.fromJson(json['firstAction']) : null;
- assetType = json['assetType'];
- }
-
- num id;
- String callNo;
- String callComments;
- Asset asset;
- AssignedEmployee assignedEmployee;
- List callSiteContactPerson;
- Status status;
- Lookup callLastSituation;
- DefectType defectType;
- FirstAction firstAction;
- num assetType;
-
- CallRequest copyWith({
- num id,
- String callNo,
- String callComments,
- Asset asset,
- AssignedEmployee assignedEmployee,
- List callSiteContactPerson,
- Status status,
- Lookup callLastSituation,
- DefectType defectType,
- FirstAction firstAction,
- num assetType,
- }) =>
- CallRequest(
- id: id ?? this.id,
- callNo: callNo ?? this.callNo,
- callComments: callComments ?? this.callComments,
- asset: asset ?? this.asset,
- assignedEmployee: assignedEmployee ?? this.assignedEmployee,
- callSiteContactPerson: callSiteContactPerson ?? this.callSiteContactPerson,
- status: status ?? this.status,
- callLastSituation: callLastSituation ?? this.callLastSituation,
- defectType: defectType ?? this.defectType,
- firstAction: firstAction ?? this.firstAction,
- assetType: assetType ?? this.assetType,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['callNo'] = callNo;
- map['callComments'] = callComments;
- if (asset != null) {
- map['asset'] = asset.toJson();
- }
- if (assignedEmployee != null) {
- map['assignedEmployee'] = assignedEmployee.toJson();
- }
- if (callSiteContactPerson != null) {
- map['callSiteContactPerson'] = callSiteContactPerson.map((v) => v.toJson()).toList();
- }
- if (status != null) {
- map['status'] = status.toJson();
- }
- if (callLastSituation != null) {
- map['callLastSituation'] = callLastSituation.toJson();
- }
- if (defectType != null) {
- map['defectType'] = defectType.toJson();
- }
- if (firstAction != null) {
- map['firstAction'] = firstAction.toJson();
- }
- map['assetType'] = assetType;
- return map;
- }
-}
-
-class FirstAction {
- FirstAction({
- this.id,
- this.name,
- this.value,
- });
-
- FirstAction.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- FirstAction copyWith({
- num id,
- String name,
- num value,
- }) =>
- FirstAction(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class DefectType {
- DefectType({
- this.id,
- this.name,
- this.value,
- });
-
- DefectType.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- DefectType copyWith({
- num id,
- String name,
- num value,
- }) =>
- DefectType(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class Status {
- Status({
- this.id,
- this.name,
- this.value,
- });
-
- Status.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- Status copyWith({
- num id,
- String name,
- num value,
- }) =>
- Status(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class CallSiteContactPerson {
- CallSiteContactPerson({
- this.id,
- this.employeeCode,
- this.name,
- this.telephone,
- this.job,
- this.email,
- this.land,
- this.contactUserId,
- });
-
- CallSiteContactPerson.fromJson(dynamic json) {
- id = json['id'];
- employeeCode = json['employeeCode'];
- name = json['name'];
- telephone = json['telephone'];
- job = json['job'];
- email = json['email'];
- land = json['land'];
- contactUserId = json['contactUserId'];
- }
-
- num id;
- String employeeCode;
- String name;
- String telephone;
- String job;
- String email;
- String land;
- String contactUserId;
-
- CallSiteContactPerson copyWith({
- num id,
- String employeeCode,
- String name,
- String telephone,
- String job,
- String email,
- String land,
- String contactUserId,
- }) =>
- CallSiteContactPerson(
- id: id ?? this.id,
- employeeCode: employeeCode ?? this.employeeCode,
- name: name ?? this.name,
- telephone: telephone ?? this.telephone,
- job: job ?? this.job,
- email: email ?? this.email,
- land: land ?? this.land,
- contactUserId: contactUserId ?? this.contactUserId,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['employeeCode'] = employeeCode;
- map['name'] = name;
- map['telephone'] = telephone;
- map['job'] = job;
- map['email'] = email;
- map['land'] = land;
- map['contactUserId'] = contactUserId;
- return map;
- }
-}
-
-class TechnicalGuidanceBooks {
- TechnicalGuidanceBooks({
- this.id,
- this.guidanceBook,
- });
-
- TechnicalGuidanceBooks.fromJson(dynamic json) {
- id = json['id'];
- guidanceBook = json['guidanceBook'] != null ? GuidanceBook.fromJson(json['guidanceBook']) : null;
- }
-
- num id;
- GuidanceBook guidanceBook;
-
- TechnicalGuidanceBooks copyWith({
- num id,
- GuidanceBook guidanceBook,
- }) =>
- TechnicalGuidanceBooks(
- id: id ?? this.id,
- guidanceBook: guidanceBook ?? this.guidanceBook,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- if (guidanceBook != null) {
- map['guidanceBook'] = guidanceBook.toJson();
- }
- return map;
- }
-}
-
-class GuidanceBook {
- GuidanceBook({
- this.id,
- this.name,
- this.value,
- });
-
- GuidanceBook.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- GuidanceBook copyWith({
- num id,
- String name,
- num value,
- }) =>
- GuidanceBook(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class RemainderWarrantyMonths {
- RemainderWarrantyMonths({
- this.id,
- this.name,
- this.value,
- });
-
- RemainderWarrantyMonths.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- RemainderWarrantyMonths copyWith({
- num id,
- String name,
- num value,
- }) =>
- RemainderWarrantyMonths(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class ExtendedWarrantyMonths {
- ExtendedWarrantyMonths({
- this.id,
- this.name,
- this.value,
- });
-
- ExtendedWarrantyMonths.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- ExtendedWarrantyMonths copyWith({
- num id,
- String name,
- num value,
- }) =>
- ExtendedWarrantyMonths(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class SiteWarrantyMonths {
- SiteWarrantyMonths({
- this.id,
- this.name,
- this.value,
- });
-
- SiteWarrantyMonths.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- SiteWarrantyMonths copyWith({
- num id,
- String name,
- num value,
- }) =>
- SiteWarrantyMonths(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class CommissioningStatus {
- CommissioningStatus({
- this.id,
- this.name,
- this.value,
- });
-
- CommissioningStatus.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- CommissioningStatus copyWith({
- num id,
- String name,
- num value,
- }) =>
- CommissioningStatus(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class OriginSite {
- OriginSite({
- this.id,
- this.customerCode,
- this.custName,
- this.buildings,
- });
-
- OriginSite.fromJson(dynamic json) {
- id = json['id'];
- customerCode = json['customerCode'];
- custName = json['custName'];
- if (json['buildings'] != null) {
- buildings = [];
- json['buildings'].forEach((v) {
- buildings.add(Buildings.fromJson(v));
- });
- }
- }
-
- num id;
- num customerCode;
- String custName;
- List buildings;
-
- OriginSite copyWith({
- num id,
- num customerCode,
- String custName,
- List buildings,
- }) =>
- OriginSite(
- id: id ?? this.id,
- customerCode: customerCode ?? this.customerCode,
- custName: custName ?? this.custName,
- buildings: buildings ?? this.buildings,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['customerCode'] = customerCode;
- map['custName'] = custName;
- if (buildings != null) {
- map['buildings'] = buildings.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class Buildings {
- Buildings({
- this.id,
- this.name,
- this.value,
- this.floors,
- });
-
- Buildings.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- if (json['floors'] != null) {
- floors = [];
- json['floors'].forEach((v) {
- floors.add(Floors.fromJson(v));
- });
- }
- }
-
- num id;
- String name;
- num value;
- List floors;
-
- Buildings copyWith({
- num id,
- String name,
- num value,
- List floors,
- }) =>
- Buildings(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- floors: floors ?? this.floors,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- if (floors != null) {
- map['floors'] = floors.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class Floors {
- Floors({
- this.id,
- this.name,
- this.value,
- this.departments,
- });
-
- Floors.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- if (json['departments'] != null) {
- departments = [];
- json['departments'].forEach((v) {
- departments.add(Departments.fromJson(v));
- });
- }
- }
-
- num id;
- String name;
- num value;
- List departments;
-
- Floors copyWith({
- num id,
- String name,
- num value,
- List departments,
- }) =>
- Floors(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- departments: departments ?? this.departments,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- if (departments != null) {
- map['departments'] = departments.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class Departments {
- Departments({
- this.id,
- this.name,
- });
-
- Departments.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- }
-
- num id;
- String name;
-
- Departments copyWith({
- num id,
- String name,
- }) =>
- Departments(
- id: id ?? this.id,
- name: name ?? this.name,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- return map;
- }
-}
-
-class OriginDepartment {
- OriginDepartment({
- this.id,
- this.departmentName,
- this.departmentCode,
- this.ntCode,
- });
-
- OriginDepartment.fromJson(dynamic json) {
- id = json['id'];
- departmentName = json['departmentName'];
- departmentCode = json['departmentCode'];
- ntCode = json['ntCode'];
- }
-
- num id;
- String departmentName;
- String departmentCode;
- String ntCode;
-
- OriginDepartment copyWith({
- num id,
- String departmentName,
- String departmentCode,
- String ntCode,
- }) =>
- OriginDepartment(
- id: id ?? this.id ?? 0,
- departmentName: departmentName ?? this.departmentName,
- departmentCode: departmentCode ?? this.departmentCode,
- ntCode: ntCode ?? this.ntCode,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id;
- map['departmentName'] = departmentName;
- map['departmentCode'] = departmentCode;
- map['ntCode'] = ntCode;
- return map;
- }
-}
-
-class Currency {
- Currency({
- this.id,
- this.name,
- this.value,
- });
-
- Currency.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- Currency copyWith({
- num id,
- String name,
- num value,
- }) =>
- Currency(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class Department {
- Department({
- this.id,
- this.departmentName,
- this.departmentCode,
- this.ntCode,
- });
-
- Department.fromJson(dynamic json) {
- id = json['id'];
- departmentName = json['departmentName'];
- departmentCode = json['departmentCode'];
- ntCode = json['ntCode'];
- }
-
- num id;
- String departmentName;
- String departmentCode;
- String ntCode;
-
- Department copyWith({
- num id,
- String departmentName,
- String departmentCode,
- String ntCode,
- }) =>
- Department(
- id: id ?? this.id,
- departmentName: departmentName ?? this.departmentName,
- departmentCode: departmentCode ?? this.departmentCode,
- ntCode: ntCode ?? this.ntCode,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['departmentName'] = departmentName;
- map['departmentCode'] = departmentCode;
- map['ntCode'] = ntCode;
- return map;
- }
-}
-
-class Floor {
- Floor({
- this.id,
- this.name,
- this.value,
- });
-
- Floor.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- Floor copyWith({
- num id,
- String name,
- num value,
- }) =>
- Floor(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class Building {
- Building({
- this.id,
- this.name,
- this.value,
- });
-
- Building.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- Building copyWith({
- num id,
- String name,
- num value,
- }) =>
- Building(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class Site {
- Site({
- this.id,
- this.customerCode,
- this.custName,
- this.buildings,
- });
-
- Site.fromJson(dynamic json) {
- id = json['id'];
- customerCode = json['customerCode'];
- custName = json['custName'];
- if (json['buildings'] != null) {
- buildings = [];
- json['buildings'].forEach((v) {
- buildings.add(Buildings.fromJson(v));
- });
- }
- }
-
- num id;
- num customerCode;
- String custName;
- List buildings;
-
- Site copyWith({
- num id,
- num customerCode,
- String custName,
- List buildings,
- }) =>
- Site(
- id: id ?? this.id,
- customerCode: customerCode ?? this.customerCode,
- custName: custName ?? this.custName,
- buildings: buildings ?? this.buildings,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['customerCode'] = customerCode;
- map['custName'] = custName;
- if (buildings != null) {
- map['buildings'] = buildings.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class ParentAsset {
- ParentAsset({
- this.id,
- this.assetSerialNo,
- this.assetNumber,
- this.tagCode,
- this.systemId,
- });
-
- ParentAsset.fromJson(dynamic json) {
- id = json['id'];
- assetSerialNo = json['assetSerialNo'];
- assetNumber = json['assetNumber'];
- tagCode = json['tagCode'];
- systemId = json['systemId'];
- }
-
- num id;
- String assetSerialNo;
- String assetNumber;
- String tagCode;
- String systemId;
-
- ParentAsset copyWith({
- num id,
- String assetSerialNo,
- String assetNumber,
- String tagCode,
- String systemId,
- }) =>
- ParentAsset(
- id: id ?? this.id,
- assetSerialNo: assetSerialNo ?? this.assetSerialNo,
- assetNumber: assetNumber ?? this.assetNumber,
- tagCode: tagCode ?? this.tagCode,
- systemId: systemId ?? this.systemId,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['assetSerialNo'] = assetSerialNo;
- map['assetNumber'] = assetNumber;
- map['tagCode'] = tagCode;
- map['systemId'] = systemId;
- return map;
- }
-}
-
-class IsParent {
- IsParent({
- this.id,
- this.name,
- this.value,
- });
-
- IsParent.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- IsParent copyWith({
- num id,
- String name,
- num value,
- }) =>
- IsParent(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class OldAsset {
- OldAsset({
- this.id,
- this.assetSerialNo,
- this.assetNumber,
- this.tagCode,
- this.systemId,
- });
-
- OldAsset.fromJson(dynamic json) {
- id = json['id'];
- assetSerialNo = json['assetSerialNo'];
- assetNumber = json['assetNumber'];
- tagCode = json['tagCode'];
- systemId = json['systemId'];
- }
-
- num id;
- String assetSerialNo;
- String assetNumber;
- String tagCode;
- String systemId;
-
- OldAsset copyWith({
- num id,
- String assetSerialNo,
- String assetNumber,
- String tagCode,
- String systemId,
- }) =>
- OldAsset(
- id: id ?? this.id ?? 0,
- assetSerialNo: assetSerialNo ?? this.assetSerialNo,
- assetNumber: assetNumber ?? this.assetNumber,
- tagCode: tagCode ?? this.tagCode,
- systemId: systemId ?? this.systemId,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id;
- map['assetSerialNo'] = assetSerialNo;
- map['assetNumber'] = assetNumber;
- map['tagCode'] = tagCode;
- map['systemId'] = systemId;
- return map;
- }
-}
-
-class AssetReplace {
- AssetReplace({
- this.id,
- this.name,
- this.value,
- });
-
- AssetReplace.fromJson(dynamic json) {
- id = json['id'];
- name = json['name'];
- value = json['value'];
- }
-
- num id;
- String name;
- num value;
-
- AssetReplace copyWith({
- num id,
- String name,
- num value,
- }) =>
- AssetReplace(
- id: id ?? this.id,
- name: name ?? this.name,
- value: value ?? this.value,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['name'] = name;
- map['value'] = value;
- return map;
- }
-}
-
-class Supplier {
- Supplier({
- this.id,
- this.suppliername,
- this.suppPersons,
- });
-
- Supplier.fromJson(dynamic json) {
- id = json['id'];
- suppliername = json['suppliername'];
- if (json['suppPersons'] != null) {
- suppPersons = [];
- json['suppPersons'].forEach((v) {
- suppPersons.add(SuppPersons.fromJson(v));
- });
- }
- }
-
- num id;
- String suppliername;
- List suppPersons;
-
- SupplierModel copyWith({
- num id,
- String suppliername,
- List suppPersons,
- }) =>
- SupplierModel(
- id: id ?? this.id,
- suppliername: suppliername ?? this.suppliername,
- suppPersons: suppPersons ?? this.suppPersons,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['suppliername'] = suppliername;
- if (suppPersons != null) {
- map['suppPersons'] = suppPersons.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class ModelDefinition {
- ModelDefinition({
- this.id,
- this.assetName,
- this.modelDefCode,
- this.modelName,
- this.manufacturerId,
- this.manufacturerName,
- this.supplierName,
- this.replacementDate,
- this.essentialEquipement,
- this.businessCritical,
- this.lifeSpan,
- this.modelDefRelatedDefects,
- this.suppliers,
- });
-
- ModelDefinition.fromJson(dynamic json) {
- id = json['id'];
- assetName = json['assetName'];
- modelDefCode = json['modelDefCode'];
- modelName = json['modelName'];
- manufacturerId = json['manufacturerId'];
- manufacturerName = json['manufacturerName'];
- supplierName = json['supplierName'];
- replacementDate = json['replacementDate'];
- essentialEquipement = json['essentialEquipement'];
- businessCritical = json['businessCritical'];
- lifeSpan = json['lifeSpan'];
- if (json['modelDefRelatedDefects'] != null) {
- modelDefRelatedDefects = [];
- json['modelDefRelatedDefects'].forEach((v) {
- modelDefRelatedDefects.add(ModelDefRelatedDefects.fromJson(v));
- });
- }
- if (json['suppliers'] != null) {
- suppliers = [];
- json['suppliers'].forEach((v) {
- suppliers.add(Suppliers.fromJson(v));
- });
- }
- }
-
- num id;
- String assetName;
- String modelDefCode;
- String modelName;
- num manufacturerId;
- String manufacturerName;
- String supplierName;
- String replacementDate;
- String essentialEquipement;
- String businessCritical;
- num lifeSpan;
- List modelDefRelatedDefects;
- List suppliers;
-
- ModelDefinition copyWith({
- num id,
- String assetName,
- String modelDefCode,
- String modelName,
- num manufacturerId,
- String manufacturerName,
- String supplierName,
- String replacementDate,
- String essentialEquipement,
- String businessCritical,
- num lifeSpan,
- List modelDefRelatedDefects,
- List suppliers,
- }) =>
- ModelDefinition(
- id: id ?? this.id,
- assetName: assetName ?? this.assetName,
- modelDefCode: modelDefCode ?? this.modelDefCode,
- modelName: modelName ?? this.modelName,
- manufacturerId: manufacturerId ?? this.manufacturerId,
- manufacturerName: manufacturerName ?? this.manufacturerName,
- supplierName: supplierName ?? this.supplierName,
- replacementDate: replacementDate ?? this.replacementDate,
- essentialEquipement: essentialEquipement ?? this.essentialEquipement,
- businessCritical: businessCritical ?? this.businessCritical,
- lifeSpan: lifeSpan ?? this.lifeSpan,
- modelDefRelatedDefects: modelDefRelatedDefects ?? this.modelDefRelatedDefects,
- suppliers: suppliers ?? this.suppliers,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['assetName'] = assetName;
- map['modelDefCode'] = modelDefCode;
- map['modelName'] = modelName;
- map['manufacturerId'] = manufacturerId;
- map['manufacturerName'] = manufacturerName;
- map['supplierName'] = supplierName;
- map['replacementDate'] = replacementDate;
- map['essentialEquipement'] = essentialEquipement;
- map['businessCritical'] = businessCritical;
- map['lifeSpan'] = lifeSpan;
- if (modelDefRelatedDefects != null) {
- map['modelDefRelatedDefects'] = modelDefRelatedDefects.map((v) => v.toJson()).toList();
- }
- if (suppliers != null) {
- map['suppliers'] = suppliers.map((v) => v.toJson()).toList();
- }
- return map;
- }
-}
-
-class Suppliers {
- Suppliers({
- this.id,
- this.suppliername,
- });
-
- Suppliers.fromJson(dynamic json) {
- id = json['id'];
- suppliername = json['suppliername'];
- }
-
- num id;
- String suppliername;
-
- Suppliers copyWith({
- num id,
- String suppliername,
- }) =>
- Suppliers(
- id: id ?? this.id,
- suppliername: suppliername ?? this.suppliername,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id ?? 0;
- map['suppliername'] = suppliername;
- return map;
- }
-}
-
-class ModelDefRelatedDefects {
- ModelDefRelatedDefects({
- this.id,
- this.defectName,
- this.workPerformed,
- this.estimatedTime,
- });
-
- ModelDefRelatedDefects.fromJson(dynamic json) {
- id = json['id'];
- defectName = json['defectName'];
- workPerformed = json['workPerformed'];
- estimatedTime = json['estimatedTime'];
- }
-
- num id;
- String defectName;
- String workPerformed;
- String estimatedTime;
-
- ModelDefRelatedDefects copyWith({
- num id,
- String defectName,
- String workPerformed,
- String estimatedTime,
- }) =>
- ModelDefRelatedDefects(
- id: id ?? this.id ?? 0,
- defectName: defectName ?? this.defectName,
- workPerformed: workPerformed ?? this.workPerformed,
- estimatedTime: estimatedTime ?? this.estimatedTime,
- );
-
- Map toJson() {
- final map = {};
- map['id'] = id;
- map['defectName'] = defectName;
- map['workPerformed'] = workPerformed;
- map['estimatedTime'] = estimatedTime;
- return map;
- }
-}
diff --git a/lib/models/service_request/service_report.dart b/lib/models/service_request/service_report.dart
new file mode 100644
index 00000000..d97a3f97
--- /dev/null
+++ b/lib/models/service_request/service_report.dart
@@ -0,0 +1,304 @@
+import 'dart:typed_data';
+
+import 'package:test_sa/models/lookup.dart';
+import 'package:test_sa/models/service_request/spare_parts.dart';
+import 'package:test_sa/models/service_request/supp_engineer_work_orders.dart';
+import 'package:test_sa/models/service_request/supplier_details.dart';
+import 'package:test_sa/models/service_request/wo_call_request.dart';
+import 'package:test_sa/models/service_request/wo_parent.dart';
+
+import '../../attachment.dart';
+import '../device/asset.dart';
+import '../fault_description.dart';
+import '../new_models/assigned_employee.dart';
+import '../new_models/assistant_employee.dart';
+import 'contact_person_work_order.dart';
+
+class ServiceReport {
+ ServiceReport({
+ this.id,
+ this.parentWOId,
+ this.workOrderNo,
+ this.workOrderYear,
+ this.workOrderSequennce,
+ this.callRequest,
+ this.assetType,
+ this.assignedEmployee,
+ this.visitDate,
+ this.assistantEmployees,
+ this.supplier,
+ this.vendorTicketNumber,
+ this.mrNumber,
+ this.contactPersonWorkOrders,
+ this.calllastSituation,
+ this.currentSituation,
+ this.repairLocation,
+ this.reason,
+ this.startofWorkTime,
+ this.endofWorkTime,
+ this.workingHours,
+ this.travelingHours,
+ this.travelingExpenses,
+ this.faultDescription,
+ this.sparePartsWorkOrders,
+ this.reviewComment,
+ this.comment,
+ this.attachmentsWorkOrder,
+ this.equipmentStatus,
+ this.suppEngineerWorkOrders,
+ this.engSignature,
+ this.nurseSignature,
+ this.woParentDto,
+ this.loanAvailablity,
+ this.assetLoan,
+ });
+
+ ServiceReport.fromJson(dynamic json) {
+ id = json['id'];
+ parentWOId = json['parentWOId'];
+ workOrderNo = json['workOrderNo'];
+ workOrderYear = json['workOrderYear'];
+ workOrderSequennce = json['workOrderSequennce'];
+ callRequest = json['callRequest'] != null ? CallRequest.fromJson(json['callRequest']) : null;
+ assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null;
+ assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null;
+ visitDate = json['visitDate'];
+ if (json['assistantEmployees'] != null) {
+ assistantEmployees = [];
+ json['assistantEmployees'].forEach((v) {
+ assistantEmployees.add(AssistantEmployees.fromJson(v));
+ });
+ }
+ supplier = json['supplier'] != null ? SupplierDetails.fromJson(json['supplier']) : null;
+ vendorTicketNumber = json['vendorTicketNumber'];
+ mrNumber = json['mrNumber'];
+ if (json['contactPersonWorkOrders'] != null) {
+ contactPersonWorkOrders = [];
+ json['contactPersonWorkOrders'].forEach((v) {
+ contactPersonWorkOrders.add(ContactPersonWorkOrder.fromJson(v));
+ });
+ }
+ calllastSituation = json['calllastSituation'] != null ? Lookup.fromJson(json['calllastSituation']) : null;
+ currentSituation = json['currentSituation'] != null ? Lookup.fromJson(json['currentSituation']) : null;
+ repairLocation = json['repairLocation'] != null ? Lookup.fromJson(json['repairLocation']) : null;
+ reason = json['reason'] != null ? Lookup.fromJson(json['reason']) : null;
+ startofWorkTime = json['startofWorkTime'];
+ endofWorkTime = json['endofWorkTime'];
+ workingHours = json['workingHours'];
+ travelingHours = json['travelingHours'];
+ travelingExpenses = json['travelingExpenses'];
+ faultDescription = json['faultDescription'] != null ? FaultDescription.fromJson(json['faultDescription']) : null;
+ if (json['sparePartsWorkOrders'] != null) {
+ sparePartsWorkOrders = [];
+ json['sparePartsWorkOrders'].forEach((v) {
+ sparePartsWorkOrders.add(SparePartsWorkOrders.fromJson(v));
+ });
+ }
+ reviewComment = json['reviewComment'];
+ comment = json['comment'];
+ if (json['attachmentsWorkOrder'] != null) {
+ attachmentsWorkOrder = [];
+ json['attachmentsWorkOrder'].forEach((v) {
+ attachmentsWorkOrder.add(Attachment.fromJson(v));
+ });
+ }
+ equipmentStatus = json['equipmentStatus'] != null ? Lookup.fromJson(json['equipmentStatus']) : null;
+ if (json['suppEngineerWorkOrders'] != null) {
+ suppEngineerWorkOrders = [];
+ json['suppEngineerWorkOrders'].forEach((v) {
+ suppEngineerWorkOrders.add(SuppEngineerWorkOrders.fromJson(v));
+ });
+ }
+ engSignature = json['engSignature'];
+ nurseSignature = json['nurseSignature'];
+ woParentDto = json['woParentDto'] != null ? WoParent.fromJson(json['woParentDto']) : null;
+ loanAvailablity = json['loanAvailablity'] != null ? Lookup.fromJson(json['loanAvailablity']) : null;
+ assetLoan = json['assetLoan'] != null ? AssetInfo.fromJson(json['assetLoan']) : null;
+ }
+ num id;
+ num parentWOId;
+ String workOrderNo;
+ num workOrderYear;
+ num workOrderSequennce;
+ CallRequest callRequest;
+ Lookup assetType;
+ AssignedEmployee assignedEmployee;
+ String visitDate;
+ List assistantEmployees;
+ SupplierDetails supplier;
+ String vendorTicketNumber;
+ String mrNumber;
+ List contactPersonWorkOrders;
+ Lookup calllastSituation;
+ Lookup currentSituation;
+ Lookup repairLocation;
+ Lookup reason;
+ String startofWorkTime;
+ String endofWorkTime;
+ num workingHours;
+ num travelingHours;
+ num travelingExpenses;
+ FaultDescription faultDescription;
+ List sparePartsWorkOrders;
+ String reviewComment;
+ String comment;
+ List attachmentsWorkOrder;
+ Lookup equipmentStatus;
+ List suppEngineerWorkOrders;
+ String engSignature;
+ Uint8List localEngSignature;
+ String nurseSignature;
+ Uint8List localNurseSignature;
+ WoParent woParentDto;
+ Lookup loanAvailablity;
+ AssetInfo assetLoan;
+ ServiceReport copyWith({
+ num id,
+ num parentWOId,
+ String workOrderNo,
+ num workOrderYear,
+ num workOrderSequennce,
+ CallRequest callRequest,
+ Lookup assetType,
+ AssignedEmployee assignedEmployee,
+ String visitDate,
+ List assistantEmployees,
+ SupplierDetails supplier,
+ String vendorTicketNumber,
+ String mrNumber,
+ List contactPersonWorkOrders,
+ Lookup calllastSituation,
+ Lookup currentSituation,
+ Lookup repairLocation,
+ Lookup reason,
+ String startofWorkTime,
+ String endofWorkTime,
+ num workingHours,
+ num travelingHours,
+ num travelingExpenses,
+ FaultDescription faultDescription,
+ List sparePartsWorkOrders,
+ String reviewComment,
+ String comment,
+ List attachmentsWorkOrder,
+ Lookup equipmentStatus,
+ List suppEngineerWorkOrders,
+ String engSignature,
+ String nurseSignature,
+ WoParent woParentDto,
+ Lookup loanAvailablity,
+ AssetInfo assetLoan,
+ }) =>
+ ServiceReport(
+ id: id ?? this.id,
+ parentWOId: parentWOId ?? this.parentWOId,
+ workOrderNo: workOrderNo ?? this.workOrderNo,
+ workOrderYear: workOrderYear ?? this.workOrderYear,
+ workOrderSequennce: workOrderSequennce ?? this.workOrderSequennce,
+ callRequest: callRequest ?? this.callRequest,
+ assetType: assetType ?? this.assetType,
+ assignedEmployee: assignedEmployee ?? this.assignedEmployee,
+ visitDate: visitDate ?? this.visitDate,
+ assistantEmployees: assistantEmployees ?? this.assistantEmployees,
+ supplier: supplier ?? this.supplier,
+ vendorTicketNumber: vendorTicketNumber ?? this.vendorTicketNumber,
+ mrNumber: mrNumber ?? this.mrNumber,
+ contactPersonWorkOrders: contactPersonWorkOrders ?? this.contactPersonWorkOrders,
+ calllastSituation: calllastSituation ?? this.calllastSituation,
+ currentSituation: currentSituation ?? this.currentSituation,
+ repairLocation: repairLocation ?? this.repairLocation,
+ reason: reason ?? this.reason,
+ startofWorkTime: startofWorkTime ?? this.startofWorkTime,
+ endofWorkTime: endofWorkTime ?? this.endofWorkTime,
+ workingHours: workingHours ?? this.workingHours,
+ travelingHours: travelingHours ?? this.travelingHours,
+ travelingExpenses: travelingExpenses ?? this.travelingExpenses,
+ faultDescription: faultDescription ?? this.faultDescription,
+ sparePartsWorkOrders: sparePartsWorkOrders ?? this.sparePartsWorkOrders,
+ reviewComment: reviewComment ?? this.reviewComment,
+ comment: comment ?? this.comment,
+ attachmentsWorkOrder: attachmentsWorkOrder ?? this.attachmentsWorkOrder,
+ equipmentStatus: equipmentStatus ?? this.equipmentStatus,
+ suppEngineerWorkOrders: suppEngineerWorkOrders ?? this.suppEngineerWorkOrders,
+ engSignature: engSignature ?? this.engSignature,
+ nurseSignature: nurseSignature ?? this.nurseSignature,
+ woParentDto: woParentDto ?? this.woParentDto,
+ loanAvailablity: loanAvailablity ?? this.loanAvailablity,
+ assetLoan: assetLoan ?? this.assetLoan,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ map['parentWOId'] = parentWOId;
+ map['workOrderNo'] = workOrderNo;
+ map['workOrderYear'] = workOrderYear;
+ map['workOrderSequennce'] = workOrderSequennce;
+ if (callRequest != null) {
+ map['callRequest'] = callRequest.toJson();
+ }
+ if (assetType != null) {
+ map['assetType'] = assetType.toJson();
+ }
+ if (assignedEmployee != null) {
+ map['assignedEmployee'] = assignedEmployee.toJson();
+ }
+ map['visitDate'] = visitDate;
+ if (assistantEmployees != null) {
+ map['assistantEmployees'] = assistantEmployees.map((v) => v.toJson()).toList();
+ }
+ if (supplier != null) {
+ map['supplier'] = supplier.toJson();
+ }
+ map['vendorTicketNumber'] = vendorTicketNumber;
+ map['mrNumber'] = mrNumber;
+ if (contactPersonWorkOrders != null) {
+ map['contactPersonWorkOrders'] = contactPersonWorkOrders.map((v) => v.toJson()).toList();
+ }
+ if (calllastSituation != null) {
+ map['calllastSituation'] = calllastSituation.toJson();
+ }
+ if (currentSituation != null) {
+ map['currentSituation'] = currentSituation.toJson();
+ }
+ if (repairLocation != null) {
+ map['repairLocation'] = repairLocation.toJson();
+ }
+ if (reason != null) {
+ map['reason'] = reason.toJson();
+ }
+ map['startofWorkTime'] = startofWorkTime;
+ map['endofWorkTime'] = endofWorkTime;
+ map['workingHours'] = workingHours;
+ map['travelingHours'] = travelingHours;
+ map['travelingExpenses'] = travelingExpenses;
+ if (faultDescription != null) {
+ map['faultDescription'] = faultDescription.toJson();
+ }
+ if (sparePartsWorkOrders != null) {
+ map['sparePartsWorkOrders'] = sparePartsWorkOrders.map((v) => v.toJson()).toList();
+ }
+ map['reviewComment'] = reviewComment;
+ map['comment'] = comment;
+ if (attachmentsWorkOrder != null) {
+ map['attachmentsWorkOrder'] = attachmentsWorkOrder.map((v) => v.toJson()).toList();
+ }
+ if (equipmentStatus != null) {
+ map['equipmentStatus'] = equipmentStatus.toJson();
+ }
+ if (suppEngineerWorkOrders != null) {
+ map['suppEngineerWorkOrders'] = suppEngineerWorkOrders.map((v) => v.toJson()).toList();
+ }
+ map['engSignature'] = engSignature;
+ map['nurseSignature'] = nurseSignature;
+ if (woParentDto != null) {
+ map['woParentDto'] = woParentDto.toJson();
+ }
+ if (loanAvailablity != null) {
+ map['loanAvailablity'] = loanAvailablity.toJson();
+ }
+ if (assetLoan != null) {
+ map['assetLoan'] = assetLoan.toJson();
+ }
+ return map;
+ }
+}
diff --git a/lib/models/service_request/service_request_search.dart b/lib/models/service_request/service_request_search.dart
index d461c629..19dc1d47 100644
--- a/lib/models/service_request/service_request_search.dart
+++ b/lib/models/service_request/service_request_search.dart
@@ -1,7 +1,7 @@
import 'package:test_sa/models/hospital.dart';
import 'package:test_sa/models/lookup.dart';
-import '../call_request_for_work_order_model.dart';
+import '../new_models/assigned_employee.dart';
class ServiceRequestSearch {
String callId;
diff --git a/lib/models/service_request/spare_parts.dart b/lib/models/service_request/spare_parts.dart
new file mode 100644
index 00000000..cd981eb2
--- /dev/null
+++ b/lib/models/service_request/spare_parts.dart
@@ -0,0 +1,91 @@
+import '../base.dart';
+
+class SparePartsWorkOrders extends Base {
+ SparePartsWorkOrders({
+ this.id,
+ this.sparePart,
+ this.qty,
+ this.returnQty,
+ this.installQty,
+ }) : super(identifier: id?.toString(), name: sparePart?.partName);
+
+ SparePartsWorkOrders.fromJson(dynamic json) {
+ id = json['id'];
+ sparePart = json['sparePart'] != null ? SparePart.fromJson(json['sparePart']) : null;
+ qty = json['qty'];
+ returnQty = json['returnQty'];
+ installQty = json['installQty'];
+ }
+ num id;
+ SparePart sparePart;
+ num qty;
+ num returnQty;
+ num installQty;
+ SparePartsWorkOrders copyWith({
+ num id,
+ SparePart sparePart,
+ num qty,
+ num returnQty,
+ num installQty,
+ }) =>
+ SparePartsWorkOrders(
+ id: id ?? this.id,
+ sparePart: sparePart ?? this.sparePart,
+ qty: qty ?? this.qty,
+ returnQty: returnQty ?? this.returnQty,
+ installQty: installQty ?? this.installQty,
+ );
+ Map toJson() {
+ final map = {};
+ map['id'] = id;
+ if (sparePart != null) {
+ map['sparePart'] = sparePart.toJson();
+ }
+ map['qty'] = qty;
+ map['returnQty'] = returnQty;
+ map['installQty'] = installQty;
+ return map;
+ }
+}
+
+class SparePart extends Base {
+ SparePart({
+ this.id,
+ this.partNo,
+ this.partName,
+ this.assetId,
+ }) : super(identifier: id?.toString(), name: partName);
+
+ SparePart.fromJson(dynamic json) {
+ id = json['id'];
+ identifier = id?.toString();
+ partNo = json['partNo'];
+ partName = json['partName'];
+ name = partName;
+ assetId = json['assetId'];
+ }
+ num id;
+ String partNo;
+ String partName;
+ num assetId;
+ SparePart copyWith({
+ num id,
+ String partNo,
+ String partName,
+ num assetId,
+ }) =>
+ SparePart(
+ id: id ?? this.id,
+ partNo: partNo ?? this.partNo,
+ partName: partName ?? this.partName,
+ assetId: assetId ?? this.assetId,
+ );
+ Map