+3
-3
@@ -35,15 +35,15 @@
|
|||||||
<mat-card-actions class="account-actions">
|
<mat-card-actions class="account-actions">
|
||||||
|
|
||||||
<ng-container *ngFor="let button of buttonConfig.singleButtons">
|
<ng-container *ngFor="let button of buttonConfig.singleButtons">
|
||||||
<button mat-raised-button>
|
<button mat-raised-button (click)="doAction(button.name)">
|
||||||
<i class="{{button.icon}}"></i> {{button.name}}</button>
|
<i class="{{button.icon}}"></i> {{button.name}}</button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<ng-container *ngIf="buttonConfig.options">
|
<ng-container *ngIf="buttonConfig.options.length">
|
||||||
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
|
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
|
||||||
<mat-menu #More="matMenu">
|
<mat-menu #More="matMenu">
|
||||||
<span *ngFor="let option of buttonConfig.options">
|
<span *ngFor="let option of buttonConfig.options">
|
||||||
<button mat-menu-item >{{option.name}}</button>
|
<button mat-menu-item (click)="doAction(option.name)">{{option.name}}</button>
|
||||||
</span>
|
</span>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
+55
-2
@@ -1,8 +1,14 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { MatDialog } from '@angular/material';
|
||||||
|
|
||||||
|
/** Custom Button Config. */
|
||||||
import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.config';
|
import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.config';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { FixedDepositsService } from '../fixed-deposits.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed Deposits Account View Component
|
* Fixed Deposits Account View Component
|
||||||
*/
|
*/
|
||||||
@@ -24,7 +30,10 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
|||||||
* Fetches fixed deposits account data from `resolve`
|
* Fetches fixed deposits account data from `resolve`
|
||||||
* @param {ActivatedRoute} route Activated Route
|
* @param {ActivatedRoute} route Activated Route
|
||||||
*/
|
*/
|
||||||
constructor(private route: ActivatedRoute) {
|
constructor(private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private fixedDepositsService: FixedDepositsService,
|
||||||
|
public dialog: MatDialog) {
|
||||||
this.route.data.subscribe((data: { fixedDepositsAccountData: any, savingsDatatables: any }) => {
|
this.route.data.subscribe((data: { fixedDepositsAccountData: any, savingsDatatables: any }) => {
|
||||||
this.fixedDepositsAccountData = data.fixedDepositsAccountData;
|
this.fixedDepositsAccountData = data.fixedDepositsAccountData;
|
||||||
this.savingsDatatables = data.savingsDatatables;
|
this.savingsDatatables = data.savingsDatatables;
|
||||||
@@ -54,4 +63,48 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs action button/option action.
|
||||||
|
* @param {string} name action name.
|
||||||
|
*/
|
||||||
|
doAction(name: string) {
|
||||||
|
switch (name) {
|
||||||
|
case 'Approve':
|
||||||
|
case 'Reject':
|
||||||
|
case 'Deposit':
|
||||||
|
case 'Activate':
|
||||||
|
case 'Close':
|
||||||
|
case 'Undo Approval':
|
||||||
|
case 'Post Interest As On':
|
||||||
|
case 'Assign Staff':
|
||||||
|
case 'Add Charge':
|
||||||
|
case 'Unassign Staff':
|
||||||
|
case 'Withdraw By Client':
|
||||||
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
|
break;
|
||||||
|
case 'Withdraw':
|
||||||
|
this.router.navigate([`actions/Withdrawal`], { relativeTo: this.route });
|
||||||
|
break;
|
||||||
|
case 'Modify Application':
|
||||||
|
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
|
||||||
|
break;
|
||||||
|
case 'Delete':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'Calculate Interest':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'Post Interest':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'Enable Withhold Tax':
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 'Disable Withhold Tax':
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="approveFixedDepositsAccountForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Approved On Date</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="approvedOnDatePicker" required formControlName="approvedOnDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="approvedOnDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #approvedOnDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="approveFixedDepositsAccountForm.controls.approvedOnDate.hasError('required')">
|
||||||
|
Approved On Date is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Note</mat-label>
|
||||||
|
<textarea matInput formControlName="note"></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../../']">Cancel</button>
|
||||||
|
<button mat-raised-button color="accent" [disabled]="!approveFixedDepositsAccountForm">Confirm</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ApproveFixedDepositsAccountComponent } from './approve-fixed-deposits-account.component';
|
||||||
|
|
||||||
|
describe('ApproveFixedDepositsAccountComponent', () => {
|
||||||
|
let component: ApproveFixedDepositsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<ApproveFixedDepositsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ApproveFixedDepositsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ApproveFixedDepositsAccountComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+83
@@ -0,0 +1,83 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve Fixed Deposits Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-approve-fixed-deposits-account',
|
||||||
|
templateUrl: './approve-fixed-deposits-account.component.html',
|
||||||
|
styleUrls: ['./approve-fixed-deposits-account.component.scss']
|
||||||
|
})
|
||||||
|
export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Approve Fixed Deposits Account form. */
|
||||||
|
approveFixedDepositsAccountForm: FormGroup;
|
||||||
|
/** Fixed Deposits Account Id */
|
||||||
|
accountId: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||||
|
* @param {DatePipe} datePipe Date Pipe
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private fixedDepositsService: FixedDepositsService,
|
||||||
|
private datePipe: DatePipe,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
this.accountId = this.route.parent.snapshot.params['fixedDepositAccountId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the approve fixed deposits form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createApproveFixedDepositsAccountForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the approve fixed deposits account form.
|
||||||
|
*/
|
||||||
|
createApproveFixedDepositsAccountForm() {
|
||||||
|
this.approveFixedDepositsAccountForm = this.formBuilder.group({
|
||||||
|
'approvedOnDate': ['', Validators.required],
|
||||||
|
'note': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and approves the fixed deposit account,
|
||||||
|
* if successful redirects to the fixed deposit account.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
// TODO: Update once language and date settings are setup
|
||||||
|
const locale = 'en';
|
||||||
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
|
const prevApprovedOnDate: Date = this.approveFixedDepositsAccountForm.value.approvedOnDate;
|
||||||
|
this.approveFixedDepositsAccountForm.patchValue({
|
||||||
|
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.approveFixedDepositsAccountForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<mifosx-approve-fixed-deposits-account *ngIf="actions['Approve']"></mifosx-approve-fixed-deposits-account>
|
||||||
|
<!-- <mifosx-reject-fixed-deposits-account *ngIf="actions['Reject']"></mifosx-reject-fixed-deposits-account>
|
||||||
|
<mifosx-activate-fixed-deposits-account *ngIf="actions['Activate']"></mifosx-activate-fixed-deposits-account>
|
||||||
|
<mifosx-undo-approval-fixed-deposits-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-fixed-deposits-account>
|
||||||
|
<mifosx-post-interest-as-on-fixed-deposits-account *ngIf="actions['Post Interest As On']"></mifosx-post-interest-as-on-fixed-deposits-account>
|
||||||
|
<mifosx-withdraw-by-client-fixed-deposits-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-fixed-deposits-account>
|
||||||
|
<mifosx-add-charge-fixed-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-fixed-deposits-account>
|
||||||
|
<mifosx-close-fixed-deposits-account *ngIf="actions['Close']"></mifosx-close-fixed-deposits-account> -->
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { FixedDepositsAccountActionsComponent } from './fixed-deposits-account-actions.component';
|
||||||
|
|
||||||
|
describe('FixedDepositsAccountActionsComponent', () => {
|
||||||
|
let component: FixedDepositsAccountActionsComponent;
|
||||||
|
let fixture: ComponentFixture<FixedDepositsAccountActionsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ FixedDepositsAccountActionsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(FixedDepositsAccountActionsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fixed deposits account actions component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-fixed-deposits-account-actions',
|
||||||
|
templateUrl: './fixed-deposits-account-actions.component.html',
|
||||||
|
styleUrls: ['./fixed-deposits-account-actions.component.scss']
|
||||||
|
})
|
||||||
|
export class FixedDepositsAccountActionsComponent {
|
||||||
|
|
||||||
|
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||||
|
actions: {
|
||||||
|
'Approve': boolean
|
||||||
|
'Reject': boolean
|
||||||
|
'Withdrawal': boolean
|
||||||
|
'Deposit': boolean
|
||||||
|
'Activate': boolean
|
||||||
|
'Close': boolean
|
||||||
|
'Undo Approval': boolean
|
||||||
|
'Post Interest As On': boolean
|
||||||
|
'Assign Staff': boolean
|
||||||
|
'Add Charge': boolean
|
||||||
|
'Unassign Staff': boolean
|
||||||
|
'Withdraw By Client': boolean
|
||||||
|
} = {
|
||||||
|
'Approve': false,
|
||||||
|
'Reject': false,
|
||||||
|
'Withdrawal': false,
|
||||||
|
'Deposit': false,
|
||||||
|
'Activate': false,
|
||||||
|
'Close': false,
|
||||||
|
'Undo Approval': false,
|
||||||
|
'Post Interest As On': false,
|
||||||
|
'Assign Staff': false,
|
||||||
|
'Add Charge': false,
|
||||||
|
'Unassign Staff': false,
|
||||||
|
'Withdraw By Client': false
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute) {
|
||||||
|
const name = this.route.snapshot.params['name'];
|
||||||
|
this.actions[name] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ import { TransactionsTabComponent } from './fixed-deposit-account-view/transacti
|
|||||||
import { ChargesTabComponent } from './fixed-deposit-account-view/charges-tab/charges-tab.component';
|
import { ChargesTabComponent } from './fixed-deposit-account-view/charges-tab/charges-tab.component';
|
||||||
import { StandingInstructionsTabComponent } from './fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
import { StandingInstructionsTabComponent } from './fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component';
|
||||||
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
||||||
|
import { FixedDepositsAccountActionsComponent } from './fixed-deposits-account-actions/fixed-deposits-account-actions.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { FixedDepositsAccountViewResolver } from '../fixed-deposits/common-resolvers/fixed-deposit-account-view.resolver';
|
import { FixedDepositsAccountViewResolver } from '../fixed-deposits/common-resolvers/fixed-deposit-account-view.resolver';
|
||||||
@@ -71,6 +72,11 @@ const routes: Routes = [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'actions/:name',
|
||||||
|
data: { title: extract('Fixed Deposits Account Actions'), routeParamBreadcrumb: 'name' },
|
||||||
|
component: FixedDepositsAccountActionsComponent
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import { InterestRateChartTabComponent } from './fixed-deposit-account-view/inte
|
|||||||
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
import { DatatableTabsComponent } from './fixed-deposit-account-view/datatable-tabs/datatable-tabs.component';
|
||||||
import { MultiRowComponent } from './fixed-deposit-account-view/datatable-tabs/multi-row/multi-row.component';
|
import { MultiRowComponent } from './fixed-deposit-account-view/datatable-tabs/multi-row/multi-row.component';
|
||||||
import { SingleRowComponent } from './fixed-deposit-account-view/datatable-tabs/single-row/single-row.component';
|
import { SingleRowComponent } from './fixed-deposit-account-view/datatable-tabs/single-row/single-row.component';
|
||||||
|
import { FixedDepositsAccountActionsComponent } from './fixed-deposits-account-actions/fixed-deposits-account-actions.component';
|
||||||
|
import { ApproveFixedDepositsAccountComponent } from './fixed-deposits-account-actions/approve-fixed-deposits-account/approve-fixed-deposits-account.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@@ -27,7 +29,9 @@ import { SingleRowComponent } from './fixed-deposit-account-view/datatable-tabs/
|
|||||||
InterestRateChartTabComponent,
|
InterestRateChartTabComponent,
|
||||||
DatatableTabsComponent,
|
DatatableTabsComponent,
|
||||||
MultiRowComponent,
|
MultiRowComponent,
|
||||||
SingleRowComponent
|
SingleRowComponent,
|
||||||
|
FixedDepositsAccountActionsComponent,
|
||||||
|
ApproveFixedDepositsAccountComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
SharedModule,
|
SharedModule,
|
||||||
|
|||||||
@@ -24,6 +24,17 @@ export class FixedDepositsService {
|
|||||||
return this.http.get(`/fixeddepositaccounts/${accountId}`, { params: httpParams });
|
return this.http.get(`/fixeddepositaccounts/${accountId}`, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} accountId Savings Account Id
|
||||||
|
* @param {string} command Command
|
||||||
|
* @param {any} data Data
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
executeFixedDepositsAccountCommand(accountId: string, command: string, data: any): Observable<any> {
|
||||||
|
const httpParams = new HttpParams().set('command', command);
|
||||||
|
return this.http.post(`/fixeddepositaccounts/${accountId}`, data, { params: httpParams });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param clientId Client Id
|
* @param clientId Client Id
|
||||||
* @param clientName Client Name
|
* @param clientName Client Name
|
||||||
|
|||||||
Reference in New Issue
Block a user