Format date fields without patch form
This commit is contained in:
committed by
Arnold Gálovics
parent
9d43181cea
commit
6ea3d97538
+1
-1
@@ -38,7 +38,7 @@
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="25%">Show Payment Details</span>
|
||||
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
|
||||
<span fxFlex="75%" class="expandcollapsebutton" (click)="addPaymentDetails()">
|
||||
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
.expandCollapsebutton {
|
||||
.expandcollapsebutton {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
|
||||
+12
-9
@@ -100,16 +100,19 @@ export class RecoveryRepaymentComponent implements OnInit {
|
||||
|
||||
/** Submits the recovery payment form */
|
||||
submit() {
|
||||
const prevTransactionDate: Date = this.recoveryRepaymentLoanForm.value.transactionDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const recoveryRepaymentLoanFormData = this.recoveryRepaymentLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.recoveryRepaymentLoanForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
|
||||
});
|
||||
const recoveryRepaymentLoanData = this.recoveryRepaymentLoanForm.value;
|
||||
recoveryRepaymentLoanData.locale = this.settingsService.language.code;
|
||||
recoveryRepaymentLoanData.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(this.loanId, recoveryRepaymentLoanData, 'recoverypayment')
|
||||
const prevTransactionDate: Date = this.recoveryRepaymentLoanForm.value.transactionDate;
|
||||
if (recoveryRepaymentLoanFormData.transactionDate instanceof Date) {
|
||||
recoveryRepaymentLoanFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...recoveryRepaymentLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'recoverypayment')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user