This commit is contained in:
Hamza-Ayed
2024-02-09 02:56:37 +03:00
parent d4d4592944
commit 8c61a79de3
15 changed files with 397 additions and 71 deletions

View File

@@ -22,6 +22,8 @@ import '../../functions/location_controller.dart';
class MapDriverController extends GetxController {
bool isLoading = true;
final formKey1 = GlobalKey<FormState>();
final sosEmergincyNumberCotroller = TextEditingController();
List data = [];
List dataDestination = [];
LatLngBounds? boundsData;
@@ -478,6 +480,20 @@ class MapDriverController extends GetxController {
polyLines.add(polyline);
// rideConfirm = false;
// Define the northeast and southwest coordinates
final bounds = response["routes"][0]["bounds"];
LatLng northeast =
LatLng(bounds['northeast']['lat'], bounds['northeast']['lng']);
LatLng southwest =
LatLng(bounds['southwest']['lat'], bounds['southwest']['lng']);
// Create the LatLngBounds object
LatLngBounds boundsData =
LatLngBounds(northeast: northeast, southwest: southwest);
// Fit the camera to the bounds
var cameraUpdate = CameraUpdate.newLatLngBounds(boundsData, 130);
mapController!.animateCamera(cameraUpdate);
update();
}
}
@@ -519,6 +535,8 @@ class MapDriverController extends GetxController {
// updateCameraFromBoundsAfterGetMap(dataBounds);
// polyLinesDestination.add(polyline);
// rideConfirm = false;
// Define the northeast and southwest coordinates
update();
}
}

View File

@@ -10,10 +10,29 @@ import 'package:ride/main.dart';
class CaptainWalletController extends GetxController {
bool isLoading = false;
Map walletDate = {};
Map walletDateVisa = {};
Map walletDriverPointsDate = {};
final formKey = GlobalKey<FormState>();
String totalAmount = '0';
String totalAmountVisa = '0';
String totalPoints = '0';
final amountFromBudgetController = TextEditingController();
payFromBudget() async {
if (formKey.currentState!.validate()) {
var pointFromBudget = int.parse((amountFromBudgetController.text)) * 100;
await addDriverPayment('fromBudgetToPoints',
int.parse((amountFromBudgetController.text)) * -1);
Future.delayed(const Duration(seconds: 2));
await addDriverWallet('fromBudget', pointFromBudget.toString());
update();
Get.back();
getCaptainWalletFromRide();
getCaptainWalletFromBuyPoints();
checkAccountCaptainBank();
}
}
Future getCaptainWalletFromRide() async {
isLoading = true;
@@ -26,6 +45,16 @@ class CaptainWalletController extends GetxController {
totalAmount = walletDate['message'][0]['total_amount'].toString() == null
? '0'
: walletDate['message'][0]['total_amount'];
print(totalAmount);
var res1 = await CRUD().get(
link: AppLink.getAllPaymentVisa,
payload: {'driverID': box.read(BoxName.driverID)});
walletDateVisa = jsonDecode(res1);
totalAmountVisa = walletDateVisa['message'][0]['diff'].toString() == null
? '0'
: walletDateVisa['message'][0]['diff'];
print(totalAmountVisa);
isLoading = false;
update();
}
@@ -60,7 +89,7 @@ class CaptainWalletController extends GetxController {
});
var d = jsonDecode(res);
paymentID = d['message'].toString();
// print(paymentID);
print('paymentID $paymentID');
}
Future addDriverWallet(String paymentMethod, point) async {