From 41768829890a440c3cba70a1a1b9afcbce678177 Mon Sep 17 00:00:00 2001 From: Muskan Khedia <36980003+muskankhedia@users.noreply.github.com> Date: Mon, 6 Jul 2020 15:16:26 +0530 Subject: [PATCH] feat: add create recurring deposit account (#999) Fixes: #998 --- .../clients-view/clients-view.component.html | 1 + ...ring-deposits-account-template.resolver.ts | 32 ++ ...-recurring-deposits-account.component.html | 106 +++++++ ...-recurring-deposits-account.component.scss | 0 ...curring-deposits-account.component.spec.ts | 25 ++ ...te-recurring-deposits-account.component.ts | 140 +++++++++ ...posits-account-charges-step.component.html | 111 +++++++ ...posits-account-charges-step.component.scss | 11 + ...its-account-charges-step.component.spec.ts | 25 ++ ...deposits-account-charges-step.component.ts | 184 ++++++++++++ ...osits-account-currency-step.component.html | 29 ++ ...osits-account-currency-step.component.scss | 0 ...ts-account-currency-step.component.spec.ts | 25 ++ ...eposits-account-currency-step.component.ts | 58 ++++ ...posits-account-details-step.component.html | 50 ++++ ...posits-account-details-step.component.scss | 3 + ...its-account-details-step.component.spec.ts | 25 ++ ...deposits-account-details-step.component.ts | 91 ++++++ ...nt-interest-rate-chart-step.component.html | 69 +++++ ...nt-interest-rate-chart-step.component.scss | 10 + ...interest-rate-chart-step.component.spec.ts | 25 ++ ...ount-interest-rate-chart-step.component.ts | 38 +++ ...posits-account-preview-step.component.html | 274 ++++++++++++++++++ ...posits-account-preview-step.component.scss | 24 ++ ...its-account-preview-step.component.spec.ts | 25 ++ ...deposits-account-preview-step.component.ts | 41 +++ ...osits-account-settings-step.component.html | 192 ++++++++++++ ...osits-account-settings-step.component.scss | 24 ++ ...ts-account-settings-step.component.spec.ts | 25 ++ ...eposits-account-settings-step.component.ts | 127 ++++++++ ...deposits-account-terms-step.component.html | 70 +++++ ...deposits-account-terms-step.component.scss | 0 ...osits-account-terms-step.component.spec.ts | 25 ++ ...g-deposits-account-terms-step.component.ts | 86 ++++++ .../recurring-deposits-routing.module.ts | 13 +- .../recurring-deposits.module.ts | 18 +- .../recurring-deposits.service.ts | 26 +- 37 files changed, 2024 insertions(+), 4 deletions(-) create mode 100644 src/app/deposits/recurring-deposits/common-resolvers/recurring-deposits-account-template.resolver.ts create mode 100644 src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.html create mode 100644 src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.scss create mode 100644 src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.html create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.scss create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.spec.ts create mode 100644 src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.ts diff --git a/src/app/clients/clients-view/clients-view.component.html b/src/app/clients/clients-view/clients-view.component.html index dbdc1c1ac..68344e54e 100644 --- a/src/app/clients/clients-view/clients-view.component.html +++ b/src/app/clients/clients-view/clients-view.component.html @@ -38,6 +38,7 @@ + diff --git a/src/app/deposits/recurring-deposits/common-resolvers/recurring-deposits-account-template.resolver.ts b/src/app/deposits/recurring-deposits/common-resolvers/recurring-deposits-account-template.resolver.ts new file mode 100644 index 000000000..93d64ccb4 --- /dev/null +++ b/src/app/deposits/recurring-deposits/common-resolvers/recurring-deposits-account-template.resolver.ts @@ -0,0 +1,32 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { RecurringDepositsService } from '../recurring-deposits.service'; + +/** + * Savings Account Template resolver. + */ +@Injectable() +export class RecurringDepositsAccountTemplateResolver implements Resolve { + + /** + * @param {recurringDepositsService} RecurringDepositsService Savings service. + */ + constructor(private recurringDepositsService: RecurringDepositsService) { } + + /** + * Returns the Shares Account Template. + * @param {ActivatedRouteSnapshot} route Route Snapshot + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const clientId = route.parent.parent.paramMap.get('clientId'); + return this.recurringDepositsService.getRecurringDepositsAccountTemplate(clientId); + } + +} diff --git a/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.html b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.html new file mode 100644 index 000000000..3c06fb565 --- /dev/null +++ b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.html @@ -0,0 +1,106 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + DETAILS + + + + + + + + + CURRENCY + + + + + + + + + TERMS + + + + + + + + + SETTINGS + + + + + + + + + INTEREST RATE CHART + + + + + + + + + CHARGES + + + + + + + + + PREVIEW + + + + + + + + +
diff --git a/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.scss b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.spec.ts b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.spec.ts new file mode 100644 index 000000000..7a0ffc60f --- /dev/null +++ b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CreateRecurringDepositsAccountComponent } from './create-recurring-deposits-account.component'; + +describe('CreateRecurringDepositsAccountComponent', () => { + let component: CreateRecurringDepositsAccountComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ CreateRecurringDepositsAccountComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(CreateRecurringDepositsAccountComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.ts b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.ts new file mode 100644 index 000000000..a0fc40b4c --- /dev/null +++ b/src/app/deposits/recurring-deposits/create-recurring-deposits-account/create-recurring-deposits-account.component.ts @@ -0,0 +1,140 @@ +/** Angular Imports */ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { DatePipe } from '@angular/common'; + +/** Custom Services */ +import { RecurringDepositsService } from '../recurring-deposits.service'; + +/** Step Components */ +import { RecurringDepositsAccountDetailsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component'; +import { RecurringDepositsAccountTermsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component'; +import { RecurringDepositsAccountCurrencyStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component'; +import { RecurringDepositsAccountSettingsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component'; +import { RecurringDepositsAccountChargesStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component'; + +/** + * Create new recurring deposit account + */ +@Component({ + selector: 'mifosx-create-recurring-deposits-account', + templateUrl: './create-recurring-deposits-account.component.html', + styleUrls: ['./create-recurring-deposits-account.component.scss'] +}) +export class CreateRecurringDepositsAccountComponent implements OnInit { + + /** Imports all the step component */ + @ViewChild(RecurringDepositsAccountDetailsStepComponent) recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent; + @ViewChild(RecurringDepositsAccountCurrencyStepComponent) recurringDepositAccountCurrencyStep: RecurringDepositsAccountCurrencyStepComponent; + @ViewChild(RecurringDepositsAccountTermsStepComponent) recurringDepositAccountTermsStep: RecurringDepositsAccountTermsStepComponent; + @ViewChild(RecurringDepositsAccountSettingsStepComponent) recurringDepositAccountSettingsStep: RecurringDepositsAccountSettingsStepComponent; + @ViewChild(RecurringDepositsAccountChargesStepComponent) recurringDepositAccountChargesStep: RecurringDepositsAccountChargesStepComponent; + + /** Recurring Deposits Account Template */ + recurringDepositsAccountTemplate: any; + /** Recurring Deposit Account Product Template */ + recurringDepositsAccountProductTemplate: any; + + constructor(private route: ActivatedRoute, + private router: Router, + private datePipe: DatePipe, + private recurringDepositsService: RecurringDepositsService + ) { + this.route.data.subscribe((data: { recurringDepositsAccountTemplate: any }) => { + this.recurringDepositsAccountTemplate = data.recurringDepositsAccountTemplate; + }); + } + + /** + * Sets recurring deposits account product template. + * @param {any} $event API response + */ + setTemplate($event: any) { + this.recurringDepositsAccountProductTemplate = $event; + } + + ngOnInit() { + } + + /** Get Recurring Deposit Account Details Form Data */ + get recurringDepositAccountDetailsForm() { + return this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetailsForm; + } + + /** Get Recurring Deposit Account Currency Form Data */ + get recurringDepositAccountCurrencyForm() { + return this.recurringDepositAccountCurrencyStep.recurringDepositAccountCurrencyForm; + } + + /** Get Recurring Deposit Account Terms Form Data */ + get recurringDepositAccountTermsForm() { + return this.recurringDepositAccountTermsStep.recurringDepositAccountTermsForm; + } + + /** Get Recurring Deposit Account Settings Form Data */ + get recurringDepositAccountSettingsForm() { + return this.recurringDepositAccountSettingsStep.recurringDepositAccountSettingsForm; + } + + /** Checks wheter all the forms in different steps are valid or not */ + get recurringDepositAccountFormValid() { + return ( + this.recurringDepositAccountDetailsForm.valid && + this.recurringDepositAccountTermsForm.valid && + this.recurringDepositAccountSettingsForm.valid + ); + } + + /** Retrieves Data of all the forms */ + get recurringDepositAccountData() { + return { + ...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails, + ...this.recurringDepositAccountCurrencyStep.recurringDepositAccountCurrency, + ...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms, + ...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings, + ...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges, + }; + } + + + /** Retrieves Data of all forms except Currency to submit the data */ + get recurringDepositAccount() { + return { + ...this.recurringDepositsAccountDetailsStep.recurringDepositAccountDetails, + ...this.recurringDepositAccountTermsStep.recurringDepositAccountTerms, + ...this.recurringDepositAccountSettingsStep.recurringDepositAccountSettings, + ...this.recurringDepositAccountChargesStep.recurringDepositAccountCharges, + }; + } + + /** + * Submits the recurring deposit form to create a new recurring deposit account + */ + submit() { + const locale = 'en'; + const dateFormat = 'dd MMMM yyyy'; + const monthDayFormat = 'dd MMMM'; + const recurringDepositAccount = { + ...this.recurringDepositAccount, + clientId: this.recurringDepositsAccountTemplate.clientId, + charges: this.recurringDepositAccount.charges.map((charge: any) => ({ + chargeId: charge.id, + amount: charge.amount, + dueDate: charge.dueDate, + feeOnMonthDay: charge.feeOnMonthDay, + feeInterval: charge.feeInterval + })), + isCalendarInherited: this.recurringDepositAccount.recurringDepositAccount ? this.recurringDepositAccount.recurringDepositAccount : false, + submittedOnDate: this.datePipe.transform(this.recurringDepositAccount.submittedOnDate, dateFormat), + expectedFirstDepositOnDate: this.datePipe.transform(this.recurringDepositAccount.expectedFirstDepositOnDate, dateFormat), + dateFormat, + monthDayFormat, + locale + }; + console.log('daaa: ', recurringDepositAccount); + + this.recurringDepositsService.createRecurringDepositAccount(recurringDepositAccount).subscribe((response: any) => { + this.router.navigate(['../', response.resourceId], { relativeTo: this.route }); + }); + } +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.html new file mode 100644 index 000000000..2393507b7 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.html @@ -0,0 +1,111 @@ +
+ + + Charge + + + {{ charge.name }} + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name + {{ charge.name + ', ' + charge.currency.displaySymbol }} + Type + {{ charge.chargeCalculationType.value }} + Amount + {{ charge.amount }} + + Collected On + {{ charge.chargeTimeType.value }} + Date + + {{(charge.dueDate | date) || 'Unassigned'}} + + + {{(charge.feeOnMonthDay | date) || 'Unassigned'}} + + + N/A + + + Repayments Every + {{ charge.feeInterval || 'Not Provided' }} + + Actions + +
+ +
+ +
+ + +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.scss new file mode 100644 index 000000000..dd420676a --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.scss @@ -0,0 +1,11 @@ +table { + width: 100%; +} + +.mat-elevation-z1 { + margin: 1em 0 1.5em 0; +} + +.margin-t { + margin-top: 1em; +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.spec.ts new file mode 100644 index 000000000..0fd68d31a --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountChargesStepComponent } from './recurring-deposits-account-charges-step.component'; + +describe('RecurringDepositsAccountChargesStepComponent', () => { + let component: RecurringDepositsAccountChargesStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountChargesStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountChargesStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.ts new file mode 100644 index 000000000..5e87ce3b2 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component.ts @@ -0,0 +1,184 @@ +/** Angular Imports */ +import { Component, OnInit, Input } from '@angular/core'; +import { FormControl } from '@angular/forms'; +import { MatDialog } from '@angular/material'; + +/** Dialog Components */ +import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; +import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; + +/** Custom Services */ +import { DatePipe } from '@angular/common'; +import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base'; +import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; +import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; + +/** + * Recurring Deposit Account Charges Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-charges-step', + templateUrl: './recurring-deposits-account-charges-step.component.html', + styleUrls: ['./recurring-deposits-account-charges-step.component.scss'] +}) +export class RecurringDepositsAccountChargesStepComponent implements OnInit { + + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + @Input() currencyCode: FormControl; + @Input() recurringDepositAccountFormValid: boolean; + + /** Charges Data */ + chargeData: any; + /** Charges Data Source */ + chargesDataSource: {}[]; + /** Charges table columns */ + displayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery', 'action']; + /** Component is pristine if there has been no changes by user interaction */ + pristine = true; + + constructor(public dialog: MatDialog, + private datePipe: DatePipe) { + } + + ngOnInit() { + this.chargeData = this.recurringDepositsAccountTemplate.chargeOptions; + this.chargesDataSource = []; + this.currencyCode.valueChanges.subscribe(() => this.chargesDataSource = []); + } + + /** + * Add a charge + */ + addCharge(charge: any) { + this.chargesDataSource = this.chargesDataSource.concat([charge.value]); + charge.value = ''; + } + + /** + * Edits the Charge Amount + * @param {any} charge Charge + */ + editChargeAmount(charge: any) { + const formfields: FormfieldBase[] = [ + new InputBase({ + controlName: 'amount', + label: 'Amount', + value: charge.amount, + type: 'number', + required: false + }), + ]; + const data = { + title: 'Edit Charge Amount', + layout: { addButtonText: 'Confirm' }, + formfields: formfields + }; + const editNoteDialogRef = this.dialog.open(FormDialogComponent, { data }); + editNoteDialogRef.afterClosed().subscribe((response: any) => { + if (response.data) { + const newCharge = { ...charge, amount: response.data.value.amount }; + this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge); + this.chargesDataSource = this.chargesDataSource.concat([]); + } + }); + this.pristine = false; + } + + /** + * Edits the Charge Date + * @param {any} charge Charge + */ + editChargeDate(charge: any) { + const formfields: FormfieldBase[] = [ + new DatepickerBase({ + controlName: 'date', + label: 'Date', + value: charge.dueDate || charge.feeOnMonthDay || '', + type: 'datetime-local', + required: false + }), + ]; + const data = { + title: 'Edit Charge Date', + layout: { addButtonText: 'Confirm' }, + formfields: formfields + }; + const editNoteDialogRef = this.dialog.open(FormDialogComponent, { data }); + editNoteDialogRef.afterClosed().subscribe((response: any) => { + if (response.data) { + let newCharge: any; + const dateFormat = 'dd MMMM yyyy'; + const date = this.datePipe.transform(response.data.value.date, dateFormat); + switch (charge.chargeTimeType.value) { + case 'Specified due date': + case 'Weekly Fee': + newCharge = { ...charge, dueDate: date }; + break; + case 'Annual Fee': + newCharge = { ...charge, feeOnMonthDay: date }; + break; + } + this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge); + this.chargesDataSource = this.chargesDataSource.concat([]); + } + }); + this.pristine = false; + } + + /** + * Edits the Charge Fee Interval + * @param {any} charge Charge + */ + editChargeFeeInterval(charge: any) { + const formfields: FormfieldBase[] = [ + new InputBase({ + controlName: 'feeInterval', + label: 'Fee Interval', + value: charge.feeInterval, + type: 'text', + required: false + }), + ]; + const data = { + title: 'Edit Charge Fee Interval', + layout: { addButtonText: 'Confirm' }, + formfields: formfields + }; + const editNoteDialogRef = this.dialog.open(FormDialogComponent, { data }); + editNoteDialogRef.afterClosed().subscribe((response: any) => { + if (response.data) { + const newCharge = { ...charge, feeInterval: response.data.value.feeInterval }; + this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1, newCharge); + this.chargesDataSource = this.chargesDataSource.concat([]); + } + }); + this.pristine = false; + } + + /** + * Delete a particular charge + * @param charge Charge + */ + deleteCharge(charge: any) { + const deleteChargeDialogRef = this.dialog.open(DeleteDialogComponent, { + data: { deleteContext: `charge ${charge.name}` } + }); + deleteChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.delete) { + this.chargesDataSource.splice(this.chargesDataSource.indexOf(charge), 1); + this.chargesDataSource = this.chargesDataSource.concat([]); + } + }); + } + + /** + * Returns Recurring Deposits Account Charges Form + */ + get recurringDepositAccountCharges() { + return { + charges: this.chargesDataSource + }; + } + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.html new file mode 100644 index 000000000..2a243aec6 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.html @@ -0,0 +1,29 @@ +
+ +
+ + + Currency + + + + + + Decimal Places + + + +
+ +
+ + +
+ +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.spec.ts new file mode 100644 index 000000000..d681ae386 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountCurrencyStepComponent } from './recurring-deposits-account-currency-step.component'; + +describe('RecurringDepositsAccountCurrencyStepComponent', () => { + let component: RecurringDepositsAccountCurrencyStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountCurrencyStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountCurrencyStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.ts new file mode 100644 index 000000000..f72b5e37e --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component.ts @@ -0,0 +1,58 @@ +/** Angular Imports */ +import { Component, OnInit, Input, OnChanges } from '@angular/core'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; + +/** + * Recurring Deposit Account Currency Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-currency-step', + templateUrl: './recurring-deposits-account-currency-step.component.html', + styleUrls: ['./recurring-deposits-account-currency-step.component.scss'] +}) +export class RecurringDepositsAccountCurrencyStepComponent implements OnInit, OnChanges { + + + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + + /** Recurring Deposit Account Currency Form */ + recurringDepositAccountCurrencyForm: FormGroup; + /** Currency Data */ + currencyData: any; + + constructor(private formBuilder: FormBuilder) { + this.createRecurringDepositAccountCurrencyForm(); + } + + ngOnInit() { + } + + ngOnChanges() { + console.log('out here'); + + if (this.recurringDepositsAccountProductTemplate) { + console.log('here'); + + this.recurringDepositAccountCurrencyForm.patchValue({ + 'currencyCode': this.recurringDepositsAccountProductTemplate.currency.code, + 'decimalPlaces': this.recurringDepositsAccountProductTemplate.currency.decimalPlaces + }); + } + } + + createRecurringDepositAccountCurrencyForm() { + this.recurringDepositAccountCurrencyForm = this.formBuilder.group({ + 'currencyCode': [{ value: '', disabled: true }], + 'decimalPlaces': [{ value: '', disabled: true }] + }); + } + + /** + * Returns Recurring Deposits Account Currency Form + */ + get recurringDepositAccountCurrency() { + return this.recurringDepositAccountCurrencyForm.value; + } + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.html new file mode 100644 index 000000000..500e4ad5d --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.html @@ -0,0 +1,50 @@ +
+ +
+ + + Product Name + + + {{ product.name }} + + + + Product Name is required + + + + + Submitted On + + + + + Submission Date is required + + + + + Field Officer + + + {{ officer.displayName }} + + + + +
+ +
+ + +
+ +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.scss new file mode 100644 index 000000000..aa8d23226 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.scss @@ -0,0 +1,3 @@ +.margin-t { + margin-top: 1em; +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.spec.ts new file mode 100644 index 000000000..f2875de8c --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountDetailsStepComponent } from './recurring-deposits-account-details-step.component'; + +describe('RecurringDepositsAccountDetailsStepComponent', () => { + let component: RecurringDepositsAccountDetailsStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountDetailsStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountDetailsStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.ts new file mode 100644 index 000000000..5ebf4129e --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component.ts @@ -0,0 +1,91 @@ +/** Angular Imports */ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; + +/** Custom Services */ +import { RecurringDepositsService } from '../../recurring-deposits.service'; +import { DatePipe } from '@angular/common'; + +/** + * Recurring Deposits Account Details Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-details-step', + templateUrl: './recurring-deposits-account-details-step.component.html', + styleUrls: ['./recurring-deposits-account-details-step.component.scss'] +}) +export class RecurringDepositsAccountDetailsStepComponent implements OnInit { + + /** Recurring Deposits Account Template */ + @Input() recurringDepositsAccountTemplate: any; + + /** Minimum date allowed. */ + minDate = new Date(2000, 0, 1); + /** Maximum date allowed. */ + maxDate = new Date(); + /** Product Data */ + productData: any; + /** Field Officer Data */ + fieldOfficerData: any; + /** Recurring Deposits Account Details Form */ + recurringDepositAccountDetailsForm: FormGroup; + + /** Recurring Deposits Account Template with product data */ + @Output() recurringDepositsAccountProductTemplate = new EventEmitter(); + + /** + * Sets recurring deposits account details form. + * @param {FormBuilder} formBuilder Form Builder. + * @param {RecurringDepositsService} recurringDepositsService Recurring Deposits Service. + */ + constructor(private formBuilder: FormBuilder, + private recurringDepositsService: RecurringDepositsService, + private datePipe: DatePipe) { + this.createRecurringDepositsAccountDetailsForm(); + } + + ngOnInit() { + this.buildDependencies(); + if (this.recurringDepositsAccountTemplate) { + this.productData = this.recurringDepositsAccountTemplate.productOptions; + if (this.recurringDepositsAccountTemplate.depositProductId) { + this.recurringDepositAccountDetailsForm.patchValue({ + 'productId': this.recurringDepositsAccountTemplate.depositProductId, + 'submittedOnDate': this.recurringDepositsAccountTemplate.timeline.submittedOnDate && new Date(this.recurringDepositsAccountTemplate.timeline.submittedOnDate), + }); + } + } + } + + /** + * Creates recurring deposits account details form. + */ + createRecurringDepositsAccountDetailsForm() { + this.recurringDepositAccountDetailsForm = this.formBuilder.group({ + 'productId': ['', Validators.required], + 'submittedOnDate': ['', Validators.required], + 'fieldOfficerId': [''] + }); + } + + /** + * Fetches recurring deposits account product template on productId value changes + */ + buildDependencies() { + const clientId = this.recurringDepositsAccountTemplate.clientId; + this.recurringDepositAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => { + this.recurringDepositsService.getRecurringDepositsAccountTemplate(clientId, productId).subscribe((response: any) => { + this.recurringDepositsAccountProductTemplate.emit(response); + this.fieldOfficerData = response.fieldOfficerOptions; + this.recurringDepositAccountDetailsForm.get('fieldOfficerId').patchValue(''); + }); + }); + } + + /** + * Returns recurring deposits account details form value. + */ + get recurringDepositAccountDetails() { + return this.recurringDepositAccountDetailsForm.value; + } +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html new file mode 100644 index 000000000..481b89413 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html @@ -0,0 +1,69 @@ + +
+ +
+
+ Name: + {{ recurringDepositsAccountProductTemplate?.accountChart.name | date }} +
+ +
+ Valid from Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.fromDate | date }} +
+ +
+ End Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.endDate | date }} +
+ +
+ Description: + {{ recurringDepositsAccountProductTemplate?.accountChart.description }} +
+ +
+ Primary Grouping by Amount: + {{ recurringDepositsAccountProductTemplate?.accountChart.isPrimaryGroupingByAmount ? 'Yes' : 'No' }} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Period + {{rateChart.fromPeriod}}-{{rateChart.toPeriod}} {{rateChart.periodType.value}} Amount Range {{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}} Interest {{ rateChart.annualInterestRate }} Description {{ rateChart.description }} Incentives + +
+
+
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss new file mode 100644 index 000000000..be9328c80 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss @@ -0,0 +1,10 @@ +.tab-container { + padding: 1%; + margin: 1%; + h3 { + margin:1% auto; + } + table { + width: 100%; + } +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.spec.ts new file mode 100644 index 000000000..09d4dbe43 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountInterestRateChartStepComponent } from './recurring-deposits-account-interest-rate-chart-step.component'; + +describe('RecurringDepositsAccountInterestRateChartStepComponent', () => { + let component: RecurringDepositsAccountInterestRateChartStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountInterestRateChartStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountInterestRateChartStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts new file mode 100644 index 000000000..57acf98e7 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts @@ -0,0 +1,38 @@ +/** Angular Imports */ +import { Component, OnInit, Input, OnChanges } from '@angular/core'; +import { MatTableDataSource } from '@angular/material'; + +/** + * Recurring Deposits Account Interest Rate Chart Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-interest-rate-chart-step', + templateUrl: './recurring-deposits-account-interest-rate-chart-step.component.html', + styleUrls: ['./recurring-deposits-account-interest-rate-chart-step.component.scss'] +}) +export class RecurringDepositsAccountInterestRateChartStepComponent implements OnInit, OnChanges { + + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + + /** Interest Rate Chart Data */ + interestRateChartData: any; + /** Columns to be displayed in interest rate chart table. */ + displayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives']; + /** Data source for interest rate chart table. */ + dataSource: MatTableDataSource; + + constructor() { + } + + ngOnChanges() { + if (this.recurringDepositsAccountProductTemplate) { + this.interestRateChartData = this.recurringDepositsAccountProductTemplate.accountChart.chartSlabs; + } + } + + ngOnInit() { + this.interestRateChartData = []; + } + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html new file mode 100644 index 000000000..ea80ac1ab --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html @@ -0,0 +1,274 @@ +
+ +

Details

+ + + +
+ Product + {{ recurringDepositAccountData.productId | find:recurringDepositsAccountTemplate.productOptions:'id':'name' }} +
+ +
+ Submitted On + {{ recurringDepositAccountData.submittedOnDate | date }} +
+ +
+ Field Officer + {{ recurringDepositAccountData.fieldOfficerId | find:recurringDepositsAccountProductTemplate.fieldOfficerOptions:'id':'displayName' }} +
+ +

Currency

+ + + +
+ Currency + {{ recurringDepositsAccountProductTemplate.currency.code }} +
+ +
+ Decimal Places + {{ recurringDepositsAccountProductTemplate.currency.decimalPlaces }} +
+ +

Terms

+ + +
+ Interest Compounding Period: + {{ recurringDepositAccountData.interestCompoundingPeriodType | find:recurringDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions:'id':'value' }} +
+ +
+ Interest Posting Period: + {{ recurringDepositAccountData.interestPostingPeriodType | find:recurringDepositsAccountProductTemplate.interestPostingPeriodTypeOptions:'id':'value' }} +
+ +
+ Interest Calculated using: + {{ recurringDepositAccountData.interestCalculationType | find:recurringDepositsAccountProductTemplate.interestCalculationTypeOptions:'id':'value' }} +
+ +
+ Days in Year: + {{ recurringDepositAccountData.interestCalculationDaysInYearType | find:recurringDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions:'id':'value' }} +
+ +

Settings

+ + + +
+ Lock-in Period: + {{ recurringDepositAccountData.lockinPeriodFrequency + ' ' + (recurringDepositAccountData.lockinPeriodFrequencyType | find:recurringDepositsAccountProductTemplate.lockinPeriodFrequencyTypeOptions:'id':'value') }} +
+ +
+ Recurring Deposit Amount: + {{ recurringDepositAccountData.mandatoryRecommendedDepositAmount}} +
+ +
+ Deposit Period: + {{ recurringDepositAccountData.depositPeriod + ' ' + (recurringDepositAccountData.depositPeriodFrequencyId | find:recurringDepositsAccountProductTemplate.periodFrequencyTypeData:'id':'value') }} +
+ +
+ Deposit Frequency Same as Group/Center meeting: + {{ recurringDepositsAccountProductTemplate.isCalendarInherited === true ? 'Yes' : 'No' }} +
+ + +
+ Deposit Start Date: + {{ recurringDepositAccountData.expectedFirstDepositOnDate | date}} +
+ +
+ Deposit Frequency: + {{ recurringDepositAccountData.recurringFrequency + ' ' + (recurringDepositAccountData.recurringFrequencyType | find:recurringDepositsAccountProductTemplate.periodFrequencyTypeData:'id':'value')}} +
+
+ + +
+ Minimum Deposit Term: + {{ (recurringDepositsAccountProductTemplate.minDepositTerm ? recurringDepositsAccountProductTemplate.minDepositTerm: '') + ' ' + (this.recurringDepositsAccountProductTemplate.minDepositTermType ? this.recurringDepositsAccountProductTemplate.minDepositTermType.value: '') }} +
+ +
+ In Multiples Of: + {{ (recurringDepositsAccountProductTemplate.inMultiplesOfDepositTerm ? recurringDepositsAccountProductTemplate.inMultiplesOfDepositTerm: '') + ' ' + (this.recurringDepositsAccountProductTemplate.inMultiplesOfDepositTermType ? this.recurringDepositsAccountProductTemplate.inMultiplesOfDepositTermType.value: '') }} +
+ +
+ Maximum Deposit Term + {{ (recurringDepositsAccountProductTemplate.maxDepositTerm ? recurringDepositsAccountProductTemplate.maxDepositTerm: '') + ' ' + (this.recurringDepositsAccountProductTemplate.maxDepositTermType ? this.recurringDepositsAccountProductTemplate.maxDepositTermType.value: '') }} +
+ + +

Interest Rate Chart

+ + +
+
+ Name: + {{ recurringDepositsAccountProductTemplate?.accountChart.name | date }} +
+ +
+ Valid from Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.fromDate | date }} +
+ +
+ End Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.endDate | date }} +
+ +
+ Description: + {{ recurringDepositsAccountProductTemplate?.accountChart.description }} +
+ +
+ Primary Grouping by Amount: + {{ recurringDepositsAccountProductTemplate?.accountChart.isPrimaryGroupingByAmount ? 'Yes' : 'No' }} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Period + {{rateChart.fromPeriod}}-{{rateChart.toPeriod}} {{rateChart.periodType.value}} Amount Range {{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}} Interest {{ rateChart.annualInterestRate }} Description {{ rateChart.description }} Incentives + +
+
+ +
+ +

Charges

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Name + {{ charge.name + ', ' + charge.currency.displaySymbol }} + Type + {{ charge.chargeCalculationType.value }} + Amount + {{ charge.amount }} + Date + + {{(charge.dueDate | date) || 'Unassigned'}} + + + {{(charge.feeOnMonthDay | date) || 'Unassigned'}} + + + N/A + + Repayments Every + {{ charge.feeInterval || 'Not Provided' }} + Collected On + {{ charge.chargeTimeType.value }} +
+ +
+ +
+ +
+ + + +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss new file mode 100644 index 000000000..87258dacb --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss @@ -0,0 +1,24 @@ +table { + width: 100%; +} + +.mat-elevation-z1 { + margin: 1em 0 1.5em 0; +} + +h2, h3, h4 { + margin: 0; + font-weight: 500; +} + +span { + margin: 0.5em 0; +} + +mat-divider { + margin: 0 0 0.5em 0; +} + +.margin-t { + margin-top: 1em; +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.spec.ts new file mode 100644 index 000000000..a328bf4a4 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountPreviewStepComponent } from './recurring-deposits-account-preview-step.component'; + +describe('RecurringDepositsAccountPreviewStepComponent', () => { + let component: RecurringDepositsAccountPreviewStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountPreviewStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountPreviewStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts new file mode 100644 index 000000000..915da3d59 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts @@ -0,0 +1,41 @@ +/** Angular Imports */ +import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core'; + +/** + * Recurring Deposit Preview Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-preview-step', + templateUrl: './recurring-deposits-account-preview-step.component.html', + styleUrls: ['./recurring-deposits-account-preview-step.component.scss'] +}) +export class RecurringDepositsAccountPreviewStepComponent implements OnInit, OnChanges { + + /** Input Data */ + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + @Input() recurringDepositAccountData: any; + /** Output the submit action */ + @Output() submit = new EventEmitter(); + + /** Charges Displayed Columns */ + chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery']; + /** Interest Rate Chart Displayed Columns */ + interestRateChartDisplayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives']; + /** Interest Rate Chart Data */ + interestRateChartData: any; + + constructor() { } + + ngOnChanges() { + if (this.recurringDepositsAccountProductTemplate) { + this.interestRateChartData = this.recurringDepositsAccountProductTemplate.accountChart.chartSlabs; + } + } + + ngOnInit() { + this.interestRateChartData = []; + } + + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.html new file mode 100644 index 000000000..7be8b48cb --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.html @@ -0,0 +1,192 @@ +
+ +
+ + + Is Mandatory Deposit? + + + + Adjust advance payments toward future installments? + + + + Allow Withdrawals? + + +

Lock-in Period

+ + + Frequency + + + + + Type + + + {{ lockinPeriodFrequencyType.value }} + + + + +

Recurring Deposit Details

+ + + Recurring Deposit Amount + + + Recurring Deposit Amount is required + + + +

Deposit Period

+ + + Deposit Period + + + + + Type + + + {{ periodFrequencyType.value }} + + + + + + Deposit Frequency Same as Group/Center meeting + + + + + Deposit Start Date + + + + + +

Deposit Frequency

+ + + Deposit Frequency + + + Deposit Frequency is required + + + + + Type + + + {{ periodFrequencyType.value }} + + + + Deposit Frequency Type is required + + +
+ + + + +

Minimum Deposit Term

+ + + Frequency + + + Minimum Deposit Term Frequency is required + + + + + Frequency Type + + + {{ periodFrequencyType.value }} + + + + Minimum Deposit Term Frequency Type is required + + + +

And thereafter, in Multiples of

+ + + Frequency + + + + + Type + + + {{ periodFrequencyType.value }} + + + + +

Maximum Deposit Term

+ + + Frequency + + + + + Type + + + {{ periodFrequencyType.value }} + + + + + + + + + + +
+ +
+ + +
+ +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.scss new file mode 100644 index 000000000..17e77f81d --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.scss @@ -0,0 +1,24 @@ +h4 { + font-weight: 500; + margin: 1em 0; +} + +h3 { + font-weight: 500; +} + +mat-divider { + margin: 1em 0 2em 0; +} + +.margin-v { + margin: 1em 0; +} + +.margin-b { + margin: 0 0 1em 0; +} + +.margin-t { + margin-top: 1em; +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.spec.ts new file mode 100644 index 000000000..aff8b32f4 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountSettingsStepComponent } from './recurring-deposits-account-settings-step.component'; + +describe('RecurringDepositsAccountSettingsStepComponent', () => { + let component: RecurringDepositsAccountSettingsStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountSettingsStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountSettingsStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.ts new file mode 100644 index 000000000..e21f12697 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component.ts @@ -0,0 +1,127 @@ +/** Angular Imports */ +import { Component, OnInit, Input, OnChanges } from '@angular/core'; +import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms'; + +/** Custom Services */ +import { DatePipe } from '@angular/common'; + +/** + * Recurring Deposits Account Settings Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-settings-step', + templateUrl: './recurring-deposits-account-settings-step.component.html', + styleUrls: ['./recurring-deposits-account-settings-step.component.scss'] +}) +export class RecurringDepositsAccountSettingsStepComponent implements OnInit, OnChanges { + + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + + /** Recurring Deposits Account Settings Form */ + recurringDepositAccountSettingsForm: FormGroup; + /** Minimum date allowed. */ + minDate = new Date(2000, 0, 1); + /** Maximum date allowed. */ + maxDate = new Date(); + /** Lockin Period Frequency Type Data */ + lockinPeriodFrequencyTypeData: any; + /** Period Frequency Type Data */ + periodFrequencyTypeData: any; + + /** + * @param {FormBuilder} formBuilder Form Builder + */ + constructor(private formBuilder: FormBuilder, + private datePipe: DatePipe) { + this.createRecurringDepositAccountSettingsForm(); + this.buildDependencies(); + } + + ngOnChanges() { + if (this.recurringDepositsAccountProductTemplate) { + this.recurringDepositAccountSettingsForm.patchValue({ + 'isMandatoryDeposit': this.recurringDepositsAccountProductTemplate.isMandatoryDeposit, + 'adjustAdvanceTowardsFuturePayments': this.recurringDepositsAccountProductTemplate.adjustAdvanceTowardsFuturePayments, + 'allowWithdrawal': this.recurringDepositsAccountProductTemplate.allowWithdrawal, + 'lockinPeriodFrequency': this.recurringDepositsAccountProductTemplate.lockinPeriodFrequency, + 'lockinPeriodFrequencyType': this.recurringDepositsAccountProductTemplate.lockinPeriodFrequencyType ? this.recurringDepositsAccountProductTemplate.lockinPeriodFrequencyType.id : '', + 'minDepositTerm': this.recurringDepositsAccountProductTemplate.minDepositTerm, + 'minDepositTermTypeId': this.recurringDepositsAccountProductTemplate.minDepositTermType ? this.recurringDepositsAccountProductTemplate.minDepositTermType.id : '', + 'inMultiplesOfDepositTerm': this.recurringDepositsAccountProductTemplate.inMultiplesOfDepositTerm, + 'inMultiplesOfDepositTermTypeId': this.recurringDepositsAccountProductTemplate.inMultiplesOfDepositTermType ? this.recurringDepositsAccountProductTemplate.inMultiplesOfDepositTermType.id : '', + 'maxDepositTerm': this.recurringDepositsAccountProductTemplate.maxDepositTerm, + 'maxDepositTermTypeId': this.recurringDepositsAccountProductTemplate.maxDepositTermType ? this.recurringDepositsAccountProductTemplate.maxDepositTermType.id : '', + }); + this.setOptions(); + } + } + + ngOnInit() { + if (this.recurringDepositsAccountTemplate) { + this.recurringDepositAccountSettingsForm.patchValue({ + 'lockinPeriodFrequency': this.recurringDepositsAccountTemplate.lockinPeriodFrequency, + 'lockinPeriodFrequencyType': this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType && this.recurringDepositsAccountTemplate.lockinPeriodFrequencyType.id, + }); + } + } + + /** + * Creates recurring deposits account terms form. + */ + createRecurringDepositAccountSettingsForm() { + this.recurringDepositAccountSettingsForm = this.formBuilder.group({ + 'isMandatoryDeposit': [''], + 'adjustAdvanceTowardsFuturePayments': [''], + 'allowWithdrawal': [''], + 'lockinPeriodFrequency': [''], + 'lockinPeriodFrequencyType': [''], + 'mandatoryRecommendedDepositAmount': ['', Validators.required], + 'depositPeriod': ['', Validators.required], + 'depositPeriodFrequencyId': ['', Validators.required], + 'isCalendarInherited': [''], + 'expectedFirstDepositOnDate': [''], + 'recurringFrequency': ['', Validators.required], + 'recurringFrequencyType': ['', Validators.required], + 'minDepositTerm': [{value: '', disabled: true}], + 'minDepositTermTypeId': [{ value: '', disabled: true }], + 'inMultiplesOfDepositTerm': [{ value: '', disabled: true }], + 'inMultiplesOfDepositTermTypeId': [{ value: '', disabled: true }], + 'maxDepositTerm': [{ value: '', disabled: true }], + 'maxDepositTermTypeId': [{ value: '', disabled: true }] + }); + } + + /** + * Sets all select dropdown options. + */ + setOptions() { + this.lockinPeriodFrequencyTypeData = this.recurringDepositsAccountProductTemplate.lockinPeriodFrequencyTypeOptions; + this.periodFrequencyTypeData = this.recurringDepositsAccountProductTemplate.periodFrequencyTypeOptions; + } + + /** + * Subscribes to value changes and sets new form controls accordingly. + */ + buildDependencies() { + this.recurringDepositAccountSettingsForm.get('isCalendarInherited').valueChanges.subscribe((isCalendarInherited: any) => { + if (isCalendarInherited) { + this.recurringDepositAccountSettingsForm.removeControl('expectedFirstDepositOnDate'); + this.recurringDepositAccountSettingsForm.removeControl('recurringFrequency'); + this.recurringDepositAccountSettingsForm.removeControl('recurringFrequencyType'); + } else { + this.recurringDepositAccountSettingsForm.addControl('expectedFirstDepositOnDate', new FormControl()); + this.recurringDepositAccountSettingsForm.addControl('recurringFrequency', new FormControl('')); + this.recurringDepositAccountSettingsForm.addControl('recurringFrequencyType', new FormControl('')); + } + }); + } + + /** + * Returns recurring deposits account settings form value. + */ + get recurringDepositAccountSettings() { + return this.recurringDepositAccountSettingsForm.value; + } + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.html new file mode 100644 index 000000000..6d1c5e4c5 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.html @@ -0,0 +1,70 @@ +
+ +
+ + + Interest Compounding Period + + + {{ interestCompoundingPeriodType.value }} + + + + Interest Compounding Period is required + + + + + Interest Posting Period + + + {{ interestPostingPeriodType.value }} + + + + Interest Posting Period is required + + + + + Interest Calculated using + + + {{ interestCalculationType.value }} + + + + Interest Calculated using is required + + + + + Days in Year + + + {{ interestCalculationDaysInYearType.value }} + + + + Days in Year is required + + + +
+ +
+ + +
+ +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.spec.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.spec.ts new file mode 100644 index 000000000..a9b35ab98 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RecurringDepositsAccountTermsStepComponent } from './recurring-deposits-account-terms-step.component'; + +describe('RecurringDepositsAccountTermsStepComponent', () => { + let component: RecurringDepositsAccountTermsStepComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RecurringDepositsAccountTermsStepComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RecurringDepositsAccountTermsStepComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.ts new file mode 100644 index 000000000..309d21ca3 --- /dev/null +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component.ts @@ -0,0 +1,86 @@ +/** Angular Imports */ +import { Component, OnInit, Input, OnChanges } from '@angular/core'; +import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms'; + +/** + * Recurring Deposits Terms Step + */ +@Component({ + selector: 'mifosx-recurring-deposits-account-terms-step', + templateUrl: './recurring-deposits-account-terms-step.component.html', + styleUrls: ['./recurring-deposits-account-terms-step.component.scss'] +}) +export class RecurringDepositsAccountTermsStepComponent implements OnInit, OnChanges { + + @Input() recurringDepositsAccountTemplate: any; + @Input() recurringDepositsAccountProductTemplate: any; + + /** Minimum date allowed. */ + minDate = new Date(2000, 0, 1); + /** Maximum date allowed. */ + maxDate = new Date(); + /** Recurring Deposits Account Terms Form */ + recurringDepositAccountTermsForm: FormGroup; + /** Interest Compounding Period Type Data */ + interestCompoundingPeriodTypeData: any; + /** Interest Posting Period Type Data */ + interestPostingPeriodTypeData: any; + /** Interest Calculation Type Data */ + interestCalculationTypeData: any; + /** Interest Calculation Days in Year Data */ + interestCalculationDaysInYearTypeData: any; + + /** + * @param {FormBuilder} formBuilder Form Builder + */ + constructor(private formBuilder: FormBuilder) { + this.createRecurringDepositsAccountTermsForm(); + } + + ngOnChanges() { + if (this.recurringDepositsAccountProductTemplate) { + this.setOptions(); + } + } + + ngOnInit() { + if (this.recurringDepositsAccountTemplate.interestCompoundingPeriodType) { + this.recurringDepositAccountTermsForm.patchValue({ + 'interestCompoundingPeriodType': this.recurringDepositsAccountTemplate.interestCompoundingPeriodType.id, + 'interestPostingPeriodType': this.recurringDepositsAccountTemplate.interestPostingPeriodType.id, + 'interestCalculationType': this.recurringDepositsAccountTemplate.interestCalculationType.id, + 'interestCalculationDaysInYearType': this.recurringDepositsAccountTemplate.interestCalculationDaysInYearType.id, + }); + } + } + + /** + * Creates recurring deposits account terms form. + */ + createRecurringDepositsAccountTermsForm() { + this.recurringDepositAccountTermsForm = this.formBuilder.group({ + 'interestCompoundingPeriodType': ['', Validators.required], + 'interestPostingPeriodType': ['', Validators.required], + 'interestCalculationType': ['', Validators.required], + 'interestCalculationDaysInYearType': ['', Validators.required], + }); + } + + /** + * Sets all select dropdown options. + */ + setOptions() { + this.interestCompoundingPeriodTypeData = this.recurringDepositsAccountProductTemplate.interestCompoundingPeriodTypeOptions; + this.interestPostingPeriodTypeData = this.recurringDepositsAccountProductTemplate.interestPostingPeriodTypeOptions; + this.interestCalculationTypeData = this.recurringDepositsAccountProductTemplate.interestCalculationTypeOptions; + this.interestCalculationDaysInYearTypeData = this.recurringDepositsAccountProductTemplate.interestCalculationDaysInYearTypeOptions; + } + + /** + * Returns recurring deposits account terms form value. + */ + get recurringDepositAccountTerms() { + return this.recurringDepositAccountTermsForm.value; + } + +} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-routing.module.ts b/src/app/deposits/recurring-deposits/recurring-deposits-routing.module.ts index 2b52837a4..fed3d453c 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-routing.module.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-routing.module.ts @@ -18,12 +18,22 @@ import { ChargesTabComponent } from './recurring-deposits-account-view/charges-t import { DatatableTabsComponent } from './recurring-deposits-account-view/datatable-tabs/datatable-tabs.component'; import { SavingsDatatableResolver } from 'app/savings/common-resolvers/savings-datatable.resolver'; import { SavingsDatatablesResolver } from 'app/savings/common-resolvers/savings-datatables.resolver'; +import { CreateRecurringDepositsAccountComponent } from './create-recurring-deposits-account/create-recurring-deposits-account.component'; +import { RecurringDepositsAccountTemplateResolver } from './common-resolvers/recurring-deposits-account-template.resolver'; const routes: Routes = [ { path: '', data: { title: extract('All RecurringDeposits'), breadcrumb: 'RecurringDeposits', routeParamBreadcrumb: false }, children: [ + { + path: 'create-recurring-deposits-account', + data: { title: extract('Create Recurring Deposits Account'), breadcrumb: 'Create Recurring Deposits Account' }, + component: CreateRecurringDepositsAccountComponent, + resolve: { + recurringDepositsAccountTemplate: RecurringDepositsAccountTemplateResolver + } + }, { path: ':recurringDepositAccountId', data: { title: extract('RecurringDeposit Account View'), routeParamBreadcrumb: 'recurringDepositAccountId' }, @@ -88,7 +98,8 @@ const routes: Routes = [ RecurringDepositsAccountViewResolver, RecurringDepositsAccountDataResolver, SavingsDatatableResolver, - SavingsDatatablesResolver + SavingsDatatablesResolver, + RecurringDepositsAccountTemplateResolver ] }) export class RecurringDepositsRoutingModule {} diff --git a/src/app/deposits/recurring-deposits/recurring-deposits.module.ts b/src/app/deposits/recurring-deposits/recurring-deposits.module.ts index e40be9947..a60f6d977 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits.module.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits.module.ts @@ -17,6 +17,14 @@ import { ChargesTabComponent } from './recurring-deposits-account-view/charges-t import { DatatableTabsComponent } from './recurring-deposits-account-view/datatable-tabs/datatable-tabs.component'; import { MultiRowComponent } from './recurring-deposits-account-view/datatable-tabs/multi-row/multi-row.component'; import { SingleRowComponent } from './recurring-deposits-account-view/datatable-tabs/single-row/single-row.component'; +import { CreateRecurringDepositsAccountComponent } from './create-recurring-deposits-account/create-recurring-deposits-account.component'; +import { RecurringDepositsAccountDetailsStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component'; +import { RecurringDepositsAccountTermsStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-terms-step/recurring-deposits-account-terms-step.component'; +import { RecurringDepositsAccountCurrencyStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-currency-step/recurring-deposits-account-currency-step.component'; +import { RecurringDepositsAccountSettingsStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-settings-step/recurring-deposits-account-settings-step.component'; +import { RecurringDepositsAccountInterestRateChartStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component'; +import { RecurringDepositsAccountChargesStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-charges-step/recurring-deposits-account-charges-step.component'; +import { RecurringDepositsAccountPreviewStepComponent } from './recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component'; /** * RecurringDeposits Module @@ -38,7 +46,15 @@ import { SingleRowComponent } from './recurring-deposits-account-view/datatable- ChargesTabComponent, DatatableTabsComponent, MultiRowComponent, - SingleRowComponent + SingleRowComponent, + CreateRecurringDepositsAccountComponent, + RecurringDepositsAccountDetailsStepComponent, + RecurringDepositsAccountTermsStepComponent, + RecurringDepositsAccountCurrencyStepComponent, + RecurringDepositsAccountSettingsStepComponent, + RecurringDepositsAccountInterestRateChartStepComponent, + RecurringDepositsAccountChargesStepComponent, + RecurringDepositsAccountPreviewStepComponent ], providers: [DatePipe] }) diff --git a/src/app/deposits/recurring-deposits/recurring-deposits.service.ts b/src/app/deposits/recurring-deposits/recurring-deposits.service.ts index 1349378d2..e7cf3d550 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits.service.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits.service.ts @@ -13,9 +13,13 @@ import { Observable } from 'rxjs'; }) export class RecurringDepositsService { - constructor(private http: HttpClient) {} + constructor(private http: HttpClient) { } - getRecurringDepositsAccountData(recurringDepositAccountId: any) { + /** + * @params recurringDepositAccountId + * Returns the details of a particular Recurring Deposit Account + */ + getRecurringDepositsAccountData(recurringDepositAccountId: any): Observable { const httpParams = new HttpParams() .set('associations', 'all'); return this.http.get(`/recurringdepositaccounts/${recurringDepositAccountId}`, { params: httpParams }); @@ -42,4 +46,22 @@ export class RecurringDepositsService { return this.http.get(`/standinginstructions`, { params: httpParams }); } + /** + * Returns Recurring Deposit Account Template Data + * @param clientId Client ID + * @param productId Product ID + */ + getRecurringDepositsAccountTemplate(clientId: any, productId?: any): Observable { + let httpParams = new HttpParams().set('clientId', clientId); + httpParams = productId ? httpParams.set('productId', productId) : httpParams; + return this.http.get(`/recurringdepositaccounts/template`, { params: httpParams }); + } + + /** + * Post Request to create a recurring deposit account + * @param recurringAccountData Recurring Deposit Account Data + */ + createRecurringDepositAccount(recurringAccountData: any): Observable { + return this.http.post(`/recurringdepositaccounts`, recurringAccountData); + } }