build: Use prettier for typescript

Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
Ralph Hopman
2025-01-15 11:59:30 +00:00
committed by Adam Saghy
parent 9d6cf1514a
commit cac1d11ad7
1812 changed files with 22516 additions and 16862 deletions
@@ -8,9 +8,8 @@ describe('AddCollateralComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddCollateralComponent ]
})
.compileComponents();
declarations: [AddCollateralComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { LoansService } from 'app/loans/loans.service';
styleUrls: ['./add-collateral.component.scss']
})
export class AddCollateralComponent implements OnInit {
@Input() dataObject: any;
/** Collateral form. */
@@ -30,10 +29,12 @@ export class AddCollateralComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {LoansService} LoansService loans service.
*/
constructor(private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService ) { }
constructor(
private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService
) {}
ngOnInit() {
this.createAddCollateralForm();
@@ -44,9 +45,15 @@ export class AddCollateralComponent implements OnInit {
*/
createAddCollateralForm() {
this.collateralForm = this.formBuilder.group({
'collateralTypeId': ['', Validators.required],
'value': ['', Validators.required],
'description': ['']
collateralTypeId: [
'',
Validators.required
],
value: [
'',
Validators.required
],
description: ['']
});
}
@@ -56,7 +63,7 @@ export class AddCollateralComponent implements OnInit {
submit() {
const collateralTypeId = this.collateralForm.value.collateralTypeId;
this.collateralForm.patchValue({
'collateralTypeId': collateralTypeId
collateralTypeId: collateralTypeId
});
const loanId = this.route.snapshot.params['loanId'];
const collateralForm = this.collateralForm.value;
@@ -65,5 +72,4 @@ export class AddCollateralComponent implements OnInit {
this.router.navigate(['../../loan-collateral'], { relativeTo: this.route });
});
}
}
@@ -1,47 +1,60 @@
<div class="container mat-elevation-z8">
<mat-card>
<div class="m-b-20" fxLayout="column" *ngIf="maturityDate">
<span class="m-r-10">{{'Maturity Date' | translateKey:'inputs'}} : {{ maturityDate | dateFormat}}</span>
<mat-card>
<div class="m-b-20" fxLayout="column" *ngIf="maturityDate">
<span class="m-r-10">{{ 'Maturity Date' | translateKey: 'inputs' }} : {{ maturityDate | dateFormat }}</span>
</div>
<form [formGroup]="interestPauseLoanForm" (ngSubmit)="submit()">
<mat-card-content>
<div fxLayout="column">
<mat-form-field (click)="startDatePicker.open()">
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
<input
matInput
[min]="minDate"
[max]="maxDate"
[matDatepicker]="startDatePicker"
required
formControlName="startDate"
/>
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
<mat-datepicker #startDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.startDate.hasError('required')">
{{ 'labels.inputs.Start Date' | translate }}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field (click)="endDatePicker.open()">
<mat-label>{{ 'labels.inputs.End Date' | translate }}</mat-label>
<input
matInput
[min]="interestPauseLoanForm.value.startDate"
[max]="maxDate"
[matDatepicker]="endDatePicker"
required
formControlName="endDate"
/>
<mat-datepicker-toggle matSuffix [for]="endDatePicker"></mat-datepicker-toggle>
<mat-datepicker #endDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.endDate.hasError('required')">
{{ 'labels.inputs.End Date' | translate }}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
</div>
<form [formGroup]="interestPauseLoanForm" (ngSubmit)="submit()">
<mat-card-content>
<div fxLayout="column">
<mat-form-field (click)="startDatePicker.open()">
<mat-label>{{ 'labels.inputs.Start Date' | translate }}</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="startDatePicker"
required formControlName="startDate" />
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
<mat-datepicker #startDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.startDate.hasError('required')">
{{ 'labels.inputs.Start Date' | translate
}}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
<mat-form-field (click)="endDatePicker.open()">
<mat-label>{{ 'labels.inputs.End Date' | translate }}</mat-label>
<input matInput [min]="interestPauseLoanForm.value.startDate" [max]="maxDate" [matDatepicker]="endDatePicker"
required formControlName="endDate" />
<mat-datepicker-toggle matSuffix [for]="endDatePicker"></mat-datepicker-toggle>
<mat-datepicker #endDatePicker></mat-datepicker>
<mat-error *ngIf="interestPauseLoanForm.controls.endDate.hasError('required')">
{{ 'labels.inputs.End Date' | translate
}}<strong>{{ 'labels.commons.required' | translate }}</strong>
</mat-error>
</mat-form-field>
</div>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button mat-raised-button color="primary" [disabled]="!interestPauseLoanForm.valid"
*mifosxHasPermission="'DISBURSE_LOAN'">
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">
{{ 'labels.buttons.Cancel' | translate }}
</button>
<button
mat-raised-button
color="primary"
[disabled]="!interestPauseLoanForm.valid"
*mifosxHasPermission="'DISBURSE_LOAN'"
>
{{ 'labels.buttons.Submit' | translate }}
</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>
@@ -1,8 +1,7 @@
.expandcollapsebutton {
margin-top: -7px;
}
.container {
max-width: 37rem;
}
margin-top: -7px;
}
.container {
max-width: 37rem;
}
@@ -8,9 +8,8 @@ describe('AddInterestPauseComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AddInterestPauseComponent ]
})
.compileComponents();
declarations: [AddInterestPauseComponent]
}).compileComponents();
fixture = TestBed.createComponent(AddInterestPauseComponent);
component = fixture.componentInstance;
@@ -11,7 +11,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./add-interest-pause.component.scss']
})
export class AddInterestPauseComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -35,13 +34,14 @@ export class AddInterestPauseComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -64,8 +64,14 @@ export class AddInterestPauseComponent implements OnInit {
*/
createInterestPauseLoanForm() {
this.interestPauseLoanForm = this.formBuilder.group({
'startDate': [this.startDate, Validators.required],
'endDate': [this.startDate, Validators.required]
startDate: [
this.startDate,
Validators.required
],
endDate: [
this.startDate,
Validators.required
]
});
}
@@ -87,10 +93,8 @@ export class AddInterestPauseComponent implements OnInit {
dateFormat,
locale
};
this.loanService.addInterestPauseToLoan(this.loanId, data )
.subscribe((response: any) => {
this.router.navigate(['../../term-variations'], { relativeTo: this.route });
});
this.loanService.addInterestPauseToLoan(this.loanId, data).subscribe((response: any) => {
this.router.navigate(['../../term-variations'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AddloanchargeComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AddLoanChargeComponent ]
})
.compileComponents();
declarations: [AddLoanChargeComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./add-loan-charge.component.scss']
})
export class AddLoanChargeComponent implements OnInit {
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -51,12 +50,14 @@ export class AddLoanChargeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService) {
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loansService: LoansService,
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { actionButtonData: any }) => {
this.loanChargeOptions = data.actionButtonData.chargeOptions;
});
@@ -69,8 +70,8 @@ export class AddLoanChargeComponent implements OnInit {
ngOnInit() {
this.maxDate = this.settingsService.maxFutureDate;
this.createLoanChargeForm();
this.loanChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
const chargeDetails = this.loanChargeOptions.find(option => {
this.loanChargeForm.controls.chargeId.valueChanges.subscribe((chargeId) => {
const chargeDetails = this.loanChargeOptions.find((option) => {
return option.id === chargeId;
});
if (chargeDetails.chargeTimeType.id === 2) {
@@ -79,9 +80,9 @@ export class AddLoanChargeComponent implements OnInit {
this.loanChargeForm.removeControl('dueDate');
}
this.loanChargeForm.patchValue({
'amount': chargeDetails.amount,
'chargeCalculation': chargeDetails.chargeCalculationType.value,
'chargeTime': chargeDetails.chargeTimeType.value
amount: chargeDetails.amount,
chargeCalculation: chargeDetails.chargeCalculationType.value,
chargeTime: chargeDetails.chargeTimeType.value
});
});
}
@@ -91,10 +92,16 @@ export class AddLoanChargeComponent implements OnInit {
*/
createLoanChargeForm() {
this.loanChargeForm = this.formBuilder.group({
'chargeId': ['', Validators.required],
'amount': ['', Validators.required],
'chargeCalculation': [{ value: '', disabled: true }],
'chargeTime': [{ value: '', disabled: true }]
chargeId: [
'',
Validators.required
],
amount: [
'',
Validators.required
],
chargeCalculation: [{ value: '', disabled: true }],
chargeTime: [{ value: '', disabled: true }]
});
}
@@ -111,7 +118,7 @@ export class AddLoanChargeComponent implements OnInit {
dateFormat,
locale
};
this.loansService.createLoanCharge(this.loanId, 'charges', data).subscribe(res => {
this.loansService.createLoanCharge(this.loanId, 'charges', data).subscribe((res) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
@@ -8,9 +8,8 @@ describe('AdjustLoanChargeComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AdjustLoanChargeComponent ]
})
.compileComponents();
declarations: [AdjustLoanChargeComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -36,19 +36,21 @@ export class AdjustLoanChargeComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
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;
});
}
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
@@ -65,10 +67,13 @@ export class AdjustLoanChargeComponent implements OnInit {
*/
createAdjustLoanChargeForm() {
this.adjustLoanChargeForm = this.formBuilder.group({
'amount': [this.chargeData.amount, Validators.required],
'externalId': '',
'paymentTypeId': '',
'note': ''
amount: [
this.chargeData.amount,
Validators.required
],
externalId: '',
paymentTypeId: '',
note: ''
});
}
@@ -107,10 +112,10 @@ export class AdjustLoanChargeComponent implements OnInit {
locale
};
const command = 'adjustment';
this.loanService.executeLoansAccountChargesCommand(this.loanId, command, data, this.chargeId)
this.loanService
.executeLoansAccountChargesCommand(this.loanId, command, data, this.chargeId)
.subscribe((response: any) => {
this.router.navigate(['../..'], { relativeTo: this.route });
});
});
}
}
@@ -8,9 +8,8 @@ describe('ApproveLoanComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ApproveLoanComponent ]
})
.compileComponents();
declarations: [ApproveLoanComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./approve-loan.component.scss']
})
export class ApproveLoanComponent implements OnInit {
/** Approve Loan form. */
approveLoanForm: UntypedFormGroup;
/** Loan data. */
@@ -40,12 +39,14 @@ export class ApproveLoanComponent implements OnInit {
* @param router Router.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private dateUtils: Dates,
private loanService: LoansService,
private router: Router,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.route.data.subscribe((data: { actionButtonData: any }) => {
this.loanData = data.actionButtonData;
this.currency = data.actionButtonData.currency;
@@ -58,7 +59,7 @@ export class ApproveLoanComponent implements OnInit {
this.loanService.getApproveAssociationsDetails(this.loanId).subscribe((response: any) => {
this.associationData = response;
this.approveLoanForm.patchValue({
'expectedDisbursementDate': new Date(response.timeline.expectedDisbursementDate)
expectedDisbursementDate: new Date(response.timeline.expectedDisbursementDate)
});
});
}
@@ -68,10 +69,16 @@ export class ApproveLoanComponent implements OnInit {
*/
setApproveLoanForm() {
this.approveLoanForm = this.formBuilder.group({
'approvedOnDate': [this.settingsService.businessDate, Validators.required],
'expectedDisbursementDate': [''],
'approvedLoanAmount': [this.loanData.approvalAmount, Validators.required],
'note': ['']
approvedOnDate: [
this.settingsService.businessDate,
Validators.required
],
expectedDisbursementDate: [''],
approvedLoanAmount: [
this.loanData.approvalAmount,
Validators.required
],
note: ['']
});
}
@@ -99,5 +106,4 @@ export class ApproveLoanComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('AssetTransferLoanComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AssetTransferLoanComponent ]
})
.compileComponents();
declarations: [AssetTransferLoanComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -11,7 +11,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./asset-transfer-loan.component.scss']
})
export class AssetTransferLoanComponent implements OnInit {
BUYBACK_COMMAND = 'buyback';
SALE_COMMAND = 'sale';
@@ -25,16 +24,18 @@ export class AssetTransferLoanComponent implements OnInit {
/** Sell Loan Form */
saleLoanForm: UntypedFormGroup;
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private externalAssetOwnerService: ExternalAssetOwnerService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
const actionName = this.route.snapshot.params['action'];
this.command = (actionName === 'Sell Loan') ? this.SALE_COMMAND : this.BUYBACK_COMMAND;
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
const actionName = this.route.snapshot.params['action'];
this.command = actionName === 'Sell Loan' ? this.SALE_COMMAND : this.BUYBACK_COMMAND;
}
/**
* Creates the Sell Loan form
@@ -47,7 +48,7 @@ export class AssetTransferLoanComponent implements OnInit {
}
isBuyBack(): boolean {
return (this.command === this.BUYBACK_COMMAND);
return this.command === this.BUYBACK_COMMAND;
}
/**
@@ -55,10 +56,19 @@ export class AssetTransferLoanComponent implements OnInit {
*/
createSaleLoanForm() {
this.saleLoanForm = this.formBuilder.group({
'settlementDate': [this.settingsService.businessDate, Validators.required],
'purchasePriceRatio': ['', Validators.required],
'transferExternalId': '',
'ownerExternalId': ['', Validators.required]
settlementDate: [
this.settingsService.businessDate,
Validators.required
],
purchasePriceRatio: [
'',
Validators.required
],
transferExternalId: '',
ownerExternalId: [
'',
Validators.required
]
});
if (this.isBuyBack()) {
@@ -80,11 +90,10 @@ export class AssetTransferLoanComponent implements OnInit {
dateFormat,
locale
};
this.externalAssetOwnerService.executeExternalAssetOwnerLoanCommand(this.loanId, data, this.command)
this.externalAssetOwnerService
.executeExternalAssetOwnerLoanCommand(this.loanId, data, this.command)
.subscribe((response: any) => {
this.router.navigate(['../../external-asset-owner'], { relativeTo: this.route });
});
});
}
}
@@ -8,9 +8,8 @@ describe('AssignLoanOfficerComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AssignLoanOfficerComponent ]
})
.compileComponents();
declarations: [AssignLoanOfficerComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./assign-loan-officer.component.scss']
})
export class AssignLoanOfficerComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -32,14 +31,16 @@ export class AssignLoanOfficerComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the assign officer form.
@@ -55,8 +56,14 @@ export class AssignLoanOfficerComponent implements OnInit {
*/
createassignOfficerForm() {
this.assignOfficerForm = this.formBuilder.group({
'toLoanOfficerId': ['', Validators.required],
'assignmentDate': [new Date(), Validators.required]
toLoanOfficerId: [
'',
Validators.required
],
assignmentDate: [
new Date(),
Validators.required
]
});
}
@@ -74,10 +81,8 @@ export class AssignLoanOfficerComponent implements OnInit {
locale
};
data.fromLoanOfficerId = this.dataObject.loanOfficerId || '';
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', data)
.subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
this.loanService.loanActionButtons(this.loanId, 'assignLoanOfficer', data).subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ChargeOffComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ChargeOffComponent ]
})
.compileComponents();
declarations: [ChargeOffComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -35,14 +35,16 @@ export class ChargeOffComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the repayment loan form
@@ -59,10 +61,13 @@ export class ChargeOffComponent implements OnInit {
*/
createChargeoffLoanForm() {
this.chargeoffLoanForm = this.formBuilder.group({
'transactionDate': [this.settingsService.businessDate, Validators.required],
'externalId': '',
'chargeOffReasonId': '',
'note': ''
transactionDate: [
this.settingsService.businessDate,
Validators.required
],
externalId: '',
chargeOffReasonId: '',
note: ''
});
}
@@ -80,10 +85,8 @@ export class ChargeOffComponent implements OnInit {
locale
};
const command = 'charge-off';
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CloseAsRescheduledComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CloseAsRescheduledComponent ]
})
.compileComponents();
declarations: [CloseAsRescheduledComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./close-as-rescheduled.component.scss']
})
export class CloseAsRescheduledComponent implements OnInit {
@Input() dataObject: any;
/** Close form. */
@@ -32,14 +31,16 @@ export class CloseAsRescheduledComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the close form.
@@ -54,8 +55,11 @@ export class CloseAsRescheduledComponent implements OnInit {
*/
createCloseForm() {
this.closeLoanForm = this.formBuilder.group({
'transactionDate': [new Date(this.dataObject.date) || new Date(), Validators.required],
'note': []
transactionDate: [
new Date(this.dataObject.date) || new Date(),
Validators.required
],
note: []
});
}
@@ -76,9 +80,8 @@ export class CloseAsRescheduledComponent implements OnInit {
dateFormat,
locale
};
this.loanService.submitLoanActionButton(this.loanId, data, 'close-rescheduled')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'close-rescheduled').subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('CreateGuarantorComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ CreateGuarantorComponent ]
})
.compileComponents();
declarations: [CreateGuarantorComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./create-guarantor.component.scss']
})
export class CreateGuarantorComponent implements OnInit, AfterViewInit {
@Input() dataObject: any;
/** New Guarantor Form */
newGuarantorForm: UntypedFormGroup;
@@ -44,13 +43,15 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private clientsService: ClientsService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -64,11 +65,14 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
/** Create Guarantor Details Form */
createNewGuarantorForm() {
this.newGuarantorForm = this.formBuilder.group({
'existingClient': [''],
'name': ['', Validators.required],
'clientRelationshipTypeId': [''],
'savingsId': [''],
'amount': ['']
existingClient: [''],
name: [
'',
Validators.required
],
clientRelationshipTypeId: [''],
savingsId: [''],
amount: ['']
});
}
@@ -123,10 +127,9 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
if (this.newGuarantorForm.value.existingClient) {
this.newGuarantorForm.get('name').valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.clientsService.getFilteredClients('displayName', 'ASC', true, value)
.subscribe((data: any) => {
this.clientsData = data.pageItems;
});
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
this.clientsData = data.pageItems;
});
}
});
}
@@ -155,7 +158,9 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
const dateFormat = this.settingsService.dateFormat;
const prevdob: Date = this.newGuarantorForm.value.dob;
const guarantorTypeId: number = this.newGuarantorForm.value.existingClient ? this.dataObject.guarantorTypeOptions[0].id : this.dataObject.guarantorTypeOptions[2].id;
const guarantorTypeId: number = this.newGuarantorForm.value.existingClient
? this.dataObject.guarantorTypeOptions[0].id
: this.dataObject.guarantorTypeOptions[2].id;
const data = {
...newGuarantorFormData,
locale,
@@ -174,10 +179,8 @@ export class CreateGuarantorComponent implements OnInit, AfterViewInit {
delete data.existingClient;
delete data.name;
this.loanService.createNewGuarantor(this.loanId, data)
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.createNewGuarantor(this.loanId, data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DisburseToSavingsAccountComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DisburseToSavingsAccountComponent ]
})
.compileComponents();
declarations: [DisburseToSavingsAccountComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -12,7 +12,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./disburse-to-savings-account.component.scss']
})
export class DisburseToSavingsAccountComponent implements OnInit {
@Input() dataObject: any;
/** Minimum Date allowed. */
@@ -31,13 +30,14 @@ export class DisburseToSavingsAccountComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loanService: LoansService,
private settingsService: SettingsService) {
}
private settingsService: SettingsService
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -52,12 +52,21 @@ export class DisburseToSavingsAccountComponent implements OnInit {
*/
setDisbursementToSavingsForm() {
this.disbursementForm = this.formBuilder.group({
'actualDisbursementDate': [new Date(), Validators.required],
'transactionAmount': [this.dataObject.amount, Validators.required],
'note': ['']
actualDisbursementDate: [
new Date(),
Validators.required
],
transactionAmount: [
this.dataObject.amount,
Validators.required
],
note: ['']
});
if (this.dataObject.fixedEmiAmount) {
this.disbursementForm.addControl('fixedEmiAmount', new UntypedFormControl(this.dataObject.fixedEmiAmount, [Validators.required]));
this.disbursementForm.addControl(
'fixedEmiAmount',
new UntypedFormControl(this.dataObject.fixedEmiAmount, [Validators.required])
);
}
}
@@ -70,7 +79,10 @@ export class DisburseToSavingsAccountComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActualDisbursementDate: Date = this.disbursementForm.value.actualDisbursementDate;
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(
prevActualDisbursementDate,
dateFormat
);
}
const data = {
...disbursementLoanFormData,
@@ -83,5 +95,4 @@ export class DisburseToSavingsAccountComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('DisburseComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DisburseComponent ]
})
.compileComponents();
declarations: [DisburseComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./disburse.component.scss']
})
export class DisburseComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -41,16 +40,17 @@ export class DisburseComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the disbursement loan form
* and initialize with the required values
@@ -69,18 +69,24 @@ export class DisburseComponent implements OnInit {
*/
createDisbursementLoanForm() {
this.disbursementLoanForm = this.formBuilder.group({
'actualDisbursementDate': [this.settingsService.businessDate, Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': '',
'paymentTypeId': '',
'note': ''
actualDisbursementDate: [
this.settingsService.businessDate,
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: '',
paymentTypeId: '',
note: ''
});
}
setDisbursementLoanDetails() {
this.paymentTypes = this.dataObject.paymentTypeOptions;
this.disbursementLoanForm.patchValue({
transactionAmount: this.dataObject.amount,
transactionAmount: this.dataObject.amount
// actualDisbursementDate: new Date(this.dataObject.date)
});
}
@@ -112,7 +118,10 @@ export class DisburseComponent implements OnInit {
const dateFormat = this.settingsService.dateFormat;
const prevActualDisbursementDate: Date = this.disbursementLoanForm.value.actualDisbursementDate;
if (disbursementLoanFormData.actualDisbursementDate instanceof Date) {
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(prevActualDisbursementDate, dateFormat);
disbursementLoanFormData.actualDisbursementDate = this.dateUtils.formatDate(
prevActualDisbursementDate,
dateFormat
);
}
const data = {
...disbursementLoanFormData,
@@ -120,10 +129,8 @@ export class DisburseComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.loanActionButtons(this.loanId, 'disburse', data )
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.loanActionButtons(this.loanId, 'disburse', data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('EditRepaymentScheduleComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ EditRepaymentScheduleComponent ]
})
.compileComponents();
declarations: [EditRepaymentScheduleComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
styleUrls: ['./edit-repayment-schedule.component.scss']
})
export class EditRepaymentScheduleComponent implements OnInit {
/** Loan ID. */
loanId: string;
/** Indicates If the Schedule has been changed */
@@ -37,13 +36,15 @@ export class EditRepaymentScheduleComponent implements OnInit {
* @param {Dates} dateUtils Dates Utils.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private loansService: LoansService,
constructor(
private loansService: LoansService,
private router: Router,
private route: ActivatedRoute,
private dialog: MatDialog,
private dateUtils: Dates,
private translateService: TranslateService,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
this.getRepaymentSchedule();
}
@@ -62,7 +63,10 @@ export class EditRepaymentScheduleComponent implements OnInit {
const periods: any = [];
this.repaymentScheduleDetails['periods'].forEach((period: any) => {
if (period.period) {
periods.push({ idx: period.period, dueDate: this.dateUtils.formatDate(period.dueDate, this.settingsService.dateFormat) });
periods.push({
idx: period.period,
dueDate: this.dateUtils.formatDate(period.dueDate, this.settingsService.dateFormat)
});
}
});
const formfields: FormfieldBase[] = [
@@ -86,7 +90,8 @@ export class EditRepaymentScheduleComponent implements OnInit {
value: '',
type: 'number',
required: true
}),
})
];
const data = {
title: 'Pattern Update',
@@ -118,34 +123,45 @@ export class EditRepaymentScheduleComponent implements OnInit {
reset(): void {
const recoverScheduleDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { heading: this.translateService.instant('labels.heading.Recover Original Schedule'), dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want recover the Original Schedule') }
data: {
heading: this.translateService.instant('labels.heading.Recover Original Schedule'),
dialogContext: this.translateService.instant(
'labels.dialogContext.Are you sure you want recover the Original Schedule'
)
}
});
recoverScheduleDialogRef.afterClosed().subscribe((responseConfirmation: any) => {
if (responseConfirmation.confirm) {
this.loansService.applyCommandLoanScheduleVariations(this.loanId, 'deleteVariations', {}).subscribe((response: any) => {
this.getRepaymentSchedule();
this.wasChanged = false;
this.wasValidated = false;
});
this.loansService
.applyCommandLoanScheduleVariations(this.loanId, 'deleteVariations', {})
.subscribe((response: any) => {
this.getRepaymentSchedule();
this.wasChanged = false;
this.wasValidated = false;
});
}
});
}
validate(): void {
this.loansService.applyCommandLoanScheduleVariations(this.loanId, 'calculateLoanSchedule', this.getPayload()).subscribe((response: any) => {
this.repaymentScheduleDetails['periods'] = [];
response['periods'].forEach((period: any) => {
period['changed'] = true;
this.repaymentScheduleDetails['periods'].push(period);
this.wasValidated = true;
this.loansService
.applyCommandLoanScheduleVariations(this.loanId, 'calculateLoanSchedule', this.getPayload())
.subscribe((response: any) => {
this.repaymentScheduleDetails['periods'] = [];
response['periods'].forEach((period: any) => {
period['changed'] = true;
this.repaymentScheduleDetails['periods'].push(period);
this.wasValidated = true;
});
});
});
}
submit(): void {
this.loansService.applyCommandLoanScheduleVariations(this.loanId, 'addVariations', this.getPayload()).subscribe((response: any) => {
this.router.navigate(['../../repayment-schedule'], { relativeTo: this.route });
});
this.loansService
.applyCommandLoanScheduleVariations(this.loanId, 'addVariations', this.getPayload())
.subscribe((response: any) => {
this.router.navigate(['../../repayment-schedule'], { relativeTo: this.route });
});
}
private getPayload(): any {
@@ -163,5 +179,4 @@ export class EditRepaymentScheduleComponent implements OnInit {
locale
};
}
}
@@ -8,9 +8,8 @@ describe('ForeclosureComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ForeclosureComponent ]
})
.compileComponents();
declarations: [ForeclosureComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -30,14 +30,16 @@ export class ForeclosureComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -47,21 +49,26 @@ export class ForeclosureComponent implements OnInit {
createforeclosureForm() {
this.foreclosureForm = this.formBuilder.group({
'transactionDate': [this.dataObject.date && new Date(this.dataObject.date), Validators.required],
'outstandingPrincipalPortion': [{value: this.dataObject.principalPortion || 0, disabled: true}],
'outstandingInterestPortion': [{value: this.dataObject.interestPortion || 0, disabled: true}],
'outstandingFeeChargesPortion': [{value: this.dataObject.feeChargesPortion || 0, disabled: true}],
'outstandingPenaltyChargesPortion': [{value: this.dataObject.penaltyChargesPortion || 0, disabled: true}],
'transactionAmount': [{value: this.dataObject.amount, disabled: true}],
'note': ['', Validators.required]
transactionDate: [
this.dataObject.date && new Date(this.dataObject.date),
Validators.required
],
outstandingPrincipalPortion: [{ value: this.dataObject.principalPortion || 0, disabled: true }],
outstandingInterestPortion: [{ value: this.dataObject.interestPortion || 0, disabled: true }],
outstandingFeeChargesPortion: [{ value: this.dataObject.feeChargesPortion || 0, disabled: true }],
outstandingPenaltyChargesPortion: [{ value: this.dataObject.penaltyChargesPortion || 0, disabled: true }],
transactionAmount: [{ value: this.dataObject.amount, disabled: true }],
note: [
'',
Validators.required
]
});
}
onChanges(): void {
this.foreclosureForm.get('transactionDate').valueChanges.subscribe(val => {
this.foreclosureForm.get('transactionDate').valueChanges.subscribe((val) => {
this.retrieveLoanForeclosureTemplate(val);
});
}
retrieveLoanForeclosureTemplate(val: any) {
@@ -73,15 +80,14 @@ export class ForeclosureComponent implements OnInit {
locale: this.settingsService.language.code,
transactionDate: transactionDateFormatted
};
this.loanService.getForeclosureData(this.loanId, data)
.subscribe((response: any) => {
this.loanService.getForeclosureData(this.loanId, data).subscribe((response: any) => {
this.foreclosuredata = response;
this.foreclosureForm.patchValue({
outstandingPrincipalPortion: this.foreclosuredata.principalPortion,
outstandingInterestPortion: this.foreclosuredata.interestPortion,
outstandingFeeChargesPortion: this.foreclosuredata.feeChargesPortion,
outstandingPenaltyChargesPortion: this.foreclosuredata.penaltyChargesPortion,
outstandingPenaltyChargesPortion: this.foreclosuredata.penaltyChargesPortion
});
});
}
@@ -100,10 +106,8 @@ export class ForeclosureComponent implements OnInit {
locale
};
this.loanService.loanForclosureData(this.loanId, data)
.subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
});
}
this.loanService.loanForclosureData(this.loanId, data).subscribe((response: any) => {
this.router.navigate([`../../general`], { relativeTo: this.route });
});
}
}
@@ -57,4 +57,7 @@
<mifosx-asset-transfer-loan *ngIf="actions['Sell Loan'] || actions['Buy Back Loan']"></mifosx-asset-transfer-loan>
<mifosx-loan-reaging [dataObject]="actionButtonData" *ngIf="actions['Re-Age']"></mifosx-loan-reaging>
<mifosx-loan-reamortize [dataObject]="actionButtonData" *ngIf="actions['Re-Amortize']"></mifosx-loan-reamortize>
<mifosx-add-interest-pause [dataObject]="navigationData" *ngIf="actions['Add Interest Pause']"></mifosx-add-interest-pause>
<mifosx-add-interest-pause
[dataObject]="navigationData"
*ngIf="actions['Add Interest Pause']"
></mifosx-add-interest-pause>
@@ -8,9 +8,8 @@ describe('LoanAccountActionsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoanAccountActionsComponent ]
})
.compileComponents();
declarations: [LoanAccountActionsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -11,84 +11,83 @@ import { ActivatedRoute, Router } from '@angular/router';
styleUrls: ['./loan-account-actions.component.scss']
})
export class LoanAccountActionsComponent {
/** Loan Details Data */
navigationData: any;
/** flag object to store possible actions and render appropriate UI to the user */
actions: {
'Close': boolean,
'Undo Approval': boolean,
'Write Off': boolean,
'Add Collateral': boolean,
'Assign Loan Officer': boolean,
'Foreclosure': boolean,
'Prepay Loan': boolean,
'Reject': boolean,
'Disburse to Savings': boolean,
'Make Repayment': boolean,
'Waive Interest': boolean,
'Close (as Rescheduled)': boolean,
'Reschedule': boolean,
'Recovery Payment': boolean,
'View Guarantors': boolean,
'Create Guarantor': boolean,
'Disburse': boolean,
'Withdrawn by Client': boolean,
'Undo Disbursal': boolean,
'Undo Last Disbursal': boolean,
'Loan Screen Reports': boolean,
'Approve': boolean,
'Add Loan Charge': boolean,
'Goodwill Credit': boolean,
'Merchant Issued Refund': boolean,
'Payout Refund': boolean,
'Credit Balance Refund': boolean,
'Edit Repayment Schedule': boolean,
'Charge-Off': boolean,
'Sell Loan': boolean,
'Buy Back Loan': boolean,
'Re-Age': boolean,
'Re-Amortize': boolean,
'Interest Payment Waiver': boolean,
'Add Interest Pause': boolean
Close: boolean;
'Undo Approval': boolean;
'Write Off': boolean;
'Add Collateral': boolean;
'Assign Loan Officer': boolean;
Foreclosure: boolean;
'Prepay Loan': boolean;
Reject: boolean;
'Disburse to Savings': boolean;
'Make Repayment': boolean;
'Waive Interest': boolean;
'Close (as Rescheduled)': boolean;
Reschedule: boolean;
'Recovery Payment': boolean;
'View Guarantors': boolean;
'Create Guarantor': boolean;
Disburse: boolean;
'Withdrawn by Client': boolean;
'Undo Disbursal': boolean;
'Undo Last Disbursal': boolean;
'Loan Screen Reports': boolean;
Approve: boolean;
'Add Loan Charge': boolean;
'Goodwill Credit': boolean;
'Merchant Issued Refund': boolean;
'Payout Refund': boolean;
'Credit Balance Refund': boolean;
'Edit Repayment Schedule': boolean;
'Charge-Off': boolean;
'Sell Loan': boolean;
'Buy Back Loan': boolean;
'Re-Age': boolean;
'Re-Amortize': boolean;
'Interest Payment Waiver': boolean;
'Add Interest Pause': boolean;
} = {
'Close': false,
'Undo Approval': false,
'Write Off': false,
'Add Collateral': false,
'Assign Loan Officer': false,
'Foreclosure': false,
'Prepay Loan': false,
'Reject': false,
'Disburse to Savings': false,
'Make Repayment': false,
'Waive Interest': false,
'Close (as Rescheduled)': false,
'Reschedule': false,
'Recovery Payment': false,
'View Guarantors': false,
'Create Guarantor': false,
'Disburse': false,
'Withdrawn by Client': false,
'Undo Disbursal': false,
'Undo Last Disbursal': false,
'Loan Screen Reports': false,
'Approve': false,
'Add Loan Charge': false,
'Goodwill Credit': false,
'Merchant Issued Refund': false,
'Payout Refund': false,
'Credit Balance Refund': false,
'Edit Repayment Schedule': false,
'Charge-Off': false,
'Sell Loan': false,
'Buy Back Loan': false,
'Re-Age': false,
'Re-Amortize': false,
'Interest Payment Waiver': false,
'Add Interest Pause': false
};
Close: false,
'Undo Approval': false,
'Write Off': false,
'Add Collateral': false,
'Assign Loan Officer': false,
Foreclosure: false,
'Prepay Loan': false,
Reject: false,
'Disburse to Savings': false,
'Make Repayment': false,
'Waive Interest': false,
'Close (as Rescheduled)': false,
Reschedule: false,
'Recovery Payment': false,
'View Guarantors': false,
'Create Guarantor': false,
Disburse: false,
'Withdrawn by Client': false,
'Undo Disbursal': false,
'Undo Last Disbursal': false,
'Loan Screen Reports': false,
Approve: false,
'Add Loan Charge': false,
'Goodwill Credit': false,
'Merchant Issued Refund': false,
'Payout Refund': false,
'Credit Balance Refund': false,
'Edit Repayment Schedule': false,
'Charge-Off': false,
'Sell Loan': false,
'Buy Back Loan': false,
'Re-Age': false,
'Re-Amortize': false,
'Interest Payment Waiver': false,
'Add Interest Pause': false
};
actionButtonData: any;
actionName: any;
@@ -96,7 +95,8 @@ export class LoanAccountActionsComponent {
/**
* @param route Activated Route.
*/
constructor(private route: ActivatedRoute,
constructor(
private route: ActivatedRoute,
private router: Router
) {
this.navigationData = this.router.getCurrentNavigation().extras.state.data;
@@ -104,7 +104,7 @@ export class LoanAccountActionsComponent {
this.actionButtonData = data.actionButtonData;
});
this.route.params.subscribe(params => {
this.route.params.subscribe((params) => {
this.actionName = params['action'];
if (this.actionName === 'Change Loan Officer') {
this.actionName = 'Assign Loan Officer';
@@ -115,5 +115,4 @@ export class LoanAccountActionsComponent {
this.actions[this.actionName] = true;
});
}
}
@@ -8,9 +8,8 @@ describe('LoanCreditBalanceRefundComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanCreditBalanceRefundComponent ]
})
.compileComponents();
declarations: [LoanCreditBalanceRefundComponent]
}).compileComponents();
});
beforeEach(() => {
@@ -12,7 +12,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./loan-credit-balance-refund.component.scss']
})
export class LoanCreditBalanceRefundComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -31,14 +30,16 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the Credit Balance loan form
@@ -58,10 +59,16 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
*/
createCreditBalanceLoanForm() {
this.creditBalanceLoanForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': '',
'note': ''
transactionDate: [
new Date(),
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: '',
note: ''
});
}
@@ -87,10 +94,8 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
};
const command = this.dataObject.type.code.split('.')[1];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('LoanReagingComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanReagingComponent ]
})
.compileComponents();
declarations: [LoanReagingComponent]
}).compileComponents();
fixture = TestBed.createComponent(LoanReagingComponent);
component = fixture.componentInstance;
@@ -26,13 +26,15 @@ export class LoanReagingComponent implements OnInit {
/** Maximum Date allowed. */
maxDate = new Date();
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private settingsService: SettingsService,
private dropdownOptions: DropdownOptions,
private loanService: LoansService,
private dateUtils: Dates) {
private dateUtils: Dates
) {
this.loanId = this.route.snapshot.params['loanId'];
this.frequencyOptions = this.dropdownOptions.retrievePeriodFrequencyTypeOptions(false);
}
@@ -44,12 +46,24 @@ export class LoanReagingComponent implements OnInit {
createReagingLoanForm() {
this.reagingLoanForm = this.formBuilder.group({
'numberOfInstallments': [1, Validators.required],
'startDate': [this.settingsService.businessDate, Validators.required],
'frequencyNumber': [1, Validators.required],
'frequencyType': [, Validators.required],
'note': '',
'externalId': ''
numberOfInstallments: [
1,
Validators.required
],
startDate: [
this.settingsService.businessDate,
Validators.required
],
frequencyNumber: [
1,
Validators.required
],
frequencyType: [
,
Validators.required
],
note: '',
externalId: ''
});
}
@@ -66,10 +80,8 @@ export class LoanReagingComponent implements OnInit {
dateFormat,
locale
};
this.loanService.submitLoanActionButton(this.loanId, data, 'reAge')
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'reAge').subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('LoanReamortizeComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanReamortizeComponent ]
})
.compileComponents();
declarations: [LoanReamortizeComponent]
}).compileComponents();
fixture = TestBed.createComponent(LoanReamortizeComponent);
component = fixture.componentInstance;
@@ -15,11 +15,13 @@ export class LoanReamortizeComponent implements OnInit {
/** ReAmortize Loan Form */
reamortizeLoanForm: UntypedFormGroup;
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router,
private loanService: LoansService) {
this.loanId = this.route.snapshot.params['loanId'];
private loanService: LoansService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
ngOnInit(): void {
@@ -28,19 +30,15 @@ export class LoanReamortizeComponent implements OnInit {
createReAmortizeLoanForm() {
this.reamortizeLoanForm = this.formBuilder.group({
'note': '',
'externalId': ''
note: '',
externalId: ''
});
}
submit(): void {
const data = this.reamortizeLoanForm.value;
this.loanService.submitLoanActionButton(this.loanId, data, 'reAmortize')
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'reAmortize').subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('LoanRescheduleComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoanRescheduleComponent ]
})
.compileComponents();
declarations: [LoanRescheduleComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -13,7 +13,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./loan-reschedule.component.scss']
})
export class LoanRescheduleComponent implements OnInit {
@Input() dataObject: any;
loanId: any;
rescheduleLoanForm: UntypedFormGroup;
@@ -36,14 +35,16 @@ export class LoanRescheduleComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -53,17 +54,25 @@ export class LoanRescheduleComponent implements OnInit {
setRescheduleLoanForm() {
this.rescheduleLoanForm = this.formBuilder.group({
'rescheduleFromDate': [new Date(), Validators.required],
'rescheduleReasonId': ['', Validators.required],
'submittedOnDate': [new Date(), Validators.required],
'rescheduleReasonComment': [''],
'adjustedDueDate': [''],
'graceOnPrincipal': [''],
'graceOnInterest': [''],
'extraTerms': [''],
'newInterestRate': ['']
rescheduleFromDate: [
new Date(),
Validators.required
],
rescheduleReasonId: [
'',
Validators.required
],
submittedOnDate: [
new Date(),
Validators.required
],
rescheduleReasonComment: [''],
adjustedDueDate: [''],
graceOnPrincipal: [''],
graceOnInterest: [''],
extraTerms: [''],
newInterestRate: ['']
});
}
submit() {
@@ -89,12 +98,10 @@ export class LoanRescheduleComponent implements OnInit {
};
data.loanId = this.loanId;
this.loanService.submitRescheduleData(data).subscribe((response: any) => {
// TODO: needs to be updated
// mentioned in Community App:
// location.path('/loans-accounts/' + scope.loanId + '/viewreschedulerequest/'+ data.resourceId);
this.router.navigate(['../../general'], { relativeTo: this.route });
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('LoanScreenReportsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoanScreenReportsComponent ]
})
.compileComponents();
declarations: [LoanScreenReportsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -16,7 +16,6 @@ import { DomSanitizer } from '@angular/platform-browser';
styleUrls: ['./loan-screen-reports.component.scss']
})
export class LoanScreenReportsComponent implements OnInit {
@Input() dataObject: any;
/** Loan Screen Reportform. */
loanScreenReportForm: UntypedFormGroup;
@@ -38,11 +37,13 @@ export class LoanScreenReportsComponent implements OnInit {
* @param {DomSanitizer} sanitizer DOM Sanitizer
* @param {Renderer2} renderer Renderer 2
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loansService: LoansService,
private route: ActivatedRoute,
private sanitizer: DomSanitizer,
private renderer: Renderer2) {
private renderer: Renderer2
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -59,7 +60,7 @@ export class LoanScreenReportsComponent implements OnInit {
*/
createLoanScreenReportForm() {
this.loanScreenReportForm = this.formBuilder.group({
'templateId': ['']
templateId: ['']
});
}
@@ -86,5 +87,4 @@ export class LoanScreenReportsComponent implements OnInit {
this.renderer.setProperty(this.screenReportRef.nativeElement, 'innerHTML', this.template);
});
}
}
@@ -8,9 +8,8 @@ describe('LoansAccountCloseComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoansAccountCloseComponent ]
})
.compileComponents();
declarations: [LoansAccountCloseComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,7 +14,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./loans-account-close.component.scss']
})
export class LoansAccountCloseComponent implements OnInit {
@Input() dataObject: any;
/** Close form. */
@@ -33,14 +32,16 @@ export class LoansAccountCloseComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the close form.
@@ -55,8 +56,11 @@ export class LoansAccountCloseComponent implements OnInit {
*/
createCloseForm() {
this.closeLoanForm = this.formBuilder.group({
'transactionDate': [new Date(this.dataObject.date) || new Date(), Validators.required],
'note': []
transactionDate: [
new Date(this.dataObject.date) || new Date(),
Validators.required
],
note: []
});
}
@@ -77,10 +81,8 @@ export class LoansAccountCloseComponent implements OnInit {
dateFormat,
locale
};
this.loanService.submitLoanActionButton(this.loanId, data, 'close')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'close').subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('MakeRepaymentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MakeRepaymentComponent ]
})
.compileComponents();
declarations: [MakeRepaymentComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./make-repayment.component.scss']
})
export class MakeRepaymentComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -41,14 +40,16 @@ export class MakeRepaymentComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the repayment loan form
@@ -68,11 +69,17 @@ export class MakeRepaymentComponent implements OnInit {
*/
createRepaymentLoanForm() {
this.repaymentLoanForm = this.formBuilder.group({
'transactionDate': [this.settingsService.businessDate, Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': '',
'paymentTypeId': '',
'note': ''
transactionDate: [
this.settingsService.businessDate,
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: '',
paymentTypeId: '',
note: ''
});
}
@@ -119,10 +126,8 @@ export class MakeRepaymentComponent implements OnInit {
};
const command = this.dataObject.type.code.split('.')[1];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, command).subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('PrepayLoanComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ PrepayLoanComponent ]
})
.compileComponents();
declarations: [PrepayLoanComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -9,7 +9,6 @@ import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Loan Prepay Loan Option
*/
@@ -19,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./prepay-loan.component.scss']
})
export class PrepayLoanComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -48,14 +46,16 @@ export class PrepayLoanComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
this.loanId = this.route.snapshot.params['loanId'];
}
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
/**
* Creates the prepay loan form
@@ -76,11 +76,17 @@ export class PrepayLoanComponent implements OnInit {
*/
createprepayLoanForm() {
this.prepayLoanForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': [''],
'paymentTypeId': [''],
'note': ['']
transactionDate: [
new Date(),
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: [''],
paymentTypeId: [''],
note: ['']
});
}
@@ -95,8 +101,7 @@ export class PrepayLoanComponent implements OnInit {
this.prepayLoanForm.get('transactionDate').valueChanges.subscribe((transactionDate: string) => {
const prepayDate = this.dateUtils.formatDate(transactionDate, this.settingsService.dateFormat);
this.loanService.getLoanPrepayLoanActionTemplate(this.loanId, prepayDate)
.subscribe((response: any) => {
this.loanService.getLoanPrepayLoanActionTemplate(this.loanId, prepayDate).subscribe((response: any) => {
this.prepayData = response;
this.prepayLoanForm.patchValue({
transactionAmount: this.prepayData.amount
@@ -142,10 +147,8 @@ export class PrepayLoanComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, 'repayment')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
this.loanService.submitLoanActionButton(this.loanId, data, 'repayment').subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RecoveryRepaymentComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RecoveryRepaymentComponent ]
})
.compileComponents();
declarations: [RecoveryRepaymentComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./recovery-repayment.component.scss']
})
export class RecoveryRepaymentComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -41,12 +40,14 @@ export class RecoveryRepaymentComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -68,11 +69,17 @@ export class RecoveryRepaymentComponent implements OnInit {
*/
createRecoveryRepaymentLoanForm() {
this.recoveryRepaymentLoanForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': ['', Validators.required],
'externalId': [''],
'paymentTypeId': [''],
'note': ['']
transactionDate: [
new Date(),
Validators.required
],
transactionAmount: [
'',
Validators.required
],
externalId: [''],
paymentTypeId: [''],
note: ['']
});
}
@@ -120,10 +127,8 @@ export class RecoveryRepaymentComponent implements OnInit {
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, 'recoverypayment')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.submitLoanActionButton(this.loanId, data, 'recoverypayment').subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('RejectLoanComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ RejectLoanComponent ]
})
.compileComponents();
declarations: [RejectLoanComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./reject-loan.component.scss']
})
export class RejectLoanComponent implements OnInit {
/** Loan Id. */
loanId: any;
/** Reject Loan form. */
@@ -34,12 +33,14 @@ export class RejectLoanComponent implements OnInit {
* @param route Activated Route.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService,
private dateUtils: Dates,
private settingsService: SettingsService ) {
constructor(
private formBuilder: UntypedFormBuilder,
private router: Router,
private route: ActivatedRoute,
private loanService: LoansService,
private dateUtils: Dates,
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -53,8 +54,11 @@ export class RejectLoanComponent implements OnInit {
*/
setRejectLoanForm() {
this.rejectLoanForm = this.formBuilder.group({
'rejectedOnDate': [new Date(), Validators.required],
'note': ['']
rejectedOnDate: [
new Date(),
Validators.required
],
note: ['']
});
}
@@ -78,5 +82,4 @@ export class RejectLoanComponent implements OnInit {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoApprovalComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoApprovalComponent ]
})
.compileComponents();
declarations: [UndoApprovalComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -14,7 +14,6 @@ import { LoansService } from 'app/loans/loans.service';
styleUrls: ['./undo-approval.component.scss']
})
export class UndoApprovalComponent implements OnInit {
/** Form Controller. */
note: UntypedFormControl;
@@ -23,10 +22,12 @@ export class UndoApprovalComponent implements OnInit {
* @param route Activated Route.
* @param router Router.
*/
constructor(private loanService: LoansService,
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router) { }
constructor(
private loanService: LoansService,
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private router: Router
) {}
ngOnInit() {
this.note = this.formBuilder.control('');
@@ -37,9 +38,8 @@ export class UndoApprovalComponent implements OnInit {
*/
submit() {
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});
this.loanService.loanActionButtons(loanId, 'undoapproval', { note: this.note.value }).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('UndoDisbursalComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UndoDisbursalComponent ]
})
.compileComponents();
declarations: [UndoDisbursalComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -15,7 +15,6 @@ import { LoansService } from '../../../loans.service';
styleUrls: ['./undo-disbursal.component.scss']
})
export class UndoDisbursalComponent implements OnInit {
@Input() actionName: string;
/** Loan ID. */
@@ -29,10 +28,12 @@ export class UndoDisbursalComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router for navigation.
*/
constructor(private formBuilder: UntypedFormBuilder,
private loansService: LoansService,
private router: Router,
private route: ActivatedRoute) {
constructor(
private formBuilder: UntypedFormBuilder,
private loansService: LoansService,
private router: Router,
private route: ActivatedRoute
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -51,9 +52,8 @@ export class UndoDisbursalComponent implements OnInit {
if (this.actionName === 'Undo Last Disbursal') {
command = 'undolastdisbursal';
}
this.loansService.loanActionButtons(this.loanId, command, {'note': this.note.value}).subscribe((response: any) => {
this.loansService.loanActionButtons(this.loanId, command, { note: this.note.value }).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('ViewGuarantorsComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ViewGuarantorsComponent ]
})
.compileComponents();
declarations: [ViewGuarantorsComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -20,12 +20,20 @@ import { LoansAccountViewGuarantorDetailsDialogComponent } from 'app/loans/custo
styleUrls: ['./view-guarantors.component.scss']
})
export class ViewGuarantorsComponent implements OnInit {
@Input() dataObject: any;
guarantorDetails: any;
showDeletedGuarantorsAccounts = false;
loanId: any;
guarantorsDisplayedColumns: string[] = ['fullname', 'relationship', 'guarantortype', 'depositAccount', 'amount', 'remainingAmount', 'status', 'action'];
guarantorsDisplayedColumns: string[] = [
'fullname',
'relationship',
'guarantortype',
'depositAccount',
'amount',
'remainingAmount',
'status',
'action'
];
/** View and perform various action on existing list of guarantors
* @param {MatDialog} dialog Dialog
@@ -33,10 +41,12 @@ export class ViewGuarantorsComponent implements OnInit {
* @param {route} Route Route
* @param {router} Router Router
*/
constructor(public dialog: MatDialog,
public loansService: LoansService,
private route: ActivatedRoute,
private router: Router) {
constructor(
public dialog: MatDialog,
public loansService: LoansService,
private route: ActivatedRoute,
private router: Router
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -75,8 +85,8 @@ export class ViewGuarantorsComponent implements OnInit {
private reload() {
const clientId = this.dataObject.clientId;
const url: string = this.router.url;
this.router.navigateByUrl(`/clients/${clientId}/loans-accounts`, { skipLocationChange: true })
this.router
.navigateByUrl(`/clients/${clientId}/loans-accounts`, { skipLocationChange: true })
.then(() => this.router.navigate([url]));
}
}
@@ -8,9 +8,8 @@ describe('WaiveInterestComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WaiveInterestComponent ]
})
.compileComponents();
declarations: [WaiveInterestComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -18,7 +18,6 @@ import { Currency } from 'app/shared/models/general.model';
styleUrls: ['./waive-interest.component.scss']
})
export class WaiveInterestComponent implements OnInit {
@Input() dataObject: any;
/** Loan Interest form. */
@@ -36,12 +35,14 @@ export class WaiveInterestComponent implements OnInit {
* @param {LoansService} loanService Loan Service.
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private formBuilder: UntypedFormBuilder,
private router: Router,
private settingsService: SettingsService,
private dateUtils: Dates,
private loanService: LoansService,
private route: ActivatedRoute) { }
constructor(
private formBuilder: UntypedFormBuilder,
private router: Router,
private settingsService: SettingsService,
private dateUtils: Dates,
private loanService: LoansService,
private route: ActivatedRoute
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -56,9 +57,15 @@ export class WaiveInterestComponent implements OnInit {
*/
setLoanInterestForm() {
this.loanInterestForm = this.formBuilder.group({
'transactionAmount': [this.dataObject.amount, Validators.required],
'transactionDate': [this.dataObject.date && new Date(this.dataObject.date), Validators.required],
'note': ['']
transactionAmount: [
this.dataObject.amount,
Validators.required
],
transactionDate: [
this.dataObject.date && new Date(this.dataObject.date),
Validators.required
],
note: ['']
});
}
@@ -81,8 +88,7 @@ export class WaiveInterestComponent implements OnInit {
data['transactionAmount'] = data['transactionAmount'] * 1;
const loanId = this.route.snapshot.params['loanId'];
this.loanService.submitLoanActionButton(loanId, data, 'waiveinterest').subscribe((response: any) => {
this.router.navigate(['../../general'], {relativeTo: this.route});
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('WithdrawnByClientComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WithdrawnByClientComponent ]
})
.compileComponents();
declarations: [WithdrawnByClientComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { Dates } from 'app/core/utils/dates';
styleUrls: ['./withdrawn-by-client.component.scss']
})
export class WithdrawnByClientComponent implements OnInit {
@Input() dataObject: any;
/** Loan Id */
loanId: string;
@@ -35,12 +34,14 @@ export class WithdrawnByClientComponent implements OnInit {
* @param {Router} router Router for navigation.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
constructor(
private formBuilder: UntypedFormBuilder,
private loanService: LoansService,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private settingsService: SettingsService) {
private settingsService: SettingsService
) {
this.loanId = this.route.snapshot.params['loanId'];
}
@@ -58,8 +59,11 @@ export class WithdrawnByClientComponent implements OnInit {
*/
createWithdrawnByClientLoanForm() {
this.withdrawnByClientLoanForm = this.formBuilder.group({
'withdrawnOnDate': [new Date(), Validators.required],
'note': ''
withdrawnOnDate: [
new Date(),
Validators.required
],
note: ''
});
}
@@ -77,10 +81,8 @@ export class WithdrawnByClientComponent implements OnInit {
dateFormat,
locale
};
this.loanService.loanActionButtons(this.loanId, 'withdrawnByApplicant', data)
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
this.loanService.loanActionButtons(this.loanId, 'withdrawnByApplicant', data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}
@@ -8,9 +8,8 @@ describe('WriteOffPageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ WriteOffPageComponent ]
})
.compileComponents();
declarations: [WriteOffPageComponent]
}).compileComponents();
}));
beforeEach(() => {
@@ -17,7 +17,6 @@ import { SettingsService } from 'app/settings/settings.service';
styleUrls: ['./write-off-page.component.scss']
})
export class WriteOffPageComponent implements OnInit {
@Input() dataObject: any;
/** Minimum Date allowed. */
@@ -37,12 +36,14 @@ export class WriteOffPageComponent implements OnInit {
* @param {Router} router Router.
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private loanService: LoansService,
private dateUtils: Dates,
private router: Router,
private settingsService: SettingsService) { }
constructor(
private formBuilder: UntypedFormBuilder,
private route: ActivatedRoute,
private loanService: LoansService,
private dateUtils: Dates,
private router: Router,
private settingsService: SettingsService
) {}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -54,9 +55,12 @@ export class WriteOffPageComponent implements OnInit {
*/
setWriteOffForm() {
this.writeOffForm = this.formBuilder.group({
'transactionDate': [this.dataObject.date && new Date(this.dataObject.date), Validators.required],
'amount': [{value: this.dataObject.amount, disabled: true}],
'note': ['']
transactionDate: [
this.dataObject.date && new Date(this.dataObject.date),
Validators.required
],
amount: [{ value: this.dataObject.amount, disabled: true }],
note: ['']
});
}
@@ -79,8 +83,7 @@ export class WriteOffPageComponent implements OnInit {
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});
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
}