From 963ec68527d56c6420e54dad8bc1ec24d94d177d Mon Sep 17 00:00:00 2001 From: Jivjyot Singh Date: Tue, 28 May 2019 18:07:12 +0530 Subject: [PATCH] refactor: Clients Module - refactors clients-routing.module.ts for dynamic breadcrumbs. - refactors clients.service.ts to use HttpClient - adds resolver to load client data - removes partially implemented components fixes: #409 --- src/app/clients/clients-routing.module.ts | 57 +-- src/app/clients/clients.component.ts | 36 +- src/app/clients/clients.module.ts | 63 +-- src/app/clients/clients.service.ts | 356 +--------------- .../common-resolvers/clients.resolver.ts | 30 ++ .../create-address.component.html | 71 ---- .../create-address.component.scss | 17 - .../create-address.component.spec.ts | 28 -- .../create-address.component.ts | 77 ---- .../create-client.component.html | 248 ----------- .../create-client.component.scss | 13 - .../create-client.component.spec.ts | 25 -- .../create-client/create-client.component.ts | 25 -- .../create-identity.component.html | 53 --- .../create-identity.component.scss | 17 - .../create-identity.component.spec.ts | 28 -- .../create-identity.component.ts | 76 ---- .../edit-address/edit-address.component.html | 64 --- .../edit-address/edit-address.component.scss | 13 - .../edit-address.component.spec.ts | 28 -- .../edit-address/edit-address.component.ts | 108 ----- .../upload-document.component.html | 43 -- .../upload-document.component.scss | 17 - .../upload-document.component.spec.ts | 28 -- .../upload-document.component.ts | 62 --- .../view-client-component-dialog.html | 8 - .../view-client/view-client.component.html | 400 ------------------ .../view-client/view-client.component.scss | 182 -------- .../view-client/view-client.component.spec.ts | 24 -- .../view-client/view-client.component.ts | 262 ------------ .../view-loan/view-loan.component.html | 354 ---------------- .../view-loan/view-loan.component.scss | 15 - .../view-loan/view-loan.component.spec.ts | 24 -- .../clients/view-loan/view-loan.component.ts | 15 - 34 files changed, 89 insertions(+), 2778 deletions(-) create mode 100644 src/app/clients/common-resolvers/clients.resolver.ts delete mode 100644 src/app/clients/create-address/create-address.component.html delete mode 100644 src/app/clients/create-address/create-address.component.scss delete mode 100644 src/app/clients/create-address/create-address.component.spec.ts delete mode 100644 src/app/clients/create-address/create-address.component.ts delete mode 100644 src/app/clients/create-client/create-client.component.html delete mode 100644 src/app/clients/create-client/create-client.component.scss delete mode 100644 src/app/clients/create-client/create-client.component.spec.ts delete mode 100644 src/app/clients/create-client/create-client.component.ts delete mode 100644 src/app/clients/create-identity/create-identity.component.html delete mode 100644 src/app/clients/create-identity/create-identity.component.scss delete mode 100644 src/app/clients/create-identity/create-identity.component.spec.ts delete mode 100644 src/app/clients/create-identity/create-identity.component.ts delete mode 100644 src/app/clients/edit-address/edit-address.component.html delete mode 100644 src/app/clients/edit-address/edit-address.component.scss delete mode 100644 src/app/clients/edit-address/edit-address.component.spec.ts delete mode 100644 src/app/clients/edit-address/edit-address.component.ts delete mode 100644 src/app/clients/upload-document/upload-document.component.html delete mode 100644 src/app/clients/upload-document/upload-document.component.scss delete mode 100644 src/app/clients/upload-document/upload-document.component.spec.ts delete mode 100644 src/app/clients/upload-document/upload-document.component.ts delete mode 100644 src/app/clients/view-client/view-client-component-dialog.html delete mode 100644 src/app/clients/view-client/view-client.component.html delete mode 100644 src/app/clients/view-client/view-client.component.scss delete mode 100644 src/app/clients/view-client/view-client.component.spec.ts delete mode 100644 src/app/clients/view-client/view-client.component.ts delete mode 100644 src/app/clients/view-loan/view-loan.component.html delete mode 100644 src/app/clients/view-loan/view-loan.component.scss delete mode 100644 src/app/clients/view-loan/view-loan.component.spec.ts delete mode 100644 src/app/clients/view-loan/view-loan.component.ts diff --git a/src/app/clients/clients-routing.module.ts b/src/app/clients/clients-routing.module.ts index 1efed1a7a..7d6cfbeed 100644 --- a/src/app/clients/clients-routing.module.ts +++ b/src/app/clients/clients-routing.module.ts @@ -7,63 +7,30 @@ import { Route } from '../core/route/route.service'; /** Translation Imports */ import { extract } from '../core/i18n/i18n.service'; +/** Custom Components */ import { ClientsComponent } from './clients.component'; -import { CreateClientComponent} from './create-client/create-client.component'; -import { ViewClientComponent } from './view-client/view-client.component'; -import { ViewLoanComponent } from './view-loan/view-loan.component'; -import { CreateAddressComponent } from './create-address/create-address.component'; -import { CreateIdentityComponent } from './create-identity/create-identity.component'; -import { UploadDocumentComponent } from './upload-document/upload-document.component'; -import { EditAddressComponent } from './edit-address/edit-address.component'; + +/** Custom Resolvers */ +import { ClientsResolver } from './common-resolvers/clients.resolver'; const routes: Routes = [ Route.withShell([ { path: 'clients', component: ClientsComponent, - data: { title: extract('Clients') } - }, - { - path: 'clients/create', - component: CreateClientComponent, - data: { title: extract('Create Client') } - }, - { - path: 'clients/view/:id', - component: ViewClientComponent, - data: { title: extract('View Client') } - }, - { - path: 'clients/viewloan', - component: ViewLoanComponent, - data: { title: extract('View Loan') } - }, - { - path: 'clients/address/:id', - component: CreateAddressComponent, - data: { title: extract('Create Address') } - }, - { - path: 'clients/editaddress/:id/:addressTypeId/:addressId', - component: EditAddressComponent, - data: { title: extract('Edit Address') } - }, - { - path: 'clients/addclientidentifier/:id', - component: CreateIdentityComponent, - data: { title: extract('Create Identity') } - }, - { - path: 'clients/addclientdocument/:id', - component: UploadDocumentComponent, - data: { title: extract('Create Identity') } - }, + data: { title: extract('Clients'), breadcrumb: 'Clients', routeParamBreadcrumb: false }, + resolve: { + clientsData: ClientsResolver + } + } ]) ]; @NgModule({ imports: [RouterModule.forChild(routes)], exports: [RouterModule], - providers: [] + providers: [ + ClientsResolver + ] }) export class ClientsRoutingModule { } diff --git a/src/app/clients/clients.component.ts b/src/app/clients/clients.component.ts index f3e939660..a4e087f97 100644 --- a/src/app/clients/clients.component.ts +++ b/src/app/clients/clients.component.ts @@ -1,9 +1,6 @@ -import {Component, OnInit, ViewChild, ViewEncapsulation} from '@angular/core'; -import {MatPaginator, MatSort, MatTableDataSource} from '@angular/material'; -import { Response} from '@angular/http'; -import {ClientsService} from './clients.service'; -import {DataSource} from '@angular/cdk/collections'; -import { Observable } from 'rxjs'; +import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; +import { MatPaginator, MatSort, MatTableDataSource } from '@angular/material'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'mifosx-clients', templateUrl: './clients.component.html', @@ -13,26 +10,17 @@ import { Observable } from 'rxjs'; }) export class ClientsComponent implements OnInit { post: any = []; - private ELEMENT_DATA: any = undefined; - displayedColumns = ['name', 'clientno', 'externalid', 'status', 'mobileNo', 'gender', 'office', 'staff']; + + displayedColumns = ['name', 'clientno', 'externalid', 'status', 'mobileNo', 'gender', 'office', 'staff']; dataSource = new MatTableDataSource(); @ViewChild(MatPaginator) paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; - constructor(private clientService: ClientsService) {} - - ngOnInit() { - this.getClients(); - } - - // GET from clients API - getClients() { - this.clientService.getClients() - .subscribe( - (res => { - console.log(res); - res.active = !!res.active; + constructor(private route: ActivatedRoute) { + this.route.data.subscribe((clientsData: { clientsData: any }) => { + const res = clientsData.clientsData.pageItems; + res.active = !!res.active; this.dataSource = new MatTableDataSource(res); this.dataSource.paginator = this.paginator; this.dataSource.sortingDataAccessor = (data: any, property: any) => { @@ -42,10 +30,12 @@ export class ClientsComponent implements OnInit { } }; this.dataSource.sort = this.sort; - }) - ); + }); } + + ngOnInit() { } + applyFilter(filterValue: string) { filterValue = filterValue.trim(); // Remove whitespace filterValue = filterValue.toLowerCase(); // Datasource defaults to lowercase matches diff --git a/src/app/clients/clients.module.ts b/src/app/clients/clients.module.ts index 94f14d867..cb3aaf02d 100644 --- a/src/app/clients/clients.module.ts +++ b/src/app/clients/clients.module.ts @@ -1,55 +1,26 @@ -import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { Component, OnInit, ViewChild } from '@angular/core'; -import { BrowserModule } from '@angular/platform-browser'; -import { HttpModule } from '@angular/http'; -import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { CoreModule } from '../core/core.module'; -import { MatTableModule } from '@angular/material/table'; -import { FlexLayoutModule } from '@angular/flex-layout'; -import { ArchwizardModule } from 'angular-archwizard'; +/** Angular Imports */ +import { NgModule } from '@angular/core'; +import { DatePipe } from '@angular/common'; +/** Custom Modules */ import { ClientsRoutingModule } from './clients-routing.module'; +import { SharedModule } from 'app/shared/shared.module'; + +/** Custom Components */ import { ClientsComponent } from './clients.component'; -import { CreateClientComponent} from './create-client/create-client.component'; -import { ViewClientComponent } from './view-client/view-client.component'; -import { ViewLoanComponent } from './view-loan/view-loan.component'; -import { CreateAddressComponent } from './create-address/create-address.component'; -import { CreateIdentityComponent } from './create-identity/create-identity.component'; - -import { ClientsService } from './clients.service'; -import { UploadDocumentComponent } from './upload-document/upload-document.component'; -import { EditAddressComponent } from './edit-address/edit-address.component'; +/** + * Clients Module + * + * All components related to Clients should be declared here. + */ @NgModule({ imports: [ - CoreModule, - CommonModule, - ClientsRoutingModule, - FormsModule, - ReactiveFormsModule, - FlexLayoutModule, - BrowserModule, // tslint:disable - HttpModule, - MatTableModule, - ArchwizardModule, + SharedModule, + ClientsRoutingModule ], - declarations: [ - ClientsComponent, - CreateClientComponent, - ViewClientComponent, - ViewLoanComponent, - CreateAddressComponent, - CreateIdentityComponent, - UploadDocumentComponent, - EditAddressComponent -], - providers: [ - ClientsService, - HttpModule // tslint:disable - ], - schemas: [ - CUSTOM_ELEMENTS_SCHEMA - ] + declarations: [ClientsComponent], + providers: [DatePipe] + }) export class ClientsModule { } diff --git a/src/app/clients/clients.service.ts b/src/app/clients/clients.service.ts index de5e5ef38..a434db813 100644 --- a/src/app/clients/clients.service.ts +++ b/src/app/clients/clients.service.ts @@ -1,347 +1,25 @@ +/** Angular Imports */ import { Injectable } from '@angular/core'; -import { Http, Headers, Response, RequestOptions, URLSearchParams } from '@angular/http'; -/* import { HttpHeaders, HttpClient } from '@angular/common/http'; - */ +import { HttpClient, HttpParams } from '@angular/common/http'; + +/** rxjs Imports */ import { Observable } from 'rxjs'; -import { of } from 'rxjs'; -import { map } from 'rxjs/operators'; +/** + * Clients service. + */ +@Injectable({ + providedIn: 'root' +}) @Injectable() export class ClientsService { - constructor(private http: Http) {} // tslint:disable-line + /** + * @param {HttpClient} http Http Client to send requests. + */ + constructor(private http: HttpClient) { } - createAuthorizationHeader(headers: Headers) { // tslint:disable-line - const username = 'mifos'; - const password = 'password'; - headers.append('Authorization', 'Basic ' + btoa(username + ':' + password)); - headers.append('Content-Type', 'application/json'); - headers.append('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); - headers.append('Access-Control-Allow-Origin', '*'); + getClients(): Observable { + const httpParams = new HttpParams().set('orderBy', 'id'); + return this.http.get('/clients', { params: httpParams }); } - - getClients() { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get( - 'https://demo.openmf.org/fineract-provider/api/v1/clients?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response['pageItems']; - - } - ) - ); - } - getClientId(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - getClientAccounts(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/accounts' + '?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - getClientCharges(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/charges' + '?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - getClientAddress(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/client/' + clientId + - '/addresses' + '?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - getClientNote(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/notes' + '?tenantIdentifier=default&pretty=true', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - postClientNote(clientId: number, notes: any) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - const body = JSON.stringify(notes); - return this.http.post('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/notes' + '?tenantIdentifier=default&pretty=true', notes, { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - getClientAddressTemplate() { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/client/' + - 'addresses/template?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - postClientAddress(clientId: number, body: any, type: any) { - const headers = new Headers(); // tslint:disable-line - const params = new URLSearchParams(); // tslint:disable-line - params.set('type', type); - this.createAuthorizationHeader(headers); - body = JSON.stringify(body); - const options = new RequestOptions({ // tslint:disable-line - headers: headers, - params: params, - }); - return this.http.post('https://demo.openmf.org/fineract-provider/api/v1/client/' + clientId + - '/addresses?' + '&tenantIdentifier=default&pretty=true', body, - options) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - putClientAddress(clientId: number, body: any, type: any) { - const headers = new Headers(); // tslint:disable-line - const params = new URLSearchParams(); // tslint:disable-line - params.set('type', type); - this.createAuthorizationHeader(headers); - // body = JSON.stringify(body); - const options = new RequestOptions({ // tslint:disable-line - headers: headers, - params: params, - }); - return this.http.put('https://demo.openmf.org/fineract-provider/api/v1/client/' + clientId + - '/addresses?' + 'tenantIdentifier=default', body, - options) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - getClientIdentifierTemplate(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/identifiers/template?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response['allowedDocumentTypes']; - - } - ) - ); - } - - getClientIdentifiers(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/identifiers/?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response = response.json(); - return response; - - } - ) - ); - } - - postClientIdentifier(clientId: number, body: any) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.post('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/identifiers/?tenantIdentifier=default', body, { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - deleteClientIdentifier(clientId: number, identifierId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.delete('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/identifiers/' + identifierId + '/?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - postClientDocument(clientId: number, body: any) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - headers.append('Content-Type', null); - headers.append('Accept', 'multipart/form-data'); - body = JSON.stringify(body); - - return this.http.post('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/documents/?tenantIdentifier=default', body, { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - getClientDocuments(clientId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/documents/?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - return response.json(); - } - ) - ); - } - - deleteClientDocuments(clientId: number, documentId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.delete('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/documents/' + documentId + '/?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - response.json(); - } - ) - ); - } - - downloadClientDocuments(clientId: number, documentId: number) { - const headers = new Headers(); // tslint:disable-line - this.createAuthorizationHeader(headers); - return this.http.get('https://demo.openmf.org/fineract-provider/api/v1/clients/' + clientId + - '/documents/' + documentId + '/attachment/?tenantIdentifier=default', { - headers: headers - }) - .pipe( - map( - (response: Response) => { // tslint:disable-line - return response.json(); - } - ) - ); - } - - - - } - diff --git a/src/app/clients/common-resolvers/clients.resolver.ts b/src/app/clients/common-resolvers/clients.resolver.ts new file mode 100644 index 000000000..a672e861f --- /dev/null +++ b/src/app/clients/common-resolvers/clients.resolver.ts @@ -0,0 +1,30 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { ClientsService } from '../clients.service'; + +/** + * Clients data resolver. + */ +@Injectable() +export class ClientsResolver implements Resolve { + + /** + * @param {ClientsService} ClientsService Clients service. + */ + constructor(private clientsService: ClientsService) { } + + /** + * Returns the Clients data. + * @returns {Observable} + */ + resolve(): Observable { + return this.clientsService.getClients(); + } + +} diff --git a/src/app/clients/create-address/create-address.component.html b/src/app/clients/create-address/create-address.component.html deleted file mode 100644 index d587c67dc..000000000 --- a/src/app/clients/create-address/create-address.component.html +++ /dev/null @@ -1,71 +0,0 @@ -
- - - - -
- - - - -
- - -
- - {{item?.name}} -
-
-
- - - - - - - - - - - - - - - - - - - - -
- - {{item?.name}} -
-
-
- - -
- - {{item?.name}} -
-
-
- - - - - - -
- -
-
- - -
- - -
-
-
diff --git a/src/app/clients/create-address/create-address.component.scss b/src/app/clients/create-address/create-address.component.scss deleted file mode 100644 index 4ad60da3c..000000000 --- a/src/app/clients/create-address/create-address.component.scss +++ /dev/null @@ -1,17 +0,0 @@ - - - .example-form { - min-width: 150px; - max-width: 500px; - width: 100%; - } - - .example-full-width { - width: 100%; - padding:5px 3px; - } - - .mat-raised-button{ - margin-left:10px; - margin-top:10px; - } \ No newline at end of file diff --git a/src/app/clients/create-address/create-address.component.spec.ts b/src/app/clients/create-address/create-address.component.spec.ts deleted file mode 100644 index bbfc57503..000000000 --- a/src/app/clients/create-address/create-address.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { CreateAddressComponent } from './create-address.component'; - -describe('CreateAddressComponent', () => { - let component: CreateAddressComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CreateAddressComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CreateAddressComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/create-address/create-address.component.ts b/src/app/clients/create-address/create-address.component.ts deleted file mode 100644 index 80267b638..000000000 --- a/src/app/clients/create-address/create-address.component.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Params } from '@angular/router'; -import { Subscription } from 'rxjs'; -import { NgForm } from '@angular/forms'; -import { Router } from '@angular/router'; - -import { ClientsService } from 'app/clients/clients.service'; - -@Component({ - selector: 'mifosx-app-create-address', - templateUrl: './create-address.component.html', - styleUrls: ['./create-address.component.scss'], - encapsulation: ViewEncapsulation.None - -}) -export class CreateAddressComponent implements OnInit { - id: number = undefined; - paramsSubscription: Subscription; - clientAddress: any = undefined; - value: any = undefined; - mymodel: any = undefined; - addressTypeId: any = undefined; - addressStateId: any = undefined; - addressCountryId: any = undefined; - - address: any = undefined; - - constructor(private route: ActivatedRoute, private clientService: ClientsService) {} - - @ViewChild('f') addressForm: NgForm; - - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - } - ); - console.log(this.id); - this.getClientAddressTemplate(); - } - - getClientAddressTemplate() { - this.clientService.getClientAddressTemplate() - .subscribe( - (res => { - this.clientAddress = res; - console.log(res); - }) - ); - } - - onSubmit() { - this.address = {}; - console.log(this.addressTypeId); - this.address.street = this.addressForm.value.street; - this.address.addressLine1 = this.addressForm.value.addressLine1; - this.address.addressLine2 = this.addressForm.value.addressLine2; - this.address.addressLine3 = this.addressForm.value.addressLine3; - this.address.city = this.addressForm.value.city; - this.address.stateProvinceId = this.addressStateId; - this.address.countryId = this.addressCountryId; - this.address.postalCode = this.addressForm.value.postalCode; - - - this.clientService.postClientAddress(this.id, this.address, this.addressTypeId) - .subscribe( - (res => { - return true; - }) - ); - this.addressForm.reset(); - } -} - - diff --git a/src/app/clients/create-client/create-client.component.html b/src/app/clients/create-client/create-client.component.html deleted file mode 100644 index f50b881c4..000000000 --- a/src/app/clients/create-client/create-client.component.html +++ /dev/null @@ -1,248 +0,0 @@ -
- - - - - -
- - -
- Shiba Inu - Dog Breed -
- -
- - - - - - - -
- - - -
- -

- - - - - - -

- - - - - -
- - - - - - {{postalCode.value.length}} / 5 -
-
- -
- - - - -
- - -
- - -
- -
-
diff --git a/src/app/clients/create-client/create-client.component.scss b/src/app/clients/create-client/create-client.component.scss deleted file mode 100644 index 81c45bbeb..000000000 --- a/src/app/clients/create-client/create-client.component.scss +++ /dev/null @@ -1,13 +0,0 @@ - .example-card { - width: 500px; - } - - .example-form { - min-width: 150px; - max-width: 500px; - width: 100%; - } - - .example-full-width { - width: 100%; - } \ No newline at end of file diff --git a/src/app/clients/create-client/create-client.component.spec.ts b/src/app/clients/create-client/create-client.component.spec.ts deleted file mode 100644 index 9a8598793..000000000 --- a/src/app/clients/create-client/create-client.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CreateClientComponent } from './create-client.component'; - -describe('CreateClientComponent', () => { - let component: CreateClientComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CreateClientComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CreateClientComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/create-client/create-client.component.ts b/src/app/clients/create-client/create-client.component.ts deleted file mode 100644 index e7e322c4a..000000000 --- a/src/app/clients/create-client/create-client.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component, OnInit} from '@angular/core'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -@Component({ - selector: 'mifosx-create-client', - templateUrl: './create-client.component.html', - styleUrls: ['./create-client.component.scss'] -}) -export class CreateClientComponent implements OnInit { - - isLinear = false; - firstFormGroup: FormGroup; - secondFormGroup: FormGroup; - - constructor(private _formBuilder: FormBuilder) { } - - ngOnInit() { - this.firstFormGroup = this._formBuilder.group({ - firstCtrl: ['', Validators.required] - }); - this.secondFormGroup = this._formBuilder.group({ - secondCtrl: ['', Validators.required] - }); - } - -} diff --git a/src/app/clients/create-identity/create-identity.component.html b/src/app/clients/create-identity/create-identity.component.html deleted file mode 100644 index 976a6df11..000000000 --- a/src/app/clients/create-identity/create-identity.component.html +++ /dev/null @@ -1,53 +0,0 @@ -
- - - - - -
- - - - -
- - -
- - {{item?.name}} -
-
-
- - -
- - {{item?.label}} -
-
-
- - - - - - - - - - - -
- -
-
- - -
- - -
-
-
- \ No newline at end of file diff --git a/src/app/clients/create-identity/create-identity.component.scss b/src/app/clients/create-identity/create-identity.component.scss deleted file mode 100644 index 4ad60da3c..000000000 --- a/src/app/clients/create-identity/create-identity.component.scss +++ /dev/null @@ -1,17 +0,0 @@ - - - .example-form { - min-width: 150px; - max-width: 500px; - width: 100%; - } - - .example-full-width { - width: 100%; - padding:5px 3px; - } - - .mat-raised-button{ - margin-left:10px; - margin-top:10px; - } \ No newline at end of file diff --git a/src/app/clients/create-identity/create-identity.component.spec.ts b/src/app/clients/create-identity/create-identity.component.spec.ts deleted file mode 100644 index 3dd7ca09e..000000000 --- a/src/app/clients/create-identity/create-identity.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { CreateIdentityComponent } from './create-identity.component'; - -describe('CreateIdentityComponent', () => { - let component: CreateIdentityComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CreateIdentityComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CreateIdentityComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/create-identity/create-identity.component.ts b/src/app/clients/create-identity/create-identity.component.ts deleted file mode 100644 index 9ddc86230..000000000 --- a/src/app/clients/create-identity/create-identity.component.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Params } from '@angular/router'; -import { Subscription } from 'rxjs'; -import { NgForm } from '@angular/forms'; -import { Router } from '@angular/router'; - -import { ClientsService } from 'app/clients/clients.service'; -@Component({ - selector: 'mifosx-app-create-identity', - templateUrl: './create-identity.component.html', - styleUrls: ['./create-identity.component.scss'] -}) -export class CreateIdentityComponent implements OnInit { - id: number = undefined; - paramsSubscription: Subscription; - clientIdentifierDocument: any = undefined; - document: any = undefined; - status: any = undefined; - value: any = undefined; - mymodel: any = undefined; - addressTypeId: any = undefined; - addressStateId: any = undefined; - addressCountryId: any = undefined; - - identifier: any = undefined; - statusTypes = [{ - id: 1, - label: 'Active' - }, { - id: 2, - label: 'Inactive', -}]; - constructor(private route: ActivatedRoute, private clientService: ClientsService) {} - - @ViewChild('f') identifierForm: NgForm; - - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - } - ); - console.log(this.id); - this.getClientIdentifierTemplate(this.id); - } - - getClientIdentifierTemplate(id: any) { - this.clientService.getClientIdentifierTemplate(id) - .subscribe( - (res => { - this.clientIdentifierDocument = res; - console.log(res); - }) - ); - } - - onSubmit() { - this.identifier = {}; - this.identifier.description = this.identifierForm.value.description; - this.identifier.documentKey = this.identifierForm.value.uniqueid; - this.identifier.documentTypeId = this.document; - this.identifier.status = this.status; - - - this.clientService.postClientIdentifier(this.id, this.identifier) - .subscribe( - (res => { - return true; - }) - ); - this.identifierForm.reset(); - } - -} diff --git a/src/app/clients/edit-address/edit-address.component.html b/src/app/clients/edit-address/edit-address.component.html deleted file mode 100644 index e91808eed..000000000 --- a/src/app/clients/edit-address/edit-address.component.html +++ /dev/null @@ -1,64 +0,0 @@ -
- - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - - -
- - {{item?.name}} -
-
-
- - -
- - {{item?.name}} -
-
-
- - - - - - -
- -
-
- - -
- - -
-
-
diff --git a/src/app/clients/edit-address/edit-address.component.scss b/src/app/clients/edit-address/edit-address.component.scss deleted file mode 100644 index 15edfa57c..000000000 --- a/src/app/clients/edit-address/edit-address.component.scss +++ /dev/null @@ -1,13 +0,0 @@ -.example-card { - width: 500px; - } - - .example-form { - min-width: 150px; - max-width: 500px; - width: 100%; - } - - .example-full-width { - width: 100%; - } \ No newline at end of file diff --git a/src/app/clients/edit-address/edit-address.component.spec.ts b/src/app/clients/edit-address/edit-address.component.spec.ts deleted file mode 100644 index 7e9277a5a..000000000 --- a/src/app/clients/edit-address/edit-address.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { EditAddressComponent } from './edit-address.component'; - -describe('EditAddressComponent', () => { - let component: EditAddressComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ EditAddressComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(EditAddressComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/edit-address/edit-address.component.ts b/src/app/clients/edit-address/edit-address.component.ts deleted file mode 100644 index 159cd10dc..000000000 --- a/src/app/clients/edit-address/edit-address.component.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Params } from '@angular/router'; -import { Subscription } from 'rxjs'; -import { NgForm } from '@angular/forms'; -import { Router } from '@angular/router'; -import { FormControl } from '@angular/forms'; -import { ClientsService } from 'app/clients/clients.service'; - -@Component({ - selector: 'mifosx-app-edit-address', - templateUrl: './edit-address.component.html', - styleUrls: ['./edit-address.component.scss'] -}) -export class EditAddressComponent implements OnInit { - - id: number = undefined; - paramsSubscription: Subscription; - clientAddress: any = undefined; - clientAddressK: any = undefined; - value: any = undefined; - mymodel: any = undefined; - addressTypeId: number = undefined; - addressId: number = undefined; - addressStateId: any = undefined; - addressCountryId: any = undefined; - random: any = undefined; - - address: any = undefined; - - form: any = undefined; - - constructor(private route: ActivatedRoute, private clientService: ClientsService) {} - - @ViewChild('f') addressForm: NgForm; - - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - this.addressTypeId = +params['addressTypeId']; - this.addressId = +params['addressId']; - - console.log(this.addressId); - console.log(this.addressTypeId); - } - ); - this.getClientAddressTemplate(); - this.getClientAddress(this.id, this.addressId); - } - - getClientAddressTemplate() { - this.clientService.getClientAddressTemplate() - .subscribe( - (res => { - this.clientAddress = res; - // console.log(res); - }) - ); - } - - getClientAddress(id: any, addressId: any) { - this.clientService.getClientAddress(id) - .subscribe( - (res => { - this.form = {}; - this.clientAddressK = res; - this.clientAddressK.forEach((item: any) => { - if (item.addressId === addressId) { - this.form.street = item.street; - this.form.addressLine1 = item.addressLine1; - this.form.addressLine2 = item.addressLine2; - this.form.addressLine3 = item.addressLine3; - this.form.city = item.city; - this.form.stateProvinceId = item.stateProvinceId; - this.form.countryId = item.countryId; - this.form.postalCode = item.postalCode; - } - }); - }) - ); - } - - onSubmit() { - this.address = {}; - this.address.addressId = this.addressId; - this.address.street = this.form.street; - this.address.addressLine1 = this.form.addressLine1; - this.address.addressLine2 = this.form.addressLine2; - this.address.addressLine3 = this.form.addressLine3; - this.address.city = this.form.city; - this.address.stateProvinceId = this.form.stateProvinceId; - this.address.countryId = this.form.countryId; - this.address.postalCode = this.form.postalCode; - this.address.locale = 'en'; - - console.log(this.address); - - this.clientService.putClientAddress(this.id, this.address, this.addressTypeId) - .subscribe( - (res => { - return true; - }) - ); - } -} - diff --git a/src/app/clients/upload-document/upload-document.component.html b/src/app/clients/upload-document/upload-document.component.html deleted file mode 100644 index 2cd710a70..000000000 --- a/src/app/clients/upload-document/upload-document.component.html +++ /dev/null @@ -1,43 +0,0 @@ -
- - - - - -
- - - - -
- - - - - - - - -
- - - {{ inputFile.value }} -
- - - - -
- -
-
- - -
- - -
-
-
- diff --git a/src/app/clients/upload-document/upload-document.component.scss b/src/app/clients/upload-document/upload-document.component.scss deleted file mode 100644 index 4ad60da3c..000000000 --- a/src/app/clients/upload-document/upload-document.component.scss +++ /dev/null @@ -1,17 +0,0 @@ - - - .example-form { - min-width: 150px; - max-width: 500px; - width: 100%; - } - - .example-full-width { - width: 100%; - padding:5px 3px; - } - - .mat-raised-button{ - margin-left:10px; - margin-top:10px; - } \ No newline at end of file diff --git a/src/app/clients/upload-document/upload-document.component.spec.ts b/src/app/clients/upload-document/upload-document.component.spec.ts deleted file mode 100644 index c6c107792..000000000 --- a/src/app/clients/upload-document/upload-document.component.spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -/* tslint:disable:no-unused-variable */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { By } from '@angular/platform-browser'; -import { DebugElement } from '@angular/core'; - -import { UploadDocumentComponent } from './upload-document.component'; - -describe('UploadDocumentComponent', () => { - let component: UploadDocumentComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ UploadDocumentComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(UploadDocumentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/upload-document/upload-document.component.ts b/src/app/clients/upload-document/upload-document.component.ts deleted file mode 100644 index a3d263864..000000000 --- a/src/app/clients/upload-document/upload-document.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Params } from '@angular/router'; -import { Subscription } from 'rxjs'; -import { NgForm } from '@angular/forms'; -import { Router } from '@angular/router'; - -import { ClientsService } from 'app/clients/clients.service'; - -@Component({ - selector: 'mifosx-app-upload-document', - templateUrl: './upload-document.component.html', - styleUrls: ['./upload-document.component.scss'] -}) -export class UploadDocumentComponent implements OnInit { - - id: number = undefined; - paramsSubscription: Subscription; - - document: any = undefined; - - - filename: any = undefined; - constructor(private route: ActivatedRoute, private clientService: ClientsService) {} - - @ViewChild('f') documentForm: NgForm; - - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - } - ); - console.log(this.id); - // this.getClientIdentifierTemplate(this.id); - } - - - - onFileSelected($event: any) { - this.filename = $event.target.files[0].name; - console.log(this.filename); - } - - onSubmit() { - this.document = {}; - this.document.description = this.documentForm.value.description; - this.document.name = this.documentForm.value.name; - this.document.filename = this.filename; - console.log(this.filename); - - this.clientService.postClientDocument(this.id, this.document) - .subscribe( - (res => { - return true; - }) - ); - this.documentForm.reset(); - } -} - diff --git a/src/app/clients/view-client/view-client-component-dialog.html b/src/app/clients/view-client/view-client-component-dialog.html deleted file mode 100644 index 9feb3e42c..000000000 --- a/src/app/clients/view-client/view-client-component-dialog.html +++ /dev/null @@ -1,8 +0,0 @@ -

Install Angular

- - Photo of a Shiba Inu - - - - - diff --git a/src/app/clients/view-client/view-client.component.html b/src/app/clients/view-client/view-client.component.html deleted file mode 100644 index cb49a8bf8..000000000 --- a/src/app/clients/view-client/view-client.component.html +++ /dev/null @@ -1,400 +0,0 @@ -
- - -
-
- - - -

{{clientInfo?.displayName}}

-
- -
- Photo of a Shiba Inu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name:{{clientInfo?.displayName}}
Activation date{{clientInfo?.activationDate}}
Member{{clientInfo?.groupNames}}
Is Staff{{clientInfo?.isStaff}}
Mobile No{{clientInfo?.mobileNo}}
Gender{{clientInfo?.gender.name }}
Client Type{{clientInfo?.clientType.name}}
Client Classification{{clientInfo?.clientClassification.name}}
Date of Birth{{clientInfo?.dateOfBirth}}
-
- -
-
-
-
- - - - Loan Account Overview - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account #ng {{row.accountNo}} Loan Account {{row.productName}} Original Loan {{row.originalLoan}} Loan Balance {{row.loanBalance}} Amount Paid {{row.amountPaid}} Type {{row.loanType.value}}
- -
- - -
- - Savings Account Overview - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account # {{row.accountNo}} Saving Account {{row.productName}} Last Active {{row.lastActiveTransactionDate}} Balance {{row.accountBalance}}
- - -
- - - - -
- - Shares Account Overview - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Account # {{row.accountNo}} Share Account# {{row.productName}} Approved Shares {{row.totalApprovedShares}} Pending for Approval Shares {{row.totalPendingForApprovalShares}}
- - -
-
-
-
- -
- -
-
-
- - -
- {{item?.addressType}} -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Street{{item?.street}}
Address Line 1 {{item?.addressLine1}}
Address Line 2 {{item?.addressLine2}}
Address Line 3 {{item?.addressLine3}}
City {{item?.city}}
State / Province - {{item?.stateName}}
Country - {{item?.countryName}}
Postal Code {{item?.postalCode}}
is Active ? {{item?.isActive}}
-
-
- - - - -
-
-
-
- -
-
-
- - - - -
- -
- -
-
- - {{item.note}} - -
- -
-
- -
- - - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ID {{row.id}} Description {{row.description}} Type {{row.documentType.name}} Status {{row.status}} Actions - -
-
-
- - -
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Name {{row.name}} Description {{row.description}} Type {{row.fileName}} Actions - - - -
-
-
- -
- - -
-

User with ID {{ id }} loaded.

- diff --git a/src/app/clients/view-client/view-client.component.scss b/src/app/clients/view-client/view-client.component.scss deleted file mode 100644 index e319f0297..000000000 --- a/src/app/clients/view-client/view-client.component.scss +++ /dev/null @@ -1,182 +0,0 @@ -.example-card { - // width:40%; -} - -.address-card { - width: 470px; -} - -.example-header-image { - background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg'); - background-size: cover; -} - -.border { - border: 0.5px solid #DDD; - border-right-width: 0; - border-left-width: 0; - border-radius: 0; -} - -th { - white-space: nowrap; - overflow: hidden; - text-align: left; - padding: 6px 3px 6px; -} - -tr { - word-wrap: break-word; - padding: 6px 0px 6px; -} - -/* .mat-row:nth-child(even) { - background-color: #fafafa; -} - -.mat-header-row { - background-color: #fafafa; -} */ - -table { - width: 100%; -} - -.mat-form-field { - font-size: 14px; - width: 100%; -} - -td, -th { - width: 15%; -} - -.mat-tab-label { - // font-weight: bold; -} - -.mat-tab-label.mat-tab-label-active {} - -.mat-toolbar { - font-size: 18px; - background-color: #fafafa; -} - -// css horizontal table with responsiveness -.custom-table { - table { - width: 100%; - margin: 0; - padding: 0; - border-collapse: collapse; - border-spacing: 0; - } - table tr { - border: 1px solid #ddd; - border-right-width: 0; - border-left-width: 0; - padding: 5px; - } - table th { - padding: 10px; - text-align: middle; - } - table td { - padding: 10px; - text-align: middle; - } - table th { - text-transform: uppercase; - font-size: 14px; - letter-spacing: 1px; - } - tr:nth-child(even) { - // background-color: #fafafa; - } - @media screen and (max-width: 600px) { - table { - border: 0; - } - table thead { - display: none; - } - table tr { - margin-bottom: 10px; - display: block; - border-bottom: 2px solid #ddd; - } - table td { - display: block; - text-align: left; - font-size: 13px; - border-bottom: 1px dotted #ccc; - } - table td:last-child { - border-bottom: 0; - } - table td:before { - content: attr(data-label); - float: left; - text-transform: uppercase; - font-weight: bold; - } - table th { - border: 0px; - } - } -} - -// css vertical table with responsiveness -.document-table { - table { - border: 1px solid #ccc; - width: 100%; - margin: 0; - padding: 0; - border-collapse: collapse; - border-spacing: 0; - } - table tr { - border: 1px solid #ddd; - padding: 5px; - } - table th, - table td { - padding: 10px; - text-align: center; - } - table th { - text-transform: uppercase; - font-size: 14px; - letter-spacing: 1px; - } - @media screen and (max-width: 600px) { - table { - border: 0; - } - table thead { - display: none; - } - table tr { - margin-bottom: 10px; - display: block; - border-bottom: 2px solid #ddd; - } - table td { - display: block; - text-align: right; - font-size: 13px; - border-bottom: 1px dotted #ccc; - } - table td:last-child { - border-bottom: 0; - } - table td:before { - content: attr(data-label); - float: left; - text-transform: uppercase; - font-weight: bold; - } - } -} diff --git a/src/app/clients/view-client/view-client.component.spec.ts b/src/app/clients/view-client/view-client.component.spec.ts deleted file mode 100644 index 8b02d3f2e..000000000 --- a/src/app/clients/view-client/view-client.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ViewClientComponent } from './view-client.component'; - -describe('CreateClientComponent', () => { - let component: ViewClientComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ViewClientComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ViewClientComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/view-client/view-client.component.ts b/src/app/clients/view-client/view-client.component.ts deleted file mode 100644 index 77467c33d..000000000 --- a/src/app/clients/view-client/view-client.component.ts +++ /dev/null @@ -1,262 +0,0 @@ -import { ClientsService } from 'app/clients/clients.service'; -import { Component, OnInit, OnDestroy, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Params } from '@angular/router'; -import { Subscription } from 'rxjs'; -import { DataSource } from '@angular/cdk/collections'; -import { MatPaginator, MatSort, MatTableDataSource, MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; -import { NgForm } from '@angular/forms'; -import { Router } from '@angular/router'; -@Component({ - selector: 'mifosx-view-client', - templateUrl: './view-client.component.html', - styleUrls: ['./view-client.component.scss'], - encapsulation: ViewEncapsulation.None -}) -export class ViewClientComponent implements OnInit, OnDestroy { - notes: any = undefined; - id: number = undefined; - loanAccounts: any = undefined; - savingsAccounts: any = undefined; - shareAccounts: any = undefined; - upcomingCharges: any = undefined; - clientInfo: any = undefined; - paramsSubscription: Subscription; - post: any = []; - clientAddress: any = undefined; - allNotes: any = undefined; - clientIdentifiers: any = undefined; - clientDocuments: any = undefined; - docId: any = undefined; - private LOAN_DATA: any = undefined; - private SAVINGS_DATA: any = undefined; - private SHARES_DATA: any = undefined; - displayedLoanColumns = ['account', 'loanAccount', 'originalLoan', 'loanBalance', 'amountPaid', 'type']; - displayedSavingsColumns = ['account', 'savingsAccount', 'lastActive', 'balance']; - displayedSharesColumns = ['account', 'shareAccount', 'approvedShares', 'pending']; - displayedIdentifierColumns = ['id', 'description', 'type', 'status', 'actions']; - displayedDocumentColumns = ['name', 'description', 'filename', 'actions']; - - dataSourceLoan = new MatTableDataSource([]); - dataSourceSavings = new MatTableDataSource([]); - dataSourceShares = new MatTableDataSource([]); - dataSourceIdentifiers = new MatTableDataSource([]); - dataSourceDocuments = new MatTableDataSource([]); - - @ViewChild('f') noteForm: NgForm; - @ViewChild(MatPaginator) paginator: MatPaginator; - @ViewChild('loanPaginator') loanPaginator: MatPaginator; - @ViewChild('savingsPaginator') savingsPaginator: MatPaginator; - @ViewChild('sharesPaginator') sharesPaginator: MatPaginator; - @ViewChild(MatSort) sort: MatSort; - - constructor(private route: ActivatedRoute, private clientService: ClientsService, - private router: Router, public dialog: MatDialog) {} - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - } - ); - - this.getClientId(this.id); - this.getClientAccounts(this.id); - this.getClientCharges(this.id); - this.getClientAddress(this.id); - this.getClientNotes(this.id); - this.getClientIdentifier(this.id); - this.getClientDocuments(this.id); - } - - getClientId(id: any) { - this.clientService.getClientId(id) - .subscribe( - (res => { - const groupArray = new Array; - this.clientInfo = res; - this.clientInfo.dateOfBirth = this.clientInfo.dateOfBirth.reverse().join('-'); - this.clientInfo.activationDate = this.clientInfo.activationDate.reverse().join('-'); - - this.clientInfo.groups.forEach(function (item: any) { - groupArray.push(item.name); - }); - this.clientInfo.groupNames = groupArray.join('|'); - - }) - ); - } - - getClientAccounts(id: any) { - this.clientService.getClientAccounts(id) - .subscribe( - (res => { - this.loanAccounts = res['loanAccounts']; - this.savingsAccounts = res['savingsAccounts']; - this.shareAccounts = res['shareAccounts']; - this.LOAN_DATA = this.loanAccounts; - this.SAVINGS_DATA = this.savingsAccounts; - this.SHARES_DATA = this.shareAccounts; - this.dataSourceLoan = new MatTableDataSource(this.LOAN_DATA); - this.dataSourceSavings = new MatTableDataSource(this.SAVINGS_DATA); - this.dataSourceShares = new MatTableDataSource(this.SHARES_DATA); - this.dataSourceLoan.paginator = this.loanPaginator; - this.dataSourceSavings.paginator = this.savingsPaginator; - this.dataSourceShares.paginator = this.sharesPaginator; - this.dataSourceLoan.sort = this.sort; - this.dataSourceSavings.sort = this.sort; - this.dataSourceShares.sort = this.sort; - - }) - ); - } - - getClientCharges(id: any) { - this.clientService.getClientCharges(id) - .subscribe( - (res => { - this.upcomingCharges = res['pageItems']; - }) - ); - } - - getClientAddress(id: any) { - this.clientService.getClientAddress(id) - .subscribe( - (res => { - this.clientAddress = res; - }) - ); - } - - getClientNotes(id: any) { - this.clientService.getClientNote(id) - .subscribe( - (res => { - this.allNotes = res; - }) - ); - } - - getClientIdentifier(id: any) { - this.clientService.getClientIdentifiers(id) - .subscribe( - (res => { - this.clientIdentifiers = res; - this.clientIdentifiers.forEach(function (item: any) { - item.status = item.status.split('.')[1]; - }); - - this.dataSourceIdentifiers = new MatTableDataSource(this.clientIdentifiers); - this.dataSourceIdentifiers.paginator = this.paginator; - this.dataSourceIdentifiers.sort = this.sort; - }) - ); - } - - getClientDocuments(id: any) { - this.clientService.getClientDocuments(id) - .subscribe( - (res => { - this.clientDocuments = res; - this.docId = res.id; - this.dataSourceDocuments = new MatTableDataSource(res); - this.dataSourceDocuments.paginator = this.paginator; - this.dataSourceDocuments.sort = this.sort; - }) - ); - - } - onSubmit() { - // this.submitted = true; - this.notes = {}; - // const d = new Date(); - this.notes.note = this.noteForm.value.clientnotes; - // this.notes.createdOn = d; - console.log(this.notes); - this.clientService.postClientNote(this.id, this.notes) - .subscribe( - (res => { - this.getClientNotes(this.id); - return true; - }) - ); - this.noteForm.reset(); - - } - - deleteClientIdentifier(id: number, identifierId: number) { - this.clientService.deleteClientIdentifier(id, identifierId) - .subscribe( - (res => { - this.getClientIdentifier(this.id); - return true; - }) - ); - } - deleteClientDocuments(id: number, docId: number) { - console.log(docId); - this.clientService.deleteClientDocuments(id, docId) - .subscribe( - (res => { - this.getClientDocuments(this.id); - return true; - }) - ); - } - -/* openDialog() { - const dialogRef = this.dialog.open(ViewClientDialogComponent, { - height: '350px' - }); - - dialogRef.afterClosed().subscribe(result => { - console.log(`Dialog result: ${result}`); - }); - } - */ - ngOnDestroy() { - this.paramsSubscription.unsubscribe(); - } - -} - - -/* -@Component({ - selector: 'mifosx-view-client-component-dialog', - templateUrl: 'view-client-component-dialog.html', -}) -export class ViewClientDialogComponent implements OnInit, OnDestroy { - - paramsSubscription: Subscription; - id: any = undefined; - clientDocuments: any = undefined; - constructor(private route: ActivatedRoute, private clientService: ClientsService, - private router: Router, public dialog: MatDialog) {} - - ngOnInit() { - this.paramsSubscription = this.route.params - .subscribe( - (params: Params) => { - this.id = params['id']; - } - ); - this.getClientDocuments(this.id); - } - - getClientDocuments(id: any) { - this.clientService.getClientDocuments(id) - .subscribe( - (res => { - this.clientDocuments = res; - }) - ); - } - - ngOnDestroy() { - this.paramsSubscription.unsubscribe(); - } - -} - */ diff --git a/src/app/clients/view-loan/view-loan.component.html b/src/app/clients/view-loan/view-loan.component.html deleted file mode 100644 index 744d7bdab..000000000 --- a/src/app/clients/view-loan/view-loan.component.html +++ /dev/null @@ -1,354 +0,0 @@ - diff --git a/src/app/clients/view-loan/view-loan.component.scss b/src/app/clients/view-loan/view-loan.component.scss deleted file mode 100644 index c10ea5c95..000000000 --- a/src/app/clients/view-loan/view-loan.component.scss +++ /dev/null @@ -1,15 +0,0 @@ -// .btn-flat { -// filter:progid:DXImageTransform.Microsoft.Gradient(enabled='false'); -// -webkit-box-shadow: none; -// -moz-box-shadow: none; -// box-shadow: none; -// background-image:none; -// border:0; -// } - -// .btn { -// border: 1px solid #DDD; -// border-right-width: 0; -// border-radius: 0; -// } - diff --git a/src/app/clients/view-loan/view-loan.component.spec.ts b/src/app/clients/view-loan/view-loan.component.spec.ts deleted file mode 100644 index 8a5d2b13c..000000000 --- a/src/app/clients/view-loan/view-loan.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ViewLoanComponent } from './view-loan.component'; - -describe('ViewLoanComponent', () => { - let component: ViewLoanComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ ViewLoanComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(ViewLoanComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/clients/view-loan/view-loan.component.ts b/src/app/clients/view-loan/view-loan.component.ts deleted file mode 100644 index c348a7aa0..000000000 --- a/src/app/clients/view-loan/view-loan.component.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'mifosx-view-loan', - templateUrl: './view-loan.component.html', - styleUrls: ['./view-loan.component.scss'] -}) -export class ViewLoanComponent implements OnInit { - - constructor() { } - - ngOnInit() { - } - -}