feat: clients identities page
- add identities-tab component - add upload-document-dialog component - remove content-type header from authentication interceptor fixes: #261
This commit is contained in:
committed by
Abhay Chawla
parent
c33995ba77
commit
d84dbf50ed
@@ -14,6 +14,7 @@ import { GeneralTabComponent } from './clients-view/general-tab/general-tab.comp
|
|||||||
import { FamilyMembersTabComponent } from './clients-view/family-members-tab/family-members-tab.component';
|
import { FamilyMembersTabComponent } from './clients-view/family-members-tab/family-members-tab.component';
|
||||||
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
||||||
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
||||||
|
import { IdentitiesTabComponent } from './clients-view/identities-tab/identities-tab.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { ClientsResolver } from './common-resolvers/clients.resolver';
|
import { ClientsResolver } from './common-resolvers/clients.resolver';
|
||||||
@@ -24,6 +25,7 @@ import { ClientSummaryResolver } from './common-resolvers/client-summary.resolve
|
|||||||
import { ClientFamilyMembersResolver } from './common-resolvers/client-family-members.resolver';
|
import { ClientFamilyMembersResolver } from './common-resolvers/client-family-members.resolver';
|
||||||
import { ClientFamilyMemberResolver } from './common-resolvers/client-family-member.resolver';
|
import { ClientFamilyMemberResolver } from './common-resolvers/client-family-member.resolver';
|
||||||
import { ClientTemplateResolver } from './common-resolvers/client-template.resolver';
|
import { ClientTemplateResolver } from './common-resolvers/client-template.resolver';
|
||||||
|
import { ClientIdentitiesResolver } from './common-resolvers/client-identities.resolver';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
Route.withShell([{
|
Route.withShell([{
|
||||||
@@ -83,6 +85,13 @@ const routes: Routes = [
|
|||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'identities',
|
||||||
|
component: IdentitiesTabComponent,
|
||||||
|
resolve: {
|
||||||
|
clientIdentities: ClientIdentitiesResolver
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -102,7 +111,8 @@ const routes: Routes = [
|
|||||||
ClientSummaryResolver,
|
ClientSummaryResolver,
|
||||||
ClientFamilyMembersResolver,
|
ClientFamilyMembersResolver,
|
||||||
ClientFamilyMemberResolver,
|
ClientFamilyMemberResolver,
|
||||||
ClientTemplateResolver
|
ClientTemplateResolver,
|
||||||
|
ClientIdentitiesResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ClientsRoutingModule { }
|
export class ClientsRoutingModule { }
|
||||||
|
|||||||
@@ -44,12 +44,18 @@
|
|||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<nav mat-tab-nav-bar>
|
<nav mat-tab-nav-bar>
|
||||||
<a mat-tab-link [routerLink]="['./general']" routerLinkActive #general="routerLinkActive" [active]="general.isActive">
|
<a mat-tab-link [routerLink]="['./general']" routerLinkActive #general="routerLinkActive"
|
||||||
|
[active]="general.isActive">
|
||||||
General
|
General
|
||||||
</a>
|
</a>
|
||||||
<a mat-tab-link [routerLink]="['./family-members']" routerLinkActive #familyMembers="routerLinkActive" [active]="familyMembers.isActive">
|
<a mat-tab-link [routerLink]="['./family-members']" routerLinkActive #familyMembers="routerLinkActive"
|
||||||
|
[active]="familyMembers.isActive">
|
||||||
Family Members
|
Family Members
|
||||||
</a>
|
</a>
|
||||||
|
<a mat-tab-link [routerLink]="['./identities']" routerLinkActive #identities="routerLinkActive"
|
||||||
|
[active]="identities.isActive">
|
||||||
|
Identities
|
||||||
|
</a>
|
||||||
</nav>
|
</nav>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<div class="tab-container mat-typography">
|
||||||
|
|
||||||
|
<!-- Identities Table -->
|
||||||
|
|
||||||
|
<h3>Identities</h3>
|
||||||
|
|
||||||
|
<button mat-raised-button class="f-right" color="primary">
|
||||||
|
<fa-icon icon="plus"></fa-icon> Add
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<table mat-table #identifiersTable [dataSource]="clientIdentities" class="mat-elevation-z1">
|
||||||
|
|
||||||
|
<ng-container matColumnDef="id">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Id </th>
|
||||||
|
<td mat-cell *matCellDef="let identity">
|
||||||
|
{{identity.id}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="description">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Description </th>
|
||||||
|
<td mat-cell *matCellDef="let identity"> {{identity.description}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="type">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> type </th>
|
||||||
|
<td mat-cell *matCellDef="let identity"> {{identity.documentType.name}}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="documents">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Identity Documents </th>
|
||||||
|
<td mat-cell *matCellDef="let identity">
|
||||||
|
<div *ngFor="let document of identity.documents">
|
||||||
|
{{document.name}}
|
||||||
|
<fa-icon icon="cloud-download-alt" (click)="download(document.parentEntityId,document.id)"></fa-icon>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="status">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Status </th>
|
||||||
|
<td mat-cell *matCellDef="let identity">
|
||||||
|
{{(identity.status==='clientIdentifierStatusType.active')?'active':'inactive'}} </td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<ng-container matColumnDef="actions">
|
||||||
|
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||||
|
<td mat-cell *matCellDef="let identity; let i = index">
|
||||||
|
<button class="identity-action-button" mat-raised-button color="primary" (click)="uploadDocument(i,identity.id)">
|
||||||
|
<fa-icon icon="cloud-upload-alt"></fa-icon>
|
||||||
|
</button>
|
||||||
|
<button class="identity-action-button" mat-raised-button color="warn" (click)="deleteIdentifier(identity.clientId,identity.id,index)">
|
||||||
|
<fa-icon icon="times"></fa-icon>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="identitiesColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: identitiesColumns;"></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
.tab-container {
|
||||||
|
padding: 1%;
|
||||||
|
margin: 1%;
|
||||||
|
|
||||||
|
h3{
|
||||||
|
margin:1% auto;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
.identity-action-button{
|
||||||
|
min-width: 26px;
|
||||||
|
padding: 0 6px;
|
||||||
|
margin: 4px;
|
||||||
|
line-height: 25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { IdentitiesTabComponent } from './identities-tab.component';
|
||||||
|
|
||||||
|
describe('IdentitiesTabComponent', () => {
|
||||||
|
let component: IdentitiesTabComponent;
|
||||||
|
let fixture: ComponentFixture<IdentitiesTabComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ IdentitiesTabComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(IdentitiesTabComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { MatTable } from '@angular/material/table';
|
||||||
|
import { MatDialog } from '@angular/material';
|
||||||
|
|
||||||
|
/** Custom Components */
|
||||||
|
import { UploadDocumentDialogComponent } from '../upload-document-dialog/upload-document-dialog.component';
|
||||||
|
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ClientsService } from '../../clients.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-identities-tab',
|
||||||
|
templateUrl: './identities-tab.component.html',
|
||||||
|
styleUrls: ['./identities-tab.component.scss']
|
||||||
|
})
|
||||||
|
export class IdentitiesTabComponent implements OnInit {
|
||||||
|
@ViewChild('identifiersTable') identifiersTable: MatTable<Element>;
|
||||||
|
identitiesColumns: string[] = ['id', 'description', 'type', 'documents', 'status', 'actions'];
|
||||||
|
clientIdentities: any;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute,
|
||||||
|
public dialog: MatDialog,
|
||||||
|
private clientService: ClientsService) {
|
||||||
|
this.route.data.subscribe((data: { clientIdentities: any }) => {
|
||||||
|
this.clientIdentities = data.clientIdentities;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
download(parentEntityId: string, documentId: string) {
|
||||||
|
this.clientService.downloadClientIdentificationDocument(parentEntityId, documentId).subscribe(res => {
|
||||||
|
const url = window.URL.createObjectURL(res);
|
||||||
|
window.open(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteIdentifier(clientId: string, identifierId: string, index: number) {
|
||||||
|
const deleteFamilyMemberDialogRef = this.dialog.open(DeleteDialogComponent, {
|
||||||
|
data: { deleteContext: `identifier id:${identifierId}` }
|
||||||
|
});
|
||||||
|
deleteFamilyMemberDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response.delete) {
|
||||||
|
this.clientService.deleteClientIdentifier(clientId, identifierId).subscribe(res => {
|
||||||
|
this.clientIdentities.splice(index, 1);
|
||||||
|
this.identifiersTable.renderRows();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadDocument(index: number, identifierId: string) {
|
||||||
|
const uploadDocumentDialogRef = this.dialog.open(UploadDocumentDialogComponent);
|
||||||
|
uploadDocumentDialogRef.afterClosed().subscribe((dialogResponse: any) => {
|
||||||
|
if (dialogResponse) {
|
||||||
|
const formData: FormData = new FormData;
|
||||||
|
formData.append('name', dialogResponse.fileName);
|
||||||
|
formData.append('file', dialogResponse.file);
|
||||||
|
this.clientService.uploadClientIdentifierDocument(identifierId, formData).subscribe((res: any) => {
|
||||||
|
this.clientIdentities[index].documents.push({
|
||||||
|
id: res.resourceId,
|
||||||
|
parentEntityType: 'client_identifiers',
|
||||||
|
parentEntityId: identifierId,
|
||||||
|
name: dialogResponse.fileName,
|
||||||
|
fileName: dialogResponse.file.fileName
|
||||||
|
});
|
||||||
|
this.identifiersTable.renderRows();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+22
@@ -0,0 +1,22 @@
|
|||||||
|
<h1 mat-dialog-title>Upload Client Documents</h1>
|
||||||
|
<div>
|
||||||
|
<form [formGroup]="uploadDocumentForm" fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>File Name</mat-label>
|
||||||
|
<input formControlName="fileName" required matInput />
|
||||||
|
<mat-error *ngIf="uploadDocumentForm.controls.fileName.hasError('required')">
|
||||||
|
File Name is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<input type="file" name="file" (change)="onFileSelect($event)" />
|
||||||
|
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||||
|
<button mat-raised-button color="primary" [disabled]="!uploadDocumentForm.valid"
|
||||||
|
[mat-dialog-close]="uploadDocumentForm.value">Confirm</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UploadDocumentDialogComponent } from './upload-document-dialog.component';
|
||||||
|
|
||||||
|
describe('UploadDocumentDialogComponent', () => {
|
||||||
|
let component: UploadDocumentDialogComponent;
|
||||||
|
let fixture: ComponentFixture<UploadDocumentDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ UploadDocumentDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(UploadDocumentDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
import { Component, OnInit, Inject } from '@angular/core';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-upload-document-dialog',
|
||||||
|
templateUrl: './upload-document-dialog.component.html',
|
||||||
|
styleUrls: ['./upload-document-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class UploadDocumentDialogComponent implements OnInit {
|
||||||
|
/** Upload Document form. */
|
||||||
|
uploadDocumentForm: FormGroup;
|
||||||
|
file: any;
|
||||||
|
uploadDocumentData: any = [];
|
||||||
|
|
||||||
|
constructor(public dialogRef: MatDialogRef<UploadDocumentDialogComponent>,
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
|
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.createUploadDocumentForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the upload Document form.
|
||||||
|
*/
|
||||||
|
createUploadDocumentForm() {
|
||||||
|
this.uploadDocumentForm = this.formBuilder.group({
|
||||||
|
'fileName': ['', Validators.required],
|
||||||
|
'file': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
onFileSelect(event: any) {
|
||||||
|
if (event.target.files.length > 0) {
|
||||||
|
const file = event.target.files[0];
|
||||||
|
this.uploadDocumentForm.get('file').setValue(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -14,6 +14,8 @@ import {PipesModule} from '../pipes/pipes.module';
|
|||||||
import { FamilyMembersTabComponent } from './clients-view/family-members-tab/family-members-tab.component';
|
import { FamilyMembersTabComponent } from './clients-view/family-members-tab/family-members-tab.component';
|
||||||
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
||||||
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
||||||
|
import { IdentitiesTabComponent } from './clients-view/identities-tab/identities-tab.component';
|
||||||
|
import { UploadDocumentDialogComponent } from './clients-view/upload-document-dialog/upload-document-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +35,12 @@ import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edi
|
|||||||
GeneralTabComponent,
|
GeneralTabComponent,
|
||||||
FamilyMembersTabComponent,
|
FamilyMembersTabComponent,
|
||||||
AddFamilyMemberComponent,
|
AddFamilyMemberComponent,
|
||||||
EditFamilyMemberComponent
|
EditFamilyMemberComponent,
|
||||||
|
IdentitiesTabComponent,
|
||||||
|
UploadDocumentDialogComponent
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
UploadDocumentDialogComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
|
|
||||||
|
|||||||
@@ -27,35 +27,64 @@ export class ClientsService {
|
|||||||
getClientData(clientId: string) {
|
getClientData(clientId: string) {
|
||||||
return this.http.get(`/clients/${clientId}`);
|
return this.http.get(`/clients/${clientId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientAccountData(clientId: string) {
|
getClientAccountData(clientId: string) {
|
||||||
return this.http.get(`/clients/${clientId}/accounts`);
|
return this.http.get(`/clients/${clientId}/accounts`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientChargesData(clientId: string) {
|
getClientChargesData(clientId: string) {
|
||||||
const httpParams = new HttpParams().set('pendingPayment', 'true');
|
const httpParams = new HttpParams().set('pendingPayment', 'true');
|
||||||
return this.http.get(`/clients/${clientId}/charges`, { params: httpParams });
|
return this.http.get(`/clients/${clientId}/charges`, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientSummary(clientId: string) {
|
getClientSummary(clientId: string) {
|
||||||
const httpParams = new HttpParams().set('R_clientId', clientId)
|
const httpParams = new HttpParams().set('R_clientId', clientId)
|
||||||
.set('genericResultSet', 'false');
|
.set('genericResultSet', 'false');
|
||||||
return this.http.get(`/runreports/ClientSummary`, { params: httpParams });
|
return this.http.get(`/runreports/ClientSummary`, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientProfileImage(clientId: string) {
|
getClientProfileImage(clientId: string) {
|
||||||
const httpParams = new HttpParams().set('maxHeight', '150');
|
const httpParams = new HttpParams().set('maxHeight', '150');
|
||||||
return this.http.get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
|
return this.http.get(`/clients/${clientId}/images`, { params: httpParams, responseType: 'text' });
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientFamilyMembers(clientId: string) {
|
getClientFamilyMembers(clientId: string) {
|
||||||
return this.http.get(`/clients/${clientId}/familymembers`);
|
return this.http.get(`/clients/${clientId}/familymembers`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientFamilyMember(clientId: string, familyMemberId: string) {
|
getClientFamilyMember(clientId: string, familyMemberId: string) {
|
||||||
return this.http.get(`/clients/${clientId}/familymembers/${familyMemberId}`);
|
return this.http.get(`/clients/${clientId}/familymembers/${familyMemberId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
addFamilyMember(clientId: string, familyMemberData: any) {
|
addFamilyMember(clientId: string, familyMemberData: any) {
|
||||||
return this.http.post(`/clients/${clientId}/familymembers`, familyMemberData);
|
return this.http.post(`/clients/${clientId}/familymembers`, familyMemberData);
|
||||||
}
|
}
|
||||||
|
|
||||||
editFamilyMember(clientId: string, familyMemberId: any, familyMemberData: any) {
|
editFamilyMember(clientId: string, familyMemberId: any, familyMemberData: any) {
|
||||||
return this.http.put(`/clients/${clientId}/familymembers/${familyMemberId}`, familyMemberData);
|
return this.http.put(`/clients/${clientId}/familymembers/${familyMemberId}`, familyMemberData);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteFamilyMember(clientId: string, familyMemberId: string) {
|
deleteFamilyMember(clientId: string, familyMemberId: string) {
|
||||||
return this.http.delete(`/clients/${clientId}/familymembers/${familyMemberId}`);
|
return this.http.delete(`/clients/${clientId}/familymembers/${familyMemberId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getClientIdentifiers(clientId: string) {
|
||||||
|
return this.http.get(`/clients/${clientId}/identifiers`);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteClientIdentifier(clientId: string, identifierId: string) {
|
||||||
|
return this.http.delete(`/clients/${clientId}/identifiers/${identifierId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
getClientIdentificationDocuments(documentId: string) {
|
||||||
|
return this.http.get(`/client_identifiers/${documentId}/documents`);
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadClientIdentificationDocument(parentEntityId: string, documentId: string) {
|
||||||
|
return this.http.get(`/client_identifiers/${parentEntityId}/documents/${documentId}/attachment`, { responseType: 'blob' });
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadClientIdentifierDocument(identifierId: string, documentData: any) {
|
||||||
|
return this.http.post(`/client_identifiers/${identifierId}/documents`, documentData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable, forkJoin, from } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ClientsService } from '../clients.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client Identities resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class ClientIdentitiesResolver implements Resolve<Object> {
|
||||||
|
/**
|
||||||
|
* @param {ClientsService} ClientsService Clients service.
|
||||||
|
*/
|
||||||
|
constructor(private clientsService: ClientsService) { }
|
||||||
|
/**
|
||||||
|
* Returns the Client Identities data.
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
|
const clientId = route.parent.paramMap.get('clientId');
|
||||||
|
let identitiesData: any;
|
||||||
|
return this.clientsService.getClientIdentifiers(clientId).pipe(map((identities: any) => {
|
||||||
|
identitiesData = identities;
|
||||||
|
const docObservable: Observable<any>[] = [];
|
||||||
|
identities.forEach((identity: any) => {
|
||||||
|
docObservable.push(this.clientsService.getClientIdentificationDocuments(identity.id));
|
||||||
|
});
|
||||||
|
forkJoin(docObservable).subscribe(documents => {
|
||||||
|
documents.forEach((document, index) => {
|
||||||
|
identitiesData[index].documents = document;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return identitiesData;
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,7 +11,6 @@ import { environment } from '../../../environments/environment';
|
|||||||
/** Http request options headers. */
|
/** Http request options headers. */
|
||||||
const httpOptions = {
|
const httpOptions = {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
|
||||||
'Fineract-Platform-TenantId': environment.fineractPlatformTenantId
|
'Fineract-Platform-TenantId': environment.fineractPlatformTenantId
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -65,7 +65,11 @@ import {
|
|||||||
faUniversity,
|
faUniversity,
|
||||||
faUserCircle,
|
faUserCircle,
|
||||||
faUsers,
|
faUsers,
|
||||||
faUserShield
|
faUserShield,
|
||||||
|
faDownload,
|
||||||
|
faCloudDownloadAlt,
|
||||||
|
faCloudUploadAlt,
|
||||||
|
faTimes
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
/** Add icons to the library for convenient access in other components. */
|
/** Add icons to the library for convenient access in other components. */
|
||||||
@@ -130,7 +134,11 @@ library.add(
|
|||||||
faUniversity,
|
faUniversity,
|
||||||
faUserCircle,
|
faUserCircle,
|
||||||
faUsers,
|
faUsers,
|
||||||
faUserShield
|
faUserShield,
|
||||||
|
faDownload,
|
||||||
|
faCloudDownloadAlt,
|
||||||
|
faCloudUploadAlt,
|
||||||
|
faTimes
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user