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';
|
||||
operationDate = this.settingsService.businessDate;
|
||||
payload = {};
|
||||
} else if (this.isWriteOff(transaction.type)) {
|
||||
command = 'undowriteoff';
|
||||
payload = {
|
||||
transactionDate: this.dateUtils.formatDate(operationDate && new Date(operationDate), dateFormat),
|
||||
transactionAmount: 0,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
} else {
|
||||
payload = {
|
||||
transactionDate: this.dateUtils.formatDate(operationDate && new Date(operationDate), dateFormat),
|
||||
@@ -357,7 +365,7 @@ export class TransactionsTabComponent implements OnInit {
|
||||
undoTransactionAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||
if (response.confirm) {
|
||||
let transactionId = transaction.id;
|
||||
if (this.isChargeOff(transaction.type)) {
|
||||
if (this.isChargeOff(transaction.type) || command === 'undowriteoff' || this.isWriteOff(transaction.type)) {
|
||||
transactionId = null;
|
||||
}
|
||||
this.loansService
|
||||
@@ -399,6 +407,10 @@ export class TransactionsTabComponent implements OnInit {
|
||||
return transactionType.chargeoff || transactionType.code === 'loanTransactionType.chargeOff';
|
||||
}
|
||||
|
||||
isWriteOff(transactionType: LoanTransactionType): boolean {
|
||||
return transactionType.writeOff || transactionType.code === 'loanTransactionType.writeOff';
|
||||
}
|
||||
|
||||
private isDownPayment(transactionType: LoanTransactionType): boolean {
|
||||
return transactionType.downPayment || transactionType.code === 'loanTransactionType.downPayment';
|
||||
}
|
||||
|
||||
+7
-1
@@ -200,6 +200,10 @@ export class ViewTransactionComponent implements OnInit {
|
||||
return true;
|
||||
}
|
||||
|
||||
isWriteOff(transactionType: LoanTransactionType): boolean {
|
||||
return transactionType.writeOff || transactionType.code === 'loanTransactionType.writeOff';
|
||||
}
|
||||
|
||||
/**
|
||||
* Undo the loans transaction
|
||||
*/
|
||||
@@ -267,8 +271,10 @@ export class ViewTransactionComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
const command = this.isWriteOff(this.transactionType) ? 'undowriteoff' : 'undo';
|
||||
const transactionId = command === 'undowriteoff' ? null : this.transactionData.id;
|
||||
this.loansService
|
||||
.executeLoansAccountTransactionsCommand(accountId, 'undo', data, this.transactionData.id)
|
||||
.executeLoansAccountTransactionsCommand(accountId, command, data, transactionId)
|
||||
.subscribe(() => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user