25-10-11/1
This commit is contained in:
@@ -225,24 +225,15 @@ class _OrderOverlayState extends State<OrderOverlay>
|
||||
_getData(8).toString(),
|
||||
_getData(9).toString(),
|
||||
];
|
||||
final fmc = Get.isRegistered<FirebaseMessagesController>()
|
||||
? Get.find<FirebaseMessagesController>()
|
||||
: Get.put(FirebaseMessagesController());
|
||||
|
||||
// fmc.sendNotificationToDriverMAP(
|
||||
// "Accepted Ride",
|
||||
// 'your ride is Accepted'.tr,
|
||||
// _getData(9).toString(),
|
||||
// bodyToPassenger,
|
||||
// 'start.wav',
|
||||
// );
|
||||
NotificationService.sendNotification(
|
||||
target: _getData(9).toString(),
|
||||
title: "Accepted Ride",
|
||||
title: "Accepted Ride".tr,
|
||||
body: 'your ride is Accepted'.tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
driverList: bodyToPassenger,
|
||||
category: 'Accepted Ride',
|
||||
);
|
||||
final payload = {
|
||||
// بيانات أساسية
|
||||
@@ -294,15 +285,6 @@ class _OrderOverlayState extends State<OrderOverlay>
|
||||
'status': 'Apply'
|
||||
});
|
||||
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link: "${AppLink.endPoint}/ride/driver_order/add.php",
|
||||
payload: {
|
||||
'driver_id': driverId,
|
||||
'order_id': orderData!.orderId,
|
||||
'status': 'Apply'
|
||||
});
|
||||
}
|
||||
_log("Server update successful. Writing to storage.");
|
||||
notificationController.showNotification(
|
||||
"Order Accepted".tr,
|
||||
|
||||
@@ -184,6 +184,32 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
// Card(
|
||||
// elevation: 4,
|
||||
// child: Padding(
|
||||
// padding: const EdgeInsets.all(16.0),
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
// children: [
|
||||
// _InfoTile(
|
||||
// icon: Icons.timer,
|
||||
// label:
|
||||
// '${(double.parse(controller.myList[12]) / 60).toStringAsFixed(0)} ${'min'.tr}',
|
||||
// ),
|
||||
// _InfoTile(
|
||||
// icon: Icons.directions_car,
|
||||
// label:
|
||||
// '${(double.parse(controller.myList[11]) / 1000).toStringAsFixed(1)} ${'km'.tr}',
|
||||
// ),
|
||||
// _InfoTile(
|
||||
// icon: Icons.monetization_on,
|
||||
// label: '${controller.myList[2]}',
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// استبدل هذا الكود
|
||||
Card(
|
||||
elevation: 4,
|
||||
child: Padding(
|
||||
@@ -194,16 +220,21 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
|
||||
_InfoTile(
|
||||
icon: Icons.timer,
|
||||
label:
|
||||
'${(double.parse(controller.myList[12]) / 60).toStringAsFixed(0)} ${'min'.tr}',
|
||||
// استخدم الفهرس 13 للوقت (Duration)
|
||||
'${((double.tryParse(controller.myList[13].toString()) ?? 0.0) / 60).toStringAsFixed(0)} ${'min'.tr}',
|
||||
),
|
||||
_InfoTile(
|
||||
icon: Icons.directions_car,
|
||||
label:
|
||||
'${(double.parse(controller.myList[11]) / 1000).toStringAsFixed(1)} ${'km'.tr}',
|
||||
// استخدم الفهرس 14 للمسافة (Distance)
|
||||
// استخدم tryParse للأمان لأن القيمة "" (نص فارغ)
|
||||
'${((double.tryParse(controller.myList[14].toString()) ?? 0.0) / 1000).toStringAsFixed(1)} ${'km'.tr}',
|
||||
),
|
||||
_InfoTile(
|
||||
icon: Icons.monetization_on,
|
||||
label: '${controller.myList[2]}',
|
||||
label:
|
||||
// السعر أصبح في الفهرس 4
|
||||
'${controller.myList[4]}',
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -230,17 +261,15 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
|
||||
'status': 'Apply',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
});
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.endPoint}/ride/rides/updateStausFromSpeed.php",
|
||||
payload: {
|
||||
'id': (controller.myList[16]),
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Apply',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
});
|
||||
}
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.endPoint}/ride/rides/updateStausFromSpeed.php",
|
||||
payload: {
|
||||
'id': (controller.myList[16]),
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Apply',
|
||||
'driver_id': box.read(BoxName.driverID),
|
||||
});
|
||||
if (res == 'failure') {
|
||||
MyDialog().getDialog(
|
||||
"This ride is already applied by another driver."
|
||||
@@ -258,43 +287,21 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
|
||||
(controller.myList[16].toString()),
|
||||
'status': 'Apply'
|
||||
});
|
||||
if (AppLink.endPoint !=
|
||||
AppLink.seferCairoServer) {
|
||||
CRUD().postFromDialogue(
|
||||
link:
|
||||
'${AppLink.endPoint}/rides/driver_order/add.php',
|
||||
payload: {
|
||||
'driver_id':
|
||||
(controller.myList[6].toString()),
|
||||
'order_id':
|
||||
(controller.myList[16].toString()),
|
||||
'status': 'Apply'
|
||||
});
|
||||
}
|
||||
|
||||
List<String> bodyToPassenger = [
|
||||
controller.myList[6].toString(),
|
||||
controller.myList[8].toString(),
|
||||
controller.myList[9].toString(),
|
||||
];
|
||||
final fmc =
|
||||
Get.isRegistered<FirebaseMessagesController>()
|
||||
? Get.find<FirebaseMessagesController>()
|
||||
: Get.put(FirebaseMessagesController());
|
||||
|
||||
// fmc.sendNotificationToDriverMAP(
|
||||
// "Accepted Ride",
|
||||
// 'your ride is Accepted'.tr,
|
||||
// controller.myList[9].toString(),
|
||||
// bodyToPassenger,
|
||||
// 'start',
|
||||
// );
|
||||
NotificationService.sendNotification(
|
||||
target: controller.myList[9].toString(),
|
||||
title: "Accepted Ride",
|
||||
title: "Accepted Ride".tr,
|
||||
body: 'your ride is Accepted'.tr,
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
driverList: bodyToPassenger,
|
||||
category: 'Accepted Ride',
|
||||
);
|
||||
Get.back();
|
||||
box.write(BoxName.rideArguments, {
|
||||
@@ -398,7 +405,7 @@ class _OrderRequestPageState extends State<OrderRequestPage> {
|
||||
'${box.read(BoxName.nameDriver)} ${'is reviewing your order. They may need more information or a higher price.'.tr}',
|
||||
isTopic: false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
driverList: [], category: 'Order Under Review',
|
||||
);
|
||||
|
||||
controller.refuseOrder(
|
||||
|
||||
@@ -368,7 +368,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.endPoint}/ride/rides/updateStausFromSpeed.php",
|
||||
"${AppLink.rideServer}/rides/updateStausFromSpeed.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart':
|
||||
@@ -401,12 +401,12 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
?[9]
|
||||
?.toString() ??
|
||||
_getData(9),
|
||||
title: 'Accepted Ride',
|
||||
title: 'Accepted Ride'.tr,
|
||||
body: 'your ride is applied'.tr,
|
||||
isTopic:
|
||||
false, // Important: this is a token
|
||||
tone: 'start',
|
||||
driverList: [],
|
||||
driverList: [], category: 'Accepted Ride',
|
||||
);
|
||||
|
||||
// Using rideId (_getData(16)) for order_id consistently
|
||||
@@ -423,7 +423,7 @@ class OrderSpeedRequest extends StatelessWidget {
|
||||
AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link:
|
||||
"${AppLink.endPoint}/ride/driver_order/add.php",
|
||||
"${AppLink.rideServer}/driver_order/add.php",
|
||||
payload: {
|
||||
'driver_id': _getData(6),
|
||||
'order_id': rideId,
|
||||
|
||||
Reference in New Issue
Block a user