12/12/1
This commit is contained in:
@@ -141,4 +141,6 @@ class AppLink {
|
|||||||
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
static String sendVerifyEmailCaptin = "$authCaptin/sendVerifyEmail.php";
|
||||||
static String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
static String verifyEmailCaptin = "$authCaptin/verifyEmail.php";
|
||||||
static String removeUser = "$authCaptin/removeAccount.php";
|
static String removeUser = "$authCaptin/removeAccount.php";
|
||||||
|
static String updateAccountBank = "$authCaptin/updateAccountBank.php";
|
||||||
|
static String getAccount = "$authCaptin/getAccount.php";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class HelpController extends GetxController {
|
|||||||
});
|
});
|
||||||
if (res == "failure") {
|
if (res == "failure") {
|
||||||
// print(res);
|
// print(res);
|
||||||
|
isLoading = false;
|
||||||
|
update();
|
||||||
Get.defaultDialog(
|
Get.defaultDialog(
|
||||||
title: 'There is no help Question here'.tr,
|
title: 'There is no help Question here'.tr,
|
||||||
titleStyle: AppStyle.title,
|
titleStyle: AppStyle.title,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class CaptainWalletController extends GetxController {
|
|||||||
final formKey = GlobalKey<FormState>();
|
final formKey = GlobalKey<FormState>();
|
||||||
String totalAmount = '0';
|
String totalAmount = '0';
|
||||||
String totalPoints = '0';
|
String totalPoints = '0';
|
||||||
|
|
||||||
Future getCaptainWalletFromRide() async {
|
Future getCaptainWalletFromRide() async {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
update();
|
update();
|
||||||
@@ -37,8 +38,14 @@ class CaptainWalletController extends GetxController {
|
|||||||
payload: {'driverID': box.read(BoxName.driverID)},
|
payload: {'driverID': box.read(BoxName.driverID)},
|
||||||
);
|
);
|
||||||
walletDriverPointsDate = jsonDecode(res);
|
walletDriverPointsDate = jsonDecode(res);
|
||||||
totalPoints =
|
if (walletDriverPointsDate['message'][0]['driverID'].toString() ==
|
||||||
walletDriverPointsDate['message'][0]['total_amount'].toString();
|
box.read(BoxName.driverID)) {
|
||||||
|
totalPoints =
|
||||||
|
walletDriverPointsDate['message'][0]['total_amount'].toString();
|
||||||
|
} else {
|
||||||
|
totalPoints = '0';
|
||||||
|
}
|
||||||
|
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -64,10 +71,25 @@ class CaptainWalletController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check if account bank is created or not
|
||||||
|
Future checkAccountCaptainBank() async {
|
||||||
|
if (box.read(BoxName.accountIdStripeConnect).toString().isEmpty) {
|
||||||
|
var res = await CRUD().get(link: AppLink.getAccount, payload: {
|
||||||
|
'id': box.read(BoxName.driverID).toString(),
|
||||||
|
});
|
||||||
|
var d = jsonDecode(res);
|
||||||
|
if (d['status'] != 'failure') {
|
||||||
|
box.write(BoxName.accountIdStripeConnect,
|
||||||
|
d['message'][0]['accountBank'].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
getCaptainWalletFromRide();
|
getCaptainWalletFromRide();
|
||||||
getCaptainWalletFromBuyPoints();
|
getCaptainWalletFromBuyPoints();
|
||||||
|
checkAccountCaptainBank();
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -403,13 +403,24 @@ class PaymentController extends GetxController {
|
|||||||
payload: body,
|
payload: body,
|
||||||
);
|
);
|
||||||
final responseData = jsonDecode(response);
|
final responseData = jsonDecode(response);
|
||||||
print(responseData);
|
// print(responseData);
|
||||||
final accountId = responseData['id'];
|
final accountId = responseData['id'];
|
||||||
box.write(BoxName.accountIdStripeConnect, accountId);
|
box.write(BoxName.accountIdStripeConnect, accountId);
|
||||||
|
await updateCaptainAccountBank();
|
||||||
print('accountId = $accountId');
|
print('accountId = $accountId');
|
||||||
return accountId;
|
return accountId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future updateCaptainAccountBank() async {
|
||||||
|
var res = await CRUD().post(link: AppLink.updateAccountBank, payload: {
|
||||||
|
'id': box.read(BoxName.driverID),
|
||||||
|
'accountBank': box.read(BoxName.accountIdStripeConnect),
|
||||||
|
});
|
||||||
|
if (jsonDecode(res)['status'] == 'success') {
|
||||||
|
Get.snackbar('Account Updated', '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> createTransactionToCaptain(
|
Future<String> createTransactionToCaptain(
|
||||||
String amount, String account) async {
|
String amount, String account) async {
|
||||||
String url = 'https://api.stripe.com//v1/transfers';
|
String url = 'https://api.stripe.com//v1/transfers';
|
||||||
@@ -427,7 +438,7 @@ class PaymentController extends GetxController {
|
|||||||
final responseData = jsonDecode(response);
|
final responseData = jsonDecode(response);
|
||||||
print(responseData);
|
print(responseData);
|
||||||
final transactionId = responseData['id'];
|
final transactionId = responseData['id'];
|
||||||
box.write(BoxName.accountIdStripeConnect, transactionId);
|
|
||||||
print('transactionId = $transactionId');
|
print('transactionId = $transactionId');
|
||||||
return transactionId;
|
return transactionId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,137 +18,136 @@ class HelpCaptain extends StatelessWidget {
|
|||||||
return MyScafolld(
|
return MyScafolld(
|
||||||
title: 'Helping Page'.tr,
|
title: 'Helping Page'.tr,
|
||||||
body: [
|
body: [
|
||||||
Positioned(
|
Column(
|
||||||
top: Get.height * .025,
|
children: [
|
||||||
right: 20,
|
Card(
|
||||||
left: 20,
|
color: AppColor.yellowColor,
|
||||||
child: Card(
|
|
||||||
color: AppColor.yellowColor,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
'If you need any help or have question this is right site to do that and your welcome'
|
|
||||||
.tr,
|
|
||||||
style: AppStyle.title,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: Get.height * .15,
|
|
||||||
right: 20,
|
|
||||||
left: 20,
|
|
||||||
child: Card(
|
|
||||||
elevation: 3,
|
|
||||||
color: AppColor.secondaryColor,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: GetBuilder<HelpController>(
|
child: Text(
|
||||||
builder: (helpController) => Form(
|
'If you need any help or have question this is right site to do that and your welcome'
|
||||||
key: helpController.formKey,
|
.tr,
|
||||||
child: Column(
|
style: AppStyle.title,
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
controller: helpController.helpQuestionController,
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
hintText: 'Enter your Question here',
|
|
||||||
labelText: 'Question',
|
|
||||||
),
|
|
||||||
validator: (value) {
|
|
||||||
if (value == null || value.isEmpty) {
|
|
||||||
return 'Please enter your Question.';
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
helpController.isLoading
|
|
||||||
? const MyCircularProgressIndicator()
|
|
||||||
: MyElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (helpController.formKey.currentState!
|
|
||||||
.validate()) {
|
|
||||||
helpController.addHelpQuestion();
|
|
||||||
|
|
||||||
// Clear the feedback form
|
|
||||||
helpController.formKey.currentState!
|
|
||||||
.reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
title: 'Submit Question'.tr,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
),
|
),
|
||||||
Positioned(
|
Card(
|
||||||
bottom: 3,
|
elevation: 3,
|
||||||
right: 8,
|
color: AppColor.secondaryColor,
|
||||||
left: 8,
|
child: Padding(
|
||||||
child: GetBuilder<HelpController>(
|
padding: const EdgeInsets.all(8.0),
|
||||||
builder: (helpController) => Container(
|
child: GetBuilder<HelpController>(
|
||||||
height: Get.height * .63,
|
builder: (helpController) => Form(
|
||||||
decoration: AppStyle.boxDecoration,
|
key: helpController.formKey,
|
||||||
child: ListView.builder(
|
child: Column(
|
||||||
itemCount:
|
children: [
|
||||||
helpController.helpQuestionDate['message'].length,
|
SizedBox(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
width: Get.width * .8,
|
||||||
var list =
|
child: TextFormField(
|
||||||
helpController.helpQuestionDate['message'][index];
|
controller:
|
||||||
return Padding(
|
helpController.helpQuestionController,
|
||||||
padding: const EdgeInsets.all(3),
|
decoration: const InputDecoration(
|
||||||
child: Container(
|
border: OutlineInputBorder(),
|
||||||
decoration: BoxDecoration(
|
hintText: 'Enter your Question here',
|
||||||
border: Border.all(
|
labelText: 'Question',
|
||||||
color: AppColor.greenColor,
|
|
||||||
width: 3,
|
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.circular(11)),
|
validator: (value) {
|
||||||
// elevation: 3,
|
if (value == null || value.isEmpty) {
|
||||||
// color: AppColor.greenColor,
|
return 'Please enter your Question.';
|
||||||
child: GestureDetector(
|
}
|
||||||
onTap: () {
|
return null;
|
||||||
print(list['id']);
|
},
|
||||||
helpController.getindex(
|
),
|
||||||
list['id'], list['helpQuestion']);
|
),
|
||||||
helpController
|
const SizedBox(height: 20),
|
||||||
.getHelpRepley(list['id'].toString());
|
helpController.isLoading
|
||||||
Get.to(
|
? const MyCircularProgressIndicator()
|
||||||
() => const HelpDetailsReplayPage(),
|
: MyElevatedButton(
|
||||||
);
|
onPressed: () {
|
||||||
},
|
if (helpController.formKey.currentState!
|
||||||
child: Padding(
|
.validate()) {
|
||||||
padding: const EdgeInsets.all(2),
|
helpController.addHelpQuestion();
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
// Clear the feedback form
|
||||||
MainAxisAlignment.spaceBetween,
|
helpController.formKey.currentState!
|
||||||
children: [
|
.reset();
|
||||||
SizedBox(
|
}
|
||||||
width: Get.width * .6,
|
},
|
||||||
child: Text(
|
title: 'Submit Question'.tr,
|
||||||
list['helpQuestion'],
|
),
|
||||||
style: AppStyle.title,
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
GetBuilder<HelpController>(
|
||||||
|
builder: (helpController) => Container(
|
||||||
|
height: 400,
|
||||||
|
decoration: AppStyle.boxDecoration,
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: helpController.helpQuestionDate['message'] !=
|
||||||
|
null
|
||||||
|
? helpController.helpQuestionDate['message'].length
|
||||||
|
: 0,
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
// if (helpController.helpQuestionDate['message'] ==
|
||||||
|
// null) {
|
||||||
|
// return const CircularProgressIndicator();
|
||||||
|
// }
|
||||||
|
var list =
|
||||||
|
helpController.helpQuestionDate['message'][index];
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(3),
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(
|
||||||
|
color: AppColor.greenColor,
|
||||||
|
width: 3,
|
||||||
|
),
|
||||||
|
borderRadius: BorderRadius.circular(11)),
|
||||||
|
// elevation: 3,
|
||||||
|
// color: AppColor.greenColor,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
print(list['id']);
|
||||||
|
helpController.getindex(
|
||||||
|
list['id'], list['helpQuestion']);
|
||||||
|
helpController
|
||||||
|
.getHelpRepley(list['id'].toString());
|
||||||
|
Get.to(
|
||||||
|
() => const HelpDetailsReplayPage(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(2),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: Get.width * .6,
|
||||||
|
child: Text(
|
||||||
|
list['helpQuestion'],
|
||||||
|
style: AppStyle.title,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: Get.width * .3,
|
||||||
width: Get.width * .3,
|
child: Text(
|
||||||
child: Text(
|
list['datecreated'],
|
||||||
list['datecreated'],
|
style: AppStyle.subtitle,
|
||||||
style: AppStyle.subtitle,
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
)),
|
||||||
)),
|
],
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
isleading: true,
|
isleading: true,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -197,23 +197,7 @@ class PassengerWallet extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
PassengerWalletDialoge(),
|
const PassengerWalletDialoge(),
|
||||||
GetBuilder<PaymentController>(
|
|
||||||
builder: (controller) => Positioned(
|
|
||||||
top: 440,
|
|
||||||
right: 100,
|
|
||||||
left: 100,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
MyElevatedButton(
|
|
||||||
title: 'createConnectAccount',
|
|
||||||
onPressed: () {
|
|
||||||
controller.createConnectAccount();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
))
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class PointsCaptain extends StatelessWidget {
|
|||||||
await paymentController.makePaymentStripe(pricePoint, 'USD', () async {
|
await paymentController.makePaymentStripe(pricePoint, 'USD', () async {
|
||||||
await captainWalletController.addDriverPayment('visa', pricePoint);
|
await captainWalletController.addDriverPayment('visa', pricePoint);
|
||||||
await captainWalletController.addDriverWallet('visa', countPoint);
|
await captainWalletController.addDriverWallet('visa', countPoint);
|
||||||
|
await captainWalletController.getCaptainWalletFromBuyPoints();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@@ -32,16 +32,32 @@ class WaletCaptain extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Card(
|
const SizedBox(),
|
||||||
elevation: 4,
|
Container(
|
||||||
|
decoration: AppStyle.boxDecoration.copyWith(
|
||||||
|
color: double.parse(
|
||||||
|
captainWalletController.totalPoints) <
|
||||||
|
100
|
||||||
|
? AppColor.redColor
|
||||||
|
: AppColor.greenColor,
|
||||||
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: Text(
|
child: Text(
|
||||||
'Total Points is ${captainWalletController.totalPoints} 💎',
|
'Total Points is ${captainWalletController.totalPoints.toString()} 💎',
|
||||||
style: AppStyle.headtitle2,
|
style: AppStyle.headtitle2,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
double.parse(captainWalletController.totalPoints
|
||||||
|
.toString()) <
|
||||||
|
100
|
||||||
|
? MyElevatedButton(
|
||||||
|
title: 'Charge your Account', onPressed: () {})
|
||||||
|
: const SizedBox(),
|
||||||
Card(
|
Card(
|
||||||
elevation: 4,
|
elevation: 4,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -93,30 +109,39 @@ class WaletCaptain extends StatelessWidget {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
),
|
),
|
||||||
Row(
|
box
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
.read(BoxName.accountIdStripeConnect)
|
||||||
children: [
|
.toString()
|
||||||
MyElevatedButton(
|
.isEmpty
|
||||||
title: 'Create Wallet to recive your money',
|
? Row(
|
||||||
onPressed: () async {
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
PaymentController paymentController =
|
children: [
|
||||||
Get.find<PaymentController>();
|
MyElevatedButton(
|
||||||
paymentController.createConnectAccount();
|
title:
|
||||||
}),
|
'Create Wallet to recive your money',
|
||||||
],
|
onPressed: () async {
|
||||||
),
|
PaymentController paymentController =
|
||||||
TextButton(
|
Get.find<PaymentController>();
|
||||||
onPressed: () async {
|
paymentController
|
||||||
PaymentController paymentController =
|
.createConnectAccount();
|
||||||
Get.put(PaymentController());
|
}),
|
||||||
await paymentController.createTransactionToCaptain(
|
],
|
||||||
'1000',
|
)
|
||||||
box.read(BoxName.accountIdStripeConnect));
|
: const SizedBox(
|
||||||
},
|
height: 30,
|
||||||
child: const Text(
|
),
|
||||||
"Pay to Captain",
|
// TextButton(
|
||||||
),
|
// onPressed: () async {
|
||||||
)
|
// PaymentController paymentController =
|
||||||
|
// Get.put(PaymentController());
|
||||||
|
// await paymentController.createTransactionToCaptain(
|
||||||
|
// '1000',
|
||||||
|
// box.read(BoxName.accountIdStripeConnect));
|
||||||
|
// },
|
||||||
|
// child: const Text(
|
||||||
|
// "Pay to Captain",
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
))
|
))
|
||||||
|
|||||||
Reference in New Issue
Block a user