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.
|
||||
minSdk = 23
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = 108
|
||||
versionName = '1.5.08'
|
||||
versionCode = 109
|
||||
versionName = '1.5.09'
|
||||
multiDexEnabled =true
|
||||
}
|
||||
|
||||
|
||||
@@ -257,6 +257,45 @@ class HomeCaptainController extends GetxController {
|
||||
// LocationController().getLocation();
|
||||
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 {
|
||||
await CRUD().post(link: AppLink.addTokensDriver, payload: {
|
||||
|
||||
@@ -171,13 +171,20 @@ class MapDriverController extends GetxController {
|
||||
|
||||
cancelTripFromDriverAfterApplied() async {
|
||||
if (formKeyCancel.currentState!.validate()) {
|
||||
CRUD().post(
|
||||
await CRUD().post(
|
||||
link: "${AppLink.seferCairoServer}/ride/rides/update.php",
|
||||
payload: {
|
||||
"id": rideId.toString(), // Convert to String
|
||||
"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:
|
||||
"${AppLink.seferCairoServer}/ride/cancelRide/addCancelTripFromDriverAfterApplied.php",
|
||||
payload: {
|
||||
@@ -186,6 +193,17 @@ class MapDriverController extends GetxController {
|
||||
"status": 'reject After Applied',
|
||||
"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(
|
||||
"Cancel Trip from driver".tr,
|
||||
"Trip Cancelled from driver. We are looking for a new driver. Please wait."
|
||||
@@ -194,44 +212,13 @@ class MapDriverController extends GetxController {
|
||||
[],
|
||||
'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({
|
||||
'order_id': rideId,
|
||||
'created_at': DateTime.now().toString(),
|
||||
'driver_id': box.read(BoxName.driverID).toString(),
|
||||
}, TableName.driverOrdersRefuse);
|
||||
Get.put(OrderRequestController()).getRefusedOrderByCaptain();
|
||||
Get.find<HomeCaptainController>().getRefusedOrderByCaptain();
|
||||
Get.offAll(HomeCaptain());
|
||||
}
|
||||
}
|
||||
@@ -302,21 +289,13 @@ class MapDriverController extends GetxController {
|
||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferGizaServer}/ride/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferAlexandriaServer}/ride/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(link: "${AppLink.endPoint}/ride/rides/update.php", payload: {
|
||||
'id': rideId,
|
||||
'driverGoToPassengerTime': DateTime.now().toString(),
|
||||
'status': 'Applied'
|
||||
});
|
||||
}
|
||||
// Get.find<HomeCaptainController>().changeToAppliedRide('Applied');
|
||||
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
@@ -402,20 +381,13 @@ class MapDriverController extends GetxController {
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
CRUD()
|
||||
.post(link: "${AppLink.seferGizaServer}/rides/update.php", payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(link: "${AppLink.endPoint}/rides/update.php", payload: {
|
||||
'id': rideId,
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'status': 'Begin',
|
||||
});
|
||||
}
|
||||
FirebaseMessagesController().sendNotificationToAnyWithoutData(
|
||||
'RideIsBegin',
|
||||
box.read(BoxName.name).toString(),
|
||||
@@ -533,20 +505,14 @@ class MapDriverController extends GetxController {
|
||||
'rideTimeStart': DateTime.now().toString(),
|
||||
'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 =
|
||||
await generateTokenDriver(costOfWaiting5Minute.toString());
|
||||
var res = await CRUD().post(link: AppLink.addDrivePayment, payload: {
|
||||
@@ -676,23 +642,17 @@ class MapDriverController extends GetxController {
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
});
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferGizaServer}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
},
|
||||
);
|
||||
CRUD().post(
|
||||
link: "${AppLink.seferAlexandriaServer}/rides/update.php",
|
||||
if (AppLink.endPoint != AppLink.seferCairoServer) {
|
||||
CRUD().post(
|
||||
link: "${AppLink.endPoint}/rides/update.php",
|
||||
payload: {
|
||||
'id': rideId,
|
||||
'rideTimeFinish': DateTime.now().toString(),
|
||||
'status': 'Finished',
|
||||
'price': totalCost,
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
if (walletChecked == 'true') {
|
||||
paymentToken = await generateTokenPassenger(
|
||||
((-1) * double.parse(paymentAmount)).toString());
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:get/get.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/views/widgets/elevated_btn.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
|
||||
import 'dart:math' as math;
|
||||
import '../../../constant/box_name.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
import '../../functions/crud.dart';
|
||||
@@ -24,15 +26,73 @@ class OrderRequestController extends GetxController {
|
||||
final locationController = Get.put(LocationController());
|
||||
BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker;
|
||||
BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker;
|
||||
final arguments = Get.arguments;
|
||||
var myList;
|
||||
late int hours;
|
||||
late int minutes;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
getRefusedOrderByCaptain();
|
||||
// getRefusedOrderByCaptain();
|
||||
initilizeOrderPage();
|
||||
addCustomStartIcon();
|
||||
addCustomEndIcon();
|
||||
// calculateConsumptionFuel();
|
||||
update();
|
||||
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 {
|
||||
await CRUD().get(link: AppLink.getRidesDetails, payload: {
|
||||
'id': box.read(BoxName.myList)[2].toString(),
|
||||
@@ -44,9 +104,10 @@ class OrderRequestController extends GetxController {
|
||||
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/A.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
BitmapDescriptor.asset(
|
||||
config,
|
||||
'assets/images/A.png',
|
||||
).then((value) {
|
||||
startIcon = value;
|
||||
update();
|
||||
});
|
||||
@@ -55,9 +116,10 @@ class OrderRequestController extends GetxController {
|
||||
void addCustomEndIcon() {
|
||||
ImageConfiguration config = ImageConfiguration(
|
||||
size: const Size(30, 30), devicePixelRatio: Get.pixelRatio);
|
||||
BitmapDescriptor.fromAssetImage(config, 'assets/images/b.png',
|
||||
mipmaps: false)
|
||||
.then((value) {
|
||||
BitmapDescriptor.asset(
|
||||
config,
|
||||
'assets/images/b.png',
|
||||
).then((value) {
|
||||
endIcon = value;
|
||||
update();
|
||||
});
|
||||
@@ -74,46 +136,6 @@ class OrderRequestController extends GetxController {
|
||||
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;
|
||||
|
||||
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 أهمية كبيرة لسلامتك. نحن نقدم ميزات مثل التحقق من هوية السائق ، وتتبع الرحلات داخل التطبيق ، وخيارات الاتصال في حالات الطوارئ.",
|
||||
'Frequently Questions': 'الأسئلة الشائعة',
|
||||
"Contact Us": "اتصل بنا",
|
||||
'Choose a contact option': 'اختر خيار الاتصال',
|
||||
"You can change the vibration feedback for all buttons":
|
||||
"يمكنك تغيير اهتزاز الرج لجميع الأزرار",
|
||||
'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": "أساليب الأمان الأكثر فاعلية",
|
||||
"In-App VOIP Calls": "مكالمات VOIP داخل التطبيق",
|
||||
"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.":
|
||||
"من فضلك ساعدني! تواصل معي في أقرب وقت ممكن.",
|
||||
"Share Trip Details": "شارك تفاصيل الرحلة",
|
||||
"Car Plate is": "لوحة السيارة", 'L.E': 'جنيه',
|
||||
"Car Plate is": "لوحة السيارة",
|
||||
'L.E': 'ج.م',
|
||||
"the 3000 points equal 3000 L.E for you":
|
||||
"الـ 3000 نقطة تعادل 3000 جنيه مصري بالنسبة لك",
|
||||
"So go and gain your money": "انطلق واكسب مالك",
|
||||
|
||||
@@ -36,7 +36,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(OrderRequestController());
|
||||
// Get.put(OrderRequestController());
|
||||
// Get.put(HomeCaptainController());
|
||||
Get.put(CaptainWalletController());
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
@@ -53,7 +53,7 @@ class HomeCaptain extends StatelessWidget {
|
||||
elevation: 1,
|
||||
title: Text('Home'.tr),
|
||||
actions: [
|
||||
GetBuilder<OrderRequestController>(
|
||||
GetBuilder<HomeCaptainController>(
|
||||
builder: (orderRequestController) => MyCircleContainer(
|
||||
child: Text(
|
||||
orderRequestController.countRefuse.toString(),
|
||||
|
||||
@@ -16,8 +16,8 @@ class ConnectWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final OrderRequestController orderRequestController =
|
||||
Get.put(OrderRequestController());
|
||||
// final OrderRequestController orderRequestController =
|
||||
// Get.put(OrderRequestController());
|
||||
CaptainWalletController captainWalletController =
|
||||
Get.put(CaptainWalletController());
|
||||
|
||||
@@ -25,7 +25,7 @@ class ConnectWidget extends StatelessWidget {
|
||||
return Center(
|
||||
child: GetBuilder<HomeCaptainController>(
|
||||
builder: (homeCaptainController) => int.parse(
|
||||
orderRequestController.countRefuse) >
|
||||
homeCaptainController.countRefuse) >
|
||||
3 ||
|
||||
double.parse(captainWalletController.totalPoints) < -3000
|
||||
? CupertinoButton(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -172,9 +172,10 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'${AppInformation.appName} Wallet',
|
||||
style: AppStyle.headTitle
|
||||
.copyWith(color: AppColor.writeColor),
|
||||
// '${AppInformation.appName} Wallet',
|
||||
'SEFER Wallet',
|
||||
style: AppStyle.headTitle.copyWith(
|
||||
color: AppColor.writeColor, fontSize: 26),
|
||||
),
|
||||
const Icon(Icons.account_balance_wallet,
|
||||
color: AppColor.writeColor, size: 24),
|
||||
@@ -184,8 +185,8 @@ class CardSeferWalletDriver extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'${Get.find<CaptainWalletController>().totalAmountVisa}\$' ??
|
||||
'0.0 \$',
|
||||
'${Get.find<CaptainWalletController>().totalAmountVisa} ${'L.E'.tr}' ??
|
||||
'0.0 ${'L.E'.tr}',
|
||||
style: AppStyle.headTitle2.copyWith(
|
||||
color: AppColor.writeColor, fontSize: 28),
|
||||
),
|
||||
|
||||
@@ -133,7 +133,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
.tr);
|
||||
},
|
||||
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'
|
||||
.tr,
|
||||
duration: const Duration(seconds: 6),
|
||||
@@ -163,7 +163,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
},
|
||||
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'
|
||||
.tr +
|
||||
' ${AppInformation.appName} Wallet'
|
||||
@@ -296,7 +296,7 @@ class WalletCaptain extends StatelessWidget {
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
'$amount\$',
|
||||
'$amount ${'L.E'.tr}',
|
||||
style:
|
||||
const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:SEFER/constant/colors.dart';
|
||||
import 'package:SEFER/constant/style.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: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 {
|
||||
const AvailableRidesPage({super.key});
|
||||
|
||||
@@ -49,9 +60,6 @@ class RideAvailableCard extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// _buildLocationRow('🟢', rideInfo['startName']),
|
||||
// const SizedBox(height: 8),
|
||||
// _buildLocationRow('🔴', rideInfo['endName']),
|
||||
_buildLocationRow('↑', rideInfo['startName'], AppColor.greenColor),
|
||||
const SizedBox(height: 8),
|
||||
_buildLocationRow('↓', rideInfo['endName'], Colors.red),
|
||||
@@ -128,7 +136,127 @@ class RideAvailableCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
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