diff --git a/src/app/savings/create-savings-account/create-savings-account.component.ts b/src/app/savings/create-savings-account/create-savings-account.component.ts index 9b36615ba..5986ae974 100644 --- a/src/app/savings/create-savings-account/create-savings-account.component.ts +++ b/src/app/savings/create-savings-account/create-savings-account.component.ts @@ -10,6 +10,7 @@ import { SavingsAccountChargesStepComponent } from '../savings-account-stepper/s /** Custom Services */ import { SavingsService } from '../savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Create Savings Account Component @@ -39,11 +40,13 @@ export class CreateSavingsAccountComponent { * @param {Router} router Router * @param {DatePipe} datePipe Date Pipe * @param {SavingsService} savingsService Savings Service + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private savingsService: SavingsService + private savingsService: SavingsService, + private settingsService: SettingsService ) { this.route.data.subscribe((data: { savingsAccountTemplate: any }) => { this.savingsAccountTemplate = data.savingsAccountTemplate; @@ -98,8 +101,8 @@ export class CreateSavingsAccountComponent { */ 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 monthDayFormat = 'dd MMMM'; const savingsAccount = { ...this.savingsAccount, diff --git a/src/app/savings/edit-savings-account/edit-savings-account.component.ts b/src/app/savings/edit-savings-account/edit-savings-account.component.ts index 0013ec29c..4dd5dd815 100644 --- a/src/app/savings/edit-savings-account/edit-savings-account.component.ts +++ b/src/app/savings/edit-savings-account/edit-savings-account.component.ts @@ -10,6 +10,7 @@ import { SavingsAccountChargesStepComponent } from '../savings-account-stepper/s /** Custom Services */ import { SavingsService } from '../savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Edit Savings Account Component @@ -39,11 +40,13 @@ export class EditSavingsAccountComponent { * @param {Router} router Router * @param {DatePipe} datePipe Date Pipe * @param {SavingsService} savingsService Savings Service + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private savingsService: SavingsService + private savingsService: SavingsService, + private settingsService: SettingsService ) { this.route.data.subscribe((data: { savingsAccountAndTemplate: any }) => { this.savingsAccountAndTemplate = data.savingsAccountAndTemplate; @@ -103,8 +106,8 @@ export class EditSavingsAccountComponent { */ 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 monthDayFormat = 'dd MMMM'; const savingsAccount = { ...this.savingsAccount, diff --git a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts index fe2234cf4..99149f189 100644 --- a/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/activate-savings-account/activate-savings-account.component.ts @@ -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'; /** * Activate Savings Account Component @@ -32,12 +33,14 @@ export class ActivateSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -63,8 +66,8 @@ export class ActivateSavingsAccountComponent 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 prevActivatedOnDate: Date = this.activateSavingsAccountForm.value.activatedOnDate; this.activateSavingsAccountForm.patchValue({ activatedOnDate: this.datePipe.transform(prevActivatedOnDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component.ts b/src/app/savings/saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component.ts index 02caab90f..7c0255a2b 100644 --- a/src/app/savings/saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component.ts @@ -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'; /** * Apply Annual Fees Component @@ -36,12 +37,14 @@ export class ApplyAnnualFeesSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; this.route.data.subscribe((data: { savingsAccountActionData: any }) => { this.savingsAccountData = data.savingsAccountActionData; @@ -85,8 +88,8 @@ export class ApplyAnnualFeesSavingsAccountComponent 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 prevApprovedOnDate: Date = this.applyAnnualFeesForm.value.dueDate; this.applyAnnualFeesForm.patchValue({ dueDate: this.datePipe.transform(prevApprovedOnDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/approve-savings-account/approve-savings-account.component.ts b/src/app/savings/saving-account-actions/approve-savings-account/approve-savings-account.component.ts index d35c7d05b..d3cd17a18 100644 --- a/src/app/savings/saving-account-actions/approve-savings-account/approve-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/approve-savings-account/approve-savings-account.component.ts @@ -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'; /** * Approve Savings Account Component @@ -32,12 +33,14 @@ export class ApproveSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -64,8 +67,8 @@ export class ApproveSavingsAccountComponent 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 prevApprovedOnDate: Date = this.approveSavingsAccountForm.value.approvedOnDate; this.approveSavingsAccountForm.patchValue({ approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/close-savings-account/close-savings-account.component.ts b/src/app/savings/saving-account-actions/close-savings-account/close-savings-account.component.ts index f1a343efd..465e43cb8 100644 --- a/src/app/savings/saving-account-actions/close-savings-account/close-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/close-savings-account/close-savings-account.component.ts @@ -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), diff --git a/src/app/savings/saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component.ts b/src/app/savings/saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component.ts index 4e5f5dbe7..8db0691c9 100644 --- a/src/app/savings/saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component.ts @@ -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'; /** * Post Interest Savings Account Component @@ -32,12 +33,14 @@ export class PostInterestAsOnSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -63,8 +66,8 @@ export class PostInterestAsOnSavingsAccountComponent 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 prevTransactionDate: Date = this.postInterestSavingsAccountForm.value.transactionDate; this.postInterestSavingsAccountForm.patchValue({ transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts index 3ee1fd105..6e11efb0a 100644 --- a/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/reject-savings-account/reject-savings-account.component.ts @@ -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'; /** * Reject Savings Account Component @@ -32,12 +33,14 @@ export class RejectSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -64,8 +67,8 @@ export class RejectSavingsAccountComponent 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 prevRejectedOnDate: Date = this.rejectSavingsAccountForm.value.rejectedOnDate; this.rejectSavingsAccountForm.patchValue({ rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component.ts b/src/app/savings/saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component.ts index aada31b9a..cf7e7d058 100644 --- a/src/app/savings/saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component.ts +++ b/src/app/savings/saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component.ts @@ -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'; /** * Savings Account Assign Staff Component @@ -36,12 +37,14 @@ export class SavingsAccountAssignStaffComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; this.route.data.subscribe((data: { savingsAccountActionData: any }) => { this.savingsAccountData = data.savingsAccountActionData; @@ -72,8 +75,8 @@ export class SavingsAccountAssignStaffComponent 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 prevAssignmentDate: Date = this.savingsAssignStaffForm.value.assignmentDate; this.savingsAssignStaffForm.patchValue({ assignmentDate: this.datePipe.transform(prevAssignmentDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component.ts b/src/app/savings/saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component.ts index 6013cc02b..9ce7585d2 100644 --- a/src/app/savings/saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component.ts +++ b/src/app/savings/saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component.ts @@ -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'; /** * Savings Account Unassign Staff Component @@ -32,12 +33,14 @@ export class SavingsAccountUnassignStaffComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -63,8 +66,8 @@ export class SavingsAccountUnassignStaffComponent 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 prevUnassignmentDate: Date = this.savingsUnassignStaffForm.value.unassignedDate; this.savingsUnassignStaffForm.patchValue({ unassignedDate: this.datePipe.transform(prevUnassignmentDate, dateFormat), diff --git a/src/app/savings/saving-account-actions/withdraw-by-client-savings-account/withdraw-by-client-savings-account.component.ts b/src/app/savings/saving-account-actions/withdraw-by-client-savings-account/withdraw-by-client-savings-account.component.ts index c62e96bb6..3eb39b0e9 100644 --- a/src/app/savings/saving-account-actions/withdraw-by-client-savings-account/withdraw-by-client-savings-account.component.ts +++ b/src/app/savings/saving-account-actions/withdraw-by-client-savings-account/withdraw-by-client-savings-account.component.ts @@ -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'; /** * Withdraw By Client Savings Account Component @@ -32,12 +33,14 @@ export class WithdrawByClientSavingsAccountComponent 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.accountId = this.route.parent.snapshot.params['savingAccountId']; } @@ -64,8 +67,8 @@ export class WithdrawByClientSavingsAccountComponent 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 prevWithdrawnOnDate: Date = this.withdrawSavingsAccountForm.value.withdrawnOnDate; this.withdrawSavingsAccountForm.patchValue({ withdrawnOnDate: this.datePipe.transform(prevWithdrawnOnDate, dateFormat), diff --git a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts index f48845a69..fc5dc43a3 100644 --- a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts +++ b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts @@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ 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 {MatDialog} dialog Dialog reference. * @param {DatePipe} datePipe DatePipe. + * @param {SettingsService} settingsService Setting service */ constructor(private savingsService: SavingsService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.parent.data.subscribe((data: { savingsAccountData: any }) => { this.savingsAccountData = data.savingsAccountData; this.chargesData = this.savingsAccountData.charges; @@ -124,8 +127,8 @@ export class ChargesTabComponent implements OnInit { const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); payChargeDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const dataObject = { ...response.data.value, 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 }); editChargeDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const dataObject = { ...response.data.value, dateFormat, diff --git a/src/app/savings/savings-account-view/datatable-tabs/multi-row/multi-row.component.ts b/src/app/savings/savings-account-view/datatable-tabs/multi-row/multi-row.component.ts index 1590b8077..a56df4c09 100644 --- a/src/app/savings/savings-account-view/datatable-tabs/multi-row/multi-row.component.ts +++ b/src/app/savings/savings-account-view/datatable-tabs/multi-row/multi-row.component.ts @@ -8,6 +8,7 @@ import { DatePipe } from '@angular/common'; /** Custom Dialogs */ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Models */ 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 {SavingsService} savingsService Savingss Service. * @param {MatDialog} dialog Mat Dialog. + * @param {SettingsService} settingsService Setting service */ constructor(private route: ActivatedRoute, private datePipe: DatePipe, private savingsService: SavingsService, - private dialog: MatDialog) { + private dialog: MatDialog, + private settingsService: SettingsService) { 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. */ add() { - let dataTableEntryObject: any = { locale: 'en' }; + let dataTableEntryObject: any = { locale: this.settingsService.language.code }; const dateTransformColumns: string[] = []; const columns = this.dataObject.columnHeaders.filter((column: any) => { return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id')); @@ -118,7 +121,7 @@ export class MultiRowComponent implements OnInit, OnChanges { }); case 'DATE': { dateTransformColumns.push(column.columnName); - dataTableEntryObject.dateFormat = 'yyyy-MM-dd'; + dataTableEntryObject.dateFormat = this.settingsService.dateFormat; return new DatepickerBase({ controlName: column.columnName, label: column.columnName, diff --git a/src/app/savings/savings-account-view/datatable-tabs/single-row/single-row.component.ts b/src/app/savings/savings-account-view/datatable-tabs/single-row/single-row.component.ts index ff506cdaf..6582eb0a8 100644 --- a/src/app/savings/savings-account-view/datatable-tabs/single-row/single-row.component.ts +++ b/src/app/savings/savings-account-view/datatable-tabs/single-row/single-row.component.ts @@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common'; /** Custom Components */ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; import { DeleteDialogComponent } from '../../../../shared/delete-dialog/delete-dialog.component'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Models */ 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 {SavingsService} savingsService Savingss Service. * @param {MatDialog} dialog Mat Dialog. + * @param {SettingsService} settingsService Setting service */ constructor(private route: ActivatedRoute, private datePipe: DatePipe, private dialog: MatDialog, - private savingsService: SavingsService) { + private savingsService: SavingsService, + private settingsService: SettingsService) { 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. */ add() { - let dataTableEntryObject: any = { locale: 'en' }; + let dataTableEntryObject: any = { locale: this.settingsService.language.code }; const dateTransformColumns: string[] = []; const columns = this.dataObject.columnHeaders.filter((column: any) => { 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. */ edit() { - let dataTableEntryObject: any = { locale: 'en' }; + let dataTableEntryObject: any = { locale: this.settingsService.language.code }; const dateTransformColumns: string[] = []; const columns = this.dataObject.columnHeaders.filter((column: any) => { return ((column.columnName !== 'id') && (column.columnName !== 'savings_account_id')); @@ -180,7 +183,7 @@ export class SingleRowComponent implements OnInit { }); case 'DATE': { dateTransformColumns.push(column.columnName); - dataTableEntryObject.dateFormat = 'yyyy-MM-dd'; + dataTableEntryObject.dateFormat = this.settingsService.dateFormat; return new DatepickerBase({ controlName: column.columnName, label: column.columnName, diff --git a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts index 2153716af..28593ba49 100644 --- a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; import { AccountTransfersService } from 'app/account-transfers/account-transfers.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Dialog Components */ 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`. * @param {ActivatedRoute} route Activated Route. + * @param {SettingsService} settingsService Setting service */ constructor(private route: ActivatedRoute, private savingsService: SavingsService, private dialog: MatDialog, - private accountTransfersService: AccountTransfersService) { + private accountTransfersService: AccountTransfersService, + private settingsService: SettingsService) { this.route.parent.data.subscribe((data: { savingsAccountData: any }) => { this.savingsData = data.savingsAccountData; }); @@ -65,8 +68,8 @@ export class StandingInstructionsTabComponent implements OnInit { const clientId = this.savingsData.clientId; const clientName = this.savingsData.clientName; const accountId = this.savingsData.id; - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; this.savingsService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => { this.instructionsData = response.pageItems; this.dataSource.data = this.instructionsData; diff --git a/src/app/savings/savings-account-view/transactions/edit-transaction/edit-transaction.component.ts b/src/app/savings/savings-account-view/transactions/edit-transaction/edit-transaction.component.ts index 3db599e82..c52af5dc9 100644 --- a/src/app/savings/savings-account-view/transactions/edit-transaction/edit-transaction.component.ts +++ b/src/app/savings/savings-account-view/transactions/edit-transaction/edit-transaction.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Edit Transaction component. @@ -45,12 +46,14 @@ export class EditTransactionComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {DatePipe} datePipe DatePipe. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Setting service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private savingsService: SavingsService) { + private savingsService: SavingsService, + private settingsService: SettingsService) { this.route.data.subscribe((data: { savingsAccountTransactionTemplate: any }) => { this.transactionTemplateData = data.savingsAccountTransactionTemplate; this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions; @@ -107,12 +110,12 @@ export class EditTransactionComponent implements OnInit { submit() { const prevTransactionDate: Date = this.editTransactionForm.value.transactionDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.editTransactionForm.patchValue({ transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat) }); const transactionData = this.editTransactionForm.value; - transactionData.locale = 'en'; + transactionData.locale = this.settingsService.language.code; transactionData.dateFormat = dateFormat; this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, 'modify', transactionData, this.transactionTemplateData.id) .subscribe(res => { diff --git a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts index 15b324c7d..d2506145b 100644 --- a/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts +++ b/src/app/savings/savings-account-view/transactions/view-transaction/view-transaction.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ 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 {MatDialog} dialog Dialog reference. * @param {DatePipe} datePipe DatePipe. + * @param {SettingsService} settingsService Setting service */ constructor(private savingsService: SavingsService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.data.subscribe((data: { savingsAccountTransaction: any }) => { this.transactionData = data.savingsAccountTransaction; }); @@ -50,8 +53,8 @@ export class ViewTransactionComponent { const undoTransactionAccountDialogRef = this.dialog.open(UndoTransactionDialogComponent); undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => { if (response.confirm) { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const data = { transactionDate: this.datePipe.transform(this.transactionData.date && new Date(this.transactionData.date), dateFormat), transactionAmount: 0, diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.ts b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts index d0f7808d8..0687b5a65 100644 --- a/src/app/savings/savings-account-view/view-charge/view-charge.component.ts +++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; @@ -40,12 +41,14 @@ export class ViewChargeComponent { * @param {Router} router Router for navigation. * @param {MatDialog} dialog Dialog reference. * @param {DatePipe} datePipe DatePipe. + * @param {SettingsService} settingsService Setting service */ constructor(private savingsService: SavingsService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.data.subscribe((data: { savingsAccountCharge: any }) => { this.chargeData = data.savingsAccountCharge; }); @@ -82,8 +85,8 @@ export class ViewChargeComponent { const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); payChargeDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const dataObject = { ...response.data.value, dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), @@ -149,8 +152,8 @@ export class ViewChargeComponent { const editChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); editChargeDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const dataObject = { ...response.data.value, dateFormat,