fix(tasks): separate Pending Share Accounts from the Pending Account screen
Removes the Pending Share Accounts section that had been bolted onto the Pending Account screen (duplicate data/actions alongside the normal-account table), restoring it as its own standalone queue. The standalone pending-share-accounts route/component already existed but had no tab link anywhere in the Approval Center nav, so it was unreachable from the UI - added a "Pending Share Accounts" tab for it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+3
-120
@@ -29,24 +29,17 @@ import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
|
||||
import { TasksService } from '../../tasks.service';
|
||||
import { SharesService } from 'app/shares/shares.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
|
||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-pending-account',
|
||||
templateUrl: './pending-account.component.html',
|
||||
styleUrls: [
|
||||
'./pending-account.component.scss',
|
||||
'../pending-share-accounts/pending-share-accounts.component.scss'
|
||||
],
|
||||
styleUrls: ['./pending-account.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
@@ -61,8 +54,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatIcon,
|
||||
DecimalPipe
|
||||
MatIcon
|
||||
]
|
||||
})
|
||||
export class PendingAccountComponent {
|
||||
@@ -72,7 +64,6 @@ export class PendingAccountComponent {
|
||||
private dateUtils = inject(Dates);
|
||||
private settingsService = inject(SettingsService);
|
||||
private tasksService = inject(TasksService);
|
||||
private sharesService = inject(SharesService);
|
||||
|
||||
dataSource: MatTableDataSource<any>;
|
||||
selection: SelectionModel<any>;
|
||||
@@ -90,26 +81,8 @@ export class PendingAccountComponent {
|
||||
'status'
|
||||
];
|
||||
|
||||
/** Share accounts awaiting approval - rendered as their own section on this same screen rather
|
||||
* than a separate tab. Kept out of `dataSource`/`selection` (bulk-select + date-picker approve)
|
||||
* since a share subscription is approved/rejected one at a time against today's business date,
|
||||
* exactly as it always was on its own page - only where it's shown has changed. */
|
||||
shareDataSource: MatTableDataSource<any>;
|
||||
showShareData = false;
|
||||
|
||||
shareDisplayedColumns: string[] = [
|
||||
'accountNo',
|
||||
'clientName',
|
||||
'productName',
|
||||
'requestedShares',
|
||||
'requestedAmount',
|
||||
'resolution',
|
||||
'submittedDate',
|
||||
'actions'
|
||||
];
|
||||
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { pendingAccountsData: any; pendingShareAccountsData: any }) => {
|
||||
this.route.data.subscribe((data: { pendingAccountsData: any }) => {
|
||||
// status 100 = submitted and pending approval only; exclude terminated accounts
|
||||
const items = (data.pendingAccountsData?.pageItems || []).filter(
|
||||
(a: any) => a.status?.id === 100 && !a.terminateTrue
|
||||
@@ -117,10 +90,6 @@ export class PendingAccountComponent {
|
||||
this.showData = items.length > 0;
|
||||
this.dataSource = new MatTableDataSource(items);
|
||||
this.selection = new SelectionModel(true, []);
|
||||
|
||||
const shareItems = data.pendingShareAccountsData || [];
|
||||
this.showShareData = shareItems.length > 0;
|
||||
this.shareDataSource = new MatTableDataSource(shareItems);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -314,92 +283,6 @@ export class PendingAccountComponent {
|
||||
return date;
|
||||
}
|
||||
|
||||
applyShareFilter(filterValue: string = '') {
|
||||
this.shareDataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/** A date from the share account API rendered readably, whether it arrives as a string or as
|
||||
* Fineract's {@code [yyyy, m, d]} array. Kept separate from `formatDate()` above, which the
|
||||
* normal-account table already relies on with its own date-array handling. */
|
||||
formatShareDate(date: any): string {
|
||||
if (!date) {
|
||||
return '';
|
||||
}
|
||||
const d = Array.isArray(date) ? new Date(date[0], date[1] - 1, date[2]) : new Date(date);
|
||||
return isNaN(d.getTime()) ? String(date) : d.toLocaleDateString('en-IN');
|
||||
}
|
||||
|
||||
/** Opens the share account itself, for a checker who wants more than the row shows. */
|
||||
viewShareAccount(account: any): void {
|
||||
this.router.navigate([
|
||||
'/clients',
|
||||
account.clientId,
|
||||
'shares-accounts',
|
||||
account.shareAccountId
|
||||
]);
|
||||
}
|
||||
|
||||
approveShareAccount(account: any): void {
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Approve Share Account',
|
||||
dialogContext:
|
||||
`Approve share account "${account.accountNo}" for ${account.clientName} — ` +
|
||||
`${account.requestedShares} shares at ${account.requestedAmount}?`,
|
||||
type: 'basic'
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
// The approval date is the business date rather than the checker's choice, same as this
|
||||
// queue's original standalone screen: clearing a submission is a decision, not a backdated
|
||||
// transaction, so a date field per row would be extra clicks for no benefit.
|
||||
const data = {
|
||||
approvedDate: this.dateUtils.formatDate(this.settingsService.businessDate, this.settingsService.dateFormat),
|
||||
dateFormat: this.settingsService.dateFormat,
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
this.sharesService
|
||||
.executeSharesAccountCommand(account.shareAccountId, 'approve', data)
|
||||
.subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
rejectShareAccount(account: any): void {
|
||||
const formfields: FormfieldBase[] = [
|
||||
new InputBase({
|
||||
controlName: 'rejectReason',
|
||||
label: 'Reason for rejection',
|
||||
value: '',
|
||||
type: 'text',
|
||||
required: false
|
||||
})
|
||||
];
|
||||
const dialogRef = this.dialog.open(FormDialogComponent, {
|
||||
data: {
|
||||
title: `Reject Share Account ${account.accountNo}`,
|
||||
formfields
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.data) {
|
||||
const data: any = {
|
||||
rejectedDate: this.dateUtils.formatDate(this.settingsService.businessDate, this.settingsService.dateFormat),
|
||||
dateFormat: this.settingsService.dateFormat,
|
||||
locale: this.settingsService.language.code
|
||||
};
|
||||
const reason = response.data.value?.rejectReason?.trim();
|
||||
if (reason) {
|
||||
data.note = reason;
|
||||
}
|
||||
this.sharesService
|
||||
.executeSharesAccountCommand(account.shareAccountId, 'reject', data)
|
||||
.subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
reload() {
|
||||
const url = this.router.url;
|
||||
this.router
|
||||
|
||||
Reference in New Issue
Block a user