Fix: Add the reason text for ReAge and ReAmortize Loan transactions

This commit is contained in:
Jose Alberto Hernandez
2024-03-07 14:54:12 +01:00
committed by Adam Saghy
parent f52efaef44
commit d1b2195423
6 changed files with 24 additions and 4 deletions
@@ -34,6 +34,13 @@
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<div fxLayout="column">
<mat-form-field>
<mat-label>{{"labels.inputs.Reason" | translate}}</mat-label>
<input matInput formControlName="note">
</mat-form-field>
</div>
<mat-form-field> <mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label> <mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
<input matInput formControlName="externalId"> <input matInput formControlName="externalId">
@@ -47,6 +47,7 @@ export class LoanReagingComponent implements OnInit {
'numberOfInstallments': [1, Validators.required], 'numberOfInstallments': [1, Validators.required],
'startDate': [this.settingsService.businessDate, Validators.required], 'startDate': [this.settingsService.businessDate, Validators.required],
'frequency': [, Validators.required], 'frequency': [, Validators.required],
'note': '',
'externalId': '' 'externalId': ''
}); });
} }
@@ -6,6 +6,13 @@
<mat-card-content> <mat-card-content>
<div fxLayout="column">
<mat-form-field>
<mat-label>{{"labels.inputs.Reason" | translate}}</mat-label>
<input matInput formControlName="note">
</mat-form-field>
</div>
<div fxLayout="column"> <div fxLayout="column">
<mat-form-field> <mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label> <mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -28,6 +28,7 @@ export class LoanReamortizeComponent implements OnInit {
createReAmortizeLoanForm() { createReAmortizeLoanForm() {
this.reamortizeLoanForm = this.formBuilder.group({ this.reamortizeLoanForm = this.formBuilder.group({
'note': '',
'externalId': '' 'externalId': ''
}); });
} }
@@ -112,9 +112,11 @@ export class TransactionsTabComponent implements OnInit {
* GOODWILL_CREDIT:23 * GOODWILL_CREDIT:23
* CHARGE_ADJUSTMENT:26 * CHARGE_ADJUSTMENT:26
* DOWN_PAYMENT:28 * DOWN_PAYMENT:28
* REAGE:29
* REAMORTIZE:30
*/ */
showTransactions(transactionsData: any) { showTransactions(transactionsData: any) {
if ([1, 2, 4, 9, 20, 21, 22, 23, 26, 28].includes(transactionsData.type.id)) { if ([1, 2, 4, 9, 20, 21, 22, 23, 26, 28, 29, 30].includes(transactionsData.type.id)) {
this.router.navigate([transactionsData.id], { relativeTo: this.route }); this.router.navigate([transactionsData.id], { relativeTo: this.route });
} }
} }
@@ -33,6 +33,7 @@ export class ViewTransactionComponent implements OnInit {
/** Transaction data. */ /** Transaction data. */
transactionData: any; transactionData: any;
transactionType: LoanTransactionType;
/** Is Editable */ /** Is Editable */
allowEdition = true; allowEdition = true;
/** Is Undoable */ /** Is Undoable */
@@ -72,9 +73,10 @@ export class ViewTransactionComponent implements OnInit {
private alertService: AlertService) { private alertService: AlertService) {
this.route.data.subscribe((data: { loansAccountTransaction: any }) => { this.route.data.subscribe((data: { loansAccountTransaction: any }) => {
this.transactionData = data.loansAccountTransaction; this.transactionData = data.loansAccountTransaction;
this.transactionType = this.transactionData.type;
this.allowEdition = !this.transactionData.manuallyReversed && !this.allowTransactionEdition(this.transactionData.type.id); this.allowEdition = !this.transactionData.manuallyReversed && !this.allowTransactionEdition(this.transactionData.type.id);
this.allowUndo = !this.transactionData.manuallyReversed; this.allowUndo = !this.transactionData.manuallyReversed;
this.allowChargeback = this.allowChargebackTransaction(this.transactionData.type) && !this.transactionData.manuallyReversed; this.allowChargeback = this.allowChargebackTransaction(this.transactionType) && !this.transactionData.manuallyReversed;
let transactionsChargebackRelated = false; let transactionsChargebackRelated = false;
if (this.allowChargeback) { if (this.allowChargeback) {
if (this.transactionData.transactionRelations) { if (this.transactionData.transactionRelations) {
@@ -89,13 +91,13 @@ export class ViewTransactionComponent implements OnInit {
}); });
this.amountRelationsAllowed = this.transactionData.amount - amountRelations; this.amountRelationsAllowed = this.transactionData.amount - amountRelations;
this.isFullRelated = (this.amountRelationsAllowed === 0); this.isFullRelated = (this.amountRelationsAllowed === 0);
this.allowChargeback = this.allowChargebackTransaction(this.transactionData.type) && !this.isFullRelated; this.allowChargeback = this.allowChargebackTransaction(this.transactionType) && !this.isFullRelated;
} }
} }
if (!this.allowChargeback) { if (!this.allowChargeback) {
this.allowEdition = false; this.allowEdition = false;
} }
if (this.existTransactionRelations && transactionsChargebackRelated) { if ((this.existTransactionRelations && transactionsChargebackRelated) || this.transactionType.reAge || this.transactionType.reAmortize) {
this.allowUndo = false; this.allowUndo = false;
} }
}); });