diff --git a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.html b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.html
new file mode 100644
index 000000000..c63d56d92
--- /dev/null
+++ b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.html
@@ -0,0 +1,39 @@
+
diff --git a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.scss b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.scss
new file mode 100644
index 000000000..d774f68da
--- /dev/null
+++ b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.scss
@@ -0,0 +1,3 @@
+.container {
+ max-width: 37rem;
+}
diff --git a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.spec.ts b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.spec.ts
new file mode 100644
index 000000000..bdb24ed5e
--- /dev/null
+++ b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { RejectSavingsAccountComponent } from './reject-savings-account.component';
+
+describe('RejectSavingsAccountComponent', () => {
+ let component: RejectSavingsAccountComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ RejectSavingsAccountComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(RejectSavingsAccountComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts
new file mode 100644
index 000000000..3ee1fd105
--- /dev/null
+++ b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts
@@ -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';
+
+/**
+ * Reject Savings Account Component
+ */
+@Component({
+ selector: 'mifosx-reject-savings-account',
+ templateUrl: './reject-savings-account.component.html',
+ styleUrls: ['./reject-savings-account.component.scss']
+})
+export class RejectSavingsAccountComponent implements OnInit {
+
+ /** Minimum date allowed. */
+ minDate = new Date(2000, 0, 1);
+ /** Maximum date allowed. */
+ maxDate = new Date();
+ /** Reject Saving Account form. */
+ rejectSavingsAccountForm: 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 reject savings form.
+ */
+ ngOnInit() {
+ this.createRejectSavingsAccountForm();
+ }
+
+ /**
+ * Creates the reject savings account form.
+ */
+ createRejectSavingsAccountForm() {
+ this.rejectSavingsAccountForm = this.formBuilder.group({
+ 'rejectedOnDate': ['', Validators.required],
+ 'note': ['']
+ });
+ }
+
+ /**
+ * Submits the form and rejects 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 prevRejectedOnDate: Date = this.rejectSavingsAccountForm.value.rejectedOnDate;
+ this.rejectSavingsAccountForm.patchValue({
+ rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat),
+ });
+ const data = {
+ ...this.rejectSavingsAccountForm.value,
+ dateFormat,
+ locale
+ };
+ this.savingsService.executeSavingsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
+ this.router.navigate(['../../'], { relativeTo: this.route });
+ });
+ }
+
+}
diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.html b/src/app/savings/saving-account-actions/saving-account-actions.component.html
index 24b6cfc2b..48eb85865 100644
--- a/src/app/savings/saving-account-actions/saving-account-actions.component.html
+++ b/src/app/savings/saving-account-actions/saving-account-actions.component.html
@@ -1,2 +1,3 @@
-
+
+
\ No newline at end of file
diff --git a/src/app/savings/saving-account-actions/saving-account-actions.component.ts b/src/app/savings/saving-account-actions/saving-account-actions.component.ts
index 4cbb835c4..1573a5ed5 100644
--- a/src/app/savings/saving-account-actions/saving-account-actions.component.ts
+++ b/src/app/savings/saving-account-actions/saving-account-actions.component.ts
@@ -17,8 +17,10 @@ export class SavingAccountActionsComponent {
/** Flag object to store possible actions and render appropriate UI to the user */
actions: {
'Approve': boolean
+ 'Reject': boolean
} = {
- 'Approve': false
+ 'Approve': false,
+ 'Reject': false
};
/**
diff --git a/src/app/savings/savings-account-view/savings-account-view.component.ts b/src/app/savings/savings-account-view/savings-account-view.component.ts
index 4d9aacd89..1088a17f2 100644
--- a/src/app/savings/savings-account-view/savings-account-view.component.ts
+++ b/src/app/savings/savings-account-view/savings-account-view.component.ts
@@ -90,6 +90,7 @@ export class SavingsAccountViewComponent implements OnInit {
doAction(name: string) {
switch (name) {
case 'Approve':
+ case 'Reject':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Modify Application':
diff --git a/src/app/savings/savings.module.ts b/src/app/savings/savings.module.ts
index 5bf5c6ab8..24a75164f 100644
--- a/src/app/savings/savings.module.ts
+++ b/src/app/savings/savings.module.ts
@@ -26,6 +26,7 @@ import { SavingsAccountTermsStepComponent } from './savings-account-stepper/savi
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 { ApproveSavingsAccountComponent } from './saving-account-actions/approve-savings-account/approve-savings-account.component';
+import { RejectSavingsAccountComponent } from './saving-account-actions/reject-savings-account/reject-savings-account.component';
/**
* Savings Module
@@ -56,7 +57,8 @@ import { ApproveSavingsAccountComponent } from './saving-account-actions/approve
SavingsAccountTermsStepComponent,
SavingsAccountPreviewStepComponent,
EditSavingsAccountComponent,
- ApproveSavingsAccountComponent
+ ApproveSavingsAccountComponent,
+ RejectSavingsAccountComponent
],
providers: [DatePipe]
})