9/3/1
This commit is contained in:
@@ -231,6 +231,7 @@ class MapPassengerController extends GetxController {
|
||||
late double totalPassengerComfortDiscount = 0;
|
||||
late double totalPassengerLadyDiscount = 0;
|
||||
late double totalPassengerSpeedDiscount = 0;
|
||||
late double totalPassengerBalashDiscount = 0;
|
||||
late double totalPassengerRaihGaiDiscount = 0;
|
||||
late double totalPassengerMotoDelivery = 0;
|
||||
late double totalDriver = 0;
|
||||
@@ -1132,50 +1133,50 @@ class MapPassengerController extends GetxController {
|
||||
Log.print(
|
||||
'body: ${dataCarsLocationByPassenger['message'][carsOrder]['token']}');
|
||||
});
|
||||
// CRUD().post(
|
||||
// link: '${AppLink.seferAlexandriaServer}/ride/rides/add.php',
|
||||
// payload: {
|
||||
// "start_location": //'${data[0]['start_address']}',
|
||||
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
// "end_location": //'${data[0]['end_address']}',
|
||||
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
// "date": DateTime.now().toString(),
|
||||
// "time": DateTime.now().toString(),
|
||||
// "endtime": durationToAdd.toString(),
|
||||
// "price": totalPassenger.toStringAsFixed(2),
|
||||
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
// ['driver_id']
|
||||
// .toString(),
|
||||
// "status": "waiting",
|
||||
// 'carType': box.read(BoxName.carType),
|
||||
// "price_for_driver": totalPassenger.toString(),
|
||||
// "price_for_passenger": totalME.toString(),
|
||||
// "distance": distance.toString(),
|
||||
// "paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
// });
|
||||
// CRUD().post(
|
||||
// link: '${AppLink.seferGizaServer}/ride/rides/add.php',
|
||||
// payload: {
|
||||
// "start_location": //'${data[0]['start_address']}',
|
||||
// '${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
// "end_location": //'${data[0]['end_address']}',
|
||||
// '${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
// "date": DateTime.now().toString(),
|
||||
// "time": DateTime.now().toString(),
|
||||
// "endtime": durationToAdd.toString(),
|
||||
// "price": totalPassenger.toStringAsFixed(2),
|
||||
// "passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
// "driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
// ['driver_id']
|
||||
// .toString(),
|
||||
// "status": "waiting",
|
||||
// 'carType': box.read(BoxName.carType),
|
||||
// "price_for_driver": totalPassenger.toString(),
|
||||
// "price_for_passenger": totalME.toString(),
|
||||
// "distance": distance.toString(),
|
||||
// "paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
// });
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferAlexandriaServer}/ride/rides/add.php',
|
||||
payload: {
|
||||
"start_location": //'${data[0]['start_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location": //'${data[0]['end_address']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
"price": totalPassenger.toStringAsFixed(2),
|
||||
"passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString(),
|
||||
"status": "waiting",
|
||||
'carType': box.read(BoxName.carType),
|
||||
"price_for_driver": totalPassenger.toString(),
|
||||
"price_for_passenger": totalME.toString(),
|
||||
"distance": distance.toString(),
|
||||
"paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
});
|
||||
CRUD().post(
|
||||
link: '${AppLink.seferGizaServer}/ride/rides/add.php',
|
||||
payload: {
|
||||
"start_location": //'${data[0]['start_address']}',
|
||||
'${data[0]["start_location"]['lat']},${data[0]["start_location"]['lng']}',
|
||||
"end_location": //'${data[0]['end_address']}',
|
||||
'${data[0]["end_location"]['lat']},${data[0]["end_location"]['lng']}',
|
||||
"date": DateTime.now().toString(),
|
||||
"time": DateTime.now().toString(),
|
||||
"endtime": durationToAdd.toString(),
|
||||
"price": totalPassenger.toStringAsFixed(2),
|
||||
"passenger_id": box.read(BoxName.passengerID).toString(),
|
||||
"driver_id": dataCarsLocationByPassenger['message'][carsOrder]
|
||||
['driver_id']
|
||||
.toString(),
|
||||
"status": "waiting",
|
||||
'carType': box.read(BoxName.carType),
|
||||
"price_for_driver": totalPassenger.toString(),
|
||||
"price_for_passenger": totalME.toString(),
|
||||
"distance": distance.toString(),
|
||||
"paymentMethod": paymentController.isWalletChecked.toString(),
|
||||
});
|
||||
|
||||
delayAndFetchRideStatus(rideId);
|
||||
if (shouldFetch == false) {
|
||||
@@ -1292,6 +1293,9 @@ class MapPassengerController extends GetxController {
|
||||
showAndResearchForCaptain();
|
||||
// delayAndFetchRideStatusForAllDriverAvailable(rideId);
|
||||
} else if (res.toString() == 'Apply') {
|
||||
// todo play sound
|
||||
Get.find<AudioRecorderController>()
|
||||
.playSoundFromAssets('assets/start.wav');
|
||||
timer.cancel(); // Stop the current timer
|
||||
shouldFetch = false; // Stop further fetches
|
||||
statusRide = 'Apply';
|
||||
@@ -1326,6 +1330,7 @@ class MapPassengerController extends GetxController {
|
||||
"No Captain Accepted Your Order".tr,
|
||||
"We are looking for a captain but the price may increase to let a captain accept"
|
||||
.tr,
|
||||
duration: const Duration(seconds: 5),
|
||||
backgroundColor: AppColor.yellowColor,
|
||||
);
|
||||
}
|
||||
@@ -1338,7 +1343,7 @@ class MapPassengerController extends GetxController {
|
||||
Log.print('tick delayAndFetchRideStatusForAllDriverAvailable: ${tick}');
|
||||
|
||||
void fetchRideStatus() async {
|
||||
if (attemptCounter < maxAttempts && !isApplied) {
|
||||
if (attemptCounter < maxAttempts && !isApplied && tick < 20) {
|
||||
attemptCounter++;
|
||||
tick++;
|
||||
var res = await getRideStatus(rideId);
|
||||
@@ -1673,6 +1678,9 @@ class MapPassengerController extends GetxController {
|
||||
timer.cancel();
|
||||
} else {
|
||||
attempt++;
|
||||
if (reloadCount >= 3 || tick > 18 || reloadCount > 15) {
|
||||
timer.cancel();
|
||||
}
|
||||
Log.print(
|
||||
'Incrementing attempt to: ${attempt}'); // Log incremented attempt
|
||||
|
||||
@@ -1761,6 +1769,15 @@ class MapPassengerController extends GetxController {
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
break;
|
||||
case 'Balash':
|
||||
res = await CRUD()
|
||||
.get(link: AppLink.getCarsLocationByPassengerBalash, payload: {
|
||||
'southwestLat': bounds.southwest.latitude.toString(),
|
||||
'southwestLon': bounds.southwest.longitude.toString(),
|
||||
'northeastLat': bounds.northeast.latitude.toString(),
|
||||
'northeastLon': bounds.northeast.longitude.toString(),
|
||||
});
|
||||
break;
|
||||
default:
|
||||
res = await CRUD()
|
||||
.get(link: AppLink.getCarsLocationByPassenger, payload: {
|
||||
@@ -2667,10 +2684,10 @@ class MapPassengerController extends GetxController {
|
||||
// });
|
||||
// }
|
||||
bool reloadStartApp = false;
|
||||
|
||||
int reloadCount = 0;
|
||||
startMarkerReloading() async {
|
||||
Log.print('AppLink.endPoint: ${AppLink.endPoint}');
|
||||
int reloadCount = 0;
|
||||
|
||||
if (reloadStartApp == false) {
|
||||
Timer.periodic(const Duration(seconds: 5), (timer) async {
|
||||
reloadCount++;
|
||||
@@ -3249,6 +3266,7 @@ class MapPassengerController extends GetxController {
|
||||
|
||||
double costForDriver = 0;
|
||||
double totalPassengerSpeed = 0;
|
||||
double totalPassengerBalash = 0;
|
||||
double totalPassengerLady = 0;
|
||||
double totalPassengerRayehGai = 0;
|
||||
Future bottomSheet() async {
|
||||
@@ -3262,12 +3280,18 @@ class MapPassengerController extends GetxController {
|
||||
// costDuration = (durationToRide / 60) * averageDuration * 0.016;
|
||||
costDuration = (durationToRide / 60).floorToDouble();
|
||||
'passengerWalletTotal----- ${box.read(BoxName.passengerWalletTotal)}';
|
||||
double costComfort, costSpeed, costDelivery, costLady, costRayehGai = 0;
|
||||
double costComfort,
|
||||
costSpeed,
|
||||
costDelivery,
|
||||
costBalash,
|
||||
costLady,
|
||||
costRayehGai = 0;
|
||||
update();
|
||||
if (currentTime.hour >= 22 && currentTime.hour < 5) {
|
||||
// costDistance = distance * latePrice;
|
||||
costComfort = (distance * comfortPrice) + costDuration * latePrice;
|
||||
costSpeed = (distance * speedPrice) + costDuration * latePrice;
|
||||
costBalash = (distance * (speedPrice - 1)) + costDuration * latePrice;
|
||||
costDelivery = (distance * deliveryPrice) + costDuration * latePrice;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration * latePrice;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
@@ -3280,6 +3304,7 @@ class MapPassengerController extends GetxController {
|
||||
// costDistance = distance * heavyPrice;
|
||||
costComfort = (distance * comfortPrice) + costDuration * heavyPrice;
|
||||
costSpeed = (distance * speedPrice) + costDuration * heavyPrice;
|
||||
costBalash = (distance * (speedPrice - 1)) + costDuration * heavyPrice;
|
||||
costDelivery = (distance * deliveryPrice) + costDuration * heavyPrice;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration * heavyPrice;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
@@ -3292,6 +3317,7 @@ class MapPassengerController extends GetxController {
|
||||
// costDistance = distance * (naturePrice - .1);
|
||||
costComfort = (distance * comfortPrice) + costDuration;
|
||||
costSpeed = (distance * speedPrice) + costDuration;
|
||||
costBalash = (distance * (speedPrice - 1)) + costDuration;
|
||||
costDelivery = (distance * deliveryPrice) + costDuration;
|
||||
costLady = (distance * comfortPrice + 2) + costDuration;
|
||||
costRayehGai = (distance * 2 * speedPrice) -
|
||||
@@ -3308,6 +3334,8 @@ class MapPassengerController extends GetxController {
|
||||
totalPassengerLady = (costLady + (costLady * kazan / 100)).ceilToDouble();
|
||||
totalPassengerSpeed =
|
||||
(costSpeed + (costSpeed * kazan / 100)).ceilToDouble();
|
||||
totalPassengerBalash =
|
||||
(costBalash + (costBalash * kazan / 100)).ceilToDouble();
|
||||
totalPassengerRayehGai =
|
||||
(costRayehGai + (costRayehGai * kazan / 100)).ceilToDouble();
|
||||
totalPassengerComfortDiscount =
|
||||
@@ -3315,15 +3343,19 @@ class MapPassengerController extends GetxController {
|
||||
totalPassengerLadyDiscount =
|
||||
totalPassengerLady + totalPassengerLady * (kazan - 0) / 100;
|
||||
totalPassengerSpeedDiscount =
|
||||
totalPassengerSpeed + totalPassengerSpeed * (kazan - 2) / 100;
|
||||
totalPassengerSpeed + totalPassengerSpeed * (kazan) / 100;
|
||||
totalPassengerBalashDiscount =
|
||||
totalPassengerBalash + totalPassengerBalash * (kazan) / 100;
|
||||
totalPassengerRaihGaiDiscount =
|
||||
totalPassengerRayehGai + totalPassengerRayehGai * (kazan - 2) / 100;
|
||||
totalPassengerRayehGai + totalPassengerRayehGai * (kazan) / 100;
|
||||
totalPassengerMotoDelivery =
|
||||
(costDelivery + (costDelivery * kazan / 100)).ceilToDouble();
|
||||
totalPassengerComfort = totalPassengerComfortDiscount -
|
||||
(totalPassengerComfortDiscount * kazan / 100);
|
||||
totalPassengerSpeed = totalPassengerSpeedDiscount -
|
||||
(totalPassengerSpeedDiscount * kazan / 100);
|
||||
totalPassengerBalash = totalPassengerBalashDiscount -
|
||||
(totalPassengerBalashDiscount * kazan / 100);
|
||||
totalPassengerLady = totalPassengerLadyDiscount -
|
||||
(totalPassengerLadyDiscount * kazan / 100);
|
||||
totalDriver = totalDriver1 + (totalDriver1 * kazan / 100);
|
||||
@@ -3334,6 +3366,7 @@ class MapPassengerController extends GetxController {
|
||||
// for eygpt 20 le open ride
|
||||
totalCostPassenger = 20;
|
||||
totalPassengerSpeed = 20;
|
||||
totalPassengerBalash = 20;
|
||||
totalPassengerComfort = 30;
|
||||
totalPassengerLady = 30;
|
||||
totalPassengerMotoDelivery = 18;
|
||||
@@ -3348,6 +3381,8 @@ class MapPassengerController extends GetxController {
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
totalPassengerLady = totalPassengerLady +
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
totalPassengerBalash = totalPassengerBalash +
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
totalPassengerMotoDelivery = totalPassengerMotoDelivery +
|
||||
(-1) * (double.parse(box.read(BoxName.passengerWalletTotal)));
|
||||
update();
|
||||
|
||||
Reference in New Issue
Block a user