This commit is contained in:
Hamza-Ayed
2024-06-22 13:12:35 +03:00
parent 1cc0156cfd
commit 3c5321f70b
67 changed files with 91 additions and 740 deletions

View File

@@ -40,12 +40,10 @@ class DurationController extends GetxController {
payload: {'driverID': box.read(BoxName.driverID)});
if (res == 'failure') {
monthlyList = [];
print('monthlyList $monthlyList');
isLoading = false;
update();
} else {
monthlyList = jsonDecode(res)['message'];
print(monthlyList);
isLoading = false;
update();
}
@@ -62,7 +60,6 @@ class DurationController extends GetxController {
jsonData1 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideData = jsonData.map<MonthlyDataModel>((item) {
return MonthlyDataModel.fromJson(item);
@@ -90,7 +87,6 @@ class DurationController extends GetxController {
jsonData2 = jsonDecode(res);
var jsonResponse = jsonDecode(res) as Map<String, dynamic>;
isLoading = false;
// print(jsonResponse);
final List<dynamic> jsonData = jsonResponse['message'];
rideCountData = jsonData.map<MonthlyRideModel>((item) {
return MonthlyRideModel.fromJson(item);

View File

@@ -33,7 +33,6 @@ class HelpController extends GetxController {
'helpQuestion': helpQuestionController.text
});
var d = jsonDecode(res);
// print(d);
isLoading = false;
update();
if (d['status'].toString() == 'success') {
@@ -51,7 +50,6 @@ class HelpController extends GetxController {
'driverID': box.read(BoxName.driverID).toString(),
});
if (res == "failure") {
// print(res);
isLoading = false;
update();
Get.defaultDialog(
@@ -76,7 +74,6 @@ class HelpController extends GetxController {
var res = await CRUD().get(link: AppLink.getByIdhelpCenter, payload: {
'id': id,
});
print(res);
if (res == "failure") {
status = 'not yet';
isLoading = false;

View File

@@ -124,7 +124,6 @@ class HomeCaptainController extends GetxController {
countRefuse = results[0]['count'].toString();
update();
if (int.parse(countRefuse) > 3 || double.parse(totalPoints) <= -300) {
print('total point is $totalPoints');
locationController.stopLocationUpdates();
activeStartTime = null;
activeTimer?.cancel();
@@ -148,9 +147,7 @@ class HomeCaptainController extends GetxController {
Get.back();
}));
}
} catch (e) {
print('Error executing custom query: $e');
}
} catch (e) {}
}
void changeMapType() {
@@ -207,13 +204,11 @@ class HomeCaptainController extends GetxController {
}
void stopTimer() {
print('Stopping timer');
timer?.cancel();
}
getlocation() async {
isLoading = true;
print('isLoading $isLoading');
update();
await Get.find<LocationController>().getLocation();
isLoading = false;
@@ -244,7 +239,7 @@ class HomeCaptainController extends GetxController {
await CRUD().post(link: AppLink.addTokensDriver, payload: {
'token': box.read(BoxName.tokenDriver),
'captain_id': box.read(BoxName.driverID).toString()
}).then((value) => print('Token Added'));
});
MapDriverController().driverCallPassenger();
// box.write(BoxName.statusDriverLocation, 'off');
}
@@ -258,9 +253,7 @@ class HomeCaptainController extends GetxController {
totalMoneyToday = data['message'][0]['todayAmount'];
update();
} else {
print(res);
}
} else {}
}
getKazanPercent() async {
@@ -279,7 +272,6 @@ class HomeCaptainController extends GetxController {
deliveryPrice = double.parse(json['message'][0]['deliveryPrice']);
mashwariPrice = double.parse(json['message'][0]['freePrice']);
fuelPrice = double.parse(json['message'][0]['fuelPrice']);
print(json);
}
}
@@ -295,7 +287,6 @@ class HomeCaptainController extends GetxController {
data = jsonDecode(res);
countRideToday = data['message'][0]['count'].toString();
// print(countRideToday);
update();
}

View File

@@ -173,11 +173,8 @@ class MapDriverController extends GetxController {
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;
@@ -205,12 +202,9 @@ class MapDriverController extends GetxController {
}
if (remainingTimeInPassengerLocatioWait == 0) {
isdriverWaitTimeEnd = true;
print(isdriverWaitTimeEnd);
update();
}
print(isdriverWaitTimeEnd);
print(
'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait');
'remainingTimeInPassengerLocatioWait $remainingTimeInPassengerLocatioWait';
int minutes = (remainingTimeInPassengerLocatioWait / 60).floor();
int seconds = remainingTimeInPassengerLocatioWait % 60;
@@ -267,13 +261,10 @@ class MapDriverController extends GetxController {
'driverID': box.read(BoxName.driverID),
});
if (res == 'failure') {
print('Scam is failure');
box.write(BoxName.statusDriverLocation, 'off');
return '0';
}
var d = jsonDecode(res);
print('Scam is ');
print(d['message'][0]['count']);
return d['message'][0]['count'];
}
@@ -411,7 +402,6 @@ class MapDriverController extends GetxController {
'token': paymentTokenWait1,
'driverID': box.read(BoxName.driverID).toString(),
});
print(res1);
if (res != 'failure') {
Get.snackbar(
'You will get cost of your work for this trip'.tr,
@@ -458,7 +448,6 @@ class MapDriverController extends GetxController {
'amount': amount.toString(),
});
var d = jsonDecode(res);
print('paymentToken ${d['message']}');
return d['message'];
}
@@ -470,7 +459,6 @@ class MapDriverController extends GetxController {
'amount': amount.toString(),
});
var d = jsonDecode(res);
print('paymentToken ${d['message']}');
return d['message'];
}
@@ -504,7 +492,6 @@ class MapDriverController extends GetxController {
'status': 'Finished',
'price': totalCost,
});
print('walletChecked is $walletChecked');
if (walletChecked == 'true') {
paymentToken = await generateTokenPassenger(
((-1) * double.parse(paymentAmount)).toString());
@@ -524,7 +511,6 @@ class MapDriverController extends GetxController {
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
});
print('passengerWalletBurc bef ${double.parse(passengerWalletBurc)}');
if (double.parse(passengerWalletBurc) < 0) {
// for zero passenger
var paymentToken1 = await generateTokenPassenger(
@@ -534,7 +520,6 @@ class MapDriverController extends GetxController {
'token': paymentToken1,
'balance': ((-1) * double.parse(passengerWalletBurc)).toString()
});
print('passengerWalletBurc aft ${double.parse(passengerWalletBurc)}');
}
double pointsSubtraction = 0;
@@ -551,7 +536,6 @@ class MapDriverController extends GetxController {
'token': paymentToken2,
'driverID': box.read(BoxName.driverID).toString(),
});
print(res);
Future.delayed(const Duration(milliseconds: 300));
FirebaseMessagesController().sendNotificationToPassengerToken(
'Driver Finish Trip',
@@ -581,10 +565,8 @@ class MapDriverController extends GetxController {
var res = await CRUD().get(link: AppLink.getOrderCancelStatus, payload: {
'order_id': rideId,
}); //.then((value) {
print('Cancel fetch--------------------');
var response = jsonDecode(res);
canelString = response['data']['status'];
print('cancel is $canelString');
update();
if (canelString == 'Cancel') {
remainingTimeTimerRideBegin = 0;
@@ -613,8 +595,6 @@ class MapDriverController extends GetxController {
int rideTimerFromBegin = 0;
double price = 0;
void rideIsBeginPassengerTimer() async {
// print('mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm');
// print(durationOfRideValue);
int durationOfRide = int.parse(durationOfRideValue);
update();
int infinity = 40000;
@@ -764,7 +744,6 @@ class MapDriverController extends GetxController {
var response = await CRUD().getGoogleApi(link: url, payload: {});
data = response['routes'][0]['legs'];
print(data);
distanceBetweenDriverAndPassengerWhenConfirm =
(data[0]['distance']['value']) / 1000;
final points =
@@ -824,7 +803,6 @@ class MapDriverController extends GetxController {
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++) {
@@ -892,14 +870,10 @@ class MapDriverController extends GetxController {
argumentLoading() async {
passengerLocation = Get.arguments['passengerLocation'];
print(passengerLocation);
passengerDestination = Get.arguments['passengerDestination'];
print(passengerDestination);
duration = Get.arguments['Duration'];
totalCost = Get.arguments['totalCost'];
passengerId = Get.arguments['passengerId'];
print('passengerID argument =${Get.arguments['passengerId']} ');
print('passengerID =$passengerId ');
driverId = Get.arguments['driverId'];
distance = Get.arguments['Distance'];
passengerName = Get.arguments['name'];
@@ -933,8 +907,6 @@ class MapDriverController extends GetxController {
String lat = Get.find<LocationController>().myLocation.latitude.toString();
String lng = Get.find<LocationController>().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);
@@ -952,7 +924,6 @@ class MapDriverController extends GetxController {
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 =

View File

@@ -77,9 +77,7 @@ class OrderRequestController extends GetxController {
} else {
box.write(BoxName.statusDriverLocation, 'off');
}
} catch (e) {
print('Error executing custom query: $e');
}
} catch (e) {}
}
void getSQL() async {
@@ -95,7 +93,6 @@ class OrderRequestController extends GetxController {
AND created_at LIKE '%$todayDay%'
''';
List<Map<String, dynamic>> results = await sql.getCustomQuery(customQuery);
print(results);
}
void startTimer(String driverID, orderID) async {
@@ -108,8 +105,6 @@ class OrderRequestController extends GetxController {
}
if (remainingTime == 0) {
if (applied == false) {
print('applied=========================');
print(applied);
refuseOrder(orderID);
}
}
@@ -125,8 +120,6 @@ class OrderRequestController extends GetxController {
}
if (remainingTimeSpeed == 0) {
if (applied == false) {
print('applied=========================');
print(applied);
Get.back();
// refuseOrder(box.read(BoxName.driverID), orderID);
}