From 2d0c72b138b0e418914446180be191bf82277236 Mon Sep 17 00:00:00 2001 From: zaid_daoud Date: Wed, 4 Oct 2023 15:51:33 +0300 Subject: [PATCH] 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(