From dca1c5f09a5a7ca9733e0ee969e3c82797c8cb6a Mon Sep 17 00:00:00 2001 From: Adam Saghy Date: Thu, 26 May 2022 16:33:43 +0200 Subject: [PATCH] Fix repayment date change issue Wrong initial transaction date; Fix transaction date disappearance after submit; Redirect to the "transactions" list --- .../make-repayment/make-repayment.component.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 d8117573a..c4594341d 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 @@ -72,8 +72,7 @@ export class MakeRepaymentComponent implements OnInit { setRepaymentLoanDetails() { this.paymentTypes = this.dataObject.paymentTypeOptions; this.repaymentLoanForm.patchValue({ - transactionAmount: this.dataObject.amount, - transactionDate: new Date(this.dataObject.date) + transactionAmount: this.dataObject.amount }); } @@ -102,15 +101,13 @@ export class MakeRepaymentComponent implements OnInit { const prevTransactionDate: Date = this.repaymentLoanForm.value.transactionDate; // TODO: Update once language and date settings are setup const dateFormat = this.settingsService.dateFormat; - this.repaymentLoanForm.patchValue({ - transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat) - }); const repaymentLoanData = this.repaymentLoanForm.value; + repaymentLoanData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat); repaymentLoanData.locale = this.settingsService.language.code; repaymentLoanData.dateFormat = dateFormat; this.loanService.submitLoanActionButton(this.loanId, repaymentLoanData, 'repayment') .subscribe((response: any) => { - this.router.navigate(['../../../general'], { relativeTo: this.route }); + this.router.navigate(['../../transactions'], { relativeTo: this.route }); }); }