5/29/5
This commit is contained in:
@@ -14,8 +14,10 @@ import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
class RateController extends GetxController {
|
||||
double selectedRateItemId = -1;
|
||||
TextEditingController comment = TextEditingController();
|
||||
TextEditingController passenggerPayAmount = TextEditingController();
|
||||
String? rideId, passengerId, driverId, price;
|
||||
late GlobalKey<FormState> formKey;
|
||||
bool ispassengerWantWalletFromDriver = false;
|
||||
@override
|
||||
void onInit() {
|
||||
formKey = GlobalKey<FormState>();
|
||||
@@ -27,6 +29,28 @@ class RateController extends GetxController {
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
void passengerWantPay() {
|
||||
ispassengerWantWalletFromDriver = true;
|
||||
update();
|
||||
}
|
||||
|
||||
Future addPassengerWallet() async {
|
||||
if (formKey.currentState!.validate()) {
|
||||
var priceOfTrip =
|
||||
double.parse(Get.find<MapDriverController>().paymentAmount);
|
||||
double remainingFee =
|
||||
double.parse(passenggerPayAmount.text) - priceOfTrip;
|
||||
await CRUD().post(link: AppLink.addPassengersWallet, payload: {
|
||||
'passenger_id': passengerId,
|
||||
'balance': remainingFee.toString()
|
||||
}).then((value) {
|
||||
if (value != 'failure') {
|
||||
Get.snackbar('Wallet Add', '');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void selectRateItem(double id) {
|
||||
selectedRateItemId = id;
|
||||
update();
|
||||
|
||||
Reference in New Issue
Block a user