Files
tripz-service/lib/controller/mainController/pages/registration_captain_page.dart
Hamza-Ayed d43c421dc3 8/11/2
2024-08-11 14:24:57 +03:00

2100 lines
114 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:service/views/widgets/my_scafold.dart';
import '../../../../constant/colors.dart';
import '../../../../constant/links.dart';
import '../../../../constant/style.dart';
import '../../../views/widgets/elevated_btn.dart';
import '../../../views/widgets/mycircular.dart';
import '../registration_captain_controller.dart';
class RegisterCaptain extends StatelessWidget {
RegisterCaptain({super.key});
@override
Widget build(BuildContext context) {
final controller = Get.put(RegisterCaptainController());
// String text = '';
controller.driveInit();
// final inspectionDate =
// controller.responseIdCardDriverEgyptBack['inspection_date'].toString();
// final year = int.parse(inspectionDate.split('-')[0]);
// final inspectionDateTime = DateTime(year, 12, 31);
return MyScaffold(
title: 'Documents check'.tr,
action: GetBuilder<RegisterCaptainController>(builder: (controller) {
return IconButton(
onPressed: () {
controller.isLoading = false;
controller.update();
},
icon: const Icon(Icons.refresh),
);
}),
body: [
GetBuilder<RegisterCaptainController>(builder: (controller) {
return controller.isLoading
? const MyCircularProgressIndicator()
: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
TextButton(
onPressed: () {
Get.to(MyScaffold(
title: 'title',
isleading: true,
body: [
Column(
children: [
SizedBox(
height: Get.height * .8,
child: Form(
child: ListView(
children: [
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'firstName']
?.toString()
: controller
.firstName.value,
decoration:
const InputDecoration(
labelText:
'First Name'),
onChanged: (value) => controller
.firstName.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'lastName']
?.toString()
: controller
.lastName.value,
decoration:
const InputDecoration(
labelText: 'Last Name'),
onChanged: (value) => controller
.lastName.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'gender']
?.toString()
: controller
.gender.value,
decoration:
const InputDecoration(
labelText: 'Gender'),
onChanged: (value) => controller
.gender.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'license_type']
?.toString()
: controller
.licenseType.value,
decoration:
const InputDecoration(
labelText:
'License Type'),
onChanged: (value) => controller
.licenseType.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'national_number']
?.toString()
: controller
.nationalNumber
.value,
decoration:
const InputDecoration(
labelText:
'National Number'),
onChanged: (value) => controller
.nationalNumber
.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'name_arabic']
?.toString()
: controller
.nameArabic.value,
decoration:
const InputDecoration(
labelText:
'Name in Arabic'),
onChanged: (value) => controller
.nameArabic.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'name_english']
?.toString()
: controller
.nameEnglish.value,
decoration:
const InputDecoration(
labelText:
'Name in English'),
onChanged: (value) => controller
.nameEnglish.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'issue_date']
?.toString()
: controller
.issueDate.value,
decoration:
const InputDecoration(
labelText:
'Issue Date'),
onChanged: (value) => controller
.issueDate.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'expiry_date']
?.toString()
: controller
.expirationDate
.value,
decoration:
const InputDecoration(
labelText:
'Expiry Date'),
onChanged: (value) => controller
.expiryDate.value = value,
),
TextFormField(
initialValue: controller
.responseIdEgyptFront !=
null
? controller.responseIdEgyptDriverLicense[
'license_categories']
is List
? controller
.responseIdEgyptDriverLicense[
'license_categories']
.join(', ')
: controller
.responseIdEgyptDriverLicense[
'license_categories']
?.toString() ??
'Not specified'
: controller
.licenseCategories
.value,
decoration: const InputDecoration(
labelText:
'License Categories'),
onChanged: (value) => controller
.licenseCategories
.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptFront !=
null
? controller
.responseIdEgyptFront[
'address']
?.toString()
: controller.fuel.value,
decoration:
const InputDecoration(
labelText: 'Address'),
onChanged: (value) => controller
.address.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptFront !=
null
? controller
.responseIdEgyptFront[
'card_id']
?.toString()
: controller
.cardId.value,
decoration:
const InputDecoration(
labelText: 'Card ID'),
onChanged: (value) => controller
.cardId.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'occupation']
?.toString()
: controller
.education.value,
decoration:
const InputDecoration(
labelText:
'Occupation'),
onChanged: (value) => controller
.occupation.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'occupation']
?.toString()
: controller
.occupation.value,
decoration:
const InputDecoration(
labelText: 'Education'),
onChanged: (value) => controller
.education.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'issue_date']
?.toString()
: controller
.issueDate.value,
decoration: const InputDecoration(
labelText:
'License Issue Date'),
onChanged: (value) => controller
.licenseIssueDate
.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'religion']
?.toString()
: controller
.religion.value,
decoration:
const InputDecoration(
labelText: 'Religion'),
onChanged: (value) => controller
.religion.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptBack !=
null
? controller
.responseIdEgyptBack[
'maritalStatus']
?.toString()
: controller
.maritalStatus
.value,
decoration:
const InputDecoration(
labelText:
'Marital Status'),
onChanged: (value) => controller
.maritalStatus
.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'address']
?.toString()
: controller
.address.value,
decoration:
const InputDecoration(
labelText: 'Site'),
onChanged: (value) => controller
.site.value = value,
),
TextFormField(
initialValue:
controller.responseIdEgyptDriverLicense !=
null
? controller
.responseIdEgyptDriverLicense[
'employmentType']
?.toString()
: controller
.employmentType
.value,
decoration:
const InputDecoration(
labelText:
'Employment Type'),
onChanged: (value) => controller
.employmentType
.value = value,
),
const Divider(
thickness: 5,
height: 5,
),
Text('Car Details'.tr),
const Divider(
thickness: 5,
height: 5,
),
TextFormField(
initialValue: controller
.vin.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'chassis']
?.toString() ??
''
: controller.vin.value,
decoration:
const InputDecoration(
labelText: 'VIN'),
onChanged: (value) => controller
.vin.value = value,
),
TextFormField(
initialValue: controller
.vin.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'car_plate']
?.toString() ??
''
: controller.vin.value,
decoration:
const InputDecoration(
labelText: 'car_plate'),
onChanged: (value) => controller
.vin.value = value,
),
TextFormField(
initialValue: controller
.make.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'make']
?.toString() ??
''
: controller.make.value,
decoration:
const InputDecoration(
labelText: 'Make'),
onChanged: (value) => controller
.make.value = value,
),
TextFormField(
initialValue: controller
.model.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'model']
?.toString() ??
''
: controller.model.value,
decoration:
const InputDecoration(
labelText: 'Model'),
onChanged: (value) => controller
.model.value = value,
),
TextFormField(
initialValue: controller
.year.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'year']
?.toString() ??
''
: controller.year.value,
decoration:
const InputDecoration(
labelText: 'Year'),
onChanged: (value) => controller
.year.value = value,
),
TextFormField(
initialValue: controller
.displacement
.value
.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'engine']
?.toString() ??
''
: controller
.displacement.value,
decoration:
const InputDecoration(
labelText:
'Displacement'),
onChanged: (value) => controller
.displacement.value = value,
),
TextFormField(
initialValue: controller
.fuel.value.isEmpty
? controller
.responseIdCardDriverEgyptBack[
'fuel']
?.toString() ??
''
: controller.fuel.value,
decoration:
const InputDecoration(
labelText: 'Fuel'),
onChanged: (value) => controller
.fuel.value = value,
),
DropdownButtonFormField<String>(
decoration: InputDecoration(
labelText: 'Color'
.tr, // Localized label
),
value: controller
.color.value.isEmpty
? null
: controller.color.value,
items: [
{'red'.tr: '#FF0000'},
{'green'.tr: '#008000'},
{'blue'.tr: '#0000FF'},
{'black'.tr: '#000000'},
{'white'.tr: '#FFFFFF'},
{'yellow'.tr: '#FFFF00'},
{'purple'.tr: '#800080'},
{'orange'.tr: '#FFA500'},
{'pink'.tr: '#FFC0CB'},
{'brown'.tr: '#A52A2A'},
{'gray'.tr: '#808080'},
{'cyan'.tr: '#00FFFF'},
{'magenta'.tr: '#FF00FF'},
{'lime'.tr: '#00FF00'},
{'indigo'.tr: '#4B0082'},
{'violet'.tr: '#EE82EE'},
{'gold'.tr: '#FFD700'},
{'silver'.tr: '#C0C0C0'},
{'teal'.tr: '#008080'},
{'navy'.tr: '#000080'},
].map((colorMap) {
String colorName =
colorMap.keys.first;
String colorValue =
colorMap.values.first;
return DropdownMenuItem<
String>(
value: colorValue,
child: Text(colorName),
);
}).toList(),
onChanged: (value) {
controller.color.value =
value ?? '';
controller.colorHex.value =
value ?? '';
},
),
TextFormField(
initialValue: controller
.owner.value.isNotEmpty
? controller
.responseIdCardDriverEgyptFront[
'owner']
?.toString()
: controller.owner.value,
decoration:
const InputDecoration(
labelText: 'Owner'),
onChanged: (value) => controller
.owner.value = value,
),
TextFormField(
initialValue: controller
.expirationDate
.value
.isNotEmpty
? controller
.responseIdCardDriverEgyptFront[
'expiration_date']
?.toString()
: controller.owner.value,
decoration:
const InputDecoration(
labelText:
'expiration_date'),
onChanged: (value) => controller
.expirationDate
.value = value,
),
TextFormField(
initialValue: controller
.addressCar.isNotEmpty
? controller
.responseIdCardDriverEgyptFront[
'address']
?.toString()
: controller
.addressCar.value,
decoration:
const InputDecoration(
labelText: 'Address'),
onChanged: (value) => controller
.addressCar.value = value,
),
// TextFormField(
// initialValue: inspectionDateTime
// .toString(),
// decoration:
// const InputDecoration(
// labelText:
// 'Registration Date'),
// onChanged: (value) => controller
// .registrationDate
// .value = value,
// ),
const SizedBox(height: 20),
],
),
),
),
MyElevatedButton(
title: 'Upload'.tr,
onPressed: () async {
await controller
.addDriverEgyptHanding();
await controller
.addRegistrationCarEgyptHandling();
// await controller
// .getDriverNotCompleteRegistration();
Get.back();
},
kolor: AppColor.greenColor,
),
],
),
]));
// Get.defaultDialog(
// barrierDismissible: false,
// title: 'Insert all fields'.tr,
// content: SizedBox(
// height: 400,
// width: 300,
// child: Form(
// child: ListView(
// children: [
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'firstName']
// ?.toString()
// : controller.firstName.value,
// decoration: const InputDecoration(
// labelText: 'First Name'),
// onChanged: (value) => controller
// .firstName.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'lastName']
// ?.toString()
// : controller.lastName.value,
// decoration: const InputDecoration(
// labelText: 'Last Name'),
// onChanged: (value) =>
// controller.lastName.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller
// .responseIdEgyptBack['gender']
// ?.toString()
// : controller.gender.value,
// decoration: const InputDecoration(
// labelText: 'Gender'),
// onChanged: (value) =>
// controller.gender.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'license_type']
// ?.toString()
// : controller
// .licenseType.value,
// decoration: const InputDecoration(
// labelText: 'License Type'),
// onChanged: (value) => controller
// .licenseType.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'national_number']
// ?.toString()
// : controller
// .nationalNumber.value,
// decoration: const InputDecoration(
// labelText: 'National Number'),
// onChanged: (value) => controller
// .nationalNumber.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'name_arabic']
// ?.toString()
// : controller.nameArabic.value,
// decoration: const InputDecoration(
// labelText: 'Name in Arabic'),
// onChanged: (value) => controller
// .nameArabic.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'name_english']
// ?.toString()
// : controller
// .nameEnglish.value,
// decoration: const InputDecoration(
// labelText: 'Name in English'),
// onChanged: (value) => controller
// .nameEnglish.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'issue_date']
// ?.toString()
// : controller.issueDate.value,
// decoration: const InputDecoration(
// labelText: 'Issue Date'),
// onChanged: (value) => controller
// .issueDate.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'expiry_date']
// ?.toString()
// : controller
// .expirationDate.value,
// decoration: const InputDecoration(
// labelText: 'Expiry Date'),
// onChanged: (value) => controller
// .expiryDate.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptFront !=
// null
// ? controller.responseIdEgyptDriverLicense[
// 'license_categories']
// is List
// ? controller
// .responseIdEgyptDriverLicense[
// 'license_categories']
// .join(', ')
// : controller
// .responseIdEgyptDriverLicense[
// 'license_categories']
// ?.toString() ??
// 'Not specified'
// : controller
// .licenseCategories.value,
// decoration: const InputDecoration(
// labelText: 'License Categories'),
// onChanged: (value) => controller
// .licenseCategories.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptFront !=
// null
// ? controller.responseIdEgyptFront[
// 'address']
// ?.toString()
// : controller.fuel.value,
// decoration: const InputDecoration(
// labelText: 'Address'),
// onChanged: (value) =>
// controller.address.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptFront !=
// null
// ? controller.responseIdEgyptFront[
// 'card_id']
// ?.toString()
// : controller.cardId.value,
// decoration: const InputDecoration(
// labelText: 'Card ID'),
// onChanged: (value) =>
// controller.cardId.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller.responseIdEgyptBack[
// 'occupation']
// ?.toString()
// : controller.education.value,
// decoration: const InputDecoration(
// labelText: 'Occupation'),
// onChanged: (value) => controller
// .occupation.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller.responseIdEgyptBack[
// 'occupation']
// ?.toString()
// : controller.occupation.value,
// decoration: const InputDecoration(
// labelText: 'Education'),
// onChanged: (value) => controller
// .education.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller.responseIdEgyptBack[
// 'issue_date']
// ?.toString()
// : controller.issueDate.value,
// decoration: const InputDecoration(
// labelText: 'License Issue Date'),
// onChanged: (value) => controller
// .licenseIssueDate.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller.responseIdEgyptBack[
// 'religion']
// ?.toString()
// : controller.religion.value,
// decoration: const InputDecoration(
// labelText: 'Religion'),
// onChanged: (value) =>
// controller.religion.value = value,
// ),
// TextFormField(
// initialValue: controller
// .responseIdEgyptBack !=
// null
// ? controller.responseIdEgyptBack[
// 'maritalStatus']
// ?.toString()
// : controller.maritalStatus.value,
// decoration: const InputDecoration(
// labelText: 'Marital Status'),
// onChanged: (value) => controller
// .maritalStatus.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'address']
// ?.toString()
// : controller.address.value,
// decoration: const InputDecoration(
// labelText: 'Site'),
// onChanged: (value) =>
// controller.site.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdEgyptDriverLicense !=
// null
// ? controller
// .responseIdEgyptDriverLicense[
// 'employmentType']
// ?.toString()
// : controller
// .employmentType.value,
// decoration: const InputDecoration(
// labelText: 'Employment Type'),
// onChanged: (value) => controller
// .employmentType.value = value,
// ),
// const Divider(
// thickness: 5,
// height: 5,
// ),
// Text('Car Details'.tr),
// const Divider(
// thickness: 5,
// height: 5,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'chassis']
// ?.toString()
// : controller.vin.value,
// decoration: const InputDecoration(
// labelText: 'VIN'),
// onChanged: (value) =>
// controller.vin.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'make']
// ?.toString()
// : controller.make.value,
// decoration: const InputDecoration(
// labelText: 'Make'),
// onChanged: (value) =>
// controller.make.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'model']
// ?.toString()
// : controller.model.value,
// decoration: const InputDecoration(
// labelText: 'Model'),
// onChanged: (value) =>
// controller.model.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'year']
// ?.toString()
// : controller.year.value,
// decoration: const InputDecoration(
// labelText: 'Year'),
// onChanged: (value) =>
// controller.year.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'engine']
// ?.toString()
// : controller
// .displacement.value,
// decoration: const InputDecoration(
// labelText: 'Displacement'),
// onChanged: (value) => controller
// .displacement.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptBack !=
// null
// ? controller
// .responseIdCardDriverEgyptBack[
// 'fuel']
// ?.toString()
// : controller.fuel.value,
// decoration: const InputDecoration(
// labelText: 'Fuel'),
// onChanged: (value) =>
// controller.fuel.value = value,
// ),
// DropdownButtonFormField<String>(
// decoration: InputDecoration(
// labelText:
// 'Color'.tr, // Localized label
// ),
// value: controller.color.value.isEmpty
// ? null
// : controller.color.value,
// items: [
// {'red'.tr: '#FF0000'},
// {'green'.tr: '#008000'},
// {'blue'.tr: '#0000FF'},
// {'black'.tr: '#000000'},
// {'white'.tr: '#FFFFFF'},
// {'yellow'.tr: '#FFFF00'},
// {'purple'.tr: '#800080'},
// {'orange'.tr: '#FFA500'},
// {'pink'.tr: '#FFC0CB'},
// {'brown'.tr: '#A52A2A'},
// {'gray'.tr: '#808080'},
// {'cyan'.tr: '#00FFFF'},
// {'magenta'.tr: '#FF00FF'},
// {'lime'.tr: '#00FF00'},
// {'indigo'.tr: '#4B0082'},
// {'violet'.tr: '#EE82EE'},
// {'gold'.tr: '#FFD700'},
// {'silver'.tr: '#C0C0C0'},
// {'teal'.tr: '#008080'},
// {'navy'.tr: '#000080'},
// ].map((colorMap) {
// String colorName =
// colorMap.keys.first;
// String colorValue =
// colorMap.values.first;
// return DropdownMenuItem<String>(
// value: colorValue,
// child: Text(colorName),
// );
// }).toList(),
// onChanged: (value) {
// controller.color.value =
// value ?? '';
// controller.colorHex.value =
// value ?? '';
// },
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptFront !=
// null
// ? controller
// .responseIdCardDriverEgyptFront[
// 'owner']
// ?.toString()
// : controller.owner.value,
// decoration: const InputDecoration(
// labelText: 'Owner'),
// onChanged: (value) =>
// controller.owner.value = value,
// ),
// TextFormField(
// initialValue:
// controller.responseIdCardDriverEgyptFront !=
// null
// ? controller
// .responseIdCardDriverEgyptFront[
// 'address']
// ?.toString()
// : controller.addressCar.value,
// decoration: const InputDecoration(
// labelText: 'Address'),
// onChanged: (value) => controller
// .addressCar.value = value,
// ),
// TextFormField(
// initialValue:
// inspectionDateTime.toString(),
// decoration: const InputDecoration(
// labelText: 'Registration Date'),
// onChanged: (value) => controller
// .registrationDate.value = value,
// ),
// const SizedBox(height: 20),
// ],
// ),
// ),
// ),
// confirm: MyElevatedButton(
// title: 'Upload'.tr,
// onPressed: () async {
// await controller.addDriverEgyptHanding();
// await controller
// .addRegistrationCarEgyptHandling();
// await controller
// .getDriverNotCompleteRegistration();
// Get.back();
// },
// kolor: AppColor.greenColor,
// ),
// cancel: MyElevatedButton(
// kolor: AppColor.redColor,
// title: 'Cancel'.tr,
// onPressed: () {
// Get.back();
// }));
},
child: Text(
"hand inserting".tr,
),
),
(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(),
],
),
),
],
),
);
}),
],
isleading: true);
}
GetBuilder<RegisterCaptainController> egyptDriverLicense() {
return GetBuilder<RegisterCaptainController>(
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": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", 'driver_license', ai.driverId); //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": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"expiry_date": "", // Format: YYYY-MM-DD using Latin numerals (0-9)
"employmentType": "",
"license_categories": []
}
Important notes:
1. Ensure all dates are in the format YYYY-MM-DD using Latin (Western) numerals (0-9), not Arabic numerals.
2. The 'license_categories' should be an array, even if there's only one category.
3. Fill in all fields based on the information provided in the Arabic text.
4. If any information is missing, leave the field as an empty string or empty array as appropriate.
""", 'driver_license', ai.driverId); //egypt
},
child: Column(
children: [
Image.network(
'${AppLink.server}/card_image/driver_license-${ai.driverId}.jpg',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text("Not found any image".tr);
},
),
Text(
'Capture an Image of Your Driver License'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
GetBuilder<RegisterCaptainController> egyptDriverIDBack() {
return GetBuilder<RegisterCaptainController>(
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("""
Given the following Arabic text values:
Please create a JSON object with the following fields:
nationalID: Use exactly 14 digits, converting from Arabic numerals to Latin numerals (0-9).
issueDate: Format as YYYY-MM-DD using Latin numerals, setting the date to the last day of the provided month.
occupation: Translate and format consistently (e.g., all lowercase).
gender: Use the values "Male" or "Female" without translation.
country: Set to "جمهورية مصر العربية".
religion: Translate and format consistently (e.g., all lowercase).
maritalStatus: Translate and format consistently (e.g., all lowercase).
fullNameMarital: If maritalStatus is "أعزب", set this to "none". Otherwise, leave it as "none".
expirationDate: Format as YYYY-MM-DD using Latin numerals.
Important notes:
Ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals.
For the nationalID, use exactly 14 digits from the provided Arabic numeral string, converting to Latin numerals.
For issueDate, use the last day of the month since only year and month are provided.
Include the country field as "جمهورية مصر العربية".
Format all string values consistently (e.g., all lowercase or proper case)
""", 'id_back', ai.driverId); //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('''
Given the following Arabic text values:
Please create a JSON object with the following fields:
nationalID: Use exactly 14 digits, converting from Arabic numerals to Latin numerals (0-9).
issueDate: Format as YYYY-MM-DD using Latin numerals, setting the date to the last day of the provided month.
occupation: Translate and format consistently (e.g., all lowercase).
gender: Use the values "Male" or "Female" without translation.
country: Set to "جمهورية مصر العربية".
religion: Translate and format consistently (e.g., all lowercase).
maritalStatus: Translate and format consistently (e.g., all lowercase).
fullNameMarital: If maritalStatus is "أعزب", set this to "none". Otherwise, leave it as "none".
expirationDate: Format as YYYY-MM-DD using Latin numerals.
Important notes:
Ensure all date fields use Latin (Western) numerals (0-9) instead of Arabic numerals.
For the nationalID, use exactly 14 digits from the provided Arabic numeral string, converting to Latin numerals.
For issueDate, use the last day of the month since only year and month are provided.
Include the country field as "جمهورية مصر العربية".
Format all string values consistently (e.g., all lowercase or proper case)
''', 'id_back', ai.driverId); //egypt
},
child: Column(
children: [
Image.network(
'${AppLink.server}/card_image/id_back-${ai.driverId}.jpg',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text("Not found any image".tr);
},
),
Text(
'Capture an Image of Your ID Document Back'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
GetBuilder<RegisterCaptainController> egyptDriverIDFront() {
return GetBuilder<RegisterCaptainController>(
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 National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
''', 'id_front', ai.driverId); //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 National ID number before the last line (convert Arabic numerals to Latin)
"card_id": "", // The card ID in English on the last line
"dob": "" // Year of birth only, in Latin numerals (YYYY format)
}
Important notes:
1. For 'first_name', extract the word immediately following "بطاقة تحقيق الشخصية".
2. 'full_name' should be the complete name found on the line after the first name.
3. 'address' should combine information from two consecutive lines.
4. Convert the 'national_number' from Arabic numerals to Latin numerals (0-9).
5. 'card_id' should be extracted as-is from the last line (it's already in English).
6. For 'dob', include only the year of birth in YYYY format using Latin numerals.
7. If any information is missing, leave the field as an empty string.
""", 'id_front', ai.driverId); //egypt
},
child: Column(
children: [
Image.network(
//api.sefer.live/sefer/card_image/id_front-110822466514385876961.jpg
'${AppLink.server}/card_image/id_front-${ai.driverId}.jpg',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text("Not found any image".tr);
},
),
Text(
'Capture an Image of Your ID Document front'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
GetBuilder<RegisterCaptainController> egyptCarLicenceFront() {
return GetBuilder<RegisterCaptainController>(
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 the following details from the provided car license data and format them into a JSON object:
License Expiration Date
Car Plate
Owner
Address
Car License Data:
JSON Format:
{
"LicenseExpirationDate": "YYYY-MM-DD",
"car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove |
"owner": "[Owner's full name]",
"address": "[Address if available, otherwise 'Not provided']"
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'car_front', ai.driverId);
},
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 the following details from the provided car license data and format them into a JSON object:
License Expiration Date
Car Plate
Owner
Address
Car License Data:
JSON Format:
{
"LicenseExpirationDate": "YYYY-MM-DD",
"car_plate": "[Car plate number]",//the car plate is line next to line contain 'ادارة مرور' for bot numbers and letters in arabic with partition like| but you remove |
"owner": "[Owner's full name]",
"address": "[Address if available, otherwise 'Not provided']"
}
Important notes:
1. For the LicenseExpirationDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Replace all occurrences of '|' (pipe character) with a space in all fields.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'car_front', ai.driverId);
},
child: Column(
children: [
Image.network(
'${AppLink.server}/card_image/car_front-${ai.driverId}.jpg',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text("Not found any image".tr);
},
),
Text(
'Capture an Image of Your car license front'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
GetBuilder<RegisterCaptainController> egyptCarLicenceBack() {
return GetBuilder<RegisterCaptainController>(
builder: (ai) {
if (ai.responseIdCardDriverEgyptBack.isNotEmpty) {
// Get the tax expiry date from the response
final taxExpiryDate = ai.responseIdCardDriverEgyptBack['tax_expiry'];
// final displacement = ai.responseIdCardDriverEgyptBack['displacement'];
// if (int.parse(displacement) < 1000) {}
// Get the inspection date from the response
final inspectionDate =
ai.responseIdCardDriverEgyptBack['inspection_date'];
final year = int.parse(inspectionDate.split('-')[0]);
// Set inspectionDateTime to December 31st of the given year
final inspectionDateTime = DateTime(year, 12, 31);
String carBackLicenseExpired =
inspectionDateTime.toString().split(' ')[0];
// Get the current date
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
bool 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("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
displacement in the line contain (سم٣ )
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'car_back', ai.driverId);
},
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}: $carBackLicenseExpired',
style: TextStyle(
color:
isInspectionExpired ? Colors.red : Colors.green,
),
),
],
),
],
),
),
);
}
return Card(
child: InkWell(
onTap: () async {
ai.allMethodForAI("""
Analyze the extracted car license information and create a JSON object with the following keys:
{
"make": "",
"year": "",
"chassis": "",
"model": "",
"engine": "",
"displacement": "",
"cylinders": "",
"fuel": "",
"color": "",
"color_hex": "",
"inspection_date": "",
"assuranceNumber": "",
"tax_expiry": ""
}
Important notes:
1. For dates (inspection_date and tax_expiry), use the format YYYY-MM-DD with Latin numerals (0-9).
2. Convert the color name to its corresponding hex color code for the 'color_hex' field.
3. Ensure all numeric values (year, displacement, cylinders) are in Latin numerals.
4. If any information is missing, leave the corresponding field as an empty string.
5. Do not include any explanatory text in the JSON fields, only the extracted values.
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'car_back', ai.driverId);
},
child: Column(
children: [
Image.network(
'${AppLink.server}/card_image/car_back-${ai.driverId}.jpg',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
errorBuilder: (BuildContext context, Object exception,
StackTrace? stackTrace) {
return Text("Not found any image".tr);
},
),
Text(
'Capture an Image of Your car license back'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
GetBuilder<RegisterCaptainController> egyptCriminalRecord() {
return GetBuilder<RegisterCaptainController>(
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": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'criminalRecord', ai.driverId);
},
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": "" // Format: YYYY-MM-DD
}
Important notes:
1. For the IssueDate, ensure the date is in YYYY-MM-DD format using Latin numerals (0-9).
2. Add appropriate spaces in all text fields to ensure readability.
3. If any information is missing, leave the corresponding field as an empty string.
4. Ensure all text is properly formatted and spaces are used correctly.
5. Convert any Arabic numerals to Latin numerals (0-9) where applicable.
Please fill in the JSON object with the extracted information, following these guidelines.
""", 'criminalRecord', ai.driverId);
},
child: Column(
children: [
Image.network(
'${AppLink.server}/card_image/6.png',
height: Get.height * .25,
width: double.maxFinite,
fit: BoxFit.fitHeight,
),
Text(
'Capture an Image of Your Criminal Record'.tr,
style: AppStyle.title,
),
],
),
),
);
},
);
}
}