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

@@ -54,8 +54,8 @@ android {
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = 23 minSdk = 23
targetSdk = flutter.targetSdkVersion targetSdk = flutter.targetSdkVersion
versionCode = 120 versionCode = 124
versionName = '1.5.20' versionName = '1.5.24'
multiDexEnabled =true multiDexEnabled =true
} }

View File

@@ -35,7 +35,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>79</string> <string>81</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleURLTypes</key> <key>CFBundleURLTypes</key>
@@ -50,7 +50,7 @@
</dict> </dict>
</array> </array>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>4.0.79</string> <string>4.0.81</string>
<key>FirebaseAppDelegateProxyEnabled</key> <key>FirebaseAppDelegateProxyEnabled</key>
<string>NO</string> <string>NO</string>
<key>GMSApiKey</key> <key>GMSApiKey</key>

View File

@@ -22,6 +22,7 @@ class BoxName {
static const String statusDriverLocation = "statusDriverLocation"; static const String statusDriverLocation = "statusDriverLocation";
static const String rideStatus = "rideStatus"; static const String rideStatus = "rideStatus";
static const String nameArabic = "nameArabic"; static const String nameArabic = "nameArabic";
static const String carYear = "carYear";
static const String password = "password"; static const String password = "password";
static const String isVerified = '0'; static const String isVerified = '0';
static const String arrivalTime = "arrivalTime"; static const String arrivalTime = "arrivalTime";
@@ -44,6 +45,7 @@ class BoxName {
static const String passengerID = "pasengerID"; static const String passengerID = "pasengerID";
static const String phone = "phone"; static const String phone = "phone";
static const String phoneDriver = "phoneDriver"; static const String phoneDriver = "phoneDriver";
static const String is_claimed = "is_claimed";
static const String lastOtpTime = "lastOtpTime"; static const String lastOtpTime = "lastOtpTime";
static const String bankCodeDriver = "bankCodeDriver"; static const String bankCodeDriver = "bankCodeDriver";
static const String accountBankNumberDriver = "accountBankNumberDriver"; static const String accountBankNumberDriver = "accountBankNumberDriver";

View File

@@ -54,6 +54,7 @@ class AppLink {
"$walletDriver/getDriverWeekPaymentMove.php"; "$walletDriver/getDriverWeekPaymentMove.php";
static String getDriversWallet = "$walletDriver/get.php"; static String getDriversWallet = "$walletDriver/get.php";
static String addDriversWalletPoints = "$walletDriver/add.php"; static String addDriversWalletPoints = "$walletDriver/add.php";
static String addpromotionDriver = "$walletDriver/promotionDriver.php";
static String deleteDriversWallet = "$walletDriver/delete.php"; static String deleteDriversWallet = "$walletDriver/delete.php";
static String updateDriversWallet = "$walletDriver/update.php"; static String updateDriversWallet = "$walletDriver/update.php";
@@ -75,6 +76,7 @@ class AppLink {
static String addRides = "$ride/rides/add.php"; static String addRides = "$ride/rides/add.php";
static String getRides = "$ride/rides/get.php"; static String getRides = "$ride/rides/get.php";
static String getMishwari = "$ride/mishwari/get.php"; static String getMishwari = "$ride/mishwari/get.php";
static String getMishwariDriver = "$ride/mishwari/getDriver.php";
static String getTripCountByCaptain = "$ride/rides/getTripCountByCaptain.php"; static String getTripCountByCaptain = "$ride/rides/getTripCountByCaptain.php";
static String getRideOrderID = "$ride/rides/getRideOrderID.php"; static String getRideOrderID = "$ride/rides/getRideOrderID.php";
static String getRideStatus = "$ride/rides/getRideStatus.php"; static String getRideStatus = "$ride/rides/getRideStatus.php";
@@ -273,6 +275,7 @@ class AppLink {
static String auth = '$server/auth'; static String auth = '$server/auth';
static String login = "$auth/login.php"; static String login = "$auth/login.php";
static String signUp = "$auth/signup.php"; static String signUp = "$auth/signup.php";
static String updateDriverClaim = "$auth/captin/updateDriverClaim.php";
static String sendVerifyEmail = "$auth/sendVerifyEmail.php"; static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
static String passengerRemovedAccountEmail = static String passengerRemovedAccountEmail =
"$auth/passengerRemovedAccountEmail.php"; "$auth/passengerRemovedAccountEmail.php";

View File

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

View File

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

View File

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

View File

@@ -383,6 +383,70 @@ class NotificationController extends GetxController {
print('Notifications scheduled every 5 seconds'); print('Notifications scheduled every 5 seconds');
} }
void showTimerNotification(String title, String message, String tone) async {
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
FlutterLocalNotificationsPlugin();
// Setup Android notification
final AndroidNotificationDetails android = AndroidNotificationDetails(
'high_importance_channel',
'High Importance Notifications',
importance: Importance.max,
priority: Priority.high,
showWhen: false,
sound: RawResourceAndroidNotificationSound(
tone), // tone without the file extension
);
// Setup iOS notification
const DarwinNotificationDetails ios = DarwinNotificationDetails(
sound: 'default',
presentAlert: true,
presentBadge: true,
presentSound: true,
);
final NotificationDetails details =
NotificationDetails(android: android, iOS: ios);
// Request permission on Android
if (Platform.isAndroid) {
if (await Permission.scheduleExactAlarm.isDenied) {
if (await Permission.scheduleExactAlarm.request().isGranted) {
print('SCHEDULE_EXACT_ALARM permission granted');
} else {
print('SCHEDULE_EXACT_ALARM permission denied');
return;
}
}
}
// Timer duration (e.g., 120 seconds countdown)
int countdown = 12;
// Display the notification initially with the full countdown time
// Timer to update the notification every second
Timer.periodic(const Duration(seconds: 1), (timer) async {
// if (countdown > 0) {
// Update the existing notification with the updated countdown
// Decrease the countdown by 1
countdown--;
// } else {
// // Cancel the timer when the countdown reaches zero
// timer.cancel();
// }
});
await flutterLocalNotificationsPlugin.show(
0,
title,
'$message Remaining: $countdown seconds', // Initial message
details,
);
print('Notification will update every second');
}
// Callback when the notification is tapped // Callback when the notification is tapped
void onDidReceiveNotificationResponse(NotificationResponse response) { void onDidReceiveNotificationResponse(NotificationResponse response) {
handleNotificationResponse(response); handleNotificationResponse(response);
@@ -448,7 +512,7 @@ class NotificationController extends GetxController {
if (orderData is List && orderData.length == 34) { if (orderData is List && orderData.length == 34) {
closeOverLay(); closeOverLay();
Get.put(HomeCaptainController()).changeRideId(); Get.put(HomeCaptainController()).changeRideId();
Get.to(() => OrderSpeedRequest(), arguments: {'myListString': data}); Get.to(() => OrderRequestPage(), arguments: {'myListString': data});
} else { } else {
Log.print('Invalid order data'); Log.print('Invalid order data');
} }

View File

@@ -233,7 +233,7 @@ class CRUD {
Log.print('response: ${response.body}'); Log.print('response: ${response.body}');
// Log.print('response: ${response.statusCode}'); // Log.print('response: ${response.statusCode}');
// Log.print('response: ${response.reasonPhrase}'); // Log.print('response: ${response.reasonPhrase}');
// Log.print('response: ${payload}'); Log.print('response: ${payload}');
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
if (response.statusCode == 200) { if (response.statusCode == 200) {
if (jsonData['status'] == 'success') { if (jsonData['status'] == 'success') {

View File

@@ -258,7 +258,7 @@ class AI extends GetxController {
await addRegistrationCarEgypt(); await addRegistrationCarEgypt();
if (isCarSaved && isDriverSaved) { if (isCarSaved && isDriverSaved) {
DeviceController().getDeviceSerialNumber(); // DeviceController().getDeviceSerialNumber();
box.write(BoxName.phoneVerified, '1'); box.write(BoxName.phoneVerified, '1');
Get.offAll(() => HomeCaptain()); Get.offAll(() => HomeCaptain());
// Get.offAll(() => HomeCaptain()); // Get.offAll(() => HomeCaptain());
@@ -312,7 +312,7 @@ class AI extends GetxController {
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified', 'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified', 'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
'password': 'password':
Get.find<LoginDriverController>().passwordController.text.isEmpty Get.put(LoginDriverController()).passwordController.text.isEmpty
? box.read(BoxName.emailDriver).toString() ? box.read(BoxName.emailDriver).toString()
: Get.find<LoginDriverController>() : Get.find<LoginDriverController>()
.passwordController .passwordController

View File

@@ -75,16 +75,41 @@ class LocationController extends GetxController {
isActive = Get.find<HomeCaptainController>().isActive; isActive = Get.find<HomeCaptainController>().isActive;
if (isActive) { if (isActive) {
if (double.parse(totalPoints) > -3000) { if (double.parse(totalPoints) > -300) {
await getLocation(); await getLocation();
print(
'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
// Determine the area based on current location // Determine the area
String area = String area =
getLocationArea(myLocation.latitude, myLocation.longitude); getLocationArea(myLocation.latitude, myLocation.longitude);
print('Determined Area: $area'); print('Determined Area: $area');
String endpoint; String endpoint;
switch (area) {
case 'Cairo':
print('Area matched: Cairo');
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
endpoint = AppLink.addCarsLocationCairoEndpoint;
break;
case 'Giza':
print('Area matched: Giza');
box.write(BoxName.serverChosen, AppLink.seferGizaServer);
endpoint = AppLink.addCarsLocationGizaEndpoint;
break;
case 'Alexandria':
print('Area matched: Alexandria');
box.write(
BoxName.serverChosen, AppLink.seferAlexandriaServer);
endpoint = AppLink.addCarsLocationAlexandriaEndpoint;
break;
default:
print('Unknown location area. Fallback to Cairo');
endpoint = AppLink.addCarsLocationCairoEndpoint;
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
}
Log.print('Final Endpoint: $endpoint');
switch (area) { switch (area) {
case 'Cairo': case 'Cairo':
box.write(BoxName.serverChosen, AppLink.seferCairoServer); box.write(BoxName.serverChosen, AppLink.seferCairoServer);

View File

@@ -1,15 +1,18 @@
import 'dart:io'; import 'dart:io';
import 'package:SEFER/constant/links.dart';
import 'package:SEFER/controller/functions/crud.dart';
import 'package:SEFER/views/widgets/mydialoug.dart'; import 'package:SEFER/views/widgets/mydialoug.dart';
import 'package:flutter/material.dart';
import 'package:flutter_confetti/flutter_confetti.dart';
import 'package:flutter_overlay_window/flutter_overlay_window.dart'; import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:location/location.dart'; import 'package:location/location.dart';
// import 'package:permission_handler/permission_handler.dart';
import '../../constant/box_name.dart'; import '../../constant/box_name.dart';
import '../../main.dart'; import '../../main.dart';
import '../../print.dart';
import '../auth/captin/login_captin_controller.dart'; import '../auth/captin/login_captin_controller.dart';
import '../home/payment/captain_wallet_controller.dart';
Future<void> getPermissionOverlay() async { Future<void> getPermissionOverlay() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
@@ -28,6 +31,27 @@ Future<void> getPermissionOverlay() async {
} }
} }
Future<void> showDriverGiftClaim(BuildContext context) async {
if (box.read(BoxName.is_claimed).toString() == '0' ||
box.read(BoxName.is_claimed) == null) {
MyDialog().getDialog('You have gift 300 L.E'.tr, 'text', () async {
var res = await CRUD().post(link: AppLink.updateDriverClaim, payload: {
'driverId': box.read(BoxName.driverID),
});
if (res != 'failure') {
Get.find<CaptainWalletController>()
.addDriverWallet('new driver', '300', '300');
Confetti.launch(
context,
options:
const ConfettiOptions(particleCount: 100, spread: 70, y: 0.6),
);
}
Get.back();
});
}
}
Future<void> closeOverlayIfFound() async { Future<void> closeOverlayIfFound() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
bool isOverlayActive = await FlutterOverlayWindow.isActive(); bool isOverlayActive = await FlutterOverlayWindow.isActive();

View File

@@ -89,7 +89,7 @@ class HomeCaptainController extends GetxController {
isActive = !isActive; isActive = !isActive;
if (isActive) { if (isActive) {
if (double.parse(totalPoints) > -3000) { if (double.parse(totalPoints) > -300) {
locationController.startLocationUpdates(); locationController.startLocationUpdates();
// locationBackController.startBackLocation(); // locationBackController.startBackLocation();
activeStartTime = DateTime.now(); activeStartTime = DateTime.now();

View File

@@ -173,19 +173,20 @@ class MapDriverController extends GetxController {
cancelTripFromDriverAfterApplied() async { cancelTripFromDriverAfterApplied() async {
if (formKeyCancel.currentState!.validate()) { if (formKeyCancel.currentState!.validate()) {
FirebaseMessagesController().sendNotificationToDriverMAP(
"Cancel Trip from driver",
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
.tr,
tokenPassenger,
[],
'cancel.wav',
);
await CRUD().post( await CRUD().post(
link: "${AppLink.seferCairoServer}/ride/rides/update.php", link: "${AppLink.seferCairoServer}/ride/rides/update.php",
payload: { payload: {
"id": rideId.toString(), // Convert to String "id": rideId.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply' "status": 'CancelFromDriverAfterApply'
}); });
if (AppLink.endPoint != AppLink.seferCairoServer) {
CRUD()
.post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
"id": rideId.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply'
});
}
await CRUD().post( await CRUD().post(
link: link:
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php", "${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
@@ -196,6 +197,11 @@ class MapDriverController extends GetxController {
"notes": cancelTripCotroller.text.toString() "notes": cancelTripCotroller.text.toString()
}); });
if (AppLink.endPoint != AppLink.seferCairoServer) { if (AppLink.endPoint != AppLink.seferCairoServer) {
CRUD()
.post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
"id": rideId.toString(), // Convert to String
"status": 'CancelFromDriverAfterApply'
});
CRUD().post( CRUD().post(
link: link:
"${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php", "${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
@@ -206,14 +212,6 @@ class MapDriverController extends GetxController {
"notes": cancelTripCotroller.text.toString() "notes": cancelTripCotroller.text.toString()
}); });
} }
FirebaseMessagesController().sendNotificationToDriverMAP(
"Cancel Trip from driver".tr,
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
.tr,
tokenPassenger,
[],
'cancel.wav',
);
sql.insertData({ sql.insertData({
'order_id': rideId, 'order_id': rideId,
@@ -221,7 +219,7 @@ class MapDriverController extends GetxController {
'driver_id': box.read(BoxName.driverID).toString(), 'driver_id': box.read(BoxName.driverID).toString(),
}, TableName.driverOrdersRefuse); }, TableName.driverOrdersRefuse);
Get.find<HomeCaptainController>().getRefusedOrderByCaptain(); Get.find<HomeCaptainController>().getRefusedOrderByCaptain();
Get.offAll(HomeCaptain()); Get.offAll(() => HomeCaptain());
} }
} }
@@ -550,21 +548,21 @@ class MapDriverController extends GetxController {
Get.find<LocationController>().myLocation.longitude, Get.find<LocationController>().myLocation.longitude,
); );
MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () { MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () {
if (distanceToDestination > 900 || // if (distanceToDestination > 900 ||
(double.parse(distance.toString()) < 1000 && // (double.parse(distance.toString()) < 1000 &&
distanceToDestination > 150)) { // distanceToDestination > 150)) {
Get.back(); Get.back();
finishRideFromDriver1(); finishRideFromDriver1();
} else { // } else {
Get.back(); // Get.back();
if (distanceToDestination <= 150) { // if (distanceToDestination <= 150) {
// todo add scam from start point and dont move // // todo add scam from start point and dont move
// finishRideFromDriver1(); // // finishRideFromDriver1();
} // }
MyDialog().getDialog('you are not moved yet !'.tr, '', () { // MyDialog().getDialog('you are not moved yet !'.tr, '', () {
Get.back(); // Get.back();
}); // });
} // }
}); });
} }
@@ -598,7 +596,7 @@ class MapDriverController extends GetxController {
box.write(BoxName.rideStatus, 'Finished'); box.write(BoxName.rideStatus, 'Finished');
// Get.find<HomeCaptainController>().changeToAppliedRide('Finished'); // Get.find<HomeCaptainController>().changeToAppliedRide('Finished');
// Get.find<HomeCaptainController>().update(); // Get.find<HomeCaptainController>().update();
totalCost = price < 30 totalCost = price < 20
? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady' ? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
? '20' ? '20'
: '30' : '30'
@@ -662,7 +660,8 @@ class MapDriverController extends GetxController {
} }
double pointsSubtraction = 0; double pointsSubtraction = 0;
pointsSubtraction = double.parse(paymentAmount) * (-1); pointsSubtraction =
double.parse(paymentAmount) * (-1) * .08; //for 300 from 3000
var paymentToken2 = var paymentToken2 =
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0)); await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {

View File

@@ -1,12 +1,14 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:SEFER/constant/links.dart'; import 'package:SEFER/constant/links.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'dart:math' as math; import 'dart:math' as math;
import '../../../constant/box_name.dart'; import '../../../constant/box_name.dart';
import '../../../print.dart';
import '../../functions/audio_controller.dart'; import '../../functions/audio_controller.dart';
import '../../functions/crud.dart'; import '../../functions/crud.dart';
import '../../functions/location_controller.dart'; import '../../functions/location_controller.dart';
@@ -15,7 +17,7 @@ import 'home_captain_controller.dart';
class OrderRequestController extends GetxController { class OrderRequestController extends GetxController {
double progress = 0; double progress = 0;
double progressSpeed = 0; double progressSpeed = 0;
int duration = 11; int duration = 15;
int durationSpeed = 20; int durationSpeed = 20;
int remainingTime = 0; int remainingTime = 0;
int remainingTimeSpeed = 0; int remainingTimeSpeed = 0;
@@ -30,12 +32,17 @@ class OrderRequestController extends GetxController {
late int minutes; late int minutes;
@override @override
void onInit() { Future<void> onInit() async {
// AudioController audioController = Get.put(AudioController()); // AudioController audioController = Get.put(AudioController());
print('onInit called');
await initilizeOrderPage();
bool isOverlayActive = await FlutterOverlayWindow.isActive();
if (isOverlayActive) {
await FlutterOverlayWindow.closeOverlay();
}
// audioController.playAudio(); // audioController.playAudio();
// getRefusedOrderByCaptain(); // getRefusedOrderByCaptain();
initilizeOrderPage();
addCustomStartIcon(); addCustomStartIcon();
addCustomEndIcon(); addCustomEndIcon();
@@ -51,34 +58,41 @@ class OrderRequestController extends GetxController {
late double lngPassengerLocation; late double lngPassengerLocation;
late double lngPassengerDestination; late double lngPassengerDestination;
late double latPassengerDestination; late double latPassengerDestination;
initilizeOrderPage() {
final myListString = arguments['myListString']; Future<void> initilizeOrderPage() async {
// final myList = arguments['DriverList']; final myListString = Get.arguments['myListString'];
if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
if (Get.arguments['DriverList'] == null ||
Get.arguments['DriverList'].isEmpty) {
myList = jsonDecode(myListString); myList = jsonDecode(myListString);
Log.print('myList: ${myList}');
} else { } else {
myList = arguments['DriverList']; myList = Get.arguments['DriverList'];
Log.print('myList1: ${myList}');
} }
body = arguments['body']; body = Get.arguments['body'];
Duration durationToAdd = Duration(seconds: int.parse(myList[4])); Duration durationToAdd =
Duration(seconds: (double.tryParse(myList[4]) ?? 0).toInt());
hours = durationToAdd.inHours; hours = durationToAdd.inHours;
minutes = (durationToAdd.inMinutes % 60).round(); minutes = (durationToAdd.inMinutes % 60).round();
startTimerSpeed(myList[6].toString(), body.toString()); startTimerSpeed(myList[6].toString(), body.toString());
var coords = myList[0].split(',');
var coordDestination = myList[1].split(',');
// Parse to double // Instead of splitting, directly use the values from the list
latPassengerLocation = double.parse(coords[0]); // First coordinate pair is at index 0 and 1
lngPassengerLocation = double.parse(coords[1]); latPassengerLocation = double.tryParse(myList[0]) ?? 0.0;
latPassengerDestination = double.parse(coordDestination[0]); lngPassengerLocation = double.tryParse(myList[1]) ?? 0.0;
lngPassengerDestination = double.parse(coordDestination[1]);
// Second coordinate pair is at index 2 and 3
latPassengerDestination = double.tryParse(myList[2]) ?? 0.0;
lngPassengerDestination = double.tryParse(myList[3]) ?? 0.0;
pointsDirection = [ pointsDirection = [
LatLng(latPassengerLocation, lngPassengerLocation), LatLng(latPassengerLocation, lngPassengerLocation),
LatLng(latPassengerDestination, lngPassengerDestination) LatLng(latPassengerDestination, lngPassengerDestination)
]; // Calculate the midpoint between the two points ];
// Calculate the minimum and maximum latitude and longitude values
// Calculate bounds
double minLatitude = double minLatitude =
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude); math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
double maxLatitude = double maxLatitude =
@@ -87,17 +101,18 @@ class OrderRequestController extends GetxController {
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude); math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
double maxLongitude = double maxLongitude =
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude); math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
// Create a bounding box using the calculated values
bounds = LatLngBounds( bounds = LatLngBounds(
southwest: LatLng(minLatitude, minLongitude), southwest: LatLng(minLatitude, minLongitude),
northeast: LatLng(maxLatitude, maxLongitude), northeast: LatLng(maxLatitude, maxLongitude),
); );
update(); update();
} }
getRideDEtailsForBackgroundOrder() async { getRideDEtailsForBackgroundOrder(String rideId) async {
await CRUD().get(link: AppLink.getRidesDetails, payload: { await CRUD().get(link: AppLink.getRidesDetails, payload: {
'id': box.read(BoxName.myList)[2].toString(), 'id': rideId,
}); });
} }
@@ -193,20 +208,14 @@ class OrderRequestController extends GetxController {
'status': 'Refused', 'status': 'Refused',
'driver_id': box.read(BoxName.driverID), 'driver_id': box.read(BoxName.driverID),
}); });
CRUD().post( if (AppLink.endPoint != AppLink.seferCairoServer) {
link: '${AppLink.seferAlexandriaServer}/rides/update.php', CRUD().post(link: '${AppLink.endPoint}/rides/update.php', payload: {
payload: { 'id': orderID,
'id': orderID, // 'rideTimeStart': DateTime.now().toString(),
// 'rideTimeStart': DateTime.now().toString(), 'status': 'Refused',
'status': 'Refused', 'driver_id': box.read(BoxName.driverID),
'driver_id': box.read(BoxName.driverID), });
}); }
CRUD().post(link: '${AppLink.seferGizaServer}/rides/update.php', payload: {
'id': orderID,
// 'rideTimeStart': DateTime.now().toString(),
'status': 'Refused',
'driver_id': box.read(BoxName.driverID),
});
// applied = true; // applied = true;
// if (box.read(BoxName.gender).toString() != 'Female') { // if (box.read(BoxName.gender).toString() != 'Female') {
@@ -252,41 +261,24 @@ class OrderRequestController extends GetxController {
'distance': distance, 'distance': distance,
'duration': duration, 'duration': duration,
}); });
CRUD().post( if (AppLink.endPoint != AppLink.seferCairoServer) {
link: CRUD().post(
'${AppLink.seferAlexandriaServer}/notificationCaptain/addWaitingRide.php', link: '${AppLink.endPoint}/notificationCaptain/addWaitingRide.php',
payload: { payload: {
'id': orderID, 'id': orderID,
'start_location': startLocation, 'start_location': startLocation,
'end_location': endLocation, 'end_location': endLocation,
'date': date, 'date': date,
'time': time, 'time': time,
'price': price, 'price': price,
'passenger_id': passengerId, 'passenger_id': passengerId,
'status': status, 'status': status,
'carType': carType, 'carType': carType,
'passengerRate': passengerRate, 'passengerRate': passengerRate,
'price_for_passenger': priceForPassenger, 'price_for_passenger': priceForPassenger,
'distance': distance, 'distance': distance,
'duration': duration, 'duration': duration,
}); });
CRUD().post( }
link:
'${AppLink.seferGizaServer}/notificationCaptain/addWaitingRide.php',
payload: {
'id': orderID,
'start_location': startLocation,
'end_location': endLocation,
'date': date,
'time': time,
'price': price,
'passenger_id': passengerId,
'status': status,
'carType': carType,
'passengerRate': passengerRate,
'price_for_passenger': priceForPassenger,
'distance': distance,
'duration': duration,
});
} }
} }

View File

@@ -1,8 +1,8 @@
import 'dart:convert'; import 'dart:convert';
import 'package:SEFER/constant/colors.dart';
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/firebase/firbase_messge.dart'; import 'package:SEFER/controller/firebase/firbase_messge.dart';
import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/error_snakbar.dart'; import 'package:SEFER/views/widgets/error_snakbar.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -32,27 +32,34 @@ class CaptainWalletController extends GetxController {
payFromBudget() async { payFromBudget() async {
if (formKey.currentState!.validate()) { if (formKey.currentState!.validate()) {
var pointFromBudget = box.read(BoxName.countryCode) == 'Jordan' var pointFromBudget = int.parse((amountFromBudgetController.text));
? int.parse((amountFromBudgetController.text)) * 100
: int.parse((amountFromBudgetController.text));
await addDriverPaymentPoints('fromBudgetToPoints', // await getPaymentId('fromBudgetToPoints',
int.parse((amountFromBudgetController.text)) * -1); // int.parse((amountFromBudgetController.text)) * -1);
var paymentToken3 = await generateToken( var paymentToken3 =
(int.parse(amountFromBudgetController.text) * -1).toString()); await generateToken((pointFromBudget * -1).toString());
var paymentID = await getPaymentId(
'fromBudgetToPoints', (pointFromBudget * -1).toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: { await CRUD().post(link: AppLink.addDrivePayment, payload: {
'amount': (int.parse(amountFromBudgetController.text) * -1).toString(), 'amount': (pointFromBudget * -1).toString(),
'rideId': paymentID.toString(), 'rideId': paymentID.toString(),
'payment_method': 'myBudget', 'payment_method': 'myBudget',
'passengerID': 'myBudgetToPoint', 'passengerID': 'myBudgetToPoint',
'token': paymentToken3, 'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
}); });
Future.delayed(const Duration(seconds: 2)); Future.delayed(const Duration(seconds: 1));
await addDriverWallet('fromBudget', pointFromBudget.toString()); await addDriverWallet(
'fromBudget', pointFromBudget.toString(), pointFromBudget.toString());
update(); update();
Get.back(); Get.back();
await refreshCaptainWallet(); await refreshCaptainWallet();
NotificationController().showNotification(
'You have successfully charged your account'.tr,
'$pointFromBudget ${'has been added to your budget'.tr}',
'tone1',
'',
);
} }
} }
@@ -148,8 +155,8 @@ class CaptainWalletController extends GetxController {
return d['message']; return d['message'];
} }
late String paymentID; // late String paymentID;
Future<String> addDriverPaymentPoints(String paymentMethod, amount) async { Future<String> getPaymentId(String paymentMethod, amount) async {
// paymentToken = await generateToken(amount); // paymentToken = await generateToken(amount);
var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: { var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: {
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
@@ -157,12 +164,13 @@ class CaptainWalletController extends GetxController {
'payment_method': paymentMethod.toString(), 'payment_method': paymentMethod.toString(),
}); });
var d = jsonDecode(res); var d = jsonDecode(res);
paymentID = d['message'].toString(); // paymentID = d['message'].toString();
return paymentID; return d['message'];
} }
Future addDriverWallet(String paymentMethod, point) async { Future addDriverWallet(String paymentMethod, point, count) async {
paymentToken = await generateToken(point); paymentToken = await generateToken(count);
var paymentID = await getPaymentId(paymentMethod, point);
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
'paymentID': paymentID.toString(), 'paymentID': paymentID.toString(),
@@ -172,15 +180,66 @@ class CaptainWalletController extends GetxController {
}); });
} }
Future addDriverPayment(String paymentMethod, point, wayPay) async {
paymentToken = await generateToken(point);
var paymentID = await getPaymentId(paymentMethod, point.toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'amount': point.toString(),
'rideId': paymentID.toString(),
'payment_method': paymentMethod,
'passengerID': wayPay,
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
});
}
Future addDriverWalletFromPromo(String paymentMethod, point) async {
var resPromotion =
await CRUD().post(link: AppLink.addpromotionDriver, payload: {
'driver_id': box.read(BoxName.driverID).toString(),
'payment_amount': point,
'timePromo': paymentMethod,
});
if (resPromotion != 'failure') {
paymentToken = await generateToken(point);
var paymentID = await getPaymentId(paymentMethod, point.toString());
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
'amount': point,
'rideId': paymentID.toString(),
'payment_method': paymentMethod.toString(),
'passengerID': paymentMethod,
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
});
if (res != 'failure') {
String title = 'wallet_updated'.tr; // Notification title
String message = '${'wallet_credited_message'.tr} $point';
String tone = 'default_tone'.tr; // Notification tone or sound
String payLoad =
'wallet_updated'; // Additional data payload for the notification
Get.find<NotificationController>()
.showNotification(title, message, tone, payLoad);
}
} else {
Get.back();
mySnackeBarError(
"A promotion record for this driver already exists for today.".tr);
}
}
Future addDriverWalletToInvitor(String paymentMethod, driverID, point) async { Future addDriverWalletToInvitor(String paymentMethod, driverID, point) async {
paymentToken = await generateToken(point); paymentToken = await generateToken(point);
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { var paymentID = await getPaymentId(paymentMethod, point.toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'driverID': driverID, 'driverID': driverID,
'paymentID': paymentID.toString(),
'amount': point, 'amount': point,
'token': paymentToken, 'token': paymentToken,
'paymentMethod': paymentMethod.toString(), 'rideId': paymentID.toString(),
'payment_method': paymentMethod.toString(),
'passengerID': paymentMethod,
}); });
await addSeferWallet(paymentMethod, (double.parse(point) * -1).toString());
} }
Future addSeferWallet(String paymentMethod, String point) async { Future addSeferWallet(String paymentMethod, String point) async {
@@ -195,10 +254,11 @@ class CaptainWalletController extends GetxController {
} }
Future addTransferDriversWallet(String paymentMethod1, paymentMethod2) async { Future addTransferDriversWallet(String paymentMethod1, paymentMethod2) async {
paymentID = await addDriverPaymentPoints( var paymentID =
paymentMethod1, amountFromBudgetController.text); await getPaymentId(paymentMethod1, amountFromBudgetController.text);
paymentToken = await generateToken( paymentToken = await generateToken(
(int.parse(amountFromBudgetController.text) * -1).toString()); (int.parse(amountFromBudgetController.text) * -1).toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: { await CRUD().post(link: AppLink.addDrivePayment, payload: {
'amount': (int.parse(amountFromBudgetController.text) * -1).toString(), 'amount': (int.parse(amountFromBudgetController.text) * -1).toString(),
'rideId': paymentID.toString(), 'rideId': paymentID.toString(),
@@ -208,15 +268,15 @@ class CaptainWalletController extends GetxController {
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
}); });
paymentID = await addDriverPaymentPoints(paymentMethod2, paymentID = await getPaymentId(paymentMethod2,
(int.parse(amountFromBudgetController.text) - 5).toString()); (int.parse(amountFromBudgetController.text) - 5).toString());
paymentToken = await generateToken(amountFromBudgetController.text); paymentToken = await generateToken(amountFromBudgetController.text);
var res1 = var res1 =
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
'driverID': amountToNewDriverMap[0]['id'].toString(), 'driverID': amountToNewDriverMap[0]['id'].toString(),
'paymentID': paymentID.toString(), 'paymentID': paymentID.toString(),
'amount': ((int.parse(amountFromBudgetController.text) - 5) / 'amount': ((int.parse(amountFromBudgetController.text) - 5))
kazan) // double.parse(kazan) .08 for egypt // kazan) // double.parse(kazan) .08 for egypt
.toStringAsFixed( .toStringAsFixed(
0), // this will convert buddget to poitns by kazan .08 0), // this will convert buddget to poitns by kazan .08

View File

@@ -4,6 +4,18 @@ class MyTranslation extends Translations {
@override @override
Map<String, Map<String, String>> get keys => { Map<String, Map<String, String>> get keys => {
"ar": { "ar": {
'Passenger Information': 'معلومات الراكب',
'Name': 'الاسم',
"wallet_updated": "تم تحديث المحفظة",
"wallet_credited_message": "تم إضافة",
"default_tone": "النغمة الافتراضية",
"No orders available": "لا توجد طلبات متوفرة",
'Phone': 'رقم الهاتف',
"A promotion record for this driver already exists for today.":
"يوجد بالفعل سجل ترويج لهذا السائق لهذا اليوم.",
'Gender': 'الجنس',
'time Selected': 'الوقت المختار',
'Ride Status': 'حالة الرحلة',
'If you need any help or have questions, this is the right place to do that. You are welcome!': 'If you need any help or have questions, this is the right place to do that. You are welcome!':
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!', 'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
'ID Mismatch': "عدم تطابق الرقم التعريفي", 'ID Mismatch': "عدم تطابق الرقم التعريفي",
@@ -52,7 +64,10 @@ class MyTranslation extends Translations {
"incorrect_document_title": "وثيقة غير صحيحة", "incorrect_document_title": "وثيقة غير صحيحة",
"incorrect_document_message": "incorrect_document_message":
"الرجاء تحميل {expected} الصحيحة. تم الكشف عن {detected}.", "الرجاء تحميل {expected} الصحيحة. تم الكشف عن {detected}.",
"driver_license": "رخصة_القيادة", "driver_license": "رخصة_القيادة", "minute": "دقيقة",
"kilometer": "كم",
"You have successfully charged your account": "تم شحن حسابك بنجاح",
"has been added to your budget": "تمت إضافته إلى ميزانيتك",
"id_front": "هوية_أمامية", "id_front": "هوية_أمامية",
"id_back": "هوية_خلفية", "id_back": "هوية_خلفية",
"car_back": "سيارة_خلفية", "car_back": "سيارة_خلفية",
@@ -139,6 +154,7 @@ class MyTranslation extends Translations {
"Central Bank Of Egypt": "البنك المركزي المصري", "Central Bank Of Egypt": "البنك المركزي المصري",
"ATTIJARIWAFA BANK Egypt": "البنك التجاري وفا مصر", "ATTIJARIWAFA BANK Egypt": "البنك التجاري وفا مصر",
"Morning Promo": "بونص الصباح", "Morning Promo": "بونص الصباح",
'You have gift 300 L.E': "لديك هدية بقيمة 300 جنيه.",
"VIP Order": "طلب VIP", "VIP Order Accepted": "تم قبول طلب VIP.", "VIP Order": "طلب VIP", "VIP Order Accepted": "تم قبول طلب VIP.",
"The driver accepted your trip": "السائق قبل رحلتك.", "The driver accepted your trip": "السائق قبل رحلتك.",
"this is count of your all trips in the morning promo today from 7:00am-10:00am": "this is count of your all trips in the morning promo today from 7:00am-10:00am":
@@ -156,8 +172,8 @@ class MyTranslation extends Translations {
"Please enter a health insurance status.": "Please enter a health insurance status.":
"يرجى إدخال حالة التأمين الصحي", "يرجى إدخال حالة التأمين الصحي",
"Sefer Driver": "سفر السائق", "Sefer Driver": "سفر السائق",
"The 3000 points equal 3000 L.E for you \nSo go and gain your money": "The 300 points equal 300 L.E for you \nSo go and gain your money":
"3000 نقطة تساوي 3000 جنيه لك \nلذا اذهب واحصل على أموالك", "300 نقطة تساوي 300 جنيه لك \nلذا اذهب واحصل على أموالك",
"Info": "معلومات", "Info": "معلومات",
"You dont have money in your Wallet": "ليس لديك أموال في محفظتك", "You dont have money in your Wallet": "ليس لديك أموال في محفظتك",
"You dont have money in your Wallet or you should less transfer 5 LE to activate": "You dont have money in your Wallet or you should less transfer 5 LE to activate":
@@ -564,7 +580,7 @@ Store your money with us and receive it in your bank as a monthly salary.''':
"before": "قبل", "before": "قبل",
'SEFER': 'سفر', 'SEFER': 'سفر',
"Code not approved": "الرمز غير موافق عليه", "Code not approved": "الرمز غير موافق عليه",
"3000 LE": "3000 جنيه مصري", "300 LE": "300 جنيه مصري",
"Do you have an invitation code from another driver?": "Do you have an invitation code from another driver?":
"هل لديك كود دعوة من سائق آخر؟", "هل لديك كود دعوة من سائق آخر؟",
"Paste the code here": "الصق الكود هنا", "Paste the code here": "الصق الكود هنا",
@@ -1118,11 +1134,10 @@ Store your money with us and receive it in your bank as a monthly salary.''':
"Share Trip Details": "شارك تفاصيل الرحلة", "Share Trip Details": "شارك تفاصيل الرحلة",
"Car Plate is": "لوحة السيارة", "Car Plate is": "لوحة السيارة",
'L.E': 'ج.م', 'L.E': 'ج.م',
"the 3000 points equal 3000 L.E for you": "the 300 points equal 300 L.E for you":
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك", "الـ 300 نقطة تعادل 300 جنيه مصري بالنسبة لك",
"So go and gain your money": "انطلق واكسب مالك", "So go and gain your money": "انطلق واكسب مالك",
"the 3000 points equal 3000 L.E": "the 300 points equal 300 L.E": "الـ 300 نقطة تساوي 300 جنيه مصري",
"الـ 3000 نقطة تساوي 3000 جنيه مصري",
"The payment was not approved. Please try again.": "The payment was not approved. Please try again.":
"لم يتم الموافقة على الدفع. يرجى المحاولة مرة أخرى.", "لم يتم الموافقة على الدفع. يرجى المحاولة مرة أخرى.",
"Payment Failed": "تعذرت عملية الدفع", "Payment Failed": "تعذرت عملية الدفع",
@@ -1146,8 +1161,8 @@ Store your money with us and receive it in your bank as a monthly salary.''':
' is ON for this month': ' لهذا الشهر ', ' is ON for this month': ' لهذا الشهر ',
"Origin": "الأصل", "Origin": "الأصل",
"Destination": "مكان الوصول", "Destination": "مكان الوصول",
'the 3000 points equal 3000 L.E for you \nSo go and gain your money': 'the 300 points equal 300 L.E for you \nSo go and gain your money':
"ال3000 نقطة تعادل 3000 ج.م لك، فاذهب واكسب مالك.", "ال300 نقطة تعادل 300 ج.م لك، فاذهب واكسب مالك.",
"Driver Name": "اسم السائق", "Driver Name": "اسم السائق",
"Driver Car Plate": "لوحة سيارة السائق", "Driver Car Plate": "لوحة سيارة السائق",
"Available for rides": "‏الرحلات المتوفرة", "Available for rides": "‏الرحلات المتوفرة",

View File

@@ -2,9 +2,7 @@ import 'dart:convert';
import 'dart:math'; import 'dart:math';
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/functions/location_controller.dart'; import 'package:SEFER/controller/functions/location_controller.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
@@ -18,21 +16,55 @@ class RideAvailableController extends GetxController {
Map rideAvailableMap = {}; Map rideAvailableMap = {};
late LatLng southwest; late LatLng southwest;
late LatLng northeast; late LatLng northeast;
LatLngBounds calculateBounds( // LatLngBounds calculateBounds(
double centerLat, double centerLng, double radius) { // double centerLat, double centerLng, double radius) {
// double radius = 4000; // 10 km in meters // // double radius = 4000; // 10 km in meters
southwest = LatLng( // southwest = LatLng(
centerLat - (radius / 111000), // centerLat - (radius / 111000),
centerLng - (radius / (111000 * cos(centerLat))), // centerLng - (radius / (111000 * cos(centerLat))),
// );
// northeast = LatLng(
// centerLat + (radius / 111000),
// centerLng + (radius / (111000 * cos(centerLat))),
// );
// return LatLngBounds(southwest: southwest, northeast: northeast);
// }
LatLngBounds calculateBounds(double lat, double lng, double radiusInMeters) {
const double earthRadius = 6378137.0; // Earth's radius in meters
double latDelta = (radiusInMeters / earthRadius) * (180 / pi);
double lngDelta =
(radiusInMeters / (earthRadius * cos(pi * lat / 180))) * (180 / pi);
double minLat = lat - latDelta;
double maxLat = lat + latDelta;
double minLng = lng - lngDelta;
double maxLng = lng + lngDelta;
// Ensure the latitude is between -90 and 90
minLat = max(-90.0, minLat);
maxLat = min(90.0, maxLat);
// Ensure the longitude is between -180 and 180
minLng = (minLng + 180) % 360 - 180;
maxLng = (maxLng + 180) % 360 - 180;
// Ensure the bounds are in the correct order
if (minLng > maxLng) {
double temp = minLng;
minLng = maxLng;
maxLng = temp;
}
return LatLngBounds(
southwest: LatLng(minLat, minLng),
northeast: LatLng(maxLat, maxLng),
); );
northeast = LatLng(
centerLat + (radius / 111000),
centerLng + (radius / (111000 * cos(centerLat))),
);
return LatLngBounds(southwest: southwest, northeast: northeast);
} }
getRideAvailable() async { getRideAvailable() async {

View File

@@ -591,12 +591,12 @@ class PaymentController extends GetxController {
billingData: PaymobBillingDataWallet(), billingData: PaymobBillingDataWallet(),
onPayment: (PaymobResponseWallet response) {}, onPayment: (PaymobResponseWallet response) {},
); );
Log.print('message: ${response!.message}'); // Log.print('message: ${response!.message}');
Log.print('responseCode: ${response.responseCode}'); // Log.print('responseCode: ${response.responseCode}');
Log.print('success: ${response.success}'); // Log.print('success: ${response.success}');
Log.print('transactionID: ${response.transactionID}'); // Log.print('transactionID: ${response.transactionID}');
if (response.responseCode.toString() == '200' && if (response!.success == true &&
response.success == true) { response.message.toString() == 'Approved') {
// Log.print('transactionID wewer: ${response.transactionID}'); // Log.print('transactionID wewer: ${response.transactionID}');
Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor); Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor);
method(); method();

View File

@@ -128,31 +128,26 @@ class RateController extends GetxController {
middleText: '', middleText: '',
confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back())); confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back()));
} else { } else {
await CRUD() await CRUD().post(
.post(link: "${AppLink.seferCairoServer}/rate/add.php", payload: { link: "${AppLink.seferCairoServer}/ride/rate/add.php",
'passenger_id': passengerId,
'driverID': box.read(BoxName.driverID).toString(),
'rideId': rideId,
'rating': selectedRateItemId.toString(),
'comment': comment.text,
});
CRUD().post(
link: "${AppLink.seferAlexandriaServer}/rate/add.php",
payload: { payload: {
'passenger_id': passengerId, 'passenger_id': passengerId,
'driverID': box.read(BoxName.driverID).toString(), 'driverID': box.read(BoxName.driverID).toString(),
'rideId': rideId, 'rideId': rideId.toString(),
'rating': selectedRateItemId.toString(), 'rating': selectedRateItemId.toString(),
'comment': comment.text, 'comment': comment.text ?? 'none',
}); });
CRUD().post(link: AppLink.seferGizaServer, payload: { if (AppLink.endPoint != AppLink.seferCairoServer) {
'passenger_id': passengerId, CRUD().post(link: "${AppLink.endPoint}/ride/rate/add.php", payload: {
'driverID': box.read(BoxName.driverID).toString(), 'passenger_id': passengerId,
'rideId': rideId, 'driverID': box.read(BoxName.driverID).toString(),
'rating': selectedRateItemId.toString(), 'rideId': rideId.toString(),
'comment': comment.text, 'rating': selectedRateItemId.toString(),
}); 'comment': comment.text ?? 'none',
await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, { });
}
CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
'startLocation': 'startLocation':
Get.find<MapDriverController>().passengerLocation.toString(), Get.find<MapDriverController>().passengerLocation.toString(),
'endLocation': 'endLocation':

View File

@@ -60,12 +60,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
Log.print('Error decoding JSON: $e'); Log.print('Error decoding JSON: $e');
myList = []; myList = [];
} }
NotificationController().showNotification(
message.notification!.title.toString(),
message.notification!.body.toString(),
'order',
myListString,
);
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
bool isOverlayActive = await FlutterOverlayWindow.isActive(); bool isOverlayActive = await FlutterOverlayWindow.isActive();
@@ -82,6 +77,12 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
width: WindowSize.matchParent, width: WindowSize.matchParent,
startPosition: const OverlayPosition(0, -150), startPosition: const OverlayPosition(0, -150),
); );
NotificationController().showNotification(
message.notification!.title.toString(),
message.notification!.body.toString(),
'order',
myListString,
);
await FlutterOverlayWindow.shareData(myList); await FlutterOverlayWindow.shareData(myList);
} }

View File

@@ -465,7 +465,7 @@ class InviteScreen extends StatelessWidget {
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
Text( Text(
'$countOfInvitDriver / 6 ${'Trip'.tr}', // Show trips completed '$countOfInvitDriver / 3 ${'Trip'.tr}', // Show trips completed
style: const TextStyle( style: const TextStyle(
fontSize: 13, fontSize: 13,
color: CupertinoColors.secondaryLabel, color: CupertinoColors.secondaryLabel,

View File

@@ -41,9 +41,9 @@ class HomeCaptain extends StatelessWidget {
closeOverlayIfFound(); closeOverlayIfFound();
checkForUpdate(context); checkForUpdate(context);
getPermissionOverlay(); getPermissionOverlay();
showDriverGiftClaim(context);
// getPermissionLocation1(); // getPermissionLocation1();
await showFirstTimeOfferNotification(context); // await showFirstTimeOfferNotification(context);
}); });
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
@@ -424,7 +424,7 @@ showFirstTimeOfferNotification(BuildContext context) async {
borderRadius: BorderRadius.circular(15), borderRadius: BorderRadius.circular(15),
), ),
child: Text( child: Text(
'3000 LE'.tr, '300 LE'.tr,
style: const TextStyle( style: const TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 25, fontSize: 25,

View File

@@ -7,7 +7,6 @@ import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import '../../../../../constant/style.dart'; import '../../../../../constant/style.dart';
import '../../../../widgets/elevated_btn.dart'; import '../../../../widgets/elevated_btn.dart';
import '../../../../../controller/home/captin/home_captain_controller.dart'; import '../../../../../controller/home/captin/home_captain_controller.dart';
import '../../../../../controller/home/captin/order_request_controller.dart';
class ConnectWidget extends StatelessWidget { class ConnectWidget extends StatelessWidget {
const ConnectWidget({ const ConnectWidget({
@@ -27,14 +26,14 @@ class ConnectWidget extends StatelessWidget {
builder: (homeCaptainController) => int.parse( builder: (homeCaptainController) => int.parse(
homeCaptainController.countRefuse) > homeCaptainController.countRefuse) >
3 || 3 ||
double.parse(captainWalletController.totalPoints) < -3000 double.parse(captainWalletController.totalPoints) < -300
? CupertinoButton( ? CupertinoButton(
onPressed: () { onPressed: () {
Get.defaultDialog( Get.defaultDialog(
// backgroundColor: CupertinoColors.destructiveRed, // backgroundColor: CupertinoColors.destructiveRed,
barrierDismissible: false, barrierDismissible: false,
title: double.parse(captainWalletController.totalPoints) < title: double.parse(captainWalletController.totalPoints) <
-3000 -300
? 'You dont have Points'.tr ? 'You dont have Points'.tr
: 'You Are Stopped For this Day !'.tr, : 'You Are Stopped For this Day !'.tr,
titleStyle: AppStyle.title, titleStyle: AppStyle.title,
@@ -44,7 +43,7 @@ class ConnectWidget extends StatelessWidget {
onPressed: () async { onPressed: () async {
double.parse( double.parse(
captainWalletController.totalPoints) < captainWalletController.totalPoints) <
-3000 -300
? await Get.find<TextToSpeechController>() ? await Get.find<TextToSpeechController>()
.speakText( .speakText(
'You must be recharge your Account' 'You must be recharge your Account'
@@ -58,7 +57,7 @@ class ConnectWidget extends StatelessWidget {
), ),
Text( Text(
double.parse(captainWalletController.totalPoints) < double.parse(captainWalletController.totalPoints) <
-3000 -300
? 'You must be recharge your Account'.tr ? 'You must be recharge your Account'.tr
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!' : 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
.tr, .tr,
@@ -68,7 +67,7 @@ class ConnectWidget extends StatelessWidget {
), ),
confirm: confirm:
double.parse(captainWalletController.totalPoints) < double.parse(captainWalletController.totalPoints) <
-3000 -300
? MyElevatedButton( ? MyElevatedButton(
title: 'Recharge my Account'.tr, title: 'Recharge my Account'.tr,
onPressed: () { onPressed: () {

View File

@@ -1,6 +1,8 @@
import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/constant/box_name.dart';
import 'package:SEFER/controller/firebase/local_notification.dart'; import 'package:SEFER/controller/firebase/local_notification.dart';
import 'package:SEFER/main.dart'; import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/orderCaptin/order_request_page.dart';
import 'package:SEFER/views/home/Captin/orderCaptin/order_speed_request.dart';
import 'package:SEFER/views/home/Captin/orderCaptin/vip_order_page.dart'; import 'package:SEFER/views/home/Captin/orderCaptin/vip_order_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart';
@@ -9,6 +11,8 @@ import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import '../../../../../constant/colors.dart'; import '../../../../../constant/colors.dart';
import '../../../../../controller/home/payment/captain_wallet_controller.dart';
import '../../../../../print.dart';
import '../../../../Rate/ride_calculate_driver.dart'; import '../../../../Rate/ride_calculate_driver.dart';
import '../../../../../controller/functions/location_controller.dart'; import '../../../../../controller/functions/location_controller.dart';
@@ -175,32 +179,29 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
), ),
// Platform.isAndroid // Platform.isAndroid
// ? // ?
AnimatedContainer( int.parse(box.read(BoxName.carYear).toString()) > 2023
duration: const Duration(microseconds: 200), ? AnimatedContainer(
width: controller.widthMapTypeAndTraffic, duration: const Duration(microseconds: 200),
decoration: BoxDecoration( width: controller.widthMapTypeAndTraffic,
color: AppColor.secondaryColor, decoration: BoxDecoration(
border: Border.all(color: AppColor.blueColor), color: AppColor.secondaryColor,
borderRadius: BorderRadius.circular(15)), border: Border.all(color: AppColor.blueColor),
child: Builder(builder: (context) { borderRadius: BorderRadius.circular(15)),
return IconButton( child: Builder(builder: (context) {
onPressed: () async { return IconButton(
// mySnakeBarError('ad'); onPressed: () async {
Get.to(() => VipOrderPage(), arguments: { // mySnakeBarError('ad');
'myListString': 'myListString', Get.to(() => VipOrderPage());
'DriverList': 'myList', },
// 'PolylineJson': myPoints, icon: const Icon(
'body': 'message.notification!.body' Octicons.watch,
}); size: 29,
}, color: AppColor.blueColor,
icon: const Icon( ),
FontAwesome5.window_close, );
size: 29, }),
color: AppColor.blueColor, )
), : const SizedBox(),
);
}),
),
// : const SizedBox(), // : const SizedBox(),
// AnimatedContainer( // AnimatedContainer(
// duration: const Duration(microseconds: 200), // duration: const Duration(microseconds: 200),
@@ -212,84 +213,84 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// child: Builder(builder: (context) { // child: Builder(builder: (context) {
// return IconButton( // return IconButton(
// onPressed: () async { // onPressed: () async {
// // Get.to(() => LoginCaptin()); // NotificationController()
// // print(box.read(BoxName.myList)); // .showTimerNotification('title', 'message', 'tone1');
// // Bubble().startBubbleHead(sendAppToBackground: true); // // Get.to(() => OrderRequestPage(), arguments: {
// List<String> d = [ // // 'myListString': [
// "30.003028,31.2419628", // // "30.1068014,31.244621",
// "30.0955661,31.2665336", // // "30.0664345,31.2857709",
// "160.00", // // "68.56",
// "25.92", // // "25.92",
// "1488", // // "1445",
// "16.93", // // "11.29",
// "114243034311436865474", // // "114243034311436865474",
// "113172279072358305645", // // "114243034311436865474",
// "hamza ayed", // // "sefer app",
// "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3", // // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
// "+201023248456", // // "+201023248456",
// "1 min", // // "0",
// "1 m", // // "0",
// "false", // // "true",
// "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9", // // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
// "0", // // "0",
// "238", // // "1087",
// "false", // // "false",
// "114243034311436865474", // // "114243034311436865474",
// "1488", // // "1445",
// "startEnd", // // "startEnd",
// "30.049307749732176,31.274291574954987", // // "30.08517654446625,31.27303797751665",
// "", // // "",
// "", // // "",
// "", // // "",
// "", // // "",
// "17.73", // // "13.98",
// "0", // // "0",
// "hamzaayedflutter@gmail.com", // // "sefertraveling@gmail.com",
// "الفسطاط، حي مصر القديمة، مصر", // // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
// " الزاوية الحمراء، محافظة القاهرة، مصر", // // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة 4391080، مصر",
// "Speed", // // "Speed",
// "8", // // "8",
// "5.00" // // "5.00"
// ]; // // ],
// // 'DriverList': [
// box.write(BoxName.rideArguments, { // // "30.1068014,31.244621",
// 'passengerLocation': d[0].toString(), // // "30.0664345,31.2857709",
// 'passengerDestination': d[1].toString(), // // "68.56",
// 'Duration': d[4].toString(), // // "25.92",
// 'totalCost': d[26].toString(), // // "1445",
// 'Distance': d[5].toString(), // // "11.29",
// 'name': d[8].toString(), // // "114243034311436865474",
// 'phone': d[10].toString(), // // "114243034311436865474",
// 'email': d[28].toString(), // // "sefer app",
// 'WalletChecked': d[13].toString(), // // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
// 'tokenPassenger': d[9].toString(), // // "+201023248456",
// 'direction': // // "0",
// 'https://www.google.com/maps/dir/${d[0]}/${d[1]}/', // // "0",
// 'DurationToPassenger': d[15].toString(), // // "true",
// 'rideId': d[16].toString(), // // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
// 'passengerId': d[7].toString(), // // "0",
// 'driverId': d[18].toString(), // // "1087",
// 'durationOfRideValue': d[19].toString(), // // "false",
// 'paymentAmount': d[2].toString(), // // "114243034311436865474",
// 'paymentMethod': // // "1445",
// d[13].toString() == 'true' ? 'visa' : 'cash', // // "startEnd",
// 'isHaveSteps': d[20].toString(), // // "30.08517654446625,31.27303797751665",
// 'step0': d[21].toString(), // // "",
// 'step1': d[22].toString(), // // "",
// 'step2': d[23].toString(), // // "",
// 'step3': d[24].toString(), // // "",
// 'step4': d[25].toString(), // // "13.98",
// 'passengerWalletBurc': d[26].toString(), // // "0",
// 'timeOfOrder': DateTime.now().toString(), // // "sefertraveling@gmail.com",
// 'totalPassenger': d[2].toString(), // // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
// 'carType': d[31].toString(), // // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة‬ 4391080، مصر",
// 'kazan': d[32].toString(), // // "Speed",
// 'startNameLocation': d[29].toString(), // // "8",
// 'endNameLocation': d[30].toString(), // // "5.00"
// }); // // ],
// Get.to(() => PassengerLocationMapPage(), // // // 'PolylineJson': myPoints,
// arguments: box.read(BoxName.rideArguments)); // // // 'body': message.notification!.body
// // Get.offAll(() => HomeCaptainController()); // // });
// }, // },
// icon: const Icon( // icon: const Icon(
// FontAwesome5.grin_tears, // FontAwesome5.grin_tears,
@@ -299,7 +300,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
// ); // );
// }), // }),
// ), // ),
// ,
const SizedBox( const SizedBox(
height: 5, height: 5,
), ),

View File

@@ -23,7 +23,7 @@ class GoogleDriverMap extends StatelessWidget {
builder: (controller) => Column( builder: (controller) => Column(
children: [ children: [
SizedBox( SizedBox(
height: Get.height * .6, height: Get.height * .92,
child: GoogleMap( child: GoogleMap(
onMapCreated: controller.onMapCreated, onMapCreated: controller.onMapCreated,
zoomControlsEnabled: true, zoomControlsEnabled: true,

File diff suppressed because it is too large Load Diff

View File

@@ -23,17 +23,6 @@ class OrderSpeedRequest extends StatelessWidget {
Get.put(OrderRequestController()); Get.put(OrderRequestController());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// void addCustomStartIcon() async {
// Create the marker with the resized image
// orderRequestController.initilizeOrderPage();
// }
// double mpg = 0;
// calculateConsumptionFuel() {
// mpg = Get.find<HomeCaptainController>().fuelPrice /
// 12; //todo in register car add mpg in box
// }
return GetBuilder<OrderRequestController>( return GetBuilder<OrderRequestController>(
builder: (orderRequestController) { builder: (orderRequestController) {
return MyScafolld( return MyScafolld(
@@ -188,7 +177,7 @@ class OrderSpeedRequest extends StatelessWidget {
height: 5, height: 5,
), ),
Container( Container(
height: Get.height * .22, height: Get.height * .3,
width: Get.width * .9, width: Get.width * .9,
decoration: AppStyle.boxDecoration1, decoration: AppStyle.boxDecoration1,
child: Padding( child: Padding(

View File

@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../../main.dart'; import '../../../../main.dart';
import '../../../../print.dart';
class VipOrderPage extends StatelessWidget { class VipOrderPage extends StatelessWidget {
const VipOrderPage({super.key}); const VipOrderPage({super.key});
@@ -19,10 +20,58 @@ class VipOrderPage extends StatelessWidget {
title: 'VIP Order'.tr, title: 'VIP Order'.tr,
body: [ body: [
GetBuilder<VipOrderController>(builder: (vipOrderController) { GetBuilder<VipOrderController>(builder: (vipOrderController) {
if (vipOrderController.isLoading) {
return const Center(
child: CircularProgressIndicator(),
);
}
if (vipOrderController.tripData.isEmpty) {
return Center(
child: Text('No orders available'.tr),
);
}
final order = vipOrderController.tripData[0];
Log.print('order: ${order}');
return SafeArea( return SafeArea(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column( child: Column(
children: [], crossAxisAlignment: CrossAxisAlignment.start,
)); children: [
// Passenger Section
_buildSectionTitle('Passenger Information'.tr),
_buildInfoCard(
children: [
_buildDetailRow('Name'.tr,
'${order['passengerName'] ?? 'Unknown'} ${order['passengerLastName'] ?? ''}'),
_buildDetailRow(
'Phone'.tr, order['passengerPhone'] ?? 'Unknown'),
_buildDetailRow(
'Gender'.tr, order['passengergender'] ?? 'Unknown'),
_buildDetailRow('time Selected'.tr,
order['timeSelected'] ?? 'Unknown'),
_buildDetailRow(
'Ride Status'.tr, order['status'] ?? 'Unknown'),
// _buildDetailRow('Ride Status'.tr,
// vipOrderController.myList[4] ?? 'Unknown'),
IconButton(
onPressed: () {
// print(vipOrderController.myList);
},
icon: const Icon(Icons.add),
),
],
),
const SizedBox(height: 24),
// Action Buttons
_buildActionButtons(context),
],
),
),
);
}) })
], ],
isleading: true, isleading: true,
@@ -30,39 +79,158 @@ class VipOrderPage extends StatelessWidget {
} }
} }
Widget _buildSectionTitle(String title) {
return Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
title,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
);
}
Widget _buildInfoCard({required List<Widget> children}) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.2),
spreadRadius: 1,
blurRadius: 5,
offset: const Offset(0, 3),
),
],
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
),
),
);
}
Widget _buildDetailRow(String label, String value) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 2,
child: Text(
label,
style: const TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
),
Expanded(
flex: 3,
child: Text(
value,
style: const TextStyle(color: Colors.black54),
),
),
],
),
);
}
Widget _buildActionButtons(BuildContext context) {
return Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () => _onReject(context),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text(
'Reject'.tr,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(width: 16),
Expanded(
child: ElevatedButton(
onPressed: () => _onApply(context),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
child: Text(
'Apply'.tr,
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
],
);
}
void _onReject(BuildContext context) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Ride Rejected'),
backgroundColor: Colors.red,
),
);
}
void _onApply(BuildContext context) {
// TODO: Implement application logic
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Ride Applied'),
backgroundColor: Colors.green,
),
);
}
class VipOrderController extends GetxController { class VipOrderController extends GetxController {
bool isLoading = false; bool isLoading = false;
final arguments = Get.arguments;
late String body;
List tripData = []; List tripData = [];
var myList;
initilize() {
final myListString = arguments['myListString'];
if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
myList = jsonDecode(myListString);
} else {
myList = arguments['DriverList'];
}
body = arguments['body'];
update();
}
fetchOrder() async { fetchOrder() async {
var res = await CRUD().get(link: AppLink.getMishwari, payload: { isLoading = true; // Set loading state
update(); // Notify listeners
var res = await CRUD().get(link: AppLink.getMishwariDriver, payload: {
'driverId': box.read(BoxName.driverID).toString(), 'driverId': box.read(BoxName.driverID).toString(),
}); });
if (res != 'failure') { if (res != 'failure') {
tripData = jsonDecode(res)['message']; tripData = jsonDecode(res)['message'];
update(); } else {
tripData = [];
} }
isLoading = false; // Loading complete
update(); // Notify listeners
} }
@override @override
void onInit() async { void onInit() async {
await initilize();
fetchOrder(); fetchOrder();
super.onInit(); super.onInit();
} }

View File

@@ -49,10 +49,10 @@ class PointsCaptain extends StatelessWidget {
box.read(BoxName.countryCode) == 'Egypt' box.read(BoxName.countryCode) == 'Egypt'
? 'EGP' ? 'EGP'
: 'JOD', () async { : 'JOD', () async {
await captainWalletController.addDriverPaymentPoints( // await captainWalletController.getPaymentId(
'visa-in', pricePoint); // 'visa-in', pricePoint);
await captainWalletController.addDriverWallet( await captainWalletController.addDriverWallet(
'visa-in', countPoint); 'visa-in', countPoint, pricePoint);
await captainWalletController.addSeferWallet( await captainWalletController.addSeferWallet(
'visa-in', pricePoint.toString()); 'visa-in', pricePoint.toString());
await captainWalletController await captainWalletController
@@ -93,12 +93,11 @@ class PointsCaptain extends StatelessWidget {
box.read(BoxName.countryCode) == 'Egypt' box.read(BoxName.countryCode) == 'Egypt'
? 'EGP' ? 'EGP'
: 'JOD', () async { : 'JOD', () async {
// await captainWalletController
// .getPaymentId('visa-in', pricePoint);
await captainWalletController await captainWalletController
.addDriverPaymentPoints( .addDriverWallet('visa-in',
'visa-in', pricePoint); countPoint, pricePoint);
await captainWalletController
.addDriverWallet(
'visa-in', countPoint);
await captainWalletController await captainWalletController
.addSeferWallet( .addSeferWallet(
'visa-in', pricePoint.toString()); 'visa-in', pricePoint.toString());
@@ -115,10 +114,10 @@ class PointsCaptain extends StatelessWidget {
: await paymentController.makePaymentStripe(pricePoint, : await paymentController.makePaymentStripe(pricePoint,
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp', box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
() async { () async {
await captainWalletController.addDriverPaymentPoints( // await captainWalletController.getPaymentId(
'visa-in', pricePoint); // 'visa-in', pricePoint);
await captainWalletController.addDriverWallet( await captainWalletController.addDriverWallet(
'visa-in', countPoint); 'visa-in', countPoint, pricePoint);
await captainWalletController.getCaptainWalletFromBuyPoints(); await captainWalletController.getCaptainWalletFromBuyPoints();
}); });
}, },

View File

@@ -55,11 +55,11 @@ class WalletCaptain extends StatelessWidget {
double.parse(captainWalletController double.parse(captainWalletController
.totalPoints .totalPoints
.toString()) > .toString()) >
-3000 -300
? AppColor.yellowColor ? AppColor.yellowColor
: double.parse(captainWalletController.totalPoints : double.parse(captainWalletController.totalPoints
.toString()) < .toString()) <
-3000 -300
? AppColor.redColor ? AppColor.redColor
: AppColor.greenColor, : AppColor.greenColor,
child: InkWell( child: InkWell(
@@ -70,7 +70,7 @@ class WalletCaptain extends StatelessWidget {
return CupertinoAlertDialog( return CupertinoAlertDialog(
title: Text('Info'.tr), title: Text('Info'.tr),
content: Text( content: Text(
'The 3000 points equal 3000 L.E for you \nSo go and gain your money' 'The 300 points equal 300 L.E for you \nSo go and gain your money'
.tr, .tr,
), ),
actions: <Widget>[ actions: <Widget>[
@@ -99,7 +99,7 @@ class WalletCaptain extends StatelessWidget {
const SizedBox(height: 10), const SizedBox(height: 10),
if (double.parse(captainWalletController.totalPoints if (double.parse(captainWalletController.totalPoints
.toString()) < .toString()) <
-3000) -300)
CupertinoButton.filled( CupertinoButton.filled(
child: Text('Charge your Account'.tr), child: Text('Charge your Account'.tr),
onPressed: () { onPressed: () {
@@ -193,6 +193,7 @@ class WalletCaptain extends StatelessWidget {
children: [ children: [
_buildPromoCard( _buildPromoCard(
title: 'Morning Promo'.tr, title: 'Morning Promo'.tr,
timePromo: 'Morning Promo',
count: captainWalletController count: captainWalletController
.walletDate['message'][0] .walletDate['message'][0]
['morning_count'], ['morning_count'],
@@ -204,6 +205,7 @@ class WalletCaptain extends StatelessWidget {
const SizedBox( const SizedBox(
height: 16), // Add space between the cards height: 16), // Add space between the cards
_buildPromoCard( _buildPromoCard(
timePromo: 'Afternoon Promo',
title: 'Afternoon Promo'.tr, title: 'Afternoon Promo'.tr,
count: captainWalletController count: captainWalletController
.walletDate['message'][0] .walletDate['message'][0]
@@ -308,12 +310,18 @@ class WalletCaptain extends StatelessWidget {
Widget _buildPromoCard( Widget _buildPromoCard(
{required String title, {required String title,
required timePromo,
required int count, required int count,
required int maxCount, required int maxCount,
required String description}) { required String description}) {
return InkWell( return InkWell(
onTap: () { onTap: () {
MyDialog().getDialog(title, description, () { MyDialog().getDialog(title, description, () async {
if (count == 5) {
Get.find<CaptainWalletController>()
.addDriverWalletFromPromo(timePromo, 50);
}
Get.back(); Get.back();
}); });
}, },
@@ -443,25 +451,25 @@ class WalletCaptain extends StatelessWidget {
kolor: AppColor.greyColor, kolor: AppColor.greyColor,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80, pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80,
countPoint: countPoint:
box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '1000', box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '80',
), ),
PointsCaptain( PointsCaptain(
kolor: AppColor.bronze, kolor: AppColor.bronze,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200, pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200,
countPoint: countPoint:
box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '2500', box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '210',
), ),
PointsCaptain( PointsCaptain(
kolor: AppColor.goldenBronze, kolor: AppColor.goldenBronze,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400, pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400,
countPoint: countPoint:
box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '5100', box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '450',
), ),
PointsCaptain( PointsCaptain(
kolor: AppColor.gold, kolor: AppColor.gold,
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000, pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000,
countPoint: countPoint:
box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '130000', box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '1100',
), ),
], ],
), ),

View File

@@ -1,5 +1,6 @@
import 'package:SEFER/constant/style.dart'; import 'package:SEFER/constant/style.dart';
import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart'; import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
import 'package:SEFER/views/auth/captin/criminal_documents_page.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart'; import 'package:SEFER/views/widgets/elevated_btn.dart';
import 'package:SEFER/views/widgets/mycircular.dart'; import 'package:SEFER/views/widgets/mycircular.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -52,8 +53,17 @@ class ProfileCaptain extends StatelessWidget {
Get.to(() => CaptainsCars()); Get.to(() => CaptainsCars());
}, },
), ),
const SizedBox(
height: 5,
),
MyElevatedButton(
title: 'Add criminal page'.tr,
onPressed: () async {
Get.to(() => CriminalDocumemtPage());
},
),
SizedBox( SizedBox(
height: Get.height * .8, height: Get.height * .7,
child: DriverProfileCard( child: DriverProfileCard(
driverId: driverId:
controller.captainProfileData['driverID'] ?? controller.captainProfileData['driverID'] ??

View File

@@ -566,6 +566,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.3.3" version: "3.3.3"
flutter_confetti:
dependency: "direct main"
description:
name: flutter_confetti
sha256: "22fc66984c17aea73e3cd300666609c4581176c00c31d4513b1e16758f75cb08"
url: "https://pub.dev"
source: hosted
version: "0.3.4"
flutter_contacts: flutter_contacts:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@@ -87,6 +87,7 @@ dependencies:
googleapis_auth: ^1.6.0 googleapis_auth: ^1.6.0
video_player: ^2.9.2 video_player: ^2.9.2
youtube_player_flutter: ^9.0.4 youtube_player_flutter: ^9.0.4
flutter_confetti: ^0.3.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: