This commit is contained in:
Hamza-Ayed
2024-10-01 19:36:38 +03:00
parent 659f178737
commit 6f95dafd0b
13 changed files with 250 additions and 307 deletions

View File

@@ -328,7 +328,7 @@ class MapDriverController extends GetxController {
double _distance =
await calculateDistanceBetweenDriverAndPassengerLocation();
if (_distance < 50) {
if (_distance < 60) {
changeRideToBeginToPassenger();
isPassengerInfoWindow = false;
isRideStarted = true;
@@ -347,6 +347,19 @@ class MapDriverController extends GetxController {
'rideTimeStart': DateTime.now().toString(),
'status': 'Begin',
});
CRUD().post(
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
payload: {
'id': rideId,
'rideTimeStart': DateTime.now().toString(),
'status': 'Begin',
});
CRUD()
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
'id': rideId,
'rideTimeStart': DateTime.now().toString(),
'status': 'Begin',
});
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'RideIsBegin',
@@ -586,6 +599,23 @@ class MapDriverController extends GetxController {
'status': 'Finished',
'price': totalCost,
});
CRUD().post(
link: "${AppLink.seferGizaServer}/rides/update.php",
payload: {
'id': rideId,
'rideTimeFinish': DateTime.now().toString(),
'status': 'Finished',
'price': totalCost,
},
);
CRUD().post(
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
payload: {
'id': rideId,
'rideTimeFinish': DateTime.now().toString(),
'status': 'Finished',
'price': totalCost,
});
if (walletChecked == 'true') {
paymentToken = await generateTokenPassenger(
((-1) * double.parse(paymentAmount)).toString());
@@ -652,9 +682,11 @@ class MapDriverController extends GetxController {
}
void cancelCheckRideFromPassenger() async {
var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: {
'order_id': rideId,
}); //.then((value) {
var res = await CRUD().get(
link: "${AppLink.endPoint}/ride/driver_order/getOrderCancelStatus.php",
payload: {
'order_id': rideId,
}); //.then((value) {
var response = jsonDecode(res);
canelString = response['data']['status'];
update();
@@ -687,6 +719,7 @@ class MapDriverController extends GetxController {
DateTime currentTime = DateTime.now();
void rideIsBeginPassengerTimer() async {
int durationOfRide = int.parse(durationOfRideValue);
double latePrice = Get.find<HomeCaptainController>().latePrice;
update();
int infinity = 40000;
if (carType == 'Comfort' ||
@@ -716,60 +749,26 @@ class MapDriverController extends GetxController {
endNameLocation.contains('مطار') ||
endNameLocation.contains('المطار')) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
(price) -
int.parse(duration) *
Get.find<HomeCaptainController>().latePrice
// : carType == 'Speed'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().speedPrice)
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
: carType == 'Lady'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
(price) -
int.parse(duration) *
Get.find<HomeCaptainController>().latePrice
// : carType == 'Delivery'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().deliveryPrice)
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
Get.find<HomeCaptainController>().latePrice +
? (i ~/ 60) * latePrice +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) *
Get.find<HomeCaptainController>().latePrice +
: (i ~/ 60) * latePrice +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else if (currentTime.hour >= 21 && currentTime.hour < 0) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
(price) -
int.parse(duration) *
Get.find<HomeCaptainController>().latePrice
// : carType == 'Speed'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().speedPrice)
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
: carType == 'Lady'
? (i ~/ 60) * Get.find<HomeCaptainController>().latePrice +
(price) -
int.parse(duration) *
Get.find<HomeCaptainController>().latePrice
// : carType == 'Delivery'
// ? (i ~/ 60) +
// (recentDistanceToDash *
// Get.find<HomeCaptainController>().deliveryPrice)
? price + ((i ~/ 60) - int.parse(duration)) * latePrice
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
Get.find<HomeCaptainController>().latePrice +
? (i ~/ 60) * latePrice +
(recentDistanceToDash *
Get.find<HomeCaptainController>().comfortPrice)
: (i ~/ 60) *
Get.find<HomeCaptainController>().latePrice +
: (i ~/ 60) * latePrice +
(recentDistanceToDash *
Get.find<HomeCaptainController>().mashwariPrice);
} else if (currentTime.hour >= 1 && currentTime.hour < 5) {
@@ -779,51 +778,29 @@ class MapDriverController extends GetxController {
startNameLocation.contains('ملهى ليلي') ||
startNameLocation.contains('Night club')) {
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2 +
? (i ~/ 60) * (latePrice + .5) * 2 +
(price) -
int.parse(duration) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2
int.parse(duration) * (latePrice + .5) * 2
: carType == 'Lady'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2 +
? (i ~/ 60) * (latePrice + .5) * 2 +
(price) -
int.parse(duration) *
(Get.find<HomeCaptainController>().latePrice + .5) *
2
int.parse(duration) * (latePrice + .5) * 2
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice +
.5) *
2 +
(price)
: (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice +
.5) *
2 +
(price);
? (i ~/ 60) * (latePrice + .5) * 2 + (price)
: (i ~/ 60) * (latePrice + .5) * 2 + (price);
}
price = carType == 'Comfort' // || carType == 'Free Ride'
? (i ~/ 60) * (Get.find<HomeCaptainController>().latePrice + .5) +
? (i ~/ 60) * (latePrice + .5) +
(price) -
int.parse(duration) *
(Get.find<HomeCaptainController>().latePrice + .5)
int.parse(duration) * (latePrice + .5)
: carType == 'Lady'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice + .5) +
? (i ~/ 60) * (latePrice + .5) +
(price) -
int.parse(duration) *
(Get.find<HomeCaptainController>().latePrice + .5)
int.parse(duration) * (latePrice + .5)
: carType == 'RayehGaiComfort'
? (i ~/ 60) *
(Get.find<HomeCaptainController>().latePrice +
.5) +
? (i ~/ 60) * (latePrice + .5) +
(price) -
int.parse(duration) *
(Get.find<HomeCaptainController>().latePrice + .5)
int.parse(duration) * (latePrice + .5)
: price;
} else if (currentTime.hour >= 14 && currentTime.hour <= 17) {
price = carType == 'Comfort' // || carType == 'Free Ride'