refactor(client): refactor clients component (#109)
* refactor(client): refactor clients component
This commit is contained in:
@@ -10,7 +10,7 @@ import { map } from 'rxjs/operators';
|
|||||||
export class ClientsService {
|
export class ClientsService {
|
||||||
constructor(private http: Http) {} // tslint:disable-line
|
constructor(private http: Http) {} // tslint:disable-line
|
||||||
|
|
||||||
createAuthorizationHeader(headers: Headers) {
|
createAuthorizationHeader(headers: Headers) { // tslint:disable-line
|
||||||
const username = 'mifos';
|
const username = 'mifos';
|
||||||
const password = 'password';
|
const password = 'password';
|
||||||
headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
|
headers.append('Authorization', 'Basic ' + btoa(username + ':' + password));
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material';
|
|||||||
encapsulation: ViewEncapsulation.None
|
encapsulation: ViewEncapsulation.None
|
||||||
})
|
})
|
||||||
export class ViewClientComponent implements OnInit, OnDestroy {
|
export class ViewClientComponent implements OnInit, OnDestroy {
|
||||||
id: number = undefined;
|
public id: number = undefined;
|
||||||
loanAccounts: any = undefined;
|
loanAccounts: any = undefined;
|
||||||
savingsAccounts: any = undefined;
|
savingsAccounts: any = undefined;
|
||||||
shareAccounts: any = undefined;
|
shareAccounts: any = undefined;
|
||||||
@@ -42,7 +42,15 @@ export class ViewClientComponent implements OnInit, OnDestroy {
|
|||||||
this.id = params['id'];
|
this.id = params['id'];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
this.clientService.getClientId(this.id)
|
|
||||||
|
this.getClientId(this.id);
|
||||||
|
this.getClientAccounts(this.id);
|
||||||
|
this.getClientCharges(this.id);
|
||||||
|
this.getClientAddress(this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientId(id: any) {
|
||||||
|
this.clientService.getClientId(id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(res => {
|
(res => {
|
||||||
const groupArray = new Array;
|
const groupArray = new Array;
|
||||||
@@ -57,7 +65,10 @@ export class ViewClientComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
this.clientService.getClientAccounts(this.id)
|
}
|
||||||
|
|
||||||
|
getClientAccounts(id: any) {
|
||||||
|
this.clientService.getClientAccounts(id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(res => {
|
(res => {
|
||||||
this.loanAccounts = res['loanAccounts'];
|
this.loanAccounts = res['loanAccounts'];
|
||||||
@@ -71,12 +82,18 @@ export class ViewClientComponent implements OnInit, OnDestroy {
|
|||||||
this.dataSourceShares = new MatTableDataSource(this.SHARES_DATA);
|
this.dataSourceShares = new MatTableDataSource(this.SHARES_DATA);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
this.clientService.getClientCharges(this.id)
|
}
|
||||||
|
|
||||||
|
getClientCharges(id: any) {
|
||||||
|
this.clientService.getClientCharges(id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(res => {
|
(res => {
|
||||||
this.upcomingCharges = res['pageItems'];
|
this.upcomingCharges = res['pageItems'];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientAddress(id: any) {
|
||||||
this.clientService.getClientAddress(this.id)
|
this.clientService.getClientAddress(this.id)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(res => {
|
(res => {
|
||||||
|
|||||||
Reference in New Issue
Block a user