Loan account Contract Termination transaction
This commit is contained in:
@@ -5,7 +5,10 @@
|
||||
[dataObject]="actionButtonData"
|
||||
></mifosx-assign-loan-officer>
|
||||
<mifosx-foreclosure [dataObject]="actionButtonData" *ngIf="actions['Foreclosure']"></mifosx-foreclosure>
|
||||
<mifosx-prepay-loan [dataObject]="actionButtonData" *ngIf="actions['Prepay Loan']"></mifosx-prepay-loan>
|
||||
<mifosx-prepay-loan
|
||||
[dataObject]="actionButtonData"
|
||||
*ngIf="actions['Prepay Loan'] || actions['Contract Termination']"
|
||||
></mifosx-prepay-loan>
|
||||
<mifosx-make-repayment [dataObject]="actionButtonData" *ngIf="actions['Make Repayment']"></mifosx-make-repayment>
|
||||
<mifosx-make-repayment [dataObject]="actionButtonData" *ngIf="actions['Capitalized Income']"></mifosx-make-repayment>
|
||||
<mifosx-make-repayment [dataObject]="actionButtonData" *ngIf="actions['Goodwill Credit']"></mifosx-make-repayment>
|
||||
|
||||
@@ -52,6 +52,7 @@ export class LoanAccountActionsComponent {
|
||||
'Interest Payment Waiver': boolean;
|
||||
'Add Interest Pause': boolean;
|
||||
'Capitalized Income': boolean;
|
||||
'Contract Termination': boolean;
|
||||
} = {
|
||||
Close: false,
|
||||
'Undo Approval': false,
|
||||
@@ -88,7 +89,8 @@ export class LoanAccountActionsComponent {
|
||||
'Re-Amortize': false,
|
||||
'Interest Payment Waiver': false,
|
||||
'Add Interest Pause': false,
|
||||
'Capitalized Income': false
|
||||
'Capitalized Income': false,
|
||||
'Contract Termination': false
|
||||
};
|
||||
|
||||
actionButtonData: any;
|
||||
@@ -119,5 +121,7 @@ export class LoanAccountActionsComponent {
|
||||
}
|
||||
this.actions[this.actionName as keyof typeof this.actions] = true;
|
||||
});
|
||||
|
||||
this.actionButtonData['actionName'] = this.actionName;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -3,7 +3,7 @@
|
||||
<form [formGroup]="prepayLoanForm" (ngSubmit)="submit()">
|
||||
<mat-card-content>
|
||||
<div class="layout-column">
|
||||
<mat-form-field (click)="transactionDatePicker.open()">
|
||||
<mat-form-field (click)="transactionDatePicker.open()" *ngIf="!contractTermination">
|
||||
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
@@ -56,6 +56,7 @@
|
||||
</div>
|
||||
|
||||
<mifosx-input-amount
|
||||
*ngIf="!contractTermination"
|
||||
[currency]="currency"
|
||||
[isRequired]="true"
|
||||
[inputFormControl]="prepayLoanForm.controls.transactionAmount"
|
||||
@@ -68,7 +69,7 @@
|
||||
<input matInput formControlName="externalId" />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-form-field *ngIf="!contractTermination">
|
||||
<mat-label>{{ 'labels.inputs.Payment Type' | translate }}</mat-label>
|
||||
<mat-select formControlName="paymentTypeId">
|
||||
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
|
||||
@@ -77,7 +78,7 @@
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<div class="flex-fill">
|
||||
<div class="flex-fill" *ngIf="!contractTermination">
|
||||
<span class="expandcollapsebutton m-l-10 m-t-40 flex-75" (click)="addPaymentDetails()">
|
||||
<mat-slide-toggle>
|
||||
<div [className]="showPaymentDetails ? 'enabled' : 'disabled'">
|
||||
|
||||
+44
-16
@@ -38,6 +38,7 @@ export class PrepayLoanComponent implements OnInit {
|
||||
|
||||
prepayData: any;
|
||||
currency: Currency | null = null;
|
||||
contractTermination: boolean;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
@@ -62,10 +63,13 @@ export class PrepayLoanComponent implements OnInit {
|
||||
* and initialize with the required values
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.prepayData = this.dataObject;
|
||||
this.contractTermination = this.dataObject['actionName'] == 'Contract Termination';
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.createprepayLoanForm();
|
||||
this.setPrepayLoanDetails();
|
||||
this.prepayData = this.dataObject;
|
||||
if (!this.contractTermination) {
|
||||
this.setPrepayLoanDetails();
|
||||
}
|
||||
if (this.dataObject.currency) {
|
||||
this.currency = this.dataObject.currency;
|
||||
}
|
||||
@@ -75,19 +79,26 @@ export class PrepayLoanComponent implements OnInit {
|
||||
* Creates the prepay loan form.
|
||||
*/
|
||||
createprepayLoanForm() {
|
||||
this.prepayLoanForm = this.formBuilder.group({
|
||||
transactionDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
transactionAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
externalId: [''],
|
||||
paymentTypeId: [''],
|
||||
note: ['']
|
||||
});
|
||||
if (this.contractTermination) {
|
||||
this.prepayLoanForm = this.formBuilder.group({
|
||||
externalId: [''],
|
||||
note: ['']
|
||||
});
|
||||
} else {
|
||||
this.prepayLoanForm = this.formBuilder.group({
|
||||
transactionDate: [
|
||||
new Date(),
|
||||
Validators.required
|
||||
],
|
||||
transactionAmount: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
externalId: [''],
|
||||
paymentTypeId: [''],
|
||||
note: ['']
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +144,7 @@ export class PrepayLoanComponent implements OnInit {
|
||||
/**
|
||||
* Submits the prepay loan form
|
||||
*/
|
||||
submit() {
|
||||
submitRepayment() {
|
||||
const prepayLoanFormData = this.prepayLoanForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
@@ -151,4 +162,21 @@ export class PrepayLoanComponent implements OnInit {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
submitContractTermination() {
|
||||
const data = {
|
||||
...this.prepayLoanForm.value
|
||||
};
|
||||
this.loanService.loanActionButtons(this.loanId, 'contractTermination', data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
submit() {
|
||||
if (this.contractTermination) {
|
||||
this.submitContractTermination();
|
||||
} else {
|
||||
this.submitRepayment();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user