This commit is contained in:
Hamza-Ayed
2024-07-16 18:13:40 +03:00
parent 4ffaa591fa
commit e6305f4ddc
9 changed files with 246 additions and 140 deletions

View File

@@ -25,11 +25,32 @@ class AI extends GetxController {
bool approved = false;
bool isDriverSaved = false;
bool isCarSaved = false;
bool isInviteDriverFound = false;
final invitationCodeController = TextEditingController();
final formKey = GlobalKey<FormState>();
void setApproved() {
approved = true;
update();
}
Future updateInvitationCodeFromRegister() async {
if (formKey.currentState!.validate()) {
var res = await CRUD().post(
link: AppLink.updateInvitationCodeFromRegister,
payload: {"inviteCode": invitationCodeController.text});
if (res != 'failure') {
isInviteDriverFound = true;
update();
Get.snackbar("Code approved".tr, '',
backgroundColor: AppColor.greenColor);
} else {
Get.snackbar("Code not approved".tr, '',
backgroundColor: AppColor.redColor);
}
}
}
final today = DateTime.now();
Future<void> addDriverAndCarEgypt() async {
@@ -48,7 +69,7 @@ class AI extends GetxController {
taxExpiryDateTime != null && taxExpiryDateTime.isBefore(today);
// Check if the inspection date is before today
final inspectionDateTime = DateTime(year, 1, 1);
final inspectionDateTime = DateTime(year, 12, 31);
final isInspectionExpired = inspectionDateTime.isBefore(today);
if (isExpiredCar || isInspectionExpired) {
@@ -60,7 +81,7 @@ class AI extends GetxController {
const Icon(Icons.warning, size: 48, color: Colors.red),
const SizedBox(height: 16),
Text(
'Your drivers license and/or car tax has expired. Please renew them before proceeding.'
"Your drivers license and/or car tax has expired. Please renew them before proceeding."
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
@@ -69,7 +90,7 @@ class AI extends GetxController {
IconButton(
onPressed: () async {
await Get.find<TextToSpeechController>().speakText(
'Your drivers license and/or car tax has expired. Please renew them before proceeding.'
"Your drivers license and/or car tax has expired. Please renew them before proceeding."
.tr,
);
},
@@ -95,7 +116,7 @@ class AI extends GetxController {
const Icon(Icons.warning, size: 48, color: Colors.red),
const SizedBox(height: 16),
Text(
'Your drivers license has expired. Please renew it before proceeding.'
"Your drivers license has expired. Please renew it before proceeding."
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
@@ -104,9 +125,8 @@ class AI extends GetxController {
IconButton(
onPressed: () async {
await Get.find<TextToSpeechController>().speakText(
'Your drivers license has expired. Please renew it before proceeding.'
.tr,
);
"Your drivers license has expired. Please renew it before proceeding."
.tr);
},
icon: const Icon(Icons.volume_up),
),
@@ -132,7 +152,7 @@ class AI extends GetxController {
const Icon(Icons.warning, size: 48, color: Colors.red),
const SizedBox(height: 16),
Text(
'The national number on your drivers license does not match the one on your ID document. Please verify and provide the correct documents.'
"The national number on your drivers license does not match the one on your ID document. Please verify and provide the correct documents."
.tr,
textAlign: TextAlign.center,
style: AppStyle.title,
@@ -141,7 +161,8 @@ class AI extends GetxController {
IconButton(
onPressed: () async {
await Get.find<TextToSpeechController>().speakText(
'The national number on your drivers license does not match the one on your ID document. Please verify and provide the correct documents.',
"The national number on your drivers license does not match the one on your ID document. Please verify and provide the correct documents."
.tr,
);
},
icon: const Icon(Icons.volume_up),