From a783f92ce1d2457d0d47b8c79055fccb9f4c2a29 Mon Sep 17 00:00:00 2001 From: Muskan Khedia <36980003+muskankhedia@users.noreply.github.com> Date: Sun, 23 Aug 2020 17:10:24 +0530 Subject: [PATCH] feat: add view checker details page (#1220) Fixes: #1219 --- .../checker-inbox.component.html | 2 +- .../checker-inbox.component.scss | 5 + .../loan-approval/loan-approval.component.ts | 2 +- .../reschedule-loan.component.ts | 1 - .../getCheckerInboxDetail.resolver.ts | 31 ++++++ src/app/tasks/tasks-routing.module.ts | 22 +++- src/app/tasks/tasks.module.ts | 4 +- src/app/tasks/tasks.service.spec.ts | 2 +- src/app/tasks/tasks.service.ts | 8 ++ .../view-checker-inbox.component.html | 102 ++++++++++++++++++ .../view-checker-inbox.component.scss | 29 +++++ .../view-checker-inbox.component.spec.ts | 25 +++++ .../view-checker-inbox.component.ts | 94 ++++++++++++++++ 13 files changed, 319 insertions(+), 8 deletions(-) create mode 100644 src/app/tasks/common-resolvers/getCheckerInboxDetail.resolver.ts create mode 100644 src/app/tasks/view-checker-inbox/view-checker-inbox.component.html create mode 100644 src/app/tasks/view-checker-inbox/view-checker-inbox.component.scss create mode 100644 src/app/tasks/view-checker-inbox/view-checker-inbox.component.spec.ts create mode 100644 src/app/tasks/view-checker-inbox/view-checker-inbox.component.ts diff --git a/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.html b/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.html index e4f357358..4c63e2fe2 100644 --- a/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.html +++ b/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.html @@ -114,7 +114,7 @@ - + diff --git a/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.scss b/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.scss index f41ef3b17..fcc9bf2dd 100644 --- a/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.scss +++ b/src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.scss @@ -17,6 +17,11 @@ .view-details{ cursor: pointer; } + table { + tr.select-row:hover { + cursor: pointer; + } + } } .alert { diff --git a/src/app/tasks/checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component.ts b/src/app/tasks/checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component.ts index ee16d9149..6a5d91076 100644 --- a/src/app/tasks/checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component.ts +++ b/src/app/tasks/checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component.ts @@ -20,7 +20,7 @@ import { SettingsService } from 'app/settings/settings.service'; styleUrls: ['./loan-approval.component.scss'] }) export class LoanApprovalComponent { - // settingsService: SettingsService; + /** Offices Data */ offices: any; /** Loans Data */ diff --git a/src/app/tasks/checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component.ts b/src/app/tasks/checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component.ts index c9d266818..653fc9add 100644 --- a/src/app/tasks/checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component.ts +++ b/src/app/tasks/checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component.ts @@ -12,7 +12,6 @@ import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/conf /** Custom Services */ import { TasksService } from '../../tasks.service'; -import { SettingsRoutingModule } from 'app/settings/settings-routing.module'; import { SettingsService } from 'app/settings/settings.service'; @Component({ diff --git a/src/app/tasks/common-resolvers/getCheckerInboxDetail.resolver.ts b/src/app/tasks/common-resolvers/getCheckerInboxDetail.resolver.ts new file mode 100644 index 000000000..1d6448c59 --- /dev/null +++ b/src/app/tasks/common-resolvers/getCheckerInboxDetail.resolver.ts @@ -0,0 +1,31 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { TasksService } from '../tasks.service'; + +/** + * Checker Inbox Detail resolver. + */ +@Injectable() +export class GetCheckerInboxDetailResolver implements Resolve { + + /** + * @param {TasksService} tasksService Tasks service. + */ + constructor(private tasksService: TasksService) { } + + /** + * Returns the detail data of the checker inbox. + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const checkerId = route.paramMap.get('id'); + return this.tasksService.getCheckerInboxDetail(checkerId); + } + +} diff --git a/src/app/tasks/tasks-routing.module.ts b/src/app/tasks/tasks-routing.module.ts index 1e0fcf573..39f17900c 100644 --- a/src/app/tasks/tasks-routing.module.ts +++ b/src/app/tasks/tasks-routing.module.ts @@ -15,6 +15,7 @@ import { ClientApprovalComponent } from './checker-inbox-and-tasks-tabs/client-a import { LoanApprovalComponent } from './checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component'; import { LoanDisbursalComponent } from './checker-inbox-and-tasks-tabs/loan-disbursal/loan-disbursal.component'; import { RescheduleLoanComponent } from './checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component'; +import { ViewCheckerInboxComponent } from './view-checker-inbox/view-checker-inbox.component'; /** Custom Resolvers */ import { GetMakerCheckers } from './common-resolvers/getmakercheckers.resolver'; @@ -23,6 +24,7 @@ import { GetOffices } from './common-resolvers/getOffices.resolver'; import { GetLoans } from './common-resolvers/getLoans.resolver'; import { GetRescheduleLoans } from './common-resolvers/getRescheduleLoans.resolver'; import { MakerCheckerTemplate } from './common-resolvers/makerCheckerTemplate.resolver'; +import { GetCheckerInboxDetailResolver } from './common-resolvers/getCheckerInboxDetail.resolver'; /** Tasks Routes */ const routes: Routes = [ @@ -39,7 +41,7 @@ const routes: Routes = [ resolve: { makerCheckerResource: GetMakerCheckers, makerCheckerTemplate: MakerCheckerTemplate - }, + } }, { path: 'client-approval', @@ -75,7 +77,20 @@ const routes: Routes = [ } } ] - } + }, + { + path: 'checker-inbox-and-tasks/checker-inbox', + children: [ + { + path: ':id/view', + component: ViewCheckerInboxComponent, + data: { title: extract('View Checker Inbox Component'), routeParamBreadcrumb: 'clientId' }, + resolve: { + checkerInboxDetail: GetCheckerInboxDetailResolver + } + } + ] + }, ]) ]; @@ -88,7 +103,8 @@ const routes: Routes = [ GetOffices, GetLoans, GetRescheduleLoans, - MakerCheckerTemplate + MakerCheckerTemplate, + GetCheckerInboxDetailResolver ] }) export class TasksRoutingModule { } diff --git a/src/app/tasks/tasks.module.ts b/src/app/tasks/tasks.module.ts index f6dc90b8f..fdb908a9d 100644 --- a/src/app/tasks/tasks.module.ts +++ b/src/app/tasks/tasks.module.ts @@ -14,6 +14,7 @@ import { ClientApprovalComponent } from './checker-inbox-and-tasks-tabs/client-a import { LoanApprovalComponent } from './checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component'; import { LoanDisbursalComponent } from './checker-inbox-and-tasks-tabs/loan-disbursal/loan-disbursal.component'; import { RescheduleLoanComponent } from './checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component'; +import { ViewCheckerInboxComponent } from './view-checker-inbox/view-checker-inbox.component'; /** * Tasks Module @@ -31,7 +32,8 @@ import { RescheduleLoanComponent } from './checker-inbox-and-tasks-tabs/reschedu ClientApprovalComponent, LoanApprovalComponent, LoanDisbursalComponent, - RescheduleLoanComponent + RescheduleLoanComponent, + ViewCheckerInboxComponent ], providers: [DatePipe] }) diff --git a/src/app/tasks/tasks.service.spec.ts b/src/app/tasks/tasks.service.spec.ts index 02fd407b7..5bff2e67a 100644 --- a/src/app/tasks/tasks.service.spec.ts +++ b/src/app/tasks/tasks.service.spec.ts @@ -6,7 +6,7 @@ describe('TasksService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: TasksService = TestBed.get(TasksService); + const service: TasksService = TestBed.inject(TasksService); expect(service).toBeTruthy(); }); }); diff --git a/src/app/tasks/tasks.service.ts b/src/app/tasks/tasks.service.ts index 6cecb42e6..083b5c04f 100644 --- a/src/app/tasks/tasks.service.ts +++ b/src/app/tasks/tasks.service.ts @@ -102,4 +102,12 @@ export class TasksService { return this.http.delete(`/makercheckers/${makerCheckerId}`); } + /** + * Get Maker Checker Details. + * @param {makerCheckerId} MakerCheckerId + */ + getCheckerInboxDetail(makerCheckerId: any): Observable { + return this.http.get(`/audits/${makerCheckerId}`); + } + } diff --git a/src/app/tasks/view-checker-inbox/view-checker-inbox.component.html b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.html new file mode 100644 index 000000000..70e2ed824 --- /dev/null +++ b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.html @@ -0,0 +1,102 @@ +
+ + + +
+ +
+ + + + + +
+ +

View Checker Inbox

+ + + +

Details

+ + + +
+ ID: + {{ checkerInboxDetail.id }} +
+ +
+ Status: + {{ checkerInboxDetail.processingResult }} +
+ +
+ User: + {{ checkerInboxDetail.maker }} +
+ +
+ Action: + {{ checkerInboxDetail.actionName }} +
+ +
+ Entity: + {{ checkerInboxDetail.entityName }} +
+ +
+ Resource ID: + {{ checkerInboxDetail.resourceId }} +
+ +
+ Date: + {{ checkerInboxDetail.madeOnDate | date}} +
+ +
+ Office: + {{ checkerInboxDetail.officeName }} +
+ +
+ Savings Account Number: + {{ checkerInboxDetail.savingsAccountNo }} +
+ +
+ {{ checkerInboxDetail.groupLevelName }} + {{ checkerInboxDetail.groupName }} +
+ + + +

Command

+ + + + + +
+ {{ json.key }}: + {{ json.value }} +
+ +
+ +
+ +
+ +
+ +
+ +
diff --git a/src/app/tasks/view-checker-inbox/view-checker-inbox.component.scss b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.scss new file mode 100644 index 000000000..d36e60ebc --- /dev/null +++ b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.scss @@ -0,0 +1,29 @@ +.mat-elevation-z1 { + margin: 1em 0 1.5em 0; +} + +h2, h3, h4 { + margin: 0; + font-weight: 500; +} + +span { + margin: 0.5em 0; +} + +.margin-t { + margin-top: 1em; +} + +mat-divider { + margin: 0 0 0.5em 0; +} + +.mat-raised-button.mat-success { + color: #fff; + background-color: #008000ab; +} +.mat-raised-button.mat-reject { + color: #fff; + background-color: #FFCA00; +} diff --git a/src/app/tasks/view-checker-inbox/view-checker-inbox.component.spec.ts b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.spec.ts new file mode 100644 index 000000000..6aa8883bd --- /dev/null +++ b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewCheckerInboxComponent } from './view-checker-inbox.component'; + +describe('ViewCheckerInboxComponent', () => { + let component: ViewCheckerInboxComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewCheckerInboxComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewCheckerInboxComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/tasks/view-checker-inbox/view-checker-inbox.component.ts b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.ts new file mode 100644 index 000000000..50349e9fa --- /dev/null +++ b/src/app/tasks/view-checker-inbox/view-checker-inbox.component.ts @@ -0,0 +1,94 @@ +/** Angular Imports */ +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import * as _ from 'lodash'; +import { MatDialog } from '@angular/material/dialog'; + +/** Custom Services */ +import { TasksService } from '../tasks.service'; + +/** Dialog Components */ +import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component'; + +@Component({ + selector: 'mifosx-view-checker-inbox', + templateUrl: './view-checker-inbox.component.html', + styleUrls: ['./view-checker-inbox.component.scss'] +}) +export class ViewCheckerInboxComponent { + + /** Checker Inbox Details Data */ + checkerInboxDetail: any; + /** JsonData */ + jsondata: any; + /** Checks if there is any object or not in jsondata */ + displayJSONData = false; + + /** + * Retrieves the maker checker id data from `resolve`. + * @param {ActivatedRoute} route Activated Route. + * @param {Dialog} dialog MatDialog. + * @param {router} router Router. + * @param {TasksService} tasksService Tasks Service. + */ + constructor(private route: ActivatedRoute, + private dialog: MatDialog, + private router: Router, + private tasksService: TasksService) { + this.route.data.subscribe((data: { checkerInboxDetail: any }) => { + this.checkerInboxDetail = data.checkerInboxDetail; + this.jsondata = JSON.parse(this.checkerInboxDetail.commandAsJson); + this.displayJSONData = !(_.isEmpty(this.jsondata)); + }); + } + + + /** + * Approve Checker + */ + approveChecker() { + const approveCheckerDialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { heading: 'Approve Checker', dialogContext: 'Are you sure you want to approve checker' } + }); + approveCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => { + if (response.confirm) { + this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'approve').subscribe((res: any) => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Reject checker + */ + rejectChecker() { + const rejectCheckerDialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { heading: 'Reject Checker', dialogContext: 'Are you sure you want to reject checker' } + }); + rejectCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => { + if (response.confirm) { + this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'reject').subscribe((res: any) => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Delete Checker + */ + deleteChecker() { + const deleteCheckerDialogRef = this.dialog.open(ConfirmationDialogComponent, { + data: { heading: 'Delete Checker', dialogContext: 'Are you sure you want to delete checker' } + }); + deleteCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => { + if (response.confirm) { + this.tasksService.deleteMakerChecker(this.checkerInboxDetail.id).subscribe((res: any) => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); + } + }); + } + +}