@@ -156,7 +156,7 @@
|
|||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="openLoansColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="openLoansColumns"></tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: openLoansColumns;"
|
<tr mat-row *matRowDef="let row; columns: openLoansColumns;"
|
||||||
[routerLink]="['/clients', clientid, 'loans', row.id, 'general']" class="select-row"></tr>
|
[routerLink]="['../', 'loans', row.id, 'general']" class="select-row"></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- Closed Loan Accounts -->
|
<!-- Closed Loan Accounts -->
|
||||||
@@ -204,7 +204,8 @@
|
|||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<tr mat-header-row *matHeaderRowDef="closedLoansColumns"></tr>
|
<tr mat-header-row *matHeaderRowDef="closedLoansColumns"></tr>
|
||||||
<tr mat-row *matRowDef="let row; columns: closedLoansColumns;"></tr>
|
<tr mat-row *matRowDef="let row; columns: closedLoansColumns;"
|
||||||
|
[routerLink]="['../', 'loans', row.id, 'general']" class="select-row"></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,12 @@ export class LoanActionButtonResolver implements Resolve<Object> {
|
|||||||
return this.loansService.getLoanActionTemplate(loanId, 'close-rescheduled');
|
return this.loansService.getLoanActionTemplate(loanId, 'close-rescheduled');
|
||||||
} else if (loanActionButton === 'reschedule') {
|
} else if (loanActionButton === 'reschedule') {
|
||||||
return this.loansService.rescheduleLoanTemplate();
|
return this.loansService.rescheduleLoanTemplate();
|
||||||
} else {
|
} else if (loanActionButton === 'prepay-loan') {
|
||||||
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
return this.loansService.getLoanActionTemplate(loanId, 'prepayLoan');
|
||||||
|
} else if (loanActionButton === 'recovery-payment') {
|
||||||
|
return this.loansService.getLoanActionTemplate(loanId, 'recoverypayment');
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export class CreateLoansAccountComponent implements OnInit {
|
|||||||
const locale = 'en';
|
const locale = 'en';
|
||||||
const dateFormat = 'dd MMMM yyyy';
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
const loanType = 'individual';
|
const loanType = 'individual';
|
||||||
let loansAccountData = {
|
const loansAccountData = {
|
||||||
...this.loansAccount,
|
...this.loansAccount,
|
||||||
clientId: this.loansAccountTemplate.clientId,
|
clientId: this.loansAccountTemplate.clientId,
|
||||||
charges: this.loansAccount.charges.map((charge: any) => ({
|
charges: this.loansAccount.charges.map((charge: any) => ({
|
||||||
@@ -136,7 +136,7 @@ export class CreateLoansAccountComponent implements OnInit {
|
|||||||
if (loansAccountData.interestCalculationPeriodType === 0) {
|
if (loansAccountData.interestCalculationPeriodType === 0) {
|
||||||
loansAccountData.allowPartialPeriodInterestCalcualtion = false;
|
loansAccountData.allowPartialPeriodInterestCalcualtion = false;
|
||||||
}
|
}
|
||||||
if (!(loansAccountData.isFloatingInterestRate === false)){
|
if (!(loansAccountData.isFloatingInterestRate === false)) {
|
||||||
delete loansAccountData.isFloatingInterestRate;
|
delete loansAccountData.isFloatingInterestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-1
@@ -5,7 +5,6 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
|||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { LoansService } from '../../loans.service';
|
import { LoansService } from '../../loans.service';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
import { ReportsRoutingModule } from 'app/reports/reports-routing.module';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loans Account Details Step
|
* Loans Account Details Step
|
||||||
|
|||||||
@@ -10,5 +10,6 @@
|
|||||||
<mifosx-write-off-page [dataObject]="actionButtonData" *ngIf="actions.write_off"></mifosx-write-off-page>
|
<mifosx-write-off-page [dataObject]="actionButtonData" *ngIf="actions.write_off"></mifosx-write-off-page>
|
||||||
<mifosx-close-as-rescheduled [dataObject]="actionButtonData" *ngIf="actions.close_as_rescheduled"></mifosx-close-as-rescheduled>
|
<mifosx-close-as-rescheduled [dataObject]="actionButtonData" *ngIf="actions.close_as_rescheduled"></mifosx-close-as-rescheduled>
|
||||||
<mifosx-loan-reschedule [dataObject]="actionButtonData" *ngIf="actions.reschedule"></mifosx-loan-reschedule>
|
<mifosx-loan-reschedule [dataObject]="actionButtonData" *ngIf="actions.reschedule"></mifosx-loan-reschedule>
|
||||||
|
<mifosx-recovery-repayment [dataObject]="actionButtonData" *ngIf="actions.recovery_payment"></mifosx-recovery-repayment>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export class LoanAccountActionsComponent {
|
|||||||
make_repayment: boolean,
|
make_repayment: boolean,
|
||||||
waive_interest: boolean,
|
waive_interest: boolean,
|
||||||
close_as_rescheduled: boolean,
|
close_as_rescheduled: boolean,
|
||||||
reschedule: boolean } = {
|
reschedule: boolean,
|
||||||
|
recovery_payment: boolean } = {
|
||||||
close: false,
|
close: false,
|
||||||
undo_approval: false,
|
undo_approval: false,
|
||||||
write_off: false,
|
write_off: false,
|
||||||
@@ -32,7 +33,8 @@ export class LoanAccountActionsComponent {
|
|||||||
make_repayment: false,
|
make_repayment: false,
|
||||||
waive_interest: false,
|
waive_interest: false,
|
||||||
close_as_rescheduled: false,
|
close_as_rescheduled: false,
|
||||||
reschedule: false };
|
reschedule: false,
|
||||||
|
recovery_payment: false };
|
||||||
|
|
||||||
actionButtonData: any;
|
actionButtonData: any;
|
||||||
actionName: any;
|
actionName: any;
|
||||||
|
|||||||
+2
-2
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
<div fxFlexFill>
|
<div fxFlexFill>
|
||||||
<span fxFlex="25%">Show Payment Details</span>
|
<span fxFlex="25%">Show Payment Details</span>
|
||||||
<span fxFlex="75%" class="expandCollapsebutton" (click)="toggleDisplay()">
|
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
|
||||||
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||||
<i class="fa fa-minus"></i>
|
<i class="fa fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Cheque #</mat-label>
|
<mat-label>Cheque #</mat-label>
|
||||||
<input matInput formControlName="chequeNumber">
|
<input matInput formControlName="checkNumber">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
|||||||
+47
-38
@@ -1,9 +1,15 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||||
import { LoansService } from 'app/loans/loans.service';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { LoansService } from 'app/loans/loans.service';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loan Make Repayment Component
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-make-repayment',
|
selector: 'mifosx-make-repayment',
|
||||||
templateUrl: './make-repayment.component.html',
|
templateUrl: './make-repayment.component.html',
|
||||||
@@ -14,25 +20,23 @@ export class MakeRepaymentComponent implements OnInit {
|
|||||||
@Input() dataObject: any;
|
@Input() dataObject: any;
|
||||||
/** Loan Id */
|
/** Loan Id */
|
||||||
loanId: string;
|
loanId: string;
|
||||||
|
/** Payment Type Options */
|
||||||
paymentTypes: any;
|
paymentTypes: any;
|
||||||
showPenaltyPortionDisplay: boolean;
|
/** Show payment details */
|
||||||
principalPortion: any;
|
|
||||||
interestPortion: any;
|
|
||||||
feeChargesPortion: any;
|
|
||||||
processDate: boolean;
|
|
||||||
showPaymentDetails = false;
|
showPaymentDetails = false;
|
||||||
/** Minimum Date allowed. */
|
/** Minimum Date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
/** Maximum Date allowed. */
|
/** Maximum Date allowed. */
|
||||||
maxDate = new Date();
|
maxDate = new Date();
|
||||||
/** Assign loan Officer form. */
|
/** Repayment Loan Form */
|
||||||
repaymentLoanForm: FormGroup;
|
repaymentLoanForm: FormGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {FormBuilder} formBuilder Form Builder.
|
* @param {FormBuilder} formBuilder Form Builder.
|
||||||
* @param {LoansService} systemService Loan Service.
|
* @param {LoansService} loanService Loan Service.
|
||||||
* @param {ActivatedRoute} route Activated Route.
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {Router} router Router for navigation.
|
||||||
|
* @param {DatePipe} datePipe Date Pipe.
|
||||||
*/
|
*/
|
||||||
constructor(private formBuilder: FormBuilder,
|
constructor(private formBuilder: FormBuilder,
|
||||||
private loanService: LoansService,
|
private loanService: LoansService,
|
||||||
@@ -43,61 +47,66 @@ export class MakeRepaymentComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the assign officer form.
|
* Creates the repayment loan form
|
||||||
|
* and initialize with the required values
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.createprepayLoanForm();
|
this.createRepaymentLoanForm();
|
||||||
// this.setPrepayLoanDetails();
|
// this.setRepaymentLoanDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the create close form.
|
* Creates the create close form.
|
||||||
*/
|
*/
|
||||||
createprepayLoanForm() {
|
createRepaymentLoanForm() {
|
||||||
this.repaymentLoanForm = this.formBuilder.group({
|
this.repaymentLoanForm = this.formBuilder.group({
|
||||||
'transactionDate': [new Date(), Validators.required],
|
'transactionDate': [new Date(), Validators.required],
|
||||||
'transactionAmount': ['', Validators.required],
|
'transactionAmount': ['', Validators.required],
|
||||||
'paymentTypeId': '',
|
'paymentTypeId': '',
|
||||||
'accountNumber': '',
|
|
||||||
'chequeNumber': '',
|
|
||||||
'routingCode': '',
|
|
||||||
'receiptNumber': '',
|
|
||||||
'bankNumber': '',
|
|
||||||
'note': ''
|
'note': ''
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setPrepayLoanDetails() {
|
setRepaymentLoanDetails() {
|
||||||
this.paymentTypes = this.dataObject.paymentTypeOptions;
|
this.paymentTypes = this.dataObject.paymentTypeOptions;
|
||||||
this.repaymentLoanForm.patchValue({
|
this.repaymentLoanForm.patchValue({
|
||||||
transactionAmount: this.dataObject.amount,
|
transactionAmount: this.dataObject.amount,
|
||||||
transactionDate: new Date(this.dataObject.date)
|
transactionDate: new Date(this.dataObject.date)
|
||||||
});
|
});
|
||||||
if (this.dataObject.penaltyChargesPortion > 0) {
|
}
|
||||||
this.showPenaltyPortionDisplay = true;
|
|
||||||
|
/**
|
||||||
|
* Add payment detail fields to the UI.
|
||||||
|
*/
|
||||||
|
addPaymentDetails() {
|
||||||
|
this.showPaymentDetails = !this.showPaymentDetails;
|
||||||
|
if (this.showPaymentDetails) {
|
||||||
|
this.repaymentLoanForm.addControl('accountNumber', new FormControl(''));
|
||||||
|
this.repaymentLoanForm.addControl('checkNumber', new FormControl(''));
|
||||||
|
this.repaymentLoanForm.addControl('routingCode', new FormControl(''));
|
||||||
|
this.repaymentLoanForm.addControl('receiptNumber', new FormControl(''));
|
||||||
|
this.repaymentLoanForm.addControl('bankNumber', new FormControl(''));
|
||||||
|
} else {
|
||||||
|
this.repaymentLoanForm.removeControl('accountNumber');
|
||||||
|
this.repaymentLoanForm.removeControl('checkNumber');
|
||||||
|
this.repaymentLoanForm.removeControl('routingCode');
|
||||||
|
this.repaymentLoanForm.removeControl('receiptNumber');
|
||||||
|
this.repaymentLoanForm.removeControl('bankNumber');
|
||||||
}
|
}
|
||||||
this.feeChargesPortion = this.dataObject.feeChargesPortion;
|
|
||||||
this.processDate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleDisplay() {
|
|
||||||
this.showPaymentDetails = !(this.showPaymentDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Submits the repayment form */
|
||||||
submit() {
|
submit() {
|
||||||
const transactionDate = this.repaymentLoanForm.value.transactionDate;
|
const prevTransactionDate: Date = this.repaymentLoanForm.value.transactionDate;
|
||||||
const dateFormat = 'yyyy-MM-dd';
|
// TODO: Update once language and date settings are setup
|
||||||
|
const dateFormat = 'dd-MM-yyyy';
|
||||||
this.repaymentLoanForm.patchValue({
|
this.repaymentLoanForm.patchValue({
|
||||||
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
|
transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
|
||||||
});
|
});
|
||||||
const repaymentForm = {
|
const repaymentLoanData = this.repaymentLoanForm.value;
|
||||||
locale: 'en',
|
repaymentLoanData.locale = 'en';
|
||||||
dateFormat: dateFormat,
|
repaymentLoanData.dateFormat = dateFormat;
|
||||||
paymentTypeId: this.repaymentLoanForm.value.paymentTypeId,
|
this.loanService.submitLoanActionButton(this.loanId, repaymentLoanData, 'repayment')
|
||||||
transactionDate: this.repaymentLoanForm.value.transactionDate,
|
|
||||||
transactionAmount: this.repaymentLoanForm.value.transactionAmount
|
|
||||||
};
|
|
||||||
this.loanService.submitLoanActionButton(this.loanId, repaymentForm, 'repayment')
|
|
||||||
.subscribe((response: any) => {
|
.subscribe((response: any) => {
|
||||||
this.router.navigate(['../general'], { relativeTo: this.route });
|
this.router.navigate(['../general'], { relativeTo: this.route });
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
<div fxFlexFill>
|
<div fxFlexFill>
|
||||||
<span fxFlex="25%">Show Payment Details</span>
|
<span fxFlex="25%">Show Payment Details</span>
|
||||||
<span fxFlex="75%" class="expandCollapsebutton" (click)="toggleDisplay()">
|
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
|
||||||
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||||
<i class="fa fa-minus"></i>
|
<i class="fa fa-minus"></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>Cheque #</mat-label>
|
<mat-label>Cheque #</mat-label>
|
||||||
<input matInput formControlName="chequeNumber">
|
<input matInput formControlName="checkNumber">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
|
|||||||
+53
-35
@@ -1,9 +1,15 @@
|
|||||||
|
/** Angular Imports */
|
||||||
import { Component, OnInit, Input } from '@angular/core';
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||||
import { LoansService } from 'app/loans/loans.service';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { LoansService } from 'app/loans/loans.service';
|
||||||
import { DatePipe } from '@angular/common';
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loan Prepay Loan Option
|
||||||
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-prepay-loan',
|
selector: 'mifosx-prepay-loan',
|
||||||
templateUrl: './prepay-loan.component.html',
|
templateUrl: './prepay-loan.component.html',
|
||||||
@@ -14,25 +20,27 @@ export class PrepayLoanComponent implements OnInit {
|
|||||||
@Input() dataObject: any;
|
@Input() dataObject: any;
|
||||||
/** Loan Id */
|
/** Loan Id */
|
||||||
loanId: string;
|
loanId: string;
|
||||||
|
/** Payment Types */
|
||||||
paymentTypes: any;
|
paymentTypes: any;
|
||||||
showPenaltyPortionDisplay: boolean;
|
/** Principal Portion */
|
||||||
principalPortion: any;
|
principalPortion: any;
|
||||||
|
/** Interest Portion */
|
||||||
interestPortion: any;
|
interestPortion: any;
|
||||||
feeChargesPortion: any;
|
/** Show Payment Details */
|
||||||
processDate: boolean;
|
|
||||||
showPaymentDetails = false;
|
showPaymentDetails = false;
|
||||||
/** Minimum Date allowed. */
|
/** Minimum Date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
/** Maximum Date allowed. */
|
/** Maximum Date allowed. */
|
||||||
maxDate = new Date();
|
maxDate = new Date();
|
||||||
/** Assign loan Officer form. */
|
/** Prepay Loan form. */
|
||||||
prepayLoanForm: FormGroup;
|
prepayLoanForm: FormGroup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {FormBuilder} formBuilder Form Builder.
|
* @param {FormBuilder} formBuilder Form Builder.
|
||||||
* @param {LoansService} systemService Loan Service.
|
* @param {LoansService} loanService Loan Service.
|
||||||
* @param {ActivatedRoute} route Activated Route.
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
* @param {Router} router Router for navigation.
|
* @param {Router} router Router for navigation.
|
||||||
|
* @param {DatePipe} datePipe Date Pipe.
|
||||||
*/
|
*/
|
||||||
constructor(private formBuilder: FormBuilder,
|
constructor(private formBuilder: FormBuilder,
|
||||||
private loanService: LoansService,
|
private loanService: LoansService,
|
||||||
@@ -43,7 +51,8 @@ export class PrepayLoanComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the assign officer form.
|
* Creates the prepay loan form
|
||||||
|
* and initialize with the required values
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.createprepayLoanForm();
|
this.createprepayLoanForm();
|
||||||
@@ -51,7 +60,7 @@ export class PrepayLoanComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the create close form.
|
* Creates the prepay loan form.
|
||||||
*/
|
*/
|
||||||
createprepayLoanForm() {
|
createprepayLoanForm() {
|
||||||
this.prepayLoanForm = this.formBuilder.group({
|
this.prepayLoanForm = this.formBuilder.group({
|
||||||
@@ -59,16 +68,14 @@ export class PrepayLoanComponent implements OnInit {
|
|||||||
'transactionAmount': ['', Validators.required],
|
'transactionAmount': ['', Validators.required],
|
||||||
'principal': [{value: '', disabled: true}],
|
'principal': [{value: '', disabled: true}],
|
||||||
'interestAmount': [{value: '', disabled: true}, Validators.required],
|
'interestAmount': [{value: '', disabled: true}, Validators.required],
|
||||||
'paymentTypeId': '',
|
'paymentTypeId': [''],
|
||||||
'accountNumber': '',
|
'note': ['']
|
||||||
'chequeNumber': '',
|
|
||||||
'routingCode': '',
|
|
||||||
'receiptNumber': '',
|
|
||||||
'bankNumber': '',
|
|
||||||
'note': ''
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the value in the prepay loan form
|
||||||
|
*/
|
||||||
setPrepayLoanDetails() {
|
setPrepayLoanDetails() {
|
||||||
this.paymentTypes = this.dataObject.paymentTypeOptions;
|
this.paymentTypes = this.dataObject.paymentTypeOptions;
|
||||||
this.prepayLoanForm.patchValue({
|
this.prepayLoanForm.patchValue({
|
||||||
@@ -76,31 +83,42 @@ export class PrepayLoanComponent implements OnInit {
|
|||||||
principal: this.dataObject.principalPortion,
|
principal: this.dataObject.principalPortion,
|
||||||
interestAmount: this.dataObject.interestPortion,
|
interestAmount: this.dataObject.interestPortion,
|
||||||
});
|
});
|
||||||
if (this.dataObject.penaltyChargesPortion > 0) {
|
}
|
||||||
this.showPenaltyPortionDisplay = true;
|
|
||||||
|
/**
|
||||||
|
* Add payment detail fields to the UI.
|
||||||
|
*/
|
||||||
|
addPaymentDetails() {
|
||||||
|
this.showPaymentDetails = !this.showPaymentDetails;
|
||||||
|
if (this.showPaymentDetails) {
|
||||||
|
this.prepayLoanForm.addControl('accountNumber', new FormControl(''));
|
||||||
|
this.prepayLoanForm.addControl('checkNumber', new FormControl(''));
|
||||||
|
this.prepayLoanForm.addControl('routingCode', new FormControl(''));
|
||||||
|
this.prepayLoanForm.addControl('receiptNumber', new FormControl(''));
|
||||||
|
this.prepayLoanForm.addControl('bankNumber', new FormControl(''));
|
||||||
|
} else {
|
||||||
|
this.prepayLoanForm.removeControl('accountNumber');
|
||||||
|
this.prepayLoanForm.removeControl('checkNumber');
|
||||||
|
this.prepayLoanForm.removeControl('routingCode');
|
||||||
|
this.prepayLoanForm.removeControl('receiptNumber');
|
||||||
|
this.prepayLoanForm.removeControl('bankNumber');
|
||||||
}
|
}
|
||||||
this.feeChargesPortion = this.dataObject.feeChargesPortion;
|
|
||||||
this.processDate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleDisplay() {
|
|
||||||
this.showPaymentDetails = !(this.showPaymentDetails);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the prepay loan form
|
||||||
|
*/
|
||||||
submit() {
|
submit() {
|
||||||
const transactionDate = this.prepayLoanForm.value.transactionDate;
|
const prevTransactionDate: Date = this.prepayLoanForm.value.transactionDate;
|
||||||
const dateFormat = 'yyyy-MM-dd';
|
// TODO: Update once language and date settings are setup
|
||||||
|
const dateFormat = 'dd-MM-yyyy';
|
||||||
this.prepayLoanForm.patchValue({
|
this.prepayLoanForm.patchValue({
|
||||||
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
|
transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
|
||||||
});
|
});
|
||||||
const prepayForm = {
|
const prepayLoanData = this.prepayLoanForm.value;
|
||||||
locale: 'en',
|
prepayLoanData.locale = 'en';
|
||||||
dateFormat: dateFormat,
|
prepayLoanData.dateFormat = dateFormat;
|
||||||
paymentTypeId: this.prepayLoanForm.value.paymentTypeId,
|
this.loanService.submitLoanActionButton(this.loanId, prepayLoanData, 'repayment')
|
||||||
transactionDate: this.prepayLoanForm.value.transactionDate,
|
|
||||||
transactionAmount: this.prepayLoanForm.value.transactionAmount
|
|
||||||
};
|
|
||||||
this.loanService.submitLoanActionButton(this.loanId, prepayForm, 'repayment')
|
|
||||||
.subscribe((response: any) => {
|
.subscribe((response: any) => {
|
||||||
this.router.navigate(['../general'], { relativeTo: this.route });
|
this.router.navigate(['../general'], { relativeTo: this.route });
|
||||||
});
|
});
|
||||||
|
|||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<form [formGroup]="recoveryRepaymentLoanForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Transaction Date</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="transactionDatePicker" required
|
||||||
|
formControlName="transactionDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="transactionDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #transactionDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="recoveryRepaymentLoanForm.controls.transactionDate.hasError('required')">
|
||||||
|
Transaction Date <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Transaction Amount</mat-label>
|
||||||
|
<input matInput required formControlName="transactionAmount">
|
||||||
|
<mat-error *ngIf="recoveryRepaymentLoanForm.controls.transactionAmount.hasError('required')">
|
||||||
|
Transaction Amount <strong>is required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Payment Type</mat-label>
|
||||||
|
<mat-select formControlName="paymentTypeId">
|
||||||
|
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
|
||||||
|
{{ paymentType.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div fxFlexFill>
|
||||||
|
<span fxFlex="25%">Show Payment Details</span>
|
||||||
|
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
|
||||||
|
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||||
|
<i class="fa fa-minus"></i>
|
||||||
|
</button>
|
||||||
|
<button mat-raised-button color="primary" *ngIf="!showPaymentDetails">
|
||||||
|
<i class="fa fa-plus"></i>
|
||||||
|
</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-container *ngIf="showPaymentDetails">
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label> Account #</mat-label>
|
||||||
|
<input matInput formControlName="accountNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Cheque #</mat-label>
|
||||||
|
<input matInput formControlName="checkNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Routing Code</mat-label>
|
||||||
|
<input matInput formControlName="routingCode">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Reciept #</mat-label>
|
||||||
|
<input matInput formControlName="receiptNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Bank #</mat-label>
|
||||||
|
<input matInput formControlName="bankNumber">
|
||||||
|
</mat-form-field>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Note</mat-label>
|
||||||
|
<textarea matInput formControlName="note"></textarea>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../general']">Cancel</button>
|
||||||
|
<button mat-raised-button color="primary" [disabled]="!recoveryRepaymentLoanForm.valid"
|
||||||
|
*mifosxHasPermission="'REPAYMENT_LOAN'">Submit</button>
|
||||||
|
</mat-card-actions>
|
||||||
|
|
||||||
|
</mat-card-content>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
.expandCollapsebutton {
|
||||||
|
margin-top: -7px;
|
||||||
|
}
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { RecoveryRepaymentComponent } from './recovery-repayment.component';
|
||||||
|
|
||||||
|
describe('RecoveryRepaymentComponent', () => {
|
||||||
|
let component: RecoveryRepaymentComponent;
|
||||||
|
let fixture: ComponentFixture<RecoveryRepaymentComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ RecoveryRepaymentComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(RecoveryRepaymentComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+116
@@ -0,0 +1,116 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit, Input } from '@angular/core';
|
||||||
|
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { LoansService } from 'app/loans/loans.service';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loan Recovery Repayment Action
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-recovery-repayment',
|
||||||
|
templateUrl: './recovery-repayment.component.html',
|
||||||
|
styleUrls: ['./recovery-repayment.component.scss']
|
||||||
|
})
|
||||||
|
export class RecoveryRepaymentComponent implements OnInit {
|
||||||
|
|
||||||
|
@Input() dataObject: any;
|
||||||
|
/** Loan Id */
|
||||||
|
loanId: string;
|
||||||
|
/** Payment Type Options */
|
||||||
|
paymentTypes: any;
|
||||||
|
/** Show payment details */
|
||||||
|
showPaymentDetails = false;
|
||||||
|
/** Minimum Date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum Date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Recovery Repayment Loan Form */
|
||||||
|
recoveryRepaymentLoanForm: FormGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder.
|
||||||
|
* @param {LoansService} loanService Loan Service.
|
||||||
|
* @param {ActivatedRoute} route Activated Route.
|
||||||
|
* @param {Router} router Router for navigation.
|
||||||
|
* @param {DatePipe} datePipe Date Pipe.
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private loanService: LoansService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private datePipe: DatePipe) {
|
||||||
|
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the recovery repayment loan form
|
||||||
|
* and initialize with the required values
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createRecoveryRepaymentLoanForm();
|
||||||
|
this.setRecoveryRepaymentLoanDetails();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the recovery repayment loan form
|
||||||
|
*/
|
||||||
|
createRecoveryRepaymentLoanForm() {
|
||||||
|
this.recoveryRepaymentLoanForm = this.formBuilder.group({
|
||||||
|
'transactionDate': [new Date(), Validators.required],
|
||||||
|
'transactionAmount': ['', Validators.required],
|
||||||
|
'paymentTypeId': [''],
|
||||||
|
'note': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Sets Recovery Payment Loan Details */
|
||||||
|
setRecoveryRepaymentLoanDetails() {
|
||||||
|
this.paymentTypes = this.dataObject.paymentTypeOptions;
|
||||||
|
this.recoveryRepaymentLoanForm.patchValue({
|
||||||
|
transactionAmount: this.dataObject.amount,
|
||||||
|
transactionDate: new Date(this.dataObject.date)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add payment detail fields to the UI.
|
||||||
|
*/
|
||||||
|
addPaymentDetails() {
|
||||||
|
this.showPaymentDetails = !this.showPaymentDetails;
|
||||||
|
if (this.showPaymentDetails) {
|
||||||
|
this.recoveryRepaymentLoanForm.addControl('accountNumber', new FormControl(''));
|
||||||
|
this.recoveryRepaymentLoanForm.addControl('checkNumber', new FormControl(''));
|
||||||
|
this.recoveryRepaymentLoanForm.addControl('routingCode', new FormControl(''));
|
||||||
|
this.recoveryRepaymentLoanForm.addControl('receiptNumber', new FormControl(''));
|
||||||
|
this.recoveryRepaymentLoanForm.addControl('bankNumber', new FormControl(''));
|
||||||
|
} else {
|
||||||
|
this.recoveryRepaymentLoanForm.removeControl('accountNumber');
|
||||||
|
this.recoveryRepaymentLoanForm.removeControl('checkNumber');
|
||||||
|
this.recoveryRepaymentLoanForm.removeControl('routingCode');
|
||||||
|
this.recoveryRepaymentLoanForm.removeControl('receiptNumber');
|
||||||
|
this.recoveryRepaymentLoanForm.removeControl('bankNumber');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Submits the recovery payment form */
|
||||||
|
submit() {
|
||||||
|
const prevTransactionDate: Date = this.recoveryRepaymentLoanForm.value.transactionDate;
|
||||||
|
// TODO: Update once language and date settings are setup
|
||||||
|
const dateFormat = 'dd-MM-yyyy';
|
||||||
|
this.recoveryRepaymentLoanForm.patchValue({
|
||||||
|
transactionDate: this.datePipe.transform(prevTransactionDate, dateFormat)
|
||||||
|
});
|
||||||
|
const recoveryRepaymentLoanData = this.recoveryRepaymentLoanForm.value;
|
||||||
|
recoveryRepaymentLoanData.locale = 'en';
|
||||||
|
recoveryRepaymentLoanData.dateFormat = dateFormat;
|
||||||
|
this.loanService.submitLoanActionButton(this.loanId, recoveryRepaymentLoanData, 'recoverypayment')
|
||||||
|
.subscribe((response: any) => {
|
||||||
|
this.router.navigate(['../general'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,6 +42,7 @@ import { LoansAccountTermsStepComponent } from './loans-account-stepper/loans-ac
|
|||||||
import { LoansAccountChargesStepComponent } from './loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component';
|
import { LoansAccountChargesStepComponent } from './loans-account-stepper/loans-account-charges-step/loans-account-charges-step.component';
|
||||||
import { LoansAccountPreviewStepComponent } from './loans-account-stepper/loans-account-preview-step/loans-account-preview-step.component';
|
import { LoansAccountPreviewStepComponent } from './loans-account-stepper/loans-account-preview-step/loans-account-preview-step.component';
|
||||||
import { LoansAccountAddCollateralDialogComponent } from './loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component';
|
import { LoansAccountAddCollateralDialogComponent } from './loans-account-add-collateral-dialog/loans-account-add-collateral-dialog.component';
|
||||||
|
import { RecoveryRepaymentComponent } from './loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loans Module
|
* Loans Module
|
||||||
@@ -84,6 +85,7 @@ import { LoansAccountAddCollateralDialogComponent } from './loans-account-add-co
|
|||||||
LoansAccountChargesStepComponent,
|
LoansAccountChargesStepComponent,
|
||||||
LoansAccountPreviewStepComponent,
|
LoansAccountPreviewStepComponent,
|
||||||
LoansAccountAddCollateralDialogComponent,
|
LoansAccountAddCollateralDialogComponent,
|
||||||
|
RecoveryRepaymentComponent,
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
LoansAccountAddCollateralDialogComponent
|
LoansAccountAddCollateralDialogComponent
|
||||||
|
|||||||
Reference in New Issue
Block a user