pending account terminate feature develop
This commit is contained in:
+40
-3
@@ -11,8 +11,8 @@ import { Component, OnInit, inject } from '@angular/core';
|
||||
import { ActivatedRoute, Router, RouterLinkActive, RouterLink, RouterOutlet } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Dialogs */
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { CalculateInterestDialogComponent } from './custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||
import { PostInterestDialogComponent } from './custom-dialogs/post-interest-dialog/post-interest-dialog.component';
|
||||
import { ToggleWithholdTaxDialogComponent } from './custom-dialogs/toggle-withhold-tax-dialog/toggle-withhold-tax-dialog.component';
|
||||
@@ -23,7 +23,10 @@ import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.conf
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../fixed-deposits.service';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { AccountsService } from 'app/accounts/accounts.service';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { NgClass, CurrencyPipe } from '@angular/common';
|
||||
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
||||
@@ -67,6 +70,9 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private savingsService = inject(SavingsService);
|
||||
private accountsService = inject(AccountsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
dialog = inject(MatDialog);
|
||||
|
||||
/** Fixed Deposits Account Data */
|
||||
@@ -99,7 +105,8 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
'Apply Annual Fees': 'admin',
|
||||
Reject: 'danger',
|
||||
'Withdrawn by Client': 'danger',
|
||||
Delete: 'danger'
|
||||
Delete: 'danger',
|
||||
Terminate: 'danger'
|
||||
};
|
||||
|
||||
private readonly ACTION_ICON: Record<string, string> = {
|
||||
@@ -121,7 +128,8 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
'Apply Annual Fees': 'receipt',
|
||||
Reject: 'ban',
|
||||
'Withdrawn by Client': 'user-slash',
|
||||
Delete: 'trash'
|
||||
Delete: 'trash',
|
||||
Terminate: 'times-circle'
|
||||
};
|
||||
|
||||
kindOf(name: string): 'transact' | 'block' | 'interest' | 'admin' | 'danger' {
|
||||
@@ -237,6 +245,9 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
case 'Disable Withhold Tax':
|
||||
this.disableWithHoldTax();
|
||||
break;
|
||||
case 'Terminate':
|
||||
this.terminateFixedDepositsAccount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +267,32 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private terminateFixedDepositsAccount() {
|
||||
const terminateFixedDepositAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Terminate Account',
|
||||
dialogContext: 'Are you sure you want to terminate this account?',
|
||||
type: 'Strong'
|
||||
}
|
||||
});
|
||||
terminateFixedDepositAccountDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response && response.confirm) {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const terminatedOnDate = this.dateUtils.formatDate(new Date(), dateFormat);
|
||||
const data = {
|
||||
accountType: 'FD',
|
||||
terminatedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.accountsService.terminateAccount(this.fixedDepositsAccountData.id, data).subscribe(() => {
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates fixed deposit account's interest
|
||||
*/
|
||||
|
||||
+3
@@ -132,6 +132,9 @@ export class FixedDepositsButtonsConfiguration {
|
||||
},
|
||||
{
|
||||
name: 'Delete'
|
||||
},
|
||||
{
|
||||
name: 'Terminate'
|
||||
}
|
||||
];
|
||||
break;
|
||||
|
||||
+40
-2
@@ -20,9 +20,13 @@ import { RecurringDepositsButtonsConfiguration } from './recurring-deposits-butt
|
||||
|
||||
/** Custom Dialogs */
|
||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { RecurringDepositConfirmationDialogComponent } from './custom-dialogs/recurring-deposit-confirmation-dialog/recurring-deposit-confirmation-dialog.component';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AccountsService } from 'app/accounts/accounts.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { NgClass, DecimalPipe, CurrencyPipe } from '@angular/common';
|
||||
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
||||
@@ -67,6 +71,9 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private recurringDepositsService = inject(RecurringDepositsService);
|
||||
private savingsService = inject(SavingsService);
|
||||
private accountsService = inject(AccountsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private dateUtils = inject(Dates);
|
||||
dialog = inject(MatDialog);
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
@@ -103,7 +110,8 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
'Apply Annual Fees': 'admin',
|
||||
Reject: 'danger',
|
||||
'Withdrawn by Client': 'danger',
|
||||
Delete: 'danger'
|
||||
Delete: 'danger',
|
||||
Terminate: 'danger'
|
||||
};
|
||||
|
||||
private readonly ACTION_ICON: Record<string, string> = {
|
||||
@@ -125,7 +133,8 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
'Apply Annual Fees': 'receipt',
|
||||
Reject: 'ban',
|
||||
'Withdrawn by Client': 'user-slash',
|
||||
Delete: 'trash'
|
||||
Delete: 'trash',
|
||||
Terminate: 'times-circle'
|
||||
};
|
||||
|
||||
kindOf(name: string): 'transact' | 'block' | 'interest' | 'admin' | 'danger' {
|
||||
@@ -287,6 +296,9 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
case 'Disable Withhold Tax':
|
||||
this.disableWithHoldTax();
|
||||
break;
|
||||
case 'Terminate':
|
||||
this.terminateRecurringDepositsAccount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,6 +320,32 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private terminateRecurringDepositsAccount() {
|
||||
const terminateRecurringDepositAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Terminate Account',
|
||||
dialogContext: 'Are you sure you want to terminate this account?',
|
||||
type: 'Strong'
|
||||
}
|
||||
});
|
||||
terminateRecurringDepositAccountDialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response && response.confirm) {
|
||||
const locale = this.settingsService.language.code;
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const terminatedOnDate = this.dateUtils.formatDate(new Date(), dateFormat);
|
||||
const data = {
|
||||
accountType: 'RD',
|
||||
terminatedOnDate,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.accountsService.terminateAccount(this.recurringDepositsAccountData.id, data).subscribe(() => {
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates savings account's interest
|
||||
*/
|
||||
|
||||
+5
@@ -163,6 +163,11 @@ export class RecurringDepositsButtonsConfiguration {
|
||||
name: 'Delete',
|
||||
icon: 'trash',
|
||||
taskPermissionName: 'DELETE_RECURRINGDEPOSITACCOUNT'
|
||||
},
|
||||
{
|
||||
name: 'Terminate',
|
||||
icon: 'times-circle',
|
||||
taskPermissionName: 'DELETE_RECURRINGDEPOSITACCOUNT'
|
||||
}
|
||||
];
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user