@@ -34,6 +34,7 @@ export class SavingsAccountActionsResolver implements Resolve<Object> {
|
||||
return this.savingsService.getSavingsChargeTemplateResource(savingAccountId);
|
||||
case 'Withdrawal':
|
||||
case 'Deposit':
|
||||
case 'Close':
|
||||
return this.savingsService.getSavingsTransactionTemplateResource(savingAccountId);
|
||||
default:
|
||||
return undefined;
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="closeSavingsAccountForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Closed On Date</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="closeSavingsAccountForm.controls.closedOnDate.hasError('required')">
|
||||
Closed On Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-checkbox class="m-b-25 m-t-15" formControlName="withdrawBalance">
|
||||
Withdraw Balance
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-checkbox formControlName="postInterestValidationOnClosure">
|
||||
Is Interest Posting required on closure date?
|
||||
</mat-checkbox>
|
||||
|
||||
<div *ngIf="closeSavingsAccountForm.controls['withdrawBalance'].value" fxLayout="column">
|
||||
|
||||
<mat-form-field class="m-t-20" *ngIf="closeSavingsAccountForm.controls['amount']">
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input type=number required matInput formControlName="amount"/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['paymentTypeId']">
|
||||
<mat-label>Payment Type</mat-label>
|
||||
<mat-select formControlName="paymentTypeId">
|
||||
<mat-option *ngFor="let paymentType of paymentTypeOptions"
|
||||
[value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column" class="m-t-10">
|
||||
<mat-label fxFlexAlign="center">Show Payment Details</mat-label>
|
||||
<button type="button" mat-mini-fab color="primary" (click)="addPaymentDetails()">
|
||||
<fa-icon [icon]="!addPaymentDetailsFlag ? 'plus-circle' : 'minus-circle'" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['accountNumber']">
|
||||
<mat-label>Account Number</mat-label>
|
||||
<input type="number" formControlName="accountNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['checkNumber']">
|
||||
<mat-label>Cheque</mat-label>
|
||||
<input type="number" formControlName="checkNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['routingCode']">
|
||||
<mat-label>Routing Code</mat-label>
|
||||
<input formControlName="routingCode" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['receiptNumber']">
|
||||
<mat-label>Receipt Number</mat-label>
|
||||
<input formControlName="receiptNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="closeSavingsAccountForm.controls['bankNumber']">
|
||||
<mat-label>Bank</mat-label>
|
||||
<input formControlName="bankNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<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="warn" [disabled]="!closeSavingsAccountForm.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 { CloseSavingsAccountComponent } from './close-savings-account.component';
|
||||
|
||||
describe('CloseSavingsAccountComponent', () => {
|
||||
let component: CloseSavingsAccountComponent;
|
||||
let fixture: ComponentFixture<CloseSavingsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CloseSavingsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CloseSavingsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
/**
|
||||
* Close Savings Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-close-savings-account',
|
||||
templateUrl: './close-savings-account.component.html',
|
||||
styleUrls: ['./close-savings-account.component.scss']
|
||||
})
|
||||
export class CloseSavingsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Close Savings Account form. */
|
||||
closeSavingsAccountForm: FormGroup;
|
||||
/** Savings Account Id */
|
||||
accountId: any;
|
||||
/** Flag to enable payment details fields. */
|
||||
addPaymentDetailsFlag = false;
|
||||
/** Payment Type Options */
|
||||
paymentTypeOptions: any;
|
||||
/** Transaction Amount */
|
||||
transactionAmount: 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.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
this.paymentTypeOptions = data.savingsAccountActionData.paymentTypeOptions;
|
||||
});
|
||||
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
|
||||
this.transactionAmount = data.savingsAccountData.summary.accountBalance;
|
||||
});
|
||||
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the close savings form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createCloseSavingsAccountForm();
|
||||
this.buildDependencies();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the close savings account form.
|
||||
*/
|
||||
createCloseSavingsAccountForm() {
|
||||
this.closeSavingsAccountForm = this.formBuilder.group({
|
||||
'closedOnDate': ['', Validators.required],
|
||||
'withdrawBalance': [false],
|
||||
'postInterestValidationOnClosure': [false],
|
||||
'note': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to value changes of withdraw balance checkbox.
|
||||
*/
|
||||
buildDependencies() {
|
||||
this.closeSavingsAccountForm.get('withdrawBalance').valueChanges.subscribe((value: boolean) => {
|
||||
if (value) {
|
||||
this.closeSavingsAccountForm.addControl('amount', new FormControl({value: this.transactionAmount, disabled: true}));
|
||||
this.closeSavingsAccountForm.addControl('paymentTypeId', new FormControl(''));
|
||||
} else {
|
||||
this.closeSavingsAccountForm.removeControl('amount');
|
||||
this.closeSavingsAccountForm.removeControl('paymentTypeId');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to add payment detail fields to the UI.
|
||||
*/
|
||||
addPaymentDetails() {
|
||||
this.addPaymentDetailsFlag = !this.addPaymentDetailsFlag;
|
||||
if (this.addPaymentDetailsFlag) {
|
||||
this.closeSavingsAccountForm.addControl('accountNumber', new FormControl(''));
|
||||
this.closeSavingsAccountForm.addControl('checkNumber', new FormControl(''));
|
||||
this.closeSavingsAccountForm.addControl('routingCode', new FormControl(''));
|
||||
this.closeSavingsAccountForm.addControl('receiptNumber', new FormControl(''));
|
||||
this.closeSavingsAccountForm.addControl('bankNumber', new FormControl(''));
|
||||
} else {
|
||||
this.closeSavingsAccountForm.removeControl('accountNumber');
|
||||
this.closeSavingsAccountForm.removeControl('checkNumber');
|
||||
this.closeSavingsAccountForm.removeControl('routingCode');
|
||||
this.closeSavingsAccountForm.removeControl('receiptNumber');
|
||||
this.closeSavingsAccountForm.removeControl('bankNumber');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and closes 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 prevClosedOnDate: Date = this.closeSavingsAccountForm.value.closedOnDate;
|
||||
this.closeSavingsAccountForm.patchValue({
|
||||
closedOnDate: this.datePipe.transform(prevClosedOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.closeSavingsAccountForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.savingsService.executeSavingsAccountCommand(this.accountId, 'close', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,3 +8,4 @@
|
||||
<mifosx-withdraw-by-client-savings-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-savings-account>
|
||||
<mifosx-add-charge-savings-account *ngIf="actions['Add Charge']"></mifosx-add-charge-savings-account>
|
||||
<mifosx-savings-transactions *ngIf="actions['Withdrawal'] || actions['Deposit']"></mifosx-savings-transactions>
|
||||
<mifosx-close-savings-account *ngIf="actions['Close']"></mifosx-close-savings-account>
|
||||
|
||||
@@ -19,6 +19,7 @@ export class SavingAccountActionsComponent {
|
||||
'Withdrawal': boolean
|
||||
'Deposit': boolean
|
||||
'Activate': boolean
|
||||
'Close': boolean
|
||||
'Undo Approval': boolean
|
||||
'Post Interest As On': boolean
|
||||
'Assign Staff': boolean // savings account and template
|
||||
@@ -31,6 +32,7 @@ export class SavingAccountActionsComponent {
|
||||
'Withdrawal': false,
|
||||
'Deposit': false,
|
||||
'Activate': false,
|
||||
'Close': false,
|
||||
'Undo Approval': false,
|
||||
'Post Interest As On': false,
|
||||
'Assign Staff': false,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
<div fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column">
|
||||
<mat-label fxFlexAlign="center">Show Payment Details</mat-label>
|
||||
<button type="button" mat-mini-fab color="primary" (click)="addPaymentDetails()">
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
<fa-icon [icon]="!addPaymentDetailsFlag ? 'plus-circle' : 'minus-circle'" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -108,6 +108,7 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
case 'Reject':
|
||||
case 'Deposit':
|
||||
case 'Activate':
|
||||
case 'Close':
|
||||
case 'Undo Approval':
|
||||
case 'Post Interest As On':
|
||||
case 'Assign Staff':
|
||||
|
||||
@@ -51,7 +51,6 @@ const routes: Routes = [
|
||||
path: '',
|
||||
component: SavingsAccountViewComponent,
|
||||
resolve: {
|
||||
savingsAccountData: SavingsAccountViewResolver,
|
||||
savingsDatatables: SavingsDatatablesResolver
|
||||
},
|
||||
children: [
|
||||
|
||||
@@ -40,6 +40,7 @@ import { WaiveChargeDialogComponent } from './savings-account-view/custom-dialog
|
||||
import { InactivateChargeDialogComponent } from './savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component';
|
||||
import { WithdrawByClientSavingsAccountComponent } from './saving-account-actions/withdraw-by-client-savings-account/withdraw-by-client-savings-account.component';
|
||||
import { AddChargeSavingsAccountComponent } from './saving-account-actions/add-charge-savings-account/add-charge-savings-account.component';
|
||||
import { CloseSavingsAccountComponent } from './saving-account-actions/close-savings-account/close-savings-account.component';
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,8 @@ import { AddChargeSavingsAccountComponent } from './saving-account-actions/add-c
|
||||
WaiveChargeDialogComponent,
|
||||
InactivateChargeDialogComponent,
|
||||
WithdrawByClientSavingsAccountComponent,
|
||||
AddChargeSavingsAccountComponent
|
||||
AddChargeSavingsAccountComponent,
|
||||
CloseSavingsAccountComponent
|
||||
],
|
||||
entryComponents: [
|
||||
CalculateInterestDialogComponent,
|
||||
|
||||
Reference in New Issue
Block a user