Merge pull request #2515 from alberto-art3ch/enhancement/loan_account_undo_contract_termination

Loan account Contract Termination undo
This commit is contained in:
Jose Alberto Hernandez
2025-06-11 23:41:48 -05:00
committed by GitHub
3 changed files with 73 additions and 29 deletions
@@ -196,7 +196,7 @@ export class TransactionsTabComponent implements OnInit {
* INTEREST REFUND:33 * INTEREST REFUND:33
* CAPITALIZED INCOME:35 * CAPITALIZED INCOME:35
* CAPITALIZED INCOME ADJUSTMENT:37 * CAPITALIZED INCOME ADJUSTMENT:37
* CONTRACT_TERMINATION:90 * CONTRACT_TERMINATION:38
*/ */
showTransaction(transactionsData: LoanTransaction): boolean { showTransaction(transactionsData: LoanTransaction): boolean {
return [ return [
@@ -216,7 +216,7 @@ export class TransactionsTabComponent implements OnInit {
33, 33,
35, 35,
37, 37,
90 38
].includes(transactionsData.type.id); ].includes(transactionsData.type.id);
} }
@@ -228,7 +228,8 @@ export class TransactionsTabComponent implements OnInit {
transaction.type.disbursement || transaction.type.disbursement ||
transaction.type.chargeoff || transaction.type.chargeoff ||
this.isReAgoeOrReAmortize(transaction.type) || this.isReAgoeOrReAmortize(transaction.type) ||
transaction.type.interestRefund transaction.type.interestRefund ||
transaction.type.contractTermination
); );
} }
@@ -163,35 +163,77 @@ export class ViewTransactionComponent implements OnInit {
* Undo the loans transaction * Undo the loans transaction
*/ */
undoTransaction() { undoTransaction() {
console.log(this.transactionData);
const accountId = this.route.snapshot.params['loanId']; const accountId = this.route.snapshot.params['loanId'];
const undoTransactionAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: { if (this.transactionType.contractTermination) {
heading: this.translateService.instant('labels.heading.Undo Transaction'), const formfields: FormfieldBase[] = [
dialogContext: new InputBase({
this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction') + controlName: 'note',
`${this.transactionData.id}` label: 'Note',
} value: '',
}); type: 'text',
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => { required: false,
if (response.confirm) { order: 1
const locale = this.settingsService.language.code; }),
const dateFormat = this.settingsService.dateFormat; new InputBase({
const data = { controlName: 'reversalExternalId',
transactionDate: this.dateUtils.formatDate( label: 'externalId',
this.transactionData.date && new Date(this.transactionData.date), value: '',
dateFormat type: 'text',
), required: false,
transactionAmount: 0, order: 2
dateFormat, })
locale
}; ];
this.loansService const data = {
.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id) title: this.translateService.instant('labels.heading.Undo Transaction'),
.subscribe(() => { layout: { addButtonText: 'Undo' },
formfields: formfields
};
const undoTransactionAccountDialogRef = this.dialog.open(FormDialogComponent, { data, width: '50rem' });
undoTransactionAccountDialogRef.afterClosed().subscribe((response: any) => {
if (response.data) {
const payload = {
note: response.data.value.note,
reversalExternalId: response.data.value.reversalExternalId
};
this.loansService.loanActionButtons(accountId, 'undoContractTermination', payload).subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route }); this.router.navigate(['../'], { relativeTo: this.route });
}); });
} }
}); });
} else {
const undoTransactionAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
data: {
heading: this.translateService.instant('labels.heading.Undo Transaction'),
dialogContext:
this.translateService.instant('labels.dialogContext.Are you sure you want undo the transaction') +
`${this.transactionData.id}`
}
});
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
if (response.confirm) {
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const data = {
transactionDate: this.dateUtils.formatDate(
this.transactionData.date && new Date(this.transactionData.date),
dateFormat
),
transactionAmount: 0,
dateFormat,
locale
};
this.loansService
.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id)
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
});
}
} }
chargebackTransaction() { chargebackTransaction() {
@@ -36,4 +36,5 @@ export interface LoanTransactionType {
capitalizedIncomeAdjustment: boolean; capitalizedIncomeAdjustment: boolean;
capitalizedIncomeAmortization: boolean; capitalizedIncomeAmortization: boolean;
capitalizedIncomeAmortizationAdjustment: boolean; capitalizedIncomeAmortizationAdjustment: boolean;
contractTermination: boolean;
} }