Enhancement in loan and savings account views (#1690)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
c0185627f7
commit
6ef53c6462
+1
-1
@@ -58,7 +58,7 @@ export class AddCollateralComponent implements OnInit {
|
||||
this.collateralForm.patchValue({
|
||||
'collateralTypeId': collateralTypeId
|
||||
});
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanId = this.route.snapshot.params['loanId'];
|
||||
const collateralForm = this.collateralForm.value;
|
||||
collateralForm.locale = 'en';
|
||||
this.loanService.createLoanCollateral(loanId, collateralForm).subscribe((response: any) => {
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ export class AddLoanChargeComponent implements OnInit {
|
||||
this.route.data.subscribe((data: { actionButtonData: any }) => {
|
||||
this.loanChargeOptions = data.actionButtonData.chargeOptions;
|
||||
});
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
<div class="container mat-elevation-z8">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="adjustLoanChargeForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>Amount</mat-label>
|
||||
<span matTextSuffix class="m-l-10">{{ loanDetailsData.currency.code }}</span>
|
||||
<span fxFlex="auto"></span>
|
||||
<input type="number" matInput required class="right-input" formControlName="amount">
|
||||
<mat-error *ngIf="adjustLoanChargeForm.controls.amount.hasError('required')">
|
||||
Amount <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>External Id</mat-label>
|
||||
<input matInput formControlName="externalId">
|
||||
</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="75%" class="expandcollapsebutton m-l-10 m-t-40" (click)="addPaymentDetails()">
|
||||
<mat-slide-toggle>
|
||||
<div [className]="showPaymentDetails ? 'enabled' : 'disabled'">
|
||||
<span class="m-l-10">Show Payment Details</span>
|
||||
</div>
|
||||
</mat-slide-toggle>
|
||||
</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" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
|
||||
<button type="button" mat-raised-button [routerLink]="['../..']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!adjustLoanChargeForm.valid"
|
||||
*mifosxHasPermission="'ADJUSTMENT_LOANCHARGE'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
.expandcollapsebutton {
|
||||
margin-top: -7px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
.right-input {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.right-label {
|
||||
padding-right: 25px !important;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdjustLoanChargeComponent } from './adjust-loan-charge.component';
|
||||
|
||||
describe('AdjustLoanChargeComponent', () => {
|
||||
let component: AdjustLoanChargeComponent;
|
||||
let fixture: ComponentFixture<AdjustLoanChargeComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdjustLoanChargeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AdjustLoanChargeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { LoansService } from 'app/loans/loans.service';
|
||||
import { OrganizationService } from 'app/organization/organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-adjust-loan-charge',
|
||||
templateUrl: './adjust-loan-charge.component.html',
|
||||
styleUrls: ['./adjust-loan-charge.component.scss']
|
||||
})
|
||||
export class AdjustLoanChargeComponent implements OnInit {
|
||||
/** Loan Id */
|
||||
loanId: string;
|
||||
chargeId: string;
|
||||
|
||||
/** Payment Type Options */
|
||||
paymentTypes: any = [];
|
||||
chargeData: any = [];
|
||||
loanDetailsData: any = [];
|
||||
|
||||
/** Show payment details */
|
||||
showPaymentDetails = false;
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Repayment Loan Form */
|
||||
adjustLoanChargeForm: FormGroup;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {LoansService} loanService Loan Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private loanService: LoansService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private settingsService: SettingsService,
|
||||
private organizationService: OrganizationService) {
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
this.chargeId = this.route.snapshot.params['id'];
|
||||
this.route.data.subscribe((data: { loansAccountCharge: any, loanDetailsData: any }) => {
|
||||
this.chargeData = data.loansAccountCharge;
|
||||
this.loanDetailsData = data.loanDetailsData;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the repayment loan form
|
||||
* and initialize with the required values
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.maxAllowedDate;
|
||||
this.createAdjustLoanChargeForm();
|
||||
this.setRepaymentLoanDetails();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the create close form.
|
||||
*/
|
||||
createAdjustLoanChargeForm() {
|
||||
this.adjustLoanChargeForm = this.formBuilder.group({
|
||||
'amount': [this.chargeData.amount, Validators.required],
|
||||
'externalId': '',
|
||||
'paymentTypeId': '',
|
||||
'note': ''
|
||||
});
|
||||
}
|
||||
|
||||
setRepaymentLoanDetails() {
|
||||
this.organizationService.getPaymentTypes().subscribe((paymentTypes: any) => {
|
||||
this.paymentTypes = paymentTypes;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add payment detail fields to the UI.
|
||||
*/
|
||||
addPaymentDetails() {
|
||||
this.showPaymentDetails = !this.showPaymentDetails;
|
||||
if (this.showPaymentDetails) {
|
||||
this.adjustLoanChargeForm.addControl('accountNumber', new FormControl(''));
|
||||
this.adjustLoanChargeForm.addControl('checkNumber', new FormControl(''));
|
||||
this.adjustLoanChargeForm.addControl('routingCode', new FormControl(''));
|
||||
this.adjustLoanChargeForm.addControl('receiptNumber', new FormControl(''));
|
||||
this.adjustLoanChargeForm.addControl('bankNumber', new FormControl(''));
|
||||
} else {
|
||||
this.adjustLoanChargeForm.removeControl('accountNumber');
|
||||
this.adjustLoanChargeForm.removeControl('checkNumber');
|
||||
this.adjustLoanChargeForm.removeControl('routingCode');
|
||||
this.adjustLoanChargeForm.removeControl('receiptNumber');
|
||||
this.adjustLoanChargeForm.removeControl('bankNumber');
|
||||
}
|
||||
}
|
||||
|
||||
/** Submits the repayment form */
|
||||
submit() {
|
||||
const adjustLoanChargeFormData = this.adjustLoanChargeForm.value;
|
||||
const locale = this.settingsService.language.code;
|
||||
const data = {
|
||||
...adjustLoanChargeFormData,
|
||||
locale
|
||||
};
|
||||
const command = 'adjustment';
|
||||
this.loanService.executeLoansAccountChargesCommand(this.loanId, command, data, this.chargeId)
|
||||
.subscribe((response: any) => {
|
||||
this.router.navigate(['../..'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -47,7 +47,7 @@ export class ApproveLoanComponent implements OnInit {
|
||||
this.route.data.subscribe((data: { actionButtonData: any }) => {
|
||||
this.loanData = data.actionButtonData;
|
||||
});
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ export class AssignLoanOfficerComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ export class CloseAsRescheduledComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
|
||||
private dateUtils: Dates,
|
||||
private clientsService: ClientsService,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ export class DisburseToSavingsAccountComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanId = this.route.snapshot.params['loanId'];
|
||||
this.loanService.loanActionButtons(loanId, 'disbursetosavings', data).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ export class DisburseComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ export class EditRepaymentScheduleComponent implements OnInit {
|
||||
private dialog: MatDialog,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
this.getRepaymentSchedule();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export class ForeclosureComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ export class LoanRescheduleComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ export class LoanScreenReportsComponent implements OnInit {
|
||||
private route: ActivatedRoute,
|
||||
private sanitizer: DomSanitizer,
|
||||
private renderer: Renderer2) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ export class LoansAccountCloseComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-3
@@ -45,7 +45,7 @@ export class MakeRepaymentComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +63,7 @@ export class MakeRepaymentComponent implements OnInit {
|
||||
*/
|
||||
createRepaymentLoanForm() {
|
||||
this.repaymentLoanForm = this.formBuilder.group({
|
||||
'transactionDate': [new Date(), Validators.required],
|
||||
'transactionDate': [this.settingsService.businessDate, Validators.required],
|
||||
'transactionAmount': ['', Validators.required],
|
||||
'externalId': '',
|
||||
'paymentTypeId': '',
|
||||
@@ -83,7 +83,6 @@ export class MakeRepaymentComponent implements OnInit {
|
||||
*/
|
||||
addPaymentDetails() {
|
||||
this.showPaymentDetails = !this.showPaymentDetails;
|
||||
console.log(this.showPaymentDetails);
|
||||
if (this.showPaymentDetails) {
|
||||
this.repaymentLoanForm.addControl('accountNumber', new FormControl(''));
|
||||
this.repaymentLoanForm.addControl('checkNumber', new FormControl(''));
|
||||
|
||||
@@ -52,7 +52,7 @@ export class PrepayLoanComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ export class RecoveryRepaymentComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ export class RejectLoanComponent implements OnInit {
|
||||
private loanService: LoansService,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService ) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ export class UndoApprovalComponent implements OnInit {
|
||||
* Submits undo approval form.
|
||||
*/
|
||||
submit() {
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanId = this.route.snapshot.params['loanId'];
|
||||
this.loanService.loanActionButtons(loanId, 'undoapproval', { 'note': this.note.value }).subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], {relativeTo: this.route});
|
||||
});
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ export class UndoDisbursalComponent implements OnInit {
|
||||
private loansService: LoansService,
|
||||
private router: Router,
|
||||
private route: ActivatedRoute) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ export class ViewGuarantorsComponent implements OnInit {
|
||||
public loansService: LoansService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ export class WaiveInterestComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanId = this.route.snapshot.params['loanId'];
|
||||
this.loanService.submitLoanActionButton(loanId, data, 'waiveinterest').subscribe((response: any) => {
|
||||
this.router.navigate(['../../general'], {relativeTo: this.route});
|
||||
});
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ export class WithdrawnByClientComponent implements OnInit {
|
||||
private router: Router,
|
||||
private dateUtils: Dates,
|
||||
private settingsService: SettingsService) {
|
||||
this.loanId = this.route.parent.snapshot.params['loanId'];
|
||||
this.loanId = this.route.snapshot.params['loanId'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ export class WriteOffPageComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const loanId = this.route.parent.snapshot.params['loanId'];
|
||||
const loanId = this.route.snapshot.params['loanId'];
|
||||
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