feat: add clients view page
- add client view page - add general tab - add status lookup pipe to store styles based on status - add accounts filter pipe to filter accounts - add status related colors in _color.scss Fixes: #216
This commit is contained in:
committed by
Abhay Chawla
parent
61606b09e9
commit
1916e67062
@@ -0,0 +1,8 @@
|
||||
import { AccountsFilterPipe } from './accounts-filter.pipe';
|
||||
|
||||
describe('AccountsFilterPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new AccountsFilterPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'accountsFilter'
|
||||
})
|
||||
export class AccountsFilterPipe implements PipeTransform {
|
||||
|
||||
transform(accounts: any, type: any, status: any): any {
|
||||
if (accounts) {
|
||||
if (type === 'loan') {
|
||||
if (status === 'closed') {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code === 'loanStatusType.closed.written.off' ||
|
||||
account.status.code === 'loanStatusType.closed.obligations.met' ||
|
||||
account.status.code === 'loanStatusType.closed.reschedule.outstanding.amount' ||
|
||||
account.status.code === 'loanStatusType.withdrawn.by.client' ||
|
||||
account.status.code === 'loanStatusType.rejected');
|
||||
});
|
||||
} else {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code !== 'loanStatusType.closed.written.off' &&
|
||||
account.status.code !== 'loanStatusType.closed.obligations.met' &&
|
||||
account.status.code !== 'loanStatusType.closed.reschedule.outstanding.amount' &&
|
||||
account.status.code !== 'loanStatusType.withdrawn.by.client' &&
|
||||
account.status.code !== 'loanStatusType.rejected');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (type === 'saving') {
|
||||
if (status === 'closed') {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code === 'savingsAccountStatusType.withdrawn.by.applicant' ||
|
||||
account.status.code === 'savingsAccountStatusType.closed' ||
|
||||
account.status.code === 'savingsAccountStatusType.pre.mature.closure' ||
|
||||
account.status.code === 'savingsAccountStatusType.rejected');
|
||||
});
|
||||
} else {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code !== 'savingsAccountStatusType.withdrawn.by.applicant' &&
|
||||
account.status.code !== 'savingsAccountStatusType.closed' &&
|
||||
account.status.code !== 'savingsAccountStatusType.pre.mature.closure' &&
|
||||
account.status.code !== 'savingsAccountStatusType.rejected');
|
||||
});
|
||||
}
|
||||
}
|
||||
if (type === 'share') {
|
||||
if (status === 'closed') {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code === 'shareAccountStatusType.closed' ||
|
||||
account.status.code === 'shareAccountStatusType.rejected');
|
||||
});
|
||||
} else {
|
||||
accounts = accounts.filter((account: any) => {
|
||||
return (account.status.code !== 'shareAccountStatusType.closed' &&
|
||||
account.status.code !== 'shareAccountStatusType.rejected');
|
||||
});
|
||||
}
|
||||
}
|
||||
return accounts;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import { FetchImagePipe } from './fetch-image.pipe';
|
||||
|
||||
describe('FetchImagePipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new FetchImagePipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
import { PipesModule } from './pipes.module';
|
||||
|
||||
describe('PipesModule', () => {
|
||||
let pipesModule: PipesModule;
|
||||
|
||||
beforeEach(() => {
|
||||
pipesModule = new PipesModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(pipesModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { StatusLookupPipe } from './status-lookup.pipe';
|
||||
import { AccountsFilterPipe } from './accounts-filter.pipe';
|
||||
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
declarations: [StatusLookupPipe, AccountsFilterPipe],
|
||||
providers: [StatusLookupPipe, AccountsFilterPipe],
|
||||
exports: [StatusLookupPipe, AccountsFilterPipe]
|
||||
})
|
||||
export class PipesModule { }
|
||||
@@ -0,0 +1,8 @@
|
||||
import { StatusLookupPipe } from './status-lookup.pipe';
|
||||
|
||||
describe('StatusLookupPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new StatusLookupPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'statusLookup'
|
||||
})
|
||||
export class StatusLookupPipe implements PipeTransform {
|
||||
|
||||
transform(status: string): string {
|
||||
const cssClassNameLookup = {
|
||||
'true': 'status-active',
|
||||
'false': 'status-deleted',
|
||||
'Active': 'status-active',
|
||||
'charges.StatusType.active.true': 'status-active',
|
||||
'loanStatusType.submitted.and.pending.approval': 'status-pending',
|
||||
'loanStatusType.approved': 'status-approved',
|
||||
'loanStatusType.active': 'status-active',
|
||||
'loanStatusType.overpaid': 'status-overpaid',
|
||||
'savingsAccountStatusType.submitted.and.pending.approval': 'status-pending',
|
||||
'savingsAccountStatusType.approved': 'status-approved',
|
||||
'savingsAccountStatusType.active': 'status-active',
|
||||
'savingsAccountStatusType.activeInactive': 'status-active-overdue',
|
||||
'savingsAccountStatusType.activeDormant': 'status-active-overdue',
|
||||
'savingsAccountStatusType.matured': 'status-matured',
|
||||
'shareAccountStatusType.submitted.and.pending.approval': 'status-pending',
|
||||
'shareAccountStatusType.approved': 'status-approved',
|
||||
'shareAccountStatusType.active': 'status-active',
|
||||
'shareAccountStatusType.rejected': 'status-rejected',
|
||||
};
|
||||
return cssClassNameLookup[status];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user