5/18/1
This commit is contained in:
1
.env
1
.env
@@ -30,6 +30,5 @@ payMobApikey='MDrGqKEWS1rVqHvEPDvPjJ7vZDBExrO7S3BEBgrlfUwTA3i5RnP5ZnvoL3M2S9rEBg
|
|||||||
integrationIdPayMobWallet=0552352XrXlBl
|
integrationIdPayMobWallet=0552352XrXlBl
|
||||||
Ocp-Apim-Subscription-Key=21010e54b50f41a4904708c526e102df
|
Ocp-Apim-Subscription-Key=21010e54b50f41a4904708c526e102df
|
||||||
smsPasswordEgypt="E)Pu=an/@Z"
|
smsPasswordEgypt="E)Pu=an/@Z"
|
||||||
|
|
||||||
chatGPTkeySeferNew=sk-proj-6r2SrvboRE7hAIpnn8WmT3BlbkFJdPAOf7WOX8aV8CFFaiY5
|
chatGPTkeySeferNew=sk-proj-6r2SrvboRE7hAIpnn8WmT3BlbkFJdPAOf7WOX8aV8CFFaiY5
|
||||||
anthropicAIkeySeferNew=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
|
anthropicAIkeySeferNew=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
|
||||||
BIN
assets/images/6.png
Normal file
BIN
assets/images/6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 493 KiB |
@@ -188,6 +188,8 @@ class AppLink {
|
|||||||
static String loginCaptin = "$authCaptin/login.php";
|
static String loginCaptin = "$authCaptin/login.php";
|
||||||
static String signUpCaptin = "$authCaptin/register.php";
|
static String signUpCaptin = "$authCaptin/register.php";
|
||||||
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
||||||
|
static String sendVerifyOtpMessage = "$server/auth/otpmessage.php";
|
||||||
|
static String verifyOtpMessage = "$server/auth/verifyOtpMessage.php";
|
||||||
static String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
static String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
||||||
static String removeUser = "$authCaptin/removeAccount.php";
|
static String removeUser = "$authCaptin/removeAccount.php";
|
||||||
static String deletecaptainAccounr = "$authCaptin/deletecaptainAccounr.php";
|
static String deletecaptainAccounr = "$authCaptin/deletecaptainAccounr.php";
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
import 'package:SEFER/controller/auth/captin/login_captin_controller.dart';
|
||||||
|
import 'package:SEFER/views/auth/captin/register_captin.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
@@ -15,9 +16,11 @@ import 'package:SEFER/views/auth/captin/verify_email_captain.dart';
|
|||||||
import '../../../views/auth/captin/ai_page.dart';
|
import '../../../views/auth/captin/ai_page.dart';
|
||||||
import '../../../views/auth/captin/car_license_page.dart';
|
import '../../../views/auth/captin/car_license_page.dart';
|
||||||
import '../../../views/home/Captin/home_captain/home_captin.dart';
|
import '../../../views/home/Captin/home_captain/home_captin.dart';
|
||||||
|
import '../../functions/sms_egypt_controller.dart';
|
||||||
|
|
||||||
class RegisterCaptainController extends GetxController {
|
class RegisterCaptainController extends GetxController {
|
||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
|
final formKey3 = GlobalKey<FormState>();
|
||||||
|
|
||||||
TextEditingController emailController = TextEditingController();
|
TextEditingController emailController = TextEditingController();
|
||||||
TextEditingController phoneController = TextEditingController();
|
TextEditingController phoneController = TextEditingController();
|
||||||
@@ -27,6 +30,7 @@ class RegisterCaptainController extends GetxController {
|
|||||||
String birthDate = 'Birth Date'.tr;
|
String birthDate = 'Birth Date'.tr;
|
||||||
String gender = 'Male'.tr;
|
String gender = 'Male'.tr;
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
bool isSent = false;
|
||||||
late String name;
|
late String name;
|
||||||
late String licenseClass;
|
late String licenseClass;
|
||||||
late String documentNo;
|
late String documentNo;
|
||||||
@@ -62,11 +66,51 @@ class RegisterCaptainController extends GetxController {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
// Get.put(SmsEgyptController());
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
void changeGender(String value) {
|
void changeGender(String value) {
|
||||||
gender = value;
|
gender = value;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendOtpMessage() async {
|
||||||
|
SmsEgyptController smsEgyptController = Get.put(SmsEgyptController());
|
||||||
|
|
||||||
|
int randomNumber = Random().nextInt(100000) + 1;
|
||||||
|
isLoading = true;
|
||||||
|
update();
|
||||||
|
if (formKey3.currentState!.validate()) {
|
||||||
|
await CRUD().post(link: AppLink.sendVerifyOtpMessage, payload: {
|
||||||
|
'phone_number': phoneController.text,
|
||||||
|
'token_code': randomNumber.toString(),
|
||||||
|
});
|
||||||
|
|
||||||
|
await smsEgyptController.sendSmsEgypt(
|
||||||
|
phoneController.toString(), randomNumber.toString());
|
||||||
|
isSent = true;
|
||||||
|
isLoading = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
verifySMSCode() async {
|
||||||
|
if (formKey3.currentState!.validate()) {
|
||||||
|
var res = await CRUD().post(link: AppLink.verifyOtpMessage, payload: {
|
||||||
|
'phone_number': phoneController.text,
|
||||||
|
'token_code': verifyCode.text.toString(),
|
||||||
|
});
|
||||||
|
if (res != 'failure') {
|
||||||
|
// var dec = jsonDecode(res);
|
||||||
|
box.write(BoxName.phoneDriver, '+2${phoneController.text}');
|
||||||
|
Get.to(const RegisterCaptin());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sendVerifications() async {
|
sendVerifications() async {
|
||||||
var res = await CRUD().post(link: AppLink.verifyEmail, payload: {
|
var res = await CRUD().post(link: AppLink.verifyEmail, payload: {
|
||||||
'email': emailController.text.isEmpty
|
'email': emailController.text.isEmpty
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
import 'package:SEFER/main.dart';
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:SEFER/views/auth/captin/cards_egypt/egypt_card_a_i.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:google_sign_in/google_sign_in.dart';
|
import 'package:google_sign_in/google_sign_in.dart';
|
||||||
|
|
||||||
@@ -13,11 +14,18 @@ class GoogleSignInHelper {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Method to handle Google Sign-In
|
||||||
static Future<GoogleSignInAccount?> signIn() async {
|
static Future<GoogleSignInAccount?> signIn() async {
|
||||||
try {
|
try {
|
||||||
final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
final GoogleSignInAccount? googleUser = await _googleSignIn.signIn();
|
||||||
getDriverInfo();
|
if (googleUser != null) {
|
||||||
|
await _handleSignUp(googleUser);
|
||||||
|
if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||||
|
Get.to(() => EgyptCardAI());
|
||||||
|
} else if (box.read(BoxName.countryCode) == 'Jordan') {
|
||||||
Get.to(() => AiPage());
|
Get.to(() => AiPage());
|
||||||
|
}
|
||||||
|
}
|
||||||
return googleUser;
|
return googleUser;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print('Google Sign-In error: $error');
|
print('Google Sign-In error: $error');
|
||||||
@@ -25,25 +33,50 @@ class GoogleSignInHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to handle Google Sign-Out
|
||||||
static Future<void> signOut() async {
|
static Future<void> signOut() async {
|
||||||
try {
|
try {
|
||||||
await _googleSignIn.signOut();
|
await _googleSignIn.signOut();
|
||||||
|
await _handleSignOut();
|
||||||
|
print('User signed out.');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
print('Google Sign-Out error: $error');
|
print('Google Sign-Out error: $error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Method to get the current signed-in user
|
||||||
static GoogleSignInAccount? getCurrentUser() {
|
static GoogleSignInAccount? getCurrentUser() {
|
||||||
return _googleSignIn.currentUser;
|
return _googleSignIn.currentUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String? getDriverInfo() {
|
// Method to handle sign-up process
|
||||||
final GoogleSignInAccount? user = _googleSignIn.currentUser;
|
static Future<void> _handleSignUp(GoogleSignInAccount user) async {
|
||||||
box.write(BoxName.driverID, user!.id);
|
// Store driver information
|
||||||
|
box.write(BoxName.driverID, user.id);
|
||||||
box.write(BoxName.emailDriver, user.email);
|
box.write(BoxName.emailDriver, user.email);
|
||||||
box.write(BoxName.nameDriver, user.displayName);
|
box.write(BoxName.nameDriver, user.displayName);
|
||||||
box.write(BoxName.driverPhotoUrl, user.photoUrl);
|
box.write(BoxName.driverPhotoUrl, user.photoUrl);
|
||||||
print('emailDriver =${box.read(BoxName.emailDriver)}');
|
|
||||||
return user.displayName;
|
// Perform any additional sign-up tasks or API calls here
|
||||||
|
// For example, you can send the user data to your server for registration
|
||||||
|
|
||||||
|
print('driverID = ${box.read(BoxName.driverID)}');
|
||||||
|
print('emailDriver = ${box.read(BoxName.emailDriver)}');
|
||||||
|
print('nameDriver = ${box.read(BoxName.nameDriver)}');
|
||||||
|
print('driverPhotoUrl = ${box.read(BoxName.driverPhotoUrl)}');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Method to handle sign-out process
|
||||||
|
static Future<void> _handleSignOut() async {
|
||||||
|
// Clear stored driver information
|
||||||
|
box.remove(BoxName.driverID);
|
||||||
|
box.remove(BoxName.emailDriver);
|
||||||
|
box.remove(BoxName.nameDriver);
|
||||||
|
box.remove(BoxName.driverPhotoUrl);
|
||||||
|
|
||||||
|
// Perform any additional sign-out tasks or API calls here
|
||||||
|
// For example, you can notify your server about the user sign-out
|
||||||
|
|
||||||
|
print('User data cleared.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 '../../constant/colors.dart';
|
||||||
import 'gemeni.dart';
|
import 'gemeni.dart';
|
||||||
import 'llama_ai.dart';
|
import 'llama_ai.dart';
|
||||||
import 'upload_image.dart';
|
import 'upload_image.dart';
|
||||||
@@ -246,6 +247,10 @@ class CRUD {
|
|||||||
if (jsonData['status'] == 'success') {
|
if (jsonData['status'] == 'success') {
|
||||||
return response.body;
|
return response.body;
|
||||||
} else {
|
} else {
|
||||||
|
String errorMessage = jsonData['message'];
|
||||||
|
Get.snackbar('Erroe'.tr, errorMessage.tr,
|
||||||
|
backgroundColor: AppColor.redColor);
|
||||||
|
print(errorMessage.tr);
|
||||||
return (jsonData['status']);
|
return (jsonData['status']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
|
import 'package:SEFER/constant/links.dart';
|
||||||
|
import 'package:SEFER/constant/style.dart';
|
||||||
import 'package:SEFER/controller/functions/crud.dart';
|
import 'package:SEFER/controller/functions/crud.dart';
|
||||||
|
import 'package:SEFER/main.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:image_cropper/image_cropper.dart';
|
import 'package:image_cropper/image_cropper.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
@@ -10,17 +15,270 @@ import 'package:path_provider/path_provider.dart';
|
|||||||
|
|
||||||
import '../../constant/api_key.dart';
|
import '../../constant/api_key.dart';
|
||||||
import '../../constant/colors.dart';
|
import '../../constant/colors.dart';
|
||||||
|
import 'tts.dart';
|
||||||
import 'upload_image.dart';
|
import 'upload_image.dart';
|
||||||
|
|
||||||
class AI extends GetxController {
|
class AI extends GetxController {
|
||||||
|
bool approved = false;
|
||||||
|
|
||||||
|
void setApproved() {
|
||||||
|
approved = true;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
final today = DateTime.now();
|
||||||
|
|
||||||
|
Future<void> addDriverAndCarEgypt() async {
|
||||||
|
final expiryDate = responseIdEgyptDriverLicense['expiry_date'];
|
||||||
|
final expiryDateTime = DateTime.tryParse(expiryDate);
|
||||||
|
final isExpired = expiryDateTime != null && expiryDateTime.isBefore(today);
|
||||||
|
|
||||||
|
final taxExpiryDate = responseIdCardDriverEgyptBack['tax_expiry'];
|
||||||
|
|
||||||
|
// Get the inspection date from the response
|
||||||
|
final inspectionDate = responseIdCardDriverEgyptBack['inspection_date'];
|
||||||
|
|
||||||
|
// Try parsing the tax expiry date. If it fails, set it to null.
|
||||||
|
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate ?? '');
|
||||||
|
final isExpiredCar =
|
||||||
|
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
|
||||||
|
|
||||||
|
// Check if the inspection date is before today
|
||||||
|
final inspectionDateTime = DateTime(int.parse(inspectionDate ?? ''), 1, 1);
|
||||||
|
final isInspectionExpired = inspectionDateTime.isBefore(today);
|
||||||
|
|
||||||
|
if (isExpiredCar || isInspectionExpired) {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'Expired Driver’s License'.tr,
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.warning, size: 48, color: Colors.red),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'Your driver’s license and/or car tax has expired. Please renew them before proceeding.'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await Get.find<TextToSpeechController>().speakText(
|
||||||
|
'Your driver’s license and/or car tax has expired. Please renew them before proceeding.'
|
||||||
|
.tr,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.volume_up),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else if (isExpired) {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title: 'Expired Driver’s License'.tr,
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.warning, size: 48, color: Colors.red),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'Your driver’s license has expired. Please renew it before proceeding.'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await Get.find<TextToSpeechController>().speakText(
|
||||||
|
'Your driver’s license has expired. Please renew it before proceeding.'
|
||||||
|
.tr,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.volume_up),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else if (responseIdEgyptDriverLicense['national_number'] !=
|
||||||
|
responseIdEgyptBack['nationalID']) {
|
||||||
|
Get.defaultDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
title: 'ID Mismatch',
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.warning, size: 48, color: Colors.red),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'The national number on your driver’s license does not match the one on your ID document. Please verify and provide the correct documents.'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await Get.find<TextToSpeechController>().speakText(
|
||||||
|
'The national number on your driver’s license does not match the one on your ID document. Please verify and provide the correct documents.',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.volume_up),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else if (responseCriminalRecordEgypt['FullName'] !=
|
||||||
|
responseIdEgyptDriverLicense['name_arabic']) {
|
||||||
|
Get.defaultDialog(
|
||||||
|
barrierDismissible: false,
|
||||||
|
title: 'Criminal Record Mismatch',
|
||||||
|
content: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Icon(Icons.warning, size: 48, color: Colors.red),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Text(
|
||||||
|
'The full name on your criminal record does not match the one on your driver’s license. Please verify and provide the correct documents.'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await Get.find<TextToSpeechController>().speakText(
|
||||||
|
'The full name on your criminal record does not match the one on your driver’s license. Please verify and provide the correct documents.'
|
||||||
|
.tr,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.volume_up),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
},
|
||||||
|
child: const Text('OK'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
isLoading = true;
|
||||||
|
update();
|
||||||
|
await addDriverEgypt();
|
||||||
|
await addRegistrationCarEgypt();
|
||||||
|
isLoading = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> addDriverEgypt() async {
|
||||||
|
try {
|
||||||
|
var res = await CRUD().post(link: AppLink.signUpCaptin, payload: {
|
||||||
|
'first_name': responseIdEgyptDriverLicense['firstName'],
|
||||||
|
'last_name': responseIdEgyptDriverLicense['lastName'],
|
||||||
|
'email': box.read(BoxName.emailDriver),
|
||||||
|
'phone': '78787', //todo add phone //box.read(BoxName.phoneDriver),
|
||||||
|
'driverId': box.read(BoxName.driverID),
|
||||||
|
'password': '123456', // todo check
|
||||||
|
'gender': responseIdEgyptBack['gender'] == 'ذكر' ? 'Male' : 'Female',
|
||||||
|
'license_type': responseIdEgyptDriverLicense['license_type'],
|
||||||
|
'national_number': responseIdEgyptBack['nationalID'],
|
||||||
|
'name_arabic': responseIdEgyptDriverLicense['name_arabic'],
|
||||||
|
'name_english': responseIdEgyptDriverLicense['name_english'],
|
||||||
|
'issue_date': responseIdEgyptDriverLicense['issue_date'],
|
||||||
|
'expiry_date': responseIdEgyptDriverLicense['expiry_date'],
|
||||||
|
'license_categories':
|
||||||
|
responseIdEgyptDriverLicense['license_categories'],
|
||||||
|
'address': responseIdEgyptFront['address'],
|
||||||
|
'card_id': responseIdEgyptFront['card_id'],
|
||||||
|
'occupation': responseIdEgyptBack['occupation'],
|
||||||
|
'education': responseIdEgyptBack['occupation'],
|
||||||
|
'licenseIssueDate': responseIdEgyptDriverLicense['issue_date'],
|
||||||
|
'religion': responseIdEgyptBack['religion'],
|
||||||
|
'status': responseIdEgyptBack['fullName'],
|
||||||
|
'birthdate': responseIdEgyptFront['dob'] + '-01-01',
|
||||||
|
'maritalStatus': responseIdEgyptBack['maritalStatus'],
|
||||||
|
'site': responseIdEgyptDriverLicense['address'],
|
||||||
|
'employmentType': responseIdEgyptDriverLicense['employmentType'],
|
||||||
|
});
|
||||||
|
var status = jsonDecode(res);
|
||||||
|
if (status == 'success') {
|
||||||
|
Get.snackbar('Success', 'message',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('error is $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future addRegistrationCarEgypt() async {
|
||||||
|
try {
|
||||||
|
var res = await CRUD().post(link: AppLink.addRegisrationCar, payload: {
|
||||||
|
'driverID': box.read(BoxName.driverID),
|
||||||
|
'vin': responseIdCardDriverEgyptBack['chassis'].toString(),
|
||||||
|
'car_plate': responseIdCardDriverEgyptFront['car_plate'].toString(),
|
||||||
|
'make': responseIdCardDriverEgyptBack['make'].toString(),
|
||||||
|
'model': responseIdCardDriverEgyptBack['model'],
|
||||||
|
'year': responseIdCardDriverEgyptBack['year'].toString(),
|
||||||
|
'expiration_date':
|
||||||
|
responseIdCardDriverEgyptFront['LicenseExpirationDate'].toString(),
|
||||||
|
'color': responseIdCardDriverEgyptBack['color'],
|
||||||
|
'owner': responseIdCardDriverEgyptFront['owner'],
|
||||||
|
'color_hex': responseIdCardDriverEgyptBack['color_hex'].toString(),
|
||||||
|
'address': responseIdCardDriverEgyptFront['address'].toString(),
|
||||||
|
'displacement': responseIdCardDriverEgyptBack['engine'].toString(),
|
||||||
|
'fuel': responseIdCardDriverEgyptBack['fuel'].toString(),
|
||||||
|
'registration_date':
|
||||||
|
'${responseIdCardDriverEgyptBack['inspection_date']}-01-01',
|
||||||
|
});
|
||||||
|
var status = jsonDecode(res);
|
||||||
|
if (status == 'success') {
|
||||||
|
Get.snackbar('Success', 'message',
|
||||||
|
backgroundColor: AppColor.greenColor);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('error is $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final picker = ImagePicker();
|
final picker = ImagePicker();
|
||||||
Map<String, dynamic> responseMap = {};
|
Map<String, dynamic> responseMap = {};
|
||||||
Map<String, dynamic> responseCarLicenseMap = {};
|
Map<String, dynamic> responseCarLicenseMapJordan = {};
|
||||||
Map<String, dynamic> responseBackCarLicenseMap = {};
|
Map<String, dynamic> responseBackCarLicenseMap = {};
|
||||||
Map<String, dynamic> responseIdCardMap = {};
|
Map<String, dynamic> responseIdCardMap = {};
|
||||||
Map<String, dynamic> responseIdCardDriverEgyptBack = {};
|
Map<String, dynamic> responseIdCardDriverEgyptBack = {};
|
||||||
Map<String, dynamic> responseIdCardDriverEgyptFront = {};
|
Map<String, dynamic> responseIdCardDriverEgyptFront = {};
|
||||||
Map<String, dynamic> responseIdEgyptFront = {};
|
Map<String, dynamic> responseIdEgyptFront = {};
|
||||||
|
Map<String, dynamic> responseCriminalRecordEgypt = {};
|
||||||
Map<String, dynamic> responseIdEgyptBack = {};
|
Map<String, dynamic> responseIdEgyptBack = {};
|
||||||
Map<String, dynamic> responseIdEgyptDriverLicense = {};
|
Map<String, dynamic> responseIdEgyptDriverLicense = {};
|
||||||
String? responseIdCardDriverEgypt1;
|
String? responseIdCardDriverEgypt1;
|
||||||
@@ -87,7 +345,7 @@ class AI extends GetxController {
|
|||||||
var json = jsonDecode(extractedString);
|
var json = jsonDecode(extractedString);
|
||||||
var textValues = CRUD().extractTextFromLines(json);
|
var textValues = CRUD().extractTextFromLines(json);
|
||||||
print(textValues);
|
print(textValues);
|
||||||
// await Get.put(AI()).geminiAiExtraction(prompt, textValues);
|
// await Get.put(AI()).geminiAiExtraction(prompt, textValues, imagePath);
|
||||||
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
|
await Get.put(AI()).anthropicAI(textValues, prompt, imagePath);
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
update();
|
update();
|
||||||
@@ -238,6 +496,10 @@ class AI extends GetxController {
|
|||||||
responseIdEgyptDriverLicense =
|
responseIdEgyptDriverLicense =
|
||||||
jsonDecode(responseData['content'][0]['text']);
|
jsonDecode(responseData['content'][0]['text']);
|
||||||
print(responseIdEgyptDriverLicense);
|
print(responseIdEgyptDriverLicense);
|
||||||
|
} else if (idType == 'criminalRecord') {
|
||||||
|
responseCriminalRecordEgypt =
|
||||||
|
jsonDecode(responseData['content'][0]['text']);
|
||||||
|
print(responseCriminalRecordEgypt);
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
@@ -246,7 +508,7 @@ class AI extends GetxController {
|
|||||||
return responseIdCardDriverEgyptBack.toString();
|
return responseIdCardDriverEgyptBack.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> geminiAiExtraction(String prompt, payload) async {
|
Future<void> geminiAiExtraction(String prompt, payload, String idType) async {
|
||||||
var requestBody = jsonEncode({
|
var requestBody = jsonEncode({
|
||||||
"contents": [
|
"contents": [
|
||||||
{
|
{
|
||||||
@@ -309,11 +571,28 @@ class AI extends GetxController {
|
|||||||
// Convert the JSON object to a String
|
// Convert the JSON object to a String
|
||||||
jsonString = jsonEncode(json.decode(jsonString));
|
jsonString = jsonEncode(json.decode(jsonString));
|
||||||
|
|
||||||
|
if (idType == 'car_back') {
|
||||||
responseIdCardDriverEgyptBack = jsonDecode(jsonString);
|
responseIdCardDriverEgyptBack = jsonDecode(jsonString);
|
||||||
print(responseIdCardDriverEgyptBack);
|
print(responseIdCardDriverEgyptBack);
|
||||||
|
} else if (idType == 'car_front') {
|
||||||
|
responseIdCardDriverEgyptFront = jsonDecode(jsonString);
|
||||||
|
print(responseIdCardDriverEgyptFront);
|
||||||
|
} else if (idType == 'id_front') {
|
||||||
|
responseIdEgyptFront = jsonDecode(jsonString);
|
||||||
|
print(responseIdEgyptFront);
|
||||||
|
} else if (idType == 'id_back') {
|
||||||
|
responseIdEgyptBack = jsonDecode(jsonString);
|
||||||
|
print(responseIdEgyptBack);
|
||||||
|
} else if (idType == 'driver_license') {
|
||||||
|
responseIdEgyptDriverLicense = jsonDecode(jsonString);
|
||||||
|
print(responseIdEgyptDriverLicense);
|
||||||
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
} else {
|
} else {
|
||||||
print("JSON string not found");
|
print("JSON string not found");
|
||||||
|
Get.snackbar('Error', "JSON string not found",
|
||||||
|
backgroundColor: AppColor.redColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rest of your code...
|
// Rest of your code...
|
||||||
@@ -503,10 +782,10 @@ Output the extracted information in the following JSON format''',
|
|||||||
if (jsonString != null) {
|
if (jsonString != null) {
|
||||||
// Convert the JSON object to a String
|
// Convert the JSON object to a String
|
||||||
jsonString = jsonEncode(json.decode(jsonString));
|
jsonString = jsonEncode(json.decode(jsonString));
|
||||||
responseCarLicenseMap = jsonDecode(jsonString);
|
responseCarLicenseMapJordan = jsonDecode(jsonString);
|
||||||
print(jsonString);
|
print(jsonString);
|
||||||
print(responseCarLicenseMap);
|
print(responseCarLicenseMapJordan);
|
||||||
print(responseCarLicenseMap['plate_number']);
|
print(responseCarLicenseMapJordan['plate_number']);
|
||||||
} else {
|
} else {
|
||||||
print("JSON string not found");
|
print("JSON string not found");
|
||||||
}
|
}
|
||||||
@@ -604,10 +883,10 @@ Output the extracted information in the following JSON format''',
|
|||||||
if (jsonString != null) {
|
if (jsonString != null) {
|
||||||
// Convert the JSON object to a String
|
// Convert the JSON object to a String
|
||||||
jsonString = jsonEncode(json.decode(jsonString));
|
jsonString = jsonEncode(json.decode(jsonString));
|
||||||
responseCarLicenseMap = jsonDecode(jsonString);
|
responseCarLicenseMapJordan = jsonDecode(jsonString);
|
||||||
print(jsonString);
|
print(jsonString);
|
||||||
print(responseCarLicenseMap);
|
print(responseCarLicenseMapJordan);
|
||||||
print(responseCarLicenseMap['plate_number']);
|
print(responseCarLicenseMapJordan['plate_number']);
|
||||||
} else {
|
} else {
|
||||||
print("JSON string not found");
|
print("JSON string not found");
|
||||||
}
|
}
|
||||||
@@ -714,10 +993,10 @@ Output the extracted information in the following JSON formate and make date for
|
|||||||
if (jsonString != null) {
|
if (jsonString != null) {
|
||||||
// Convert the JSON object to a String
|
// Convert the JSON object to a String
|
||||||
jsonString = jsonEncode(json.decode(jsonString));
|
jsonString = jsonEncode(json.decode(jsonString));
|
||||||
responseCarLicenseMap = jsonDecode(jsonString);
|
responseCarLicenseMapJordan = jsonDecode(jsonString);
|
||||||
print(jsonString);
|
print(jsonString);
|
||||||
print(responseCarLicenseMap);
|
print(responseCarLicenseMapJordan);
|
||||||
print(responseCarLicenseMap['plate_number']);
|
print(responseCarLicenseMapJordan['plate_number']);
|
||||||
} else {
|
} else {
|
||||||
print("JSON string not found");
|
print("JSON string not found");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:SEFER/constant/api_key.dart';
|
import 'package:SEFER/constant/api_key.dart';
|
||||||
import 'package:SEFER/constant/box_name.dart';
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
import 'package:SEFER/constant/info.dart';
|
import 'package:SEFER/constant/info.dart';
|
||||||
@@ -7,22 +9,28 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class SmsEgypt extends GetxController {
|
class SmsEgyptController extends GetxController {
|
||||||
var headers = {'Content-Type': 'application/json'};
|
var headers = {'Content-Type': 'application/json'};
|
||||||
|
|
||||||
Future sendSmsEgypt(String phone, otp) async {
|
Future<dynamic> sendSmsEgypt(String phone, otp) async {
|
||||||
var res = await http.post(
|
var body = jsonEncode({
|
||||||
Uri.parse(AppLink.sendSms),
|
|
||||||
body: {
|
|
||||||
"username": AppInformation.appName,
|
"username": AppInformation.appName,
|
||||||
"password": AK.smsPassword,
|
"password": AK.smsPassword,
|
||||||
"message": "${AppInformation.appName} app code is $otp\ncopy it to app",
|
"message": "${AppInformation.appName} app code is $otp\ncopy it to app",
|
||||||
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
|
"language": box.read(BoxName.lang) == 'en' ? "e" : 'r',
|
||||||
"sender": "Kazumi", // todo add sefer sender name
|
"sender": "Kazumi", // todo add sefer sender name
|
||||||
"receiver": "2$phone"
|
"receiver": "2$phone"
|
||||||
},
|
});
|
||||||
|
|
||||||
|
var res = await http.post(
|
||||||
|
Uri.parse(AppLink.sendSms),
|
||||||
|
body: body,
|
||||||
headers: headers,
|
headers: headers,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
print(res.reasonPhrase);
|
||||||
|
print(res.request);
|
||||||
|
print(res.body);
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'You will recieve code in sms message'.tr,
|
title: 'You will recieve code in sms message'.tr,
|
||||||
@@ -6,7 +6,7 @@ import 'package:get/get.dart';
|
|||||||
|
|
||||||
class TextToSpeechController extends GetxController {
|
class TextToSpeechController extends GetxController {
|
||||||
final flutterTts = FlutterTts();
|
final flutterTts = FlutterTts();
|
||||||
|
bool isComplete = false;
|
||||||
// Initialize TTS in initState
|
// Initialize TTS in initState
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@@ -41,6 +41,8 @@ class TextToSpeechController extends GetxController {
|
|||||||
if (result == 1) {
|
if (result == 1) {
|
||||||
// TTS operation has started
|
// TTS operation has started
|
||||||
// You can perform additional operations here, if needed
|
// You can perform additional operations here, if needed
|
||||||
|
isComplete = true;
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Handle error gracefully, e.g., show a message
|
// Handle error gracefully, e.g., show a message
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:SEFER/views/auth/login_page.dart';
|
|||||||
import '../../constant/box_name.dart';
|
import '../../constant/box_name.dart';
|
||||||
import '../../main.dart';
|
import '../../main.dart';
|
||||||
import '../../onbording_page.dart';
|
import '../../onbording_page.dart';
|
||||||
|
import '../../views/auth/captin/cards_egypt/sms_signup.dart';
|
||||||
import '../../views/auth/captin/login_captin.dart';
|
import '../../views/auth/captin/login_captin.dart';
|
||||||
import '../../views/home/Captin/home_captain/home_captin.dart';
|
import '../../views/home/Captin/home_captain/home_captin.dart';
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ class SplashScreenController extends GetxController
|
|||||||
box.read(BoxName.onBoarding) == null
|
box.read(BoxName.onBoarding) == null
|
||||||
? Get.off(() => OnBoardingPage())
|
? Get.off(() => OnBoardingPage())
|
||||||
: box.read(BoxName.emailDriver) != null
|
: box.read(BoxName.emailDriver) != null
|
||||||
? Get.off(() => RegisterCaptin())
|
? Get.off(() => SmsSignupEgypt())
|
||||||
: Get.off(() => LoginCaptin());
|
: Get.off(() => LoginCaptin());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,70 @@ class MyTranslation extends Translations {
|
|||||||
@override
|
@override
|
||||||
Map<String, Map<String, String>> get keys => {
|
Map<String, Map<String, String>> get keys => {
|
||||||
"ar": {
|
"ar": {
|
||||||
|
'You will recieve code in sms message': '',
|
||||||
|
'Please enter': '',
|
||||||
|
'We need your phone number to contact you and to help you receive orders.':
|
||||||
|
"نحتاج إلى رقم هاتفك للتواصل معك ولمساعدتك في تلقي الطلبات.",
|
||||||
|
'The full name on your criminal record does not match the one on your driver’s license. Please verify and provide the correct documents.':
|
||||||
|
'الاسم الكامل في سجلك الجنائي لا يتطابق مع الاسم الموجود في رخصة القيادة الخاصة بك. يرجى التحقق وتقديم الوثائق الصحيحة.',
|
||||||
|
"The national number on your driver’s license does not match the one on your ID document. Please verify and provide the correct documents.":
|
||||||
|
"الرقم الوطني على رخصة القيادة الخاصة بك لا يتطابق مع الرقم الموجود على وثيقة الهوية الخاصة بك. يرجى التحقق وتقديم الوثائق الصحيحة.",
|
||||||
|
"Capture an Image of Your Criminal Record":
|
||||||
|
"التقط صورة لسجلك الجنائي",
|
||||||
|
"IssueDate": "تاريخ الإصدار",
|
||||||
|
"Capture an Image of Your car license front ":
|
||||||
|
"التقط صورة للواجهة الأمامية لرخصة سيارتك",
|
||||||
|
"Capture an Image of Your ID Document front":
|
||||||
|
"التقط صورة للواجهة الأمامية لوثيقة هويتك",
|
||||||
|
"NationalID": "الرقم القومي",
|
||||||
|
"FullName": "الاسم الكامل",
|
||||||
|
"InspectionResult": "نتيجة الفحص",
|
||||||
|
"Criminal Record": "السجل الجنائي",
|
||||||
|
"The email or phone number is already registered.":
|
||||||
|
"البريد الإلكتروني أو رقم الهاتف مسجل بالفعل.",
|
||||||
|
'To become a ride-sharing driver on the Sefer app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Sefer app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.':
|
||||||
|
'لِتُصْبِحَ سَائِقَاً لِلرُّكوبِ المُشْتَرَكِ عَلَى تَطْبِيق سَفَر، يَجِبُ عَلَيْكَ تَحْمِيل رُخْصَةِ القِيَادَةِ، وَثِيقَةِ الهُوِيَّةِ، وَوَثِيقَةَ تَسْجِيل السَّيَّارَةِ. سَيَقُومُ نِظَامُ الذَّكَاءِ الاِصْطِنَاعِيِّ لَدَيْنَا بِمُرَاجَعَةِ وَتَحْقِيقِ صِحَّةِ الوَثَائِقِ فِي غُضُونِ ٢-٣ دَقَائِقَ فَقَطْ. إِذَا تَمَّتْ المُوَافَقَةُ عَلَى وَثَائِقِكَ، يُمْكِنُكَ البَدْءُ فِي العَمَلِ كَسَائِقٍ عَلَى تَطْبِيق سَفَر. يُرْجَى مُلَاحَظَةُ، تَقْدِيمُ وَثَائِقَ مُزَورَةٍ يُعَدُّ جَرِيمَةً خَطِيرَةً وَقَدْ يَتَرَتَّبُ عَلَيْهِ اِنهَاءُ الحِسَابِ فَوْرِيَّاً وَعَوَاقِبُ قَانُونِيَّة.',
|
||||||
|
"Documents check": "فحص الوثائق",
|
||||||
|
"Driver's License": "رخصة القيادة",
|
||||||
|
"License Type": "نوع الرخصة",
|
||||||
|
"National Number": "الرقم الوطني",
|
||||||
|
"Name (Arabic)": "الاسم بالعربي",
|
||||||
|
"Name (English)": "الاسم بالإنجليزية",
|
||||||
|
"Address": "العنوان",
|
||||||
|
"Issue Date": "تاريخ الإصدار",
|
||||||
|
"Expiry Date": "تاريخ الانتهاء",
|
||||||
|
"License Categories": "فئات الرخصة",
|
||||||
|
"driver_license": "رخصة القيادة",
|
||||||
|
"Capture an Image of Your Driver License": "التقط صورة لرخصة قيادتك",
|
||||||
|
"ID Documents Back": "الوجه الخلفي لوثائق الهوية",
|
||||||
|
"National ID": "البطاقة الوطنية",
|
||||||
|
"Occupation": "المهنة",
|
||||||
|
"Gender": "الجنس",
|
||||||
|
"Religion": "الديانة",
|
||||||
|
"Marital Status": "الحالة الاجتماعية",
|
||||||
|
"Full Name (Marital)": "الاسم الكامل (حسب الحالة الاجتماعية)",
|
||||||
|
"Expiration Date": "تاريخ الانتهاء",
|
||||||
|
"Capture an Image of Your ID Document Back":
|
||||||
|
"التقط صورة للوجه الخلفي لوثيقة الهوية الخاصة بك",
|
||||||
|
"ID Documents Front": "الوجه الأمامي لوثائق الهوية",
|
||||||
|
"First Name": "الاسم الأول",
|
||||||
|
"CardID": "رقم البطاقة",
|
||||||
|
"Full Name": "الاسم الكامل",
|
||||||
|
"Vehicle Details Front": "تفاصيل المركبة الوجه الأمامية",
|
||||||
|
"Plate Number": "رقم اللوحة",
|
||||||
|
"Owner Name": "اسم المالك",
|
||||||
|
"Vehicle Details Back": "تفاصيل المركبة الوجه الخلفي",
|
||||||
|
"Make": "المصنع",
|
||||||
|
"Model": "الطراز",
|
||||||
|
"Year": "السنة",
|
||||||
|
"Chassis": "الشاسيه",
|
||||||
|
"Color": "اللون",
|
||||||
|
"Displacement": "السعة",
|
||||||
|
"Fuel": "الوقود",
|
||||||
|
"Tax Expiry Date": "تاريخ انتهاء الضريبة",
|
||||||
|
"Inspection Date": "تاريخ الفحص",
|
||||||
|
"Capture an Image of Your car license back":
|
||||||
|
"التقط صورة للوجه الخلفي لرخصة سيارتك",
|
||||||
'Capture an Image of Your Driver’s License':
|
'Capture an Image of Your Driver’s License':
|
||||||
'التقط صورة لرخصة قيادتك',
|
'التقط صورة لرخصة قيادتك',
|
||||||
'Sign in with Google for easier email and name entry':
|
'Sign in with Google for easier email and name entry':
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ class AiPage extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [
|
children: [
|
||||||
egyptDriverLicense(),
|
// egyptDriverLicense(),
|
||||||
egyptCarLicenceFront(),
|
// egyptCarLicenceFront(),
|
||||||
egyptCarLicenceBack(),
|
// egyptCarLicenceBack(),
|
||||||
egyptDriverIDFront(),
|
// egyptDriverIDFront(),
|
||||||
egyptDriverIDBack(),
|
// egyptDriverIDBack(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -46,506 +46,6 @@ class AiPage extends StatelessWidget {
|
|||||||
isleading: true);
|
isleading: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
GetBuilder<AI> egyptDriverLicense() {
|
|
||||||
return GetBuilder<AI>(
|
|
||||||
builder: (ai) {
|
|
||||||
if (ai.responseIdEgyptDriverLicense.isNotEmpty) {
|
|
||||||
final expiryDate = ai.responseIdEgyptDriverLicense['expiry_date'];
|
|
||||||
|
|
||||||
// Check if the expiry date is before today
|
|
||||||
final today = DateTime.now();
|
|
||||||
|
|
||||||
// Try parsing the expiry date. If it fails, set it to null.
|
|
||||||
final expiryDateTime = DateTime.tryParse(expiryDate);
|
|
||||||
final isExpired =
|
|
||||||
expiryDateTime != null && expiryDateTime.isBefore(today);
|
|
||||||
|
|
||||||
return Card(
|
|
||||||
elevation: 4.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('Driver\'s License'.tr, style: AppStyle.headTitle2),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
const Divider(color: AppColor.accentColor),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'License Type'.tr}: ${ai.responseIdEgyptDriverLicense['license_type']}',
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'National Number'.tr}: ${ai.responseIdEgyptDriverLicense['national_number']}',
|
|
||||||
style: AppStyle.title.copyWith(
|
|
||||||
color: ai.responseIdEgyptDriverLicense[
|
|
||||||
'national_number'] ==
|
|
||||||
ai.responseIdEgyptBack['nationalID']
|
|
||||||
? AppColor.greenColor
|
|
||||||
: AppColor.redColor),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Name (Arabic)'.tr}: ${ai.responseIdEgyptDriverLicense['name_arabic']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Name (English)'.tr}: ${ai.responseIdEgyptDriverLicense['name_english']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Address'.tr}: ${ai.responseIdEgyptDriverLicense['address']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Issue Date'.tr}: ${ai.responseIdEgyptDriverLicense['issue_date']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Expiry Date'.tr}: ${ai.responseIdEgyptDriverLicense['expiry_date']}',
|
|
||||||
style: AppStyle.title.copyWith(
|
|
||||||
color:
|
|
||||||
!isExpired ? AppColor.greenColor : AppColor.redColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'License Categories'.tr}: ${ai.responseIdEgyptDriverLicense['license_categories']}',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
await ai.allMethodForAI(
|
|
||||||
'''Write a JSON object from the following information extracted from the provided Arabic text:license_type,national_number,name_arabic,name_english,address,issue_date,expiry_date,license_categories.and (date formate year-month-day in latin numbers) ''',
|
|
||||||
AppLink.uploadEgypt,
|
|
||||||
'driver_license'); //egypt
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/5.png',
|
|
||||||
height: Get.height * .25,
|
|
||||||
width: double.maxFinite,
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Capture an Image of Your Driver License'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBuilder<AI> egyptDriverIDBack() {
|
|
||||||
return GetBuilder<AI>(
|
|
||||||
builder: (ai) {
|
|
||||||
if (ai.responseIdEgyptBack.isNotEmpty) {
|
|
||||||
final taxExpiryDate = ai.responseIdEgyptBack['expirationDate'];
|
|
||||||
|
|
||||||
// Check if the tax expiry date is before today
|
|
||||||
final today = DateTime.now();
|
|
||||||
|
|
||||||
// Try parsing the tax expiry date. If it fails, set it to null.
|
|
||||||
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate);
|
|
||||||
final isExpired =
|
|
||||||
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
|
|
||||||
|
|
||||||
return Card(
|
|
||||||
elevation: 4.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('ID Documents Back'.tr, style: AppStyle.headTitle2),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
const Divider(color: AppColor.accentColor),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
// Assuming these keys exist in ai.responseIdEgyptFront
|
|
||||||
Text(
|
|
||||||
'${'National ID'.tr}: ${ai.responseIdEgyptBack['nationalID']}',
|
|
||||||
style: AppStyle.title),
|
|
||||||
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Occupation'.tr}: ${ai.responseIdEgyptBack['occupation']}', // Assuming 'occupation' exists
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Issue Date'.tr}: ${ai.responseIdEgyptBack['issueDate']}', // Assuming 'issueDate' exists
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${'Gender'.tr}: ${ai.responseIdEgyptBack['gender']}', // Assuming 'gender' exists
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Religion'.tr}: ${ai.responseIdEgyptBack['religion']}', // Assuming 'religion' exists
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${'Marital Status'.tr}: ${ai.responseIdEgyptBack['maritalStatus']}', // Assuming 'maritalStatus' exists
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Full Name (Marital)'.tr}: ${ai.responseIdEgyptBack['fullNameMaritial']}', // Assuming 'fullNameMaritial' exists
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Expiration Date'.tr}: ${ai.responseIdEgyptBack['expirationDate']}', // Assuming 'expirationDate' exists
|
|
||||||
style: AppStyle.title.copyWith(
|
|
||||||
color: !isExpired
|
|
||||||
? AppColor.greenColor
|
|
||||||
: AppColor.redColor),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
await ai.allMethodForAI(
|
|
||||||
'''Write a JSON from the following information extracted from the provided Arabic text:nationalID,issueDate,occupation,gender,religion,maritalStatus,fullNameMaritial if(أعزب)=none ,expirationDate.and (date formate year-month-day in latin numbers) ''',
|
|
||||||
AppLink.uploadEgypt,
|
|
||||||
'id_back'); //egypt
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/2.png',
|
|
||||||
height: Get.height * .25,
|
|
||||||
width: double.maxFinite,
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Capture an Image of Your ID Document Back'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBuilder<AI> egyptDriverIDFront() {
|
|
||||||
return GetBuilder<AI>(
|
|
||||||
builder: (ai) {
|
|
||||||
if (ai.responseIdEgyptFront.isNotEmpty) {
|
|
||||||
return Card(
|
|
||||||
elevation: 4.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('ID Documents Front'.tr, style: AppStyle.headTitle2),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
const Divider(color: AppColor.accentColor),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
// Removed Make, Model, etc. as they are not available
|
|
||||||
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'First Name'.tr}: ${ai.responseIdEgyptFront['first_name']}',
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${'CardID'.tr}: ${ai.responseIdEgyptFront['card_id']}',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Full Name'.tr}: ${ai.responseIdEgyptFront['full_name']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Address'.tr}: ${ai.responseIdEgyptFront['address']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'National Number'.tr}: ${ai.responseIdEgyptFront['national_number']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
|
|
||||||
// Removed Inspection Date as it's not available
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
await ai.allMethodForAI(
|
|
||||||
'''Write a JSON object from the following information extracted from the provided Arabic text:first_name: The word next to "بطاقة تحقيق الشخصية" (National Identification Card).full_name: The full name on the next line after the first name.address: The complete address spanning the next two lines.national_number: The Arabic numeral representing the National ID number before the last line.card_id: The card ID in English on the last line ''',
|
|
||||||
AppLink.uploadEgypt,
|
|
||||||
'id_front'); //egypt
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/1.png',
|
|
||||||
height: Get.height * .25,
|
|
||||||
width: double.maxFinite,
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Capture an Image of Your ID Document front'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBuilder<AI> egyptCarLicenceFront() {
|
|
||||||
return GetBuilder<AI>(
|
|
||||||
builder: (ai) {
|
|
||||||
if (ai.responseIdCardDriverEgyptFront.isNotEmpty) {
|
|
||||||
// No need to access ai.responseIdCardDriverEgyptBack anymore
|
|
||||||
final licenseExpiryDate = DateTime.parse(
|
|
||||||
ai.responseIdCardDriverEgyptFront['LicenseExpirationDate']);
|
|
||||||
|
|
||||||
// Check if license has expired
|
|
||||||
final today = DateTime.now();
|
|
||||||
final isLicenseExpired = licenseExpiryDate.isBefore(today);
|
|
||||||
|
|
||||||
return Card(
|
|
||||||
elevation: 4.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('Vehicle Details Front'.tr, style: AppStyle.headTitle2),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
const Divider(color: AppColor.accentColor),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
// Removed Make, Model, etc. as they are not available
|
|
||||||
|
|
||||||
Text(
|
|
||||||
'${'Plate Number'.tr}: ${ai.responseIdCardDriverEgyptFront['car_plate']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Owner Name'.tr}: ${ai.responseIdCardDriverEgyptFront['owner']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Address'.tr}: ${ai.responseIdCardDriverEgyptFront['address']}',
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'License Expiry Date'.tr}: ${licenseExpiryDate.toString().substring(0, 10)}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: isLicenseExpired ? Colors.red : Colors.green,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Removed Fuel as it's not available
|
|
||||||
],
|
|
||||||
),
|
|
||||||
// Removed Inspection Date as it's not available
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
ai.allMethodForAI(
|
|
||||||
'extract all fields as json for keys[LicenseExpirationDate,car_plate,owner,address] replace | by space,and date formate year-month-day',
|
|
||||||
AppLink.uploadEgypt,
|
|
||||||
'car_front');
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/3.png',
|
|
||||||
height: Get.height * .25,
|
|
||||||
width: double.maxFinite,
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Capture an Image of Your car license front '.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBuilder<AI> egyptCarLicenceBack() {
|
|
||||||
return GetBuilder<AI>(
|
|
||||||
builder: (ai) {
|
|
||||||
if (ai.responseIdCardDriverEgyptBack.isNotEmpty) {
|
|
||||||
// print(ai.responseIdCardDriverEgyptBack);
|
|
||||||
|
|
||||||
// Get the tax expiry date from the response
|
|
||||||
final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry'];
|
|
||||||
|
|
||||||
// Get the inspection date from the response
|
|
||||||
final inspectionDate =
|
|
||||||
ai.responseIdCardDriverEgyptBack['inspection_date'];
|
|
||||||
|
|
||||||
// Check if the tax expiry date is before today
|
|
||||||
final today = DateTime.now();
|
|
||||||
|
|
||||||
// Try parsing the tax expiry date. If it fails, set it to null.
|
|
||||||
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate);
|
|
||||||
final isExpired =
|
|
||||||
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
|
|
||||||
|
|
||||||
// Check if the inspection date is before today
|
|
||||||
final inspectionDateTime = DateTime(int.parse(inspectionDate), 1, 1);
|
|
||||||
final isInspectionExpired = inspectionDateTime.isBefore(today);
|
|
||||||
|
|
||||||
return Card(
|
|
||||||
elevation: 4.0,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('Vehicle Details Back'.tr, style: AppStyle.headTitle2),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
const Divider(color: AppColor.accentColor),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Make'.tr}: ${ai.responseIdCardDriverEgyptBack['make']}'),
|
|
||||||
Text(
|
|
||||||
'${'Model'.tr}: ${ai.responseIdCardDriverEgyptBack['model']}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Year'.tr}: ${ai.responseIdCardDriverEgyptBack['year']}'),
|
|
||||||
Text(
|
|
||||||
'${'Chassis'.tr}: ${ai.responseIdCardDriverEgyptBack['chassis']}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Color'.tr}: ${ai.responseIdCardDriverEgyptBack['color']}'),
|
|
||||||
Text(
|
|
||||||
'${'Displacement'.tr}: ${ai.responseIdCardDriverEgyptBack['displacement']} cc'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Fuel'.tr}: ${ai.responseIdCardDriverEgyptBack['fuel']}'),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Text(
|
|
||||||
'${'Tax Expiry Date'.tr}: ${taxExpiryDateTime != null ? taxExpiryDate : 'N/A'}',
|
|
||||||
style: TextStyle(
|
|
||||||
color: isExpired ? Colors.red : Colors.green,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8.0),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
'${'Inspection Date'.tr}: $inspectionDate',
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
isInspectionExpired ? Colors.red : Colors.green,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// Text(
|
|
||||||
// '${'Cylinders'.tr}: ${ai.responseIdCardDriverEgypt['cylinders']}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Card(
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
ai.allMethodForAI(
|
|
||||||
'this extracted car license analyze it to get Json just without any text for keys[make, year, chassis, model, engine, displacement, cylinders, fuel, color, inspection_date,assurnceNumber, tax_expiry,make date format year-month-day',
|
|
||||||
AppLink.uploadEgypt,
|
|
||||||
'car_back');
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Image.asset(
|
|
||||||
'assets/images/4.png',
|
|
||||||
height: Get.height * .25,
|
|
||||||
width: double.maxFinite,
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'Capture an Image of Your car license back'.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
GetBuilder<AI> egyptDriverLicenseWidget() {
|
GetBuilder<AI> egyptDriverLicenseWidget() {
|
||||||
return GetBuilder<AI>(
|
return GetBuilder<AI>(
|
||||||
builder: (contentController) => contentController.responseMap.isNotEmpty
|
builder: (contentController) => contentController.responseMap.isNotEmpty
|
||||||
@@ -692,7 +192,7 @@ class AiPage extends StatelessWidget {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
contentController.responseCarLicenseMap.isNotEmpty
|
contentController.responseCarLicenseMapJordan.isNotEmpty
|
||||||
? Container(
|
? Container(
|
||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
// height: Get.height * .3,
|
// height: Get.height * .3,
|
||||||
@@ -700,35 +200,36 @@ class AiPage extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${'Name'.tr} ${contentController.responseCarLicenseMap['name']}',
|
'${'Name'.tr} ${contentController.responseCarLicenseMapJordan['name']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Address'.tr} ${contentController.responseCarLicenseMap['address']}',
|
'${'Address'.tr} ${contentController.responseCarLicenseMapJordan['address']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}',
|
'${'Car Kind'.tr} ${contentController.responseCarLicenseMapJordan['car_kind']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}',
|
'${'Color'.tr} ${contentController.responseCarLicenseMapJordan['car_color']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}',
|
'${'Year'.tr} ${contentController.responseCarLicenseMapJordan['car_year']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}',
|
'${'Car Plate'.tr} ${contentController.responseCarLicenseMapJordan['car_plate']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Car Expire'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}',
|
'${'Car Expire'.tr} ${contentController.responseCarLicenseMapJordan['expire_date_of_license']}',
|
||||||
style: contentController
|
style: contentController
|
||||||
.responseCarLicenseMap.isNotEmpty
|
.responseCarLicenseMapJordan
|
||||||
|
.isNotEmpty
|
||||||
? DateTime.parse(contentController
|
? DateTime.parse(contentController
|
||||||
.responseCarLicenseMap[
|
.responseCarLicenseMapJordan[
|
||||||
'expire_date_of_license']
|
'expire_date_of_license']
|
||||||
.toString())
|
.toString())
|
||||||
.isBefore(contentController.now)
|
.isBefore(contentController.now)
|
||||||
@@ -1003,7 +504,8 @@ Output the extracted information in the following JSON formate and make date for
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
contentController.responseCarLicenseMap.isNotEmpty
|
contentController
|
||||||
|
.responseCarLicenseMapJordan.isNotEmpty
|
||||||
? Container(
|
? Container(
|
||||||
decoration: AppStyle.boxDecoration,
|
decoration: AppStyle.boxDecoration,
|
||||||
// height: Get.height * .3,
|
// height: Get.height * .3,
|
||||||
@@ -1011,36 +513,36 @@ Output the extracted information in the following JSON formate and make date for
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${'Name'.tr} ${contentController.responseCarLicenseMap['name']}',
|
'${'Name'.tr} ${contentController.responseCarLicenseMapJordan['name']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Address'.tr} ${contentController.responseCarLicenseMap['address']}',
|
'${'Address'.tr} ${contentController.responseCarLicenseMapJordan['address']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Car Kind'.tr} ${contentController.responseCarLicenseMap['car_kind']}',
|
'${'Car Kind'.tr} ${contentController.responseCarLicenseMapJordan['car_kind']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Color'.tr} ${contentController.responseCarLicenseMap['car_color']}',
|
'${'Color'.tr} ${contentController.responseCarLicenseMapJordan['car_color']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Year'.tr} ${contentController.responseCarLicenseMap['car_year']}',
|
'${'Year'.tr} ${contentController.responseCarLicenseMapJordan['car_year']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'Car Plate'.tr} ${contentController.responseCarLicenseMap['car_plate']}',
|
'${'Car Plate'.tr} ${contentController.responseCarLicenseMapJordan['car_plate']}',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'${'ُExpire Date'.tr} ${contentController.responseCarLicenseMap['expire_date_of_license']}',
|
'${'ُExpire Date'.tr} ${contentController.responseCarLicenseMapJordan['expire_date_of_license']}',
|
||||||
style: contentController
|
style: contentController
|
||||||
.responseCarLicenseMap
|
.responseCarLicenseMapJordan
|
||||||
.isNotEmpty
|
.isNotEmpty
|
||||||
? DateTime.parse(contentController
|
? DateTime.parse(contentController
|
||||||
.responseCarLicenseMap[
|
.responseCarLicenseMapJordan[
|
||||||
'expire_date_of_license']
|
'expire_date_of_license']
|
||||||
.toString())
|
.toString())
|
||||||
.isBefore(
|
.isBefore(
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
import 'package:SEFER/controller/functions/gemeni.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
class EgyptCard extends StatelessWidget {
|
|
||||||
const EgyptCard({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
Get.put(AI());
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: const Text('Egypt Card'),
|
|
||||||
),
|
|
||||||
body: GetBuilder<AI>(builder: (controller) {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
child: Text(
|
|
||||||
controller.responseIdCardDriverEgyptBack['firstName'].toString()),
|
|
||||||
));
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
856
lib/views/auth/captin/cards_egypt/egypt_card_a_i.dart
Normal file
856
lib/views/auth/captin/cards_egypt/egypt_card_a_i.dart
Normal file
@@ -0,0 +1,856 @@
|
|||||||
|
import 'package:SEFER/controller/functions/gemeni.dart';
|
||||||
|
import 'package:SEFER/controller/functions/tts.dart';
|
||||||
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../../../constant/colors.dart';
|
||||||
|
import '../../../../constant/links.dart';
|
||||||
|
import '../../../../constant/style.dart';
|
||||||
|
import '../../../widgets/my_scafold.dart';
|
||||||
|
import '../../../widgets/mycircular.dart';
|
||||||
|
|
||||||
|
class EgyptCardAI extends StatelessWidget {
|
||||||
|
EgyptCardAI({super.key});
|
||||||
|
TextToSpeechController textToSpeechController =
|
||||||
|
Get.put(TextToSpeechController());
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Get.put(AI());
|
||||||
|
// String text = '';
|
||||||
|
|
||||||
|
return MyScafolld(
|
||||||
|
title: 'Documents check'.tr,
|
||||||
|
body: [
|
||||||
|
GetBuilder<AI>(builder: (controller) {
|
||||||
|
return controller.isLoading
|
||||||
|
? const MyCircularProgressIndicator()
|
||||||
|
: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
(controller.responseIdCardDriverEgyptBack.isNotEmpty &&
|
||||||
|
controller.responseIdCardDriverEgyptFront
|
||||||
|
.isNotEmpty &&
|
||||||
|
controller.responseIdEgyptFront.isNotEmpty &&
|
||||||
|
controller.responseIdEgyptBack.isNotEmpty &&
|
||||||
|
controller
|
||||||
|
.responseIdEgyptDriverLicense.isNotEmpty &&
|
||||||
|
controller
|
||||||
|
.responseCriminalRecordEgypt.isNotEmpty)
|
||||||
|
? MyElevatedButton(
|
||||||
|
title: 'Next'.tr,
|
||||||
|
onPressed: () {
|
||||||
|
controller.addDriverAndCarEgypt();
|
||||||
|
})
|
||||||
|
: const SizedBox(),
|
||||||
|
SizedBox(
|
||||||
|
height:
|
||||||
|
(controller.responseIdCardDriverEgyptBack
|
||||||
|
.isNotEmpty &&
|
||||||
|
controller.responseIdCardDriverEgyptFront
|
||||||
|
.isNotEmpty &&
|
||||||
|
controller
|
||||||
|
.responseIdEgyptFront.isNotEmpty &&
|
||||||
|
controller
|
||||||
|
.responseIdEgyptBack.isNotEmpty &&
|
||||||
|
controller.responseIdEgyptDriverLicense
|
||||||
|
.isNotEmpty &&
|
||||||
|
controller.responseCriminalRecordEgypt
|
||||||
|
.isNotEmpty)
|
||||||
|
? Get.height * .7
|
||||||
|
: Get.height * .85,
|
||||||
|
child: ListView(
|
||||||
|
children: [
|
||||||
|
egyptDriverLicense(),
|
||||||
|
egyptCarLicenceFront(),
|
||||||
|
egyptCarLicenceBack(),
|
||||||
|
egyptDriverIDFront(),
|
||||||
|
egyptDriverIDBack(),
|
||||||
|
egyptCriminalRecord(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
Positioned(
|
||||||
|
top: 30,
|
||||||
|
bottom: 30,
|
||||||
|
right: 30,
|
||||||
|
left: 30,
|
||||||
|
child: GetBuilder<AI>(builder: (controller) {
|
||||||
|
print(controller.approved);
|
||||||
|
return controller.approved == false
|
||||||
|
? Container(
|
||||||
|
decoration: AppStyle.boxDecoration1,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'Approve Driver Documents',
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Text(
|
||||||
|
'To become a ride-sharing driver on the Sefer app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Sefer app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.'
|
||||||
|
.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Container(
|
||||||
|
decoration: AppStyle.boxDecoration1,
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: () async {
|
||||||
|
await textToSpeechController.speakText(
|
||||||
|
'To become a ride-sharing driver on the Sefer app, you need to upload your driver\'s license, ID document, and car registration document. Our AI system will instantly review and verify their authenticity in just 2-3 minutes. If your documents are approved, you can start working as a driver on the Sefer app. Please note, submitting fraudulent documents is a serious offense and may result in immediate termination and legal consequences.'
|
||||||
|
.tr);
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.headphones,
|
||||||
|
size: 50,
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
'Press to hear'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
GetBuilder<TextToSpeechController>(
|
||||||
|
builder: (textToSpeechController) {
|
||||||
|
return textToSpeechController.isComplete
|
||||||
|
? Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
kolor: AppColor.greenColor,
|
||||||
|
onPressed: () {
|
||||||
|
controller.setApproved();
|
||||||
|
}),
|
||||||
|
MyElevatedButton(
|
||||||
|
title: 'cancel'.tr,
|
||||||
|
kolor: AppColor.redColor,
|
||||||
|
onPressed: () {
|
||||||
|
Get.defaultDialog(
|
||||||
|
title:
|
||||||
|
'You will cancel registeration'
|
||||||
|
.tr,
|
||||||
|
middleText: '',
|
||||||
|
content: IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await textToSpeechController
|
||||||
|
.speakText(
|
||||||
|
'You will cancel registeration'
|
||||||
|
.tr);
|
||||||
|
},
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.headphones),
|
||||||
|
),
|
||||||
|
confirm: MyElevatedButton(
|
||||||
|
title: 'OK'.tr,
|
||||||
|
kolor: AppColor.redColor,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
Get.back();
|
||||||
|
}),
|
||||||
|
cancel: MyElevatedButton(
|
||||||
|
title: 'Cancel'.tr,
|
||||||
|
kolor:
|
||||||
|
AppColor.greenColor,
|
||||||
|
onPressed: () {
|
||||||
|
Get.back();
|
||||||
|
}));
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: const SizedBox();
|
||||||
|
})
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: const SizedBox();
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
isleading: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptDriverLicense() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseIdEgyptDriverLicense.isNotEmpty) {
|
||||||
|
final expiryDate = ai.responseIdEgyptDriverLicense['expiry_date'];
|
||||||
|
|
||||||
|
// Check if the expiry date is before today
|
||||||
|
final today = DateTime.now();
|
||||||
|
|
||||||
|
// Try parsing the expiry date. If it fails, set it to null.
|
||||||
|
final expiryDateTime = DateTime.tryParse(expiryDate);
|
||||||
|
final isExpired =
|
||||||
|
expiryDateTime != null && expiryDateTime.isBefore(today);
|
||||||
|
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('Driver\'s License'.tr, style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON object from the following information extracted from the provided Arabic text:license_type,national_number,name_arabic,name_english,firstName,lastName,address,issue_date,expiry_date,employmentType,license_categories.and (date formate year-month-day in latin numbers) ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'driver_license'); //egypt
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'License Type'.tr}: ${ai.responseIdEgyptDriverLicense['license_type']}',
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'National Number'.tr}: ${ai.responseIdEgyptDriverLicense['national_number']}',
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color: ai.responseIdEgyptDriverLicense[
|
||||||
|
'national_number'] ==
|
||||||
|
ai.responseIdEgyptBack['nationalID']
|
||||||
|
? AppColor.greenColor
|
||||||
|
: AppColor.redColor),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Name (Arabic)'.tr}: ${ai.responseIdEgyptDriverLicense['name_arabic']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Name (English)'.tr}: ${ai.responseIdEgyptDriverLicense['name_english']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Address'.tr}: ${ai.responseIdEgyptDriverLicense['address']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Issue Date'.tr}: ${ai.responseIdEgyptDriverLicense['issue_date']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Expiry Date'.tr}: ${ai.responseIdEgyptDriverLicense['expiry_date']}',
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color:
|
||||||
|
!isExpired ? AppColor.greenColor : AppColor.redColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'License Categories'.tr}: ${ai.responseIdEgyptDriverLicense['license_categories']}',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON object from the following information extracted from the provided Arabic text:license_type,national_number,name_arabic,name_english,firstName,lastName,address,issue_date,expiry_date,employmentType,license_categories.and (date formate year-month-day in latin numbers) ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'driver_license'); //egypt
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/5.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your Driver License'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptDriverIDBack() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseIdEgyptBack.isNotEmpty) {
|
||||||
|
final taxExpiryDate = ai.responseIdEgyptBack['expirationDate'];
|
||||||
|
|
||||||
|
// Check if the tax expiry date is before today
|
||||||
|
final today = DateTime.now();
|
||||||
|
|
||||||
|
// Try parsing the tax expiry date. If it fails, set it to null.
|
||||||
|
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate);
|
||||||
|
final isExpired =
|
||||||
|
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
|
||||||
|
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('ID Documents Back'.tr, style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON from the following information extracted from the provided Arabic text:nationalID,issueDate,occupation,gender,religion,maritalStatus,fullNameMaritial if(أعزب)=none ,expirationDate.and (date formate year-month-day in latin numbers) ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'id_back'); //egypt
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
// Assuming these keys exist in ai.responseIdEgyptFront
|
||||||
|
Text(
|
||||||
|
'${'National ID'.tr}: ${ai.responseIdEgyptBack['nationalID']}',
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color: ai.responseIdEgyptDriverLicense[
|
||||||
|
'national_number'] ==
|
||||||
|
ai.responseIdEgyptBack['nationalID']
|
||||||
|
? AppColor.greenColor
|
||||||
|
: AppColor.redColor),
|
||||||
|
),
|
||||||
|
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Occupation'.tr}: ${ai.responseIdEgyptBack['occupation']}', // Assuming 'occupation' exists
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Issue Date'.tr}: ${ai.responseIdEgyptBack['issueDate']}', // Assuming 'issueDate' exists
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${'Gender'.tr}: ${ai.responseIdEgyptBack['gender']}', // Assuming 'gender' exists
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
// Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
// children: [
|
||||||
|
// Text(
|
||||||
|
// '${'Religion'.tr}: ${ai.responseIdEgyptBack['religion']}', // Assuming 'religion' exists
|
||||||
|
// ),
|
||||||
|
// Text(
|
||||||
|
// '${'Marital Status'.tr}: ${ai.responseIdEgyptBack['maritalStatus']}', // Assuming 'maritalStatus' exists
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 8.0),
|
||||||
|
// Text(
|
||||||
|
// '${'Full Name (Marital)'.tr}: ${ai.responseIdEgyptBack['fullNameMaritial']}', // Assuming 'fullNameMaritial' exists
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Expiration Date'.tr}: ${ai.responseIdEgyptBack['expirationDate']}', // Assuming 'expirationDate' exists
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color: !isExpired
|
||||||
|
? AppColor.greenColor
|
||||||
|
: AppColor.redColor),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON from the following information extracted from the provided Arabic text:nationalID,issueDate,occupation,gender,religion,maritalStatus,fullNameMaritial if(أعزب)=none ,expirationDate.and (date formate year-month-day in latin numbers) ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'id_back'); //egypt
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/2.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your ID Document Back'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptDriverIDFront() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseIdEgyptFront.isNotEmpty) {
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('ID Documents Front'.tr, style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON object from the following information extracted from the provided Arabic text:first_name: The word next to "بطاقة تحقيق الشخصية" (National Identification Card).full_name: The full name on the next line after the first name.address: The complete address spanning the next two lines.national_number: The Arabic numeral representing the National ID number before the last line.card_id: The card ID in English on the last line and dob for date in year note month just year of born in latin char ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'id_front'); //egypt
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
// Removed Make, Model, etc. as they are not available
|
||||||
|
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'First Name'.tr}: ${ai.responseIdEgyptFront['first_name']}',
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${'CardID'.tr}: ${ai.responseIdEgyptFront['card_id']}',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Full Name'.tr}: ${ai.responseIdEgyptFront['full_name']}',
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${'DOB'.tr}: ${ai.responseIdEgyptFront['dob']}',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Address'.tr}: ${ai.responseIdEgyptFront['address']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
// Text(
|
||||||
|
// '${'National Number'.tr}: ${ai.responseIdEgyptFront['national_number']}',
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 8.0),
|
||||||
|
|
||||||
|
// Removed Inspection Date as it's not available
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'''Write a JSON object from the following information extracted from the provided Arabic text:first_name: The word next to "بطاقة تحقيق الشخصية" (National Identification Card).full_name: The full name on the next line after the first name.address: The complete address spanning the next two lines.national_number: The Arabic numeral representing the National ID number before the last line.card_id: The card ID in English on the last line and dob for date in year note month just year of born in latin char ''',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'id_front'); //egypt
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/1.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your ID Document front'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptCarLicenceFront() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseIdCardDriverEgyptFront.isNotEmpty) {
|
||||||
|
// No need to access ai.responseIdCardDriverEgyptBack anymore
|
||||||
|
final licenseExpiryDate = DateTime.parse(
|
||||||
|
ai.responseIdCardDriverEgyptFront['LicenseExpirationDate']);
|
||||||
|
|
||||||
|
// Check if license has expired
|
||||||
|
final today = DateTime.now();
|
||||||
|
final isLicenseExpired = licenseExpiryDate.isBefore(today);
|
||||||
|
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text('Vehicle Details Front'.tr,
|
||||||
|
style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
ai.allMethodForAI(
|
||||||
|
'extract all fields as json for keys[LicenseExpirationDate,car_plate,owner,address] replace | by space,and date formate year-month-day',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'car_front');
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
// Removed Make, Model, etc. as they are not available
|
||||||
|
|
||||||
|
Text(
|
||||||
|
'${'Plate Number'.tr}: ${ai.responseIdCardDriverEgyptFront['car_plate']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Owner Name'.tr}: ${ai.responseIdCardDriverEgyptFront['owner']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Address'.tr}: ${ai.responseIdCardDriverEgyptFront['address']}',
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'License Expiry Date'.tr}: ${licenseExpiryDate.toString().substring(0, 10)}',
|
||||||
|
style: TextStyle(
|
||||||
|
color: isLicenseExpired ? Colors.red : Colors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Removed Fuel as it's not available
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// Removed Inspection Date as it's not available
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ai.allMethodForAI(
|
||||||
|
'extract all fields as json for keys[LicenseExpirationDate,car_plate,owner,address] replace | by space,and date formate year-month-day',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'car_front');
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/3.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your car license front '.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptCarLicenceBack() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseIdCardDriverEgyptBack.isNotEmpty) {
|
||||||
|
// print(ai.responseIdCardDriverEgyptBack);
|
||||||
|
|
||||||
|
// Get the tax expiry date from the response
|
||||||
|
final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry'];
|
||||||
|
|
||||||
|
// Get the inspection date from the response
|
||||||
|
final inspectionDate =
|
||||||
|
ai.responseIdCardDriverEgyptBack['inspection_date'];
|
||||||
|
|
||||||
|
// Check if the tax expiry date is before today
|
||||||
|
final today = DateTime.now();
|
||||||
|
|
||||||
|
// Try parsing the tax expiry date. If it fails, set it to null.
|
||||||
|
final taxExpiryDateTime = DateTime.tryParse(taxExpiryDate ?? '');
|
||||||
|
final isExpired =
|
||||||
|
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
|
||||||
|
|
||||||
|
// Check if the inspection date is before today
|
||||||
|
final inspectionDateTime =
|
||||||
|
DateTime(int.parse(inspectionDate ?? ''), 1, 1);
|
||||||
|
final isInspectionExpired = inspectionDateTime.isBefore(today);
|
||||||
|
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('Vehicle Details Back'.tr,
|
||||||
|
style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
ai.allMethodForAI(
|
||||||
|
'for this this extracted car license analyze it to get Json just without any text for keys[make, year, chassis, model, engine, displacement, cylinders, fuel, color,and color_hex (for color) inspection_date,assurnceNumber, tax_expiry,make date format year-month-day get hex color form color name provided',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'car_back');
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Make'.tr}: ${ai.responseIdCardDriverEgyptBack['make']}'),
|
||||||
|
Text(
|
||||||
|
'${'Model'.tr}: ${ai.responseIdCardDriverEgyptBack['model']}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Year'.tr}: ${ai.responseIdCardDriverEgyptBack['year']}'),
|
||||||
|
Text(
|
||||||
|
'${'Chassis'.tr}: ${ai.responseIdCardDriverEgyptBack['chassis']}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Color'.tr}: ${ai.responseIdCardDriverEgyptBack['color']}'),
|
||||||
|
Text(
|
||||||
|
'${'Displacement'.tr}: ${ai.responseIdCardDriverEgyptBack['displacement']} cc'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'Fuel'.tr}: ${ai.responseIdCardDriverEgyptBack['fuel']}'),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
if (taxExpiryDateTime != null)
|
||||||
|
Text(
|
||||||
|
'${'Tax Expiry Date'.tr}: $taxExpiryDate',
|
||||||
|
style: TextStyle(
|
||||||
|
color: isExpired ? Colors.red : Colors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
'${'Inspection Date'.tr}: $inspectionDate',
|
||||||
|
style: TextStyle(
|
||||||
|
color:
|
||||||
|
isInspectionExpired ? Colors.red : Colors.green,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
ai.allMethodForAI(
|
||||||
|
'this extracted car license analyze it to get Json just without any text for keys[make, year, chassis, model, engine, displacement, cylinders, fuel, color,and color_hex from color inspection_date,assurnceNumber, tax_expiry,make date format year-month-day',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'car_back');
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/4.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your car license back'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetBuilder<AI> egyptCriminalRecord() {
|
||||||
|
return GetBuilder<AI>(
|
||||||
|
builder: (ai) {
|
||||||
|
if (ai.responseCriminalRecordEgypt.isNotEmpty) {
|
||||||
|
return Card(
|
||||||
|
elevation: 4.0,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('Criminal Record'.tr, style: AppStyle.headTitle2),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'Write a JSON object from the following information extracted from the provided Arabic text:["InspectionResult": ,"NationalID","FullName","IssueDate"]make date format year-month-day ,and add spaces in text',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'criminalRecord',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.refresh),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
const Divider(color: AppColor.accentColor),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'InspectionResult'.tr}: ${ai.responseCriminalRecordEgypt['InspectionResult']}'),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'FullName'.tr}: ${ai.responseCriminalRecordEgypt['FullName']}',
|
||||||
|
style: AppStyle.title.copyWith(
|
||||||
|
color: ai.responseCriminalRecordEgypt['FullName'] ==
|
||||||
|
ai.responseIdEgyptDriverLicense['name_arabic']
|
||||||
|
? AppColor.greenColor
|
||||||
|
: AppColor.redColor),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'NationalID'.tr}: ${ai.responseCriminalRecordEgypt['NationalID']}'),
|
||||||
|
const SizedBox(height: 8.0),
|
||||||
|
Text(
|
||||||
|
'${'IssueDate'.tr}: ${ai.responseCriminalRecordEgypt['IssueDate']}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Card(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () async {
|
||||||
|
await ai.allMethodForAI(
|
||||||
|
'Write a JSON object from the following information extracted from the provided Arabic text:["InspectionResult": ,"NationalID","FullName","IssueDate"]make date format year-month-day ,and add spaces in text',
|
||||||
|
AppLink.uploadEgypt,
|
||||||
|
'criminalRecord',
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Image.asset(
|
||||||
|
'assets/images/6.png',
|
||||||
|
height: Get.height * .25,
|
||||||
|
width: double.maxFinite,
|
||||||
|
fit: BoxFit.fitHeight,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Capture an Image of Your Criminal Record'.tr,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
106
lib/views/auth/captin/cards_egypt/sms_signup.dart
Normal file
106
lib/views/auth/captin/cards_egypt/sms_signup.dart
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
import 'package:SEFER/constant/style.dart';
|
||||||
|
import 'package:SEFER/controller/auth/captin/register_captin_controller.dart';
|
||||||
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
|
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class SmsSignupEgypt extends StatelessWidget {
|
||||||
|
SmsSignupEgypt({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
Get.put(RegisterCaptainController());
|
||||||
|
return MyScafolld(
|
||||||
|
title: 'Phone Check'.tr,
|
||||||
|
body: [
|
||||||
|
GetBuilder<RegisterCaptainController>(
|
||||||
|
builder: (registerCaptainController) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
// Logo at the top
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 20.0),
|
||||||
|
child: Image.asset(
|
||||||
|
'assets/images/logo.png', // Make sure you have a logo image in your assets folder
|
||||||
|
height: 100,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Message to the driver
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
|
child: Text(
|
||||||
|
'We need your phone number to contact you and to help you receive orders.'
|
||||||
|
.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Enter phone number text
|
||||||
|
Padding(
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
|
child: Text(
|
||||||
|
'Enter your phone number'.tr,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// Phone number input field
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: !registerCaptainController.isSent
|
||||||
|
? Form(
|
||||||
|
key: registerCaptainController.formKey3,
|
||||||
|
child: MyTextForm(
|
||||||
|
controller:
|
||||||
|
registerCaptainController.phoneController,
|
||||||
|
label: 'Enter your phone number'.tr,
|
||||||
|
hint: 'Enter your phone number'.tr,
|
||||||
|
type: TextInputType.phone),
|
||||||
|
)
|
||||||
|
: Container(
|
||||||
|
decoration: AppStyle.boxDecoration1,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
registerCaptainController.phoneController.text,
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: registerCaptainController.isSent
|
||||||
|
? Form(
|
||||||
|
key: registerCaptainController.formKey3,
|
||||||
|
child: MyTextForm(
|
||||||
|
controller: registerCaptainController.verifyCode,
|
||||||
|
label: '5 digit'.tr,
|
||||||
|
hint: '5 digit'.tr,
|
||||||
|
type: TextInputType.number),
|
||||||
|
)
|
||||||
|
: const SizedBox()),
|
||||||
|
// Submit button
|
||||||
|
MyElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
!registerCaptainController.isSent
|
||||||
|
? await registerCaptainController.sendOtpMessage()
|
||||||
|
: await registerCaptainController.verifySMSCode();
|
||||||
|
},
|
||||||
|
title: 'Submit'.tr,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
isleading: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'package:SEFER/constant/box_name.dart';
|
||||||
|
import 'package:SEFER/main.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:get_storage/get_storage.dart';
|
import 'package:get_storage/get_storage.dart';
|
||||||
@@ -43,7 +45,7 @@ class MyTextForm extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
if (value!.isEmpty) {
|
if (value!.isEmpty) {
|
||||||
return 'Please enter $label.'.tr;
|
return '${'Please enter'.tr} $label.'.tr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == TextInputType.emailAddress) {
|
if (type == TextInputType.emailAddress) {
|
||||||
@@ -51,7 +53,11 @@ class MyTextForm extends StatelessWidget {
|
|||||||
return 'Please enter a valid email.'.tr;
|
return 'Please enter a valid email.'.tr;
|
||||||
}
|
}
|
||||||
} else if (type == TextInputType.phone) {
|
} else if (type == TextInputType.phone) {
|
||||||
if (value.length != 10) {
|
if (box.read(BoxName.countryCode) == 'Egypt') {
|
||||||
|
if (value.length != 11) {
|
||||||
|
return 'Please enter a valid phone number.'.tr;
|
||||||
|
}
|
||||||
|
} else if (value.length != 10) {
|
||||||
return 'Please enter a valid phone number.'.tr;
|
return 'Please enter a valid phone number.'.tr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user