feat(chart-of-accounts): add sub-ledger account

Add sub-ledger account for account usage header.
This commit is contained in:
Abhay Chawla
2018-08-04 22:09:54 +05:30
parent 1390540474
commit c790413817
3 changed files with 20 additions and 5 deletions
@@ -63,7 +63,7 @@
</mat-card-content>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['/accounting/chart-of-accounts']">Cancel</button>
<button type="button" mat-raised-button [routerLink]="[cancelRoute]">Cancel</button>
<button mat-raised-button color="primary">Submit</button>
</mat-card-actions>
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { AccountingService } from '../../accounting.service';
@@ -18,9 +18,23 @@ export class CreateGlAccountComponent implements OnInit {
accountUsageData: any;
tagData: any;
accountTypeId: number;
parentId: number;
cancelRoute = '/accounting/chart-of-accounts';
constructor(private formBuilder: FormBuilder,
private accountingService: AccountingService,
private router: Router) { }
private route: ActivatedRoute,
private router: Router) {
this.route.queryParamMap.subscribe(params => {
this.accountTypeId = Number(params.get('accountType'));
this.parentId = Number(params.get('parent'));
if (this.parentId) {
this.cancelRoute = `/accounting/chart-of-accounts/gl-accounts/view/${this.parentId}`;
}
});
}
ngOnInit() {
this.createGlAccountForm();
@@ -34,7 +48,7 @@ export class CreateGlAccountComponent implements OnInit {
'name': ['', Validators.required],
'usage': ['', Validators.required],
'glCode': ['', Validators.required],
'parentId': [''],
'parentId': [this.parentId],
'tagId': [''],
'manualEntriesAllowed': [true, Validators.required],
'description': ['']
@@ -46,6 +60,7 @@ export class CreateGlAccountComponent implements OnInit {
this.chartOfAccountsData = chartOfAccountsData;
this.accountTypeData = chartOfAccountsData.accountTypeOptions;
this.accountUsageData = chartOfAccountsData.usageOptions;
this.glAccountForm.get('type').setValue(this.accountTypeId);
});
}
@@ -1,5 +1,5 @@
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
<button mat-raised-button color="primary" *ngIf="glAccount.usage.value === 'HEADER'">
<button mat-raised-button color="primary" *ngIf="glAccount.usage.value === 'HEADER'" [routerLink]="['/accounting/chart-of-accounts/gl-accounts/create']" [queryParams]="{ parent: glAccount.id, accountType: glAccount.type.id }">
<mat-icon>add</mat-icon>&nbsp;&nbsp;Subledger Account
</button>
<button mat-raised-button color="primary" [routerLink]="['/accounting/chart-of-accounts/gl-accounts/view', glAccount.id, 'edit']">