refractor(df/locale):savings module (#1301)

This commit is contained in:
Abhishek Kumar
2021-08-08 13:16:30 +05:30
committed by GitHub
parent 997611a9f3
commit 88ee1b4fcd
4 changed files with 28 additions and 18 deletions
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services */
import { SavingsService } from '../../savings.service';
import { SettingsService } from 'app/settings/settings.service';
/**
* Add Savings Charge component.
@@ -37,14 +38,14 @@ export class AddChargeSavingsAccountComponent implements OnInit {
* @param {Router} router Router
* @param {DatePipe} datePipe Date Pipe
* @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/
constructor(
private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe,
private savingsService: SavingsService
) {
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private datePipe: DatePipe,
private savingsService: SavingsService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.savingsChargeOptions = data.savingsAccountActionData.chargeOptions;
});
@@ -111,7 +112,7 @@ export class AddChargeSavingsAccountComponent implements OnInit {
*/
submit() {
const savingsCharge = this.savingsChargeForm.value;
savingsCharge.locale = 'en';
savingsCharge.locale = this.settingsService.language.code;
if (!savingsCharge.feeInterval) {
savingsCharge.feeInterval = this.chargeDetails.feeInterval;
}
@@ -124,7 +125,7 @@ export class AddChargeSavingsAccountComponent implements OnInit {
savingsCharge.feeOnMonthDay = this.datePipe.transform(prevDate, monthDayFormat);
}
} else {
const dateFormat = 'yyyy-MM-dd';
const dateFormat = this.settingsService.dateFormat;
savingsCharge.dateFormat = dateFormat;
if (savingsCharge.dueDate) {
const prevDate = this.savingsChargeForm.value.dueDate;