|
|
|
|
@ -285,8 +285,8 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
SizedBox(width: 12.w),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: LocaleKeys.cashRefundApprovalInstructions.tr(context: context).toText12(
|
|
|
|
|
color: AppColors.greyInfoTextColor,
|
|
|
|
|
),
|
|
|
|
|
color: AppColors.greyInfoTextColor,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -345,9 +345,9 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
final isStep2Valid = vm.selectedWithdrawMethod != null &&
|
|
|
|
|
(isCash
|
|
|
|
|
? !vm.isCashWithdrawAmountExceeded // Cash: check amount limit
|
|
|
|
|
: (isBankTransfer &&
|
|
|
|
|
_bankDetailsController.text.trim().isNotEmpty &&
|
|
|
|
|
_descriptionController.text.trim().isNotEmpty)); // Bank: check fields
|
|
|
|
|
: (isBankTransfer
|
|
|
|
|
? (_bankDetailsController.text.trim().isNotEmpty && _descriptionController.text.trim().isNotEmpty) // Bank: check IBAN and description
|
|
|
|
|
: true)); // HMG Wallet: no additional validation
|
|
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
|
|
|
|
|
@ -460,10 +460,10 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
child: SelectHospitalBottomSheet(
|
|
|
|
|
onHospitalSelected: (hospital) {
|
|
|
|
|
habibWalletViewModel.setSelectedHospital(hospital);
|
|
|
|
|
habibWalletViewModel.fetchAdvancesForHospital();
|
|
|
|
|
if (hospital.iD != null) {
|
|
|
|
|
final projectId = hospital.iD is int ? hospital.iD as int : int.tryParse(hospital.iD.toString());
|
|
|
|
|
if (projectId != null) {
|
|
|
|
|
habibWalletViewModel.fetchAdvancesForHospital(projectId: projectId);
|
|
|
|
|
habibWalletViewModel.getThresholdAmount(projectId: projectId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -492,6 +492,7 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
Widget _buildBankInputDetails() {
|
|
|
|
|
return Consumer<HabibWalletViewModel>(
|
|
|
|
|
builder: (context, viewModel, _) {
|
|
|
|
|
final isBankTransfer = viewModel.selectedWithdrawMethod == RefundTabType.invoices;
|
|
|
|
|
final hasError = viewModel.ibanError != null || viewModel.withdrawDescriptionError != null;
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.all(16.h),
|
|
|
|
|
@ -505,32 +506,34 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.addIbanDetails.tr(),
|
|
|
|
|
hintText: "SA0000000000000000000000",
|
|
|
|
|
controller: _bankDetailsController,
|
|
|
|
|
focusNode: _ibanFocusNode,
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
isReadOnly: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
fontSize: 14.f,
|
|
|
|
|
isCountryDropDown: false,
|
|
|
|
|
leadingIcon: AppAssets.bankIcon,
|
|
|
|
|
fontFamily: "Poppins",
|
|
|
|
|
hasError: false,
|
|
|
|
|
errorMessage: viewModel.ibanError,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
viewModel.clearIbanError();
|
|
|
|
|
},
|
|
|
|
|
onSubmitted: (value) {
|
|
|
|
|
_descriptionFocusNode.requestFocus();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Divider(color: AppColors.bottomNAVBorder, thickness: 1).withVerticalPadding(16.h),
|
|
|
|
|
if (isBankTransfer) ...[
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.addIbanDetails.tr(),
|
|
|
|
|
hintText: "SA0000000000000000000000",
|
|
|
|
|
controller: _bankDetailsController,
|
|
|
|
|
focusNode: _ibanFocusNode,
|
|
|
|
|
autoFocus: false,
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
isEnable: true,
|
|
|
|
|
isReadOnly: false,
|
|
|
|
|
prefix: null,
|
|
|
|
|
isBorderAllowed: false,
|
|
|
|
|
isAllowLeadingIcon: true,
|
|
|
|
|
fontSize: 14.f,
|
|
|
|
|
isCountryDropDown: false,
|
|
|
|
|
leadingIcon: AppAssets.bankIcon,
|
|
|
|
|
fontFamily: "Poppins",
|
|
|
|
|
hasError: false,
|
|
|
|
|
errorMessage: viewModel.ibanError,
|
|
|
|
|
onChange: (value) {
|
|
|
|
|
viewModel.clearIbanError();
|
|
|
|
|
},
|
|
|
|
|
onSubmitted: (value) {
|
|
|
|
|
_descriptionFocusNode.requestFocus();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Divider(color: AppColors.bottomNAVBorder, thickness: 1).withVerticalPadding(16.h),
|
|
|
|
|
],
|
|
|
|
|
TextInputWidget(
|
|
|
|
|
labelText: LocaleKeys.description.tr(),
|
|
|
|
|
hintText: LocaleKeys.enterDescription.tr(),
|
|
|
|
|
@ -733,9 +736,17 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
final user = _appState.getAuthenticatedUser();
|
|
|
|
|
final hospital = vm.selectedHospital;
|
|
|
|
|
|
|
|
|
|
// Determine refund destination: '2' = Bank Transfer, '3' = Cash
|
|
|
|
|
// Determine refund destination: 1 = HMG Wallet, 2 = Bank Transfer, 3 = Cash
|
|
|
|
|
String refundDestination;
|
|
|
|
|
final isBankTransfer = vm.selectedWithdrawMethod == RefundTabType.invoices;
|
|
|
|
|
final isCash = vm.selectedWithdrawMethod == RefundTabType.cash;
|
|
|
|
|
final refundDestination = isCash ? '3' : '2';
|
|
|
|
|
if (isCash) {
|
|
|
|
|
refundDestination = '3';
|
|
|
|
|
} else if (isBankTransfer) {
|
|
|
|
|
refundDestination = '2';
|
|
|
|
|
} else {
|
|
|
|
|
refundDestination = '1'; // HMG Wallet
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await vm.submitWalletWithdrawalRequest(
|
|
|
|
|
iban: _bankDetailsController.text.trim(),
|
|
|
|
|
@ -904,11 +915,9 @@ class _WithdrawRequestCreatePageState extends State<WithdrawRequestCreatePage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
_buildRefundMethodSelection(habibWalletViewModel),
|
|
|
|
|
if (habibWalletViewModel.selectedWithdrawMethod == RefundTabType.invoices) ...[
|
|
|
|
|
if (habibWalletViewModel.selectedWithdrawMethod != null) ...[
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
_buildBankInputDetails(),
|
|
|
|
|
],
|
|
|
|
|
if (habibWalletViewModel.selectedWithdrawMethod != null) ...[
|
|
|
|
|
SizedBox(height: 16.h),
|
|
|
|
|
_buildImageUploadSection(habibWalletViewModel),
|
|
|
|
|
],
|
|
|
|
|
|