diff --git a/src/app/core/shell/content/content.component.html b/src/app/core/shell/content/content.component.html
index 638208949..08716e076 100644
--- a/src/app/core/shell/content/content.component.html
+++ b/src/app/core/shell/content/content.component.html
@@ -1,2 +1,3 @@
+
diff --git a/src/app/core/shell/content/content.component.scss b/src/app/core/shell/content/content.component.scss
index e69de29bb..884bccc46 100644
--- a/src/app/core/shell/content/content.component.scss
+++ b/src/app/core/shell/content/content.component.scss
@@ -0,0 +1,2 @@
+mifosx-content { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -30px; }
+#push { height:30px;}
diff --git a/src/app/loans/create-loans-account/create-loans-account.component.ts b/src/app/loans/create-loans-account/create-loans-account.component.ts
index f40b0919c..c5c34d1c0 100644
--- a/src/app/loans/create-loans-account/create-loans-account.component.ts
+++ b/src/app/loans/create-loans-account/create-loans-account.component.ts
@@ -1,7 +1,6 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom Services */
import { LoansService } from '../loans.service';
@@ -11,6 +10,7 @@ import { SettingsService } from 'app/settings/settings.service';
import { LoansAccountDetailsStepComponent } from '../loans-account-stepper/loans-account-details-step/loans-account-details-step.component';
import { LoansAccountTermsStepComponent } from '../loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component';
import { LoansAccountChargesStepComponent } from '../loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component';
+import { Dates } from 'app/core/utils/dates';
/**
* Create loans account
@@ -44,7 +44,7 @@ export class CreateLoansAccountComponent implements OnInit {
*/
constructor(private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService
) {
@@ -107,17 +107,17 @@ export class CreateLoansAccountComponent implements OnInit {
charges: this.loansAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
- dueDate: charge.dueDate && this.datePipe.transform(charge.dueDate, dateFormat),
+ dueDate: charge.dueDate && this.dateUtils.formatDate(charge.dueDate, dateFormat),
})),
collateral: this.loansAccount.collateral.map((collateralEle: any) => ({
type: collateralEle.type,
value: collateralEle.value,
description: collateralEle.description
})),
- interestChargedFromDate: this.datePipe.transform(this.loansAccount.interestChargedFromDate, dateFormat),
- repaymentsStartingFromDate: this.datePipe.transform(this.loansAccount.repaymentsStartingFromDate, dateFormat),
- submittedOnDate: this.datePipe.transform(this.loansAccount.submittedOnDate, dateFormat),
- expectedDisbursementDate: this.datePipe.transform(this.loansAccount.expectedDisbursementDate, dateFormat),
+ interestChargedFromDate: this.dateUtils.formatDate(this.loansAccount.interestChargedFromDate, dateFormat),
+ repaymentsStartingFromDate: this.dateUtils.formatDate(this.loansAccount.repaymentsStartingFromDate, dateFormat),
+ submittedOnDate: this.dateUtils.formatDate(this.loansAccount.submittedOnDate, dateFormat),
+ expectedDisbursementDate: this.dateUtils.formatDate(this.loansAccount.expectedDisbursementDate, dateFormat),
dateFormat,
locale,
loanType
@@ -129,10 +129,14 @@ export class CreateLoansAccountComponent implements OnInit {
}
if (loansAccountData.recalculationRestFrequencyDate) {
- loansAccountData.recalculationRestFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
+ loansAccountData.recalculationRestFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
}
- if (!loansAccountData.recalculationCompoundingFrequencyDate) {
+ if (this.loansAccountProductTemplate.isInterestRecalculationEnabled) {
+ if (loansAccountData.recalculationCompoundingFrequencyDate !== null) {
+ loansAccountData.recalculationCompoundingFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationCompoundingFrequencyDate, dateFormat);
+ }
+ } else {
delete loansAccountData.recalculationCompoundingFrequencyDate;
}
diff --git a/src/app/loans/edit-loans-account/edit-loans-account.component.ts b/src/app/loans/edit-loans-account/edit-loans-account.component.ts
index 4e4a1f02f..8ed564ce4 100644
--- a/src/app/loans/edit-loans-account/edit-loans-account.component.ts
+++ b/src/app/loans/edit-loans-account/edit-loans-account.component.ts
@@ -1,6 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
import { LoansService } from '../loans.service';
import { LoansAccountDetailsStepComponent } from '../loans-account-stepper/loans-account-details-step/loans-account-details-step.component';
import { LoansAccountTermsStepComponent } from '../loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component';
@@ -8,6 +7,7 @@ import { LoansAccountChargesStepComponent } from '../loans-account-stepper/loans
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Edit Loans
@@ -41,7 +41,7 @@ export class EditLoansAccountComponent implements OnInit {
*/
constructor(private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService
) {
@@ -110,17 +110,17 @@ export class EditLoansAccountComponent implements OnInit {
charges: this.loansAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
- dueDate: charge.dueDate && this.datePipe.transform(charge.dueDate, dateFormat),
+ dueDate: charge.dueDate && this.dateUtils.formatDate(charge.dueDate, dateFormat),
})),
collateral: this.loansAccount.collateral.map((collateralEle: any) => ({
type: collateralEle.type,
value: collateralEle.value,
description: collateralEle.description
})),
- interestChargedFromDate: this.datePipe.transform(this.loansAccount.interestChargedFromDate, dateFormat),
- repaymentsStartingFromDate: this.datePipe.transform(this.loansAccount.repaymentsStartingFromDate, dateFormat),
- submittedOnDate: this.datePipe.transform(this.loansAccount.submittedOnDate, dateFormat),
- expectedDisbursementDate: this.datePipe.transform(this.loansAccount.expectedDisbursementDate, dateFormat),
+ interestChargedFromDate: this.dateUtils.formatDate(this.loansAccount.interestChargedFromDate, dateFormat),
+ repaymentsStartingFromDate: this.dateUtils.formatDate(this.loansAccount.repaymentsStartingFromDate, dateFormat),
+ submittedOnDate: this.dateUtils.formatDate(this.loansAccount.submittedOnDate, dateFormat),
+ expectedDisbursementDate: this.dateUtils.formatDate(this.loansAccount.expectedDisbursementDate, dateFormat),
dateFormat,
locale,
loanType
@@ -132,11 +132,15 @@ export class EditLoansAccountComponent implements OnInit {
}
if (loansAccountData.recalculationRestFrequencyDate) {
- loansAccountData.recalculationRestFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
+ loansAccountData.recalculationRestFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationRestFrequencyDate, dateFormat);
}
- if (loansAccountData.recalculationCompoundingFrequencyDate) {
- loansAccountData.recalculationCompoundingFrequencyDate = this.datePipe.transform(this.loansAccount.recalculationCompoundingFrequencyDate, dateFormat);
+ if (this.loansAccountProductTemplate.isInterestRecalculationEnabled) {
+ if (loansAccountData.recalculationCompoundingFrequencyDate !== null) {
+ loansAccountData.recalculationCompoundingFrequencyDate = this.dateUtils.formatDate(this.loansAccount.recalculationCompoundingFrequencyDate, dateFormat);
+ }
+ } else {
+ delete loansAccountData.recalculationCompoundingFrequencyDate;
}
if (loansAccountData.interestCalculationPeriodType === 0) {
diff --git a/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
index c7f0e5d5b..acfba3981 100644
--- a/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
+++ b/src/app/loans/loans-account-stepper/loans-account-details-step/loans-account-details-step.component.ts
@@ -78,7 +78,7 @@ export class LoansAccountDetailsStepComponent implements OnInit {
'loanOfficerId': [''],
'loanPurposeId': [''],
'fundId': [''],
- 'submittedOnDate': ['', Validators.required],
+ 'submittedOnDate': [new Date(), Validators.required],
'expectedDisbursementDate': ['', Validators.required],
'externalId': [''],
'linkAccountId': [''],
diff --git a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html
index 88c4b7a51..d8e99d9a0 100644
--- a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html
+++ b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html
@@ -72,7 +72,7 @@
Select On
-
+
@@ -83,7 +83,7 @@
Select Day
-
+
diff --git a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts
index f90f2a124..ed096345a 100644
--- a/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts
+++ b/src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts
@@ -91,6 +91,12 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'repaymentsStartingFromDate': this.loansAccountTemplate.expectedFirstRepaymentOnDate && new Date(this.loansAccountTemplate.expectedFirstRepaymentOnDate)
});
}
+
+ if (this.loansAccountTemplate.isInterestRecalculationEnabled) {
+ this.loansAccountTermsForm.patchValue({
+ 'recalculationCompoundingFrequencyDate': ''
+ });
+ }
}
this.createloansAccountTermsForm();
this.setCustomValidators();
@@ -126,8 +132,8 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'numberOfRepayments': ['', Validators.required],
'repaymentEvery': ['', Validators.required],
'repaymentFrequencyType': ['', Validators.required],
- 'repaymentFrequencyNthDayType': ['', Validators.required],
- 'repaymentFrequencyDayOfWeekType': ['', Validators.required],
+ 'repaymentFrequencyNthDayType': [''],
+ 'repaymentFrequencyDayOfWeekType': [''],
'repaymentsStartingFromDate': [''],
'interestChargedFromDate': [''],
'interestRatePerPeriod': [''],
@@ -147,8 +153,7 @@ export class LoansAccountTermsStepComponent implements OnInit, OnChanges {
'loanIdToClose': [''],
'fixedEmiAmount': [''],
'isTopup': [''],
- 'maxOutstandingLoanBalance': [''],
- 'recalculationCompoundingFrequencyDate': ['']
+ 'maxOutstandingLoanBalance': ['']
});
}
diff --git a/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts b/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts
index 72a4c3d51..d7c768d48 100644
--- a/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/add-loan-charge/add-loan-charge.component.ts
@@ -2,11 +2,11 @@
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';
/** Custom Services */
import { LoansService } from '../../../loans.service';
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Create Add Loan Charge component.
@@ -54,7 +54,7 @@ export class AddLoanChargeComponent implements OnInit {
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService) {
this.route.data.subscribe((data: { actionButtonData: any }) => {
@@ -102,7 +102,7 @@ export class AddLoanChargeComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.loanChargeForm.patchValue({
- dueDate: this.datePipe.transform(prevDueDate, dateFormat)
+ dueDate: this.dateUtils.formatDate(prevDueDate, dateFormat)
});
const loanCharge = this.loanChargeForm.value;
loanCharge.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts
index 47e506516..9c71ef8a7 100644
--- a/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts
@@ -2,8 +2,7 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { distinctUntilChanged } from 'rxjs/operators';
-import { DatePipe } from '@angular/common';
+import { Dates } from 'app/core/utils/dates';
/** Custom Services. */
import { LoansService } from 'app/loans/loans.service';
@@ -41,7 +40,7 @@ export class ApproveLoanComponent implements OnInit {
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loanService: LoansService,
private router: Router,
private settingsService: SettingsService) {
@@ -77,18 +76,18 @@ export class ApproveLoanComponent implements OnInit {
* Submits Approve form.
*/
submit() {
- const local = this.settingsService.language.code;
+ 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.datePipe.transform(approvedOnDate, dateFormat),
- expectedDisbursementDate: this.datePipe.transform(expectedDisbursementDate, dateFormat)
+ approvedOnDate: this.dateUtils.formatDate(approvedOnDate, dateFormat),
+ expectedDisbursementDate: this.dateUtils.formatDate(expectedDisbursementDate, dateFormat)
});
const approveLoanFormData = {
... this.approveLoanForm.value,
dateFormat,
- local
+ locale
};
this.loanService.loanActionButtons(this.loanId, 'approve', approveLoanFormData).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
diff --git a/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts b/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts
index e998d7334..1f4ed4dc0 100644
--- a/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/assign-loan-officer/assign-loan-officer.component.ts
@@ -1,12 +1,11 @@
import { Component, OnInit, Input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
-import { MatDialog } from '@angular/material/dialog';
import { LoansService } from 'app/loans/loans.service';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
@Component({
selector: 'mifosx-assign-loan-officer',
@@ -37,7 +36,7 @@ export class AssignLoanOfficerComponent implements OnInit {
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -64,7 +63,7 @@ export class AssignLoanOfficerComponent implements OnInit {
const assignmentDate = this.assignOfficerForm.value.assignmentDate;
const dateFormat = this.settingsService.dateFormat;
this.assignOfficerForm.patchValue({
- assignmentDate: this.datePipe.transform(assignmentDate, dateFormat)
+ assignmentDate: this.dateUtils.formatDate(assignmentDate, dateFormat)
});
const assignForm = this.assignOfficerForm.value;
assignForm.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts b/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts
index db6825d7d..3087c51e8 100644
--- a/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/close-as-rescheduled/close-as-rescheduled.component.ts
@@ -2,10 +2,10 @@ import { Component, OnInit, Input } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { LoansService } from 'app/loans/loans.service';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
@Component({
selector: 'mifosx-close-as-rescheduled',
@@ -36,7 +36,7 @@ export class CloseAsRescheduledComponent implements OnInit {
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -66,7 +66,7 @@ export class CloseAsRescheduledComponent implements OnInit {
const transactionDate = this.closeLoanForm.value.transactionDate;
const dateFormat = this.settingsService.dateFormat;
this.closeLoanForm.patchValue({
- transactionDate: this.datePipe.transform(transactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
});
const closeForm = this.closeLoanForm.value;
closeForm.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts b/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts
index bcd8e78bd..cf6a88d5b 100644
--- a/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/create-guarantor/create-guarantor.component.ts
@@ -5,9 +5,9 @@ import { ActivatedRoute, Router } from '@angular/router';
/** Custom Services */
import { LoansService } from 'app/loans/loans.service';
-import { DatePipe } from '@angular/common';
import { ClientsService } from 'app/clients/clients.service';
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Create Guarantor Action
@@ -42,14 +42,13 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private clientsService: ClientsService,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
@@ -164,7 +163,7 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
if (this.newGuarantorForm.value.existingClient) {
newGuarantorData['entityId'] = this.newGuarantorForm.controls.name.value.id;
} else {
- newGuarantorData['dob'] = this.datePipe.transform(prevdob, dateFormat),
+ newGuarantorData['dob'] = this.dateUtils.formatDate(prevdob, dateFormat),
newGuarantorData['dateFormat'] = dateFormat;
}
diff --git a/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts b/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts
index 0b23b144a..f111e7484 100644
--- a/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component.ts
@@ -2,11 +2,11 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom Service. */
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Disburse To Savings component.
@@ -32,14 +32,13 @@ export class DisburseLoanAccountComponent implements OnInit {
* @param {FormBuilder} formBuilder FormBuilder.
* @param {ActivatedRoute} route ActivatedRoute.
* @param {Router} router Router.
- * @param {DatePipe} datePipe DatePipe.
* @param {LoansService} loanService Loan Service.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loanService: LoansService,
private settingsService: SettingsService) { }
@@ -68,7 +67,7 @@ export class DisburseLoanAccountComponent implements OnInit {
const actualDisbursementDate = this.disbursementForm.value.actualDisbursementDate;
const dateFormat = this.settingsService.dateFormat;
this.disbursementForm.patchValue({
- actualDisbursementDate: this.datePipe.transform(actualDisbursementDate, dateFormat)
+ actualDisbursementDate: this.dateUtils.formatDate(actualDisbursementDate, dateFormat)
});
const loanId = this.route.parent.snapshot.params['loanId'];
const disbursementForm = this.disbursementForm.value;
diff --git a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
index f17e559e1..752aad072 100644
--- a/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts
@@ -5,8 +5,8 @@ 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';
/**
* Disburse Loan Option
@@ -37,14 +37,13 @@ export class DisburseComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -105,7 +104,7 @@ export class DisburseComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.disbursementLoanForm.patchValue({
- actualDisbursementDate: this.datePipe.transform(prevActualDisbursementDate, dateFormat)
+ actualDisbursementDate: this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat)
});
const disbursementLoanData = this.disbursementLoanForm.value;
disbursementLoanData.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts b/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts
index 1c7d4eada..11d3d4507 100644
--- a/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/foreclosure/foreclosure.component.ts
@@ -2,10 +2,10 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { LoansService } from 'app/loans/loans.service';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
@Component({
selector: 'mifosx-foreclosure',
@@ -36,7 +36,7 @@ export class ForeclosureComponent implements OnInit {
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -68,7 +68,7 @@ export class ForeclosureComponent implements OnInit {
retrieveLoanForeclosureTemplate(val: any) {
const dateFormat = this.settingsService.dateFormat;
- const transactionDateFormatted = this.datePipe.transform(val, dateFormat);
+ const transactionDateFormatted = this.dateUtils.formatDate(val, dateFormat);
const data = {
command: 'foreclosure',
dateFormat: this.settingsService.dateFormat,
@@ -111,7 +111,7 @@ export class ForeclosureComponent implements OnInit {
const transactionDate = this.foreclosureForm.value.transactionDate;
const dateFormat = this.settingsService.dateFormat;
this.foreclosureForm.patchValue({
- transactionDate: this.datePipe.transform(transactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
});
const formData = {
transactionDate: this.foreclosureForm.value.transactionDate,
diff --git a/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts b/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts
index 0950d57d8..35310662e 100644
--- a/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/loan-reschedule/loan-reschedule.component.ts
@@ -2,11 +2,10 @@ import { Component, OnInit, Input } from '@angular/core';
import { LoansService } from 'app/loans/loans.service';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
-import { DatePipe } from '@angular/common';
-import { subscribeOn } from 'rxjs/operators';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
@Component({
selector: 'mifosx-loan-reschedule',
@@ -41,7 +40,7 @@ export class LoanRescheduleComponent implements OnInit {
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -73,9 +72,9 @@ export class LoanRescheduleComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
this.rescheduleLoanForm.patchValue({
- rescheduleFromDate: this.datePipe.transform(rescheduleFromDate, dateFormat),
- adjustedDueDate: this.datePipe.transform(adjustedDueDate, dateFormat),
- submittedOnDate: this.datePipe.transform(submittedOnDate, dateFormat)
+ 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;
diff --git a/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts b/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts
index 253b2e60c..0d2e1e556 100644
--- a/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/loans-account-close/loans-account-close.component.ts
@@ -3,10 +3,10 @@ import { Component, OnInit, Input } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
-import { DatePipe } from '@angular/common';
/** Custom Services */
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
@Component({
selector: 'mifosx-loans-account-close',
@@ -37,7 +37,7 @@ export class LoansAccountCloseComponent implements OnInit {
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -67,7 +67,7 @@ export class LoansAccountCloseComponent implements OnInit {
const transactionDate = this.closeLoanForm.value.transactionDate;
const dateFormat = this.settingsService.dateFormat;
this.closeLoanForm.patchValue({
- transactionDate: this.datePipe.transform(transactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat)
});
const closeForm = this.closeLoanForm.value;
closeForm.locale = this.settingsService.language.code;
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 8d83328e2..d8117573a 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
@@ -5,8 +5,8 @@ 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';
/**
* Loan Make Repayment Component
@@ -37,14 +37,13 @@ export class MakeRepaymentComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -104,7 +103,7 @@ export class MakeRepaymentComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.repaymentLoanForm.patchValue({
- transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
});
const repaymentLoanData = this.repaymentLoanForm.value;
repaymentLoanData.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts
index 39ba57d08..20ece5420 100644
--- a/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/prepay-loan/prepay-loan.component.ts
@@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
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';
/**
@@ -42,14 +43,13 @@ export class PrepayLoanComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -117,7 +117,7 @@ export class PrepayLoanComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.prepayLoanForm.patchValue({
- transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
});
const prepayLoanData = this.prepayLoanForm.value;
prepayLoanData.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts b/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts
index 5cbc13f84..c8542a113 100644
--- a/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component.ts
@@ -5,8 +5,8 @@ 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';
/**
* Loan Recovery Repayment Action
@@ -37,14 +37,13 @@ export class RecoveryRepaymentComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -105,7 +104,7 @@ export class RecoveryRepaymentComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.recoveryRepaymentLoanForm.patchValue({
- transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
+ transactionDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
});
const recoveryRepaymentLoanData = this.recoveryRepaymentLoanForm.value;
recoveryRepaymentLoanData.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts b/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts
index 31870b1ad..18c96a442 100644
--- a/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/reject-loan/reject-loan.component.ts
@@ -2,11 +2,11 @@
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom services. */
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Reject Loan component.
@@ -32,14 +32,13 @@ export class RejectLoanComponent implements OnInit {
* @param formBuilder Form Builder.
* @param router Router.
* @param route Activated Route.
- * @param datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService ) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -65,7 +64,7 @@ export class RejectLoanComponent implements OnInit {
const rejectedOnDate = this.rejectLoanForm.value.rejectedOnDate;
const dateFormat = this.settingsService.dateFormat;
this.rejectLoanForm.patchValue({
- rejectedOnDate: this.datePipe.transform(rejectedOnDate, dateFormat)
+ rejectedOnDate: this.dateUtils.formatDate(rejectedOnDate, dateFormat)
});
const rejectForm = this.rejectLoanForm.value;
rejectForm.locale = this.settingsService.language.code;
diff --git a/src/app/loans/loans-view/loan-account-actions/waive-interest/waive-interest.component.ts b/src/app/loans/loans-view/loan-account-actions/waive-interest/waive-interest.component.ts
index 837f4c184..52fb09b2a 100644
--- a/src/app/loans/loans-view/loan-account-actions/waive-interest/waive-interest.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/waive-interest/waive-interest.component.ts
@@ -2,10 +2,10 @@
import { Component, OnInit, Input } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
-import { DatePipe } from '@angular/common';
/** Custom Services. */
import { LoansService } from 'app/loans/loans.service';
+import { Dates } from 'app/core/utils/dates';
/**
* Waive Interest component.
@@ -30,13 +30,12 @@ export class WaiveInterestComponent implements OnInit {
* Get data from `Resolver`.
* @param {FormBuilder} formBuilder Form Builder.
* @param {Router} router Router.
- * @param {DatePipe} datePipe DatePipe.
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private formBuilder: FormBuilder,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private loanService: LoansService,
private route: ActivatedRoute) { }
@@ -63,7 +62,7 @@ export class WaiveInterestComponent implements OnInit {
const transactionAmount = this.loanInterestForm.value.transactionAmount;
const dateFormat = 'dd MMMM yyyy';
this.loanInterestForm.patchValue({
- transactionDate: this.datePipe.transform(transactionDate, dateFormat),
+ transactionDate: this.dateUtils.formatDate(transactionDate, dateFormat),
transactionAmount: parseInt(transactionAmount, 10)
});
const loanId = this.route.parent.snapshot.params['loanId'];
diff --git a/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts b/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts
index 9dee68ca7..81bd29f26 100644
--- a/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts
+++ b/src/app/loans/loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component.ts
@@ -5,8 +5,8 @@ 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';
/**
* Withdrawn By Applicant Loan Form
@@ -33,14 +33,13 @@ export class WithdrawnByClientComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
- * @param {DatePipe} datePipe Date Pipe.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
- private datePipe: DatePipe,
+ private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.parent.snapshot.params['loanId'];
}
@@ -69,7 +68,7 @@ export class WithdrawnByClientComponent implements OnInit {
// TODO: Update once language and date settings are setup
const dateFormat = this.settingsService.dateFormat;
this.withdrawnByClientLoanForm.patchValue({
- withdrawnOnDate: this.datePipe.transform(prevTransactionDate, dateFormat)
+ withdrawnOnDate: this.dateUtils.formatDate(prevTransactionDate, dateFormat)
});
const WithdrawnByClientLoanData = this.withdrawnByClientLoanForm.value;
WithdrawnByClientLoanData.locale = this.settingsService.language.code;