Skip to content

Commit eab7e62

Browse files
committed
WEB-657: Working Capital Loan Delinquency - Reset & Undo Reset
Signed-off-by: Soma Sörös <soma.soros@dpc.hu>
1 parent 4493297 commit eab7e62

19 files changed

Lines changed: 203 additions & 5 deletions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build:prod": "node version.js && node --max-old-space-size=16384 ./node_modules/@angular/cli/bin/ng build --configuration production --output-hashing=none --base-href=/web-app/",
1818
"start": "npm run env -s && ng serve --proxy-config proxy.conf.js",
1919
"serve:dev": "npm run env -s && ng serve --source-map",
20-
"serve:sw": "npm run build -s && npx http-server ./dist -p 4200",
20+
"serve:sw": "npm run build -s && npx http-server ./dist/web-app/browser -p 4200",
2121
"lint": "eslint . && stylelint \"src/**/*.scss\" && prettier . --check && htmlhint \"src\" --config .htmlhintrc",
2222
"test": "jest --config jest.config.ts",
2323
"test:watch": "jest --config jest.config.ts --watch",
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
Copyright since 2025 Mifos Initiative
3+
4+
This Source Code Form is subject to the terms of the Mozilla Public
5+
License, v. 2.0. If a copy of the MPL was not distributed with this
6+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
-->
8+
9+
<h2 mat-dialog-title>{{ 'labels.heading.Loan Delinquency Actions' | translate }}</h2>
10+
11+
<div mat-dialog-content [formGroup]="delinquencyActionForm">
12+
<div class="layout-column">
13+
<mat-checkbox class="flex-98" formControlName="startNewPeriod">
14+
<p>{{ 'labels.inputs.Start new period' | translate }}</p>
15+
</mat-checkbox>
16+
</div>
17+
</div>
18+
19+
<mat-dialog-actions class="layout-row layout-xs-column layout-align-center gap-2percent">
20+
<button mat-raised-button mat-dialog-close>{{ 'labels.buttons.Cancel' | translate }}</button>
21+
<button
22+
mat-raised-button
23+
color="primary"
24+
[mat-dialog-close]="{ data: delinquencyActionForm }"
25+
>
26+
{{ 'labels.buttons.Reset' | translate }}
27+
</button>
28+
</mat-dialog-actions>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Copyright since 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*/
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/**
2+
* Copyright since 2025 Mifos Initiative
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
7+
*/
8+
9+
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
10+
import { UntypedFormBuilder, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
11+
import {
12+
MAT_DIALOG_DATA,
13+
MatDialogRef,
14+
MatDialogTitle,
15+
MatDialogContent,
16+
MatDialogActions,
17+
MatDialogClose
18+
} from '@angular/material/dialog';
19+
import { CdkScrollable } from '@angular/cdk/scrolling';
20+
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
21+
import { MatTooltip } from '@angular/material/tooltip';
22+
import { StringEnumOptionData } from 'app/shared/models/option-data.model';
23+
24+
@Component({
25+
selector: 'mifosx-loan-delinquency-action-reset-dialog',
26+
templateUrl: './loan-delinquency-action-reset-dialog.component.html',
27+
styleUrl: './loan-delinquency-action-reset-dialog.component.scss',
28+
imports: [
29+
...STANDALONE_SHARED_IMPORTS,
30+
MatDialogTitle,
31+
MatDialogContent,
32+
MatDialogActions,
33+
MatDialogClose
34+
],
35+
changeDetection: ChangeDetectionStrategy.OnPush
36+
})
37+
export class LoanDelinquencyActionResetDialogComponent {
38+
dialogRef = inject<MatDialogRef<LoanDelinquencyActionResetDialogComponent>>(MatDialogRef);
39+
data = inject(MAT_DIALOG_DATA);
40+
private formBuilder = inject(UntypedFormBuilder);
41+
42+
delinquencyActionForm: UntypedFormGroup;
43+
44+
constructor() {
45+
this.createDelinquencyActionForm();
46+
}
47+
48+
createDelinquencyActionForm() {
49+
this.delinquencyActionForm = this.formBuilder.group({
50+
startNewPeriod: [
51+
false
52+
]
53+
});
54+
}
55+
}

src/app/loans/loans-view/loan-delinquency-tags-tab/loan-delinquency-tags-tab.component.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ <h3>{{ 'labels.heading.Loan Delinquency Installment Tags' | translate }}</h3>
163163
>
164164
<fa-icon icon="calendar" class="m-r-10"></fa-icon>{{ 'labels.buttons.Reschedule' | translate }}
165165
</button>
166+
<button
167+
mat-raised-button
168+
color="primary"
169+
(click)="createDelinquencyActionReset()"
170+
*mifosxHasPermission="'CREATE_WC_DELINQUENCY_RESET'"
171+
>
172+
<fa-icon icon="calendar" class="m-r-10"></fa-icon>{{ 'labels.buttons.Reset' | translate }}
173+
</button>
174+
<button
175+
mat-raised-button
176+
color="primary"
177+
(click)="createDelinquencyActionUndoReset()"
178+
*mifosxHasPermission="'CREATE_WC_DELINQUENCY_UNDO_RESET'"
179+
>
180+
<fa-icon icon="calendar" class="m-r-10"></fa-icon>{{ 'labels.buttons.Undo Reset' | translate }}
181+
</button>
166182
}
167183
</div>
168184

src/app/loans/loans-view/loan-delinquency-tags-tab/loan-delinquency-tags-tab.component.ts

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ import { LoanProductBaseComponent } from 'app/products/loan-products/common/loan
5656
import { LoanDelinquencyActionRescheduleDialogComponent } from 'app/loans/custom-dialog/loan-delinquency-action-reschedule-dialog/loan-delinquency-action-reschedule-dialog.component';
5757
import { StringEnumOptionData } from 'app/shared/models/option-data.model';
5858
import { ProductsService } from 'app/products/products.service';
59+
import {
60+
LoanDelinquencyActionResetDialogComponent
61+
} from 'app/loans/custom-dialog/loan-delinquency-action-reset-dialog/loan-delinquency-action-reset-dialog.component';
5962

6063
type DelinquencyActionStatus = 'active' | 'scheduled' | 'expired';
6164

@@ -293,7 +296,7 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
293296
const startDate: Date = response.data.value.startDate;
294297
const endDate: Date = response.data.value.endDate;
295298

296-
this.sendDelinquencyAction(action, startDate, endDate, null, null, null, null);
299+
this.sendDelinquencyAction(action, startDate, endDate, null, null, null, null, null);
297300
});
298301
}
299302

@@ -312,7 +315,36 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
312315
const frequency: number = response.data.value.frequency;
313316
const frequencyType: string = response.data.value.frequencyType;
314317

315-
this.sendDelinquencyAction(action, null, null, minimumPayment, minimumPaymentType, frequency, frequencyType);
318+
this.sendDelinquencyAction(action, null, null, minimumPayment, minimumPaymentType, frequency, frequencyType, null);
319+
});
320+
}
321+
322+
createDelinquencyActionReset(): void {
323+
const action = 'reset';
324+
const loanDelinquencyActionDialogRef = this.dialog.open(LoanDelinquencyActionResetDialogComponent, {
325+
data: {
326+
action: action,
327+
startNewPeriod: false
328+
}
329+
});
330+
loanDelinquencyActionDialogRef.afterClosed().subscribe((response: { data: any }) => {
331+
const startNewPeriod: boolean = response.data.value.startNewPeriod;
332+
333+
this.sendDelinquencyAction(action, null, null, null, null, null, null, startNewPeriod);
334+
});
335+
}
336+
createDelinquencyActionUndoReset(): void {
337+
const action = 'undo_reset';
338+
const loanDelinquencyActionDialogRef = this.dialog.open(ConfirmationDialogComponent, {
339+
data: {
340+
heading: this.translateService.instant('labels.heading.Undo Reset'),
341+
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to undo last reset action')
342+
}
343+
});
344+
loanDelinquencyActionDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
345+
if (response.confirm) {
346+
this.sendDelinquencyAction(action, null, null, null, null, null, null, null);
347+
}
316348
});
317349
}
318350

@@ -330,7 +362,7 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
330362
removePauseDialogRef.afterClosed().subscribe((response: any) => {
331363
if (response.confirm) {
332364
if (this.loanProductService.isLoanProduct) {
333-
this.sendDelinquencyAction('resume', null, null, null, null, null, null);
365+
this.sendDelinquencyAction('resume', null, null, null, null, null, null, null);
334366
} else {
335367
this.sendDelinquencyAction(
336368
'resume',
@@ -339,6 +371,7 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
339371
null,
340372
null,
341373
null,
374+
null,
342375
null
343376
);
344377
}
@@ -353,7 +386,8 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
353386
minimumPayment: number | null,
354387
minimumPaymentType: string | null,
355388
frequency: number | null,
356-
frequencyType: string | null
389+
frequencyType: string | null,
390+
startNewPeriod: boolean | null
357391
): void {
358392
let payload: any = {
359393
action,
@@ -378,6 +412,12 @@ export class LoanDelinquencyTagsTabComponent extends LoanProductBaseComponent im
378412
frequency,
379413
frequencyType
380414
};
415+
} else if (action === 'reset') {
416+
payload = {
417+
action,
418+
locale: this.locale,
419+
startNewPeriod,
420+
}
381421
}
382422

383423
this.loansServices

src/assets/translations/cs-CS.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -744,6 +744,7 @@
744744
"Unassign Staff": "Zrušit přidělení personálu",
745745
"Undo": "vrátit",
746746
"Undo Rejection": "Zrušit odmítnutí",
747+
"Undo Reset": "Vrátit reset",
747748
"Undo Transfer": "Vrátit zpět převod",
748749
"Unpin": "Odepnout",
749750
"Update Default Savings": "Aktualizovat výchozí úspory",
@@ -1562,6 +1563,7 @@
15621563
"Unassign Role": "Zrušit přiřazení role",
15631564
"Unassign Staff": "Zrušit přidělení personálu",
15641565
"Undo": "vrátit",
1566+
"Undo Reset": "Vrátit reset",
15651567
"Undo Transaction": "Vrátit zpět transakci",
15661568
"Upcoming Charges": "Nadcházející poplatky",
15671569
"Upload": "nahrát",
@@ -2929,6 +2931,7 @@
29292931
"Standing Instruction Type": "Typ trvalého pokynu",
29302932
"Standing Instructions": "Stálé instrukce",
29312933
"Start Date": "Datum zahájení",
2934+
"Start new period": "Zahájit nové období",
29322935
"Start Time": "Doba spuštění",
29332936
"Started On": "Zahájeno dne",
29342937
"Starting date": "Počáteční datum",
@@ -3362,6 +3365,7 @@
33623365
"Are you sure you want to waive charge with id:": "Určitě se chcete vzdát poplatku s ID:",
33633366
"Are you sure you want to waive charges": "Opravdu chcete odpustit {{ count }} poplatků",
33643367
"Are you sure you want to undo this transaction ?": "Jste si jisti, že chcete tuto transakci vrátit zpět?",
3368+
"Are you sure you want to undo last reset action": "Opravdu chcete vrátit poslední akci resetu?",
33653369
"Are you sure you want recover from Guarantor": "Jste si jisti, že se chcete zotavit z ručitele",
33663370
"Are you sure you want recover the Original Schedule": "Jste si jisti, že chcete obnovit původní rozvrh",
33673371
"Are you sure you want resume the Delinquency Classification for Loan": "Jste si jisti, že chcete pokračovat v klasifikaci delikvence pro půjčku",

src/assets/translations/de-DE.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@
745745
"Unassign Staff": "Personalzuweisung aufheben",
746746
"Undo": "Rückgängig machen",
747747
"Undo Rejection": "Ablehnung rückgängig machen",
748+
"Undo Reset": "Zurücksetzen rückgängig machen",
748749
"Undo Transfer": "Übertragung rückgängig machen",
749750
"Unpin": "Lösen",
750751
"Update Default Savings": "Standardeinsparungen aktualisieren",
@@ -1564,6 +1565,7 @@
15641565
"Unassign Role": "Rollenzuweisung aufheben",
15651566
"Unassign Staff": "Personalzuweisung aufheben",
15661567
"Undo": "Rückgängig machen",
1568+
"Undo Reset": "Zurücksetzen rückgängig machen",
15671569
"Undo Transaction": "Transaktion rückgängig machen",
15681570
"Upcoming Charges": "Kommende Anklagen",
15691571
"Upload": "Hochladen",
@@ -2931,6 +2933,7 @@
29312933
"Standing Instruction Type": "Ständiger Instruktionstyp",
29322934
"Standing Instructions": "Ständige Anweisungen",
29332935
"Start Date": "Startdatum",
2936+
"Start new period": "Neue Periode starten",
29342937
"Start Time": "Startzeit",
29352938
"Started On": "Begann am",
29362939
"Starting date": "Anfangsdatum",
@@ -3364,6 +3367,7 @@
33643367
"Are you sure you want to waive charge with id:": "Sind Sie sicher, dass Sie die Gebühr mit der ID erlassen möchten:",
33653368
"Are you sure you want to waive charges": "Sind Sie sicher, dass Sie {{ count }} Gebühren verzichten möchten",
33663369
"Are you sure you want to undo this transaction ?": "Sind Sie sicher, dass Sie diese Transaktion rückgängig machen möchten ?",
3370+
"Are you sure you want to undo last reset action": "Sind Sie sicher, dass Sie die letzte Zurücksetzung rückgängig machen möchten?",
33673371
"Are you sure you want recover from Guarantor": "Sind Sie sicher, dass Sie sich vom Bürgen erholen möchten",
33683372
"Are you sure you want recover the Original Schedule": "Sind Sie sicher, dass Sie den Originalzeitplan wiederherstellen möchten",
33693373
"Are you sure you want resume the Delinquency Classification for Loan": "Sind Sie sicher, dass Sie die Delinquenzklassifizierung für das Darlehen fortsetzen möchten",

src/assets/translations/en-US.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@
746746
"Unassign Staff": "Unassign Staff",
747747
"Undo": "Undo",
748748
"Undo Rejection": "Undo Rejection",
749+
"Undo Reset": "Undo Reset",
749750
"Undo Transfer": "Undo Transfer",
750751
"Unpin": "Unpin",
751752
"Update Default Savings": "Update Default Savings",
@@ -1570,6 +1571,7 @@
15701571
"Unassign Staff": "Unassign Staff",
15711572
"Undo": "Undo",
15721573
"Undo Transaction": "Undo Transaction",
1574+
"Undo Reset": "Undo Reset",
15731575
"Upcoming Charges": "Upcoming Charges",
15741576
"Upload": "Upload",
15751577
"Upload Client Image": "Upload Client Image",
@@ -2932,6 +2934,7 @@
29322934
"Standing Instruction Type": "Standing Instruction Type",
29332935
"Standing Instructions": "Standing Instructions",
29342936
"Start Date": "Start Date",
2937+
"Start new period": "Start New Period",
29352938
"Start Time": "Start Time",
29362939
"Started On": "Started On",
29372940
"Starting Date": "Starting Date",
@@ -3387,6 +3390,7 @@
33873390
"Are you sure you want to delete checker": "Are you sure you want to delete checker",
33883391
"Are you sure you want to Approve Loan": "Are you sure you want to Approve Loan",
33893392
"Are you sure you want to Disburse Loan": "Are you sure you want to Disburse Loan",
3393+
"Are you sure you want to undo last reset action": "Are you sure you want to undo last reset action",
33903394
"undo_account_transfer": "Are you sure you want to undo this account transfer?",
33913395
"Are you sure you want to": "Are you sure you want to ",
33923396
"the productmix component with id": "the productmix component with id",

src/assets/translations/es-CL.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,7 @@
743743
"Unassign Staff": "Desasignar Asesor",
744744
"Undo": "Deshacer",
745745
"Undo Rejection": "Deshacer rechazo",
746+
"Undo Reset": "Deshacer reinicio",
746747
"Undo Transfer": "Deshacer transferencia",
747748
"Unpin": "Desanclar",
748749
"Update Default Savings": "Actualizar ahorros predeterminados",
@@ -1562,6 +1563,7 @@
15621563
"Unassign Role": "Desasignar rol",
15631564
"Unassign Staff": "Desasignar Asesor",
15641565
"Undo": "Deshacer",
1566+
"Undo Reset": "Deshacer reinicio",
15651567
"Undo Transaction": "Deshacer transacción",
15661568
"Upcoming Charges": "Próximos cargos",
15671569
"Upload": "Subir",
@@ -2930,6 +2932,7 @@
29302932
"Standing Instruction Type": "Tipo de instrucción permanente",
29312933
"Standing Instructions": "Instrucciones permanentes",
29322934
"Start Date": "Fecha de inicio",
2935+
"Start new period": "Iniciar nuevo período",
29332936
"Start Time": "Hora de inicio",
29342937
"Started On": "Iniciado en",
29352938
"Starting date": "Fecha de inicio",
@@ -3362,6 +3365,7 @@
33623365
"Disable withhold tax for this account ?": "¿Quieres deshabilitar la retención de impuestos para esta cuenta?",
33633366
"Are you sure you want to waive charge with id:": "¿Estás seguro de que deseas eximir el cargo con ID:",
33643367
"Are you sure you want to waive charges": "¿Está seguro de que desea renunciar a {{ count }} comisiones",
3368+
"Are you sure you want to undo last reset action": "¿Está seguro de que desea deshacer la última acción de reinicio?",
33653369
"Are you sure you want to undo this transaction ?": "¿Estás seguro de que deseas deshacer esta transacción?",
33663370
"Are you sure you want recover from Guarantor": "¿Estás seguro de que deseas recuperar del garante?",
33673371
"Are you sure you want recover the Original Schedule": "¿Estás seguro de que deseas recuperar el Calendario Original?",

0 commit comments

Comments
 (0)