Format date fields without patch form
This commit is contained in:
committed by
Arnold Gálovics
parent
9d43181cea
commit
6ea3d97538
+1
-1
@@ -21,7 +21,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="loanChargeForm.controls.amount.hasError('required')">
|
||||
Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
|
||||
+12
-9
@@ -98,16 +98,19 @@ export class AddLoanChargeComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit() {
|
||||
const prevDueDate: Date = this.loanChargeForm.value.dueDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const loanChargeFormData = this.loanChargeForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.loanChargeForm.patchValue({
|
||||
dueDate: this.dateUtils.formatDate(prevDueDate, dateFormat)
|
||||
});
|
||||
const loanCharge = this.loanChargeForm.value;
|
||||
loanCharge.locale = this.settingsService.language.code;
|
||||
loanCharge.dateFormat = dateFormat;
|
||||
this.loansService.createLoanCharge(this.loanId, 'charges', loanCharge).subscribe(res => {
|
||||
const prevDueDate: Date = this.loanChargeForm.value.dueDate;
|
||||
if (loanChargeFormData.dueDate instanceof Date) {
|
||||
loanChargeFormData.dueDate = this.dateUtils.formatDate(prevDueDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...loanChargeFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loansService.createLoanCharge(this.loanId, 'charges', data).subscribe(res => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input matInput type="number" required formControlName="approvedLoanAmount" required>
|
||||
<input matInput type="number" required formControlName="approvedLoanAmount">
|
||||
<mat-error *ngIf="approveLoanForm.controls.approvedLoanAmount.hasError('required')">
|
||||
Transaction Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
|
||||
+11
-8
@@ -33,7 +33,7 @@ export class ApproveLoanComponent implements OnInit {
|
||||
* Retrieve data from `Resolver`.
|
||||
* @param formBuilder Form Builder.
|
||||
* @param route Activated Route.
|
||||
* @param datePipe Date Pipe.
|
||||
* @param datePipe Date Utils.
|
||||
* @param loanService Loan Service.
|
||||
* @param router Router.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
@@ -76,20 +76,23 @@ export class ApproveLoanComponent implements OnInit {
|
||||
* Submits Approve form.
|
||||
*/
|
||||
submit() {
|
||||
const approveLoanFormData = this.approveLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const approvedOnDate = this.approveLoanForm.value.approvedOnDate;
|
||||
const expectedDisbursementDate = this.approveLoanForm.value.expectedDisbursementDate;
|
||||
this.approveLoanForm.patchValue({
|
||||
approvedOnDate: this.dateUtils.formatDate(approvedOnDate, dateFormat),
|
||||
expectedDisbursementDate: this.dateUtils.formatDate(expectedDisbursementDate, dateFormat)
|
||||
});
|
||||
const approveLoanFormData = {
|
||||
... this.approveLoanForm.value,
|
||||
if (approveLoanFormData.approvedOnDate instanceof Date) {
|
||||
approveLoanFormData.approvedOnDate = this.dateUtils.formatDate(approvedOnDate, dateFormat);
|
||||
}
|
||||
if (approveLoanFormData.expectedDisbursementDate instanceof Date) {
|
||||
approveLoanFormData.expectedDisbursementDate = this.dateUtils.formatDate(expectedDisbursementDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...approveLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.loanActionButtons(this.loanId, 'approve', approveLoanFormData).subscribe((response: any) => {
|
||||
this.loanService.loanActionButtons(this.loanId, 'approve', data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
+13
-10
@@ -60,17 +60,20 @@ export class AssignLoanOfficerComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit() {
|
||||
const assignmentDate = this.assignOfficerForm.value.assignmentDate;
|
||||
const assignOfficerFormData = this.assignOfficerForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.assignOfficerForm.patchValue({
|
||||
assignmentDate: this.dateUtils.formatDate(assignmentDate, dateFormat)
|
||||
});
|
||||
const assignForm = this.assignOfficerForm.value;
|
||||
assignForm.locale = this.settingsService.language.code;
|
||||
assignForm.dateFormat = dateFormat;
|
||||
assignForm.fromLoanOfficerId = this.dataObject.loanOfficerId || '';
|
||||
|
||||
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', assignForm)
|
||||
const assignmentDate = this.assignOfficerForm.value.assignmentDate;
|
||||
if (assignOfficerFormData.assignmentDate instanceof Date) {
|
||||
assignOfficerFormData.assignmentDate = this.dateUtils.formatDate(assignmentDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...assignOfficerFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
data.fromLoanOfficerId = this.dataObject.loanOfficerId || '';
|
||||
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate([`../../general`], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+12
-8
@@ -63,15 +63,19 @@ export class CloseAsRescheduledComponent implements OnInit {
|
||||
* if successful redirects to view created close.
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.closeLoanForm.value.transactionDate;
|
||||
const closeLoanFormData = this.closeLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.closeLoanForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
|
||||
});
|
||||
const closeForm = this.closeLoanForm.value;
|
||||
closeForm.locale = this.settingsService.language.code;
|
||||
closeForm.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close-rescheduled')
|
||||
const transactionDate = this.closeLoanForm.value.transactionDate;
|
||||
if (closeLoanFormData.transactionDate instanceof Date) {
|
||||
closeLoanFormData.transactionDate = this.dateUtils.formatDate(transactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...closeLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'close-rescheduled')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@
|
||||
</mat-form-field>
|
||||
|
||||
<mat-autocomplete autoActiveFirstOption #clientsAutocomplete="matAutocomplete" [displayWith]="displayClient"
|
||||
(optionSelected)='clientSelected($event.option.value)'>
|
||||
(optionSelected)="clientSelected($event.option.value)">
|
||||
<mat-option *ngFor="let client of clientsData" [value]="client">
|
||||
{{ client.displayName }}
|
||||
</mat-option>
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type="number" matInput required formControlName="amount" required>
|
||||
<input type="number" matInput required formControlName="amount">
|
||||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>First Name</mat-label>
|
||||
<input matInput required formControlName="firstname" required>
|
||||
<input matInput required formControlName="firstname">
|
||||
<mat-error *ngIf="newGuarantorForm.controls.firstname.hasError('required')">
|
||||
First Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Last Name</mat-label>
|
||||
<input matInput required formControlName="lastname" required>
|
||||
<input matInput required formControlName="lastname">
|
||||
<mat-error *ngIf="newGuarantorForm.controls.lastname.hasError('required')">
|
||||
Last Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
|
||||
+14
-11
@@ -149,28 +149,31 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Submits the new guarantor details form */
|
||||
submit() {
|
||||
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 newGuarantorFormData = this.newGuarantorForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const newGuarantorData = {
|
||||
... this.newGuarantorForm.value,
|
||||
|
||||
const prevdob: Date = this.newGuarantorForm.value.dob;
|
||||
const guarantorTypeId: number = this.newGuarantorForm.value.existingClient ? this.dataObject.guarantorTypeOptions[0].id : this.dataObject.guarantorTypeOptions[2].id;
|
||||
const data = {
|
||||
...newGuarantorFormData,
|
||||
locale,
|
||||
dateFormat,
|
||||
guarantorTypeId
|
||||
};
|
||||
|
||||
if (this.newGuarantorForm.value.existingClient) {
|
||||
newGuarantorData['entityId'] = this.newGuarantorForm.controls.name.value.id;
|
||||
data['entityId'] = this.newGuarantorForm.controls.name.value.id;
|
||||
} else {
|
||||
newGuarantorData['dob'] = this.dateUtils.formatDate(prevdob, dateFormat),
|
||||
newGuarantorData['dateFormat'] = dateFormat;
|
||||
if (newGuarantorFormData.dob instanceof Date) {
|
||||
data['dob'] = this.dateUtils.formatDate(prevdob, dateFormat);
|
||||
}
|
||||
}
|
||||
|
||||
delete newGuarantorData.existingClient;
|
||||
delete newGuarantorData.name;
|
||||
delete data.existingClient;
|
||||
delete data.name;
|
||||
|
||||
this.loanService.createNewGuarantor(this.loanId, newGuarantorData)
|
||||
this.loanService.createNewGuarantor(this.loanId, data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+12
-8
@@ -64,16 +64,20 @@ export class DisburseLoanAccountComponent implements OnInit {
|
||||
* Submit Disburse Form.
|
||||
*/
|
||||
submit() {
|
||||
const actualDisbursementDate = this.disbursementForm.value.actualDisbursementDate;
|
||||
const disbursementLoanFormData = this.disbursementForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.disbursementForm.patchValue({
|
||||
actualDisbursementDate: this.dateUtils.formatDate(actualDisbursementDate, dateFormat)
|
||||
});
|
||||
const prevActualDisbursementDate: Date = this.disbursementForm.value.actualDisbursementDate;
|
||||
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
|
||||
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...disbursementLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const disbursementForm = this.disbursementForm.value;
|
||||
disbursementForm.locale = this.settingsService.language.code;
|
||||
disbursementForm.dateFormat = dateFormat;
|
||||
this.loanService.loanActionButtons(loanId, 'disbursetosavings', disbursementForm).subscribe((response: any) => {
|
||||
this.loanService.loanActionButtons(loanId, 'disbursetosavings', data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], {relativeTo: this.route});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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,4 +1,4 @@
|
||||
.expandCollapsebutton {
|
||||
.expandcollapsebutton {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
|
||||
@@ -100,16 +100,19 @@ export class DisburseComponent implements OnInit {
|
||||
|
||||
/** Submits the disbursement form */
|
||||
submit() {
|
||||
const prevActualDisbursementDate: Date = this.disbursementLoanForm.value.actualDisbursementDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const disbursementLoanFormData = this.disbursementLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.disbursementLoanForm.patchValue({
|
||||
actualDisbursementDate: this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat)
|
||||
});
|
||||
const disbursementLoanData = this.disbursementLoanForm.value;
|
||||
disbursementLoanData.locale = this.settingsService.language.code;
|
||||
disbursementLoanData.dateFormat = dateFormat;
|
||||
this.loanService.loanActionButtons(this.loanId, 'disburse', disbursementLoanData )
|
||||
const prevActualDisbursementDate: Date = this.disbursementLoanForm.value.actualDisbursementDate;
|
||||
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
|
||||
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...disbursementLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.loanActionButtons(this.loanId, 'disburse', data )
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+11
-13
@@ -13,8 +13,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./foreclosure.component.scss']
|
||||
})
|
||||
export class ForeclosureComponent implements OnInit {
|
||||
|
||||
|
||||
loanId: any;
|
||||
foreclosureForm: FormGroup;
|
||||
/** Minimum Date allowed. */
|
||||
@@ -24,7 +22,6 @@ export class ForeclosureComponent implements OnInit {
|
||||
foreclosuredata: any;
|
||||
paymentTypes: any;
|
||||
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {LoansService} systemService Loan Service.
|
||||
@@ -108,19 +105,20 @@ export class ForeclosureComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit() {
|
||||
const transactionDate = this.foreclosureForm.value.transactionDate;
|
||||
const foreclosureFormData = this.foreclosureForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.foreclosureForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
|
||||
});
|
||||
const formData = {
|
||||
transactionDate: this.foreclosureForm.value.transactionDate,
|
||||
locale: this.settingsService.language.code,
|
||||
dateFormat: dateFormat,
|
||||
note: this.foreclosureForm.value.note
|
||||
const prevTransactionDate = this.foreclosureForm.value.transactionDate;
|
||||
if (foreclosureFormData.transactionDate instanceof Date) {
|
||||
foreclosureFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...foreclosureFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
|
||||
this.loanService.loanForclosureData(this.loanId, formData)
|
||||
this.loanService.loanForclosureData(this.loanId, data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate([`../../general`], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+21
-14
@@ -66,21 +66,28 @@ export class LoanRescheduleComponent implements OnInit {
|
||||
}
|
||||
|
||||
submit() {
|
||||
const rescheduleFromDate = this.rescheduleLoanForm.value.rescheduleFromDate;
|
||||
const adjustedDueDate = this.rescheduleLoanForm.value.adjustedDueDate;
|
||||
const submittedOnDate = this.rescheduleLoanForm.value.submittedOnDate;
|
||||
const rescheduleLoanFormData = this.rescheduleLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
|
||||
this.rescheduleLoanForm.patchValue({
|
||||
rescheduleFromDate: this.dateUtils.formatDate(rescheduleFromDate, dateFormat),
|
||||
adjustedDueDate: this.dateUtils.formatDate(adjustedDueDate, dateFormat),
|
||||
submittedOnDate: this.dateUtils.formatDate(submittedOnDate, dateFormat)
|
||||
});
|
||||
const rescheduleForm = this.rescheduleLoanForm.value;
|
||||
rescheduleForm.locale = this.settingsService.language.code;
|
||||
rescheduleForm.dateFormat = dateFormat;
|
||||
rescheduleForm.loanId = this.loanId;
|
||||
this.loanService.submitRescheduleData(rescheduleForm).subscribe((response: any) => {
|
||||
const prevRescheduleFromDate = this.rescheduleLoanForm.value.rescheduleFromDate;
|
||||
const prevAdjustedDueDate = this.rescheduleLoanForm.value.adjustedDueDate;
|
||||
const prevSubmittedOnDate = this.rescheduleLoanForm.value.submittedOnDate;
|
||||
if (rescheduleLoanFormData.rescheduleFromDate instanceof Date) {
|
||||
rescheduleLoanFormData.rescheduleFromDate = this.dateUtils.formatDate(prevRescheduleFromDate, dateFormat);
|
||||
}
|
||||
if (rescheduleLoanFormData.rescheduleFromDate instanceof Date) {
|
||||
rescheduleLoanFormData.adjustedDueDate = this.dateUtils.formatDate(prevAdjustedDueDate, dateFormat);
|
||||
}
|
||||
if (rescheduleLoanFormData.rescheduleFromDate instanceof Date) {
|
||||
rescheduleLoanFormData.submittedOnDate = this.dateUtils.formatDate(prevSubmittedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...rescheduleLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
data.loanId = this.loanId;
|
||||
this.loanService.submitRescheduleData(data).subscribe((response: any) => {
|
||||
|
||||
// TODO: needs to be updated
|
||||
// mentioned in Community App:
|
||||
|
||||
+12
-8
@@ -64,15 +64,19 @@ export class LoansAccountCloseComponent implements OnInit {
|
||||
* if successful redirects to view created close.
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.closeLoanForm.value.transactionDate;
|
||||
const closeLoanFormData = this.closeLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.closeLoanForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
|
||||
});
|
||||
const closeForm = this.closeLoanForm.value;
|
||||
closeForm.locale = this.settingsService.language.code;
|
||||
closeForm.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(this.loanId, closeForm, 'close')
|
||||
const preTransactionDate = this.closeLoanForm.value.transactionDate;
|
||||
if (closeLoanFormData.transactionDate instanceof Date) {
|
||||
closeLoanFormData.transactionDate = this.dateUtils.formatDate(preTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...closeLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'close')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+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
-7
@@ -98,14 +98,19 @@ export class MakeRepaymentComponent implements OnInit {
|
||||
|
||||
/** Submits the repayment form */
|
||||
submit() {
|
||||
const prevTransactionDate: Date = this.repaymentLoanForm.value.transactionDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const repaymentLoanFormData = this.repaymentLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.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')
|
||||
const prevTransactionDate: Date = this.repaymentLoanForm.value.transactionDate;
|
||||
if (repaymentLoanFormData.transactionDate instanceof Date) {
|
||||
repaymentLoanFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...repaymentLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'repayment')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+1
-1
@@ -51,7 +51,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
-10
@@ -5,7 +5,6 @@ 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';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
@@ -113,16 +112,19 @@ export class PrepayLoanComponent implements OnInit {
|
||||
* Submits the prepay loan form
|
||||
*/
|
||||
submit() {
|
||||
const prevTransactionDate: Date = this.prepayLoanForm.value.transactionDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const prepayLoanFormData = this.prepayLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.prepayLoanForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
|
||||
});
|
||||
const prepayLoanData = this.prepayLoanForm.value;
|
||||
prepayLoanData.locale = this.settingsService.language.code;
|
||||
prepayLoanData.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(this.loanId, prepayLoanData, 'repayment')
|
||||
const prevTransactionDate: Date = this.prepayLoanForm.value.transactionDate;
|
||||
if (prepayLoanFormData.transactionDate instanceof Date) {
|
||||
prepayLoanFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...prepayLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.submitLoanActionButton(this.loanId, data, 'repayment')
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+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 });
|
||||
});
|
||||
|
||||
@@ -61,15 +61,19 @@ export class RejectLoanComponent implements OnInit {
|
||||
* Submit Reject Loan form.
|
||||
*/
|
||||
submit() {
|
||||
const rejectedOnDate = this.rejectLoanForm.value.rejectedOnDate;
|
||||
const rejectLoanFormData = this.rejectLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.rejectLoanForm.patchValue({
|
||||
rejectedOnDate: this.dateUtils.formatDate(rejectedOnDate, dateFormat)
|
||||
});
|
||||
const rejectForm = this.rejectLoanForm.value;
|
||||
rejectForm.locale = this.settingsService.language.code;
|
||||
rejectForm.dateFormat = dateFormat;
|
||||
this.loanService.loanActionButtons(this.loanId, 'reject', rejectForm).subscribe((response: any) => {
|
||||
const prevRejectedOnDate = this.rejectLoanForm.value.rejectedOnDate;
|
||||
if (rejectLoanFormData.rejectedOnDate instanceof Date) {
|
||||
rejectLoanFormData.rejectedOnDate = this.dateUtils.formatDate(prevRejectedOnDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...rejectLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.loanActionButtons(this.loanId, 'reject', data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
+15
-11
@@ -6,6 +6,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
/** Custom Services. */
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Waive Interest component.
|
||||
@@ -35,6 +36,7 @@ export class WaiveInterestComponent implements OnInit {
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private loanService: LoansService,
|
||||
private route: ActivatedRoute) { }
|
||||
@@ -58,18 +60,20 @@ export class WaiveInterestComponent implements OnInit {
|
||||
* Submits loan interest form.
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.loanInterestForm.value.transactionDate;
|
||||
const transactionAmount = this.loanInterestForm.value.transactionAmount;
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
this.loanInterestForm.patchValue({
|
||||
transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat),
|
||||
transactionAmount: parseInt(transactionAmount, 10)
|
||||
});
|
||||
const loanInterestFormData = this.loanInterestForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const prevTransactionDate = this.loanInterestForm.value.transactionDate;
|
||||
if (loanInterestFormData.transactionDate instanceof Date) {
|
||||
loanInterestFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...loanInterestFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanInterestForm = this.loanInterestForm.value;
|
||||
loanInterestForm.locale = 'en';
|
||||
loanInterestForm.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(loanId, loanInterestForm, 'waiveinterest').subscribe((response: any) => {
|
||||
this.loanService.submitLoanActionButton(loanId, data, 'waiveinterest').subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], {relativeTo: this.route});
|
||||
});
|
||||
}
|
||||
|
||||
+12
-9
@@ -64,16 +64,19 @@ export class WithdrawnByClientComponent implements OnInit {
|
||||
|
||||
/** Submits the withdraw by appplicant form */
|
||||
submit() {
|
||||
const prevTransactionDate: Date = this.withdrawnByClientLoanForm.value.withdrawnOnDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const withdrawnByClientLoanFormData = this.withdrawnByClientLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.withdrawnByClientLoanForm.patchValue({
|
||||
withdrawnOnDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
|
||||
});
|
||||
const WithdrawnByClientLoanData = this.withdrawnByClientLoanForm.value;
|
||||
WithdrawnByClientLoanData.locale = this.settingsService.language.code;
|
||||
WithdrawnByClientLoanData.dateFormat = dateFormat;
|
||||
this.loanService.loanActionButtons(this.loanId, 'withdrawnByApplicant', WithdrawnByClientLoanData)
|
||||
const prevTransactionDate: Date = this.withdrawnByClientLoanForm.value.withdrawnOnDate;
|
||||
if (withdrawnByClientLoanFormData.withdrawnOnDate instanceof Date) {
|
||||
withdrawnByClientLoanFormData.withdrawnOnDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...withdrawnByClientLoanFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.loanService.loanActionButtons(this.loanId, 'withdrawnByApplicant', data)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+16
-12
@@ -2,7 +2,7 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
|
||||
/** Custom Services. */
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
@@ -33,14 +33,14 @@ export class WriteOffPageComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {LoansService} loanService Loan Service.
|
||||
* @param {DatePipe} datePipe Date Pipe.
|
||||
* @param {Dates} dateUtils Date Utils.
|
||||
* @param {Router} router Router.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private loanService: LoansService,
|
||||
private datePipe: DatePipe,
|
||||
private dateUtils: Dates,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService) { }
|
||||
|
||||
@@ -63,17 +63,21 @@ export class WriteOffPageComponent implements OnInit {
|
||||
* Submits write off form.
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.writeOffForm.value.transactionDate;
|
||||
const writeOffFormData = this.writeOffForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.writeOffForm.patchValue({
|
||||
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
|
||||
});
|
||||
const prevTransactionDate = this.writeOffForm.value.transactionDate;
|
||||
if (writeOffFormData.transactionDate instanceof Date) {
|
||||
writeOffFormData.transactionDate = this.dateUtils.formatDate(prevTransactionDate, dateFormat);
|
||||
}
|
||||
const data = {
|
||||
...writeOffFormData,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const writeOffForm = this.writeOffForm.value;
|
||||
delete writeOffForm.amount;
|
||||
writeOffForm.locale = this.settingsService.language.code;
|
||||
writeOffForm.dateFormat = dateFormat;
|
||||
this.loanService.submitLoanActionButton(loanId, writeOffForm, 'writeoff').subscribe((response: any) => {
|
||||
delete data.amount;
|
||||
this.loanService.submitLoanActionButton(loanId, data, 'writeoff').subscribe((response: any) => {
|
||||
this.router.navigate(['../../../general'], {relativeTo: this.route});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user