Merge pull request #2637 from budaidev/WEB-295/undowriteoff-for-writeoff
WEB-306: Set command undowriteoff for writeoff instead of undo
This commit is contained in:
@@ -335,6 +335,14 @@ export class TransactionsTabComponent implements OnInit {
|
|||||||
command = 'undo-charge-off';
|
command = 'undo-charge-off';
|
||||||
operationDate = this.settingsService.businessDate;
|
operationDate = this.settingsService.businessDate;
|
||||||
payload = {};
|
payload = {};
|
||||||
|
} else if (this.isWriteOff(transaction.type)) {
|
||||||
|
command = 'undowriteoff';
|
||||||
|
payload = {
|
||||||
|
transactionDate: this.dateUtils.formatDate(operationDate && new Date(operationDate), dateFormat),
|
||||||
|
transactionAmount: 0,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
} else {
|
} else {
|
||||||
payload = {
|
payload = {
|
||||||
transactionDate: this.dateUtils.formatDate(operationDate && new Date(operationDate), dateFormat),
|
transactionDate: this.dateUtils.formatDate(operationDate && new Date(operationDate), dateFormat),
|
||||||
@@ -357,7 +365,7 @@ export class TransactionsTabComponent implements OnInit {
|
|||||||
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||||
if (response.confirm) {
|
if (response.confirm) {
|
||||||
let transactionId = transaction.id;
|
let transactionId = transaction.id;
|
||||||
if (this.isChargeOff(transaction.type)) {
|
if (this.isChargeOff(transaction.type) || command === 'undowriteoff' || this.isWriteOff(transaction.type)) {
|
||||||
transactionId = null;
|
transactionId = null;
|
||||||
}
|
}
|
||||||
this.loansService
|
this.loansService
|
||||||
@@ -399,6 +407,10 @@ export class TransactionsTabComponent implements OnInit {
|
|||||||
return transactionType.chargeoff || transactionType.code === 'loanTransactionType.chargeOff';
|
return transactionType.chargeoff || transactionType.code === 'loanTransactionType.chargeOff';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isWriteOff(transactionType: LoanTransactionType): boolean {
|
||||||
|
return transactionType.writeOff || transactionType.code === 'loanTransactionType.writeOff';
|
||||||
|
}
|
||||||
|
|
||||||
private isDownPayment(transactionType: LoanTransactionType): boolean {
|
private isDownPayment(transactionType: LoanTransactionType): boolean {
|
||||||
return transactionType.downPayment || transactionType.code === 'loanTransactionType.downPayment';
|
return transactionType.downPayment || transactionType.code === 'loanTransactionType.downPayment';
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -200,6 +200,10 @@ export class ViewTransactionComponent implements OnInit {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isWriteOff(transactionType: LoanTransactionType): boolean {
|
||||||
|
return transactionType.writeOff || transactionType.code === 'loanTransactionType.writeOff';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Undo the loans transaction
|
* Undo the loans transaction
|
||||||
*/
|
*/
|
||||||
@@ -267,8 +271,10 @@ export class ViewTransactionComponent implements OnInit {
|
|||||||
dateFormat,
|
dateFormat,
|
||||||
locale
|
locale
|
||||||
};
|
};
|
||||||
|
const command = this.isWriteOff(this.transactionType) ? 'undowriteoff' : 'undo';
|
||||||
|
const transactionId = command === 'undowriteoff' ? null : this.transactionData.id;
|
||||||
this.loansService
|
this.loansService
|
||||||
.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id)
|
.executeLoansAccountTransactionsCommand(accountId, command, data, transactionId)
|
||||||
.subscribe(() => {
|
.subscribe(() => {
|
||||||
this.router.navigate(['../'], { relativeTo: this.route });
|
this.router.navigate(['../'], { relativeTo: this.route });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user