Format date fields without patch form
This commit is contained in:
committed by
Arnold Gálovics
parent
9d43181cea
commit
6ea3d97538
+1
-1
@@ -44,7 +44,7 @@ export class CreateFixedDepositAccountComponent {
|
||||
* Fetches FD account template from `resolve`
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ export class EditFixedDepositAccountComponent {
|
||||
* Fetches FD account template from `resolve`
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ export class FixedDepositAccountChargesStepComponent implements OnInit, OnChange
|
||||
|
||||
/**
|
||||
* @param {MatDialog} dialog Mat Dialog
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {DatePipe} datePipe Date Utils
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(public dialog: MatDialog,
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ export class MultiRowComponent implements OnInit, OnChanges {
|
||||
/**
|
||||
* Fetches savings account Id from parent route params.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {DatePipe} datePipe Date Utils.
|
||||
* @param {SavingsService} savingsService Savingss Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ export class SingleRowComponent implements OnInit {
|
||||
/**
|
||||
* Fetches savings account Id from parent route params.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {DatePipe} datePipe Date Utils.
|
||||
* @param {SavingsService} savingsService Savingss Service.
|
||||
* @param {MatDialog} dialog Mat Dialog.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
@@ -151,7 +151,7 @@ export class SingleRowComponent implements OnInit {
|
||||
/**
|
||||
* Maps API response to data table form fields.
|
||||
* @param {any} columns Data Table Columns.
|
||||
* @param {string[]} dateTransformColumns Columns transformed with date pipe.
|
||||
* @param {string[]} dateTransformColumns Columns transformed with Date Utils.
|
||||
* @param {any} dataTableEntryObject Additional data table details.
|
||||
*/
|
||||
getFormfields(columns: any, dateTransformColumns: string[], dataTableEntryObject: any) {
|
||||
|
||||
+8
-8
@@ -1,8 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
@@ -31,14 +31,14 @@ export class ActivateFixedDepositsAccountComponent implements OnInit {
|
||||
* Fixed deposits endpoint is not supported so using Savings endpoint.
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private savingsService: SavingsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -66,15 +66,15 @@ export class ActivateFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const activateFixedDepositsAccountFormData = this.activateFixedDepositsAccountForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevActivatedOnDate: Date = this.activateFixedDepositsAccountForm.value.activatedOnDate;
|
||||
this.activateFixedDepositsAccountForm.patchValue({
|
||||
activatedOnDate: this.datePipe.transform(prevActivatedOnDate, dateFormat),
|
||||
});
|
||||
if (activateFixedDepositsAccountFormData.activatedOnDate instanceof Date) {
|
||||
activateFixedDepositsAccountFormData.activatedOnDate = this.dateUtils.formatDate(prevActivatedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.activateFixedDepositsAccountForm.value,
|
||||
...activateFixedDepositsAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type=number required matInput formControlName="amount" />
|
||||
<input type="number" required matInput formControlName="amount" />
|
||||
<mat-error *ngIf="fixedDepositsChargeForm.controls.amount.hasError('required')">
|
||||
Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
|
||||
+5
-5
@@ -2,7 +2,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
@@ -37,7 +37,7 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private savingsService: SavingsService,
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
@@ -125,14 +125,14 @@ export class AddChargeFixedDepositsAccountComponent implements OnInit {
|
||||
savingsCharge.monthDayFormat = monthDayFormat;
|
||||
if (savingsCharge.feeOnMonthDay) {
|
||||
const prevDate = this.fixedDepositsChargeForm.value.feeOnMonthDay;
|
||||
savingsCharge.feeOnMonthDay = this.datePipe.transform(prevDate, monthDayFormat);
|
||||
savingsCharge.feeOnMonthDay = this.dateUtils.formatDate(prevDate, monthDayFormat);
|
||||
}
|
||||
} else {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
savingsCharge.dateFormat = dateFormat;
|
||||
if (savingsCharge.dueDate) {
|
||||
const prevDate = this.fixedDepositsChargeForm.value.dueDate;
|
||||
savingsCharge.dueDate = this.datePipe.transform(prevDate, dateFormat);
|
||||
savingsCharge.dueDate = this.dateUtils.formatDate(prevDate, dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -1,8 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -30,14 +30,14 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -66,14 +66,15 @@ export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
const approveFixedDepositsAccountFormData = this.approveFixedDepositsAccountForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevApprovedOnDate: Date = this.approveFixedDepositsAccountForm.value.approvedOnDate;
|
||||
this.approveFixedDepositsAccountForm.patchValue({
|
||||
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||
});
|
||||
if (approveFixedDepositsAccountFormData.approvedOnDate instanceof Date) {
|
||||
approveFixedDepositsAccountFormData.approvedOnDate = this.dateUtils.formatDate(prevApprovedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.approveFixedDepositsAccountForm.value,
|
||||
...approveFixedDepositsAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Maturity Amount</mat-label>
|
||||
<input type=number matInput formControlName="maturityAmount"/>
|
||||
<input type="number" matInput formControlName="maturityAmount"/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
|
||||
+8
-7
@@ -1,12 +1,12 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Close On Maturity Fixed Deposits Account Component
|
||||
@@ -37,14 +37,14 @@ export class CloseFixedDepositsAccountComponent implements OnInit {
|
||||
* Fetches close action data from `resolve`
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -96,14 +96,15 @@ export class CloseFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fd account.
|
||||
*/
|
||||
submit() {
|
||||
const closeOnMaturityAccountFormData = this.closeOnMaturityAccountForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevClosedDate: Date = this.closeOnMaturityAccountForm.value.closedOnDate;
|
||||
this.closeOnMaturityAccountForm.patchValue({
|
||||
closedOnDate: this.datePipe.transform(prevClosedDate, dateFormat),
|
||||
});
|
||||
if (closeOnMaturityAccountFormData.closedOnDate instanceof Date) {
|
||||
closeOnMaturityAccountFormData.closedOnDate = this.dateUtils.formatDate(prevClosedDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.closeOnMaturityAccountForm.value,
|
||||
...closeOnMaturityAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
|
||||
<mat-form-field *ngIf="prematureCloseAccountForm.controls.maturityAmount">
|
||||
<mat-label>Maturity Amount</mat-label>
|
||||
<input type=number matInput formControlName="maturityAmount"/>
|
||||
<input type="number" matInput formControlName="maturityAmount"/>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="prematureCloseAccountForm.contains('onAccountClosureId')">
|
||||
|
||||
+9
-8
@@ -1,12 +1,12 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/**
|
||||
* Premature Close Fixed Deposits Account Component
|
||||
@@ -37,14 +37,14 @@ export class PrematureCloseFixedDepositsAccountComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -87,7 +87,7 @@ export class PrematureCloseFixedDepositsAccountComponent implements OnInit {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const data = {
|
||||
closedOnDate: this.datePipe.transform(date, dateFormat),
|
||||
closedOnDate: this.dateUtils.formatDate(date, dateFormat),
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
@@ -124,15 +124,16 @@ export class PrematureCloseFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fd account.
|
||||
*/
|
||||
submit() {
|
||||
const prematureCloseAccountFormData = this.prematureCloseAccountForm.value;
|
||||
this.isSubmitted = true;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevClosedDate: Date = this.prematureCloseAccountForm.value.closedOnDate;
|
||||
this.prematureCloseAccountForm.patchValue({
|
||||
closedOnDate: this.datePipe.transform(prevClosedDate, dateFormat),
|
||||
});
|
||||
if (prematureCloseAccountFormData.closedOnDate instanceof Date) {
|
||||
prematureCloseAccountFormData.closedOnDate = this.dateUtils.formatDate(prevClosedDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.prematureCloseAccountForm.value,
|
||||
...prematureCloseAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
+8
-7
@@ -1,8 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -30,14 +30,14 @@ export class RejectFixedDepositsAccountComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -66,14 +66,15 @@ export class RejectFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
const rejectFixedDepositsAccountFormData = this.rejectFixedDepositsAccountForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevRejectedOnDate: Date = this.rejectFixedDepositsAccountForm.value.rejectedOnDate;
|
||||
this.rejectFixedDepositsAccountForm.patchValue({
|
||||
rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat),
|
||||
});
|
||||
if (rejectFixedDepositsAccountFormData.rejectedOnDate instanceof Date) {
|
||||
rejectFixedDepositsAccountFormData.rejectedOnDate = this.dateUtils.formatDate(prevRejectedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.rejectFixedDepositsAccountForm.value,
|
||||
...rejectFixedDepositsAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
+8
-7
@@ -1,8 +1,8 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
@@ -30,14 +30,14 @@ export class WithdrawByClientFixedDepositsAccountComponent implements OnInit {
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) {
|
||||
@@ -66,14 +66,15 @@ export class WithdrawByClientFixedDepositsAccountComponent implements OnInit {
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
const withdrawFixedDepositsAccountFormData = this.withdrawFixedDepositsAccountForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevWithdrawnOnDate: Date = this.withdrawFixedDepositsAccountForm.value.withdrawnOnDate;
|
||||
this.withdrawFixedDepositsAccountForm.patchValue({
|
||||
withdrawnOnDate: this.datePipe.transform(prevWithdrawnOnDate, dateFormat),
|
||||
});
|
||||
if (withdrawFixedDepositsAccountFormData.withdrawnOnDate instanceof Date) {
|
||||
withdrawFixedDepositsAccountFormData.withdrawnOnDate = this.dateUtils.formatDate(prevWithdrawnOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...this.withdrawFixedDepositsAccountForm.value,
|
||||
...withdrawFixedDepositsAccountFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user