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',