From 8d02ff5ec1a7a69a53fb143eb21f17aecbe725b0 Mon Sep 17 00:00:00 2001 From: WaseemAbbasi22 Date: Mon, 11 Aug 2025 09:20:25 +0300 Subject: [PATCH] mr number and exchange cost added --- lib/controllers/api_routes/urls.dart | 8 ++--- .../workorder/work_order_helper_models.dart | 6 ++-- .../new_models/work_order_detail_model.dart | 28 +++++++++-------- .../service_request_detail_view.dart | 10 ++++++- .../forms/cost/cost_detail_form_screen.dart | 30 +++++++++++++++++++ 5 files changed, 63 insertions(+), 19 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index cb7f9347..69f699fb 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,14 +3,14 @@ class URLs { static const String appReleaseBuildNumber = "21"; - static const host1 = "https://atomsm.hmg.com"; // production url - // static const host1 = "https://atomsmdev.hmg.com"; // local DEV url + // static const host1 = "https://atomsm.hmg.com"; // production url + static const host1 = "https://atomsmdev.hmg.com"; // local DEV url // static const host1 = "https://atomsmuat.hmg.com"; // local UAT url // static String _baseUrl = "$_host/mobile"; - // static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis + static final String _baseUrl = "$_host/v2/mobile"; // new V2 apis // static final String _baseUrl = "$_host/mobile"; // host local UAT - static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM + // static final String _baseUrl = "$_host/v3/mobile"; // v3 for new CM,PM,TM static String _host = host1; diff --git a/lib/models/helper_data_models/workorder/work_order_helper_models.dart b/lib/models/helper_data_models/workorder/work_order_helper_models.dart index cd302791..76bf3767 100644 --- a/lib/models/helper_data_models/workorder/work_order_helper_models.dart +++ b/lib/models/helper_data_models/workorder/work_order_helper_models.dart @@ -170,10 +170,12 @@ class WorkOrderCostModel { num? qAmount; String? prNo; String? poNo; + String? mrNo; + num? exchangeCost; - WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo}); + WorkOrderCostModel({this.workOrderId, this.sparePartCost, this.labourCost, this.travelCost, this.qAmount, this.poNo, this.prNo,this.mrNo,this.exchangeCost}); Map toJson() { - return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo}; + return {'workOrderId': workOrderId, 'sparePartCost': sparePartCost, 'laborCost': labourCost, 'travelCost': travelCost, 'qAmount': qAmount, 'prNo': prNo, 'poNo': poNo,'mrNo':mrNo,'exchangeCost':exchangeCost}; } } diff --git a/lib/models/new_models/work_order_detail_model.dart b/lib/models/new_models/work_order_detail_model.dart index 18041173..7f44edad 100644 --- a/lib/models/new_models/work_order_detail_model.dart +++ b/lib/models/new_models/work_order_detail_model.dart @@ -106,6 +106,8 @@ class WorkOrderData { this.qAmount, this.prNo, this.poNo, + this.mrNo, + this.exchangeCost, required this.workOrderHistory, required this.activities, required this.activityAssetToBeRetireds, @@ -171,6 +173,8 @@ class WorkOrderData { num? qAmount; String? prNo; String? poNo; + String? mrNo; + num? exchangeCost; List workOrderHistory; List activities; List activityAssetToBeRetireds; @@ -207,6 +211,8 @@ class WorkOrderData { qAmount: json['qAmount'], prNo: json['prNo'], poNo: json['poNo'], + mrNo: json['mrNo'], + exchangeCost: json['exchangeCost'], assetType: json["assetType"] == null ? null : Lookup.fromJson(json["assetType"]), assignedEmployee: json["assignedEmployee"] == null ? null : WorkOrderAssignedEmployee.fromJson(json["assignedEmployee"]), lastActivityStatus: json["lastActivityStatus"] != null ? Lookup.fromJson(json["lastActivityStatus"]) : null, @@ -278,6 +284,8 @@ class WorkOrderData { "comments": comments, "voiceNote": voiceNote, "edd": edd, + 'mrNo': mrNo, + 'exchangeCost': exchangeCost, "workOrderAttachments": workOrderAttachments.map((e) => e.toJson()).toList(), "returnToService": returnToService, "serviceType": serviceType?.toJson(), @@ -828,20 +836,19 @@ class ActivityMaintenanceAssistantEmployees { double? workingHours; String? technicalComment; AssignedEmployee? user; - AssistantEmployees ?employee; + AssistantEmployees? employee; - ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee}); + ActivityMaintenanceAssistantEmployees({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee}); ActivityMaintenanceAssistantEmployees.fromJson(Map json) { - Map assistEmpData={}; - + Map assistEmpData = {}; startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null; endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null; workingHours = json['workingHours']; technicalComment = json['technicalComment']; user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null; - if(json['user']!=null) { + if (json['user'] != null) { assistEmpData = { 'id': null, 'user': { @@ -866,7 +873,6 @@ class ActivityMaintenanceAssistantEmployees { } } - // class ActivityMaintenanceAssistantEmployees { // DateTime? startDate; // DateTime? endDate; @@ -923,27 +929,25 @@ class ActivityMaintenanceTimers { } } - class AssistantEmployeesModel { DateTime? startDate; DateTime? endDate; double? workingHours; String? technicalComment; AssignedEmployee? user; - AssistantEmployees ?employee; + AssistantEmployees? employee; - AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user,this.employee}); + AssistantEmployeesModel({this.startDate, this.endDate, this.workingHours, this.technicalComment, this.user, this.employee}); AssistantEmployeesModel.fromJson(Map json) { - Map assistEmpData={}; - + Map assistEmpData = {}; startDate = json['startDate'] != null ? DateTime.parse(json['startDate']) : null; endDate = json['endDate'] != null ? DateTime.parse(json['endDate']) : null; workingHours = json['workingHours']; technicalComment = json['technicalComment']; user = json['user'] != null ? AssignedEmployee.fromJson(json['user']) : null; - if(json['user']!=null) { + if (json['user'] != null) { assistEmpData = { 'id': null, 'user': { diff --git a/lib/modules/cm_module/views/components/service_request_detail_view.dart b/lib/modules/cm_module/views/components/service_request_detail_view.dart index 52ceea18..b366a1ce 100644 --- a/lib/modules/cm_module/views/components/service_request_detail_view.dart +++ b/lib/modules/cm_module/views/components/service_request_detail_view.dart @@ -336,7 +336,7 @@ class _ServiceRequestDetailViewState extends State { "Attachments".addTranslation, style: AppTextStyles.heading4.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral50), ), - FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)!).toList()), + FilesList(images: _attachments.map((toElement) => URLs.getFileUrl(toElement.name!)??'').toList()), ], if (!requestProvider.isReadOnlyRequest && workOrder.nextStep?.workOrderNextStepEnum == WorkOrderNextStepEnum.activity) ...[ 8.height, @@ -530,6 +530,14 @@ class _ServiceRequestDetailViewState extends State { 'PO No: ${provider.currentWorkOrder!.data?.poNo ?? '-'}', style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), ), + Text( + 'MR No: ${provider.currentWorkOrder!.data?.mrNo ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), + Text( + 'Exchange Cost: ${provider.currentWorkOrder!.data?.exchangeCost ?? '-'}', + style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral120), + ), ], ), ], diff --git a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart index c8f99451..f4cbe4db 100644 --- a/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart +++ b/lib/modules/cm_module/views/forms/cost/cost_detail_form_screen.dart @@ -46,6 +46,8 @@ class _CostDetailFormScreenState extends State with Ticker qAmount: currentWorkOrderData.qAmount, prNo: currentWorkOrderData.prNo, poNo: currentWorkOrderData.poNo, + mrNo: currentWorkOrderData.mrNo, + exchangeCost: currentWorkOrderData.exchangeCost, ); } @@ -152,6 +154,34 @@ class _CostDetailFormScreenState extends State with Ticker }, style: Theme.of(context).textTheme.titleMedium, ), + 8.height, + AppTextFormField( + labelText: "MR No", + backgroundColor: AppColor.neutral100, + initialValue: requestDetailProvider.workOrderCostModel?.mrNo, + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: TextInputType.text, + showShadow: false, + onChange: (value) { + requestDetailProvider.workOrderCostModel?.mrNo = value; + }, + style: Theme.of(context).textTheme.titleMedium, + ), + 8.height, + AppTextFormField( + labelText: "Exchange Cost", + backgroundColor: AppColor.neutral100, + initialValue: requestDetailProvider.workOrderCostModel?.exchangeCost!=null?requestDetailProvider.workOrderCostModel?.exchangeCost.toString():'', + textAlign: TextAlign.center, + labelStyle: AppTextStyles.textFieldLabelStyle, + textInputType: const TextInputType.numberWithOptions(decimal: true), + showShadow: false, + onChange: (value) { + requestDetailProvider.workOrderCostModel?.exchangeCost = num.parse(value); + }, + style: Theme.of(context).textTheme.titleMedium, + ), ], ).toShadowContainer(context).paddingAll(16), ).expanded,