feat: Pending and Rejected account tabs in Approval Center with tasks service
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
b7d009b22a
commit
38c4a7d9e9
+72
@@ -107,7 +107,25 @@ export class PendingAccountComponent {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
navigateToAccount(account: any): void {
|
||||
const clientId = account.clientId;
|
||||
const accountId = account.id;
|
||||
const depositTypeId = account.depositType?.id;
|
||||
let path: string;
|
||||
if (account.accountType === 'Current') {
|
||||
path = `/clients/${clientId}/current-accounts/${accountId}`;
|
||||
} else if (depositTypeId === 200) {
|
||||
path = `/clients/${clientId}/fixed-deposits-accounts/${accountId}`;
|
||||
} else if (depositTypeId === 300) {
|
||||
path = `/clients/${clientId}/recurring-deposits-accounts/${accountId}`;
|
||||
} else {
|
||||
path = `/clients/${clientId}/savings-accounts/${accountId}`;
|
||||
}
|
||||
this.router.navigate([path]);
|
||||
}
|
||||
|
||||
approveAccounts() {
|
||||
if (!this.selection.hasValue()) return;
|
||||
const formfields: FormfieldBase[] = [
|
||||
new DatepickerBase({
|
||||
controlName: 'approvedOnDate',
|
||||
@@ -131,6 +149,60 @@ export class PendingAccountComponent {
|
||||
});
|
||||
}
|
||||
|
||||
rejectAccounts() {
|
||||
if (!this.selection.hasValue()) return;
|
||||
const formfields: FormfieldBase[] = [
|
||||
new DatepickerBase({
|
||||
controlName: 'rejectedOnDate',
|
||||
label: 'Rejected On Date',
|
||||
value: new Date(),
|
||||
type: 'datetime-local',
|
||||
required: true
|
||||
})
|
||||
];
|
||||
const dialogRef = this.dialog.open(FormDialogComponent, {
|
||||
data: {
|
||||
title: 'Enter Rejection Date',
|
||||
layout: { addButtonText: 'Confirm' },
|
||||
formfields
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.data) {
|
||||
this.bulkReject(response.data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private bulkReject(submittedData: any) {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
const rejectedOnDate = this.dateUtils.formatDate(submittedData.value.rejectedOnDate, dateFormat);
|
||||
const payload = { rejectedOnDate, dateFormat, locale };
|
||||
|
||||
const selected = this.selection.selected;
|
||||
let done = 0;
|
||||
selected.forEach((account: any) => {
|
||||
const depositTypeId = account.depositType?.id;
|
||||
let reject$;
|
||||
if (account.accountType === 'Current') {
|
||||
reject$ = this.tasksService.rejectCurrentAccount(account.id, payload);
|
||||
} else if (depositTypeId === 200) {
|
||||
reject$ = this.tasksService.rejectFDAccount(account.id, payload);
|
||||
} else if (depositTypeId === 300) {
|
||||
reject$ = this.tasksService.rejectRDAccount(account.id, payload);
|
||||
} else {
|
||||
reject$ = this.tasksService.rejectSavingsAccount(account.id, payload);
|
||||
}
|
||||
reject$.subscribe(() => {
|
||||
done++;
|
||||
if (done === selected.length) {
|
||||
this.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private bulkApprove(submittedData: any) {
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
const locale = this.settingsService.language.code;
|
||||
|
||||
Reference in New Issue
Block a user