Update: 2026-06-29 00:07:33

This commit is contained in:
Hamza-Ayed
2026-06-29 00:07:33 +03:00
parent 24da2bc7ca
commit d695a4e812
15 changed files with 190 additions and 60 deletions

View File

@@ -50,7 +50,8 @@ class MainController extends GetxController {
@override
void onInit() {
super.onInit();
// refreshDashboardStats(); // Removed to save data consumption at start
final country = box.read('countryCode')?.toString() ?? 'Jordan';
Log.print('🌍 [SIRO-SERVICE-STARTUP] Current countryCode stored in box: $country');
}
Future<void> refreshDashboardStats() async {

View File

@@ -123,6 +123,42 @@ class ReviewDriverController extends GetxController {
};
List<List<dynamic>> getFieldsForTab(String tabKey) {
final countryCode = country;
if (countryCode == 'Syria') {
if (tabKey == 'driver_license_front') {
return [
['licenseTypeController', 'License Type', false, false, false, false],
[
'licenseIssueDateController',
'License Issue Date',
true,
false,
false,
false
],
[
'expiryDateController',
'License Expiry Date',
true,
false,
false,
false
],
];
}
if (tabKey == 'driver_license_back') {
return [
[
'licenseCategoriesController',
'License Categories',
false,
false,
false,
false
],
];
}
}
return fieldConfig[tabKey] ?? [];
}
@@ -161,6 +197,10 @@ class ReviewDriverController extends GetxController {
driverId.value = args['driverId'] ?? '';
phone.value = args['phone'] ?? '';
}
if (country == 'Jordan' || country == 'Egypt') {
docUrls.remove('driver_license_back');
}
_initializeDocUrls();
fetchData();
}
@@ -210,13 +250,64 @@ class ReviewDriverController extends GetxController {
}
}
String reconstructDocumentUrl(String originalLink, String docType) {
if (originalLink.isEmpty) {
return "${AppLink.server}/auth/syria/driversDocs/syria.intaleq.xyz-${driverId.value}-$docType.jpg";
}
try {
final origUri = Uri.parse(originalLink);
final query = origUri.query;
final path = origUri.path;
if (path.contains('secure_image.php')) {
return "${AppLink.server}/secure_image.php?$query";
}
if (path.contains('auth/syria/driversDocs/')) {
final parts = path.split('auth/syria/driversDocs/');
final filename = parts.last;
return "${AppLink.server}/auth/syria/driversDocs/$filename";
}
if (originalLink.startsWith('http://') ||
originalLink.startsWith('https://')) {
final serverUri = Uri.parse(AppLink.server);
final host = serverUri.host;
final newUri = Uri(
scheme: 'https',
host: host,
path: path,
query: query.isNotEmpty ? query : null,
);
return newUri.toString();
}
final cleanPath = path.startsWith('/') ? path : '/$path';
return "${AppLink.server}$cleanPath${query.isNotEmpty ? '?$query' : ''}";
} catch (e) {
if (originalLink.startsWith('http://')) {
return originalLink.replaceFirst('http://', 'https://');
}
return originalLink;
}
}
void _initializeDocUrls() {
for (var key in docUrls.keys) {
docUrls[key]!.value = reconstructDocumentUrl('', key);
}
}
void _populateDocUrls(dynamic docs) {
if (docs is List) {
for (var doc in docs) {
if (doc is Map && doc['doc_type'] != null && doc['link'] != null) {
String type = doc['doc_type'].toString();
if (docUrls.containsKey(type)) {
docUrls[type]!.value = doc['link'].toString();
docUrls[type]!.value =
reconstructDocumentUrl(doc['link'].toString(), type);
}
}
}