resolved bug in Creating Tax Components (#2367)
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@
|
||||
[inputFormControl]="taxComponentForm.controls.debitAcountId"
|
||||
[glAccountList]="debitAccountData"
|
||||
[required]="false"
|
||||
[inputLabel]="'Credit Account'"
|
||||
[inputLabel]="'Debit Account'"
|
||||
>
|
||||
</mifosx-gl-account-selector>
|
||||
|
||||
|
||||
+5
-5
@@ -113,15 +113,15 @@ export class CreateTaxComponentComponent implements OnInit {
|
||||
getAccountsData(accountTypeId: number) {
|
||||
switch (accountTypeId) {
|
||||
case 1:
|
||||
return this.taxComponentTemplateData.glAccountOptions.assetAccountOptions;
|
||||
return this.taxComponentTemplateData.glAccountOptions.assetAccountOptions || [];
|
||||
case 2:
|
||||
return this.taxComponentTemplateData.glAccountOptions.liabilityAccountOptions;
|
||||
return this.taxComponentTemplateData.glAccountOptions.liabilityAccountOptions || [];
|
||||
case 3:
|
||||
return this.taxComponentTemplateData.glAccountOptions.equityAccountOptions;
|
||||
return this.taxComponentTemplateData.glAccountOptions.equityAccountOptions || [];
|
||||
case 4:
|
||||
return this.taxComponentTemplateData.glAccountOptions.incomeAccountOptions;
|
||||
return this.taxComponentTemplateData.glAccountOptions.incomeAccountOptions || [];
|
||||
case 5:
|
||||
return this.taxComponentTemplateData.glAccountOptions.expenseAccountOptions;
|
||||
return this.taxComponentTemplateData.glAccountOptions.expenseAccountOptions || [];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,12 +21,12 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="taxComponentData.creditAccountType.value">
|
||||
<mat-form-field *ngIf="taxComponentData?.creditAccountType?.value">
|
||||
<mat-label>{{ 'labels.inputs.Credit Account Type' | translate }}</mat-label>
|
||||
<input matInput formControlName="creditAccountType" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="taxComponentData.creditAccount.name">
|
||||
<mat-form-field *ngIf="taxComponentData?.creditAccount?.name">
|
||||
<mat-label>{{ 'labels.inputs.Credit Account' | translate }}</mat-label>
|
||||
<input matInput formControlName="creditAccount" />
|
||||
</mat-form-field>
|
||||
|
||||
+8
-4
@@ -63,6 +63,12 @@ export class EditTaxComponentComponent implements OnInit {
|
||||
* Edit tax component form.
|
||||
*/
|
||||
editTaxComponent() {
|
||||
const creditAccountTypeValue = this.taxComponentData?.creditAccountType?.value
|
||||
? this.translateService.instant(`labels.inputs.accounting.${this.taxComponentData.creditAccountType.value}`)
|
||||
: null;
|
||||
|
||||
const creditAccountName = this.taxComponentData?.creditAccount?.name ?? null;
|
||||
|
||||
this.taxComponentForm = this.formBuilder.group({
|
||||
name: [
|
||||
this.taxComponentData.name,
|
||||
@@ -78,13 +84,11 @@ export class EditTaxComponentComponent implements OnInit {
|
||||
startDate: [this.taxComponentData.startDate && new Date(this.taxComponentData.startDate)],
|
||||
creditAccountType: [
|
||||
{
|
||||
value: this.translateService.instant(
|
||||
'labels.inputs.accounting.' + this.taxComponentData.creditAccountType.value
|
||||
),
|
||||
value: creditAccountTypeValue,
|
||||
disabled: true
|
||||
}
|
||||
],
|
||||
creditAccount: [{ value: this.taxComponentData.creditAccount.name, disabled: true }]
|
||||
creditAccount: [{ value: creditAccountName, disabled: true }]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<ng-container matColumnDef="glAccount">
|
||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'labels.inputs.Account' | translate }}</th>
|
||||
<td mat-cell *matCellDef="let taxComponent">
|
||||
({{ taxComponent.creditAccount.glCode }}) {{ taxComponent.creditAccount.name }}
|
||||
({{ taxComponent.creditAccount?.glCode || '' }}) {{ taxComponent.creditAccount?.name || '' }}
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user