12/1/1
This commit is contained in:
@@ -22,6 +22,7 @@ class BoxName {
|
||||
static const String statusDriverLocation = "statusDriverLocation";
|
||||
static const String rideStatus = "rideStatus";
|
||||
static const String nameArabic = "nameArabic";
|
||||
static const String carYear = "carYear";
|
||||
static const String password = "password";
|
||||
static const String isVerified = '0';
|
||||
static const String arrivalTime = "arrivalTime";
|
||||
@@ -44,6 +45,7 @@ class BoxName {
|
||||
static const String passengerID = "pasengerID";
|
||||
static const String phone = "phone";
|
||||
static const String phoneDriver = "phoneDriver";
|
||||
static const String is_claimed = "is_claimed";
|
||||
static const String lastOtpTime = "lastOtpTime";
|
||||
static const String bankCodeDriver = "bankCodeDriver";
|
||||
static const String accountBankNumberDriver = "accountBankNumberDriver";
|
||||
|
||||
@@ -54,6 +54,7 @@ class AppLink {
|
||||
"$walletDriver/getDriverWeekPaymentMove.php";
|
||||
static String getDriversWallet = "$walletDriver/get.php";
|
||||
static String addDriversWalletPoints = "$walletDriver/add.php";
|
||||
static String addpromotionDriver = "$walletDriver/promotionDriver.php";
|
||||
static String deleteDriversWallet = "$walletDriver/delete.php";
|
||||
static String updateDriversWallet = "$walletDriver/update.php";
|
||||
|
||||
@@ -75,6 +76,7 @@ class AppLink {
|
||||
static String addRides = "$ride/rides/add.php";
|
||||
static String getRides = "$ride/rides/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 getRideOrderID = "$ride/rides/getRideOrderID.php";
|
||||
static String getRideStatus = "$ride/rides/getRideStatus.php";
|
||||
@@ -273,6 +275,7 @@ class AppLink {
|
||||
static String auth = '$server/auth';
|
||||
static String login = "$auth/login.php";
|
||||
static String signUp = "$auth/signup.php";
|
||||
static String updateDriverClaim = "$auth/captin/updateDriverClaim.php";
|
||||
static String sendVerifyEmail = "$auth/sendVerifyEmail.php";
|
||||
static String passengerRemovedAccountEmail =
|
||||
"$auth/passengerRemovedAccountEmail.php";
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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');
|
||||
// }
|
||||
|
||||
@@ -383,6 +383,70 @@ class NotificationController extends GetxController {
|
||||
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
|
||||
void onDidReceiveNotificationResponse(NotificationResponse response) {
|
||||
handleNotificationResponse(response);
|
||||
@@ -448,7 +512,7 @@ class NotificationController extends GetxController {
|
||||
if (orderData is List && orderData.length == 34) {
|
||||
closeOverLay();
|
||||
Get.put(HomeCaptainController()).changeRideId();
|
||||
Get.to(() => OrderSpeedRequest(), arguments: {'myListString': data});
|
||||
Get.to(() => OrderRequestPage(), arguments: {'myListString': data});
|
||||
} else {
|
||||
Log.print('Invalid order data');
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ class CRUD {
|
||||
Log.print('response: ${response.body}');
|
||||
// Log.print('response: ${response.statusCode}');
|
||||
// Log.print('response: ${response.reasonPhrase}');
|
||||
// Log.print('response: ${payload}');
|
||||
Log.print('response: ${payload}');
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (response.statusCode == 200) {
|
||||
if (jsonData['status'] == 'success') {
|
||||
|
||||
@@ -258,7 +258,7 @@ class AI extends GetxController {
|
||||
await addRegistrationCarEgypt();
|
||||
|
||||
if (isCarSaved && isDriverSaved) {
|
||||
DeviceController().getDeviceSerialNumber();
|
||||
// DeviceController().getDeviceSerialNumber();
|
||||
box.write(BoxName.phoneVerified, '1');
|
||||
Get.offAll(() => HomeCaptain());
|
||||
// Get.offAll(() => HomeCaptain());
|
||||
@@ -312,7 +312,7 @@ class AI extends GetxController {
|
||||
'phone': box.read(BoxName.phoneDriver)?.toString() ?? 'Not specified',
|
||||
'id': box.read(BoxName.driverID)?.toString() ?? 'Not specified',
|
||||
'password':
|
||||
Get.find<LoginDriverController>().passwordController.text.isEmpty
|
||||
Get.put(LoginDriverController()).passwordController.text.isEmpty
|
||||
? box.read(BoxName.emailDriver).toString()
|
||||
: Get.find<LoginDriverController>()
|
||||
.passwordController
|
||||
|
||||
@@ -75,16 +75,41 @@ class LocationController extends GetxController {
|
||||
isActive = Get.find<HomeCaptainController>().isActive;
|
||||
|
||||
if (isActive) {
|
||||
if (double.parse(totalPoints) > -3000) {
|
||||
if (double.parse(totalPoints) > -300) {
|
||||
await getLocation();
|
||||
print(
|
||||
'Latitude: ${myLocation.latitude}, Longitude: ${myLocation.longitude}');
|
||||
|
||||
// Determine the area based on current location
|
||||
// Determine the area
|
||||
String area =
|
||||
getLocationArea(myLocation.latitude, myLocation.longitude);
|
||||
print('Determined Area: $area');
|
||||
|
||||
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) {
|
||||
case 'Cairo':
|
||||
box.write(BoxName.serverChosen, AppLink.seferCairoServer);
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
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:flutter/material.dart';
|
||||
import 'package:flutter_confetti/flutter_confetti.dart';
|
||||
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:location/location.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../../print.dart';
|
||||
import '../auth/captin/login_captin_controller.dart';
|
||||
import '../home/payment/captain_wallet_controller.dart';
|
||||
|
||||
Future<void> getPermissionOverlay() async {
|
||||
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 {
|
||||
if (Platform.isAndroid) {
|
||||
bool isOverlayActive = await FlutterOverlayWindow.isActive();
|
||||
|
||||
@@ -89,7 +89,7 @@ class HomeCaptainController extends GetxController {
|
||||
|
||||
isActive = !isActive;
|
||||
if (isActive) {
|
||||
if (double.parse(totalPoints) > -3000) {
|
||||
if (double.parse(totalPoints) > -300) {
|
||||
locationController.startLocationUpdates();
|
||||
// locationBackController.startBackLocation();
|
||||
activeStartTime = DateTime.now();
|
||||
|
||||
@@ -173,19 +173,20 @@ class MapDriverController extends GetxController {
|
||||
|
||||
cancelTripFromDriverAfterApplied() async {
|
||||
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(
|
||||
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||
payload: {
|
||||
"id": rideId.toString(), // Convert to String
|
||||
"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(
|
||||
link:
|
||||
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
||||
@@ -196,6 +197,11 @@ class MapDriverController extends GetxController {
|
||||
"notes": cancelTripCotroller.text.toString()
|
||||
});
|
||||
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(
|
||||
link:
|
||||
"${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
||||
@@ -206,14 +212,6 @@ class MapDriverController extends GetxController {
|
||||
"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({
|
||||
'order_id': rideId,
|
||||
@@ -221,7 +219,7 @@ class MapDriverController extends GetxController {
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
}, TableName.driverOrdersRefuse);
|
||||
Get.find<HomeCaptainController>().getRefusedOrderByCaptain();
|
||||
Get.offAll(HomeCaptain());
|
||||
Get.offAll(() => HomeCaptain());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,21 +548,21 @@ class MapDriverController extends GetxController {
|
||||
Get.find<LocationController>().myLocation.longitude,
|
||||
);
|
||||
MyDialog().getDialog('Are you sure to exit ride ?'.tr, '', () {
|
||||
if (distanceToDestination > 900 ||
|
||||
(double.parse(distance.toString()) < 1000 &&
|
||||
distanceToDestination > 150)) {
|
||||
Get.back();
|
||||
finishRideFromDriver1();
|
||||
} else {
|
||||
Get.back();
|
||||
if (distanceToDestination <= 150) {
|
||||
// todo add scam from start point and dont move
|
||||
// finishRideFromDriver1();
|
||||
}
|
||||
MyDialog().getDialog('you are not moved yet !'.tr, '', () {
|
||||
Get.back();
|
||||
});
|
||||
}
|
||||
// if (distanceToDestination > 900 ||
|
||||
// (double.parse(distance.toString()) < 1000 &&
|
||||
// distanceToDestination > 150)) {
|
||||
Get.back();
|
||||
finishRideFromDriver1();
|
||||
// } else {
|
||||
// Get.back();
|
||||
// if (distanceToDestination <= 150) {
|
||||
// // todo add scam from start point and dont move
|
||||
// // finishRideFromDriver1();
|
||||
// }
|
||||
// MyDialog().getDialog('you are not moved yet !'.tr, '', () {
|
||||
// Get.back();
|
||||
// });
|
||||
// }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -598,7 +596,7 @@ class MapDriverController extends GetxController {
|
||||
box.write(BoxName.rideStatus, 'Finished');
|
||||
// Get.find<HomeCaptainController>().changeToAppliedRide('Finished');
|
||||
// Get.find<HomeCaptainController>().update();
|
||||
totalCost = price < 30
|
||||
totalCost = price < 20
|
||||
? carType != 'Comfort' && carType != 'Mishwar Vip' && carType != 'Lady'
|
||||
? '20'
|
||||
: '30'
|
||||
@@ -662,7 +660,8 @@ class MapDriverController extends GetxController {
|
||||
}
|
||||
|
||||
double pointsSubtraction = 0;
|
||||
pointsSubtraction = double.parse(paymentAmount) * (-1);
|
||||
pointsSubtraction =
|
||||
double.parse(paymentAmount) * (-1) * .08; //for 300 from 3000
|
||||
var paymentToken2 =
|
||||
await generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
|
||||
var res = await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_overlay_window/flutter_overlay_window.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:SEFER/constant/links.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'dart:math' as math;
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../print.dart';
|
||||
import '../../functions/audio_controller.dart';
|
||||
import '../../functions/crud.dart';
|
||||
import '../../functions/location_controller.dart';
|
||||
@@ -15,7 +17,7 @@ import 'home_captain_controller.dart';
|
||||
class OrderRequestController extends GetxController {
|
||||
double progress = 0;
|
||||
double progressSpeed = 0;
|
||||
int duration = 11;
|
||||
int duration = 15;
|
||||
int durationSpeed = 20;
|
||||
int remainingTime = 0;
|
||||
int remainingTimeSpeed = 0;
|
||||
@@ -30,12 +32,17 @@ class OrderRequestController extends GetxController {
|
||||
late int minutes;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
Future<void> onInit() async {
|
||||
// AudioController audioController = Get.put(AudioController());
|
||||
|
||||
print('onInit called');
|
||||
await initilizeOrderPage();
|
||||
bool isOverlayActive = await FlutterOverlayWindow.isActive();
|
||||
if (isOverlayActive) {
|
||||
await FlutterOverlayWindow.closeOverlay();
|
||||
}
|
||||
// audioController.playAudio();
|
||||
// getRefusedOrderByCaptain();
|
||||
initilizeOrderPage();
|
||||
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
|
||||
@@ -51,34 +58,41 @@ class OrderRequestController extends GetxController {
|
||||
late double lngPassengerLocation;
|
||||
late double lngPassengerDestination;
|
||||
late double latPassengerDestination;
|
||||
initilizeOrderPage() {
|
||||
final myListString = arguments['myListString'];
|
||||
// final myList = arguments['DriverList'];
|
||||
if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
|
||||
|
||||
Future<void> initilizeOrderPage() async {
|
||||
final myListString = Get.arguments['myListString'];
|
||||
|
||||
if (Get.arguments['DriverList'] == null ||
|
||||
Get.arguments['DriverList'].isEmpty) {
|
||||
myList = jsonDecode(myListString);
|
||||
Log.print('myList: ${myList}');
|
||||
} else {
|
||||
myList = arguments['DriverList'];
|
||||
myList = Get.arguments['DriverList'];
|
||||
Log.print('myList1: ${myList}');
|
||||
}
|
||||
|
||||
body = arguments['body'];
|
||||
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
|
||||
body = Get.arguments['body'];
|
||||
Duration durationToAdd =
|
||||
Duration(seconds: (double.tryParse(myList[4]) ?? 0).toInt());
|
||||
hours = durationToAdd.inHours;
|
||||
minutes = (durationToAdd.inMinutes % 60).round();
|
||||
startTimerSpeed(myList[6].toString(), body.toString());
|
||||
var coords = myList[0].split(',');
|
||||
var coordDestination = myList[1].split(',');
|
||||
|
||||
// Parse to double
|
||||
latPassengerLocation = double.parse(coords[0]);
|
||||
lngPassengerLocation = double.parse(coords[1]);
|
||||
latPassengerDestination = double.parse(coordDestination[0]);
|
||||
lngPassengerDestination = double.parse(coordDestination[1]);
|
||||
// Instead of splitting, directly use the values from the list
|
||||
// First coordinate pair is at index 0 and 1
|
||||
latPassengerLocation = double.tryParse(myList[0]) ?? 0.0;
|
||||
lngPassengerLocation = double.tryParse(myList[1]) ?? 0.0;
|
||||
|
||||
// Second coordinate pair is at index 2 and 3
|
||||
latPassengerDestination = double.tryParse(myList[2]) ?? 0.0;
|
||||
lngPassengerDestination = double.tryParse(myList[3]) ?? 0.0;
|
||||
|
||||
pointsDirection = [
|
||||
LatLng(latPassengerLocation, lngPassengerLocation),
|
||||
LatLng(latPassengerDestination, lngPassengerDestination)
|
||||
]; // Calculate the midpoint between the two points
|
||||
// Calculate the minimum and maximum latitude and longitude values
|
||||
];
|
||||
|
||||
// Calculate bounds
|
||||
double minLatitude =
|
||||
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
|
||||
double maxLatitude =
|
||||
@@ -87,17 +101,18 @@ class OrderRequestController extends GetxController {
|
||||
math.min(pointsDirection[0].longitude, pointsDirection[1].longitude);
|
||||
double maxLongitude =
|
||||
math.max(pointsDirection[0].longitude, pointsDirection[1].longitude);
|
||||
// Create a bounding box using the calculated values
|
||||
|
||||
bounds = LatLngBounds(
|
||||
southwest: LatLng(minLatitude, minLongitude),
|
||||
northeast: LatLng(maxLatitude, maxLongitude),
|
||||
);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
getRideDEtailsForBackgroundOrder() async {
|
||||
getRideDEtailsForBackgroundOrder(String rideId) async {
|
||||
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',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
});
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferAlexandriaServer}/rides/update.php',
|
||||
payload: {
|
||||
'id': orderID,
|
||||
// 'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Refused',
|
||||
'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),
|
||||
});
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(link: '${AppLink.endPoint}/rides/update.php', payload: {
|
||||
'id': orderID,
|
||||
// 'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Refused',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
});
|
||||
}
|
||||
|
||||
// applied = true;
|
||||
// if (box.read(BoxName.gender).toString() != 'Female') {
|
||||
@@ -252,41 +261,24 @@ class OrderRequestController extends GetxController {
|
||||
'distance': distance,
|
||||
'duration': duration,
|
||||
});
|
||||
CRUD().post(
|
||||
link:
|
||||
'${AppLink.seferAlexandriaServer}/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,
|
||||
});
|
||||
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,
|
||||
});
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link: '${AppLink.endPoint}/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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.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/error_snakbar.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -32,27 +32,34 @@ class CaptainWalletController extends GetxController {
|
||||
|
||||
payFromBudget() async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
var pointFromBudget = box.read(BoxName.countryCode) == 'Jordan'
|
||||
? int.parse((amountFromBudgetController.text)) * 100
|
||||
: int.parse((amountFromBudgetController.text));
|
||||
var pointFromBudget = int.parse((amountFromBudgetController.text));
|
||||
|
||||
await addDriverPaymentPoints('fromBudgetToPoints',
|
||||
int.parse((amountFromBudgetController.text)) * -1);
|
||||
var paymentToken3 = await generateToken(
|
||||
(int.parse(amountFromBudgetController.text) * -1).toString());
|
||||
// await getPaymentId('fromBudgetToPoints',
|
||||
// int.parse((amountFromBudgetController.text)) * -1);
|
||||
var paymentToken3 =
|
||||
await generateToken((pointFromBudget * -1).toString());
|
||||
var paymentID = await getPaymentId(
|
||||
'fromBudgetToPoints', (pointFromBudget * -1).toString());
|
||||
await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||
'amount': (int.parse(amountFromBudgetController.text) * -1).toString(),
|
||||
'amount': (pointFromBudget * -1).toString(),
|
||||
'rideId': paymentID.toString(),
|
||||
'payment_method': 'myBudget',
|
||||
'passengerID': 'myBudgetToPoint',
|
||||
'token': paymentToken3,
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
Future.delayed(const Duration(seconds: 2));
|
||||
await addDriverWallet('fromBudget', pointFromBudget.toString());
|
||||
Future.delayed(const Duration(seconds: 1));
|
||||
await addDriverWallet(
|
||||
'fromBudget', pointFromBudget.toString(), pointFromBudget.toString());
|
||||
update();
|
||||
Get.back();
|
||||
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'];
|
||||
}
|
||||
|
||||
late String paymentID;
|
||||
Future<String> addDriverPaymentPoints(String paymentMethod, amount) async {
|
||||
// late String paymentID;
|
||||
Future<String> getPaymentId(String paymentMethod, amount) async {
|
||||
// paymentToken = await generateToken(amount);
|
||||
var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: {
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
@@ -157,12 +164,13 @@ class CaptainWalletController extends GetxController {
|
||||
'payment_method': paymentMethod.toString(),
|
||||
});
|
||||
var d = jsonDecode(res);
|
||||
paymentID = d['message'].toString();
|
||||
return paymentID;
|
||||
// paymentID = d['message'].toString();
|
||||
return d['message'];
|
||||
}
|
||||
|
||||
Future addDriverWallet(String paymentMethod, point) async {
|
||||
paymentToken = await generateToken(point);
|
||||
Future addDriverWallet(String paymentMethod, point, count) async {
|
||||
paymentToken = await generateToken(count);
|
||||
var paymentID = await getPaymentId(paymentMethod, point);
|
||||
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||
'driverID': box.read(BoxName.driverID).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 {
|
||||
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,
|
||||
'paymentID': paymentID.toString(),
|
||||
'amount': point,
|
||||
'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 {
|
||||
@@ -195,10 +254,11 @@ class CaptainWalletController extends GetxController {
|
||||
}
|
||||
|
||||
Future addTransferDriversWallet(String paymentMethod1, paymentMethod2) async {
|
||||
paymentID = await addDriverPaymentPoints(
|
||||
paymentMethod1, amountFromBudgetController.text);
|
||||
var paymentID =
|
||||
await getPaymentId(paymentMethod1, amountFromBudgetController.text);
|
||||
paymentToken = await generateToken(
|
||||
(int.parse(amountFromBudgetController.text) * -1).toString());
|
||||
|
||||
await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||
'amount': (int.parse(amountFromBudgetController.text) * -1).toString(),
|
||||
'rideId': paymentID.toString(),
|
||||
@@ -208,15 +268,15 @@ class CaptainWalletController extends GetxController {
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
|
||||
paymentID = await addDriverPaymentPoints(paymentMethod2,
|
||||
paymentID = await getPaymentId(paymentMethod2,
|
||||
(int.parse(amountFromBudgetController.text) - 5).toString());
|
||||
paymentToken = await generateToken(amountFromBudgetController.text);
|
||||
var res1 =
|
||||
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||
'driverID': amountToNewDriverMap[0]['id'].toString(),
|
||||
'paymentID': paymentID.toString(),
|
||||
'amount': ((int.parse(amountFromBudgetController.text) - 5) /
|
||||
kazan) // double.parse(kazan) .08 for egypt
|
||||
'amount': ((int.parse(amountFromBudgetController.text) - 5))
|
||||
// kazan) // double.parse(kazan) .08 for egypt
|
||||
.toStringAsFixed(
|
||||
0), // this will convert buddget to poitns by kazan .08
|
||||
|
||||
|
||||
@@ -4,6 +4,18 @@ class MyTranslation extends Translations {
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {
|
||||
"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!':
|
||||
'إذا كنت بحاجة إلى أي مساعدة أو لديك أي أسئلة، فهذا هو المكان المناسب لذلك. أهلاً وسهلاً بك!',
|
||||
'ID Mismatch': "عدم تطابق الرقم التعريفي",
|
||||
@@ -52,7 +64,10 @@ class MyTranslation extends Translations {
|
||||
"incorrect_document_title": "وثيقة غير صحيحة",
|
||||
"incorrect_document_message":
|
||||
"الرجاء تحميل {expected} الصحيحة. تم الكشف عن {detected}.",
|
||||
"driver_license": "رخصة_القيادة",
|
||||
"driver_license": "رخصة_القيادة", "minute": "دقيقة",
|
||||
"kilometer": "كم",
|
||||
"You have successfully charged your account": "تم شحن حسابك بنجاح",
|
||||
"has been added to your budget": "تمت إضافته إلى ميزانيتك",
|
||||
"id_front": "هوية_أمامية",
|
||||
"id_back": "هوية_خلفية",
|
||||
"car_back": "سيارة_خلفية",
|
||||
@@ -139,6 +154,7 @@ class MyTranslation extends Translations {
|
||||
"Central Bank Of Egypt": "البنك المركزي المصري",
|
||||
"ATTIJARIWAFA BANK Egypt": "البنك التجاري وفا مصر",
|
||||
"Morning Promo": "بونص الصباح",
|
||||
'You have gift 300 L.E': "لديك هدية بقيمة 300 جنيه.",
|
||||
"VIP Order": "طلب VIP", "VIP Order Accepted": "تم قبول طلب VIP.",
|
||||
"The driver accepted your trip": "السائق قبل رحلتك.",
|
||||
"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.":
|
||||
"يرجى إدخال حالة التأمين الصحي",
|
||||
"Sefer Driver": "سفر السائق",
|
||||
"The 3000 points equal 3000 L.E for you \nSo go and gain your money":
|
||||
"3000 نقطة تساوي 3000 جنيه لك \nلذا اذهب واحصل على أموالك",
|
||||
"The 300 points equal 300 L.E for you \nSo go and gain your money":
|
||||
"300 نقطة تساوي 300 جنيه لك \nلذا اذهب واحصل على أموالك",
|
||||
"Info": "معلومات",
|
||||
"You dont have money in your Wallet": "ليس لديك أموال في محفظتك",
|
||||
"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": "قبل",
|
||||
'SEFER': 'سفر',
|
||||
"Code not approved": "الرمز غير موافق عليه",
|
||||
"3000 LE": "3000 جنيه مصري",
|
||||
"300 LE": "300 جنيه مصري",
|
||||
"Do you have an invitation code from another driver?":
|
||||
"هل لديك كود دعوة من سائق آخر؟",
|
||||
"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": "شارك تفاصيل الرحلة",
|
||||
"Car Plate is": "لوحة السيارة",
|
||||
'L.E': 'ج.م',
|
||||
"the 3000 points equal 3000 L.E for you":
|
||||
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
|
||||
"the 300 points equal 300 L.E for you":
|
||||
"الـ 300 نقطة تعادل 300 جنيه مصري بالنسبة لك",
|
||||
"So go and gain your money": "انطلق واكسب مالك",
|
||||
"the 3000 points equal 3000 L.E":
|
||||
"الـ 3000 نقطة تساوي 3000 جنيه مصري",
|
||||
"the 300 points equal 300 L.E": "الـ 300 نقطة تساوي 300 جنيه مصري",
|
||||
"The payment was not approved. Please try again.":
|
||||
"لم يتم الموافقة على الدفع. يرجى المحاولة مرة أخرى.",
|
||||
"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': ' لهذا الشهر ',
|
||||
"Origin": "الأصل",
|
||||
"Destination": "مكان الوصول",
|
||||
'the 3000 points equal 3000 L.E for you \nSo go and gain your money':
|
||||
"ال3000 نقطة تعادل 3000 ج.م لك، فاذهب واكسب مالك.",
|
||||
'the 300 points equal 300 L.E for you \nSo go and gain your money':
|
||||
"ال300 نقطة تعادل 300 ج.م لك، فاذهب واكسب مالك.",
|
||||
"Driver Name": "اسم السائق",
|
||||
"Driver Car Plate": "لوحة سيارة السائق",
|
||||
"Available for rides": "الرحلات المتوفرة",
|
||||
|
||||
@@ -2,9 +2,7 @@ import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/functions/location_controller.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
@@ -18,21 +16,55 @@ class RideAvailableController extends GetxController {
|
||||
Map rideAvailableMap = {};
|
||||
late LatLng southwest;
|
||||
late LatLng northeast;
|
||||
LatLngBounds calculateBounds(
|
||||
double centerLat, double centerLng, double radius) {
|
||||
// double radius = 4000; // 10 km in meters
|
||||
// LatLngBounds calculateBounds(
|
||||
// double centerLat, double centerLng, double radius) {
|
||||
// // double radius = 4000; // 10 km in meters
|
||||
|
||||
southwest = LatLng(
|
||||
centerLat - (radius / 111000),
|
||||
centerLng - (radius / (111000 * cos(centerLat))),
|
||||
// southwest = LatLng(
|
||||
// centerLat - (radius / 111000),
|
||||
// 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 {
|
||||
|
||||
@@ -591,12 +591,12 @@ class PaymentController extends GetxController {
|
||||
billingData: PaymobBillingDataWallet(),
|
||||
onPayment: (PaymobResponseWallet response) {},
|
||||
);
|
||||
Log.print('message: ${response!.message}');
|
||||
Log.print('responseCode: ${response.responseCode}');
|
||||
Log.print('success: ${response.success}');
|
||||
Log.print('transactionID: ${response.transactionID}');
|
||||
if (response.responseCode.toString() == '200' &&
|
||||
response.success == true) {
|
||||
// Log.print('message: ${response!.message}');
|
||||
// Log.print('responseCode: ${response.responseCode}');
|
||||
// Log.print('success: ${response.success}');
|
||||
// Log.print('transactionID: ${response.transactionID}');
|
||||
if (response!.success == true &&
|
||||
response.message.toString() == 'Approved') {
|
||||
// Log.print('transactionID wewer: ${response.transactionID}');
|
||||
Toast.show(context, 'Payment Successful'.tr, AppColor.greenColor);
|
||||
method();
|
||||
|
||||
@@ -128,31 +128,26 @@ class RateController extends GetxController {
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(title: 'Ok', onPressed: () => Get.back()));
|
||||
} else {
|
||||
await CRUD()
|
||||
.post(link: "${AppLink.seferCairoServer}/rate/add.php", payload: {
|
||||
'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",
|
||||
await CRUD().post(
|
||||
link: "${AppLink.seferCairoServer}/ride/rate/add.php",
|
||||
payload: {
|
||||
'passenger_id': passengerId,
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
'rideId': rideId,
|
||||
'rideId': rideId.toString(),
|
||||
'rating': selectedRateItemId.toString(),
|
||||
'comment': comment.text,
|
||||
'comment': comment.text ?? 'none',
|
||||
});
|
||||
CRUD().post(link: AppLink.seferGizaServer, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
'rideId': rideId,
|
||||
'rating': selectedRateItemId.toString(),
|
||||
'comment': comment.text,
|
||||
});
|
||||
await CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(link: "${AppLink.endPoint}/ride/rate/add.php", payload: {
|
||||
'passenger_id': passengerId,
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
'rideId': rideId.toString(),
|
||||
'rating': selectedRateItemId.toString(),
|
||||
'comment': comment.text ?? 'none',
|
||||
});
|
||||
}
|
||||
|
||||
CRUD().sendEmail(AppLink.sendEmailToPassengerForTripDetails, {
|
||||
'startLocation':
|
||||
Get.find<MapDriverController>().passengerLocation.toString(),
|
||||
'endLocation':
|
||||
|
||||
@@ -60,12 +60,7 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
Log.print('Error decoding JSON: $e');
|
||||
myList = [];
|
||||
}
|
||||
NotificationController().showNotification(
|
||||
message.notification!.title.toString(),
|
||||
message.notification!.body.toString(),
|
||||
'order',
|
||||
myListString,
|
||||
);
|
||||
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
||||
bool isOverlayActive = await FlutterOverlayWindow.isActive();
|
||||
@@ -82,6 +77,12 @@ Future<void> backgroundMessageHandler(RemoteMessage message) async {
|
||||
width: WindowSize.matchParent,
|
||||
startPosition: const OverlayPosition(0, -150),
|
||||
);
|
||||
NotificationController().showNotification(
|
||||
message.notification!.title.toString(),
|
||||
message.notification!.body.toString(),
|
||||
'order',
|
||||
myListString,
|
||||
);
|
||||
|
||||
await FlutterOverlayWindow.shareData(myList);
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ class InviteScreen extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'$countOfInvitDriver / 6 ${'Trip'.tr}', // Show trips completed
|
||||
'$countOfInvitDriver / 3 ${'Trip'.tr}', // Show trips completed
|
||||
style: const TextStyle(
|
||||
fontSize: 13,
|
||||
color: CupertinoColors.secondaryLabel,
|
||||
|
||||
@@ -41,9 +41,9 @@ class HomeCaptain extends StatelessWidget {
|
||||
closeOverlayIfFound();
|
||||
checkForUpdate(context);
|
||||
getPermissionOverlay();
|
||||
|
||||
showDriverGiftClaim(context);
|
||||
// getPermissionLocation1();
|
||||
await showFirstTimeOfferNotification(context);
|
||||
// await showFirstTimeOfferNotification(context);
|
||||
});
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -424,7 +424,7 @@ showFirstTimeOfferNotification(BuildContext context) async {
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
),
|
||||
child: Text(
|
||||
'3000 LE'.tr,
|
||||
'300 LE'.tr,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 25,
|
||||
|
||||
@@ -7,7 +7,6 @@ import 'package:SEFER/controller/home/payment/captain_wallet_controller.dart';
|
||||
import '../../../../../constant/style.dart';
|
||||
import '../../../../widgets/elevated_btn.dart';
|
||||
import '../../../../../controller/home/captin/home_captain_controller.dart';
|
||||
import '../../../../../controller/home/captin/order_request_controller.dart';
|
||||
|
||||
class ConnectWidget extends StatelessWidget {
|
||||
const ConnectWidget({
|
||||
@@ -27,14 +26,14 @@ class ConnectWidget extends StatelessWidget {
|
||||
builder: (homeCaptainController) => int.parse(
|
||||
homeCaptainController.countRefuse) >
|
||||
3 ||
|
||||
double.parse(captainWalletController.totalPoints) < -3000
|
||||
double.parse(captainWalletController.totalPoints) < -300
|
||||
? CupertinoButton(
|
||||
onPressed: () {
|
||||
Get.defaultDialog(
|
||||
// backgroundColor: CupertinoColors.destructiveRed,
|
||||
barrierDismissible: false,
|
||||
title: double.parse(captainWalletController.totalPoints) <
|
||||
-3000
|
||||
-300
|
||||
? 'You dont have Points'.tr
|
||||
: 'You Are Stopped For this Day !'.tr,
|
||||
titleStyle: AppStyle.title,
|
||||
@@ -44,7 +43,7 @@ class ConnectWidget extends StatelessWidget {
|
||||
onPressed: () async {
|
||||
double.parse(
|
||||
captainWalletController.totalPoints) <
|
||||
-3000
|
||||
-300
|
||||
? await Get.find<TextToSpeechController>()
|
||||
.speakText(
|
||||
'You must be recharge your Account'
|
||||
@@ -58,7 +57,7 @@ class ConnectWidget extends StatelessWidget {
|
||||
),
|
||||
Text(
|
||||
double.parse(captainWalletController.totalPoints) <
|
||||
-3000
|
||||
-300
|
||||
? 'You must be recharge your Account'.tr
|
||||
: 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||
.tr,
|
||||
@@ -68,7 +67,7 @@ class ConnectWidget extends StatelessWidget {
|
||||
),
|
||||
confirm:
|
||||
double.parse(captainWalletController.totalPoints) <
|
||||
-3000
|
||||
-300
|
||||
? MyElevatedButton(
|
||||
title: 'Recharge my Account'.tr,
|
||||
onPressed: () {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/controller/firebase/local_notification.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:flutter/material.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 '../../../../../constant/colors.dart';
|
||||
import '../../../../../controller/home/payment/captain_wallet_controller.dart';
|
||||
import '../../../../../print.dart';
|
||||
import '../../../../Rate/ride_calculate_driver.dart';
|
||||
import '../../../../../controller/functions/location_controller.dart';
|
||||
|
||||
@@ -175,32 +179,29 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
),
|
||||
// Platform.isAndroid
|
||||
// ?
|
||||
AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(color: AppColor.blueColor),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Builder(builder: (context) {
|
||||
return IconButton(
|
||||
onPressed: () async {
|
||||
// mySnakeBarError('ad');
|
||||
Get.to(() => VipOrderPage(), arguments: {
|
||||
'myListString': 'myListString',
|
||||
'DriverList': 'myList',
|
||||
// 'PolylineJson': myPoints,
|
||||
'body': 'message.notification!.body'
|
||||
});
|
||||
},
|
||||
icon: const Icon(
|
||||
FontAwesome5.window_close,
|
||||
size: 29,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
int.parse(box.read(BoxName.carYear).toString()) > 2023
|
||||
? AnimatedContainer(
|
||||
duration: const Duration(microseconds: 200),
|
||||
width: controller.widthMapTypeAndTraffic,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.secondaryColor,
|
||||
border: Border.all(color: AppColor.blueColor),
|
||||
borderRadius: BorderRadius.circular(15)),
|
||||
child: Builder(builder: (context) {
|
||||
return IconButton(
|
||||
onPressed: () async {
|
||||
// mySnakeBarError('ad');
|
||||
Get.to(() => VipOrderPage());
|
||||
},
|
||||
icon: const Icon(
|
||||
Octicons.watch,
|
||||
size: 29,
|
||||
color: AppColor.blueColor,
|
||||
),
|
||||
);
|
||||
}),
|
||||
)
|
||||
: const SizedBox(),
|
||||
// : const SizedBox(),
|
||||
// AnimatedContainer(
|
||||
// duration: const Duration(microseconds: 200),
|
||||
@@ -212,84 +213,84 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
// child: Builder(builder: (context) {
|
||||
// return IconButton(
|
||||
// onPressed: () async {
|
||||
// // Get.to(() => LoginCaptin());
|
||||
// // print(box.read(BoxName.myList));
|
||||
// // Bubble().startBubbleHead(sendAppToBackground: true);
|
||||
// List<String> d = [
|
||||
// "30.003028,31.2419628",
|
||||
// "30.0955661,31.2665336",
|
||||
// "160.00",
|
||||
// "25.92",
|
||||
// "1488",
|
||||
// "16.93",
|
||||
// "114243034311436865474",
|
||||
// "113172279072358305645",
|
||||
// "hamza ayed",
|
||||
// "rlMbi4Hc8L1STMPE99iPKqK4Gddwv8r9qZOCadsz9qTEJZ6KLEE9ruTJI6N8dKfK4CXez5pme5WIs14-1QGo29s07fQOniZgIlJV5XFL3yqzPRSUmn3",
|
||||
// "+201023248456",
|
||||
// "1 min",
|
||||
// "1 m",
|
||||
// "false",
|
||||
// "QwUMoyUtZ0J3oR6yXKUavrB_gBl9npUZe-qZtax-Raq4QBbdKv0AmtLKm0BfBd6N_592HBv4CVa41ii4122W3hr-BCUKKzJhzZcK8m0YjbWbtpvgJRD8uD_nuMk9",
|
||||
// "0",
|
||||
// "238",
|
||||
// "false",
|
||||
// "114243034311436865474",
|
||||
// "1488",
|
||||
// "startEnd",
|
||||
// "30.049307749732176,31.274291574954987",
|
||||
// "",
|
||||
// "",
|
||||
// "",
|
||||
// "",
|
||||
// "17.73",
|
||||
// "0",
|
||||
// "hamzaayedflutter@gmail.com",
|
||||
// "الفسطاط، حي مصر القديمة، مصر",
|
||||
// " الزاوية الحمراء، محافظة القاهرة، مصر",
|
||||
// "Speed",
|
||||
// "8",
|
||||
// "5.00"
|
||||
// ];
|
||||
|
||||
// box.write(BoxName.rideArguments, {
|
||||
// 'passengerLocation': d[0].toString(),
|
||||
// 'passengerDestination': d[1].toString(),
|
||||
// 'Duration': d[4].toString(),
|
||||
// 'totalCost': d[26].toString(),
|
||||
// 'Distance': d[5].toString(),
|
||||
// 'name': d[8].toString(),
|
||||
// 'phone': d[10].toString(),
|
||||
// 'email': d[28].toString(),
|
||||
// 'WalletChecked': d[13].toString(),
|
||||
// 'tokenPassenger': d[9].toString(),
|
||||
// 'direction':
|
||||
// 'https://www.google.com/maps/dir/${d[0]}/${d[1]}/',
|
||||
// 'DurationToPassenger': d[15].toString(),
|
||||
// 'rideId': d[16].toString(),
|
||||
// 'passengerId': d[7].toString(),
|
||||
// 'driverId': d[18].toString(),
|
||||
// 'durationOfRideValue': d[19].toString(),
|
||||
// 'paymentAmount': d[2].toString(),
|
||||
// 'paymentMethod':
|
||||
// d[13].toString() == 'true' ? 'visa' : 'cash',
|
||||
// 'isHaveSteps': d[20].toString(),
|
||||
// 'step0': d[21].toString(),
|
||||
// 'step1': d[22].toString(),
|
||||
// 'step2': d[23].toString(),
|
||||
// 'step3': d[24].toString(),
|
||||
// 'step4': d[25].toString(),
|
||||
// 'passengerWalletBurc': d[26].toString(),
|
||||
// 'timeOfOrder': DateTime.now().toString(),
|
||||
// 'totalPassenger': d[2].toString(),
|
||||
// 'carType': d[31].toString(),
|
||||
// 'kazan': d[32].toString(),
|
||||
// 'startNameLocation': d[29].toString(),
|
||||
// 'endNameLocation': d[30].toString(),
|
||||
// });
|
||||
// Get.to(() => PassengerLocationMapPage(),
|
||||
// arguments: box.read(BoxName.rideArguments));
|
||||
// // Get.offAll(() => HomeCaptainController());
|
||||
// NotificationController()
|
||||
// .showTimerNotification('title', 'message', 'tone1');
|
||||
// // Get.to(() => OrderRequestPage(), arguments: {
|
||||
// // 'myListString': [
|
||||
// // "30.1068014,31.244621",
|
||||
// // "30.0664345,31.2857709",
|
||||
// // "68.56",
|
||||
// // "25.92",
|
||||
// // "1445",
|
||||
// // "11.29",
|
||||
// // "114243034311436865474",
|
||||
// // "114243034311436865474",
|
||||
// // "sefer app",
|
||||
// // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
|
||||
// // "+201023248456",
|
||||
// // "0",
|
||||
// // "0",
|
||||
// // "true",
|
||||
// // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
|
||||
// // "0",
|
||||
// // "1087",
|
||||
// // "false",
|
||||
// // "114243034311436865474",
|
||||
// // "1445",
|
||||
// // "startEnd",
|
||||
// // "30.08517654446625,31.27303797751665",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "13.98",
|
||||
// // "0",
|
||||
// // "sefertraveling@gmail.com",
|
||||
// // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
|
||||
// // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة 4391080، مصر",
|
||||
// // "Speed",
|
||||
// // "8",
|
||||
// // "5.00"
|
||||
// // ],
|
||||
// // 'DriverList': [
|
||||
// // "30.1068014,31.244621",
|
||||
// // "30.0664345,31.2857709",
|
||||
// // "68.56",
|
||||
// // "25.92",
|
||||
// // "1445",
|
||||
// // "11.29",
|
||||
// // "114243034311436865474",
|
||||
// // "114243034311436865474",
|
||||
// // "sefer app",
|
||||
// // "cAVvCAywQvm6LUAqF2E3sU:APA91bHusGWWBwlaKQ6A4idNTVzvakCxtFxPPrHwVR2ycMZK5IP27Tf-RDnUypure0NVGxdFf6npAV7bi4_KWZP-UKJ0Pz3lUogWWbtzO9bIPJgBP3SPCvA",
|
||||
// // "+201023248456",
|
||||
// // "0",
|
||||
// // "0",
|
||||
// // "true",
|
||||
// // "fbeWrFqeQMqorzVU9-2mIa:APA91bHWIcbxzsk3C-w7fiAZ0NRRpPuAmRgNjduS2oQ5lZ7jFEMhA7gfWQLyRWfnhcjmUA9GByyzoLxcfvb7VhcL9zSgo15hVG4DMyJ_k5di1I3oii5Pe9w",
|
||||
// // "0",
|
||||
// // "1087",
|
||||
// // "false",
|
||||
// // "114243034311436865474",
|
||||
// // "1445",
|
||||
// // "startEnd",
|
||||
// // "30.08517654446625,31.27303797751665",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "",
|
||||
// // "13.98",
|
||||
// // "0",
|
||||
// // "sefertraveling@gmail.com",
|
||||
// // "5 مصر اسكندريه، شبرا الخيمة، قسم أول شبرا الخيمة، محافظة القليوبية 6210011، مصر",
|
||||
// // "12 مدرسة العباسية الميكانيكية، السرايات، الوايلى، محافظة القاهرة 4391080، مصر",
|
||||
// // "Speed",
|
||||
// // "8",
|
||||
// // "5.00"
|
||||
// // ],
|
||||
// // // 'PolylineJson': myPoints,
|
||||
// // // 'body': message.notification!.body
|
||||
// // });
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome5.grin_tears,
|
||||
@@ -299,7 +300,7 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
// );
|
||||
// }),
|
||||
// ),
|
||||
// ,
|
||||
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
|
||||
@@ -23,7 +23,7 @@ class GoogleDriverMap extends StatelessWidget {
|
||||
builder: (controller) => Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: Get.height * .6,
|
||||
height: Get.height * .92,
|
||||
child: GoogleMap(
|
||||
onMapCreated: controller.onMapCreated,
|
||||
zoomControlsEnabled: true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,17 +23,6 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
Get.put(OrderRequestController());
|
||||
@override
|
||||
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>(
|
||||
builder: (orderRequestController) {
|
||||
return MyScafolld(
|
||||
@@ -188,7 +177,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
height: 5,
|
||||
),
|
||||
Container(
|
||||
height: Get.height * .22,
|
||||
height: Get.height * .3,
|
||||
width: Get.width * .9,
|
||||
decoration: AppStyle.boxDecoration1,
|
||||
child: Padding(
|
||||
|
||||
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../../main.dart';
|
||||
import '../../../../print.dart';
|
||||
|
||||
class VipOrderPage extends StatelessWidget {
|
||||
const VipOrderPage({super.key});
|
||||
@@ -19,10 +20,58 @@ class VipOrderPage extends StatelessWidget {
|
||||
title: 'VIP Order'.tr,
|
||||
body: [
|
||||
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(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
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,
|
||||
@@ -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 {
|
||||
bool isLoading = false;
|
||||
final arguments = Get.arguments;
|
||||
late String body;
|
||||
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 {
|
||||
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(),
|
||||
});
|
||||
if (res != 'failure') {
|
||||
tripData = jsonDecode(res)['message'];
|
||||
update();
|
||||
} else {
|
||||
tripData = [];
|
||||
}
|
||||
isLoading = false; // Loading complete
|
||||
update(); // Notify listeners
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
await initilize();
|
||||
fetchOrder();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@@ -49,10 +49,10 @@ class PointsCaptain extends StatelessWidget {
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 'EGP'
|
||||
: 'JOD', () async {
|
||||
await captainWalletController.addDriverPaymentPoints(
|
||||
'visa-in', pricePoint);
|
||||
// await captainWalletController.getPaymentId(
|
||||
// 'visa-in', pricePoint);
|
||||
await captainWalletController.addDriverWallet(
|
||||
'visa-in', countPoint);
|
||||
'visa-in', countPoint, pricePoint);
|
||||
await captainWalletController.addSeferWallet(
|
||||
'visa-in', pricePoint.toString());
|
||||
await captainWalletController
|
||||
@@ -93,12 +93,11 @@ class PointsCaptain extends StatelessWidget {
|
||||
box.read(BoxName.countryCode) == 'Egypt'
|
||||
? 'EGP'
|
||||
: 'JOD', () async {
|
||||
// await captainWalletController
|
||||
// .getPaymentId('visa-in', pricePoint);
|
||||
await captainWalletController
|
||||
.addDriverPaymentPoints(
|
||||
'visa-in', pricePoint);
|
||||
await captainWalletController
|
||||
.addDriverWallet(
|
||||
'visa-in', countPoint);
|
||||
.addDriverWallet('visa-in',
|
||||
countPoint, pricePoint);
|
||||
await captainWalletController
|
||||
.addSeferWallet(
|
||||
'visa-in', pricePoint.toString());
|
||||
@@ -115,10 +114,10 @@ class PointsCaptain extends StatelessWidget {
|
||||
: await paymentController.makePaymentStripe(pricePoint,
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? 'jod' : 'egp',
|
||||
() async {
|
||||
await captainWalletController.addDriverPaymentPoints(
|
||||
'visa-in', pricePoint);
|
||||
// await captainWalletController.getPaymentId(
|
||||
// 'visa-in', pricePoint);
|
||||
await captainWalletController.addDriverWallet(
|
||||
'visa-in', countPoint);
|
||||
'visa-in', countPoint, pricePoint);
|
||||
await captainWalletController.getCaptainWalletFromBuyPoints();
|
||||
});
|
||||
},
|
||||
|
||||
@@ -55,11 +55,11 @@ class WalletCaptain extends StatelessWidget {
|
||||
double.parse(captainWalletController
|
||||
.totalPoints
|
||||
.toString()) >
|
||||
-3000
|
||||
-300
|
||||
? AppColor.yellowColor
|
||||
: double.parse(captainWalletController.totalPoints
|
||||
.toString()) <
|
||||
-3000
|
||||
-300
|
||||
? AppColor.redColor
|
||||
: AppColor.greenColor,
|
||||
child: InkWell(
|
||||
@@ -70,7 +70,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text('Info'.tr),
|
||||
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,
|
||||
),
|
||||
actions: <Widget>[
|
||||
@@ -99,7 +99,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
const SizedBox(height: 10),
|
||||
if (double.parse(captainWalletController.totalPoints
|
||||
.toString()) <
|
||||
-3000)
|
||||
-300)
|
||||
CupertinoButton.filled(
|
||||
child: Text('Charge your Account'.tr),
|
||||
onPressed: () {
|
||||
@@ -193,6 +193,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
children: [
|
||||
_buildPromoCard(
|
||||
title: 'Morning Promo'.tr,
|
||||
timePromo: 'Morning Promo',
|
||||
count: captainWalletController
|
||||
.walletDate['message'][0]
|
||||
['morning_count'],
|
||||
@@ -204,6 +205,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
const SizedBox(
|
||||
height: 16), // Add space between the cards
|
||||
_buildPromoCard(
|
||||
timePromo: 'Afternoon Promo',
|
||||
title: 'Afternoon Promo'.tr,
|
||||
count: captainWalletController
|
||||
.walletDate['message'][0]
|
||||
@@ -308,12 +310,18 @@ class WalletCaptain extends StatelessWidget {
|
||||
|
||||
Widget _buildPromoCard(
|
||||
{required String title,
|
||||
required timePromo,
|
||||
required int count,
|
||||
required int maxCount,
|
||||
required String description}) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
MyDialog().getDialog(title, description, () {
|
||||
MyDialog().getDialog(title, description, () async {
|
||||
if (count == 5) {
|
||||
Get.find<CaptainWalletController>()
|
||||
.addDriverWalletFromPromo(timePromo, 50);
|
||||
}
|
||||
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
@@ -443,25 +451,25 @@ class WalletCaptain extends StatelessWidget {
|
||||
kolor: AppColor.greyColor,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 5 : 80,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '1000',
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '3000' : '80',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.bronze,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 10 : 200,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '2500',
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '1040' : '210',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.goldenBronze,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 22 : 400,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '5100',
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '23000' : '450',
|
||||
),
|
||||
PointsCaptain(
|
||||
kolor: AppColor.gold,
|
||||
pricePoint: box.read(BoxName.countryCode) == 'Jordan' ? 50 : 1000,
|
||||
countPoint:
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '130000',
|
||||
box.read(BoxName.countryCode) == 'Jordan' ? '55000' : '1100',
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:SEFER/constant/style.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/mycircular.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -52,8 +53,17 @@ class ProfileCaptain extends StatelessWidget {
|
||||
Get.to(() => CaptainsCars());
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: 'Add criminal page'.tr,
|
||||
onPressed: () async {
|
||||
Get.to(() => CriminalDocumemtPage());
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: Get.height * .8,
|
||||
height: Get.height * .7,
|
||||
child: DriverProfileCard(
|
||||
driverId:
|
||||
controller.captainProfileData['driverID'] ??
|
||||
|
||||
Reference in New Issue
Block a user