refactor (df/locale): savings module (#1259)

See: #1213
This commit is contained in:
Shubhankar Bhadra
2020-10-16 20:20:36 +05:30
committed by GitHub
parent aeeb2cc5f1
commit 777da45b63
18 changed files with 113 additions and 59 deletions
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */
import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/**
* Close Savings Account Component
@@ -38,12 +39,14 @@ export class CloseSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route
* @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService,
private datePipe: DatePipe,
private route: ActivatedRoute,
private router: Router) {
private router: Router,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.paymentTypeOptions = data.savingsAccountActionData[0].paymentTypeOptions;
this.transactionAmount = data.savingsAccountActionData[1].summary.accountBalance;
@@ -112,8 +115,8 @@ export class CloseSavingsAccountComponent implements OnInit {
*/
submit() {
// TODO: Update once language and date settings are setup
const locale = 'en';
const dateFormat = 'dd MMMM yyyy';
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const prevClosedOnDate: Date = this.closeSavingsAccountForm.value.closedOnDate;
this.closeSavingsAccountForm.patchValue({
closedOnDate: this.datePipe.transform(prevClosedOnDate, dateFormat),