This commit is contained in:
Hamza-Ayed
2024-06-19 23:03:14 +03:00
parent 9a8829f3f1
commit fcce6b9be5
6 changed files with 295 additions and 294 deletions

View File

@@ -212,6 +212,8 @@ class CaptainWalletController extends GetxController {
amountToNewDriverMap[0]['token'].toString(),
[],
);
await addSeferWallet('payout fee', '5');
Get.defaultDialog(
title: 'transfer Successful'.tr,
middleText: '',
@@ -221,15 +223,7 @@ class CaptainWalletController extends GetxController {
onPressed: () async {
Get.back();
Get.back();
var seferToken = await Get.find<CaptainWalletController>()
.generateToken('5');
await CRUD().post(link: AppLink.addSeferWallet, payload: {
'amount': '5',
'paymentMethod': 'payout fee',
'passengerId': 'driver',
'token': seferToken,
'driverId': box.read(BoxName.driverID).toString(),
});
await refreshCaptainWallet();
}));
}

View File

@@ -78,15 +78,9 @@ class PaymobPayout extends GetxController {
'token': paymentToken,
'driverID': box.read(BoxName.driverID).toString(),
});
var seferToken = await Get.find<CaptainWalletController>()
.generateToken(payOutFee.toString());
await CRUD().post(link: AppLink.addSeferWallet, payload: {
'amount': ((-1) * (double.parse(dec['amount']))).toStringAsFixed(0),
'paymentMethod': 'payout fee',
'passengerId': 'driver',
'token': seferToken,
'driverId': box.read(BoxName.driverID).toString(),
});
await Get.find<CaptainWalletController>()
.addSeferWallet('payout fee myself', payOutFee.toString());
Get.snackbar('Transaction successful'.tr,
'${'Transaction successful'.tr} ${dec['amount']}',
backgroundColor: AppColor.greenColor);

View File

@@ -12,6 +12,8 @@ import 'package:SEFER/main.dart';
import 'package:SEFER/views/home/Captin/home_captain/home_captin.dart';
import 'package:SEFER/views/widgets/elevated_btn.dart';
import '../home/payment/captain_wallet_controller.dart';
// import '../home/captin/home_captain_controller.dart';
class RateController extends GetxController {
@@ -54,29 +56,34 @@ class RateController extends GetxController {
if (value != 'failure') {
Get.snackbar('Wallet Added'.tr, '',
backgroundColor: AppColor.greenColor);
var paymentToken3 = await Get.find<MapDriverController>()
.generateTokenPassenger(remainingFee.toString());
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': 'remain$rideId',
'amount': remainingFee.toString(),
'payment_method': 'Remainder',
'passengerID': passengerId,
'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(),
});
if (double.parse(
Get.find<CaptainWalletController>().totalAmountVisa) >
remainingFee) {
var paymentToken3 = await Get.find<MapDriverController>()
.generateTokenDriver((-1 * remainingFee).toString());
double pointsSubtraction = 0;
pointsSubtraction = remainingFee * (-1); // for egypt /100
var paymentToken4 = await Get.find<MapDriverController>()
.generateTokenPassenger((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD()
.post(link: AppLink.addDriversWalletPoints, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubtraction).toStringAsFixed(0),
'paymentMethod': 'Remainder',
'token': paymentToken4,
'driverID': box.read(BoxName.driverID).toString(),
});
await CRUD().post(link: AppLink.addDrivePayment, payload: {
'rideId': 'remain$rideId',
'amount': (-1 * remainingFee).toString(),
'payment_method': 'Remainder',
'passengerID': passengerId,
'token': paymentToken3,
'driverID': box.read(BoxName.driverID).toString(),
});
} else {
double pointsSubtraction = 0;
pointsSubtraction = remainingFee * (-1); // for egypt /100
var paymentToken4 = await Get.find<MapDriverController>()
.generateTokenDriver((pointsSubtraction).toStringAsFixed(0));
var res = await CRUD()
.post(link: AppLink.addDriversWalletPoints, payload: {
'paymentID': 'rideId$rideId',
'amount': (pointsSubtraction).toStringAsFixed(0),
'paymentMethod': 'Remainder',
'token': paymentToken4,
'driverID': box.read(BoxName.driverID).toString(),
});
}
FirebaseMessagesController().sendNotificationToAnyWithoutData(
'Wallet Added',

View File

@@ -23,67 +23,66 @@ WHERE
c.complaint_type = 'Passenger' AND c.passenger_id = '100393163265770158312';
-- Admin panel dashboard
SELECT
(
SELECT
COALESCE((
SELECT
COUNT(`email`)
FROM
`passengers`
) AS countPassengers,
(
), 0) AS countPassengers,
COALESCE((
SELECT
COUNT(`email`)
FROM
`driver`
) AS countDriver,
(
SELECT
COUNT(`id`)
FROM
`ride`
) AS countRide,
(
), 0) AS countDriver,
COALESCE((
SELECT
COUNT(`id`)
FROM
`ride`
), 0) AS countRide,
COALESCE((
SELECT
COUNT(`id`)
FROM
`passengers`
WHERE
`passengers`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS countPassengersThisMonth,
(
), 0) AS countPassengersThisMonth,
COALESCE((
SELECT
COUNT(`id`)
FROM
`ride`
WHERE
`ride`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS countRideThisMonth,
(
), 0) AS countRideThisMonth,
COALESCE((
SELECT
COUNT(`id`)
FROM
`driver`
WHERE
`driver`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS countDriverThisMonth,
(
), 0) AS countDriverThisMonth,
COALESCE((
SELECT
COUNT(`id`)
FROM
`CarRegistration`
WHERE
`CarRegistration`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS countCarRegistrationThisMonth,
(
), 0) AS countCarRegistrationThisMonth,
COALESCE((
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS countComplaintThisMonth,
(
), 0) AS countComplaintThisMonth,
COALESCE((
SELECT
COUNT(`id`)
FROM
@@ -105,30 +104,26 @@ WHERE
),
'%Y-%m-%d'
)
) AS countComplaintThisWeek,
(
), 0) AS countComplaintThisWeek,
COALESCE((
SELECT
COUNT(`id`)
FROM
`complaint`
WHERE
`complaint`.`date_filed` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d') AND DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d')
) AS countComplaintToday,
(
), 0) AS countComplaintToday,
COALESCE((
SELECT
SUM(`payments`.`amount`)
FROM
`payments` WHERE
`payments`
WHERE
`payments`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
AND
`payments`.`payment_method` IN('visa-in',
'visa',
'visaRide',
'TransferFrom',
'payout',
'TransferTo')
) AS payments,
(
`payments`.`payment_method` IN('visa-in', 'visa', 'visaRide', 'TransferFrom', 'payout', 'TransferTo')
), 0) AS payments,
COALESCE((
SELECT
SUM(`driverWallet`.`amount`)
FROM
@@ -137,15 +132,23 @@ WHERE
`driverWallet`.`dateCreated` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
AND
`driverWallet`.`paymentMethod` IN('visa', '')
) AS driverWallet,
(
), 0) AS driverWallet,
COALESCE((
SELECT
SUM(`passengerWallet`.`balance`)
FROM
`passengerWallet`
WHERE
`passengerWallet`.`created_at` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
) AS passengerWallet
FROM
`passengers`
LIMIT 1
), 0) AS passengerWallet,
COALESCE((
SELECT
SUM(`seferWallet`.`amount`)
FROM
`seferWallet`
WHERE
`seferWallet`.`createdAt` BETWEEN DATE_FORMAT(CURRENT_DATE, '%Y-%m-01') AND LAST_DAY(CURRENT_DATE)
), 0) AS seferWallet
FROM
`passengers`
LIMIT 1;

View File

@@ -21,233 +21,234 @@ class RatePassenger extends StatelessWidget {
return MyScafolld(
title: 'Rate Passenger'.tr,
body: [
Positioned(
top: 40,
left: Get.width * .1,
right: Get.width * .1,
child: Container(
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(4),
child: Container(
height: Get.height * .25,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}',
style: AppStyle.title,
),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.redColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
(double.parse(controller.price.toString()) *
.12 +
double.parse(
controller.price.toString()))
.toStringAsFixed(2),
style: AppStyle.number.copyWith(
color: AppColor.redColor,
textBaseline: TextBaseline.ideographic,
decoration: TextDecoration.lineThrough,
decorationColor: AppColor.redColor),
),
GetBuilder<RateController>(builder: (controller) {
return Positioned(
top: 40,
left: Get.width * .1,
right: Get.width * .1,
child: Container(
decoration: AppStyle.boxDecoration,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(4),
child: Container(
height: Get.height * .25,
decoration: AppStyle.boxDecoration1,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'${'Total price from '.tr}${Get.find<MapDriverController>().passengerName}',
style: AppStyle.title,
),
),
const SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.greenColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
Get.find<MapDriverController>().paymentAmount,
style: AppStyle.number,
),
),
),
const SizedBox(
height: 10,
),
Text(
'Exclusive offers and discounts always with the Sefer app'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title
.copyWith(color: AppColor.redColor),
)
],
)),
),
controller.walletChecked != 'true'
? GetBuilder<RateController>(builder: (controller) {
return controller.ispassengerWantWalletFromDriver
? Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
"How much Passenger pay?".tr,
style: AppStyle.title,
),
Form(
key: controller.formKey,
child: MyTextForm(
controller:
controller.passengerPayAmount,
label:
"passenger amount to me".tr,
hint: "passenger amount to me".tr,
type: const TextInputType
.numberWithOptions(
decimal: true)),
),
MyElevatedButton(
title: "Press here".tr,
onPressed: () {
controller.addPassengerWallet();
})
],
),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.redColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
(double.parse(controller.price.toString()) *
.12 +
double.parse(
controller.price.toString()))
.toStringAsFixed(2),
style: AppStyle.number.copyWith(
color: AppColor.redColor,
textBaseline: TextBaseline.ideographic,
decoration: TextDecoration.lineThrough,
decorationColor: AppColor.redColor),
),
)
: Container(
width: Get.width * .73,
decoration: AppStyle.boxDecoration1,
),
),
const SizedBox(
height: 10,
),
Container(
decoration: BoxDecoration(
border: Border.all(
width: 2,
color: AppColor.greenColor,
)),
child: Padding(
padding: const EdgeInsets.all(4),
child: Text(
Get.find<MapDriverController>()
.paymentAmount,
style: AppStyle.number,
),
),
),
const SizedBox(
height: 10,
),
Text(
'Exclusive offers and discounts always with the Sefer app'
.tr,
textAlign: TextAlign.center,
style: AppStyle.title
.copyWith(color: AppColor.redColor),
)
],
)),
),
controller.walletChecked != 'true'
? controller.ispassengerWantWalletFromDriver
? Container(
decoration: AppStyle.boxDecoration1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(
"Would the passenger like to settle the remaining fare using their wallet?"
.tr,
"How much Passenger pay?".tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
Form(
key: controller.formKey,
child: MyTextForm(
controller:
controller.passengerPayAmount,
label: "passenger amount to me".tr,
hint: "passenger amount to me".tr,
type: const TextInputType
.numberWithOptions(
decimal: true)),
),
MyElevatedButton(
title: "Press here".tr,
onPressed: () {
controller.passengerWantPay();
controller.addPassengerWallet();
})
],
),
);
})
: const SizedBox(),
const SizedBox(
height: 20,
),
Center(
child: RatingBar.builder(
initialRating: 0,
itemCount: 5,
itemSize: 50,
itemPadding: const EdgeInsets.symmetric(horizontal: 2),
itemBuilder: (context, index) {
switch (index) {
case 0:
return const Icon(
Icons.sentiment_very_dissatisfied,
color: Colors.red,
);
case 1:
return const Icon(
Icons.sentiment_dissatisfied,
color: Colors.redAccent,
);
case 2:
return const Icon(
Icons.sentiment_neutral,
color: Colors.amber,
);
case 3:
return const Icon(
Icons.sentiment_satisfied,
color: Colors.lightGreen,
);
case 4:
return const Icon(
Icons.sentiment_very_satisfied,
color: Colors.green,
);
default:
return const Icon(
Icons.sentiment_neutral,
color: Colors.amber,
);
} //
},
onRatingUpdate: (rating) {
controller.selectRateItem(rating);
},
),
)
: Container(
width: Get.width * .73,
decoration: AppStyle.boxDecoration1,
child: Column(
children: [
Text(
"Would the passenger like to settle the remaining fare using their wallet?"
.tr,
style: AppStyle.title,
textAlign: TextAlign.center,
),
MyElevatedButton(
title: "Press here".tr,
onPressed: () {
controller.passengerWantPay();
})
],
),
)
: const SizedBox(),
const SizedBox(
height: 20,
),
),
const SizedBox(
height: 20,
),
SizedBox(
width: Get.width * .75,
child: TextFormField(
maxLines: 4,
minLines: 1,
keyboardType: TextInputType.multiline,
controller: controller.comment,
decoration: InputDecoration(
labelText: 'Enter your Note'.tr,
hintText: 'Type something...',
prefixIcon: const Icon(
Icons.rate_review), // Add an icon as a prefix
suffixIcon: IconButton(
icon: const Icon(
Icons.clear,
color: AppColor.redColor,
), // Add an icon as a suffix
onPressed: () {
controller.comment.clear();
},
),
border:
const OutlineInputBorder(), // Add a border around the input field
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors.blue), // Customize the border color
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors
.green), // Customize the border color when focused
),
errorBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors
.red), // Customize the border color when there's an error
Center(
child: RatingBar.builder(
initialRating: 0,
itemCount: 5,
itemSize: 50,
itemPadding: const EdgeInsets.symmetric(horizontal: 2),
itemBuilder: (context, index) {
switch (index) {
case 0:
return const Icon(
Icons.sentiment_very_dissatisfied,
color: Colors.red,
);
case 1:
return const Icon(
Icons.sentiment_dissatisfied,
color: Colors.redAccent,
);
case 2:
return const Icon(
Icons.sentiment_neutral,
color: Colors.amber,
);
case 3:
return const Icon(
Icons.sentiment_satisfied,
color: Colors.lightGreen,
);
case 4:
return const Icon(
Icons.sentiment_very_satisfied,
color: Colors.green,
);
default:
return const Icon(
Icons.sentiment_neutral,
color: Colors.amber,
);
} //
},
onRatingUpdate: (rating) {
controller.selectRateItem(rating);
},
),
),
const SizedBox(
height: 20,
),
SizedBox(
width: Get.width * .75,
child: TextFormField(
maxLines: 4,
minLines: 1,
keyboardType: TextInputType.multiline,
controller: controller.comment,
decoration: InputDecoration(
labelText: 'Enter your Note'.tr,
hintText: 'Type something...',
prefixIcon: const Icon(
Icons.rate_review), // Add an icon as a prefix
suffixIcon: IconButton(
icon: const Icon(
Icons.clear,
color: AppColor.redColor,
), // Add an icon as a suffix
onPressed: () {
controller.comment.clear();
},
),
border:
const OutlineInputBorder(), // Add a border around the input field
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(
color:
Colors.blue), // Customize the border color
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors
.green), // Customize the border color when focused
),
errorBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: Colors
.red), // Customize the border color when there's an error
),
),
),
),
),
const SizedBox(
height: 20,
),
MyElevatedButton(
title: 'Submit rating'.tr,
onPressed: () => controller.addRateToPassenger())
],
),
)),
const SizedBox(
height: 20,
),
MyElevatedButton(
title: 'Submit rating'.tr,
onPressed: () => controller.addRateToPassenger())
],
),
));
}),
],
isleading: false,
);

View File

@@ -48,8 +48,8 @@ class PointsCaptain extends StatelessWidget {
box.read(BoxName.countryCode) == 'Egypt'
? 'EGP'
: 'JOD', () async {
// await captainWalletController.addDriverPaymentPoints(
// 'visa-in', pricePoint);
await captainWalletController.addDriverPaymentPoints(
'visa-in', pricePoint);
await captainWalletController.addDriverWallet(
'visa-in', countPoint);
await captainWalletController.addSeferWallet(
@@ -75,6 +75,8 @@ class PointsCaptain extends StatelessWidget {
'visa-in', pricePoint);
await captainWalletController.addDriverWallet(
'visa-in', countPoint);
await captainWalletController.addSeferWallet(
'visa-in', pricePoint);
await captainWalletController
.getCaptainWalletFromBuyPoints();
});