diff --git a/android/app/build.gradle b/android/app/build.gradle index af884a1..560034d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,8 +55,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 23 targetSdkVersion flutter.targetSdkVersion - versionCode 30 - versionName '1.5.30' + versionCode 32 + versionName '1.5.32' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/android/app/src/main/res/drawable/app_icon.png b/android/app/src/main/res/drawable/app_icon.png index 91a856a..624b71d 100644 Binary files a/android/app/src/main/res/drawable/app_icon.png and b/android/app/src/main/res/drawable/app_icon.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png index 09aaa8b..843b118 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png and b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png index 2601845..7733536 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png and b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png index 2cd6364..239ad3d 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png and b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png index 43412f8..8351f49 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png and b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png index ba8dfea..2c5fd48 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png and b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png differ diff --git a/assets/images/logo.gif b/assets/images/logo.gif index 9f4d92b..2646c02 100644 Binary files a/assets/images/logo.gif and b/assets/images/logo.gif differ diff --git a/assets/images/logo.png b/assets/images/logo.png index 0b6fdcb..900fe16 100644 Binary files a/assets/images/logo.png and b/assets/images/logo.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png index 013aad8..319af06 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png index 1ebae82..467eea3 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/102.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png index 32a4b58..605cd22 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png index dfb7eff..ecc9574 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png index 779fce1..b742152 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png index 34712ee..f2f146a 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/128.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png index e650051..89f097d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png index 68f033c..0749ee9 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png index 2ba5870..ee86a79 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/16.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png index 3b5ac36..bbfe7ac 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png index 161140e..aba3953 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/172.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png index 370656e..4b5fb2f 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png index 149f054..816169d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/196.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png index af849d1..549dc62 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png index f7e456a..0f05c0c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/216.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png index 781df85..4bf3dd7 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/256.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png index 72345f1..070b3f3 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png index 58698d8..4e554cf 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/32.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png index 06331c8..1e3ca89 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png index 5429738..d0ef255 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/48.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png index 31d85e6..70d117d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png index e496920..97f0a4b 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/512.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png index 17d4a60..2af2158 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/55.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png index 4600427..e2b3633 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png index b56af1e..fb5798d 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png index 8e123ce..876575c 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png index 39388cf..b1b7dcb 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/64.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png index 867b153..31eb17f 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/66.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png index 2b59d8f..4b60d66 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png index b8f9102..d77bf4e 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png index 7a8a4de..ca0b355 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png index 35f2966..2120a42 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png index a4e132f..97568ff 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/88.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png index b4a9ce6..0fc5c69 100644 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/92.png differ diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 22ef3bf..1f6e6ab 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -21,7 +21,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 32 + 33 CFBundleSignature ???? CFBundleURLTypes @@ -36,7 +36,7 @@ CFBundleVersion - 4.0.32 + 4.0.33 FirebaseAppDelegateProxyEnabled NO GMSApiKey diff --git a/lib/constant/colors.dart b/lib/constant/colors.dart index 977d1b7..0c99e3a 100644 --- a/lib/constant/colors.dart +++ b/lib/constant/colors.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; class AppColor { static const Color primaryColor = Color(0xFF1DA1F2); - static const Color writeColor = Color(0xFF333333); + static const Color writeColor = Color(0xff222359); static const Color secondaryColor = Colors.white; static const Color accentColor = Colors.grey; static const Color greyColor = Colors.grey; diff --git a/lib/constant/links.dart b/lib/constant/links.dart index 2b4db43..d9bc1e6 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -29,6 +29,7 @@ class AppLink { static String getWalletByDriver = "$walletDriver/getWalletByDriver.php"; static String driverStatistic = "$walletDriver/driverStatistic.php"; + static String getDriverDetails = "$walletDriver/getDriverDetails.php"; static String getDriverWeekPaymentMove = "$walletDriver/getDriverWeekPaymentMove.php"; static String getDriversWallet = "$walletDriver/get.php"; @@ -71,6 +72,8 @@ class AppLink { ////-----------------DriverPayment------------------ static String addDriverpayment = "$ride/payment/add.php"; static String addDriverPaymentPoints = "$ride/driverPayment/add.php"; + static String addPaymentToken = + "$ride/driverWallet/addPaymentToken.php"; //driverWallet/addPaymentToken.php static String getDriverPaymentPoints = "$ride/driverWallet/get.php"; static String getDriverpaymentToday = "$ride/payment/get.php"; static String getCountRide = "$ride/payment/getCountRide.php"; diff --git a/lib/controller/home/captin/map_driver_controller.dart b/lib/controller/home/captin/map_driver_controller.dart index 4e7c115..39f417b 100644 --- a/lib/controller/home/captin/map_driver_controller.dart +++ b/lib/controller/home/captin/map_driver_controller.dart @@ -878,23 +878,9 @@ class MapDriverController extends GetxController { startNameLocation = Get.arguments['startNameLocation']; endNameLocation = Get.arguments['endNameLocation']; - // var coords = passengerLocation.toString().split(','); - // var coordDestination = passengerDestination.toString().split(','); - // Parse to double latlng(passengerLocation, passengerDestination); - // double latPassengerLocation = - // double.parse(passengerLocation.toString().split(',')[0]); - // double lngPassengerLocation = - // double.parse(passengerLocation.toString().split(',')[1]); - // double latPassengerDestination = - // double.parse(passengerDestination.toString().split(',')[0]); - // double lngPassengerDestination = - // double.parse(passengerDestination.toString().split(',')[1]); - // latLngPassengerLocation = - // LatLng(latPassengerLocation, lngPassengerLocation); - // latLngPassengerDestination = - // LatLng(latPassengerDestination, lngPassengerDestination); + String lat = Get.find().myLocation.latitude.toString(); String lng = Get.find().myLocation.longitude.toString(); String origin = '$lat,$lng'; diff --git a/lib/controller/home/captin/order_request_controller.dart b/lib/controller/home/captin/order_request_controller.dart index 6d2182f..567f2cf 100644 --- a/lib/controller/home/captin/order_request_controller.dart +++ b/lib/controller/home/captin/order_request_controller.dart @@ -60,6 +60,7 @@ class OrderRequestController extends GetxController { countRefuse = results[0]['count'].toString(); update(); if (int.parse(countRefuse) > 3) { + box.write(BoxName.statusDriverLocation, 'on'); locationController.stopLocationUpdates(); Get.defaultDialog( // backgroundColor: CupertinoColors.destructiveRed, @@ -73,6 +74,8 @@ class OrderRequestController extends GetxController { confirm: MyElevatedButton( title: 'Ok , See you Tomorrow'.tr, onPressed: () => Get.back())); + } else { + box.write(BoxName.statusDriverLocation, 'off'); } } catch (e) { print('Error executing custom query: $e'); @@ -142,7 +145,7 @@ class OrderRequestController extends GetxController { }); await CRUD().post(link: AppLink.updateRides, payload: { 'id': orderID, - 'rideTimeStart': DateTime.now().toString(), + // 'rideTimeStart': DateTime.now().toString(), 'status': 'Refused', 'driver_id': box.read(BoxName.driverID), }); @@ -154,7 +157,7 @@ class OrderRequestController extends GetxController { 'driver_id': box.read(BoxName.driverID).toString(), }, TableName.driverOrdersRefuse); getRefusedOrderByCaptain(); - box.write(BoxName.statusDriverLocation, 'off'); + update(); Get.back(); // Get.offAll(HomeCaptain()); diff --git a/lib/controller/home/captin/speed_map_controller.dart b/lib/controller/home/captin/speed_map_controller.dart deleted file mode 100644 index b392154..0000000 --- a/lib/controller/home/captin/speed_map_controller.dart +++ /dev/null @@ -1,365 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:google_polyline_algorithm/google_polyline_algorithm.dart'; - -import '../../../constant/api_key.dart'; -import '../../../constant/box_name.dart'; -import '../../../constant/colors.dart'; -import '../../../constant/links.dart'; -import '../../../main.dart'; -import '../../functions/crud.dart'; -import '../../functions/location_controller.dart'; -import 'home_captain_controller.dart'; - -class SpeedMapController extends GetxController { - bool isLoading = true; - final formKey1 = GlobalKey(); - final sosEmergincyNumberCotroller = TextEditingController(); - List data = []; - List dataDestination = []; - LatLngBounds? boundsData; - double mpg = 0; - BitmapDescriptor carIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor passengerIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor startIcon = BitmapDescriptor.defaultMarker; - BitmapDescriptor endIcon = BitmapDescriptor.defaultMarker; - final List polylineCoordinates = []; - final List polylineCoordinatesDestination = []; - List polyLines = []; - List polyLinesDestination = []; - Set markers = {}; - late String passengerLocation; - late String passengerDestination; - late String step0; - late String step1; - late String step2; - late String step3; - late String step4; - late String passengerWalletBurc; - late String timeOfOrder; - late String duration; - late String totalCost; - late String distance; - late String passengerName; - late String passengerEmail; - late String totalPassenger; - late String passengerPhone; - late String rideId; - late String isHaveSteps; - late String paymentAmount; - late String paymentMethod; - late String passengerId; - late String driverId; - late String tokenPassenger; - late String durationToPassenger; - late String walletChecked; - late String direction; - late String carType; - late String kazan; - late String startNameLocation; - late String endNameLocation; - late String durationOfRideValue; - late String status; - String stringRemainingTimeToPassenger = ''; - - String stringRemainingTimeWaitingPassenger = ''; - late Duration durationToAdd; - int hours = 0; - int minutes = 0; - int timeWaitingPassenger = 5; //5 miniute - bool isPassengerInfoWindow = false; - bool isBtnRideBegin = false; - bool isArrivedSend = true; - bool isdriverWaitTimeEnd = false; - bool isRideFinished = false; - bool isRideStarted = false; - bool isPriceWindow = false; - double passengerInfoWindowHeight = Get.height * .38; - double driverEndPage = 100; - double progress = 0; - double progressToPassenger = 0; - double progressInPassengerLocationFromDriver = 0; - bool isRideBegin = false; - int progressTimerToShowPassengerInfoWindowFromDriver = 25; - int remainingTimeToShowPassengerInfoWindowFromDriver = 25; - int remainingTimeToPassenger = 60; - int remainingTimeInPassengerLocatioWait = 60; - bool isDriverNearPassengerStart = false; - GoogleMapController? mapController; - late LatLng myLocation; - int remainingTimeTimerRideBegin = 60; - String stringRemainingTimeRideBegin = ''; - String stringRemainingTimeRideBegin1 = ''; - double progressTimerRideBegin = 0; - late Timer timer; - String? mapAPIKEY; - final zones = []; - String canelString = 'yet'; - late LatLng latLngPassengerLocation; - late LatLng latLngPassengerDestination; - void clearPolyline() { - polyLines = []; - polyLinesDestination = []; - polylineCoordinates.clear(); - polylineCoordinatesDestination.clear(); - update(); - } - - argumentLoading() async { - passengerLocation = box.read(BoxName.rideArguments)['passengerLocation']; - print(passengerLocation); - passengerDestination = - box.read(BoxName.rideArguments)['passengerDestination']; - print(passengerDestination); - duration = box.read(BoxName.rideArguments)['Duration']; - totalCost = box.read(BoxName.rideArguments)['totalCost']; - passengerId = box.read(BoxName.rideArguments)['passengerId']; - driverId = box.read(BoxName.rideArguments)['driverId']; - distance = box.read(BoxName.rideArguments)['Distance']; - passengerName = box.read(BoxName.rideArguments)['name']; - passengerEmail = box.read(BoxName.rideArguments)['email']; - totalPassenger = box.read(BoxName.rideArguments)['totalPassenger']; - passengerPhone = box.read(BoxName.rideArguments)['phone']; - walletChecked = box.read(BoxName.rideArguments)['WalletChecked']; - tokenPassenger = box.read(BoxName.rideArguments)['tokenPassenger']; - direction = box.read(BoxName.rideArguments)['direction']; - durationToPassenger = - box.read(BoxName.rideArguments)['DurationToPassenger'].toString(); - print(durationToPassenger); - rideId = box.read(BoxName.rideArguments)['rideId']; - durationOfRideValue = - box.read(BoxName.rideArguments)['durationOfRideValue']; - paymentAmount = box.read(BoxName.rideArguments)['paymentAmount']; - paymentMethod = box.read(BoxName.rideArguments)['paymentMethod']; - isHaveSteps = box.read(BoxName.rideArguments)['isHaveSteps']; - step0 = box.read(BoxName.rideArguments)['step0']; - step1 = box.read(BoxName.rideArguments)['step1']; - step2 = box.read(BoxName.rideArguments)['step2']; - step3 = box.read(BoxName.rideArguments)['step3']; - step4 = box.read(BoxName.rideArguments)['step4']; - passengerWalletBurc = - box.read(BoxName.rideArguments)['passengerWalletBurc']; - timeOfOrder = box.read(BoxName.rideArguments)['timeOfOrder']; - carType = box.read(BoxName.rideArguments)['carType']; - kazan = box.read(BoxName.rideArguments)['kazan']; - startNameLocation = box.read(BoxName.rideArguments)['startNameLocation']; - endNameLocation = box.read(BoxName.rideArguments)['endNameLocation']; - - // var coords = passengerLocation.toString().split(','); - // var coordDestination = passengerDestination.toString().split(','); - -// Parse to double - latlng(passengerLocation, passengerDestination); - String lat = Get.find().myLocation.latitude.toString(); - String lng = Get.find().myLocation.longitude.toString(); - String origin = '$lat,$lng'; - print('latLngpassengerLocation $latLngPassengerLocation'); - print('latLngPassengerDestination $latLngPassengerDestination'); - // Set the origin and destination coordinates for the Google Maps directions request. - Future.delayed(const Duration(seconds: 1)); - getMap(origin, passengerLocation); - isHaveSteps == 'haveSteps' - ? ( - await getMapDestination(step0, step1), - await getMapDestination(step1, step2), - step3 == '' ? await getMapDestination(step2, step3) : () {}, - step4 == '' ? await getMapDestination(step3, step4) : () {}, - ) - : await getMapDestination(passengerLocation, passengerDestination); - update(); - } - - latlng(String passengerLocation, passengerDestination) { - double latPassengerLocation = - double.parse(passengerLocation.toString().split(',')[0]); - print('latPassengerLocation $latPassengerLocation'); - double lngPassengerLocation = - double.parse(passengerLocation.toString().split(',')[1]); - double latPassengerDestination = - double.parse(passengerDestination.toString().split(',')[0]); - double lngPassengerDestination = - double.parse(passengerDestination.toString().split(',')[1]); - latLngPassengerLocation = - LatLng(latPassengerLocation, lngPassengerLocation); - latLngPassengerDestination = - LatLng(latPassengerDestination, lngPassengerDestination); - } - - double distanceBetweenDriverAndPassengerWhenConfirm = 0; - getMap(String origin, destination) async { - isLoading = false; - - update(); - - var url = - ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}'); - - var response = await CRUD().getGoogleApi(link: url, payload: {}); - data = response['routes'][0]['legs']; - print(data); - distanceBetweenDriverAndPassengerWhenConfirm = - (data[0]['distance']['value']) / 1000; - final points = - decodePolyline(response["routes"][0]["overview_polyline"]["points"]); - for (int i = 0; i < points.length; i++) { - double lat = points[i][0].toDouble(); - double lng = points[i][1].toDouble(); - polylineCoordinates.add(LatLng(lat, lng)); - } - if (polyLines.isNotEmpty) { - clearPolyline(); - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinates, - width: 10, - color: AppColor.blueColor, - ); - polyLines.add(polyline); - // rideConfirm = false; - update(); - } else { - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinates, - width: 10, - color: AppColor.blueColor, - ); - // final dataBounds = response["routes"][0]["bounds"]; - - // updateCameraFromBoundsAfterGetMap(dataBounds); - -// Fit the camera to the bounds - - 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, 140); - mapController!.animateCamera(cameraUpdate); - update(); - } - } - - getMapDestination(String origin, destination) async { - var url = - ('${AppLink.googleMapsLink}directions/json?&language=${box.read(BoxName.lang)}&avoid=tolls|ferries&destination=$destination&origin=$origin&key=${AK.mapAPIKEY}'); - - var response = await CRUD().getGoogleApi(link: url, payload: {}); - dataDestination = response['routes'][0]['legs']; - // print(data); - final points = - decodePolyline(response["routes"][0]["overview_polyline"]["points"]); - for (int i = 0; i < points.length; i++) { - double lat = points[i][0].toDouble(); - double lng = points[i][1].toDouble(); - polylineCoordinatesDestination.add(LatLng(lat, lng)); - } - if (polyLinesDestination.isNotEmpty) { - // clearPolyline(); - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinatesDestination, - width: 10, - color: AppColor.redColor, - ); - polyLinesDestination.add(polyline); - // rideConfirm = false; - update(); - } else { - var polyline = Polyline( - polylineId: PolylineId(response["routes"][0]["summary"]), - points: polylineCoordinatesDestination, - width: 10, - color: AppColor.redColor, - ); - // final dataBounds = response["routes"][0]["bounds"]; - - // updateCameraFromBoundsAfterGetMap(dataBounds); - // polyLinesDestination.add(polyline); - // rideConfirm = false; - // Define the northeast and southwest coordinates - - update(); - } - } - - void startTimerToShowPassengerInfoWindowFromDriver() async { - isPassengerInfoWindow = true; - for (int i = 0; i <= int.parse(durationToPassenger); i++) { - await Future.delayed(const Duration(seconds: 1)); - progressToPassenger = i / int.parse(durationToPassenger); - remainingTimeToPassenger = int.parse(durationToPassenger) - i; - if (remainingTimeToPassenger == 0) { - isBtnRideBegin = true; - print(isBtnRideBegin); - update(); - } - print(isBtnRideBegin); - print(remainingTimeToPassenger); - - int minutes = (remainingTimeToPassenger / 60).floor(); - int seconds = remainingTimeToPassenger % 60; - stringRemainingTimeToPassenger = - '$minutes:${seconds.toString().padLeft(2, '0')}'; - - update(); - } - // update(); - // startTimerToShowDriverToPassengerDuration(); - } - - void onMapCreated(GoogleMapController controller) async { - myLocation = Get.find().location as LatLng; - myLocation = myLocation; - mapController = controller; - controller.getVisibleRegion(); - controller.animateCamera( - CameraUpdate.newLatLng(Get.find().myLocation), - ); - update(); - // Set up a timer or interval to trigger the marker update every 3 seconds. - timer = Timer.periodic(const Duration(seconds: 1), (_) { - // updateMarker(); - }); - } - - @override - void onInit() async { - mapAPIKEY = await storage.read(key: BoxName.mapAPIKEY); - // Get the passenger location from the arguments. - await argumentLoading(); - // addCustomCarIcon(); - // addCustomPassengerIcon(); - // addCustomStartIcon(); - // addCustomEndIcon(); - // updateMarker(); - // updateLocation(); - startTimerToShowPassengerInfoWindowFromDriver(); - durationToAdd = Duration(seconds: int.parse(duration)); - hours = durationToAdd.inHours; - minutes = (durationToAdd.inMinutes % 60).round(); - calculateConsumptionFuel(); - // cancelCheckRidefromPassenger(); - // checkIsDriverNearPassenger(); - super.onInit(); - } - - calculateConsumptionFuel() { - mpg = Get.find().fuelPrice / - 12; //todo in register car add mpg in box - update(); - } -} diff --git a/lib/controller/home/payment/captain_wallet_controller.dart b/lib/controller/home/payment/captain_wallet_controller.dart index 9a77e45..9deca93 100644 --- a/lib/controller/home/payment/captain_wallet_controller.dart +++ b/lib/controller/home/payment/captain_wallet_controller.dart @@ -1,5 +1,7 @@ import 'dart:convert'; +import 'package:SEFER/constant/colors.dart'; +import 'package:SEFER/controller/firebase/firbase_messge.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/box_name.dart'; @@ -9,6 +11,7 @@ import 'package:SEFER/main.dart'; class CaptainWalletController extends GetxController { bool isLoading = false; + final formKeyTransfer = GlobalKey(); Map walletDate = {}; Map walletDateVisa = {}; Map walletDriverPointsDate = {}; @@ -17,7 +20,8 @@ class CaptainWalletController extends GetxController { String totalAmountVisa = '0'; String totalPoints = '0'; final amountFromBudgetController = TextEditingController(); - final issurWallet = TextEditingController(); + final newDriverPhoneController = TextEditingController(); + final phoneWallet = TextEditingController(); payFromBudget() async { if (formKey.currentState!.validate()) { @@ -37,6 +41,46 @@ class CaptainWalletController extends GetxController { } } + List amountToNewDriverMap = []; + bool isNewTransfer = false; + Future detectNewDriverFromMyBudget() async { + if (formKeyTransfer.currentState!.validate()) { + if (int.parse(amountFromBudgetController.text) < + double.parse(totalAmountVisa) && + int.parse(amountFromBudgetController.text) > 10) { + //get new driver details + isNewTransfer = true; + update(); + var res = await CRUD().get( + link: AppLink.getDriverDetails, + payload: {'driver_phone': '+2${newDriverPhoneController.text}'}); + isNewTransfer = false; + update(); + if (res != 'failure') { + var d = jsonDecode(res); + amountToNewDriverMap = d['data']; + // update(); + } else { + Get.snackbar( + "This driver is not registered".tr, + '', + duration: const Duration(seconds: 3), + backgroundColor: AppColor.redColor, + snackPosition: SnackPosition.BOTTOM, + ); + } + } else { + Get.snackbar( + 'Your Budget less than needed'.tr, + '', + duration: const Duration(seconds: 3), + backgroundColor: AppColor.redColor, + snackPosition: SnackPosition.BOTTOM, + ); + } + } + } + Future getCaptainWalletFromRide() async { isLoading = true; update(); @@ -79,8 +123,20 @@ class CaptainWalletController extends GetxController { update(); } + String paymentToken = ''; + Future generateToken(String amount) async { + var res = await CRUD().post(link: AppLink.addPaymentToken, payload: { + 'driverID': box.read(BoxName.driverID).toString(), + 'amount': amount.toString(), + }); + var d = jsonDecode(res); + print('paymentToken ${d['message']}'); + return d['message']; + } + late String paymentID; - Future addDriverPayment(String paymentMethod, amount) async { + Future addDriverPayment(String paymentMethod, amount) async { + // paymentToken = await generateToken(amount); var res = await CRUD().post(link: AppLink.addDriverPaymentPoints, payload: { 'driverID': box.read(BoxName.driverID).toString(), 'amount': amount.toString(), @@ -89,17 +145,53 @@ class CaptainWalletController extends GetxController { var d = jsonDecode(res); paymentID = d['message'].toString(); print('paymentID $paymentID'); + return paymentID; } Future addDriverWallet(String paymentMethod, point) async { + paymentToken = await generateToken(point); await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { 'driverID': box.read(BoxName.driverID).toString(), 'paymentID': paymentID.toString(), 'amount': point, + 'token': paymentToken, 'paymentMethod': paymentMethod.toString(), }); } + Future addtransferDriversWallet(String paymentMethod) async { + paymentID = + await addDriverPayment(paymentMethod, amountFromBudgetController.text); + paymentToken = await generateToken(amountFromBudgetController.text); + await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { + 'driverID': box.read(BoxName.driverID).toString(), + 'paymentID': paymentID.toString(), + 'amount': (int.parse(amountFromBudgetController.text) * -1).toString(), + 'token': paymentToken, + 'paymentMethod': paymentMethod.toString(), + }); + paymentID = + await addDriverPayment(paymentMethod, amountFromBudgetController.text); + paymentToken = await generateToken(amountFromBudgetController.text); + var res1 = + await CRUD().post(link: AppLink.addDriversWalletPoints, payload: { + 'driverID': amountToNewDriverMap[0]['id'].toString(), + 'paymentID': paymentID.toString(), + 'amount': (int.parse(amountFromBudgetController.text) - 5).toString(), + 'token': paymentToken, + 'paymentMethod': paymentMethod.toString(), + }); + if (res1 != 'failure') { + FirebaseMessagesController().sendNotificationToDriverMAP( + 'Transfer', + '${'You have transfer to your wallet from'.tr}' + '${box.read(BoxName.nameDriver)}', + amountToNewDriverMap[0]['token'].toString(), + [], + ); + } + } + //check if account bank is created or not Future checkAccountCaptainBank() async { isLoading = false; diff --git a/lib/controller/home/payment/paymob_payout.dart b/lib/controller/home/payment/paymob_payout.dart index d8f6671..ba8f182 100644 --- a/lib/controller/home/payment/paymob_payout.dart +++ b/lib/controller/home/payment/paymob_payout.dart @@ -12,6 +12,7 @@ import 'captain_wallet_controller.dart'; class PaymobPayout extends GetxController { bool isLoading = false; + String dropdownValue = 'etisalat'; Future getToken() async { var headers = { @@ -53,6 +54,7 @@ class PaymobPayout extends GetxController { "issuer": issuer, //"vodafone", "msisdn": msisdn, // "01023456789" }); + print(body); var res = await http.post( Uri.parse( 'https://stagingpayouts.paymobsolutions.com/api/secure/disburse/'), @@ -65,7 +67,7 @@ class PaymobPayout extends GetxController { if (dec['disbursement_status'] == 'successful') { await CRUD().post(link: AppLink.addDriverpayment, payload: { 'rideId': DateTime.now().toIso8601String(), - 'amount': ((-1) * double.parse(dec['amount'])).toStringAsFixed(0), + 'amount': ((-1) * (double.parse(dec['amount'])) + 5).toStringAsFixed(0), 'payment_method': 'payout', 'passengerID': 'myself', 'driverID': box.read(BoxName.driverID).toString(), @@ -75,7 +77,7 @@ class PaymobPayout extends GetxController { backgroundColor: AppColor.greenColor); Get.find().getCaptainWalletFromRide(); } else if (dec['disbursement_status'] == 'failed') { - Get.snackbar('Transaction successful'.tr, 'Transaction failed'.tr, + Get.snackbar('Transaction failed'.tr, 'Transaction failed'.tr, backgroundColor: AppColor.redColor); } } @@ -89,7 +91,8 @@ class PaymobPayout extends GetxController { var body = { "issuer": "bank_card", "amount": amount, //9.0, - "full_name": box.read(BoxName.nameDriver).toString(), + "full_name": + '${box.read(BoxName.nameDriver)} ${box.read(BoxName.lastNameDriver)}', "bank_card_number": bankCardNumber, //"1111-2222-3333-4444", "bank_code": bankCode, //"CIB", "bank_transaction_type": "cash_transfer" diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index c824409..975ed63 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,6 +4,13 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + "You have transferred to your wallet from": "لقد حولت إلى محفظتك من", + 'Transfer': "تحويل", + "amount": "المبلغ", + "This driver is not registered": "هذا السائق غير مسجل", + 'insert amount': "أدخل المبلغ", + "phone number of driver": "رقم هاتف السائق", + "Transfer budget": "نقل الميزانية", "Special Order": "طلب خاص", "Speed Order": "طلب سريع", "No data yet!": "لا توجد بيانات حتى الآن!", @@ -18,7 +25,7 @@ class MyTranslation extends Translations { "Enter your wallet number": "أدخل رقم محفظتك", "The Amount is less than": "المبلغ أقل من", "Cash Out": "صرف", - "Transaction successful": "تمت العملية بنجاح", + "Do you want to collect your earnings?": "هل تريد استلام أموالك؟", // Corrected grammar "Total wallet is ": "إجمالي المحفظة هو ", diff --git a/lib/views/home/Captin/driver_map_speed.dart b/lib/views/home/Captin/driver_map_speed.dart deleted file mode 100644 index c4f3ac8..0000000 --- a/lib/views/home/Captin/driver_map_speed.dart +++ /dev/null @@ -1,92 +0,0 @@ -import 'package:SEFER/constant/style.dart'; -import 'package:SEFER/controller/home/captin/speed_map_controller.dart'; -import 'package:SEFER/views/home/Captin/mapDriverWidgets/speed_google_map.dart'; -import 'package:SEFER/views/widgets/elevated_btn.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:SEFER/controller/home/captin/map_driver_controller.dart'; -import 'package:SEFER/views/widgets/my_scafold.dart'; - -import '../../../controller/functions/location_controller.dart'; -import '../../Rate/rate_passenger.dart'; -import 'mapDriverWidgets/driver_end_ride_bar.dart'; -import 'mapDriverWidgets/google_driver_map_page.dart'; -import 'mapDriverWidgets/google_map_app.dart'; -import 'mapDriverWidgets/passenger_info_window.dart'; -import 'mapDriverWidgets/sos_connect.dart'; - -class DriverSpeedLocationMapPage extends StatelessWidget { - DriverSpeedLocationMapPage({super.key}); - final LocationController locationController = Get.put(LocationController()); - // final MapDriverController mapDriverController = - // Get.put(MapDriverController()); - @override - Widget build(BuildContext context) { - Get.put(SpeedMapController()) - .startTimerToShowPassengerInfoWindowFromDriver(); - Get.find().argumentLoading(); - Get.put(MapDriverController()); - - return MyScafolld( - title: 'Map Passenger'.tr, - body: [ - SpeedGoogleDriverMap(locationController: locationController), - const PassengerInfoWindow(), - driverEndRideBar(), - const SosConnect(), - speedCircle(), - const GoogleMapApp(), - const PricesWindow(), - ], - isleading: false); - } -} - -class PricesWindow extends StatelessWidget { - const PricesWindow({ - super.key, - }); - - @override - Widget build(BuildContext context) { - return GetBuilder(builder: (mapDriverController) { - return mapDriverController.isPriceWindow - ? Positioned( - bottom: Get.height * 1.2, - // top: Get.height * 3, - left: Get.height * 1, - right: Get.height * 1, - child: Container( - height: Get.height * 3, - decoration: AppStyle.boxDecoration1, - child: Column( - children: [ - Container( - decoration: AppStyle.boxDecoration1, - child: Padding( - padding: const EdgeInsets.all(3), - child: Text( - 'Total Price is '.tr, - style: AppStyle.headTitle2, - textAlign: TextAlign.center, - ), - )), - const SizedBox( - height: 20, - ), - MyElevatedButton( - title: 'ok'.tr, - onPressed: () => - Get.to(() => RatePassenger(), arguments: { - 'rideId': mapDriverController.rideId, - 'passengerId': mapDriverController.passengerId, - 'driverId': mapDriverController.driverId - })) - ], - ), - ), - ) - : const SizedBox(); - }); - } -} diff --git a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart index 937f397..9a9e4b8 100644 --- a/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart +++ b/lib/views/home/Captin/home_captain/widget/left_menu_map_captain.dart @@ -1,7 +1,6 @@ import 'package:SEFER/constant/box_name.dart'; import 'package:SEFER/main.dart'; import 'package:SEFER/views/home/Captin/driver_map_page.dart'; -import 'package:SEFER/views/home/Captin/driver_map_speed.dart'; import 'package:flutter/material.dart'; import 'package:flutter_font_icons/flutter_font_icons.dart'; import 'package:get/get.dart'; @@ -157,27 +156,24 @@ GetBuilder leftMainMenuCaptainIcons() { ), ), ), - AnimatedContainer( - duration: const Duration(microseconds: 200), - width: controller.widthMapTypeAndTraffic, - decoration: BoxDecoration( - color: AppColor.secondaryColor, - border: Border.all(color: AppColor.blueColor), - borderRadius: BorderRadius.circular(15)), - child: IconButton( - onPressed: () { - // Get.to(() => PassengerLocationMapPage(), - // arguments: box.read(BoxName.rideArguments)); - Get.to(() => DriverSpeedLocationMapPage()); - // print(box.read(BoxName.rideArguments)['Duration']); - }, - icon: const Icon( - FontAwesome5.grin_tears, - size: 29, - color: AppColor.blueColor, - ), - ), - ), + // AnimatedContainer( + // duration: const Duration(microseconds: 200), + // width: controller.widthMapTypeAndTraffic, + // decoration: BoxDecoration( + // color: AppColor.secondaryColor, + // border: Border.all(color: AppColor.blueColor), + // borderRadius: BorderRadius.circular(15)), + // child: IconButton( + // onPressed: () { + + // }, + // icon: const Icon( + // FontAwesome5.grin_tears, + // size: 29, + // color: AppColor.blueColor, + // ), + // ), + // ), ], )), ); diff --git a/lib/views/home/Captin/mapDriverWidgets/speed_google_map.dart b/lib/views/home/Captin/mapDriverWidgets/speed_google_map.dart deleted file mode 100644 index 5fd3c8b..0000000 --- a/lib/views/home/Captin/mapDriverWidgets/speed_google_map.dart +++ /dev/null @@ -1,97 +0,0 @@ -import 'package:SEFER/controller/home/captin/speed_map_controller.dart'; -import 'package:flutter/material.dart'; -import 'package:get/get.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; - -import '../../../../constant/colors.dart'; -import '../../../../controller/functions/location_controller.dart'; - -class SpeedGoogleDriverMap extends StatelessWidget { - const SpeedGoogleDriverMap({ - super.key, - required this.locationController, - }); - - final LocationController locationController; - - @override - Widget build(BuildContext context) { - Get.put(SpeedMapController()); - return Padding( - padding: const EdgeInsets.all(8.0), - child: GetBuilder( - builder: (controller) => GoogleMap( - onMapCreated: controller.onMapCreated, - initialCameraPosition: CameraPosition( - // bearing: 45, - target: locationController.myLocation, - zoom: 16, - tilt: 40, - ), - onCameraMoveStarted: () {}, - onCameraMove: (position) { - locationController.myLocation = position.target; - controller.mapController! - .animateCamera(CameraUpdate.newCameraPosition(position)); - }, - minMaxZoomPreference: const MinMaxZoomPreference(6, 18), - myLocationEnabled: true, - compassEnabled: true, - mapType: MapType.normal, - trafficEnabled: true, - buildingsEnabled: true, - mapToolbarEnabled: true, - zoomControlsEnabled: true, - fortyFiveDegreeImageryEnabled: true, - zoomGesturesEnabled: true, - polylines: { - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route1'), - points: controller.polylineCoordinates, - color: AppColor.yellowColor, - width: 4, - ), - Polyline( - zIndex: 2, - consumeTapEvents: true, - geodesic: true, - endCap: Cap.buttCap, - startCap: Cap.buttCap, - visible: true, - polylineId: const PolylineId('route'), - points: controller.polylineCoordinatesDestination, - color: AppColor.primaryColor, - width: 4, - ), - }, - markers: { - Marker( - markerId: MarkerId('MyLocation'.tr), - position: locationController.myLocation, - draggable: true, - icon: controller.carIcon, - rotation: locationController.heading), - Marker( - markerId: MarkerId('start'.tr), - position: controller.latLngPassengerLocation, - draggable: true, - icon: controller.startIcon, - ), - Marker( - markerId: MarkerId('end'.tr), - position: controller.latLngPassengerDestination, - draggable: true, - icon: controller.endIcon, - ), - }, - ), - ), - ); - } -} diff --git a/lib/views/home/Captin/orderCaptin/order_speed_request.dart b/lib/views/home/Captin/orderCaptin/order_speed_request.dart index aae67c5..7f4c002 100644 --- a/lib/views/home/Captin/orderCaptin/order_speed_request.dart +++ b/lib/views/home/Captin/orderCaptin/order_speed_request.dart @@ -2,7 +2,6 @@ import 'dart:convert'; import 'package:SEFER/controller/functions/tts.dart'; import 'package:SEFER/controller/home/captin/home_captain_controller.dart'; -import 'package:SEFER/views/home/Captin/driver_map_speed.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/constant/box_name.dart'; diff --git a/lib/views/home/my_wallet/card_wallet_widget.dart b/lib/views/home/my_wallet/card_wallet_widget.dart index 4c4f4aa..9d67f3e 100644 --- a/lib/views/home/my_wallet/card_wallet_widget.dart +++ b/lib/views/home/my_wallet/card_wallet_widget.dart @@ -29,118 +29,123 @@ class CardSeferWalletDriver extends StatelessWidget { DateTime? lastRequestTime = box.read(BoxName.lastTimeCaptainWalletCashOut); - if (lastRequestTime == null || - now.difference(lastRequestTime).inHours >= 24) { - // Update the last request time to now - lastRequestTime = now; - await box.write( - BoxName.lastTimeCaptainWalletCashOut, lastRequestTime); - box.write(BoxName.cvvCode, 1111); - if (double.parse( - Get.find().totalAmountVisa) > - 100) { - Get.defaultDialog( - barrierDismissible: false, - title: 'Do you want to collect your earnings?'.tr, - titleStyle: AppStyle.title, - content: Column( - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Total wallet is '.tr, - style: AppStyle.title, - ), - const SizedBox( - width: 5, - ), - Text( - Get.find() - .totalAmountVisa, - style: AppStyle.number, - ), - ], - ), - const SizedBox( - height: 5, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'Wallet Type'.tr, - style: AppStyle.title, - ), - const SizedBox( - width: 5, - ), - MyDropDown(), - ], - ), - Form( - key: captainWalletController.formKey, - child: MyTextForm( - controller: captainWalletController.issurWallet, - label: "Enter your wallet number".tr, - hint: "Enter your wallet number".tr, - type: TextInputType.phone, + // if (lastRequestTime == null || + // now.difference(lastRequestTime).inHours >= 24) { + // // Update the last request time to now + // lastRequestTime = now; + // await box.write( + // BoxName.lastTimeCaptainWalletCashOut, lastRequestTime); + // box.write(BoxName.cvvCode, 1111); + if (double.parse( + Get.find().totalAmountVisa) > + 100) { + Get.defaultDialog( + barrierDismissible: false, + title: 'Do you want to collect your earnings?'.tr, + titleStyle: AppStyle.title, + content: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Total wallet is '.tr, + style: AppStyle.title, ), - ) - ], - ), - confirm: MyElevatedButton( - title: 'Ok'.tr, - onPressed: () async { - if (captainWalletController.formKey.currentState! - .validate()) { - if (double.parse(Get.find() - .totalAmountVisa) > - 100) { - Get.back(); - String amountAfter5LE = (double.parse( - Get.find() - .totalAmountVisa) - - 5) - .toStringAsFixed(0); - await Get.put(PaymobPayout()) - .payToWalletDriverAll( - amountAfter5LE, - captainWalletController.issurWallet.toString(), - captainWalletController.issurWallet.toString(), - ); - } else { - Get.snackbar( - '${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '100' : '20'}', - '', - backgroundColor: AppColor.yellowColor); - } + const SizedBox( + width: 5, + ), + Text( + Get.find() + .totalAmountVisa, + style: AppStyle.number, + ), + ], + ), + const SizedBox( + height: 5, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Wallet Type'.tr, + style: AppStyle.title, + ), + const SizedBox( + width: 5, + ), + MyDropDown1(), + ], + ), + Form( + key: captainWalletController.formKey, + child: MyTextForm( + controller: captainWalletController.phoneWallet, + label: "Enter your wallet number".tr, + hint: "Enter your wallet number".tr, + type: TextInputType.phone, + ), + ) + ], + ), + confirm: MyElevatedButton( + title: 'Ok'.tr, + onPressed: () async { + if (captainWalletController.formKey.currentState! + .validate()) { + if (double.parse(Get.find() + .totalAmountVisa) > + 100) { + Get.back(); + String amountAfter5LE = (double.parse( + Get.find() + .totalAmountVisa) - + 5) + .toStringAsFixed(0); + print(Get.find() + .dropdownValue + .toString()); + print(captainWalletController.phoneWallet.text + .toString()); + await Get.put(PaymobPayout()).payToWalletDriverAll( + amountAfter5LE, + Get.find().dropdownValue.toString(), + captainWalletController.phoneWallet.text + .toString(), + ); + } else { + Get.snackbar( + '${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '100' : '20'}', + '', + backgroundColor: AppColor.yellowColor); } - }, - kolor: AppColor.greenColor, - ), - cancel: MyElevatedButton( - title: 'cancel'.tr, - onPressed: () { - Get.back(); - }, - kolor: AppColor.redColor, - )); - } else { - { - Get.snackbar( - '${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '100' : '20'}', - '', - backgroundColor: AppColor.yellowColor); - } - } + } + }, + kolor: AppColor.greenColor, + ), + cancel: MyElevatedButton( + title: 'cancel'.tr, + onPressed: () { + Get.back(); + }, + kolor: AppColor.redColor, + )); } else { - // Optionally show a message or handle the throttling case - final hoursLeft = 24 - now.difference(lastRequestTime).inHours; - Get.snackbar( - '${'Please wait'.tr} $hoursLeft ${"hours before trying again.".tr}', - ''); + { + Get.snackbar( + '${'The Amount is less than'.tr}${box.read(BoxName.countryCode) == 'Egypt' ? '100' : '20'}', + '', + backgroundColor: AppColor.yellowColor); + } } + // } else { + // // Optionally show a message or handle the throttling case + // final hoursLeft = 24 - now.difference(lastRequestTime).inHours; + // Get.snackbar( + // '${'Please wait'.tr} $hoursLeft ${"hours before trying again.".tr}', + // ''); + // } }, child: Container( width: Get.width * .85, diff --git a/lib/views/home/my_wallet/transfer_budget_page.dart b/lib/views/home/my_wallet/transfer_budget_page.dart new file mode 100644 index 0000000..c90305f --- /dev/null +++ b/lib/views/home/my_wallet/transfer_budget_page.dart @@ -0,0 +1,128 @@ +import 'package:SEFER/constant/links.dart'; +import 'package:SEFER/constant/style.dart'; +import 'package:SEFER/controller/functions/crud.dart'; +import 'package:SEFER/views/widgets/elevated_btn.dart'; +import 'package:SEFER/views/widgets/my_scafold.dart'; +import 'package:SEFER/views/widgets/my_textField.dart'; +import 'package:SEFER/views/widgets/mycircular.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +import '../../../constant/colors.dart'; +import '../../../controller/home/payment/captain_wallet_controller.dart'; + +class TransferBudgetPage extends StatelessWidget { + const TransferBudgetPage({super.key}); + + @override + Widget build(BuildContext context) { + Get.put(CaptainWalletController()); + return MyScafolld( + title: "Transfer budget".tr, + body: [ + GetBuilder( + builder: (captainWalletController) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + decoration: AppStyle.boxDecoration1, + height: Get.height * .7, + width: double.infinity, + child: Form( + key: captainWalletController.formKeyTransfer, + child: Column( + children: [ + const SizedBox( + height: 20, + ), + MyTextForm( + controller: captainWalletController + .newDriverPhoneController, + label: 'phone number of driver'.tr, + hint: 'phone number of driver', + type: TextInputType.phone), + MyTextForm( + controller: captainWalletController + .amountFromBudgetController, + label: 'insert amount'.tr, + hint: + '${'You have in account'.tr} ${captainWalletController.totalAmountVisa}', + type: TextInputType.number), + captainWalletController.isNewTransfer + ? const MyCircularProgressIndicator() + : captainWalletController + .amountToNewDriverMap.isEmpty + ? MyElevatedButton( + title: 'Next'.tr, + onPressed: () async { + await captainWalletController + .detectNewDriverFromMyBudget(); + }) + : const SizedBox(), + captainWalletController.amountToNewDriverMap.isNotEmpty + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + children: [ + Container( + width: double.maxFinite, + decoration: AppStyle.boxDecoration1, + child: Text( + 'Name :'.tr + + captainWalletController + .amountToNewDriverMap[0]['name'] + .toString(), + textAlign: TextAlign.center, + style: AppStyle.title, + ), + ), + const SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + decoration: AppStyle.boxDecoration1, + child: Text( + "${"NationalID".tr} ${captainWalletController.amountToNewDriverMap[0]['national_number']}", + style: AppStyle.title, + textAlign: TextAlign.center, + ), + ), + const SizedBox( + height: 5, + ), + Container( + width: double.maxFinite, + decoration: AppStyle.boxDecoration1, + child: Text( + "${"amount".tr} ${captainWalletController.amountFromBudgetController.text} ${'LE'.tr}", + style: AppStyle.title, + textAlign: TextAlign.center, + ), + ), + const SizedBox( + height: 15, + ), + captainWalletController + .amountToNewDriverMap.isNotEmpty + ? MyElevatedButton( + title: 'Transfer'.tr, + onPressed: () async { + await captainWalletController + .addtransferDriversWallet( + 'Transfer'); + }) + : const SizedBox() + ], + ), + ) + : const SizedBox() + ], + )), + ), + ); + }), + ], + isleading: true); + } +} diff --git a/lib/views/home/my_wallet/walet_captain.dart b/lib/views/home/my_wallet/walet_captain.dart index 3dca79a..311afae 100644 --- a/lib/views/home/my_wallet/walet_captain.dart +++ b/lib/views/home/my_wallet/walet_captain.dart @@ -20,6 +20,7 @@ import '../../../controller/payment/driver_payment_controller.dart'; import '../../widgets/my_scafold.dart'; import 'card_wallet_widget.dart'; import 'points_captain.dart'; +import 'transfer_budget_page.dart'; import 'weekly_payment_page.dart'; class WalletCaptain extends StatelessWidget { @@ -254,6 +255,11 @@ class WalletCaptain extends StatelessWidget { })); }, ), + MyElevatedButton( + title: 'Transfer budget'.tr, + onPressed: () { + Get.to(() => const TransferBudgetPage()); + }) ], ), ), @@ -370,6 +376,7 @@ class WalletCaptain extends StatelessWidget { : const SizedBox( height: 30, ), + Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Row( @@ -425,37 +432,32 @@ class WalletCaptain extends StatelessWidget { } } -class MyDropDown extends StatefulWidget { - @override - _MyDropDownState createState() => _MyDropDownState(); -} - -class _MyDropDownState extends State { - String dropdownValue = 'Itsalate'; - +class MyDropDown1 extends StatelessWidget { @override Widget build(BuildContext context) { - return DropdownButton( - value: dropdownValue, - icon: const Icon(Icons.arrow_drop_down), - elevation: 16, - style: const TextStyle(color: Colors.deepPurple), - underline: Container( - height: 2, - color: Colors.deepPurpleAccent, - ), - onChanged: (String? newValue) { - setState(() { - dropdownValue = newValue!; - }); - }, - items: ['Itsalate', 'We', 'Orange', 'Vodafone'] - .map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ); + Get.put(PaymobPayout()); + return GetBuilder(builder: (controller) { + return DropdownButton( + value: controller.dropdownValue, + icon: const Icon(Icons.arrow_drop_down), + elevation: 16, + style: const TextStyle(color: Colors.deepPurple), + underline: Container( + height: 2, + color: Colors.deepPurpleAccent, + ), + onChanged: (String? newValue) { + controller.dropdownValue = newValue!; + controller.update(); + }, + items: ['etisalat', 'aman', 'orange', 'vodafone'] + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ); + }); } }