@@ -223,11 +223,7 @@
|
|||||||
<i class="fa fa-arrow-down"></i>
|
<i class="fa fa-arrow-down"></i>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="element.status.submittedAndPendingApproval" class="account-action-button" mat-raised-button
|
<button *ngIf="element.status.submittedAndPendingApproval" class="account-action-button" mat-raised-button
|
||||||
color="primary">
|
color="primary" [routerLink]="['../','savingsaccounts', element.id, 'actions', 'Approve']">
|
||||||
<i class="fa fa-check"></i>
|
|
||||||
</button>
|
|
||||||
<button *ngIf="element.status.submittedAndPendingApproval" class="account-action-button" mat-raised-button
|
|
||||||
color="primary">
|
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!element.status.submittedAndPendingApproval && !element.status.active"
|
<button *ngIf="!element.status.submittedAndPendingApproval && !element.status.active"
|
||||||
|
|||||||
+39
@@ -0,0 +1,39 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="approveSavingsAccountForm" (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="approveSavingsAccountForm.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]="!approveSavingsAccountForm.valid">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 { ApproveSavingsAccountComponent } from './approve-savings-account.component';
|
||||||
|
|
||||||
|
describe('ApproveSavingsAccountComponent', () => {
|
||||||
|
let component: ApproveSavingsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<ApproveSavingsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ApproveSavingsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ApproveSavingsAccountComponent);
|
||||||
|
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 { SavingsService } from 'app/savings/savings.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve Savings Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-approve-savings-account',
|
||||||
|
templateUrl: './approve-savings-account.component.html',
|
||||||
|
styleUrls: ['./approve-savings-account.component.scss']
|
||||||
|
})
|
||||||
|
export class ApproveSavingsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Approve Savings Account form. */
|
||||||
|
approveSavingsAccountForm: FormGroup;
|
||||||
|
/** Savings Account Id */
|
||||||
|
accountId: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {SavingsService} savingsService Savings Service
|
||||||
|
* @param {DatePipe} datePipe Date Pipe
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private savingsService: SavingsService,
|
||||||
|
private datePipe: DatePipe,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the approve savings form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createApproveSavingsAccountForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the approve savings account form.
|
||||||
|
*/
|
||||||
|
createApproveSavingsAccountForm() {
|
||||||
|
this.approveSavingsAccountForm = this.formBuilder.group({
|
||||||
|
'approvedOnDate': ['', Validators.required],
|
||||||
|
'note': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and approves the saving account,
|
||||||
|
* if successful redirects to the saving account.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
// TODO: Update once language and date settings are setup
|
||||||
|
const locale = 'en';
|
||||||
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
|
const prevApprovedOnDate: Date = this.approveSavingsAccountForm.value.approvedOnDate;
|
||||||
|
this.approveSavingsAccountForm.patchValue({
|
||||||
|
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.approveSavingsAccountForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.savingsService.executeSavingsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,2 @@
|
|||||||
<div class="container">
|
<mifosx-approve-savings-account></mifosx-approve-savings-account>
|
||||||
<mat-card>
|
|
||||||
<mifosx-savings-transactions *ngIf="actions.transaction"></mifosx-savings-transactions>
|
|
||||||
</mat-card>
|
|
||||||
</div>
|
|
||||||
@@ -3,7 +3,7 @@ import { Component } from '@angular/core';
|
|||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create savings account actions component.
|
* Savings account actions component.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-saving-account-actions',
|
selector: 'mifosx-saving-account-actions',
|
||||||
@@ -12,15 +12,21 @@ import { Router, ActivatedRoute } from '@angular/router';
|
|||||||
})
|
})
|
||||||
export class SavingAccountActionsComponent {
|
export class SavingAccountActionsComponent {
|
||||||
|
|
||||||
/** flag object to store possible actions and render appropriate UI to the user */
|
/** Shares Account Data */
|
||||||
actions: { transaction: boolean } = { transaction: false };
|
sharesAccountData: any;
|
||||||
|
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||||
|
actions: {
|
||||||
|
'Approve': boolean
|
||||||
|
} = {
|
||||||
|
'Approve': false
|
||||||
|
};
|
||||||
|
|
||||||
constructor(private router: Router,
|
/**
|
||||||
private route: ActivatedRoute) {
|
* @param {ActivatedRoute} route Activated Route
|
||||||
this.route.params.subscribe(params => {
|
*/
|
||||||
this.actions[params['action']] = true;
|
constructor(private route: ActivatedRoute) {
|
||||||
});
|
const name = this.route.snapshot.params['name'];
|
||||||
|
this.actions[name] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,8 +42,8 @@
|
|||||||
<ng-container *ngIf="buttonConfig.options">
|
<ng-container *ngIf="buttonConfig.options">
|
||||||
<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 button of buttonConfig.options">
|
<span *ngFor="let option of buttonConfig.options">
|
||||||
<button mat-menu-item *mifosxHasPermission="button.taskPermissionName">{{button.name}}</button>
|
<button mat-menu-item *mifosxHasPermission="option.taskPermissionName" (click)="doAction(option.name)">{{option.name}}</button>
|
||||||
</span>
|
</span>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
@@ -89,9 +89,12 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
|
|
||||||
doAction(name: string) {
|
doAction(name: string) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
case 'Approve':
|
||||||
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
|
break;
|
||||||
case 'Modify Application':
|
case 'Modify Application':
|
||||||
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
|
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,61 +28,61 @@ export class SavingsButtonsConfiguration {
|
|||||||
setButtons(status: string) {
|
setButtons(status: string) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'Active':
|
case 'Active':
|
||||||
this.buttonsArray = [
|
this.buttonsArray = [
|
||||||
{
|
{
|
||||||
name: 'Post Interest As On',
|
name: 'Post Interest As On',
|
||||||
icon: 'fa fa-arrow-right',
|
icon: 'fa fa-arrow-right',
|
||||||
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
|
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Deposit',
|
name: 'Deposit',
|
||||||
icon: 'fa fa-arrow-up',
|
icon: 'fa fa-arrow-up',
|
||||||
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
|
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Withdraw',
|
name: 'Withdraw',
|
||||||
icon: 'fa fa-arrow-down',
|
icon: 'fa fa-arrow-down',
|
||||||
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
|
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Calculate Interest',
|
name: 'Calculate Interest',
|
||||||
icon: 'fa fa-table',
|
icon: 'fa fa-table',
|
||||||
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
|
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'Submitted and pending approval':
|
case 'Submitted and pending approval':
|
||||||
this.buttonsArray = [
|
this.buttonsArray = [
|
||||||
{
|
{
|
||||||
name: 'Modify Application',
|
name: 'Modify Application',
|
||||||
icon: 'fa fa-pencil ',
|
icon: 'fa fa-pencil ',
|
||||||
taskPermissionName: 'UPDATE_SAVINGSACCOUNT'
|
taskPermissionName: 'UPDATE_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Approve',
|
name: 'Approve',
|
||||||
icon: 'fa fa-check',
|
icon: 'fa fa-check',
|
||||||
taskPermissionName: 'APPROVE_SAVINGSACCOUNT'
|
taskPermissionName: 'APPROVE_SAVINGSACCOUNT'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'Approved':
|
case 'Approved':
|
||||||
this.buttonsArray = [
|
this.buttonsArray = [
|
||||||
{
|
{
|
||||||
name: 'Undo Approval',
|
name: 'Undo Approval',
|
||||||
icon: 'fa fa-undo',
|
icon: 'fa fa-undo',
|
||||||
taskPermissionName: 'APPROVALUNDO_SAVINGSACCOUNT'
|
taskPermissionName: 'APPROVALUNDO_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Activate',
|
name: 'Activate',
|
||||||
icon: 'fa fa-check',
|
icon: 'fa fa-check',
|
||||||
taskPermissionName: 'ACTIVATE_SAVINGSACCOUNT'
|
taskPermissionName: 'ACTIVATE_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Add Charge',
|
name: 'Add Charge',
|
||||||
icon: 'fa fa-plus',
|
icon: 'fa fa-plus',
|
||||||
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.buttonsArray = [];
|
this.buttonsArray = [];
|
||||||
@@ -92,41 +92,41 @@ export class SavingsButtonsConfiguration {
|
|||||||
setOptions(status: string) {
|
setOptions(status: string) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case 'Active':
|
case 'Active':
|
||||||
this.optionArray = [
|
this.optionArray = [
|
||||||
{
|
{
|
||||||
name: 'Post Interest',
|
name: 'Post Interest',
|
||||||
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT'
|
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Add Charge',
|
name: 'Add Charge',
|
||||||
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Close',
|
name: 'Close',
|
||||||
taskPermissionName: 'CLOSE_SAVINGSACCOUNT'
|
taskPermissionName: 'CLOSE_SAVINGSACCOUNT'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'Submitted and pending approval':
|
case 'Submitted and pending approval':
|
||||||
this.optionArray = [
|
this.optionArray = [
|
||||||
{
|
{
|
||||||
name: 'Reject',
|
name: 'Reject',
|
||||||
taskPermissionName: 'REJECT_SAVINGSACCOUNT'
|
taskPermissionName: 'REJECT_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Withdraw',
|
name: 'Withdraw',
|
||||||
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
|
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Add Charge',
|
name: 'Add Charge',
|
||||||
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
taskPermissionName: 'CREATE_SAVINGSACCOUNTCHARGE'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Delete',
|
name: 'Delete',
|
||||||
taskPermissionName: 'DELETE_SAVINGSACCOUNT'
|
taskPermissionName: 'DELETE_SAVINGSACCOUNT'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'Approved':
|
case 'Approved':
|
||||||
default:
|
default:
|
||||||
this.optionArray = [];
|
this.optionArray = [];
|
||||||
|
|||||||
@@ -89,20 +89,9 @@ const routes: Routes = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'add-savings-charge',
|
path: 'actions/:name',
|
||||||
component: AddSavingsChargeComponent,
|
data: { title: extract('Savings Account Actions'), routeParamBreadcrumb: 'name' },
|
||||||
data: { title: extract('Add Savings Charge'), breadcrumb: 'Add Savings Charge', routeParamBreadcrumb: false },
|
component: SavingAccountActionsComponent
|
||||||
resolve: {
|
|
||||||
savingsChargeTemplate: SavingsChargeTemplateResolver
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: ':action',
|
|
||||||
component: SavingAccountActionsComponent,
|
|
||||||
data: { title: extract('Saving Account Actions'), routeParamBreadcrumb: 'action' },
|
|
||||||
resolve: {
|
|
||||||
savingAccountTransactionTemplate: SavingAccountTransactionTemplateResolver
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { SavingsAccountChargesStepComponent } from './savings-account-stepper/sa
|
|||||||
import { SavingsAccountTermsStepComponent } from './savings-account-stepper/savings-account-terms-step/savings-account-terms-step.component';
|
import { SavingsAccountTermsStepComponent } from './savings-account-stepper/savings-account-terms-step/savings-account-terms-step.component';
|
||||||
import { SavingsAccountPreviewStepComponent } from './savings-account-stepper/savings-account-preview-step/savings-account-preview-step.component';
|
import { SavingsAccountPreviewStepComponent } from './savings-account-stepper/savings-account-preview-step/savings-account-preview-step.component';
|
||||||
import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings-account.component';
|
import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings-account.component';
|
||||||
|
import { ApproveSavingsAccountComponent } from './saving-account-actions/approve-savings-account/approve-savings-account.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Module
|
* Savings Module
|
||||||
@@ -54,7 +55,8 @@ import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings
|
|||||||
SavingsAccountChargesStepComponent,
|
SavingsAccountChargesStepComponent,
|
||||||
SavingsAccountTermsStepComponent,
|
SavingsAccountTermsStepComponent,
|
||||||
SavingsAccountPreviewStepComponent,
|
SavingsAccountPreviewStepComponent,
|
||||||
EditSavingsAccountComponent
|
EditSavingsAccountComponent,
|
||||||
|
ApproveSavingsAccountComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -175,4 +175,15 @@ export class SavingsService {
|
|||||||
return this.http.put(`/savingsaccounts/${accountId}`, savingsAccount);
|
return this.http.put(`/savingsaccounts/${accountId}`, savingsAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {string} accountId Savings Account Id
|
||||||
|
* @param {string} command Command
|
||||||
|
* @param {any} data Data
|
||||||
|
* @returns {Observable<any>} Savings data.
|
||||||
|
*/
|
||||||
|
executeSavingsAccountCommand(accountId: string, command: string, data: any): Observable<any> {
|
||||||
|
const httpParams = new HttpParams().set('command', command);
|
||||||
|
return this.http.post(`/savingsaccounts/${accountId}`, data, { params: httpParams });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user