7/20/2
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:http/http.dart' as http;
|
|||||||
import 'package:SEFER/env/env.dart';
|
import 'package:SEFER/env/env.dart';
|
||||||
|
|
||||||
import '../../constant/api_key.dart';
|
import '../../constant/api_key.dart';
|
||||||
|
import '../../print.dart';
|
||||||
import 'gemeni.dart';
|
import 'gemeni.dart';
|
||||||
import 'upload_image.dart';
|
import 'upload_image.dart';
|
||||||
|
|
||||||
@@ -218,6 +219,9 @@ class CRUD {
|
|||||||
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
'Basic ${base64Encode(utf8.encode(AK.basicAuthCredentials))}',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Log.print('response: ${response.request}');
|
||||||
|
Log.print('response: ${response.body}');
|
||||||
|
Log.print('response: ${payload}');
|
||||||
var jsonData = jsonDecode(response.body);
|
var jsonData = jsonDecode(response.body);
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
if (jsonData['status'] == 'success') {
|
if (jsonData['status'] == 'success') {
|
||||||
|
|||||||
@@ -304,25 +304,36 @@ class AI extends GetxController {
|
|||||||
responseIdEgyptDriverLicense['employmentType']?.toString() ??
|
responseIdEgyptDriverLicense['employmentType']?.toString() ??
|
||||||
'Not specified',
|
'Not specified',
|
||||||
};
|
};
|
||||||
var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload);
|
|
||||||
var status1 = jsonDecode(res);
|
try {
|
||||||
isLoading = false;
|
var res = await CRUD().post(link: AppLink.signUpCaptin, payload: payload);
|
||||||
update();
|
|
||||||
// Handle response
|
// Check if response is valid JSON
|
||||||
if (status1['status'] == 'success') {
|
var status1;
|
||||||
isDriverSaved = true;
|
try {
|
||||||
Get.snackbar('Success', 'Driver data saved successfully',
|
status1 = jsonDecode(res);
|
||||||
backgroundColor: AppColor.greenColor);
|
} catch (e) {
|
||||||
} else {
|
throw FormatException("Invalid JSON response: $res");
|
||||||
Get.snackbar('Error', 'Failed to save driver data',
|
}
|
||||||
|
|
||||||
|
isLoading = false;
|
||||||
|
update();
|
||||||
|
|
||||||
|
if (status1['status'] == 'success') {
|
||||||
|
isDriverSaved = true;
|
||||||
|
Get.snackbar('Success', 'Driver data saved successfully',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
} else {
|
||||||
|
Get.snackbar('Error'.tr,
|
||||||
|
'${'Failed to save driver data'.tr}: ${status1['message']}',
|
||||||
|
backgroundColor: Colors.red);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
isLoading = false;
|
||||||
|
update();
|
||||||
|
Get.snackbar('Error'.tr, 'An error occurred while saving driver data'.tr,
|
||||||
backgroundColor: Colors.red);
|
backgroundColor: Colors.red);
|
||||||
}
|
}
|
||||||
// } catch (e) {
|
|
||||||
// isLoading = false;
|
|
||||||
// update();
|
|
||||||
// Get.snackbar('Error', 'An error occurred while saving driver data: $e',
|
|
||||||
// backgroundColor: Colors.red);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addCriminalDeocuments() async {
|
addCriminalDeocuments() async {
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ class MyTranslation extends Translations {
|
|||||||
"ar": {
|
"ar": {
|
||||||
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
||||||
"face detect": "كشف الوجه",
|
"face detect": "كشف الوجه",
|
||||||
|
'An error occurred while saving driver data':
|
||||||
|
"حدث خطأ أثناء حفظ بيانات السائق",
|
||||||
"Face Detection Result": "نتيجة كشف الوجه",
|
"Face Detection Result": "نتيجة كشف الوجه",
|
||||||
"false": "خطأ",
|
"false": "خطأ",
|
||||||
"true": "صحيح",
|
"true": "صحيح",
|
||||||
|
'Failed to save driver data': 'فشل حفظ بيانات السائق',
|
||||||
|
|
||||||
"similar": "مشابه",
|
"similar": "مشابه",
|
||||||
"not similar": "غير مشابه",
|
"not similar": "غير مشابه",
|
||||||
"error": "خطأ",
|
"error": "خطأ",
|
||||||
|
|||||||
Reference in New Issue
Block a user