This commit is contained in:
Hamza-Ayed
2024-12-01 10:17:23 +02:00
parent 5aeb3cf685
commit 0129162309
34 changed files with 1317 additions and 875 deletions

View File

@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/views/widgets/mydialoug.dart';
@@ -159,21 +160,32 @@ Download the SEFER app now and enjoy your ride!
//claim your gift
if (driverInvitationData[index]['isGiftToken'].toString() == '0') {
Get.back();
await Get.find<CaptainWalletController>()
.addDriverWallet('paymentMethod', '500');
// add for invitor too
await Get.find<CaptainWalletController>().addDriverWalletToInvitor(
'paymentMethod',
driverInvitationData[index]['driverInviterId'],
'500');
await CRUD().post(
link: AppLink.updateInviteDriver,
payload: {'id': driverInvitationData[index]['id']});
await Get.find<CaptainWalletController>().addDriverPayment(
'paymentMethod',
'500',
'',
);
// add for invitor too
await Get.find<CaptainWalletController>().addDriverWalletToInvitor(
'paymentMethod',
driverInvitationData[index]['driverInviterId'],
'500',
);
await Get.find<CaptainWalletController>()
.addSeferWallet('giftInvitation', '-1000');
NotificationCaptainController().addNotificationCaptain(
driverInvitationData[index]['driverInviterId'].toString(),
"You have got a gift for invitation".tr,
'${"You have 500".tr} ${'LE'}',
false);
NotificationController().showNotification(
"You have got a gift for invitation".tr,
'${"You have 500".tr} ${'LE'}',
'tone1',
'');
} else {
Get.back();
MyDialog().getDialog("You have got a gift".tr,
@@ -188,12 +200,12 @@ Download the SEFER app now and enjoy your ride!
void onSelectPassengerInvitation(int index) async {
MyDialog().getDialog(
driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6
driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 3
? '${'When'.tr} ${driverInvitationDataToPassengers[index]['passengerName']} ${"complete, you can claim your gift".tr} '
: 'You deserve the gift'.tr,
'${driverInvitationDataToPassengers[index]['passengerName']} ${driverInvitationDataToPassengers[index]['countOfInvitDriver']} / 6 ${'Trip'.tr}',
() async {
if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 6) {
if (driverInvitationDataToPassengers[index]['countOfInvitDriver'] < 3) {
Get.back();
} else {
// Claim the gift if 100 trips are completed
@@ -203,7 +215,7 @@ Download the SEFER app now and enjoy your ride!
Get.back();
// Add wallet to the inviter
await Get.find<CaptainWalletController>()
.addDriverWallet('paymentMethod', '50');
.addDriverWallet('paymentMethod', '50', '50');
// add for invitor too
await Get.find<CaptainWalletController>().addDriverWalletToInvitor(
'paymentMethod',

View File

@@ -145,7 +145,9 @@ class LoginDriverController extends GetxController {
box.write(BoxName.phoneVerified,
jsonDecoeded['data'][0]['is_verified'].toString());
box.write(BoxName.phoneDriver, jsonDecoeded['data'][0]['phone']);
box.write(BoxName.is_claimed, jsonDecoeded['data'][0]['is_claimed']);
box.write(BoxName.nameArabic, jsonDecoeded['data'][0]['name_arabic']);
box.write(BoxName.carYear, jsonDecoeded['data'][0]['year']);
box.write(
BoxName.bankCodeDriver, jsonDecoeded['data'][0]['bankCode']);
box.write(BoxName.accountBankNumberDriver,

View File

@@ -269,12 +269,8 @@ class RegisterCaptainController extends GetxController {
update();
}
// Show error message in case of invalid phone number
void _showErrorMessage(String message) {
mySnackeBarError(message);
}
verifySMSCode() async {
// var loginDriverController = Get.put(LoginDriverController());
if (formKey3.currentState!.validate()) {
var res = await CRUD().post(link: AppLink.verifyOtpDriver, payload: {
'phone_number': '+2${phoneController.text}',
@@ -285,24 +281,16 @@ class RegisterCaptainController extends GetxController {
box.write(BoxName.phoneDriver, '+2${phoneController.text}');
box.write(BoxName.phoneVerified, '1');
// var res1 = await CRUD().post(
// link: AppLink.updateAccountBank,
// payload: {'phone': '+2${phoneController.text}'});
// if (res1 != 'failure') {
Get.find<LoginDriverController>().isGoogleLogin == true
? await Get.put(LoginDriverController())
.loginUsingCredentialsWithoutGoogle(
Get.find<LoginDriverController>()
.passwordController
.text
.toString(),
box.read(BoxName.emailDriver).toString(),
)
: await Get.put(LoginDriverController()).loginUsingCredentials(
box.read(BoxName.driverID).toString(),
box.read(BoxName.emailDriver).toString(),
);
// Get.to(EgyptCardAI());
// loginDriverController.isGoogleLogin == true
// ? await loginDriverController.loginUsingCredentialsWithoutGoogle(
// loginDriverController.passwordController.text.toString(),
// box.read(BoxName.emailDriver).toString(),
// )
// : await loginDriverController.loginUsingCredentials(
// box.read(BoxName.driverID).toString(),
// box.read(BoxName.emailDriver).toString(),
// );
Get.to(EgyptCardAI());
// } else {
// Get.snackbar('title', 'message');
// }