feat: add view standing instruction details (#1137)

Fixes: #1136
This commit is contained in:
Muskan Khedia
2020-07-18 20:58:04 +05:30
committed by GitHub
parent 8a360025f8
commit 521c61d1f3
10 changed files with 344 additions and 2 deletions
@@ -0,0 +1,44 @@
/** Angular Imports */
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
/** Translation Imports */
import { extract } from '../core/i18n/i18n.service';
/** Custom Components */
import { ViewStandingInstructionsComponent } from './view-standing-instructions/view-standing-instructions.component';
/** Custom Resolvers */
import { ViewStandingInstructionsResolver } from './common-resolvers/view-standing-instructions.resolver';
/** Loans Route. */
const routes: Routes = [
{
path: '',
children: [
{
path: ':standingInstructionsId',
data: { title: extract('Standing Instructions'), routeParamBreadcrumb: 'standingInstructionsId' },
children: [
{
path: 'view',
data: { title: extract('View Standing Instructions'), breadcrumb: 'view', routeParamBreadcrumb: false },
component: ViewStandingInstructionsComponent,
resolve: {
standingInstructionsData: ViewStandingInstructionsResolver,
},
},
]
}]
}
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
declarations: [],
providers: [
ViewStandingInstructionsResolver,
]
})
export class AccountTransfersRoutingModule { }
@@ -0,0 +1,26 @@
/** Angular Imports */
import { NgModule } from '@angular/core';
import { DatePipe } from '@angular/common';
/** Custom Modules */
import { AccountTransfersRoutingModule } from './account-transfers-routing.module';
import { SharedModule } from 'app/shared/shared.module';
import { PipesModule } from '../pipes/pipes.module';
import { DirectivesModule } from '../directives/directives.module';
/** Custom Components */
import { ViewStandingInstructionsComponent } from './view-standing-instructions/view-standing-instructions.component';
/**
* Account Transfers Module
*
* All components related to Account Transfers functions should be declared here.
*/
@NgModule({
imports: [SharedModule, PipesModule, DirectivesModule, AccountTransfersRoutingModule],
declarations: [
ViewStandingInstructionsComponent
],
providers: [DatePipe]
})
export class AccountTransfersModule { }
@@ -0,0 +1,26 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { HttpClient, HttpParams } from '@angular/common/http';
/** rxjs Imports */
import { Observable } from 'rxjs';
/**
* Account Transfers Service.
*/
@Injectable({
providedIn: 'root'
})
export class AccountTransfersService {
constructor(private http: HttpClient) { }
/**
* @params standingInstructionsId
* Returns the details of a particular Standing Instruction
*/
getStandingInstructionsData(standingInstructionsId: any): Observable<any> {
return this.http.get(`/standinginstructions/${standingInstructionsId}`);
}
}
@@ -0,0 +1,32 @@
/** Angular Imports */
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
/** rxjs Imports */
import { Observable } from 'rxjs';
/** Custom Services */
import { AccountTransfersService } from '../account-transfers.service';
/**
* View Standing Instructions resolver.
*/
@Injectable()
export class ViewStandingInstructionsResolver implements Resolve<Object> {
/**
* @param {accountTransfersService} AccountTransfersService Account Transfers service.
*/
constructor(private accountTransfersService: AccountTransfersService) { }
/**
* Returns the Standing Instructions Data.
* @param {ActivatedRouteSnapshot} route Route Snapshot
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const standingInstructionsId = route.parent.paramMap.get('standingInstructionsId');
return this.accountTransfersService.getStandingInstructionsData(standingInstructionsId);
}
}
@@ -0,0 +1,122 @@
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
<button mat-raised-button color="primary">
<fa-icon icon="edit"></fa-icon>&nbsp;&nbsp;
Edit
</button>
<button mat-raised-button color="primary">
View Transactions History
</button>
</div>
<div class="container">
<mat-card>
<mat-card-content>
<div fxLayout="row wrap" fxLayout.lt-md="column">
<h2 class="mat-h2" fxFlexFill>{{ standingInstructionsData.name }}</h2>
<mat-divider [inset]="true"></mat-divider>
<div fxFlexFill>
<span fxFlex="40%">Applicant:</span>
<span fxFlex="60%">{{ standingInstructionsData.fromClient.displayName }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Type:</span>
<span fxFlex="60%">{{ standingInstructionsData.transferType.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Priority:</span>
<span fxFlex="60%">{{ standingInstructionsData.priority.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Status:</span>
<span fxFlex="60%">{{ standingInstructionsData.status.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">From Account Type:</span>
<span fxFlex="60%">{{ standingInstructionsData.fromAccountType.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">From Account:</span>
<span fxFlex="60%">{{ standingInstructionsData.fromAccount.productName }} - {{ standingInstructionsData.fromAccount.accountNo }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Destination:</span>
<span fxFlex="60%">
<span *ngIf="allowclientedit"> Within Bank </span>
<span *ngIf="!allowclientedit"> Own Account </span>
</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">To Office:</span>
<span fxFlex="60%">{{ standingInstructionsData.toOffice.name }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Beneficiary:</span>
<span fxFlex="60%">{{ standingInstructionsData.toClient.displayName }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">To Account Type:</span>
<span fxFlex="60%">{{ standingInstructionsData.toAccountType.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">To Account:</span>
<span fxFlex="60%">{{ standingInstructionsData.toAccount.productName }} - {{standingInstructionsData.toAccount.accountNo}}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Standing Instruction Type:</span>
<span fxFlex="60%">{{ standingInstructionsData.instructionType.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Amount:</span>
<span fxFlex="60%">{{ standingInstructionsData.amount }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Validity:</span>
<span fxFlex="60%">{{ standingInstructionsData.validFrom | date }} - {{ standingInstructionsData.validTill | date }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Recurrence type:</span>
<span fxFlex="60%">{{ standingInstructionsData.recurrenceType.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Interval:</span>
<span fxFlex="60%">{{ standingInstructionsData.recurrenceInterval }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">Recurrence Frequency:</span>
<span fxFlex="60%">{{ standingInstructionsData.recurrenceFrequency.value }}</span>
</div>
<div fxFlexFill>
<span fxFlex="40%">On Month Day:</span>
<span fxFlex="60%">{{ standingInstructionsData.recurrenceOnMonthDay | date }}</span>
</div>
</div>
</mat-card-content>
</mat-card>
</div>
@@ -0,0 +1,20 @@
.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 1em 0;
}
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ViewStandingInstructionsComponent } from './view-standing-instructions.component';
describe('ViewStandingInstructionsComponent', () => {
let component: ViewStandingInstructionsComponent;
let fixture: ComponentFixture<ViewStandingInstructionsComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewStandingInstructionsComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ViewStandingInstructionsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,30 @@
/** Angular Imports */
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'mifosx-view-standing-instructions',
templateUrl: './view-standing-instructions.component.html',
styleUrls: ['./view-standing-instructions.component.scss']
})
export class ViewStandingInstructionsComponent {
/** Standing Instructions Data */
standingInstructionsData: any;
/** Allow Client Edit */
allowclientedit = false;
/**
* Retrieves the standing instructions data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { standingInstructionsData: any}) => {
this.standingInstructionsData = data.standingInstructionsData;
if (this.standingInstructionsData.fromClient.id === this.standingInstructionsData.toClient.id) {
this.allowclientedit = false;
}
});
}
}
@@ -58,7 +58,7 @@
</button>
</span>
<button class="account-action-button" mat-raised-button color="primary" matTooltip="View Standing Instruction"
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'">
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'" [routerLink]="['../', 'standing-instructions', instruction.id, 'view']">
<i class="fa fa-eye"></i>
</button>
</td>
@@ -32,7 +32,7 @@ import { RecurringDepositsAccountTransactionTemplateResolver } from './common-re
const routes: Routes = [
{
path: '',
data: { title: extract('All Recurring Deposits'), breadcrumb: 'Recurring Deposits', routeParamBreadcrumb: false },
data: { title: extract('Recurring Deposits'), breadcrumb: 'Recurring Deposits', routeParamBreadcrumb: false },
children: [
{
path: 'create-recurring-deposits-account',
@@ -147,6 +147,23 @@ const routes: Routes = [
]
}
]
},
{
path: '',
data: { title: extract('All Recurring Deposits'), breadcrumb: 'Recurring Deposits', routeParamBreadcrumb: false },
children: [
{
path: ':recurringDepositAccountId',
data: { title: extract('RecurringDeposit Account View'), routeParamBreadcrumb: 'recurringDepositAccountId' },
children: [
{
path: 'standing-instructions',
data: { title: extract('Standing Instructions'), breadcrumb: 'standing-instructions', routeParamBreadcrumb: false },
loadChildren: '../../account-transfers/account-transfers.module#AccountTransfersModule'
},
]
}
]
}
];
@NgModule({