Fix repayment date change issue

Wrong initial transaction date;
Fix transaction date disappearance after submit;
Redirect to the "transactions" list
This commit is contained in:
Adam Saghy
2022-05-26 16:57:50 +02:00
committed by Arnold Gálovics
parent e8d0777204
commit dca1c5f09a
@@ -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 });
});
}