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
@@ -10,6 +10,7 @@ import { SavingsAccountChargesStepComponent } from '../savings-account-stepper/s
/** Custom Services */ /** Custom Services */
import { SavingsService } from '../savings.service'; import { SavingsService } from '../savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Create Savings Account Component * Create Savings Account Component
@@ -39,11 +40,13 @@ export class CreateSavingsAccountComponent {
* @param {Router} router Router * @param {Router} router Router
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {SavingsService} savingsService Savings Service * @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/ */
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private datePipe: DatePipe, private datePipe: DatePipe,
private savingsService: SavingsService private savingsService: SavingsService,
private settingsService: SettingsService
) { ) {
this.route.data.subscribe((data: { savingsAccountTemplate: any }) => { this.route.data.subscribe((data: { savingsAccountTemplate: any }) => {
this.savingsAccountTemplate = data.savingsAccountTemplate; this.savingsAccountTemplate = data.savingsAccountTemplate;
@@ -98,8 +101,8 @@ export class CreateSavingsAccountComponent {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const monthDayFormat = 'dd MMMM'; const monthDayFormat = 'dd MMMM';
const savingsAccount = { const savingsAccount = {
...this.savingsAccount, ...this.savingsAccount,
@@ -10,6 +10,7 @@ import { SavingsAccountChargesStepComponent } from '../savings-account-stepper/s
/** Custom Services */ /** Custom Services */
import { SavingsService } from '../savings.service'; import { SavingsService } from '../savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Edit Savings Account Component * Edit Savings Account Component
@@ -39,11 +40,13 @@ export class EditSavingsAccountComponent {
* @param {Router} router Router * @param {Router} router Router
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {SavingsService} savingsService Savings Service * @param {SavingsService} savingsService Savings Service
* @param {SettingsService} settingsService Settings Service
*/ */
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private router: Router,
private datePipe: DatePipe, private datePipe: DatePipe,
private savingsService: SavingsService private savingsService: SavingsService,
private settingsService: SettingsService
) { ) {
this.route.data.subscribe((data: { savingsAccountAndTemplate: any }) => { this.route.data.subscribe((data: { savingsAccountAndTemplate: any }) => {
this.savingsAccountAndTemplate = data.savingsAccountAndTemplate; this.savingsAccountAndTemplate = data.savingsAccountAndTemplate;
@@ -103,8 +106,8 @@ export class EditSavingsAccountComponent {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const monthDayFormat = 'dd MMMM'; const monthDayFormat = 'dd MMMM';
const savingsAccount = { const savingsAccount = {
...this.savingsAccount, ...this.savingsAccount,
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Activate Savings Account Component * Activate Savings Account Component
@@ -32,12 +33,14 @@ export class ActivateSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -63,8 +66,8 @@ export class ActivateSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevActivatedOnDate: Date = this.activateSavingsAccountForm.value.activatedOnDate; const prevActivatedOnDate: Date = this.activateSavingsAccountForm.value.activatedOnDate;
this.activateSavingsAccountForm.patchValue({ this.activateSavingsAccountForm.patchValue({
activatedOnDate: this.datePipe.transform(prevActivatedOnDate, dateFormat), activatedOnDate: this.datePipe.transform(prevActivatedOnDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Apply Annual Fees Component * Apply Annual Fees Component
@@ -36,12 +37,14 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
this.route.data.subscribe((data: { savingsAccountActionData: any }) => { this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.savingsAccountData = data.savingsAccountActionData; this.savingsAccountData = data.savingsAccountActionData;
@@ -85,8 +88,8 @@ export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevApprovedOnDate: Date = this.applyAnnualFeesForm.value.dueDate; const prevApprovedOnDate: Date = this.applyAnnualFeesForm.value.dueDate;
this.applyAnnualFeesForm.patchValue({ this.applyAnnualFeesForm.patchValue({
dueDate: this.datePipe.transform(prevApprovedOnDate, dateFormat), dueDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Approve Savings Account Component * Approve Savings Account Component
@@ -32,12 +33,14 @@ export class ApproveSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -64,8 +67,8 @@ export class ApproveSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevApprovedOnDate: Date = this.approveSavingsAccountForm.value.approvedOnDate; const prevApprovedOnDate: Date = this.approveSavingsAccountForm.value.approvedOnDate;
this.approveSavingsAccountForm.patchValue({ this.approveSavingsAccountForm.patchValue({
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat), approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Close Savings Account Component * Close Savings Account Component
@@ -38,12 +39,14 @@ export class CloseSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => { this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.paymentTypeOptions = data.savingsAccountActionData[0].paymentTypeOptions; this.paymentTypeOptions = data.savingsAccountActionData[0].paymentTypeOptions;
this.transactionAmount = data.savingsAccountActionData[1].summary.accountBalance; this.transactionAmount = data.savingsAccountActionData[1].summary.accountBalance;
@@ -112,8 +115,8 @@ export class CloseSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevClosedOnDate: Date = this.closeSavingsAccountForm.value.closedOnDate; const prevClosedOnDate: Date = this.closeSavingsAccountForm.value.closedOnDate;
this.closeSavingsAccountForm.patchValue({ this.closeSavingsAccountForm.patchValue({
closedOnDate: this.datePipe.transform(prevClosedOnDate, dateFormat), closedOnDate: this.datePipe.transform(prevClosedOnDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Post Interest Savings Account Component * Post Interest Savings Account Component
@@ -32,12 +33,14 @@ export class PostInterestAsOnSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -63,8 +66,8 @@ export class PostInterestAsOnSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevTransactionDate: Date = this.postInterestSavingsAccountForm.value.transactionDate; const prevTransactionDate: Date = this.postInterestSavingsAccountForm.value.transactionDate;
this.postInterestSavingsAccountForm.patchValue({ this.postInterestSavingsAccountForm.patchValue({
transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat), transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Reject Savings Account Component * Reject Savings Account Component
@@ -32,12 +33,14 @@ export class RejectSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -64,8 +67,8 @@ export class RejectSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevRejectedOnDate: Date = this.rejectSavingsAccountForm.value.rejectedOnDate; const prevRejectedOnDate: Date = this.rejectSavingsAccountForm.value.rejectedOnDate;
this.rejectSavingsAccountForm.patchValue({ this.rejectSavingsAccountForm.patchValue({
rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat), rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Savings Account Assign Staff Component * Savings Account Assign Staff Component
@@ -36,12 +37,14 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
this.route.data.subscribe((data: { savingsAccountActionData: any }) => { this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.savingsAccountData = data.savingsAccountActionData; this.savingsAccountData = data.savingsAccountActionData;
@@ -72,8 +75,8 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevAssignmentDate: Date = this.savingsAssignStaffForm.value.assignmentDate; const prevAssignmentDate: Date = this.savingsAssignStaffForm.value.assignmentDate;
this.savingsAssignStaffForm.patchValue({ this.savingsAssignStaffForm.patchValue({
assignmentDate: this.datePipe.transform(prevAssignmentDate, dateFormat), assignmentDate: this.datePipe.transform(prevAssignmentDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Savings Account Unassign Staff Component * Savings Account Unassign Staff Component
@@ -32,12 +33,14 @@ export class SavingsAccountUnassignStaffComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -63,8 +66,8 @@ export class SavingsAccountUnassignStaffComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevUnassignmentDate: Date = this.savingsUnassignStaffForm.value.unassignedDate; const prevUnassignmentDate: Date = this.savingsUnassignStaffForm.value.unassignedDate;
this.savingsUnassignStaffForm.patchValue({ this.savingsUnassignStaffForm.patchValue({
unassignedDate: this.datePipe.transform(prevUnassignmentDate, dateFormat), unassignedDate: this.datePipe.transform(prevUnassignmentDate, dateFormat),
@@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Withdraw By Client Savings Account Component * Withdraw By Client Savings Account Component
@@ -32,12 +33,14 @@ export class WithdrawByClientSavingsAccountComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe * @param {DatePipe} datePipe Date Pipe
* @param {ActivatedRoute} route Activated Route * @param {ActivatedRoute} route Activated Route
* @param {Router} router Router * @param {Router} router Router
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService, private savingsService: SavingsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router) { private router: Router,
private settingsService: SettingsService) {
this.accountId = this.route.parent.snapshot.params['savingAccountId']; this.accountId = this.route.parent.snapshot.params['savingAccountId'];
} }
@@ -64,8 +67,8 @@ export class WithdrawByClientSavingsAccountComponent implements OnInit {
*/ */
submit() { submit() {
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const prevWithdrawnOnDate: Date = this.withdrawSavingsAccountForm.value.withdrawnOnDate; const prevWithdrawnOnDate: Date = this.withdrawSavingsAccountForm.value.withdrawnOnDate;
this.withdrawSavingsAccountForm.patchValue({ this.withdrawSavingsAccountForm.patchValue({
withdrawnOnDate: this.datePipe.transform(prevWithdrawnOnDate, dateFormat), withdrawnOnDate: this.datePipe.transform(prevWithdrawnOnDate, dateFormat),
@@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** Custom Dialogs */ /** Custom Dialogs */
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
@@ -62,12 +63,14 @@ export class ChargesTabComponent implements OnInit {
* @param {Router} router Router for navigation. * @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference. * @param {MatDialog} dialog Dialog reference.
* @param {DatePipe} datePipe DatePipe. * @param {DatePipe} datePipe DatePipe.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private savingsService: SavingsService, constructor(private savingsService: SavingsService,
private route: ActivatedRoute, private route: ActivatedRoute,
private datePipe: DatePipe, private datePipe: DatePipe,
private router: Router, private router: Router,
public dialog: MatDialog) { public dialog: MatDialog,
private settingsService: SettingsService) {
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => { this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsAccountData = data.savingsAccountData; this.savingsAccountData = data.savingsAccountData;
this.chargesData = this.savingsAccountData.charges; this.chargesData = this.savingsAccountData.charges;
@@ -124,8 +127,8 @@ export class ChargesTabComponent implements OnInit {
const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data });
payChargeDialogRef.afterClosed().subscribe((response: any) => { payChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) { if (response.data) {
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const dataObject = { const dataObject = {
...response.data.value, ...response.data.value,
dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat),
@@ -194,8 +197,8 @@ export class ChargesTabComponent implements OnInit {
const editChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); const editChargeDialogRef = this.dialog.open(FormDialogComponent, { data });
editChargeDialogRef.afterClosed().subscribe((response: any) => { editChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) { if (response.data) {
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const dataObject = { const dataObject = {
...response.data.value, ...response.data.value,
dateFormat, dateFormat,
@@ -8,6 +8,7 @@ import { DatePipe } from '@angular/common';
/** Custom Dialogs */ /** Custom Dialogs */
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component'; import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component';
import { SettingsService } from 'app/settings/settings.service';
/** Custom Models */ /** Custom Models */
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
@@ -52,11 +53,13 @@ export class MultiRowComponent implements OnInit, OnChanges {
* @param {DatePipe} datePipe Date Pipe. * @param {DatePipe} datePipe Date Pipe.
* @param {SavingsService} savingsService Savingss Service. * @param {SavingsService} savingsService Savingss Service.
* @param {MatDialog} dialog Mat Dialog. * @param {MatDialog} dialog Mat Dialog.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private datePipe: DatePipe, private datePipe: DatePipe,
private savingsService: SavingsService, private savingsService: SavingsService,
private dialog: MatDialog) { private dialog: MatDialog,
private settingsService: SettingsService) {
this.savingAccountId = this.route.parent.parent.snapshot.paramMap.get('savingAccountId'); this.savingAccountId = this.route.parent.parent.snapshot.paramMap.get('savingAccountId');
} }
@@ -85,7 +88,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
* Adds a new row to the given multi row data table. * Adds a new row to the given multi row data table.
*/ */
add() { add() {
let dataTableEntryObject: any = { locale: 'en' }; let dataTableEntryObject: any = { locale: this.settingsService.language.code };
const dateTransformColumns: string[] = []; const dateTransformColumns: string[] = [];
const columns = this.dataObject.columnHeaders.filter((column: any) => { const columns = this.dataObject.columnHeaders.filter((column: any) => {
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id')); return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
@@ -118,7 +121,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
}); });
case 'DATE': { case 'DATE': {
dateTransformColumns.push(column.columnName); dateTransformColumns.push(column.columnName);
dataTableEntryObject.dateFormat = 'yyyy-MM-dd'; dataTableEntryObject.dateFormat = this.settingsService.dateFormat;
return new DatepickerBase({ return new DatepickerBase({
controlName: column.columnName, controlName: column.columnName,
label: column.columnName, label: column.columnName,
@@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common';
/** Custom Components */ /** Custom Components */
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component'; import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component';
import { SettingsService } from 'app/settings/settings.service';
/** Custom Models */ /** Custom Models */
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
@@ -43,11 +44,13 @@ export class SingleRowComponent implements OnInit {
* @param {DatePipe} datePipe Date Pipe. * @param {DatePipe} datePipe Date Pipe.
* @param {SavingsService} savingsService Savingss Service. * @param {SavingsService} savingsService Savingss Service.
* @param {MatDialog} dialog Mat Dialog. * @param {MatDialog} dialog Mat Dialog.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private datePipe: DatePipe, private datePipe: DatePipe,
private dialog: MatDialog, private dialog: MatDialog,
private savingsService: SavingsService) { private savingsService: SavingsService,
private settingsService: SettingsService) {
this.savingAccountId = this.route.parent.parent.snapshot.paramMap.get('savingAccountId'); this.savingAccountId = this.route.parent.parent.snapshot.paramMap.get('savingAccountId');
} }
@@ -65,7 +68,7 @@ export class SingleRowComponent implements OnInit {
* Creates a new instance of the given single row data table. * Creates a new instance of the given single row data table.
*/ */
add() { add() {
let dataTableEntryObject: any = { locale: 'en' }; let dataTableEntryObject: any = { locale: this.settingsService.language.code };
const dateTransformColumns: string[] = []; const dateTransformColumns: string[] = [];
const columns = this.dataObject.columnHeaders.filter((column: any) => { const columns = this.dataObject.columnHeaders.filter((column: any) => {
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id')); return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
@@ -95,7 +98,7 @@ export class SingleRowComponent implements OnInit {
* Edits the current instance of single row data table. * Edits the current instance of single row data table.
*/ */
edit() { edit() {
let dataTableEntryObject: any = { locale: 'en' }; let dataTableEntryObject: any = { locale: this.settingsService.language.code };
const dateTransformColumns: string[] = []; const dateTransformColumns: string[] = [];
const columns = this.dataObject.columnHeaders.filter((column: any) => { const columns = this.dataObject.columnHeaders.filter((column: any) => {
return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id')); return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id'));
@@ -180,7 +183,7 @@ export class SingleRowComponent implements OnInit {
}); });
case 'DATE': { case 'DATE': {
dateTransformColumns.push(column.columnName); dateTransformColumns.push(column.columnName);
dataTableEntryObject.dateFormat = 'yyyy-MM-dd'; dataTableEntryObject.dateFormat = this.settingsService.dateFormat;
return new DatepickerBase({ return new DatepickerBase({
controlName: column.columnName, controlName: column.columnName,
label: column.columnName, label: column.columnName,
@@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { AccountTransfersService } from 'app/account-transfers/account-transfers.service'; import { AccountTransfersService } from 'app/account-transfers/account-transfers.service';
import { SettingsService } from 'app/settings/settings.service';
/** Dialog Components */ /** Dialog Components */
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
@@ -44,11 +45,13 @@ export class StandingInstructionsTabComponent implements OnInit {
/** /**
* Retrieves Savings Account Data from `resolve`. * Retrieves Savings Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route. * @param {ActivatedRoute} route Activated Route.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private savingsService: SavingsService, private savingsService: SavingsService,
private dialog: MatDialog, private dialog: MatDialog,
private accountTransfersService: AccountTransfersService) { private accountTransfersService: AccountTransfersService,
private settingsService: SettingsService) {
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => { this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.savingsData = data.savingsAccountData; this.savingsData = data.savingsAccountData;
}); });
@@ -65,8 +68,8 @@ export class StandingInstructionsTabComponent implements OnInit {
const clientId = this.savingsData.clientId; const clientId = this.savingsData.clientId;
const clientName = this.savingsData.clientName; const clientName = this.savingsData.clientName;
const accountId = this.savingsData.id; const accountId = this.savingsData.id;
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
this.savingsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => { this.savingsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => {
this.instructionsData = response.pageItems; this.instructionsData = response.pageItems;
this.dataSource.data = this.instructionsData; this.dataSource.data = this.instructionsData;
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** /**
* Edit Transaction component. * Edit Transaction component.
@@ -45,12 +46,14 @@ export class EditTransactionComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route. * @param {ActivatedRoute} route Activated Route.
* @param {DatePipe} datePipe DatePipe. * @param {DatePipe} datePipe DatePipe.
* @param {Router} router Router for navigation. * @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private formBuilder: FormBuilder, constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private datePipe: DatePipe, private datePipe: DatePipe,
private savingsService: SavingsService) { private savingsService: SavingsService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountTransactionTemplate: any }) => { this.route.data.subscribe((data: { savingsAccountTransactionTemplate: any }) => {
this.transactionTemplateData = data.savingsAccountTransactionTemplate; this.transactionTemplateData = data.savingsAccountTransactionTemplate;
this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions; this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions;
@@ -107,12 +110,12 @@ export class EditTransactionComponent implements OnInit {
submit() { submit() {
const prevTransactionDate: Date = this.editTransactionForm.value.transactionDate; const prevTransactionDate: Date = this.editTransactionForm.value.transactionDate;
// TODO: Update once language and date settings are setup // TODO: Update once language and date settings are setup
const dateFormat = 'dd-MM-yyyy'; const dateFormat = this.settingsService.dateFormat;
this.editTransactionForm.patchValue({ this.editTransactionForm.patchValue({
transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat) transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
}); });
const transactionData = this.editTransactionForm.value; const transactionData = this.editTransactionForm.value;
transactionData.locale = 'en'; transactionData.locale = this.settingsService.language.code;
transactionData.dateFormat = dateFormat; transactionData.dateFormat = dateFormat;
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, 'modify', transactionData, this.transactionTemplateData.id) this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, 'modify', transactionData, this.transactionTemplateData.id)
.subscribe(res => { .subscribe(res => {
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** Custom Dialogs */ /** Custom Dialogs */
import { UndoTransactionDialogComponent } from '../../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component'; import { UndoTransactionDialogComponent } from '../../custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component';
@@ -31,12 +32,14 @@ export class ViewTransactionComponent {
* @param {Router} router Router for navigation. * @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference. * @param {MatDialog} dialog Dialog reference.
* @param {DatePipe} datePipe DatePipe. * @param {DatePipe} datePipe DatePipe.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private savingsService: SavingsService, constructor(private savingsService: SavingsService,
private route: ActivatedRoute, private route: ActivatedRoute,
private datePipe: DatePipe, private datePipe: DatePipe,
private router: Router, private router: Router,
public dialog: MatDialog) { public dialog: MatDialog,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountTransaction: any }) => { this.route.data.subscribe((data: { savingsAccountTransaction: any }) => {
this.transactionData = data.savingsAccountTransaction; this.transactionData = data.savingsAccountTransaction;
}); });
@@ -50,8 +53,8 @@ export class ViewTransactionComponent {
const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent); const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent);
undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => { undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.confirm) { if (response.confirm) {
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const data = { const data = {
transactionDate: this.datePipe.transform(this.transactionData.date && new Date(this.transactionData.date), dateFormat), transactionDate: this.datePipe.transform(this.transactionData.date && new Date(this.transactionData.date), dateFormat),
transactionAmount: 0, transactionAmount: 0,
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
/** Custom Services */ /** Custom Services */
import { SavingsService } from 'app/savings/savings.service'; import { SavingsService } from 'app/savings/savings.service';
import { SettingsService } from 'app/settings/settings.service';
/** Custom Dialogs */ /** Custom Dialogs */
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
@@ -40,12 +41,14 @@ export class ViewChargeComponent {
* @param {Router} router Router for navigation. * @param {Router} router Router for navigation.
* @param {MatDialog} dialog Dialog reference. * @param {MatDialog} dialog Dialog reference.
* @param {DatePipe} datePipe DatePipe. * @param {DatePipe} datePipe DatePipe.
* @param {SettingsService} settingsService Setting service
*/ */
constructor(private savingsService: SavingsService, constructor(private savingsService: SavingsService,
private route: ActivatedRoute, private route: ActivatedRoute,
private datePipe: DatePipe, private datePipe: DatePipe,
private router: Router, private router: Router,
public dialog: MatDialog) { public dialog: MatDialog,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountCharge: any }) => { this.route.data.subscribe((data: { savingsAccountCharge: any }) => {
this.chargeData = data.savingsAccountCharge; this.chargeData = data.savingsAccountCharge;
}); });
@@ -82,8 +85,8 @@ export class ViewChargeComponent {
const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data });
payChargeDialogRef.afterClosed().subscribe((response: any) => { payChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) { if (response.data) {
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const dataObject = { const dataObject = {
...response.data.value, ...response.data.value,
dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat),
@@ -149,8 +152,8 @@ export class ViewChargeComponent {
const editChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); const editChargeDialogRef = this.dialog.open(FormDialogComponent, { data });
editChargeDialogRef.afterClosed().subscribe((response: any) => { editChargeDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) { if (response.data) {
const locale = 'en'; const locale = this.settingsService.language.code;
const dateFormat = 'dd MMMM yyyy'; const dateFormat = this.settingsService.dateFormat;
const dataObject = { const dataObject = {
...response.data.value, ...response.data.value,
dateFormat, dateFormat,