Moved to Angular 6.0

----

Pending
* Table width for the points column in incentive
* Linting
* keyboard navigation where it was used earlier
* can remove the unused totals calculated serverside in productledger
* spinner and loading bars
* Activate Guard for Employee Function tabs
* Progress for Fingerprint uploads
* deleted reconcile and receipe features as they were not being used
* focus the right control on component load
This commit is contained in:
tanshu
2018-06-09 17:05:11 +05:30
parent b3cb01da02
commit 6be1dd5a3a
1380 changed files with 23914 additions and 18722 deletions
@@ -0,0 +1,56 @@
<div fxLayout="row" fxFlex="50%" fxLayoutAlign="space-around center" class="example-card">
<mat-card fxFlex>
<mat-card-title-group>
<mat-card-title>Account</mat-card-title>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex>
<mat-label>Code</mat-label>
<input matInput placeholder="Code" formControlName="code">
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex>
<mat-label>Name</mat-label>
<input matInput #nameElement placeholder="Name" formControlName="name">
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex>
<mat-label>Account Type</mat-label>
<mat-select placeholder="Account Type" formControlName="type">
<mat-option *ngFor="let at of accountTypes" [value]="at.id">
{{ at.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-checkbox formControlName="isActive">Is Active?</mat-checkbox>
<mat-checkbox formControlName="isReconcilable">Is Reconcilable?</mat-checkbox>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-form-field fxFlex>
<mat-label>Cost Centre</mat-label>
<mat-select placeholder="Cost Centre" formControlName="costCentre">
<mat-option *ngFor="let cs of costCentres" [value]="cs.id">
{{ cs.name }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button color="primary" (click)="save()">Save</button>
<button mat-raised-button color="warn" (click)="confirmDelete()" *ngIf="!!item.id">Delete</button>
</mat-card-actions>
</mat-card>
</div>
@@ -0,0 +1,25 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {AccountDetailComponent} from './account-detail.component';
describe('AccountDetailComponent', () => {
let component: AccountDetailComponent;
let fixture: ComponentFixture<AccountDetailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [AccountDetailComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(AccountDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,121 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ToasterService} from '../../core/toaster.service';
import {ActivatedRoute, Router} from '@angular/router';
import {AccountService} from '../account.service';
import {Account} from '../account';
import {AccountType} from '../account-type';
import {CostCentre} from '../../cost-centre/cost-centre';
import {ConfirmDialogComponent} from '../../shared/confirm-dialog/confirm-dialog.component';
import {MatDialog} from '@angular/material';
import {FormBuilder, FormGroup} from '@angular/forms';
@Component({
selector: 'app-account-detail',
templateUrl: './account-detail.component.html',
styleUrls: ['./account-detail.component.css']
})
export class AccountDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement') nameElement: ElementRef;
form: FormGroup;
accountTypes: AccountType[];
costCentres: CostCentre[];
item: Account;
constructor(
private route: ActivatedRoute,
private router: Router,
private dialog: MatDialog,
private fb: FormBuilder,
private toaster: ToasterService,
private ser: AccountService
) {
this.createForm();
}
createForm() {
this.form = this.fb.group({
code: {value: '', disabled: true},
name: '',
type: '',
isActive: '',
isReconcilable: '',
costCentre: ''
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: Account, accountTypes: AccountType[], costCentres: CostCentre[] }) => {
this.accountTypes = data.accountTypes;
this.costCentres = data.costCentres;
this.showItem(data.item);
});
}
showItem(item: Account) {
this.item = item;
this.form.setValue({
code: this.item.code || '(Auto)',
name: this.item.name,
type: this.item.type,
isActive: this.item.isActive,
isReconcilable: this.item.isReconcilable,
costCentre: this.item.costCentre.id
});
}
ngAfterViewInit() {
setTimeout(() => {
this.nameElement.nativeElement.focus();
}, 0);
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/Accounts');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/Accounts');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete Account?', content: 'Are you sure? This cannot be undone.'}
});
dialogRef.afterClosed().subscribe((result: boolean) => {
if (result) {
this.delete();
}
});
}
getItem(): Account {
const formModel = this.form.value;
this.item.name = formModel.name;
this.item.type.id = formModel.type;
this.item.isActive = formModel.isActive;
this.item.isReconcilable = formModel.isReconcilable;
this.item.costCentre.id = formModel.costCentre;
return this.item;
}
}
@@ -0,0 +1,15 @@
import {inject, TestBed} from '@angular/core/testing';
import {AccountListResolverService} from './account-list-resolver.service';
describe('AccountListResolverService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AccountListResolverService]
});
});
it('should be created', inject([AccountListResolverService], (service: AccountListResolverService) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,18 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
import {Account} from './account';
import {Observable} from 'rxjs/internal/Observable';
import {AccountService} from './account.service';
@Injectable({
providedIn: 'root'
})
export class AccountListResolver implements Resolve<Account[]> {
constructor(private ser: AccountService) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Account[]> {
return this.ser.list();
}
}
@@ -0,0 +1,79 @@
import {DataSource} from '@angular/cdk/collections';
import {MatPaginator, MatSort} from '@angular/material';
import {map, tap} from 'rxjs/operators';
import {merge, Observable, of as observableOf} from 'rxjs';
import {Account} from '../account';
export class AccountListDataSource extends DataSource<Account> {
private dataObservable: Observable<Account[]>;
private filterValue: string;
constructor(private paginator: MatPaginator, private sort: MatSort, private filter: Observable<string>, public data: Account[]) {
super();
this.filter = filter.pipe(
tap(x => this.filterValue = x)
);
}
connect(): Observable<Account[]> {
this.dataObservable = observableOf(this.data);
const dataMutations = [
this.dataObservable,
this.filter,
this.paginator.page,
this.sort.sortChange
];
return merge(...dataMutations).pipe(
map((x: any) => {
return this.getPagedData(this.getSortedData(this.getFilteredData([...this.data])));
}),
tap((x: Account[]) => this.paginator.length = x.length)
);
}
disconnect() {
}
private getFilteredData(data: Account[]): Account[] {
const filter = (this.filterValue === undefined) ? '' : this.filterValue;
return filter.split(' ').reduce((p: Account[], c: string) => {
return p.filter(x => {
const accountString = (
x.name + ' ' + x.type + ' ' + x.costCentre + (x.isActive ? ' active' : ' deactive')
).toLowerCase();
return accountString.indexOf(c) !== -1;
}
);
}, Object.assign([], data));
}
private getPagedData(data: Account[]) {
const startIndex = this.paginator.pageIndex * this.paginator.pageSize;
return data.splice(startIndex, this.paginator.pageSize);
}
private getSortedData(data: Account[]) {
if (!this.sort.active || this.sort.direction === '') {
return data;
}
return data.sort((a, b) => {
const isAsc = this.sort.direction === 'asc';
switch (this.sort.active) {
case 'name':
return compare(a.name, b.name, isAsc);
case 'id':
return compare(+a.id, +b.id, isAsc);
default:
return 0;
}
});
}
}
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
function compare(a, b, isAsc) {
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
}
@@ -0,0 +1,61 @@
<mat-card>
<mat-card-title-group>
<mat-card-title>Accounts</mat-card-title>
<a mat-button [routerLink]="['/Account']">
<mat-icon>add_box</mat-icon>
Add
</a>
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div fxLayout="row" fxLayout.lt-md="column" fxLayoutGap="20px" fxLayoutGap.lt-md="0px"
fxLayoutAlign="space-around start">
<mat-form-field fxFlex>
<input type="text" matInput #filterElement placeholder="Filter" formControlName="filter" autocomplete="off">
</mat-form-field>
</div>
</form>
<mat-table #table [dataSource]="dataSource" matSort aria-label="Elements">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
<mat-cell *matCellDef="let row"><a [routerLink]="['/Account', row.id]">{{row.name}}</a></mat-cell>
</ng-container>
<!-- Type Column -->
<ng-container matColumnDef="type">
<mat-header-cell *matHeaderCellDef mat-sort-header>Type</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.type}}</mat-cell>
</ng-container>
<!-- Is Active? Column -->
<ng-container matColumnDef="isActive">
<mat-header-cell *matHeaderCellDef mat-sort-header>Is Active?</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.isActive}}</mat-cell>
</ng-container>
<!-- Is Reconcilable? Column -->
<ng-container matColumnDef="isReconcilable">
<mat-header-cell *matHeaderCellDef mat-sort-header>Is Reconcilable?</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.isReconcilable}}</mat-cell>
</ng-container>
<!-- Cost Centre Column -->
<ng-container matColumnDef="costCentre">
<mat-header-cell *matHeaderCellDef mat-sort-header>Cost Centre</mat-header-cell>
<mat-cell *matCellDef="let row">{{row.costCentre}}</mat-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
</mat-table>
<mat-paginator #paginator
[length]="dataSource.data.length"
[pageIndex]="0"
[pageSize]="50"
[pageSizeOptions]="[25, 50, 100, 250]">
</mat-paginator>
</mat-card-content>
</mat-card>
@@ -0,0 +1,23 @@
import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
import {AccountListComponent} from './account-list.component';
describe('AccountListComponent', () => {
let component: AccountListComponent;
let fixture: ComponentFixture<AccountListComponent>;
beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
declarations: [AccountListComponent]
})
.compileComponents();
fixture = TestBed.createComponent(AccountListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should compile', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,60 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {MatPaginator, MatSort} from '@angular/material';
import {AccountListDataSource} from './account-list-datasource';
import {Account} from '../account';
import {ActivatedRoute} from '@angular/router';
import {Observable} from 'rxjs';
import {FormBuilder, FormGroup} from '@angular/forms';
import {debounceTime, distinctUntilChanged, startWith} from 'rxjs/operators';
@Component({
selector: 'app-account-list',
templateUrl: './account-list.component.html',
styleUrls: ['./account-list.component.css']
})
export class AccountListComponent implements OnInit, AfterViewInit {
@ViewChild('filterElement') filterElement: ElementRef;
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
dataSource: AccountListDataSource;
filter: Observable<string>;
form: FormGroup;
list: Account[];
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'type', 'isActive', 'isReconcilable', 'costCentre'];
constructor(private route: ActivatedRoute, private fb: FormBuilder) {
this.createForm();
this.filter = this.listenToFilterChange();
}
createForm() {
this.form = this.fb.group({
filter: ''
});
}
listenToFilterChange() {
return this.form.get('filter').valueChanges
.pipe(
startWith(''),
debounceTime(150),
distinctUntilChanged()
);
}
ngOnInit() {
this.route.data
.subscribe((data: { list: Account[] }) => {
this.list = data.list;
});
this.dataSource = new AccountListDataSource(this.paginator, this.sort, this.filter, this.list);
}
ngAfterViewInit() {
setTimeout(() => {
this.filterElement.nativeElement.focus();
}, 0);
}
}
@@ -0,0 +1,15 @@
import {inject, TestBed} from '@angular/core/testing';
import {AccountResolverService} from './account-resolver.service';
describe('AccountResolverService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AccountDetailResolverService]
});
});
it('should be created', inject([AccountDetailResolverService], (service: AccountDetailResolverService) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,19 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router';
import {AccountService} from './account.service';
import {Account} from './account';
import {Observable} from 'rxjs/internal/Observable';
@Injectable({
providedIn: 'root'
})
export class AccountResolver implements Resolve<Account> {
constructor(private ser: AccountService, private router: Router) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<Account> {
const id = route.paramMap.get('id');
return this.ser.get(id);
}
}
@@ -0,0 +1,13 @@
import {AccountRoutingModule} from './account-routing.module';
describe('AccountRoutingModule', () => {
let accountRoutingModule: AccountRoutingModule;
beforeEach(() => {
accountRoutingModule = new AccountRoutingModule();
});
it('should create an instance', () => {
expect(accountRoutingModule).toBeTruthy();
});
});
@@ -0,0 +1,69 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule, Routes} from '@angular/router';
import {AccountListResolver} from './account-list-resolver.service';
import {AccountResolver} from './account-resolver.service';
import {AccountTypeResolver} from './account-type-resolver.service';
import {AccountDetailComponent} from './account-detail/account-detail.component';
import {AccountListComponent} from './account-list/account-list.component';
import {AuthGuard} from '../auth/auth-guard.service';
import {CostCentreListResolver} from '../cost-centre/cost-centre-list-resolver.service';
const accountRoutes: Routes = [
{
path: 'Accounts',
component: AccountListComponent,
canActivate: [AuthGuard],
data: {
permission: 'Accounts'
},
resolve: {
list: AccountListResolver
}
},
{
path: 'Account',
component: AccountDetailComponent,
canActivate: [AuthGuard],
data: {
permission: 'Accounts'
},
resolve: {
item: AccountResolver,
accountTypes: AccountTypeResolver,
costCentres: CostCentreListResolver
}
},
{
path: 'Account/:id',
component: AccountDetailComponent,
canActivate: [AuthGuard],
data: {
permission: 'Accounts'
},
resolve: {
item: AccountResolver,
accountTypes: AccountTypeResolver,
costCentres: CostCentreListResolver
}
}
];
@NgModule({
imports: [
CommonModule,
RouterModule.forChild(accountRoutes)
],
exports: [
RouterModule
],
providers: [
AccountListResolver,
AccountResolver
]
})
export class AccountRoutingModule {
}
@@ -0,0 +1,15 @@
import {inject, TestBed} from '@angular/core/testing';
import {AccountTypeResolverService} from './account-type-resolver.service';
describe('AccountTypeResolverService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AccountTypeResolverService]
});
});
it('should be created', inject([AccountTypeResolverService], (service: AccountTypeResolverService) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,18 @@
import {Injectable} from '@angular/core';
import {ActivatedRouteSnapshot, Resolve, RouterStateSnapshot} from '@angular/router';
import {AccountType} from './account-type';
import {Observable} from 'rxjs/internal/Observable';
import {AccountTypeService} from './account-type.service';
@Injectable({
providedIn: 'root'
})
export class AccountTypeResolver implements Resolve<AccountType[]> {
constructor(private ser: AccountTypeService) {
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<AccountType[]> {
return this.ser.list();
}
}
@@ -0,0 +1,15 @@
import {inject, TestBed} from '@angular/core/testing';
import {AccountTypeService} from './account-type.service';
describe('AccountTypeService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AccountTypeService]
});
});
it('should be created', inject([AccountTypeService], (service: AccountTypeService) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,26 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/internal/Observable';
import {AccountType} from './account-type';
import {catchError} from 'rxjs/operators';
import {HttpClient} from '@angular/common/http';
import {ErrorLoggerService} from '../core/error-logger.service';
const url = '/api/AccountTypes';
const serviceName = 'AccountTypeService';
@Injectable({
providedIn: 'root'
})
export class AccountTypeService {
constructor(
private http: HttpClient, private log: ErrorLoggerService) {
}
list(): Observable<AccountType[]> {
return <Observable<AccountType[]>>this.http.get<AccountType[]>(url)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
}
}
+9
View File
@@ -0,0 +1,9 @@
export class AccountType {
id: number;
name: string;
balanceSheet: boolean;
debit: boolean;
cashFlowClassification: string;
order: number;
showInList: boolean;
}
@@ -0,0 +1,13 @@
import {AccountModule} from './account.module';
describe('AccountModule', () => {
let accountModule: AccountModule;
beforeEach(() => {
accountModule = new AccountModule();
});
it('should create an instance', () => {
expect(accountModule).toBeTruthy();
});
});
@@ -0,0 +1,50 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {AccountListComponent} from './account-list/account-list.component';
import {AccountDetailComponent} from './account-detail/account-detail.component';
import {AccountRoutingModule} from './account-routing.module';
import {
MatButtonModule,
MatCardModule,
MatCheckboxModule,
MatIconModule,
MatInputModule,
MatOptionModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSortModule,
MatTableModule
} from '@angular/material';
import {CdkTableModule} from '@angular/cdk/table';
import {ReactiveFormsModule} from '@angular/forms';
import {FlexLayoutModule, FlexModule} from '@angular/flex-layout';
@NgModule({
imports: [
CommonModule,
CdkTableModule,
FlexModule,
FlexLayoutModule,
MatTableModule,
MatPaginatorModule,
MatSortModule,
MatCardModule,
MatProgressSpinnerModule,
MatInputModule,
MatButtonModule,
MatIconModule,
MatOptionModule,
MatSelectModule,
MatCheckboxModule,
ReactiveFormsModule,
AccountRoutingModule
],
declarations: [
AccountListComponent,
AccountDetailComponent
]
})
export class AccountModule {
}
@@ -0,0 +1,15 @@
import {inject, TestBed} from '@angular/core/testing';
import {AccountService} from './account.service';
describe('AccountService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [AccountService]
});
});
it('should be created', inject([AccountService], (service: AccountService) => {
expect(service).toBeTruthy();
}));
});
@@ -0,0 +1,97 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs/internal/Observable';
import {catchError} from 'rxjs/operators';
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import {Account} from './account';
import {ErrorLoggerService} from '../core/error-logger.service';
const httpOptions = {
headers: new HttpHeaders({'Content-Type': 'application/json'})
};
const url = '/api/Account';
const serviceName = 'AccountService';
@Injectable({providedIn: 'root'})
export class AccountService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {
}
get(id: string): Observable<Account> {
const getUrl: string = (id === null) ? url : `${url}/${id}`;
return <Observable<Account>>this.http.get<Account>(getUrl)
.pipe(
catchError(this.log.handleError(serviceName, `get id=${id}`))
);
}
list(): Observable<Account[]> {
const options = {params: new HttpParams().set('l', '')};
return <Observable<Account[]>>this.http.get<Account[]>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
}
paymentAutocomplete(term: string): Observable<Account[]> {
const options = {params: new HttpParams().set('q', term).set('t', '1')};
return <Observable<Account[]>>this.http.get<Account[]>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
}
receiptAutocomplete(term: string): Observable<Account[]> {
const options = {params: new HttpParams().set('q', term).set('t', '1')};
return <Observable<Account[]>>this.http.get<Account[]>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'list'))
);
}
save(account: Account): Observable<Account> {
return <Observable<Account>>this.http.post<Account>(url, account, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'save'))
);
}
update(account: Account): Observable<Account> {
return <Observable<Account>>this.http.put<Account>(`${url}/${account.id}`, account, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'update'))
);
}
saveOrUpdate(account: Account): Observable<Account> {
if (!account.id) {
return this.save(account);
} else {
return this.update(account);
}
}
delete(id: string): Observable<Account> {
return <Observable<Account>>this.http.delete<Account>(`${url}/${id}`, httpOptions)
.pipe(
catchError(this.log.handleError(serviceName, 'delete'))
);
}
autocomplete(term: string): Observable<Account[]> {
const options = {params: new HttpParams().set('q', term)};
return <Observable<Account[]>>this.http.get<Account[]>(url, options)
.pipe(
catchError(this.log.handleError(serviceName, 'autocomplete'))
);
}
balance(id: string, date: string): Observable<any> {
const options = {params: new HttpParams().set('b', 'true').set('d', date)};
return <Observable<any>>this.http.get<any>(`${url}/${id}`, options)
.pipe(
catchError(this.log.handleError(serviceName, 'balance'))
);
}
}
+18
View File
@@ -0,0 +1,18 @@
import {AccountType} from './account-type';
import {CostCentre} from '../cost-centre/cost-centre';
import {Journal} from '../journal/voucher';
export class Account {
id: string;
code: number;
name: string;
type: AccountType;
isActive: boolean;
isReconcilable: boolean;
isFixture: boolean;
costCentre: CostCentre;
public constructor(init?: Partial<Account>) {
Object.assign(this, init);
}
}