combined and ordered accountingMappingOptions

This commit is contained in:
Dániel Gyenizse
2023-11-15 18:53:40 +01:00
committed by Adam Saghy
parent 355ba78311
commit d8a279fc51
2 changed files with 21 additions and 3 deletions
@@ -175,7 +175,7 @@
<ng-container matColumnDef="fundSourceAccountId">
<th mat-header-cell *matHeaderCellDef> Fund Source </th>
<td mat-cell *matCellDef="let paymentFundSource">
{{ paymentFundSource.fundSourceAccountId | find:assetAccountData:'id':'name' }}
{{ paymentFundSource.fundSourceAccountId | find:combinedAccountData:'id':'name' }}
</td>
</ng-container>
@@ -30,6 +30,7 @@ export class SavingProductAccountingStepComponent implements OnInit {
expenseAccountData: any;
liabilityAccountData: any;
incomeAndLiabilityAccountData: any;
combinedAccountData: any[];
paymentFundSourceDisplayedColumns: string[] = ['paymentTypeId', 'fundSourceAccountId', 'actions'];
feesPenaltyIncomeDisplayedColumns: string[] = ['chargeId', 'incomeAccountId', 'actions'];
@@ -48,6 +49,23 @@ export class SavingProductAccountingStepComponent implements OnInit {
this.incomeAccountData = this.savingProductsTemplate.accountingMappingOptions.incomeAccountOptions || [];
this.expenseAccountData = this.savingProductsTemplate.accountingMappingOptions.expenseAccountOptions || [];
this.liabilityAccountData = this.savingProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.combinedAccountData = [
...this.assetAccountData,
...this.incomeAccountData,
...this.expenseAccountData,
...this.liabilityAccountData
];
this.combinedAccountData.sort((a, b) => {
const valueA = a.name.toLowerCase();
const valueB = b.name.toLowerCase();
if (valueA < valueB) {
return -1;
}
if (valueA > valueB) {
return 1;
}
return 0;
});
this.savingProductAccountingForm.patchValue({
'accountingRule': this.savingProductsTemplate.accountingRule.id
@@ -218,8 +236,8 @@ export class SavingProductAccountingStepComponent implements OnInit {
new SelectBase({
controlName: 'fundSourceAccountId',
label: 'Fund Source',
value: values ? values.fundSourceAccountId : this.assetAccountData[0].id,
options: { label: 'name', value: 'id', data: this.assetAccountData },
value: values ? values.fundSourceAccountId : this.combinedAccountData[0].id,
options: { label: 'name', value: 'id', data: this.combinedAccountData },
required: true,
order: 2
})