Support to pause and resume Loan Delinquency Classification (#1918)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-12-01 18:06:31 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 3f4e9870b6
commit a26c906d2c
28 changed files with 414 additions and 73 deletions
@@ -0,0 +1,34 @@
<h2 mat-dialog-title>{{"labels.heading.Loan Delinquency Actions" | translate}}</h2>
<div mat-dialog-content [formGroup]="delinquencyActionForm" fxLayout="column">
<mat-form-field fxFlex="48%" (click)="validFromDatePicker.open()">
<mat-label>{{"labels.inputs.Start Date" | translate}}</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="validFromDatePicker" required
formControlName="startDate">
<mat-datepicker-toggle matSuffix [for]="validFromDatePicker"></mat-datepicker-toggle>
<mat-datepicker #validFromDatePicker></mat-datepicker>
<mat-error *ngIf="delinquencyActionForm.controls.startDate.hasError('required')">
{{"labels.inputs.Start Date" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="48%" (click)="validTillDatePicker.open()">
<mat-label>{{"labels.inputs.End Date" | translate}}</mat-label>
<input matInput [min]="delinquencyActionForm.value.startDate" [max]="maxDate" [matDatepicker]="validTillDatePicker" required
formControlName="endDate">
<mat-datepicker-toggle matSuffix [for]="validTillDatePicker"></mat-datepicker-toggle>
<mat-datepicker #validTillDatePicker></mat-datepicker>
<mat-error *ngIf="delinquencyActionForm.controls.endDate.hasError('required')">
{{"labels.inputs.End Date" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
</div>
<mat-dialog-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="2%">
<button mat-raised-button mat-dialog-close> {{"labels.buttons.Cancel" | translate}} </button>
<button mat-raised-button color="primary" [mat-dialog-close]="{ data: delinquencyActionForm }"
[disabled]="!delinquencyActionForm.valid || delinquencyActionForm.pristine">{{"labels.buttons.Submit" | translate}}</button>
</mat-dialog-actions>
@@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoanDelinquencyActionDialogComponent } from './loan-delinquency-action-dialog.component';
describe('LoanDelinquencyActionDialogComponent', () => {
let component: LoanDelinquencyActionDialogComponent;
let fixture: ComponentFixture<LoanDelinquencyActionDialogComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoanDelinquencyActionDialogComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(LoanDelinquencyActionDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,37 @@
import { Component, Inject, OnInit } from '@angular/core';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { SettingsService } from 'app/settings/settings.service';
@Component({
selector: 'mifosx-loan-delinquency-action-dialog',
templateUrl: './loan-delinquency-action-dialog.component.html',
styleUrls: ['./loan-delinquency-action-dialog.component.scss']
})
export class LoanDelinquencyActionDialogComponent implements OnInit {
delinquencyActionForm: UntypedFormGroup;
/** Minimum date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum date allowed. */
maxDate = new Date(2100, 0, 1);
constructor(public dialogRef: MatDialogRef<LoanDelinquencyActionDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private formBuilder: UntypedFormBuilder,
private settingsService: SettingsService) {
this.createDelinquencyActionForm();
}
ngOnInit(): void {
this.minDate = this.settingsService.businessDate;
}
createDelinquencyActionForm() {
this.delinquencyActionForm = this.formBuilder.group({
'startDate': [new Date(), Validators.required],
'endDate': ['', Validators.required],
});
}
}