diff --git a/src/app/clients/clients-view/general-tab/general-tab.component.html b/src/app/clients/clients-view/general-tab/general-tab.component.html index 41807552a..903c22478 100644 --- a/src/app/clients/clients-view/general-tab/general-tab.component.html +++ b/src/app/clients/clients-view/general-tab/general-tab.component.html @@ -227,7 +227,8 @@ + + + + + + + + diff --git a/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.scss b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.scss new file mode 100644 index 000000000..d774f68da --- /dev/null +++ b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.scss @@ -0,0 +1,3 @@ +.container { + max-width: 37rem; +} diff --git a/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.spec.ts b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.spec.ts new file mode 100644 index 000000000..24b89a5aa --- /dev/null +++ b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UndoApprovalSavingsAccountComponent } from './undo-approval-savings-account.component'; + +describe('UndoApprovalSavingsAccountComponent', () => { + let component: UndoApprovalSavingsAccountComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ UndoApprovalSavingsAccountComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(UndoApprovalSavingsAccountComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.ts b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.ts new file mode 100644 index 000000000..f7b9e7bd7 --- /dev/null +++ b/src/app/savings/saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component.ts @@ -0,0 +1,66 @@ +/** Angular Imports */ +import { Component, OnInit } from '@angular/core'; +import { FormGroup, FormBuilder } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; + +/** Custom Services */ +import { SavingsService } from 'app/savings/savings.service'; + +/** + * Undo Approval Savings Account Component + */ +@Component({ + selector: 'mifosx-undo-approval-savings-account', + templateUrl: './undo-approval-savings-account.component.html', + styleUrls: ['./undo-approval-savings-account.component.scss'] +}) +export class UndoApprovalSavingsAccountComponent implements OnInit { + + /** Undo Approval Savings Account form. */ + undoApprovalSavingsAccountForm: FormGroup; + /** Savings Account Id */ + accountId: any; + + /** + * @param {FormBuilder} formBuilder Form Builder + * @param {SavingsService} savingsService Savings Service + * @param {ActivatedRoute} route Activated Route + * @param {Router} router Router + */ + constructor(private formBuilder: FormBuilder, + private savingsService: SavingsService, + private route: ActivatedRoute, + private router: Router) { + this.accountId = this.route.parent.snapshot.params['savingAccountId']; + } + + /** + * Creates the undo-approval savings form. + */ + ngOnInit() { + this.createUndoApprovalSavingsAccountForm(); + } + + /** + * Creates the undo-approval savings account form. + */ + createUndoApprovalSavingsAccountForm() { + this.undoApprovalSavingsAccountForm = this.formBuilder.group({ + 'note': [''] + }); + } + + /** + * Submits the form and undo the approval of share account, + * if successful redirects to the share account. + */ + submit() { + const data = { + ...this.undoApprovalSavingsAccountForm.value, + }; + this.savingsService.executeSavingsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); + } + +} diff --git a/src/app/savings/savings-account-view/savings-account-view.component.html b/src/app/savings/savings-account-view/savings-account-view.component.html index 6e31b1904..e5b84440a 100644 --- a/src/app/savings/savings-account-view/savings-account-view.component.html +++ b/src/app/savings/savings-account-view/savings-account-view.component.html @@ -8,7 +8,7 @@
+ [src]="'assets/images/savings_account_placeholder.png'">
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 0b5033d9f..b16e89c07 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 @@ -102,6 +102,7 @@ export class SavingsAccountViewComponent implements OnInit { case 'Reject': case 'Withdraw': case 'Activate': + case 'Undo Approval': 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 76c451c65..3eb62105b 100644 --- a/src/app/savings/savings.module.ts +++ b/src/app/savings/savings.module.ts @@ -29,6 +29,7 @@ import { ApproveSavingsAccountComponent } from './saving-account-actions/approve import { RejectSavingsAccountComponent } from './saving-account-actions/reject-savings-account/reject-savings-account.component'; import { WithdrawSavingsAccountComponent } from './saving-account-actions/withdraw-savings-account/withdraw-savings-account.component'; import { ActivateSavingsAccountComponent } from './saving-account-actions/activate-savings-account/activate-savings-account.component'; +import { UndoApprovalSavingsAccountComponent } from './saving-account-actions/undo-approval-savings-account/undo-approval-savings-account.component'; /** * Savings Module @@ -62,7 +63,8 @@ import { ActivateSavingsAccountComponent } from './saving-account-actions/activa ApproveSavingsAccountComponent, RejectSavingsAccountComponent, WithdrawSavingsAccountComponent, - ActivateSavingsAccountComponent + ActivateSavingsAccountComponent, + UndoApprovalSavingsAccountComponent ], providers: [DatePipe] })