10/14/1
This commit is contained in:
@@ -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