4/2/1
This commit is contained in:
@@ -326,9 +326,9 @@ update ui for totla results
|
||||
*/
|
||||
}
|
||||
|
||||
void startRideFromDriver() async {
|
||||
startRideFromDriver() async {
|
||||
double _distance =
|
||||
await calculateDistanseBetweenDriverAndPassengerLocation();
|
||||
await calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (_distance < 50) {
|
||||
changeRideToBeginToPassenger();
|
||||
@@ -340,6 +340,11 @@ update ui for totla results
|
||||
box.write(BoxName.statusDriverLocation, 'on');
|
||||
|
||||
update();
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
await CRUD().post(link: AppLink.addDriverpayment, payload: {
|
||||
'rideId': rideId,
|
||||
'amount': paymentAmount,
|
||||
@@ -348,16 +353,14 @@ update ui for totla results
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
});
|
||||
|
||||
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
'RideIsBegin', box.read(BoxName.name).toString(), tokenPassenger);
|
||||
rideIsBeginPassengerTimer();
|
||||
double pointsSubstraction = 0;
|
||||
pointsSubstraction = double.parse(paymentAmount) * -17;
|
||||
pointsSubstraction = double.parse(paymentAmount) *
|
||||
(-1) *
|
||||
double.parse(kazan) /
|
||||
100; // for eygpt /100
|
||||
var res =
|
||||
await CRUD().post(link: AppLink.addDriversWalletPoints, payload: {
|
||||
'paymentID': 'rideId$rideId',
|
||||
@@ -385,7 +388,7 @@ update ui for totla results
|
||||
}
|
||||
}
|
||||
|
||||
calcualateDistsanceInMetet(LatLng prev, LatLng current) async {
|
||||
calculateDistanceInMeter(LatLng prev, LatLng current) async {
|
||||
double distance2 = Geolocator.distanceBetween(
|
||||
prev.latitude,
|
||||
prev.longitude,
|
||||
@@ -408,7 +411,7 @@ update ui for totla results
|
||||
latestPosition = position as LatLng?; // Update latest position
|
||||
|
||||
// Calculate distance using the latest position
|
||||
double distance = calcualateDistsanceInMetet(
|
||||
double distance = calculateDistanceInMeter(
|
||||
currentPosition as LatLng, latestPosition!);
|
||||
speedoMeter = distance + speedoMeter;
|
||||
print('distance is $distance');
|
||||
@@ -441,7 +444,7 @@ update ui for totla results
|
||||
updateLocation();
|
||||
}
|
||||
|
||||
calculateDistanseBetweenDriverAndPassengerLocation() {
|
||||
calculateDistanceBetweenDriverAndPassengerLocation() {
|
||||
double distance2 = Geolocator.distanceBetween(
|
||||
latLngpassengerLocation.latitude,
|
||||
latLngpassengerLocation.longitude,
|
||||
@@ -451,8 +454,8 @@ update ui for totla results
|
||||
return distance2;
|
||||
}
|
||||
|
||||
addWaittingTimeCostFromPassengerToDriverWallet() async {
|
||||
double distance2 = calculateDistanseBetweenDriverAndPassengerLocation();
|
||||
addWaitingTimeCostFromPassengerToDriverWallet() async {
|
||||
double distance2 = calculateDistanceBetweenDriverAndPassengerLocation();
|
||||
|
||||
if (distance2 > 40) {
|
||||
Get.defaultDialog(
|
||||
@@ -465,11 +468,12 @@ update ui for totla results
|
||||
Get.back();
|
||||
}));
|
||||
} else {
|
||||
double cost =
|
||||
(distanceBetweenDriverAndPassengerWhenConfirm * .08) + (5 * .06);
|
||||
double costOfWaiting5Minute =
|
||||
(distanceBetweenDriverAndPassengerWhenConfirm * .08) +
|
||||
(5 * 1); //for Eygpt other like jordan .06 per minute
|
||||
var res = await CRUD().post(link: AppLink.addDriverpayment, payload: {
|
||||
'rideId': rideId,
|
||||
'amount': cost.toString(),
|
||||
'amount': costOfWaiting5Minute.toString(),
|
||||
'payment_method': 'wait-cancel',
|
||||
'passengerID': passengerId,
|
||||
'driverID': box.read(BoxName.driverID).toString(),
|
||||
@@ -477,13 +481,13 @@ update ui for totla results
|
||||
if (res != 'failure') {
|
||||
Get.snackbar(
|
||||
'You will get cost of your work for this trip'.tr,
|
||||
'${'you gain'.tr} $cost \$${' in your wallet'.tr}',
|
||||
'${'you gain'.tr} $costOfWaiting5Minute \$${' in your wallet'.tr}',
|
||||
backgroundColor: AppColor.deepPurpleAccent,
|
||||
);
|
||||
}
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': (cost * -1).toString()
|
||||
'balance': (costOfWaiting5Minute * -1).toString()
|
||||
});
|
||||
box.write(BoxName.statusDriverLocation, 'off');
|
||||
Get.offAll(HomeCaptain());
|
||||
@@ -501,7 +505,7 @@ update ui for totla results
|
||||
isRideFinished = true;
|
||||
isRideStarted = false;
|
||||
isPriceWindow = false;
|
||||
if (cartype == 'Comfort' || cartype == 'Free Ride') {
|
||||
if (carType == 'Comfort' || carType == 'Free Ride') {
|
||||
totalCost = price.toStringAsFixed(2);
|
||||
paymentAmount = totalCost;
|
||||
// update();
|
||||
@@ -602,15 +606,15 @@ update ui for totla results
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
recentDistanceToDash = Get.find<LocationController>().totalDistance;
|
||||
rideTimerFromBegin = i;
|
||||
price = cartype == 'Comfort' || cartype == 'Free Ride'
|
||||
price = carType == 'Comfort' || carType == 'Free Ride'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().comfortPrice)
|
||||
: cartype == 'Speed'
|
||||
: carType == 'Speed'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().speedPrice)
|
||||
: cartype == 'Delivery'
|
||||
: carType == 'Delivery'
|
||||
? (i ~/ 60) +
|
||||
(recentDistanceToDash *
|
||||
Get.find<HomeCaptainController>().deliveryPrice)
|
||||
@@ -877,7 +881,8 @@ LIMIT
|
||||
late Duration durationToAdd;
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
late String cartype;
|
||||
late String carType;
|
||||
late String kazan;
|
||||
@override
|
||||
void onInit() async {
|
||||
mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY);
|
||||
@@ -909,7 +914,8 @@ LIMIT
|
||||
step4 = Get.arguments['step4'];
|
||||
passengerWalletBurc = Get.arguments['passengerWalletBurc'];
|
||||
timeOfOrder = Get.arguments['timeOfOrder'];
|
||||
cartype = Get.arguments['carType'];
|
||||
carType = Get.arguments['carType'];
|
||||
kazan = Get.arguments['kazan'];
|
||||
|
||||
var coords = passengerLocation.split(',');
|
||||
var coordDestination = passengerDestination.split(',');
|
||||
|
||||
Reference in New Issue
Block a user