From 2d0c72b138b0e418914446180be191bf82277236 Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Wed, 4 Oct 2023 15:51:33 +0300 Subject: [PATCH 1/2] 1- prevent the user from creating a new gas refill request if the department isn't selected. 2- working on host: https://atomsmdev.hmg.com --- lib/controllers/api_routes/urls.dart | 5 +++-- lib/views/pages/user/gas_refill/request_gas_refill.dart | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/controllers/api_routes/urls.dart b/lib/controllers/api_routes/urls.dart index f748d37d..84f37a09 100644 --- a/lib/controllers/api_routes/urls.dart +++ b/lib/controllers/api_routes/urls.dart @@ -3,17 +3,18 @@ class URLs { static const host2 = "http://194.163.164.213/atoms/api"; static const host1 = "https://atomsuat.hmg.com"; // uat url + static const host3 = "https://atomsmdev.hmg.com"; // uat url // static const host1 = "http://109.123.243.118:9000"; static String _baseUrl = "$_host/mobile"; - static String _host = host1; + static String _host = host3; set host(String value) => _host = value; static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_baseUrl/Files/DownloadFile?fileName=$file"); - // static String getFileUrl(String file) => (file == null || file.isEmpty) ? null : (file.contains("/") ? file : "$_host/attachment/$file"); + // static String getFileUrl(String file) => (file == null || file.isEmpty) ? null :1 (file.contains("/") ? file : "$_host/attachment/$file"); // API Routes static get login => "$_baseUrl/MobileAuth/LoginIntegration"; // post diff --git a/lib/views/pages/user/gas_refill/request_gas_refill.dart b/lib/views/pages/user/gas_refill/request_gas_refill.dart index e5242580..3faea579 100644 --- a/lib/views/pages/user/gas_refill/request_gas_refill.dart +++ b/lib/views/pages/user/gas_refill/request_gas_refill.dart @@ -85,6 +85,12 @@ class _RequestGasRefillState extends State { return; } } + if (_gasRefillProvider.department?.name == null) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text("Failed to complete your request"))); + _isLoading = false; + setState(() {}); + return; + } int status = widget.gasRefillModel == null ? await _gasRefillProvider.createModel( From 630a4e1b9d0e42c8ffb7088499ae95880b41b3bc Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Wed, 4 Oct 2023 16:52:26 +0300 Subject: [PATCH 2/2] Add (mr number) field to the WO details bottom sheet --- lib/models/service_request/search_work_order.dart | 9 +++++++++ .../work_order_details_bottom_sheet.dart | 14 +++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/models/service_request/search_work_order.dart b/lib/models/service_request/search_work_order.dart index 4294f499..8483a676 100644 --- a/lib/models/service_request/search_work_order.dart +++ b/lib/models/service_request/search_work_order.dart @@ -39,6 +39,7 @@ class SearchWorkOrder { this.nurseSignature, this.woParentDto, this.timer, + this.mrNumber, }); SearchWorkOrder.fromJson(dynamic json) { @@ -51,6 +52,7 @@ class SearchWorkOrder { assetType = json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : null; visitDate = json['visitDate']; + mrNumber = json['mrNumber']; if (json['assistantEmployees'] != null) { assistantEmployees = []; json['assistantEmployees'].forEach((v) { @@ -145,6 +147,7 @@ class SearchWorkOrder { engSignature = wo.engSignature ?? engSignature; nurseSignature = wo.nurseSignature ?? nurseSignature; woParentDto = wo.woParentDto ?? woParentDto; + mrNumber = wo.mrNumber ?? mrNumber; } num id; @@ -180,6 +183,7 @@ class SearchWorkOrder { String nurseSignature; WoParentDto woParentDto; TimerModel timer; + String mrNumber; SearchWorkOrder copyWith({ num id, @@ -215,6 +219,7 @@ class SearchWorkOrder { String nurseSignature, WoParentDto woParentDto, TimerModel timer, + String mrNumber, }) => SearchWorkOrder( id: id ?? this.id, @@ -250,6 +255,7 @@ class SearchWorkOrder { nurseSignature: nurseSignature ?? this.nurseSignature, woParentDto: woParentDto ?? this.woParentDto, timer: timer ?? this.timer, + mrNumber: mrNumber ?? this.mrNumber, ); Map toJson() { @@ -319,6 +325,9 @@ class SearchWorkOrder { if (woParentDto != null) { map['woParentDto'] = woParentDto.toJson(); } + if (mrNumber != null) { + map['mrNumber'] = mrNumber; + } return map; } diff --git a/lib/views/pages/sub_workorder/work_order_details_bottom_sheet.dart b/lib/views/pages/sub_workorder/work_order_details_bottom_sheet.dart index 13c807eb..5ed1e253 100644 --- a/lib/views/pages/sub_workorder/work_order_details_bottom_sheet.dart +++ b/lib/views/pages/sub_workorder/work_order_details_bottom_sheet.dart @@ -13,7 +13,6 @@ import 'package:test_sa/views/widgets/status/service_request/supplier_engineers_ import '../../../controllers/localization/localization.dart'; import '../../../controllers/providers/api/status_drop_down/report/service_report_maintenance_situation_provider.dart'; -import '../../app_style/colors.dart'; import '../../widgets/timer/app_timer.dart'; import '../../widgets/titles/app_sub_title.dart'; import 'auto_generated_vendor_name.dart'; @@ -144,6 +143,7 @@ class _WorkOrderDetailsBottomSheetState extends State