3/31/4
This commit is contained in:
@@ -364,80 +364,77 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
'order_id': body.toString(),
|
||||
'status': 'Apply'
|
||||
});
|
||||
await CRUD()
|
||||
var res = await CRUD()
|
||||
.post(link: AppLink.updateStausFromSpeed, payload: {
|
||||
'id': myList[16],
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Apply',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
}).then((value) {
|
||||
var json = jsonDecode(value);
|
||||
if (json['message'] ==
|
||||
"This ride is already taken by another driver.") {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
"This ride is already taken by another driver."
|
||||
.tr,
|
||||
middleText: '',
|
||||
titleStyle: AppStyle.title,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr,
|
||||
onPressed: () => Get.back()));
|
||||
} else if (json['message'] ==
|
||||
"Ride data updated successfully") {
|
||||
List<String> bodyToPassenger = [
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
box.read(BoxName.tokenDriver).toString(),
|
||||
];
|
||||
// print(bodyToPassenger);
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Apply Ride', 'your ride is applied'.tr,
|
||||
// arguments['DriverList'][9].toString(),
|
||||
arguments['DriverList'][9].toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
Get.back();
|
||||
Get.to(() => PassengerLocationMapPage(),
|
||||
arguments: {
|
||||
'passengerLocation': myList[0].toString(),
|
||||
'passengerDestination': myList[1].toString(),
|
||||
'Duration': myList[4].toString(),
|
||||
'totalCost': myList[26].toString(),
|
||||
'Distance': myList[5].toString(),
|
||||
'name': myList[8].toString(),
|
||||
'phone': myList[10].toString(),
|
||||
'email': myList[28].toString(),
|
||||
'WalletChecked': myList[13].toString(),
|
||||
'tokenPassenger': myList[9].toString(),
|
||||
'direction':
|
||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
|
||||
'DurationToPassenger': myList[15].toString(),
|
||||
'rideId': myList[16].toString(),
|
||||
'passengerId': myList[7].toString(),
|
||||
'driverId': myList[18].toString(),
|
||||
'durationOfRideValue': myList[19].toString(),
|
||||
'paymentAmount': myList[2].toString(),
|
||||
'paymentMethod':
|
||||
myList[13].toString() == 'true'
|
||||
? 'visa'
|
||||
: 'cash',
|
||||
'isHaveSteps': myList[20].toString(),
|
||||
'step0': myList[21].toString(),
|
||||
'step1': myList[22].toString(),
|
||||
'step2': myList[23].toString(),
|
||||
'step3': myList[24].toString(),
|
||||
'step4': myList[25].toString(),
|
||||
'passengerWalletBurc': myList[26].toString(),
|
||||
'timeOfOrder': DateTime.now().toString(),
|
||||
'totalPassenger': myList[2].toString(),
|
||||
'carType': myList[31].toString(),
|
||||
});
|
||||
}
|
||||
});
|
||||
// .then((value) {
|
||||
var json = jsonDecode(res);
|
||||
if (res == "failure") {
|
||||
Get.defaultDialog(
|
||||
title:
|
||||
"This ride is already taken by another driver."
|
||||
.tr,
|
||||
middleText: '',
|
||||
titleStyle: AppStyle.title,
|
||||
middleTextStyle: AppStyle.title,
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Ok'.tr, onPressed: () => Get.back()));
|
||||
} else if (json['message'] ==
|
||||
"Ride data updated successfully") {
|
||||
List<String> bodyToPassenger = [
|
||||
box.read(BoxName.driverID).toString(),
|
||||
box.read(BoxName.nameDriver).toString(),
|
||||
box.read(BoxName.tokenDriver).toString(),
|
||||
];
|
||||
// print(bodyToPassenger);
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Apply Ride', 'your ride is applied'.tr,
|
||||
// arguments['DriverList'][9].toString(),
|
||||
arguments['DriverList'][9].toString(),
|
||||
// box.read(BoxName.tokenDriver).toString(),
|
||||
bodyToPassenger,
|
||||
);
|
||||
Get.back();
|
||||
Get.to(() => PassengerLocationMapPage(), arguments: {
|
||||
'passengerLocation': myList[0].toString(),
|
||||
'passengerDestination': myList[1].toString(),
|
||||
'Duration': myList[4].toString(),
|
||||
'totalCost': myList[26].toString(),
|
||||
'Distance': myList[5].toString(),
|
||||
'name': myList[8].toString(),
|
||||
'phone': myList[10].toString(),
|
||||
'email': myList[28].toString(),
|
||||
'WalletChecked': myList[13].toString(),
|
||||
'tokenPassenger': myList[9].toString(),
|
||||
'direction':
|
||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
|
||||
'DurationToPassenger': myList[15].toString(),
|
||||
'rideId': myList[16].toString(),
|
||||
'passengerId': myList[7].toString(),
|
||||
'driverId': myList[18].toString(),
|
||||
'durationOfRideValue': myList[19].toString(),
|
||||
'paymentAmount': myList[2].toString(),
|
||||
'paymentMethod': myList[13].toString() == 'true'
|
||||
? 'visa'
|
||||
: 'cash',
|
||||
'isHaveSteps': myList[20].toString(),
|
||||
'step0': myList[21].toString(),
|
||||
'step1': myList[22].toString(),
|
||||
'step2': myList[23].toString(),
|
||||
'step3': myList[24].toString(),
|
||||
'step4': myList[25].toString(),
|
||||
'passengerWalletBurc': myList[26].toString(),
|
||||
'timeOfOrder': DateTime.now().toString(),
|
||||
'totalPassenger': myList[2].toString(),
|
||||
'carType': myList[31].toString(),
|
||||
});
|
||||
}
|
||||
// });
|
||||
// Get.back();
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user