You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
3.8 KiB
Dart
85 lines
3.8 KiB
Dart
|
1 month ago
|
import 'package:get/get.dart';
|
||
|
|
|
||
|
|
import '../../../core/constants/translation_keys.dart';
|
||
|
|
import '../../../core/utils/SessionCache.dart';
|
||
|
|
import '../../../models/DepositAccountResponse.dart';
|
||
|
|
import '../../../models/UserInfo.dart';
|
||
|
|
|
||
|
|
|
||
|
|
class MyAccountController extends GetxController {
|
||
|
|
RxString fromAccountTitle = "".obs;
|
||
|
|
RxString fromAccountNumber = "".obs;
|
||
|
|
|
||
|
|
RxInt selectedIndex = 0.obs;
|
||
|
|
RxString accountTitleText = "".obs;
|
||
|
|
RxString accountNumber = "".obs;
|
||
|
|
RxString accountIBNNumber = "".obs;
|
||
|
|
RxString branchCode = "".obs;
|
||
|
|
RxString accountOpeningDate = "".obs;
|
||
|
|
|
||
|
|
/// show Selected indexBased String method
|
||
|
|
String getSelectedDisplayText() {
|
||
|
|
if (selectedIndex.value >= 0 && selectedIndex.value < dropdownItems.length) {
|
||
|
|
String fullText = dropdownItems[selectedIndex.value][0];
|
||
|
|
return fullText.length > 20 ? fullText.substring(0, 20) + '...' : fullText;
|
||
|
|
} else {
|
||
|
|
return TranslationKeys.makeTranslation(TranslationKeys.textNoSelect);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
RxList<String> totalAccount = RxList<String>.empty();
|
||
|
|
RxList<String> dropdownItems = RxList<String>.empty();
|
||
|
|
RxList<String> showAccountDetails = RxList<String>.empty();
|
||
|
|
UserInfo userInfo = UserInfo();
|
||
|
|
|
||
|
|
@override
|
||
|
|
void onInit() {
|
||
|
|
super.onInit();
|
||
|
|
|
||
|
|
DepositAccount selectAccount = DepositAccount();
|
||
|
|
if (SessionCache.instance.depositAccountList.value.isNotEmpty) {
|
||
|
|
selectAccount = SessionCache.instance.depositAccountList.value[0];
|
||
|
|
}
|
||
|
|
fromAccountTitle.value = selectAccount.mbmBkmstitle;
|
||
|
|
fromAccountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
accountTitleText.value = selectAccount.mbmBkmstitle;
|
||
|
|
accountNumber.value = selectAccount.mbmBkmsnumber;
|
||
|
|
//branchCode.value = selectAccount.plcLocadesc;
|
||
|
|
accountOpeningDate.value = selectAccount.mbmBkmsopendate;
|
||
|
|
|
||
|
|
/// For Deposit Account List
|
||
|
|
for (int i = 0; i < SessionCache.instance.depositAccountList.value.length; i++) {
|
||
|
|
totalAccount.add(SessionCache.instance.depositAccountList.value[i].mbmBkmsnumber);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// For Loan Account List
|
||
|
|
// for (int i = 0; i < SessionCache.instance.loanAccountList.value.length; i++) {
|
||
|
|
// totalAccount.add(SessionCache.instance.loanAccountList.value[i].mbmBkmsnumber);
|
||
|
|
// }
|
||
|
|
|
||
|
|
/// Assign to DropDown Items List
|
||
|
|
dropdownItems.assignAll(totalAccount);
|
||
|
|
print("The Total accounts lenght is ================== ${totalAccount}");
|
||
|
|
|
||
|
|
// for (int i = 0; i < SessionCache.instance.loanAccountList.value.length; i++) {
|
||
|
|
// showAccountDetails.add(SessionCache.instance.loanAccountList.value[i].mbmBkmstitle);
|
||
|
|
// showAccountDetails.add(SessionCache.instance.loanAccountList.value[i].plcLocadesc);
|
||
|
|
// }
|
||
|
|
for (int i = 0; i < SessionCache.instance.depositAccountList.value.length; i++) {
|
||
|
|
showAccountDetails.add(SessionCache.instance.depositAccountList.value[i].mbmBkmstitle);
|
||
|
|
//showAccountDetails.add(SessionCache.instance.depositAccountList.value[i].plcLocadesc);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
void setAccountDetails() {
|
||
|
|
accountTitleText.value = SessionCache.instance.depositAccountList.value[selectedIndex.value].mbmBkmstitle;
|
||
|
|
accountNumber.value = SessionCache.instance.depositAccountList.value[selectedIndex.value].mbmBkmsnumber;
|
||
|
|
accountIBNNumber.value = SessionCache.instance.depositAccountList.value[selectedIndex.value].mbmBkmsnumber;
|
||
|
|
//branchCode.value = SessionCache.instance.depositAccountList.value[selectedIndex.value].plcLocadesc;
|
||
|
|
// branchCode.value = SessionCache.instance.loanAccountList.value[selectedIndex.value].mbmBkmstitle;
|
||
|
|
// branchCode.value = SessionCache.instance.loanAccountList.value[selectedIndex.value].mbmBkmsnumber;
|
||
|
|
// branchCode.value = SessionCache.instance.loanAccountList.value[selectedIndex.value].mbmBkmsnumber;
|
||
|
|
// branchCode.value = SessionCache.instance.loanAccountList.value[selectedIndex.value].plcLocadesc;
|
||
|
|
}
|
||
|
|
}
|