Merge branch 'maker-checker' into dev: Product Approval workflow
Brings in the Product Approval feature (anshul.rathore) — a unified Approvals
screen for Loan/Savings/Current/Share/FD/RD/Charge product requests:
- Merges two existing pending-request sources into one list: staged product
edits (m_saving_product_temp, via /{producttype}/pending) and native
maker-checker entries (/makercheckers) for product CREATE/DELETE and
LOANPRODUCT/CHARGE of any action.
- Checker Inbox no longer lists product requests at all — they now live only
in Product Approval, so a checker isn't checking two queues for the same
thing. Clicking a non-product row now navigates straight to that entity's
own view page when one exists, instead of always opening a detail dialog.
- View Checker Inbox dialog gains a caller-supplied heading (used when opened
from Product Approval) and a notice steering staged product edits back to
Product Approval instead of being actioned in place.
- Route renamed pending-savings-products -> product-approval, with the old
path kept as a redirect for existing bookmarks/links.
8 files conflicted with dev's own recent Checker Inbox work (popup-based
detail view, e8097bc2/63134f17) and were resolved by hand, keeping both
sides' real functionality rather than picking one branch wholesale:
- product-edit-diff-dialog.component.{ts,html,scss}: kept dev's diff dialog
(resolves GL account ids to names, aliases fields like currencyCode against
the stored product, normalises the two date shapes the API uses) over
maker-checker's simpler raw-value version.
- pending-savings-products.component.{ts,html}: kept maker-checker's full
isPendingEdit()-based dispatch (dev's version was a strict subset of it).
- view-checker-inbox.component.{ts,html,scss}: kept dev's per-entry Delete
action and maker-checker's recursive Command-payload tree renderer and
custom heading side by side.
Also recovered two regressions the merge introduced silently (no conflict
markers, so `git merge` gave no warning):
- tasks.service.ts lost deleteMakerChecker() entirely — restored.
- Checker Inbox's bulk Delete action (button, deleteChecker()/
bulkDeleteChecker(), and its .cv-btn-delete style) was dropped across three
files — restored to match dev's pre-merge behaviour exactly.
And one duplicate the merge produced without a conflict marker: two
independent viewEntry() implementations landed in checker-inbox.component.ts
(TS2393, caught at build). Kept maker-checker's entity-view-page-routing
version — a superset of dev's dialog-only version — and dropped the duplicate,
along with a leftover diagnostic console.log.
This commit is contained in:
+72
-24
@@ -40,6 +40,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { isProductEntity, isTempTableAccountEdit } from '../../product-entities';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-checker-inbox',
|
||||
@@ -105,27 +106,19 @@ export class CheckerInboxComponent implements OnInit {
|
||||
];
|
||||
|
||||
/**
|
||||
* Entities whose pending edits are gated by our own custom staging tables (m_savings_product_temp
|
||||
* for products, the savings account edit-request table for Nominee/Digital-Feature edits) rather
|
||||
* than the native command-source pipeline. They're excluded from Checker Inbox entirely -
|
||||
* approving/rejecting them here would call the native /makercheckers/{id}?command=approve endpoint,
|
||||
* which replays the original command handler directly and never touches our staging table, leaving
|
||||
* its lock/hold stuck forever. Action them from Approvals -> Pending Product Edits / Pending Account
|
||||
* Edits instead, where that's handled correctly.
|
||||
* The Checker Inbox holds non-product pending requests only. Two groups are routed elsewhere:
|
||||
*
|
||||
* - Product requests of every action (CREATE, UPDATE, DELETE) belong to Approvals -> Product
|
||||
* Approval, which merges them with the product edits staged in m_saving_product_temp so a
|
||||
* checker sees one queue per product rather than two.
|
||||
* - Savings/current account edits are staged the same way as product edits and belong to
|
||||
* Approvals -> Pending Account Edits. Approving them here would call
|
||||
* /makercheckers/{id}?command=approve, which replays the original command handler and never
|
||||
* touches the staging table, leaving its lock held forever.
|
||||
*/
|
||||
private readonly productEditEntities = [
|
||||
'SAVINGSPRODUCT',
|
||||
'CURRENTPRODUCT',
|
||||
'SHAREPRODUCT',
|
||||
'FIXEDDEPOSITPRODUCT',
|
||||
'RECURRINGDEPOSITPRODUCT',
|
||||
'SAVINGSACCOUNT',
|
||||
'CURRENTACCOUNT'
|
||||
];
|
||||
|
||||
private excludeProductEdits(items: any[]): any[] {
|
||||
private excludeRoutedElsewhere(items: any[]): any[] {
|
||||
return (items || []).filter(
|
||||
(item: any) => !(this.productEditEntities.includes(item?.entityName) && item?.actionName === 'UPDATE')
|
||||
(item: any) => !isProductEntity(item?.entityName) && !isTempTableAccountEdit(item?.entityName, item?.actionName)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -142,7 +135,7 @@ export class CheckerInboxComponent implements OnInit {
|
||||
constructor() {
|
||||
this.route.data.subscribe((data: { makerCheckerResource: any; makerCheckerTemplate: any }) => {
|
||||
const raw = data.makerCheckerResource;
|
||||
this.searchData = this.excludeProductEdits(Array.isArray(raw) ? raw : (raw?.pageItems ?? []));
|
||||
this.searchData = this.excludeRoutedElsewhere(Array.isArray(raw) ? raw : (raw?.pageItems ?? []));
|
||||
this.checkerData = this.searchData.length > 0;
|
||||
this.makerCheckerTemplate = data.makerCheckerTemplate ?? {};
|
||||
this.dataSource = new MatTableDataSource(this.searchData);
|
||||
@@ -182,7 +175,7 @@ export class CheckerInboxComponent implements OnInit {
|
||||
makerDateTimeto: this.dateUtils.formatDate(this.makerCheckerSearchForm.value.makerDateTimeto, dateFormat)
|
||||
};
|
||||
this.tasksService.getMakerCheckerData(makerCheckerSearchParams).subscribe((response: any) => {
|
||||
this.searchData = this.excludeProductEdits(response);
|
||||
this.searchData = this.excludeRoutedElsewhere(response);
|
||||
if (this.searchData.length === 0) {
|
||||
this.noSearchedData = true;
|
||||
} else {
|
||||
@@ -290,11 +283,66 @@ export class CheckerInboxComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens one inbox entry in a popup rather than navigating to its own page, so the checker keeps
|
||||
* the list (and any search/filter they set up) behind the dialog. The direct route stays available
|
||||
* for a bookmarked link — ViewCheckerInboxComponent supports both entry points.
|
||||
* Maps a maker-checker entityName to the Angular route path for that entity's existing view page.
|
||||
* Returns null for entity types that have no dedicated view page in this application.
|
||||
*/
|
||||
private entityRoute(entityName: string, resourceId: string | number): string | null {
|
||||
const id = resourceId;
|
||||
switch ((entityName ?? '').toUpperCase()) {
|
||||
case 'LOANPRODUCT':
|
||||
return `/products/loan-products/${id}`;
|
||||
case 'SAVINGSPRODUCT':
|
||||
return `/products/saving-products/${id}`;
|
||||
case 'CURRENTPRODUCT':
|
||||
return `/products/current-products/${id}`;
|
||||
case 'SHAREPRODUCT':
|
||||
return `/products/share-products/${id}`;
|
||||
case 'FIXEDDEPOSITPRODUCT':
|
||||
return `/products/fixed-deposit-products/${id}`;
|
||||
case 'RECURRINGDEPOSITPRODUCT':
|
||||
return `/products/recurring-deposit-products/${id}`;
|
||||
case 'CHARGE':
|
||||
return `/products/charges/${id}`;
|
||||
case 'GLACCOUNT':
|
||||
return `/accounting/chart-of-accounts/gl-accounts/view/${id}`;
|
||||
case 'CLIENT':
|
||||
return `/clients/${id}/general`;
|
||||
case 'LOAN':
|
||||
return `/loans/${id}`;
|
||||
case 'SAVINGSACCOUNT':
|
||||
return `/savings-accounts/${id}`;
|
||||
case 'CURRENTACCOUNT':
|
||||
return `/current-accounts/${id}`;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles a row click in the Checker Inbox.
|
||||
*
|
||||
* Priority:
|
||||
* 1. If the row has a known entityName and a resourceId → navigate to the entity's existing
|
||||
* view page (read-only; no maker-checker action buttons are present on those pages).
|
||||
* 2. If no resourceId is available (e.g. a DELETE action where the entity no longer exists)
|
||||
* → show a brief informational snackbar.
|
||||
* 3. If the entityName is unrecognised → fall back to the existing ViewCheckerInboxComponent
|
||||
* dialog so the checker can still view the command details and action the entry.
|
||||
*/
|
||||
viewEntry(row: any): void {
|
||||
const entityName: string = row.entityName ?? '';
|
||||
const resourceId = row.resourceId;
|
||||
const route = this.entityRoute(entityName, resourceId);
|
||||
|
||||
if (route && resourceId != null) {
|
||||
// Navigate to the existing entity view page (no maker-checker buttons there).
|
||||
this.router.navigate([route]);
|
||||
return;
|
||||
}
|
||||
|
||||
// resourceId is absent (CREATE rows: entity does not exist yet until approved),
|
||||
// or entityName is unmapped — fall back to the detail dialog so the checker
|
||||
// can still view the command payload and action the entry.
|
||||
this.dialog
|
||||
.open(ViewCheckerInboxComponent, {
|
||||
data: { checkerId: row.id },
|
||||
|
||||
+1
-2
@@ -98,8 +98,7 @@ const NATIONALITY_LABELS: Record<string, string> = {
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatIcon,
|
||||
MatPaginatorModule,
|
||||
ClientEditEmailDialogComponent
|
||||
MatPaginatorModule
|
||||
]
|
||||
})
|
||||
export class PendingClientEditsComponent implements OnInit {
|
||||
|
||||
+22
-3
@@ -11,7 +11,12 @@
|
||||
<div class="psp-action-bar">
|
||||
<mat-form-field appearance="outline" class="psp-search-field">
|
||||
<mat-icon matPrefix>search</mat-icon>
|
||||
<input #filterInput matInput placeholder="Search by product name" (keyup)="applyFilter(filterInput.value)" />
|
||||
<input
|
||||
#filterInput
|
||||
matInput
|
||||
placeholder="Search by product name, type or request"
|
||||
(keyup)="applyFilter(filterInput.value)"
|
||||
/>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
@@ -20,7 +25,16 @@
|
||||
<ng-container matColumnDef="productType">
|
||||
<th mat-header-cell *matHeaderCellDef>Type</th>
|
||||
<td mat-cell *matCellDef="let edit">
|
||||
<span class="status-badge status-badge--type">{{ edit.productType }}</span>
|
||||
<span class="status-badge status-badge--type">{{ productTypeLabel(edit.productType) }}</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="actionName">
|
||||
<th mat-header-cell *matHeaderCellDef>Request</th>
|
||||
<td mat-cell *matCellDef="let edit">
|
||||
<span class="status-badge status-badge--action" [class.status-badge--delete]="edit.actionName === 'DELETE'">
|
||||
{{ edit.actionName }}
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
@@ -55,7 +69,12 @@
|
||||
[disabled]="loadingDiffFor === edit"
|
||||
(click)="viewDiff(edit)"
|
||||
>
|
||||
<fa-icon icon="eye" class="m-r-10"></fa-icon>{{ loadingDiffFor === edit ? 'Loading…' : 'Compare' }}
|
||||
<fa-icon icon="eye" class="m-r-10"></fa-icon>
|
||||
@if (loadingDiffFor === edit) {
|
||||
Loading…
|
||||
} @else {
|
||||
{{ isPendingEdit(edit) ? 'Compare' : 'View' }}
|
||||
}
|
||||
</button>
|
||||
<button mat-stroked-button class="psp-btn psp-btn-approve" (click)="approve(edit)">
|
||||
<fa-icon icon="check" class="m-r-10"></fa-icon>Approve
|
||||
|
||||
+41
-6
@@ -45,8 +45,16 @@ $text-muted: #64748b;
|
||||
border-color: #2563eb;
|
||||
color: #2563eb;
|
||||
|
||||
&:hover {
|
||||
background: #eff6ff;
|
||||
&:not(:disabled) {
|
||||
--mat-button-outlined-outline-color: #2563eb;
|
||||
--mat-button-outlined-label-text-color: #2563eb;
|
||||
|
||||
border-color: #2563eb !important;
|
||||
color: #2563eb !important;
|
||||
|
||||
&:hover {
|
||||
background: #eff6ff !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +62,16 @@ $text-muted: #64748b;
|
||||
border-color: #16a34a;
|
||||
color: #16a34a;
|
||||
|
||||
&:hover {
|
||||
background: #f0fdf4;
|
||||
&:not(:disabled) {
|
||||
--mat-button-outlined-outline-color: #16a34a;
|
||||
--mat-button-outlined-label-text-color: #16a34a;
|
||||
|
||||
border-color: #16a34a !important;
|
||||
color: #16a34a !important;
|
||||
|
||||
&:hover {
|
||||
background: #f0fdf4 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,8 +79,16 @@ $text-muted: #64748b;
|
||||
border-color: #dc2626;
|
||||
color: #dc2626;
|
||||
|
||||
&:hover {
|
||||
background: #fef2f2;
|
||||
&:not(:disabled) {
|
||||
--mat-button-outlined-outline-color: #dc2626;
|
||||
--mat-button-outlined-label-text-color: #dc2626;
|
||||
|
||||
border-color: #dc2626 !important;
|
||||
color: #dc2626 !important;
|
||||
|
||||
&:hover {
|
||||
background: #fef2f2 !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +109,17 @@ $text-muted: #64748b;
|
||||
background: #e0e7ff;
|
||||
color: #3730a3;
|
||||
}
|
||||
|
||||
&--action {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
// DELETE is the one irreversible request in this table, so it reads red rather than green.
|
||||
&--delete {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
|
||||
+80
-12
@@ -26,12 +26,15 @@ import { MatIcon } from '@angular/material/icon';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
|
||||
import { ProductsService } from 'app/products/products.service';
|
||||
import { TasksService } from '../../tasks.service';
|
||||
import { ProductEditDiffDialogComponent } from './product-edit-diff-dialog/product-edit-diff-dialog.component';
|
||||
import { ViewCheckerInboxComponent } from '../../view-checker-inbox/view-checker-inbox.component';
|
||||
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 { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { productTypeDisplayLabel } from '../../product-entities';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-pending-savings-products',
|
||||
@@ -58,12 +61,14 @@ export class PendingSavingsProductsComponent {
|
||||
private router = inject(Router);
|
||||
private dialog = inject(MatDialog);
|
||||
private productsService = inject(ProductsService);
|
||||
private tasksService = inject(TasksService);
|
||||
|
||||
dataSource: MatTableDataSource<any>;
|
||||
showData = false;
|
||||
|
||||
displayedColumns: string[] = [
|
||||
'productType',
|
||||
'actionName',
|
||||
'savingsProductName',
|
||||
'makerUsername',
|
||||
'createdOn',
|
||||
@@ -86,6 +91,14 @@ export class PendingSavingsProductsComponent {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Label for the Type column. Display only — the row's own `productType` is left untouched, so the
|
||||
* endpoint switches, filtering and approve/reject paths below still see the original value.
|
||||
*/
|
||||
productTypeLabel(productType: string): string {
|
||||
return productTypeDisplayLabel(productType);
|
||||
}
|
||||
|
||||
formatDate(date: any): string {
|
||||
if (!date) return '';
|
||||
const d = Array.isArray(date)
|
||||
@@ -144,17 +157,48 @@ export class PendingSavingsProductsComponent {
|
||||
}
|
||||
}
|
||||
|
||||
viewDiff(edit: any): void {
|
||||
this.loadingDiffFor = edit;
|
||||
this.getOriginalProduct$(edit).subscribe({
|
||||
/**
|
||||
* A staged edit (m_saving_product_temp) is approved through the product's own
|
||||
* /{producttype}/{id}/approve endpoint; a native maker-checker entry through
|
||||
* /makercheckers/{id}?command=approve. Crossing the two would leave the staged edit's lock in place,
|
||||
* so every action below dispatches on this.
|
||||
*/
|
||||
isPendingEdit(row: any): boolean {
|
||||
return row?.source === 'PENDING_EDIT';
|
||||
}
|
||||
|
||||
/**
|
||||
* A staged edit is diffed against the live product. A maker-checker entry has no staged row to diff
|
||||
* - and on CREATE no product exists yet - so it opens the existing command-detail dialog, which
|
||||
* renders the submitted payload and can action the entry itself.
|
||||
*/
|
||||
viewDiff(row: any): void {
|
||||
if (!this.isPendingEdit(row)) {
|
||||
this.dialog
|
||||
.open(ViewCheckerInboxComponent, {
|
||||
// Same dialog as the Checker Inbox, titled for the tab it was opened from.
|
||||
data: { checkerId: row.id, title: 'Product Approval Details' },
|
||||
autoFocus: false
|
||||
})
|
||||
.afterClosed()
|
||||
.subscribe((result: any) => {
|
||||
if (result?.refreshed) {
|
||||
this.reload();
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingDiffFor = row;
|
||||
this.getOriginalProduct$(row).subscribe({
|
||||
next: (original: any) => {
|
||||
this.loadingDiffFor = null;
|
||||
this.dialog.open(ProductEditDiffDialogComponent, {
|
||||
width: '820px',
|
||||
data: {
|
||||
productName: edit.savingsProductName,
|
||||
productName: row.savingsProductName,
|
||||
original: original ?? {},
|
||||
proposed: edit.proposedChanges ?? {}
|
||||
proposed: row.proposedChanges ?? {}
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -168,22 +212,46 @@ export class PendingSavingsProductsComponent {
|
||||
this.loadingDiffFor = null;
|
||||
}
|
||||
|
||||
approve(edit: any): void {
|
||||
approve(row: any): void {
|
||||
const isEdit = this.isPendingEdit(row);
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: 'Approve Savings Product Edit',
|
||||
dialogContext: `Apply the pending edit to "${edit.savingsProductName}"? This cannot be undone.`,
|
||||
heading: isEdit ? 'Approve Product Edit' : `Approve Product ${row.actionName}`,
|
||||
dialogContext: isEdit
|
||||
? `Apply the pending edit to "${row.savingsProductName}"? This cannot be undone.`
|
||||
: `Approve the pending ${row.actionName} request for "${row.savingsProductName}"? This cannot be undone.`,
|
||||
type: 'basic'
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
this.approveEdit$(edit).subscribe(() => this.reload());
|
||||
const request$ = isEdit
|
||||
? this.approveEdit$(row)
|
||||
: this.tasksService.executeMakerCheckerAction(row.id, 'approve');
|
||||
request$.subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
reject(edit: any): void {
|
||||
reject(row: any): void {
|
||||
if (!this.isPendingEdit(row)) {
|
||||
// The native /makercheckers reject endpoint takes no payload, so there is nowhere to store a
|
||||
// reason - ask for plain confirmation rather than collecting text that would be discarded.
|
||||
const confirmRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: {
|
||||
heading: `Reject Product ${row.actionName}`,
|
||||
dialogContext: `Reject the pending ${row.actionName} request for "${row.savingsProductName}"?`,
|
||||
type: 'basic'
|
||||
}
|
||||
});
|
||||
confirmRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.confirm) {
|
||||
this.tasksService.executeMakerCheckerAction(row.id, 'reject').subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const formfields: FormfieldBase[] = [
|
||||
new InputBase({
|
||||
controlName: 'rejectReason',
|
||||
@@ -195,7 +263,7 @@ export class PendingSavingsProductsComponent {
|
||||
];
|
||||
const dialogRef = this.dialog.open(FormDialogComponent, {
|
||||
data: {
|
||||
title: `Reject edit for "${edit.savingsProductName}"`,
|
||||
title: `Reject edit for "${row.savingsProductName}"`,
|
||||
layout: { addButtonText: 'Reject' },
|
||||
formfields
|
||||
}
|
||||
@@ -203,7 +271,7 @@ export class PendingSavingsProductsComponent {
|
||||
dialogRef.afterClosed().subscribe((response: any) => {
|
||||
if (response?.data) {
|
||||
const rejectReason = response.data.value.rejectReason || '';
|
||||
this.rejectEdit$(edit, rejectReason).subscribe(() => this.reload());
|
||||
this.rejectEdit$(row, rejectReason).subscribe(() => this.reload());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
styleUrls: ['./rejected-account.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
|
||||
-1
@@ -31,7 +31,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
styleUrls: ['./terminated-account.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
FaIconComponent,
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
|
||||
Reference in New Issue
Block a user