10/14/1
This commit is contained in:
@@ -54,8 +54,8 @@ android {
|
|||||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = flutter.targetSdkVersion
|
targetSdk = flutter.targetSdkVersion
|
||||||
versionCode = 108
|
versionCode = 109
|
||||||
versionName = '1.5.08'
|
versionName = '1.5.09'
|
||||||
multiDexEnabled =true
|
multiDexEnabled =true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -257,6 +257,45 @@ class HomeCaptainController extends GetxController {
|
|||||||
// LocationController().getLocation();
|
// LocationController().getLocation();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
// void getRefusedOrderByCaptain() async {
|
||||||
|
// // Get today's date in YYYY-MM-DD format
|
||||||
|
// String today = DateTime.now().toString().substring(0, 10);
|
||||||
|
|
||||||
|
// String driverId = box.read(BoxName.driverID).toString();
|
||||||
|
|
||||||
|
// String customQuery = '''
|
||||||
|
// SELECT COUNT(*) AS count
|
||||||
|
// FROM ${TableName.driverOrdersRefuse}
|
||||||
|
// WHERE driver_id = '$driverId'
|
||||||
|
// AND DATE(created_at) = '$today'
|
||||||
|
// ''';
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// List<Map<String, dynamic>> results =
|
||||||
|
// await sql.getCustomQuery(customQuery);
|
||||||
|
// countRefuse = results[0]['count'].toString();
|
||||||
|
// print(countRefuse);
|
||||||
|
// update();
|
||||||
|
// if (int.parse(countRefuse) > 3) {
|
||||||
|
// box.write(BoxName.statusDriverLocation, 'on');
|
||||||
|
// locationController.stopLocationUpdates();
|
||||||
|
// Get.defaultDialog(
|
||||||
|
// // backgroundColor: CupertinoColors.destructiveRed,
|
||||||
|
// barrierDismissible: false,
|
||||||
|
// title: 'You Are Stopped For this Day !'.tr,
|
||||||
|
// content: Text(
|
||||||
|
// 'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
||||||
|
// .tr,
|
||||||
|
// style: AppStyle.title,
|
||||||
|
// ),
|
||||||
|
// confirm: MyElevatedButton(
|
||||||
|
// title: 'Ok , See you Tomorrow'.tr,
|
||||||
|
// onPressed: () => Get.back()));
|
||||||
|
// } else {
|
||||||
|
// box.write(BoxName.statusDriverLocation, 'off');
|
||||||
|
// }
|
||||||
|
// } catch (e) {}
|
||||||
|
// }
|
||||||
|
|
||||||
addToken() async {
|
addToken() async {
|
||||||
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
||||||
|
|||||||
@@ -171,13 +171,20 @@ class MapDriverController extends GetxController {
|
|||||||
|
|
||||||
cancelTripFromDriverAfterApplied() async {
|
cancelTripFromDriverAfterApplied() async {
|
||||||
if (formKeyCancel.currentState!.validate()) {
|
if (formKeyCancel.currentState!.validate()) {
|
||||||
CRUD().post(
|
await CRUD().post(
|
||||||
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||||
payload: {
|
payload: {
|
||||||
"id": rideId.toString(), // Convert to String
|
"id": rideId.toString(), // Convert to String
|
||||||
"status": 'CancelFromDriverAfterApply'
|
"status": 'CancelFromDriverAfterApply'
|
||||||
});
|
});
|
||||||
CRUD().post(
|
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:
|
link:
|
||||||
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
||||||
payload: {
|
payload: {
|
||||||
@@ -186,6 +193,17 @@ class MapDriverController extends GetxController {
|
|||||||
"status": 'reject After Applied',
|
"status": 'reject After Applied',
|
||||||
"notes": cancelTripCotroller.text.toString()
|
"notes": cancelTripCotroller.text.toString()
|
||||||
});
|
});
|
||||||
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(
|
||||||
|
link:
|
||||||
|
"${AppLink.endPoint}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
||||||
|
payload: {
|
||||||
|
"order_id": rideId.toString(),
|
||||||
|
"driver_id": box.read(BoxName.driverID).toString(),
|
||||||
|
"status": 'reject After Applied',
|
||||||
|
"notes": cancelTripCotroller.text.toString()
|
||||||
|
});
|
||||||
|
}
|
||||||
FirebaseMessagesController().sendNotificationToDriverMAP(
|
FirebaseMessagesController().sendNotificationToDriverMAP(
|
||||||
"Cancel Trip from driver".tr,
|
"Cancel Trip from driver".tr,
|
||||||
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
||||||
@@ -194,44 +212,13 @@ class MapDriverController extends GetxController {
|
|||||||
[],
|
[],
|
||||||
'cancel.wav',
|
'cancel.wav',
|
||||||
);
|
);
|
||||||
CRUD().post(
|
|
||||||
link: "${AppLink.seferGizaServer}/ride/rides/update.php",
|
|
||||||
payload: {
|
|
||||||
"id": rideId.toString(), // Convert to String
|
|
||||||
"status": 'CancelFromDriverAfterApply'
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link: "${AppLink.seferAlexandriaServer}/ride/rides/update.php",
|
|
||||||
payload: {
|
|
||||||
"id": rideId.toString(), // Convert to String
|
|
||||||
"status": 'CancelFromDriverAfterApply'
|
|
||||||
});
|
|
||||||
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
"${AppLink.seferGizaServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
|
||||||
payload: {
|
|
||||||
"order_id": rideId.toString(),
|
|
||||||
"driver_id": box.read(BoxName.driverID).toString(),
|
|
||||||
"status": 'reject After Applied',
|
|
||||||
"notes": cancelTripCotroller.text.toString()
|
|
||||||
});
|
|
||||||
CRUD().post(
|
|
||||||
link:
|
|
||||||
"${AppLink.seferAlexandriaServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
|
||||||
payload: {
|
|
||||||
"order_id": rideId.toString(),
|
|
||||||
"driver_id": box.read(BoxName.driverID).toString(),
|
|
||||||
"status": 'reject After Applied',
|
|
||||||
"notes": cancelTripCotroller.text.toString()
|
|
||||||
});
|
|
||||||
|
|
||||||
sql.insertData({
|
sql.insertData({
|
||||||
'order_id': rideId,
|
'order_id': rideId,
|
||||||
'created_at': DateTime.now().toString(),
|
'created_at': DateTime.now().toString(),
|
||||||
'driver_id': box.read(BoxName.driverID).toString(),
|
'driver_id': box.read(BoxName.driverID).toString(),
|
||||||
}, TableName.driverOrdersRefuse);
|
}, TableName.driverOrdersRefuse);
|
||||||
Get.put(OrderRequestController()).getRefusedOrderByCaptain();
|
Get.find<HomeCaptainController>().getRefusedOrderByCaptain();
|
||||||
Get.offAll(HomeCaptain());
|
Get.offAll(HomeCaptain());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -302,21 +289,13 @@ class MapDriverController extends GetxController {
|
|||||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||||
'status': 'Applied'
|
'status': 'Applied'
|
||||||
});
|
});
|
||||||
CRUD().post(
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
link: "${AppLink.seferGizaServer}/ride/rides/update.php",
|
CRUD().post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
|
||||||
payload: {
|
|
||||||
'id': rideId,
|
'id': rideId,
|
||||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||||
'status': 'Applied'
|
'status': 'Applied'
|
||||||
});
|
});
|
||||||
CRUD().post(
|
}
|
||||||
link: "${AppLink.seferAlexandriaServer}/ride/rides/update.php",
|
|
||||||
payload: {
|
|
||||||
'id': rideId,
|
|
||||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
|
||||||
'status': 'Applied'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Get.find<HomeCaptainController>().changeToAppliedRide('Applied');
|
// Get.find<HomeCaptainController>().changeToAppliedRide('Applied');
|
||||||
|
|
||||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||||
@@ -402,20 +381,13 @@ class MapDriverController extends GetxController {
|
|||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'Begin',
|
'status': 'Begin',
|
||||||
});
|
});
|
||||||
CRUD().post(
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
|
||||||
payload: {
|
|
||||||
'id': rideId,
|
'id': rideId,
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'Begin',
|
'status': 'Begin',
|
||||||
});
|
});
|
||||||
CRUD()
|
}
|
||||||
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
|
|
||||||
'id': rideId,
|
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
|
||||||
'status': 'Begin',
|
|
||||||
});
|
|
||||||
|
|
||||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||||
'RideIsBegin',
|
'RideIsBegin',
|
||||||
box.read(BoxName.name).toString(),
|
box.read(BoxName.name).toString(),
|
||||||
@@ -533,20 +505,14 @@ class MapDriverController extends GetxController {
|
|||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'CancelAfterWait',
|
'status': 'CancelAfterWait',
|
||||||
});
|
});
|
||||||
CRUD().post(
|
|
||||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
|
||||||
payload: {
|
|
||||||
'id': rideId,
|
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
|
||||||
'status': 'CancelAfterWait',
|
|
||||||
});
|
|
||||||
CRUD()
|
|
||||||
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
|
|
||||||
'id': rideId,
|
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
|
||||||
'status': 'CancelAfterWait',
|
|
||||||
});
|
|
||||||
|
|
||||||
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
|
||||||
|
'id': rideId,
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'CancelAfterWait',
|
||||||
|
});
|
||||||
|
}
|
||||||
var paymentTokenWait =
|
var paymentTokenWait =
|
||||||
await generateTokenDriver(costOfWaiting5Minute.toString());
|
await generateTokenDriver(costOfWaiting5Minute.toString());
|
||||||
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||||
@@ -676,8 +642,9 @@ class MapDriverController extends GetxController {
|
|||||||
'status': 'Finished',
|
'status': 'Finished',
|
||||||
'price': totalCost,
|
'price': totalCost,
|
||||||
});
|
});
|
||||||
|
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||||
CRUD().post(
|
CRUD().post(
|
||||||
link: "${AppLink.seferGizaServer}/rides/update.php",
|
link: "${AppLink.endPoint}/rides/update.php",
|
||||||
payload: {
|
payload: {
|
||||||
'id': rideId,
|
'id': rideId,
|
||||||
'rideTimeFinish': DateTime.now().toString(),
|
'rideTimeFinish': DateTime.now().toString(),
|
||||||
@@ -685,14 +652,7 @@ class MapDriverController extends GetxController {
|
|||||||
'price': totalCost,
|
'price': totalCost,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
CRUD().post(
|
}
|
||||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
|
||||||
payload: {
|
|
||||||
'id': rideId,
|
|
||||||
'rideTimeFinish': DateTime.now().toString(),
|
|
||||||
'status': 'Finished',
|
|
||||||
'price': totalCost,
|
|
||||||
});
|
|
||||||
if (walletChecked == 'true') {
|
if (walletChecked == 'true') {
|
||||||
paymentToken = await generateTokenPassenger(
|
paymentToken = await generateTokenPassenger(
|
||||||
((-1) * double.parse(paymentAmount)).toString());
|
((-1) * double.parse(paymentAmount)).toString());
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:SEFER/constant/links.dart';
|
import 'package:SEFER/constant/links.dart';
|
||||||
@@ -5,7 +7,7 @@ import 'package:SEFER/constant/style.dart';
|
|||||||
import 'package:SEFER/main.dart';
|
import 'package:SEFER/main.dart';
|
||||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
|
import 'dart:math' as math;
|
||||||
import '../../../constant/box_name.dart';
|
import '../../../constant/box_name.dart';
|
||||||
import '../../../constant/table_names.dart';
|
import '../../../constant/table_names.dart';
|
||||||
import '../../functions/crud.dart';
|
import '../../functions/crud.dart';
|
||||||
@@ -24,15 +26,73 @@ class OrderRequestController extends GetxController {
|
|||||||
final locationController = Get.put(LocationController());
|
final locationController = Get.put(LocationController());
|
||||||
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
||||||
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
||||||
|
final arguments = Get.arguments;
|
||||||
|
var myList;
|
||||||
|
late int hours;
|
||||||
|
late int minutes;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
getRefusedOrderByCaptain();
|
// getRefusedOrderByCaptain();
|
||||||
|
initilizeOrderPage();
|
||||||
|
addCustomStartIcon();
|
||||||
|
addCustomEndIcon();
|
||||||
// calculateConsumptionFuel();
|
// calculateConsumptionFuel();
|
||||||
update();
|
update();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
late LatLngBounds bounds;
|
||||||
|
late List<LatLng> pointsDirection;
|
||||||
|
late String body;
|
||||||
|
late double latPassengerLocation;
|
||||||
|
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) {
|
||||||
|
myList = jsonDecode(myListString);
|
||||||
|
} else {
|
||||||
|
myList = arguments['DriverList'];
|
||||||
|
}
|
||||||
|
|
||||||
|
body = arguments['body'];
|
||||||
|
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
|
||||||
|
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]);
|
||||||
|
|
||||||
|
pointsDirection = [
|
||||||
|
LatLng(latPassengerLocation, lngPassengerLocation),
|
||||||
|
LatLng(latPassengerDestination, lngPassengerDestination)
|
||||||
|
]; // Calculate the midpoint between the two points
|
||||||
|
// Calculate the minimum and maximum latitude and longitude values
|
||||||
|
double minLatitude =
|
||||||
|
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
|
||||||
|
double maxLatitude =
|
||||||
|
math.max(pointsDirection[0].latitude, pointsDirection[1].latitude);
|
||||||
|
double minLongitude =
|
||||||
|
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() async {
|
||||||
await CRUD().get(link: AppLink.getRidesDetails, payload: {
|
await CRUD().get(link: AppLink.getRidesDetails, payload: {
|
||||||
'id': box.read(BoxName.myList)[2].toString(),
|
'id': box.read(BoxName.myList)[2].toString(),
|
||||||
@@ -44,9 +104,10 @@ class OrderRequestController extends GetxController {
|
|||||||
|
|
||||||
ImageConfiguration config = ImageConfiguration(
|
ImageConfiguration config = ImageConfiguration(
|
||||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
|
BitmapDescriptor.asset(
|
||||||
mipmaps: false)
|
config,
|
||||||
.then((value) {
|
'assets/images/A.png',
|
||||||
|
).then((value) {
|
||||||
startIcon = value;
|
startIcon = value;
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
@@ -55,9 +116,10 @@ class OrderRequestController extends GetxController {
|
|||||||
void addCustomEndIcon() {
|
void addCustomEndIcon() {
|
||||||
ImageConfiguration config = ImageConfiguration(
|
ImageConfiguration config = ImageConfiguration(
|
||||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png',
|
BitmapDescriptor.asset(
|
||||||
mipmaps: false)
|
config,
|
||||||
.then((value) {
|
'assets/images/b.png',
|
||||||
|
).then((value) {
|
||||||
endIcon = value;
|
endIcon = value;
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
@@ -74,46 +136,6 @@ class OrderRequestController extends GetxController {
|
|||||||
12; //todo in register car add mpg in box
|
12; //todo in register car add mpg in box
|
||||||
}
|
}
|
||||||
|
|
||||||
void getRefusedOrderByCaptain() async {
|
|
||||||
// Get today's date in YYYY-MM-DD format
|
|
||||||
String today = DateTime.now().toString().substring(0, 10);
|
|
||||||
|
|
||||||
String driverId = box.read(BoxName.driverID).toString();
|
|
||||||
|
|
||||||
String customQuery = '''
|
|
||||||
SELECT COUNT(*) AS count
|
|
||||||
FROM ${TableName.driverOrdersRefuse}
|
|
||||||
WHERE driver_id = '$driverId'
|
|
||||||
AND DATE(created_at) = '$today'
|
|
||||||
''';
|
|
||||||
|
|
||||||
try {
|
|
||||||
List<Map<String, dynamic>> results =
|
|
||||||
await sql.getCustomQuery(customQuery);
|
|
||||||
countRefuse = results[0]['count'].toString();
|
|
||||||
print(countRefuse);
|
|
||||||
update();
|
|
||||||
if (int.parse(countRefuse) > 3) {
|
|
||||||
box.write(BoxName.statusDriverLocation, 'on');
|
|
||||||
locationController.stopLocationUpdates();
|
|
||||||
Get.defaultDialog(
|
|
||||||
// backgroundColor: CupertinoColors.destructiveRed,
|
|
||||||
barrierDismissible: false,
|
|
||||||
title: 'You Are Stopped For this Day !'.tr,
|
|
||||||
content: Text(
|
|
||||||
'You Refused 3 Rides this Day that is the reason \nSee you Tomorrow!'
|
|
||||||
.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
confirm: MyElevatedButton(
|
|
||||||
title: 'Ok , See you Tomorrow'.tr,
|
|
||||||
onPressed: () => Get.back()));
|
|
||||||
} else {
|
|
||||||
box.write(BoxName.statusDriverLocation, 'off');
|
|
||||||
}
|
|
||||||
} catch (e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _timerActive = false;
|
bool _timerActive = false;
|
||||||
|
|
||||||
Future<void> startTimer(String driverID, String orderID) async {
|
Future<void> startTimer(String driverID, String orderID) async {
|
||||||
|
|||||||
@@ -476,9 +476,12 @@ Store your money with us and receive it in your bank as a monthly salary.''':
|
|||||||
"تُولي Sefer أهمية كبيرة لسلامتك. نحن نقدم ميزات مثل التحقق من هوية السائق ، وتتبع الرحلات داخل التطبيق ، وخيارات الاتصال في حالات الطوارئ.",
|
"تُولي Sefer أهمية كبيرة لسلامتك. نحن نقدم ميزات مثل التحقق من هوية السائق ، وتتبع الرحلات داخل التطبيق ، وخيارات الاتصال في حالات الطوارئ.",
|
||||||
'Frequently Questions': 'الأسئلة الشائعة',
|
'Frequently Questions': 'الأسئلة الشائعة',
|
||||||
"Contact Us": "اتصل بنا",
|
"Contact Us": "اتصل بنا",
|
||||||
|
'Choose a contact option': 'اختر خيار الاتصال',
|
||||||
"You can change the vibration feedback for all buttons":
|
"You can change the vibration feedback for all buttons":
|
||||||
"يمكنك تغيير اهتزاز الرج لجميع الأزرار",
|
"يمكنك تغيير اهتزاز الرج لجميع الأزرار",
|
||||||
'About Us': "نبذة عنا",
|
'About Us': "نبذة عنا",
|
||||||
|
'Work time is from 12:00 - 19:00.\nYou can send a WhatsApp message or email.':
|
||||||
|
'ساعات العمل من 12:00 - 19:00.\nيمكنك إرسال رسالة عبر واتساب أو بريد إلكتروني.',
|
||||||
"Most Secure Methods": "أساليب الأمان الأكثر فاعلية",
|
"Most Secure Methods": "أساليب الأمان الأكثر فاعلية",
|
||||||
"In-App VOIP Calls": "مكالمات VOIP داخل التطبيق",
|
"In-App VOIP Calls": "مكالمات VOIP داخل التطبيق",
|
||||||
"Recorded Trips for Safety": "تسجيل الرحلات من أجل السلامة",
|
"Recorded Trips for Safety": "تسجيل الرحلات من أجل السلامة",
|
||||||
@@ -1084,7 +1087,8 @@ Store your money with us and receive it in your bank as a monthly salary.''':
|
|||||||
"Please help! Contact me as soon as possible.":
|
"Please help! Contact me as soon as possible.":
|
||||||
"من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.",
|
"من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.",
|
||||||
"Share Trip Details": "شارك تفاصيل الرحلة",
|
"Share Trip Details": "شارك تفاصيل الرحلة",
|
||||||
"Car Plate is": "لوحة السيارة", 'L.E': 'جنيه',
|
"Car Plate is": "لوحة السيارة",
|
||||||
|
'L.E': 'ج.م',
|
||||||
"the 3000 points equal 3000 L.E for you":
|
"the 3000 points equal 3000 L.E for you":
|
||||||
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
|
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
|
||||||
"So go and gain your money": "انطلق واكسب مالك",
|
"So go and gain your money": "انطلق واكسب مالك",
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
Get.put(OrderRequestController());
|
// Get.put(OrderRequestController());
|
||||||
// Get.put(HomeCaptainController());
|
// Get.put(HomeCaptainController());
|
||||||
Get.put(CaptainWalletController());
|
Get.put(CaptainWalletController());
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||||
@@ -53,7 +53,7 @@ class HomeCaptain extends StatelessWidget {
|
|||||||
elevation: 1,
|
elevation: 1,
|
||||||
title: Text('Home'.tr),
|
title: Text('Home'.tr),
|
||||||
actions: [
|
actions: [
|
||||||
GetBuilder<OrderRequestController>(
|
GetBuilder<HomeCaptainController>(
|
||||||
builder: (orderRequestController) => MyCircleContainer(
|
builder: (orderRequestController) => MyCircleContainer(
|
||||||
child: Text(
|
child: Text(
|
||||||
orderRequestController.countRefuse.toString(),
|
orderRequestController.countRefuse.toString(),
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ class ConnectWidget extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final OrderRequestController orderRequestController =
|
// final OrderRequestController orderRequestController =
|
||||||
Get.put(OrderRequestController());
|
// Get.put(OrderRequestController());
|
||||||
CaptainWalletController captainWalletController =
|
CaptainWalletController captainWalletController =
|
||||||
Get.put(CaptainWalletController());
|
Get.put(CaptainWalletController());
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class ConnectWidget extends StatelessWidget {
|
|||||||
return Center(
|
return Center(
|
||||||
child: GetBuilder<HomeCaptainController>(
|
child: GetBuilder<HomeCaptainController>(
|
||||||
builder: (homeCaptainController) => int.parse(
|
builder: (homeCaptainController) => int.parse(
|
||||||
orderRequestController.countRefuse) >
|
homeCaptainController.countRefuse) >
|
||||||
3 ||
|
3 ||
|
||||||
double.parse(captainWalletController.totalPoints) < -3000
|
double.parse(captainWalletController.totalPoints) < -3000
|
||||||
? CupertinoButton(
|
? CupertinoButton(
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:SEFER/controller/functions/tts.dart';
|
|
||||||
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
import 'package:SEFER/controller/home/captin/home_captain_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -10,7 +9,6 @@ import 'package:SEFER/main.dart';
|
|||||||
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
|
import 'package:SEFER/views/home/Captin/driver_map_page.dart';
|
||||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'dart:math' as math;
|
|
||||||
import '../../../../constant/colors.dart';
|
import '../../../../constant/colors.dart';
|
||||||
import '../../../../constant/links.dart';
|
import '../../../../constant/links.dart';
|
||||||
import '../../../../constant/style.dart';
|
import '../../../../constant/style.dart';
|
||||||
@@ -25,52 +23,9 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
Get.put(OrderRequestController());
|
Get.put(OrderRequestController());
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final arguments = Get.arguments;
|
|
||||||
var myList;
|
|
||||||
final myListString = arguments['myListString'];
|
|
||||||
// final myList = arguments['DriverList'];
|
|
||||||
if (arguments['DriverList'] == null || arguments['DriverList'].isEmpty) {
|
|
||||||
myList = jsonDecode(myListString);
|
|
||||||
} else {
|
|
||||||
myList = arguments['DriverList'];
|
|
||||||
}
|
|
||||||
|
|
||||||
final body = arguments['body'];
|
|
||||||
Duration durationToAdd = Duration(seconds: int.parse(myList[4]));
|
|
||||||
int hours = durationToAdd.inHours;
|
|
||||||
int minutes = (durationToAdd.inMinutes % 60).round();
|
|
||||||
orderRequestController.startTimerSpeed(
|
|
||||||
myList[6].toString(), body.toString());
|
|
||||||
var coords = myList[0].split(',');
|
|
||||||
var coordDestination = myList[1].split(',');
|
|
||||||
|
|
||||||
// Parse to double
|
|
||||||
double latPassengerLocation = double.parse(coords[0]);
|
|
||||||
double lngPassengerLocation = double.parse(coords[1]);
|
|
||||||
double latPassengerDestination = double.parse(coordDestination[0]);
|
|
||||||
double lngPassengerDestination = double.parse(coordDestination[1]);
|
|
||||||
|
|
||||||
List<LatLng> pointsDirection = [
|
|
||||||
LatLng(latPassengerLocation, lngPassengerLocation),
|
|
||||||
LatLng(latPassengerDestination, lngPassengerDestination)
|
|
||||||
]; // Calculate the midpoint between the two points
|
|
||||||
// Calculate the minimum and maximum latitude and longitude values
|
|
||||||
double minLatitude =
|
|
||||||
math.min(pointsDirection[0].latitude, pointsDirection[1].latitude);
|
|
||||||
double maxLatitude =
|
|
||||||
math.max(pointsDirection[0].latitude, pointsDirection[1].latitude);
|
|
||||||
double minLongitude =
|
|
||||||
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
|
|
||||||
LatLngBounds bounds = LatLngBounds(
|
|
||||||
southwest: LatLng(minLatitude, minLongitude),
|
|
||||||
northeast: LatLng(maxLatitude, maxLongitude),
|
|
||||||
);
|
|
||||||
// void addCustomStartIcon() async {
|
// void addCustomStartIcon() async {
|
||||||
// Create the marker with the resized image
|
// Create the marker with the resized image
|
||||||
orderRequestController.calculateConsumptionFuel();
|
// orderRequestController.initilizeOrderPage();
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// double mpg = 0;
|
// double mpg = 0;
|
||||||
@@ -79,6 +34,8 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
// 12; //todo in register car add mpg in box
|
// 12; //todo in register car add mpg in box
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
return GetBuilder<OrderRequestController>(
|
||||||
|
builder: (orderRequestController) {
|
||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Speed Order'.tr,
|
title: 'Speed Order'.tr,
|
||||||
body: [
|
body: [
|
||||||
@@ -93,23 +50,26 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
zoom: 12,
|
zoom: 12,
|
||||||
target: Get.find<HomeCaptainController>().myLocation),
|
target: Get.find<HomeCaptainController>().myLocation),
|
||||||
cameraTargetBounds: CameraTargetBounds(bounds),
|
cameraTargetBounds:
|
||||||
|
CameraTargetBounds(orderRequestController.bounds),
|
||||||
myLocationButtonEnabled: true,
|
myLocationButtonEnabled: true,
|
||||||
trafficEnabled: true,
|
trafficEnabled: false,
|
||||||
buildingsEnabled: true,
|
buildingsEnabled: false,
|
||||||
mapToolbarEnabled: true,
|
mapToolbarEnabled: true,
|
||||||
myLocationEnabled: true,
|
myLocationEnabled: true,
|
||||||
markers: {
|
markers: {
|
||||||
Marker(
|
Marker(
|
||||||
markerId: MarkerId('MyLocation'.tr),
|
markerId: MarkerId('MyLocation'.tr),
|
||||||
position:
|
position: LatLng(
|
||||||
LatLng(latPassengerLocation, lngPassengerLocation),
|
orderRequestController.latPassengerLocation,
|
||||||
|
orderRequestController.lngPassengerLocation),
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: orderRequestController.startIcon),
|
icon: orderRequestController.startIcon),
|
||||||
Marker(
|
Marker(
|
||||||
markerId: MarkerId('Destination'.tr),
|
markerId: MarkerId('Destination'.tr),
|
||||||
position: LatLng(
|
position: LatLng(
|
||||||
latPassengerDestination, lngPassengerDestination),
|
orderRequestController.latPassengerDestination,
|
||||||
|
orderRequestController.lngPassengerDestination),
|
||||||
draggable: true,
|
draggable: true,
|
||||||
icon: orderRequestController.endIcon),
|
icon: orderRequestController.endIcon),
|
||||||
},
|
},
|
||||||
@@ -122,7 +82,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
startCap: Cap.buttCap,
|
startCap: Cap.buttCap,
|
||||||
visible: true,
|
visible: true,
|
||||||
polylineId: const PolylineId('routeOrder'),
|
polylineId: const PolylineId('routeOrder'),
|
||||||
points: pointsDirection,
|
points: orderRequestController.pointsDirection,
|
||||||
color: AppColor.primaryColor,
|
color: AppColor.primaryColor,
|
||||||
width: 2,
|
width: 2,
|
||||||
),
|
),
|
||||||
@@ -133,7 +93,8 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Card(
|
child: Card(
|
||||||
elevation: 3,
|
elevation: 3,
|
||||||
color: myList[20].toString() == 'haveSteps'
|
color: orderRequestController.myList[20].toString() ==
|
||||||
|
'haveSteps'
|
||||||
? AppColor.greenColor
|
? AppColor.greenColor
|
||||||
: AppColor.secondaryColor,
|
: AppColor.secondaryColor,
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -142,11 +103,13 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
TextButton.icon(
|
TextButton.icon(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
String mapUrl =
|
String mapUrl =
|
||||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/';
|
'https://www.google.com/maps/dir/${orderRequestController.myList[0]}/${orderRequestController.myList[1]}/';
|
||||||
showInBrowser(mapUrl);
|
showInBrowser(mapUrl);
|
||||||
},
|
},
|
||||||
icon: const Icon(Icons.map),
|
icon: const Icon(Icons.map),
|
||||||
label: myList[20].toString() == 'haveSteps'
|
label:
|
||||||
|
orderRequestController.myList[20].toString() ==
|
||||||
|
'haveSteps'
|
||||||
? Text(
|
? Text(
|
||||||
'Trip has Steps'.tr,
|
'Trip has Steps'.tr,
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
@@ -155,11 +118,13 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
style: AppStyle.title)),
|
style: AppStyle.title)),
|
||||||
Container(
|
Container(
|
||||||
decoration: AppStyle.boxDecoration.copyWith(
|
decoration: AppStyle.boxDecoration.copyWith(
|
||||||
color: myList[13].toString() == 'true'
|
color:
|
||||||
|
orderRequestController.myList[13].toString() ==
|
||||||
|
'true'
|
||||||
? AppColor.deepPurpleAccent
|
? AppColor.deepPurpleAccent
|
||||||
: AppColor.greenColor,
|
: AppColor.greenColor,
|
||||||
),
|
),
|
||||||
child: myList[13].toString() ==
|
child: orderRequestController.myList[13].toString() ==
|
||||||
'true' //Visa or Cash Method from notify to driver
|
'true' //Visa or Cash Method from notify to driver
|
||||||
? Text(
|
? Text(
|
||||||
'Visa',
|
'Visa',
|
||||||
@@ -180,7 +145,8 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
double.parse(myList[2]).toStringAsFixed(2),
|
double.parse(orderRequestController.myList[2])
|
||||||
|
.toStringAsFixed(2),
|
||||||
style: AppStyle.headTitle2,
|
style: AppStyle.headTitle2,
|
||||||
),
|
),
|
||||||
AnimatedContainer(
|
AnimatedContainer(
|
||||||
@@ -189,7 +155,9 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
child: AnimatedSize(
|
child: AnimatedSize(
|
||||||
duration: const Duration(seconds: 5),
|
duration: const Duration(seconds: 5),
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
child: myList[31].toString() == 'Comfort'
|
child: orderRequestController.myList[31]
|
||||||
|
.toString() ==
|
||||||
|
'Comfort'
|
||||||
? Column(
|
? Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceAround,
|
MainAxisAlignment.spaceAround,
|
||||||
@@ -209,7 +177,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
myList[31].toString().tr,
|
orderRequestController.myList[31].toString().tr,
|
||||||
style: AppStyle.title
|
style: AppStyle.title
|
||||||
.copyWith(color: AppColor.greenColor),
|
.copyWith(color: AppColor.greenColor),
|
||||||
),
|
),
|
||||||
@@ -220,7 +188,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: Get.height * .2,
|
height: Get.height * .22,
|
||||||
width: Get.width * .9,
|
width: Get.width * .9,
|
||||||
decoration: AppStyle.boxDecoration1,
|
decoration: AppStyle.boxDecoration1,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -241,13 +209,15 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
color: AppColor.greenColor,
|
color: AppColor.greenColor,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
myList[12] + ' ' + ' (${myList[11]}) ',
|
orderRequestController.myList[12] +
|
||||||
|
' ' +
|
||||||
|
' (${orderRequestController.myList[11]}) ',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
myList[29],
|
orderRequestController.myList[29],
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -263,13 +233,15 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
color: AppColor.redColor,
|
color: AppColor.redColor,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
myList[5] + ' ' + ' (${myList[4]}) ',
|
orderRequestController.myList[5] +
|
||||||
|
' ' +
|
||||||
|
' (${orderRequestController.myList[4]}) ',
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
myList[30],
|
orderRequestController.myList[30],
|
||||||
style: AppStyle.title,
|
style: AppStyle.title,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -287,12 +259,12 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
style: AppStyle.subtitle,
|
style: AppStyle.subtitle,
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: myList[8],
|
text: orderRequestController.myList[8],
|
||||||
style: AppStyle
|
style: AppStyle
|
||||||
.title), // Assuming myList[8] holds passenger name
|
.title), // Assuming orderRequestController.myList[8] holds passenger name
|
||||||
TextSpan(text: ' (', style: AppStyle.subtitle),
|
TextSpan(text: ' (', style: AppStyle.subtitle),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: myList[33].toString(),
|
text: orderRequestController.myList[33].toString(),
|
||||||
style: AppStyle
|
style: AppStyle
|
||||||
.title), // Assuming 'rate' holds the passenger rate
|
.title), // Assuming 'rate' holds the passenger rate
|
||||||
TextSpan(text: ' ⭐)', style: AppStyle.subtitle),
|
TextSpan(text: ' ⭐)', style: AppStyle.subtitle),
|
||||||
@@ -314,7 +286,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
// style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
// children: [
|
// children: [
|
||||||
// TextSpan(
|
// TextSpan(
|
||||||
// text: myList[26], style: AppStyle.headTitle2),
|
// text: orderRequestController.myList[26], style: AppStyle.headTitle2),
|
||||||
// ],
|
// ],
|
||||||
// ),
|
// ),
|
||||||
// ),
|
// ),
|
||||||
@@ -324,8 +296,8 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
// style: AppStyle.title,
|
// style: AppStyle.title,
|
||||||
// children: [
|
// children: [
|
||||||
// TextSpan(
|
// TextSpan(
|
||||||
// text: (double.parse(myList[2]) -
|
// text: (double.parse(orderRequestController.myList[2]) -
|
||||||
// double.parse(myList[32]))
|
// double.parse(orderRequestController.myList[32]))
|
||||||
// .toStringAsFixed(2),
|
// .toStringAsFixed(2),
|
||||||
// style: AppStyle.headTitle2),
|
// style: AppStyle.headTitle2),
|
||||||
// ],
|
// ],
|
||||||
@@ -347,9 +319,10 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Get.put(HomeCaptainController()).changeRideId();
|
Get.put(HomeCaptainController()).changeRideId();
|
||||||
box.write(BoxName.statusDriverLocation, 'on');
|
box.write(BoxName.statusDriverLocation, 'on');
|
||||||
var res = await CRUD()
|
var res = await CRUD().post(
|
||||||
.post(link: AppLink.updateStausFromSpeed, payload: {
|
link: AppLink.updateStausFromSpeed,
|
||||||
'id': myList[16],
|
payload: {
|
||||||
|
'id': orderRequestController.myList[16],
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'Apply',
|
'status': 'Apply',
|
||||||
'driver_id': box.read(BoxName.driverID),
|
'driver_id': box.read(BoxName.driverID),
|
||||||
@@ -358,7 +331,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
link:
|
link:
|
||||||
"${AppLink.seferAlexandriaServer}/rides/updateStausFromSpeed.php",
|
"${AppLink.seferAlexandriaServer}/rides/updateStausFromSpeed.php",
|
||||||
payload: {
|
payload: {
|
||||||
'id': myList[16],
|
'id': orderRequestController.myList[16],
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'Apply',
|
'status': 'Apply',
|
||||||
'driver_id': box.read(BoxName.driverID),
|
'driver_id': box.read(BoxName.driverID),
|
||||||
@@ -367,7 +340,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
link:
|
link:
|
||||||
"${AppLink.seferGizaServer}/rides/updateStausFromSpeed.php",
|
"${AppLink.seferGizaServer}/rides/updateStausFromSpeed.php",
|
||||||
payload: {
|
payload: {
|
||||||
'id': myList[16],
|
'id': orderRequestController.myList[16],
|
||||||
'rideTimeStart': DateTime.now().toString(),
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
'status': 'Apply',
|
'status': 'Apply',
|
||||||
'driver_id': box.read(BoxName.driverID),
|
'driver_id': box.read(BoxName.driverID),
|
||||||
@@ -375,18 +348,22 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
await CRUD().postFromDialogue(
|
await CRUD().postFromDialogue(
|
||||||
link: AppLink.addDriverOrder,
|
link: AppLink.addDriverOrder,
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id':
|
||||||
|
orderRequestController.myList[6].toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': myList[16].toString(),
|
'order_id': orderRequestController.myList[16]
|
||||||
|
.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
CRUD().postFromDialogue(
|
CRUD().postFromDialogue(
|
||||||
link:
|
link:
|
||||||
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
|
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id':
|
||||||
|
orderRequestController.myList[6].toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': myList[16].toString(),
|
'order_id': orderRequestController.myList[16]
|
||||||
|
.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -394,9 +371,11 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
link:
|
link:
|
||||||
'${AppLink.seferGizaServer}/driver_order/add.php',
|
'${AppLink.seferGizaServer}/driver_order/add.php',
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id':
|
||||||
|
orderRequestController.myList[6].toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': myList[16].toString(),
|
'order_id': orderRequestController.myList[16]
|
||||||
|
.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -428,27 +407,33 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
await CRUD().postFromDialogue(
|
await CRUD().postFromDialogue(
|
||||||
link: AppLink.addDriverOrder,
|
link: AppLink.addDriverOrder,
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id': orderRequestController.myList[6]
|
||||||
|
.toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': body.toString(),
|
'order_id':
|
||||||
|
orderRequestController.body.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
CRUD().postFromDialogue(
|
CRUD().postFromDialogue(
|
||||||
link:
|
link:
|
||||||
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
|
'${AppLink.seferAlexandriaServer}/driver_order/add.php',
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id': orderRequestController.myList[6]
|
||||||
|
.toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': body.toString(),
|
'order_id':
|
||||||
|
orderRequestController.body.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
CRUD().postFromDialogue(
|
CRUD().postFromDialogue(
|
||||||
link:
|
link:
|
||||||
'${AppLink.seferGizaServer}/driver_order/add.php',
|
'${AppLink.seferGizaServer}/driver_order/add.php',
|
||||||
payload: {
|
payload: {
|
||||||
'driver_id': myList[6].toString(),
|
'driver_id': orderRequestController.myList[6]
|
||||||
|
.toString(),
|
||||||
// box.read(BoxName.driverID).toString(),
|
// box.read(BoxName.driverID).toString(),
|
||||||
'order_id': body.toString(),
|
'order_id':
|
||||||
|
orderRequestController.body.toString(),
|
||||||
'status': 'Apply'
|
'status': 'Apply'
|
||||||
});
|
});
|
||||||
FirebaseMessagesController()
|
FirebaseMessagesController()
|
||||||
@@ -456,49 +441,81 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
'Apply Ride',
|
'Apply Ride',
|
||||||
'your ride is applied'.tr,
|
'your ride is applied'.tr,
|
||||||
// arguments['DriverList'][9].toString(),
|
// arguments['DriverList'][9].toString(),
|
||||||
arguments['DriverList'][9].toString(),
|
orderRequestController
|
||||||
|
.arguments['DriverList'][9]
|
||||||
|
.toString(),
|
||||||
// box.read(BoxName.tokenDriver).toString(),
|
// box.read(BoxName.tokenDriver).toString(),
|
||||||
bodyToPassenger,
|
bodyToPassenger,
|
||||||
'start.wav');
|
'start.wav');
|
||||||
Get.back();
|
Get.back();
|
||||||
|
|
||||||
// 'Arguments passed to PassengerLocationMapPage:');
|
// 'Arguments passed to PassengerLocationMapPage:');
|
||||||
// 'Payment Method: ${myList[13] == 'true' ? 'visa' : 'cash'}');
|
// 'Payment Method: ${orderRequestController.myList[13] == 'true' ? 'visa' : 'cash'}');
|
||||||
box.write(BoxName.rideArguments, {
|
box.write(BoxName.rideArguments, {
|
||||||
'passengerLocation': myList[0].toString(),
|
'passengerLocation':
|
||||||
'passengerDestination': myList[1].toString(),
|
orderRequestController.myList[0].toString(),
|
||||||
'Duration': myList[4].toString(),
|
'passengerDestination':
|
||||||
'totalCost': myList[26].toString(),
|
orderRequestController.myList[1].toString(),
|
||||||
'Distance': myList[5].toString(),
|
'Duration':
|
||||||
'name': myList[8].toString(),
|
orderRequestController.myList[4].toString(),
|
||||||
'phone': myList[10].toString(),
|
'totalCost':
|
||||||
'email': myList[28].toString(),
|
orderRequestController.myList[26].toString(),
|
||||||
'WalletChecked': myList[13].toString(),
|
'Distance':
|
||||||
'tokenPassenger': myList[9].toString(),
|
orderRequestController.myList[5].toString(),
|
||||||
|
'name':
|
||||||
|
orderRequestController.myList[8].toString(),
|
||||||
|
'phone':
|
||||||
|
orderRequestController.myList[10].toString(),
|
||||||
|
'email':
|
||||||
|
orderRequestController.myList[28].toString(),
|
||||||
|
'WalletChecked':
|
||||||
|
orderRequestController.myList[13].toString(),
|
||||||
|
'tokenPassenger':
|
||||||
|
orderRequestController.myList[9].toString(),
|
||||||
'direction':
|
'direction':
|
||||||
'https://www.google.com/maps/dir/${myList[0]}/${myList[1]}/',
|
'https://www.google.com/maps/dir/${orderRequestController.myList[0]}/${orderRequestController.myList[1]}/',
|
||||||
'DurationToPassenger': myList[15].toString(),
|
'DurationToPassenger':
|
||||||
'rideId': myList[16].toString(),
|
orderRequestController.myList[15].toString(),
|
||||||
'passengerId': myList[7].toString(),
|
'rideId':
|
||||||
'driverId': myList[18].toString(),
|
orderRequestController.myList[16].toString(),
|
||||||
'durationOfRideValue': myList[19].toString(),
|
'passengerId':
|
||||||
'paymentAmount': myList[2].toString(),
|
orderRequestController.myList[7].toString(),
|
||||||
'paymentMethod': myList[13].toString() == 'true'
|
'driverId':
|
||||||
|
orderRequestController.myList[18].toString(),
|
||||||
|
'durationOfRideValue':
|
||||||
|
orderRequestController.myList[19].toString(),
|
||||||
|
'paymentAmount':
|
||||||
|
orderRequestController.myList[2].toString(),
|
||||||
|
'paymentMethod': orderRequestController.myList[13]
|
||||||
|
.toString() ==
|
||||||
|
'true'
|
||||||
? 'visa'
|
? 'visa'
|
||||||
: 'cash',
|
: 'cash',
|
||||||
'isHaveSteps': myList[20].toString(),
|
'isHaveSteps':
|
||||||
'step0': myList[21].toString(),
|
orderRequestController.myList[20].toString(),
|
||||||
'step1': myList[22].toString(),
|
'step0':
|
||||||
'step2': myList[23].toString(),
|
orderRequestController.myList[21].toString(),
|
||||||
'step3': myList[24].toString(),
|
'step1':
|
||||||
'step4': myList[25].toString(),
|
orderRequestController.myList[22].toString(),
|
||||||
'passengerWalletBurc': myList[26].toString(),
|
'step2':
|
||||||
|
orderRequestController.myList[23].toString(),
|
||||||
|
'step3':
|
||||||
|
orderRequestController.myList[24].toString(),
|
||||||
|
'step4':
|
||||||
|
orderRequestController.myList[25].toString(),
|
||||||
|
'passengerWalletBurc':
|
||||||
|
orderRequestController.myList[26].toString(),
|
||||||
'timeOfOrder': DateTime.now().toString(),
|
'timeOfOrder': DateTime.now().toString(),
|
||||||
'totalPassenger': myList[2].toString(),
|
'totalPassenger':
|
||||||
'carType': myList[31].toString(),
|
orderRequestController.myList[2].toString(),
|
||||||
'kazan': myList[32].toString(),
|
'carType':
|
||||||
'startNameLocation': myList[29].toString(),
|
orderRequestController.myList[31].toString(),
|
||||||
'endNameLocation': myList[30].toString(),
|
'kazan':
|
||||||
|
orderRequestController.myList[32].toString(),
|
||||||
|
'startNameLocation':
|
||||||
|
orderRequestController.myList[29].toString(),
|
||||||
|
'endNameLocation':
|
||||||
|
orderRequestController.myList[30].toString(),
|
||||||
});
|
});
|
||||||
Get.to(() => PassengerLocationMapPage(),
|
Get.to(() => PassengerLocationMapPage(),
|
||||||
arguments: box.read(BoxName.rideArguments));
|
arguments: box.read(BoxName.rideArguments));
|
||||||
@@ -509,7 +526,8 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
GetBuilder<OrderRequestController>(
|
GetBuilder<OrderRequestController>(
|
||||||
builder: (timerController) {
|
builder: (timerController) {
|
||||||
final isNearEnd = timerController.remainingTimeSpeed <=
|
final isNearEnd =
|
||||||
|
timerController.remainingTimeSpeed <=
|
||||||
5; // Define a threshold for "near end"
|
5; // Define a threshold for "near end"
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
@@ -561,22 +579,22 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
orderRequestController.endTimer();
|
orderRequestController.endTimer();
|
||||||
|
|
||||||
orderRequestController.refuseOrder(
|
orderRequestController.refuseOrder(
|
||||||
myList[16].toString(),
|
orderRequestController.myList[16].toString(),
|
||||||
);
|
);
|
||||||
orderRequestController.addRideToNotificationDriverString(
|
orderRequestController.addRideToNotificationDriverString(
|
||||||
myList[16].toString(),
|
orderRequestController.myList[16].toString(),
|
||||||
myList[29].toString(),
|
orderRequestController.myList[29].toString(),
|
||||||
myList[30].toString(),
|
orderRequestController.myList[30].toString(),
|
||||||
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}',
|
'${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day}',
|
||||||
'${DateTime.now().hour}:${DateTime.now().minute}',
|
'${DateTime.now().hour}:${DateTime.now().minute}',
|
||||||
myList[2].toString(),
|
orderRequestController.myList[2].toString(),
|
||||||
myList[7].toString(),
|
orderRequestController.myList[7].toString(),
|
||||||
'wait',
|
'wait',
|
||||||
myList[31].toString(),
|
orderRequestController.myList[31].toString(),
|
||||||
myList[33].toString(),
|
orderRequestController.myList[33].toString(),
|
||||||
myList[2].toString(),
|
orderRequestController.myList[2].toString(),
|
||||||
myList[5].toString(),
|
orderRequestController.myList[5].toString(),
|
||||||
myList[4].toString());
|
orderRequestController.myList[4].toString());
|
||||||
},
|
},
|
||||||
kolor: AppColor.redColor,
|
kolor: AppColor.redColor,
|
||||||
),
|
),
|
||||||
@@ -587,5 +605,6 @@ class OrderSpeedRequest extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
isleading: true);
|
isleading: true);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,9 +172,10 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${AppInformation.appName} Wallet',
|
// '${AppInformation.appName} Wallet',
|
||||||
style: AppStyle.headTitle
|
'SEFER Wallet',
|
||||||
.copyWith(color: AppColor.writeColor),
|
style: AppStyle.headTitle.copyWith(
|
||||||
|
color: AppColor.writeColor, fontSize: 26),
|
||||||
),
|
),
|
||||||
const Icon(Icons.account_balance_wallet,
|
const Icon(Icons.account_balance_wallet,
|
||||||
color: AppColor.writeColor, size: 24),
|
color: AppColor.writeColor, size: 24),
|
||||||
@@ -184,8 +185,8 @@ class CardSeferWalletDriver extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
'${Get.find<CaptainWalletController>().totalAmountVisa} ${'L.E'.tr}' ??
|
||||||
'0.0 \$',
|
'0.0 ${'L.E'.tr}',
|
||||||
style: AppStyle.headTitle2.copyWith(
|
style: AppStyle.headTitle2.copyWith(
|
||||||
color: AppColor.writeColor, fontSize: 28),
|
color: AppColor.writeColor, fontSize: 28),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
.tr);
|
.tr);
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.headphones)),
|
child: const Icon(Icons.headphones)),
|
||||||
'${'Total Amount:'.tr} ${captainWalletController.totalAmount}\$',
|
'${'Total Amount:'.tr} ${captainWalletController.totalAmount} ${'L.E'.tr}',
|
||||||
'This amount for all trip I get from Passengers'
|
'This amount for all trip I get from Passengers'
|
||||||
.tr,
|
.tr,
|
||||||
duration: const Duration(seconds: 6),
|
duration: const Duration(seconds: 6),
|
||||||
@@ -163,7 +163,7 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: const Icon(Icons.headphones),
|
child: const Icon(Icons.headphones),
|
||||||
),
|
),
|
||||||
'${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa}\$',
|
'${'Total Amount:'.tr} ${captainWalletController.totalAmountVisa} ${'L.E'.tr}',
|
||||||
'This amount for all trip I get from Passengers and Collected For me in'
|
'This amount for all trip I get from Passengers and Collected For me in'
|
||||||
.tr +
|
.tr +
|
||||||
' ${AppInformation.appName} Wallet'
|
' ${AppInformation.appName} Wallet'
|
||||||
@@ -296,7 +296,7 @@ class WalletCaptain extends StatelessWidget {
|
|||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: Text(
|
child: Text(
|
||||||
'$amount\$',
|
'$amount ${'L.E'.tr}',
|
||||||
style:
|
style:
|
||||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:SEFER/constant/colors.dart';
|
import 'package:SEFER/constant/colors.dart';
|
||||||
import 'package:SEFER/constant/style.dart';
|
import 'package:SEFER/constant/style.dart';
|
||||||
import 'package:SEFER/controller/notification/ride_available_controller.dart';
|
import 'package:SEFER/controller/notification/ride_available_controller.dart';
|
||||||
@@ -6,6 +8,15 @@ import 'package:SEFER/views/widgets/mycircular.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import '../../constant/box_name.dart';
|
||||||
|
import '../../constant/links.dart';
|
||||||
|
import '../../controller/firebase/firbase_messge.dart';
|
||||||
|
import '../../controller/functions/crud.dart';
|
||||||
|
import '../../controller/home/captin/home_captain_controller.dart';
|
||||||
|
import '../../main.dart';
|
||||||
|
import '../home/Captin/driver_map_page.dart';
|
||||||
|
import '../widgets/mydialoug.dart';
|
||||||
|
|
||||||
class AvailableRidesPage extends StatelessWidget {
|
class AvailableRidesPage extends StatelessWidget {
|
||||||
const AvailableRidesPage({super.key});
|
const AvailableRidesPage({super.key});
|
||||||
|
|
||||||
@@ -49,9 +60,6 @@ class RideAvailableCard extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
// _buildLocationRow('🟢', rideInfo['startName']),
|
|
||||||
// const SizedBox(height: 8),
|
|
||||||
// _buildLocationRow('🔴', rideInfo['endName']),
|
|
||||||
_buildLocationRow('↑', rideInfo['startName'], AppColor.greenColor),
|
_buildLocationRow('↑', rideInfo['startName'], AppColor.greenColor),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
_buildLocationRow('↓', rideInfo['endName'], Colors.red),
|
_buildLocationRow('↓', rideInfo['endName'], Colors.red),
|
||||||
@@ -128,7 +136,127 @@ class RideAvailableCard extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _acceptRide() async {
|
void _acceptRide() async {
|
||||||
// Your existing accept ride logic here
|
var res = await CRUD().post(link: AppLink.updateStausFromSpeed, payload: {
|
||||||
// ...
|
'id': rideInfo['id'],
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'Apply',
|
||||||
|
'driver_id': box.read(BoxName.driverID),
|
||||||
|
});
|
||||||
|
if (AppLink.endPoint.toString() != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(
|
||||||
|
link: '${AppLink.endPoint}rides/updateStausFromSpeed.php',
|
||||||
|
payload: {
|
||||||
|
'id': rideInfo['id'],
|
||||||
|
'rideTimeStart': DateTime.now().toString(),
|
||||||
|
'status': 'Apply',
|
||||||
|
'driver_id': box.read(BoxName.driverID),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// .then((value) {
|
||||||
|
// var json = jsonDecode(res);
|
||||||
|
if (res == "failure") {
|
||||||
|
MyDialog().getDialog(
|
||||||
|
"This ride is already taken by another driver.".tr, '', () {
|
||||||
|
CRUD().post(
|
||||||
|
link: AppLink.deleteAvailableRide, payload: {'id': rideInfo['id']});
|
||||||
|
if (AppLink.endPoint.toString() != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(
|
||||||
|
link:
|
||||||
|
'${AppLink.endPoint}/ride/notificationCaptain/deleteAvailableRide.php',
|
||||||
|
payload: {'id': rideInfo['id']});
|
||||||
|
}
|
||||||
|
Get.back();
|
||||||
|
});
|
||||||
|
} else if (jsonDecode(res)['status'] == "success") {
|
||||||
|
List<String> bodyToPassenger = [
|
||||||
|
box.read(BoxName.driverID).toString(),
|
||||||
|
box.read(BoxName.nameDriver).toString(),
|
||||||
|
box.read(BoxName.tokenDriver).toString(),
|
||||||
|
];
|
||||||
|
box.write(BoxName.statusDriverLocation, 'on');
|
||||||
|
await CRUD().postFromDialogue(link: AppLink.addDriverOrder, payload: {
|
||||||
|
'driver_id': box.read(BoxName.driverID),
|
||||||
|
// box.read(BoxName.driverID).toString(),
|
||||||
|
'order_id': rideInfo['id'],
|
||||||
|
'status': 'Apply'
|
||||||
|
});
|
||||||
|
if (AppLink.endPoint.toString() != AppLink.seferCairoServer) {
|
||||||
|
CRUD().postFromDialogue(
|
||||||
|
link: '${AppLink.endPoint}/driver_order/add.php',
|
||||||
|
payload: {
|
||||||
|
'driver_id': box.read(BoxName.driverID),
|
||||||
|
// box.read(BoxName.driverID).toString(),
|
||||||
|
'order_id': rideInfo['id'],
|
||||||
|
'status': 'Apply'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
await CRUD().post(link: AppLink.updateRides, payload: {
|
||||||
|
'id': rideInfo['id'],
|
||||||
|
'DriverIsGoingToPassenger': DateTime.now().toString(),
|
||||||
|
'status': 'Applied'
|
||||||
|
});
|
||||||
|
if (AppLink.endPoint.toString() != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(link: '${AppLink.endPoint}/rides/update.php', payload: {
|
||||||
|
'id': rideInfo['id'],
|
||||||
|
'DriverIsGoingToPassenger': DateTime.now().toString(),
|
||||||
|
'status': 'Applied'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await CRUD().post(
|
||||||
|
link: AppLink.updateWaitingRide,
|
||||||
|
payload: {'id': rideInfo['id'], 'status': 'Applied'});
|
||||||
|
if (AppLink.endPoint.toString() != AppLink.seferCairoServer) {
|
||||||
|
CRUD().post(
|
||||||
|
link:
|
||||||
|
"${AppLink.endPoint}/ride/notificationCaptain/updateWaitingTrip.php",
|
||||||
|
payload: {'id': rideInfo['id'], 'status': 'Applied'});
|
||||||
|
}
|
||||||
|
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||||
|
'Apply Ride',
|
||||||
|
'your ride is applied'.tr,
|
||||||
|
// arguments['DriverList'][9].toString(),
|
||||||
|
rideInfo['passengerToken'].toString(),
|
||||||
|
// box.read(BoxName.tokenDriver).toString(),
|
||||||
|
bodyToPassenger,
|
||||||
|
'start.wav');
|
||||||
|
Get.back();
|
||||||
|
Get.to(() => PassengerLocationMapPage(), arguments: {
|
||||||
|
'passengerLocation': rideInfo['start_location'].toString(),
|
||||||
|
'passengerDestination': rideInfo['end_location'].toString(),
|
||||||
|
'Duration': rideInfo['duration'].toString(),
|
||||||
|
'totalCost': rideInfo['price'].toString(),
|
||||||
|
'Distance': rideInfo['distance'].toString(),
|
||||||
|
'name': rideInfo['first_name'].toString(),
|
||||||
|
'phone': rideInfo['phone'].toString(),
|
||||||
|
'email': rideInfo['email'].toString(),
|
||||||
|
'WalletChecked': rideInfo['payment_method'].toString(),
|
||||||
|
'tokenPassenger': rideInfo['passengerToken'].toString(),
|
||||||
|
'direction':
|
||||||
|
'https://www.google.com/maps/dir/${rideInfo['start_location']}/${rideInfo['end_location']}/',
|
||||||
|
'DurationToPassenger': rideInfo['duration'].toString(),
|
||||||
|
'rideId': rideInfo['id'].toString(),
|
||||||
|
'passengerId': rideInfo['passenger_id'].toString(),
|
||||||
|
'driverId': box.read(BoxName.driverID).toString(),
|
||||||
|
'durationOfRideValue': rideInfo['duration'].toString(),
|
||||||
|
'paymentAmount': rideInfo['price'].toString(),
|
||||||
|
'paymentMethod': 'cash'.toString() == //todo fix payment method
|
||||||
|
'true'
|
||||||
|
? 'visa'
|
||||||
|
: 'cash',
|
||||||
|
'isHaveSteps': 'startEnd'.toString(),
|
||||||
|
'step0': ''.toString(),
|
||||||
|
'step1': ''.toString(),
|
||||||
|
'step2': ''.toString(),
|
||||||
|
'step3': ''.toString(),
|
||||||
|
'step4': ''.toString(),
|
||||||
|
'passengerWalletBurc': rideInfo['bruc'].toString(),
|
||||||
|
'timeOfOrder': DateTime.now().toString(),
|
||||||
|
'totalPassenger': rideInfo['price'].toString(),
|
||||||
|
'carType': rideInfo['carType'].toString(),
|
||||||
|
'kazan': Get.find<HomeCaptainController>().kazan.toString(),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user