+4
@@ -33,6 +33,10 @@ export class RecurringDepositsAccountActionsResolver implements Resolve<Object>
|
|||||||
switch (actionName) {
|
switch (actionName) {
|
||||||
case 'Add Charge':
|
case 'Add Charge':
|
||||||
return this.savingsService.getSavingsChargeTemplateResource(recurringDepositAccountId);
|
return this.savingsService.getSavingsChargeTemplateResource(recurringDepositAccountId);
|
||||||
|
break;
|
||||||
|
case 'Close':
|
||||||
|
return this.recurringDepositsService.getRecurringDepositAccountActionResource(recurringDepositAccountId, 'close');
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
+114
@@ -0,0 +1,114 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="closeRecurringDepositForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<h3 class="mat-h3" fxFlexFill>{{title}}</h3>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Closed On</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="closedOnDatePicker" required
|
||||||
|
formControlName="closedOnDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="closedOnDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #closedOnDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="closeRecurringDepositForm.controls.closedOnDate.hasError('required')">
|
||||||
|
Transaction Date <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Maturity Amount</mat-label>
|
||||||
|
<input matInput required formControlName="maturityAmount">
|
||||||
|
<mat-error *ngIf="closeRecurringDepositForm.controls.maturityAmount.hasError('required')">
|
||||||
|
Maturity Amount <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Action</mat-label>
|
||||||
|
<mat-select formControlName="onAccountClosureId" required>
|
||||||
|
<mat-option *ngFor="let onAccountClosureOption of onAccountClosureOptions"
|
||||||
|
[value]="onAccountClosureOption.id">
|
||||||
|
{{ onAccountClosureOption.value }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="closeRecurringDepositForm.controls.onAccountClosureId.hasError('required')">
|
||||||
|
Action <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Payment Type Id</mat-label>
|
||||||
|
<mat-select formControlName="paymentTypeId" required>
|
||||||
|
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
|
||||||
|
{{ paymentType.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="closeRecurringDepositForm.controls.paymentTypeId.hasError('required')">
|
||||||
|
Payment Type <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div fxFlexFill>
|
||||||
|
<span fxFlex="25%">Show Payment Details</span>
|
||||||
|
<span fxFlex="75%" class="expandCollapsebutton" (click)="toggleDisplay()">
|
||||||
|
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||||
|
<i class="fa fa-minus"></i>
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" *ngIf="!showPaymentDetails">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-container *ngIf="showPaymentDetails">
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label> Account #</mat-label>
|
||||||
|
<input matInput formControlName="accountNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Cheque #</mat-label>
|
||||||
|
<input matInput formControlName="chequeNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Routing Code</mat-label>
|
||||||
|
<input matInput formControlName="routingCode">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Reciept #</mat-label>
|
||||||
|
<input matInput formControlName="receiptNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Bank #</mat-label>
|
||||||
|
<input matInput formControlName="bankNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<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]="['../general']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary" [disabled]="!closeRecurringDepositForm.valid">Submit</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</mat-card>
|
||||||
|
|
||||||
|
</div>
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
.container {
|
||||||
|
max-width: 37rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expandCollapsebutton {
|
||||||
|
margin-top: -7px;
|
||||||
|
margin-left: 2%;
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { CloseRecurringDepositsAccountComponent } from './close-recurring-deposits-account.component';
|
||||||
|
|
||||||
|
describe('CloseRecurringDepositsAccountComponent', () => {
|
||||||
|
let component: CloseRecurringDepositsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<CloseRecurringDepositsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CloseRecurringDepositsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CloseRecurringDepositsAccountComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+115
@@ -0,0 +1,115 @@
|
|||||||
|
/** 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 { RecurringDepositsService } from '../../recurring-deposits.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Close Recurring Deposits Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-close-recurring-deposits-account',
|
||||||
|
templateUrl: './close-recurring-deposits-account.component.html',
|
||||||
|
styleUrls: ['./close-recurring-deposits-account.component.scss']
|
||||||
|
})
|
||||||
|
export class CloseRecurringDepositsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Maturity Amount */
|
||||||
|
maturityAmount: any;
|
||||||
|
/** On Account Closure Options */
|
||||||
|
onAccountClosureOptions: any;
|
||||||
|
/** Payment Types */
|
||||||
|
paymentTypes: any;
|
||||||
|
/** Title */
|
||||||
|
title: string;
|
||||||
|
/** Account Id */
|
||||||
|
accountId: string;
|
||||||
|
/** Show payment details */
|
||||||
|
showPaymentDetails = false;
|
||||||
|
/** Minimum Date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum Date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Close Recurring Deposit Account form. */
|
||||||
|
closeRecurringDepositForm: FormGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves action details template data from `resolve`
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
* @param {DatePipe} datePipe Date Pipe
|
||||||
|
*/
|
||||||
|
constructor(
|
||||||
|
private formBuilder: FormBuilder,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private datePipe: DatePipe,
|
||||||
|
private recurringDepositsService: RecurringDepositsService
|
||||||
|
) {
|
||||||
|
this.route.data.subscribe((data: { recurringDepositsAccountActionData: any }) => {
|
||||||
|
this.maturityAmount = data.recurringDepositsAccountActionData.maturityAmount;
|
||||||
|
this.onAccountClosureOptions = data.recurringDepositsAccountActionData.onAccountClosureOptions;
|
||||||
|
this.paymentTypes = data.recurringDepositsAccountActionData.paymentTypeOptions;
|
||||||
|
if (data.recurringDepositsAccountActionData.maturityAmount) {
|
||||||
|
this.title = 'Recurring Deposit Closure on Maturity';
|
||||||
|
} else {
|
||||||
|
this.title = 'Recurring Deposit Closure';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.createcloseRecurringDepositForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the close form.
|
||||||
|
*/
|
||||||
|
createcloseRecurringDepositForm() {
|
||||||
|
this.closeRecurringDepositForm = this.formBuilder.group({
|
||||||
|
'closedOnDate': [new Date(), Validators.required],
|
||||||
|
'maturityAmount': [{ value: this.maturityAmount, disabled: true}],
|
||||||
|
'onAccountClosureId': ['', Validators.required],
|
||||||
|
'paymentTypeId': ['', Validators.required],
|
||||||
|
'accountNumber': '',
|
||||||
|
'chequeNumber': '',
|
||||||
|
'routingCode': '',
|
||||||
|
'receiptNumber': '',
|
||||||
|
'bankNumber': '',
|
||||||
|
'note': ''
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggles the display of payment details
|
||||||
|
*/
|
||||||
|
toggleDisplay() {
|
||||||
|
this.showPaymentDetails = !(this.showPaymentDetails);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the close recurring deposit form
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
const closedOnDate = this.closeRecurringDepositForm.value.closedOnDate;
|
||||||
|
const dateFormat = 'yyyy-MM-dd';
|
||||||
|
const locale = 'en';
|
||||||
|
this.closeRecurringDepositForm.patchValue({
|
||||||
|
closedOnDate: this.datePipe.transform(closedOnDate, dateFormat)
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.closeRecurringDepositForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'close', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+2
-1
@@ -4,4 +4,5 @@
|
|||||||
<mifosx-reject-recurring-deposits-account *ngIf="actions['Reject']"></mifosx-reject-recurring-deposits-account>
|
<mifosx-reject-recurring-deposits-account *ngIf="actions['Reject']"></mifosx-reject-recurring-deposits-account>
|
||||||
<mifosx-withdraw-by-client-recurring-deposits-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-recurring-deposits-account>
|
<mifosx-withdraw-by-client-recurring-deposits-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-recurring-deposits-account>
|
||||||
<mifosx-add-charge-recurring-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-recurring-deposits-account>
|
<mifosx-add-charge-recurring-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-recurring-deposits-account>
|
||||||
<mifosx-premature-close-recurring-deposit-account *ngIf="actions['Premature Close']"></mifosx-premature-close-recurring-deposit-account>
|
<mifosx-premature-close-recurring-deposit-account *ngIf="actions['Premature Close']"></mifosx-premature-close-recurring-deposit-account>
|
||||||
|
<mifosx-close-recurring-deposits-account *ngIf="actions['Close']"></mifosx-close-recurring-deposits-account>
|
||||||
|
|||||||
+5
-1
@@ -16,13 +16,17 @@ export class RecurringDepositsAccountActionsComponent {
|
|||||||
'Reject': boolean
|
'Reject': boolean
|
||||||
'Withdraw By Client': boolean
|
'Withdraw By Client': boolean
|
||||||
'Add Charge': boolean
|
'Add Charge': boolean
|
||||||
|
'Premature Close': boolean
|
||||||
|
'Close': boolean
|
||||||
} = {
|
} = {
|
||||||
'Activate': false,
|
'Activate': false,
|
||||||
'Undo Approval': false,
|
'Undo Approval': false,
|
||||||
'Approve': false,
|
'Approve': false,
|
||||||
'Reject': false,
|
'Reject': false,
|
||||||
'Withdraw By Client': false,
|
'Withdraw By Client': false,
|
||||||
'Add Charge': false
|
'Add Charge': false,
|
||||||
|
'Premature Close': false,
|
||||||
|
'Close': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -146,6 +146,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
|||||||
case 'Add Charge':
|
case 'Add Charge':
|
||||||
case 'Withdraw By Client':
|
case 'Withdraw By Client':
|
||||||
case 'Premature Close':
|
case 'Premature Close':
|
||||||
|
case 'Close':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
case 'Modify Application':
|
case 'Modify Application':
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import { AddChargeRecurringDepositsAccountComponent } from './recurring-deposits
|
|||||||
import { RecurringDepositConfirmationDialogComponent } from './recurring-deposits-account-view/custom-dialogs/recurring-deposit-confirmation-dialog/recurring-deposit-confirmation-dialog.component';
|
import { RecurringDepositConfirmationDialogComponent } from './recurring-deposits-account-view/custom-dialogs/recurring-deposit-confirmation-dialog/recurring-deposit-confirmation-dialog.component';
|
||||||
import { EditRecurringDepositAccountComponent } from './edit-recurring-deposit-account/edit-recurring-deposit-account.component';
|
import { EditRecurringDepositAccountComponent } from './edit-recurring-deposit-account/edit-recurring-deposit-account.component';
|
||||||
import { PrematureCloseRecurringDepositAccountComponent } from './recurring-deposits-account-actions/premature-close-recurring-deposit-account/premature-close-recurring-deposit-account.component';
|
import { PrematureCloseRecurringDepositAccountComponent } from './recurring-deposits-account-actions/premature-close-recurring-deposit-account/premature-close-recurring-deposit-account.component';
|
||||||
|
import { CloseRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/close-recurring-deposits-account/close-recurring-deposits-account.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,7 +78,8 @@ import { PrematureCloseRecurringDepositAccountComponent } from './recurring-depo
|
|||||||
AddChargeRecurringDepositsAccountComponent,
|
AddChargeRecurringDepositsAccountComponent,
|
||||||
RecurringDepositConfirmationDialogComponent,
|
RecurringDepositConfirmationDialogComponent,
|
||||||
EditRecurringDepositAccountComponent,
|
EditRecurringDepositAccountComponent,
|
||||||
PrematureCloseRecurringDepositAccountComponent
|
PrematureCloseRecurringDepositAccountComponent,
|
||||||
|
CloseRecurringDepositsAccountComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
RecurringDepositConfirmationDialogComponent
|
RecurringDepositConfirmationDialogComponent
|
||||||
|
|||||||
@@ -103,4 +103,13 @@ export class RecurringDepositsService {
|
|||||||
return this.http.put(`/recurringdepositaccounts/${accountId}`, recurringDepositAccountData);
|
return this.http.put(`/recurringdepositaccounts/${accountId}`, recurringDepositAccountData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the template for the recurring deposits action
|
||||||
|
* @param accountId Account Id
|
||||||
|
* @param command Command
|
||||||
|
*/
|
||||||
|
getRecurringDepositAccountActionResource(accountId: any, command: string): Observable<any> {
|
||||||
|
const httpParams = new HttpParams().set('command', command);
|
||||||
|
return this.http.get(`/recurringdepositaccounts/${accountId}/template`, { params: httpParams });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user