diff --git a/src/app/loans/create-loans-account/create-loans-account.component.ts b/src/app/loans/create-loans-account/create-loans-account.component.ts index 93db8fc8c..a209aaaa4 100644 --- a/src/app/loans/create-loans-account/create-loans-account.component.ts +++ b/src/app/loans/create-loans-account/create-loans-account.component.ts @@ -5,6 +5,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from '../loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Step Components */ import { LoansAccountDetailsStepComponent } from '../loans-account-stepper/loans-account-details-step/loans-account-details-step.component'; @@ -39,11 +40,13 @@ export class CreateLoansAccountComponent implements OnInit { * @param {router} Router Router. * @param {datePipe} DatePipe Date Pipe * @param {loansService} LoansService Loans Service + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private loansService: LoansService + private loansService: LoansService, + private settingsService: SettingsService ) { this.route.data.subscribe((data: { loansAccountTemplate: any }) => { this.loansAccountTemplate = data.loansAccountTemplate; @@ -95,8 +98,8 @@ export class CreateLoansAccountComponent implements OnInit { * Submits Data to create loan account */ submit() { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const loanType = 'individual'; const loansAccountData = { ...this.loansAccount, diff --git a/src/app/loans/edit-loans-account/edit-loans-account.component.ts b/src/app/loans/edit-loans-account/edit-loans-account.component.ts index 37dc1a9d7..4e4a1f02f 100644 --- a/src/app/loans/edit-loans-account/edit-loans-account.component.ts +++ b/src/app/loans/edit-loans-account/edit-loans-account.component.ts @@ -6,6 +6,12 @@ import { LoansAccountDetailsStepComponent } from '../loans-account-stepper/loans import { LoansAccountTermsStepComponent } from '../loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component'; import { LoansAccountChargesStepComponent } from '../loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + +/** + * Edit Loans + */ @Component({ selector: 'mifosx-edit-loans-account', templateUrl: './edit-loans-account.component.html', @@ -31,11 +37,13 @@ export class EditLoansAccountComponent implements OnInit { * @param {router} Router Router. * @param {datePipe} DatePipe Date Pipe * @param {loansService} LoansService Loans Service + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private loansService: LoansService + private loansService: LoansService, + private settingsService: SettingsService ) { this.route.data.subscribe((data: { loansAccountAndTemplate: any }) => { this.loansAccountAndTemplate = data.loansAccountAndTemplate; @@ -93,8 +101,8 @@ export class EditLoansAccountComponent implements OnInit { * Submits Data to create loan account */ submit() { - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const loanType = 'individual'; const loansAccountData = { ...this.loansAccount, diff --git a/src/app/loans/loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component.ts index 762cf1c3b..70e619848 100644 --- a/src/app/loans/loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component.ts +++ b/src/app/loans/loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component.ts @@ -13,6 +13,7 @@ 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'; +import { SettingsService } from 'app/settings/settings.service'; /** * Recurring Deposit Account Charges Step @@ -54,9 +55,11 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges { * Loans Account Charges Form Step * @param {dialog} MatDialog Mat Dialog * @param {datePipe} DatePipe DatePipe + * @param {SettingsService} settingsService Settings Service */ constructor(public dialog: MatDialog, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { } ngOnInit() { @@ -139,7 +142,7 @@ export class LoansAccountChargesStepComponent implements OnInit, OnChanges { editNoteDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { let newCharge: any; - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; const date = this.datePipe.transform(response.data.value.date, dateFormat); switch (charge.chargeTimeType.value) { case 'Specified due date': diff --git a/src/app/loans/loans-view/charges-tab/charges-tab.component.ts b/src/app/loans/loans-view/charges-tab/charges-tab.component.ts index a56aa27e5..f010e62d7 100644 --- a/src/app/loans/loans-view/charges-tab/charges-tab.component.ts +++ b/src/app/loans/loans-view/charges-tab/charges-tab.component.ts @@ -9,6 +9,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; @@ -46,12 +47,14 @@ export class ChargesTabComponent implements OnInit { /** * Retrieves the loans data from `resolve`. * @param {ActivatedRoute} route Activated Route. + * @param {SettingsService} settingsService Settings Service */ constructor(private loansService: LoansService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.parent.data.subscribe(( data: { loanDetailsData: any }) => { this.loanDetails = data.loanDetailsData; }); @@ -105,7 +108,7 @@ export class ChargesTabComponent implements OnInit { payChargeDialogRef.afterClosed().subscribe((response: any) => { if (response.data) { const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; const dataObject = { ...response.data.value, dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), @@ -158,8 +161,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/loans/loans-view/datatable-tab/multi-row/multi-row.component.ts b/src/app/loans/loans-view/datatable-tab/multi-row/multi-row.component.ts index 2e05e529c..262a1c3be 100644 --- a/src/app/loans/loans-view/datatable-tab/multi-row/multi-row.component.ts +++ b/src/app/loans/loans-view/datatable-tab/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 {LoansService} loansService Loans Service. * @param {MatDialog} dialog Mat Dialog. + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private datePipe: DatePipe, private loansService: LoansService, - private dialog: MatDialog) { + private dialog: MatDialog, + private settingsService: SettingsService) { this.loanId = this.route.parent.parent.snapshot.paramMap.get('loanId'); } @@ -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, @@ -129,7 +132,7 @@ export class MultiRowComponent implements OnInit, OnChanges { } case 'DATETIME': { dateTransformColumns.push(column.columnName); - dataTableEntryObject.dateFormat = 'yyyy-MM-dd HH:mm'; + dataTableEntryObject.dateFormat = this.settingsService.dateFormat; return new DatepickerBase({ controlName: column.columnName, label: column.columnName, diff --git a/src/app/loans/loans-view/datatable-tab/single-row/single-row.component.ts b/src/app/loans/loans-view/datatable-tab/single-row/single-row.component.ts index 478ff8dcb..821952b85 100644 --- a/src/app/loans/loans-view/datatable-tab/single-row/single-row.component.ts +++ b/src/app/loans/loans-view/datatable-tab/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'; @@ -40,11 +41,13 @@ export class SingleRowComponent implements OnInit { * @param {DatePipe} datePipe Date Pipe. * @param {LoansService} loansService Loans Service. * @param {MatDialog} dialog Mat Dialog. + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private datePipe: DatePipe, private dialog: MatDialog, - private loansService: LoansService) { + private loansService: LoansService, + private settingsService: SettingsService) { this.loanId = this.route.parent.parent.snapshot.paramMap.get('loanId'); } @@ -62,7 +65,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 !== 'loan_id')); @@ -92,7 +95,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 !== 'loan_id')); @@ -177,7 +180,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/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts b/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts index c7e5961dc..72a4c3d51 100644 --- a/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from '../../../loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Create Add Loan Charge component. @@ -48,12 +49,14 @@ export class AddLoanChargeComponent implements OnInit { * @param {AccountingService} accountingService Accounting Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private loansService: LoansService) { + private loansService: LoansService, + private settingsService: SettingsService) { this.route.data.subscribe((data: { actionButtonData: any }) => { this.loanChargeOptions = data.actionButtonData.chargeOptions; }); @@ -97,12 +100,12 @@ export class AddLoanChargeComponent implements OnInit { submit() { const prevDueDate: Date = this.loanChargeForm.value.dueDate; // TODO: Update once language and date settings are setup - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.loanChargeForm.patchValue({ dueDate: this.datePipe.transform(prevDueDate, dateFormat) }); const loanCharge = this.loanChargeForm.value; - loanCharge.locale = 'en'; + loanCharge.locale = this.settingsService.language.code; loanCharge.dateFormat = dateFormat; this.loansService.createLoanCharge(this.loanId, 'charges', loanCharge).subscribe(res => { this.router.navigate(['../../general'], { relativeTo: this.route }); diff --git a/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts index 799bf1e3e..47e506516 100644 --- a/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts @@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services. */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Approve Loan component. @@ -36,12 +37,14 @@ export class ApproveLoanComponent implements OnInit { * @param datePipe Date Pipe. * @param loanService Loan Service. * @param router Router. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private datePipe: DatePipe, private loanService: LoansService, - private router: Router) { + private router: Router, + private settingsService: SettingsService) { this.route.data.subscribe((data: { actionButtonData: any }) => { this.loanData = data.actionButtonData; }); @@ -74,8 +77,8 @@ export class ApproveLoanComponent implements OnInit { * Submits Approve form. */ submit() { - const dateFormat = 'dd MMMM yyyy'; - const local = 'en'; + const local = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const approvedOnDate = this.approveLoanForm.value.approvedOnDate; const expectedDisbursementDate = this.approveLoanForm.value.expectedDisbursementDate; this.approveLoanForm.patchValue({ diff --git a/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts b/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts index 6618fcb8e..e998d7334 100644 --- a/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts @@ -5,6 +5,9 @@ import { MatDialog } from '@angular/material/dialog'; import { LoansService } from 'app/loans/loans.service'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + @Component({ selector: 'mifosx-assign-loan-officer', templateUrl: './assign-loan-officer.component.html', @@ -28,12 +31,14 @@ export class AssignLoanOfficerComponent implements OnInit { * @param {LoansService} systemService Loan Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -57,12 +62,12 @@ export class AssignLoanOfficerComponent implements OnInit { submit() { const assignmentDate = this.assignOfficerForm.value.assignmentDate; - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.assignOfficerForm.patchValue({ assignmentDate: this.datePipe.transform(assignmentDate, dateFormat) }); const assignForm = this.assignOfficerForm.value; - assignForm.locale = 'en'; + assignForm.locale = this.settingsService.language.code; assignForm.dateFormat = dateFormat; assignForm.fromLoanOfficerId = this.dataObject.loanOfficerId || ''; diff --git a/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts b/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts index 96cb993b0..db6825d7d 100644 --- a/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts @@ -4,6 +4,9 @@ import { LoansService } from 'app/loans/loans.service'; import { ActivatedRoute, Router } from '@angular/router'; import { DatePipe } from '@angular/common'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + @Component({ selector: 'mifosx-close-as-rescheduled', templateUrl: './close-as-rescheduled.component.html', @@ -27,12 +30,14 @@ export class CloseAsRescheduledComponent implements OnInit { * @param {LoansService} systemService Loan Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -59,12 +64,12 @@ export class CloseAsRescheduledComponent implements OnInit { */ submit() { const transactionDate = this.closeLoanForm.value.transactionDate; - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.closeLoanForm.patchValue({ transactionDate: this.datePipe.transform(transactionDate, dateFormat) }); const closeForm = this.closeLoanForm.value; - closeForm.locale = 'en'; + closeForm.locale = this.settingsService.language.code; closeForm.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close-rescheduled') .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts b/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts index 2e02ab6b3..bcd8e78bd 100644 --- a/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts @@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router'; import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; import { ClientsService } from 'app/clients/clients.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Create Guarantor Action @@ -42,13 +43,15 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private clientsService: ClientsService) { + private clientsService: ClientsService, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -150,8 +153,8 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit { const prevdob: Date = this.newGuarantorForm.value.dob; const guarantorTypeId: number = this.newGuarantorForm.value.existingClient ? this.dataObject.guarantorTypeOptions[0].id : this.dataObject.guarantorTypeOptions[2].id; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; - const locale = 'en'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; const newGuarantorData = { ... this.newGuarantorForm.value, locale, diff --git a/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts b/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts index e52d94bd3..0b23b144a 100644 --- a/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Service. */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Disburse To Savings component. @@ -33,12 +34,14 @@ export class DisburseLoanAccountComponent implements OnInit { * @param {Router} router Router. * @param {DatePipe} datePipe DatePipe. * @param {LoansService} loanService Loan Service. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private loanService: LoansService) { } + private loanService: LoansService, + private settingsService: SettingsService) { } ngOnInit() { this.setDisbursementToSavingsForm(); @@ -63,13 +66,13 @@ export class DisburseLoanAccountComponent implements OnInit { */ submit() { const actualDisbursementDate = this.disbursementForm.value.actualDisbursementDate; - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; this.disbursementForm.patchValue({ actualDisbursementDate: this.datePipe.transform(actualDisbursementDate, dateFormat) }); const loanId = this.route.parent.snapshot.params['loanId']; const disbursementForm = this.disbursementForm.value; - disbursementForm.locale = 'en'; + disbursementForm.locale = this.settingsService.language.code; disbursementForm.dateFormat = dateFormat; this.loanService.loanActionButtons(loanId, 'disbursetosavings', disbursementForm).subscribe((response: any) => { this.router.navigate(['../../general'], {relativeTo: this.route}); diff --git a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts index 11474a8c6..f17e559e1 100644 --- a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts @@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +import { SettingsService } from 'app/settings/settings.service'; /** * Disburse Loan Option @@ -37,12 +38,14 @@ export class DisburseComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -100,12 +103,12 @@ export class DisburseComponent implements OnInit { submit() { const prevActualDisbursementDate: Date = this.disbursementLoanForm.value.actualDisbursementDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.disbursementLoanForm.patchValue({ actualDisbursementDate: this.datePipe.transform(prevActualDisbursementDate, dateFormat) }); const disbursementLoanData = this.disbursementLoanForm.value; - disbursementLoanData.locale = 'en'; + disbursementLoanData.locale = this.settingsService.language.code; disbursementLoanData.dateFormat = dateFormat; this.loanService.loanActionButtons(this.loanId, 'disburse', disbursementLoanData ) .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts b/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts index f8f40e6eb..1c7d4eada 100644 --- a/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts @@ -4,6 +4,9 @@ import { LoansService } from 'app/loans/loans.service'; import { ActivatedRoute, Router } from '@angular/router'; import { DatePipe } from '@angular/common'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + @Component({ selector: 'mifosx-foreclosure', templateUrl: './foreclosure.component.html', @@ -27,12 +30,14 @@ export class ForeclosureComponent implements OnInit { * @param {LoansService} systemService Loan Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -62,12 +67,12 @@ export class ForeclosureComponent implements OnInit { } retrieveLoanForeclosureTemplate(val: any) { - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; const transactionDateFormatted = this.datePipe.transform(val, dateFormat); const data = { command: 'foreclosure', - dateFormat: 'dd MMMM yyyy', - locale: 'en', + dateFormat: this.settingsService.dateFormat, + locale: this.settingsService.language.code, transactionDate: transactionDateFormatted }; this.loanService.getForeclosureData(this.loanId, data) @@ -104,13 +109,13 @@ export class ForeclosureComponent implements OnInit { submit() { const transactionDate = this.foreclosureForm.value.transactionDate; - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.foreclosureForm.patchValue({ transactionDate: this.datePipe.transform(transactionDate, dateFormat) }); const formData = { transactionDate: this.foreclosureForm.value.transactionDate, - locale: 'en', + locale: this.settingsService.language.code, dateFormat: dateFormat, note: this.foreclosureForm.value.note }; diff --git a/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts b/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts index 3715610ef..0950d57d8 100644 --- a/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts @@ -5,6 +5,9 @@ import { ActivatedRoute, Router } from '@angular/router'; import { DatePipe } from '@angular/common'; import { subscribeOn } from 'rxjs/operators'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + @Component({ selector: 'mifosx-loan-reschedule', templateUrl: './loan-reschedule.component.html', @@ -32,12 +35,14 @@ export class LoanRescheduleComponent implements OnInit { * @param {LoansService} systemService Loan Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -65,7 +70,7 @@ export class LoanRescheduleComponent implements OnInit { const rescheduleFromDate = this.rescheduleLoanForm.value.rescheduleFromDate; const adjustedDueDate = this.rescheduleLoanForm.value.adjustedDueDate; const submittedOnDate = this.rescheduleLoanForm.value.submittedOnDate; - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; this.rescheduleLoanForm.patchValue({ rescheduleFromDate: this.datePipe.transform(rescheduleFromDate, dateFormat), @@ -73,7 +78,7 @@ export class LoanRescheduleComponent implements OnInit { submittedOnDate: this.datePipe.transform(submittedOnDate, dateFormat) }); const rescheduleForm = this.rescheduleLoanForm.value; - rescheduleForm.locale = 'en'; + rescheduleForm.locale = this.settingsService.language.code; rescheduleForm.dateFormat = dateFormat; rescheduleForm.loanId = this.loanId; this.loanService.submitRescheduleData(rescheduleForm).subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts b/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts index d0c7974b4..253b2e60c 100644 --- a/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts @@ -5,6 +5,9 @@ import { Router, ActivatedRoute } from '@angular/router'; import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +/** Custom Services */ +import { SettingsService } from 'app/settings/settings.service'; + @Component({ selector: 'mifosx-loans-account-close', templateUrl: './loans-account-close.component.html', @@ -28,12 +31,14 @@ export class LoansAccountCloseComponent implements OnInit { * @param {LoansService} systemService Loan Service. * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -60,12 +65,12 @@ export class LoansAccountCloseComponent implements OnInit { */ submit() { const transactionDate = this.closeLoanForm.value.transactionDate; - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.closeLoanForm.patchValue({ transactionDate: this.datePipe.transform(transactionDate, dateFormat) }); const closeForm = this.closeLoanForm.value; - closeForm.locale = 'en'; + closeForm.locale = this.settingsService.language.code; closeForm.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close') .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts index 17a94da37..ff1206640 100644 --- a/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/make-repayment/make-repayment.component.ts @@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +import { SettingsService } from 'app/settings/settings.service'; /** * Loan Make Repayment Component @@ -37,12 +38,14 @@ export class MakeRepaymentComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -99,12 +102,12 @@ export class MakeRepaymentComponent implements OnInit { submit() { const prevTransactionDate: Date = this.repaymentLoanForm.value.transactionDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.repaymentLoanForm.patchValue({ transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat) }); const repaymentLoanData = this.repaymentLoanForm.value; - repaymentLoanData.locale = 'en'; + repaymentLoanData.locale = this.settingsService.language.code; repaymentLoanData.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, repaymentLoanData, 'repayment') .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts index 8190a7103..39ba57d08 100644 --- a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts @@ -6,6 +6,8 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +import { SettingsService } from 'app/settings/settings.service'; + /** * Loan Prepay Loan Option @@ -41,12 +43,14 @@ export class PrepayLoanComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -111,12 +115,12 @@ export class PrepayLoanComponent implements OnInit { submit() { const prevTransactionDate: Date = this.prepayLoanForm.value.transactionDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.prepayLoanForm.patchValue({ transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat) }); const prepayLoanData = this.prepayLoanForm.value; - prepayLoanData.locale = 'en'; + prepayLoanData.locale = this.settingsService.language.code; prepayLoanData.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, prepayLoanData, 'repayment') .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts b/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts index f8255a345..5cbc13f84 100644 --- a/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts @@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +import { SettingsService } from 'app/settings/settings.service'; /** * Loan Recovery Repayment Action @@ -37,12 +38,14 @@ export class RecoveryRepaymentComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -100,12 +103,12 @@ export class RecoveryRepaymentComponent implements OnInit { submit() { const prevTransactionDate: Date = this.recoveryRepaymentLoanForm.value.transactionDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.recoveryRepaymentLoanForm.patchValue({ transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat) }); const recoveryRepaymentLoanData = this.recoveryRepaymentLoanForm.value; - recoveryRepaymentLoanData.locale = 'en'; + recoveryRepaymentLoanData.locale = this.settingsService.language.code; recoveryRepaymentLoanData.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, recoveryRepaymentLoanData, 'recoverypayment') .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts index 9c3f45f33..31870b1ad 100644 --- a/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom services. */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** * Reject Loan component. @@ -32,12 +33,14 @@ export class RejectLoanComponent implements OnInit { * @param router Router. * @param route Activated Route. * @param datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private router: Router, private route: ActivatedRoute, private loanService: LoansService, - private datePipe: DatePipe ) { + private datePipe: DatePipe, + private settingsService: SettingsService ) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -60,12 +63,12 @@ export class RejectLoanComponent implements OnInit { */ submit() { const rejectedOnDate = this.rejectLoanForm.value.rejectedOnDate; - const dateFormat = 'yyyy-MM-dd'; + const dateFormat = this.settingsService.dateFormat; this.rejectLoanForm.patchValue({ rejectedOnDate: this.datePipe.transform(rejectedOnDate, dateFormat) }); const rejectForm = this.rejectLoanForm.value; - rejectForm.locale = 'en'; + rejectForm.locale = this.settingsService.language.code; rejectForm.dateFormat = dateFormat; this.loanService.loanActionButtons(this.loanId, 'reject', rejectForm).subscribe((response: any) => { this.router.navigate(['../../general'], { relativeTo: this.route }); diff --git a/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts b/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts index 025bcc307..9dee68ca7 100644 --- a/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts @@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { DatePipe } from '@angular/common'; +import { SettingsService } from 'app/settings/settings.service'; /** * Withdrawn By Applicant Loan Form @@ -33,12 +34,14 @@ export class WithdrawnByClientComponent implements OnInit { * @param {ActivatedRoute} route Activated Route. * @param {Router} router Router for navigation. * @param {DatePipe} datePipe Date Pipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private loanService: LoansService, private route: ActivatedRoute, private router: Router, - private datePipe: DatePipe) { + private datePipe: DatePipe, + private settingsService: SettingsService) { this.loanId = this.route.parent.snapshot.params['loanId']; } @@ -64,12 +67,12 @@ export class WithdrawnByClientComponent implements OnInit { submit() { const prevTransactionDate: Date = this.withdrawnByClientLoanForm.value.withdrawnOnDate; // TODO: Update once language and date settings are setup - const dateFormat = 'dd-MM-yyyy'; + const dateFormat = this.settingsService.dateFormat; this.withdrawnByClientLoanForm.patchValue({ withdrawnOnDate: this.datePipe.transform(prevTransactionDate, dateFormat) }); const WithdrawnByClientLoanData = this.withdrawnByClientLoanForm.value; - WithdrawnByClientLoanData.locale = 'en'; + WithdrawnByClientLoanData.locale = this.settingsService.language.code; WithdrawnByClientLoanData.dateFormat = dateFormat; this.loanService.loanActionButtons(this.loanId, 'withdrawnByApplicant', WithdrawnByClientLoanData) .subscribe((response: any) => { diff --git a/src/app/loans/loans-view/loan-account-actions/write-off-page/write-off-page.component.ts b/src/app/loans/loans-view/loan-account-actions/write-off-page/write-off-page.component.ts index 73d538b9f..2817360f1 100644 --- a/src/app/loans/loans-view/loan-account-actions/write-off-page/write-off-page.component.ts +++ b/src/app/loans/loans-view/loan-account-actions/write-off-page/write-off-page.component.ts @@ -6,6 +6,8 @@ import { DatePipe } from '@angular/common'; /** Custom Services. */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; + /** * Write Off component. */ @@ -33,12 +35,14 @@ export class WriteOffPageComponent implements OnInit { * @param {LoansService} loanService Loan Service. * @param {DatePipe} datePipe Date Pipe. * @param {Router} router Router. + * @param {SettingsService} settingsService Settings Service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private loanService: LoansService, private datePipe: DatePipe, - private router: Router) { } + private router: Router, + private settingsService: SettingsService) { } ngOnInit() { this.setWriteOffForm(); @@ -60,14 +64,14 @@ export class WriteOffPageComponent implements OnInit { */ submit() { const transactionDate = this.writeOffForm.value.transactionDate; - const dateFormat = 'dd MMMM yyyy'; + const dateFormat = this.settingsService.dateFormat; this.writeOffForm.patchValue({ transactionDate: this.datePipe.transform(transactionDate, dateFormat) }); const loanId = this.route.parent.snapshot.params['loanId']; const writeOffForm = this.writeOffForm.value; delete writeOffForm.amount; - writeOffForm.locale = 'en'; + writeOffForm.locale = this.settingsService.language.code; writeOffForm.dateFormat = dateFormat; this.loanService.submitLoanActionButton(loanId, writeOffForm, 'writeoff').subscribe((response: any) => { this.router.navigate(['../../../general'], {relativeTo: this.route}); diff --git a/src/app/loans/loans-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/loans/loans-view/standing-instructions-tab/standing-instructions-tab.component.ts index 391ada705..410462e0d 100644 --- a/src/app/loans/loans-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/loans/loans-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router'; /** Custom Services */ import { LoansService } from 'app/loans/loans.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'; @@ -36,11 +37,13 @@ export class StandingInstructionsTabComponent implements OnInit { /** * Retrieves Loans Account Data from `resolve`. * @param {ActivatedRoute} route Activated Route. + * @param {SettingsService} settingsService Settings Service */ constructor(private route: ActivatedRoute, private loansService: LoansService, private dialog: MatDialog, - private accountTransfersService: AccountTransfersService) { + private accountTransfersService: AccountTransfersService, + private settingsService: SettingsService) { this.route.parent.data.subscribe((data: { loanDetailsData: any }) => { this.loanDetailsData = data.loanDetailsData; }); @@ -57,8 +60,8 @@ export class StandingInstructionsTabComponent implements OnInit { const clientId = this.loanDetailsData.clientId; const clientName = this.loanDetailsData.clientName; const accountId = this.loanDetailsData.id; - const locale = 'en'; - const dateFormat = 'dd MMMM yyyy'; + const locale = this.settingsService.language.code; + const dateFormat = this.settingsService.dateFormat; this.loansService.getStandingInstructions(clientId, clientName, accountId, locale, dateFormat).subscribe((response: any) => { this.instructionsData = response.pageItems; this.dataSource.data = this.instructionsData; diff --git a/src/app/loans/loans-view/transactions/edit-transaction/edit-transaction.component.ts b/src/app/loans/loans-view/transactions/edit-transaction/edit-transaction.component.ts index 6b86ad72f..90e9fa351 100644 --- a/src/app/loans/loans-view/transactions/edit-transaction/edit-transaction.component.ts +++ b/src/app/loans/loans-view/transactions/edit-transaction/edit-transaction.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from 'app/loans/loans.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 Settings Service */ constructor(private formBuilder: FormBuilder, private route: ActivatedRoute, private router: Router, private datePipe: DatePipe, - private loansService: LoansService) { + private loansService: LoansService, + private settingsService: SettingsService) { this.route.data.subscribe((data: { loansAccountTransactionTemplate: any }) => { this.transactionTemplateData = data.loansAccountTransactionTemplate; 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.loansService.executeLoansAccountTransactionsCommand(this.loanAccountId, 'modify', transactionData, this.transactionTemplateData.id) .subscribe((res: any) => { diff --git a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts index 125833a5f..209018fa9 100644 --- a/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts +++ b/src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts @@ -7,6 +7,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ @@ -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 Settings Service */ constructor(private loansService: LoansService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.data.subscribe((data: { loansAccountTransaction: any }) => { this.transactionData = data.loansAccountTransaction; }); @@ -52,8 +55,8 @@ export class ViewTransactionComponent { }); undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: 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/loans/loans-view/view-charge/view-charge.component.ts b/src/app/loans/loans-view/view-charge/view-charge.component.ts index 7a62e5ae4..f9869d9d8 100644 --- a/src/app/loans/loans-view/view-charge/view-charge.component.ts +++ b/src/app/loans/loans-view/view-charge/view-charge.component.ts @@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common'; /** Custom Services */ import { LoansService } from 'app/loans/loans.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; @@ -39,12 +40,14 @@ export class ViewChargeComponent { * @param {Router} router Router for navigation. * @param {MatDialog} dialog Dialog reference. * @param {DatePipe} datePipe DatePipe. + * @param {SettingsService} settingsService Settings Service */ constructor(private loansService: LoansService, private route: ActivatedRoute, private datePipe: DatePipe, private router: Router, - public dialog: MatDialog) { + public dialog: MatDialog, + private settingsService: SettingsService) { this.route.data.subscribe((data: { loansAccountCharge: any, loanDetailsData: any }) => { this.chargeData = data.loansAccountCharge; this.loansAccountData = data.loanDetailsData; @@ -79,8 +82,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), @@ -131,8 +134,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,