feat: implement product approval workflow updates
This commit is contained in:
@@ -59,6 +59,10 @@ export class DateFormatPipe implements PipeTransform, OnDestroy {
|
|||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
// Backend sometimes returns [yyyy, MM, dd]
|
// Backend sometimes returns [yyyy, MM, dd]
|
||||||
dateVal = moment(value.join('-'), 'YYYY-MM-DD');
|
dateVal = moment(value.join('-'), 'YYYY-MM-DD');
|
||||||
|
} else if (typeof value === 'number' && value < 1e12) {
|
||||||
|
// Unix timestamp in seconds (e.g. /makercheckers madeOnDate).
|
||||||
|
// moment(seconds) would treat it as milliseconds → 1970; use moment.unix() instead.
|
||||||
|
dateVal = moment.unix(value);
|
||||||
} else {
|
} else {
|
||||||
dateVal = moment(value);
|
dateVal = moment(value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Submitting a savings product update (above) puts it in the pending-approval temp table instead of
|
* Submitting a savings product update (above) puts it in the pending-approval temp table instead of
|
||||||
* applying it directly. These calls drive the Approvals -> Pending Savings Product Edits screen.
|
* applying it directly. These calls drive the Approvals -> Product Approval screen.
|
||||||
*/
|
*/
|
||||||
getPendingSavingsProductEdits(): Observable<any> {
|
getPendingSavingsProductEdits(): Observable<any> {
|
||||||
return this.http.get('/savingsproducts/pending');
|
return this.http.get('/savingsproducts/pending');
|
||||||
@@ -124,7 +124,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Submitting a current product update (above) puts it in the pending-approval temp table instead of
|
* Submitting a current product update (above) puts it in the pending-approval temp table instead of
|
||||||
* applying it directly. These calls drive the Approvals -> Pending Product Edits screen.
|
* applying it directly. These calls drive the Approvals -> Product Approval screen.
|
||||||
*/
|
*/
|
||||||
getPendingCurrentProductEdits(): Observable<any> {
|
getPendingCurrentProductEdits(): Observable<any> {
|
||||||
return this.http.get('/currentproducts/pending');
|
return this.http.get('/currentproducts/pending');
|
||||||
@@ -168,7 +168,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Submitting a share product update (above) puts it in the pending-approval temp table instead of
|
* Submitting a share product update (above) puts it in the pending-approval temp table instead of
|
||||||
* applying it directly. These calls drive the Approvals -> Pending Product Edits screen.
|
* applying it directly. These calls drive the Approvals -> Product Approval screen.
|
||||||
*/
|
*/
|
||||||
getPendingShareProductEdits(): Observable<any> {
|
getPendingShareProductEdits(): Observable<any> {
|
||||||
return this.http.get('/products/share/pending');
|
return this.http.get('/products/share/pending');
|
||||||
@@ -313,7 +313,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Submitting a fixed deposit product update (above) puts it in the pending-approval temp table instead of
|
* Submitting a fixed deposit product update (above) puts it in the pending-approval temp table instead of
|
||||||
* applying it directly. These calls drive the Approvals -> Pending Product Edits screen.
|
* applying it directly. These calls drive the Approvals -> Product Approval screen.
|
||||||
*/
|
*/
|
||||||
getPendingFixedDepositProductEdits(): Observable<any> {
|
getPendingFixedDepositProductEdits(): Observable<any> {
|
||||||
return this.http.get('/fixeddepositproducts/pending');
|
return this.http.get('/fixeddepositproducts/pending');
|
||||||
@@ -608,7 +608,7 @@ export class ProductsService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Submitting a recurring deposit product update (above) puts it in the pending-approval temp table instead of
|
* Submitting a recurring deposit product update (above) puts it in the pending-approval temp table instead of
|
||||||
* applying it directly. These calls drive the Approvals -> Pending Product Edits screen.
|
* applying it directly. These calls drive the Approvals -> Product Approval screen.
|
||||||
*/
|
*/
|
||||||
getPendingRecurringDepositProductEdits(): Observable<any> {
|
getPendingRecurringDepositProductEdits(): Observable<any> {
|
||||||
return this.http.get('/recurringdepositproducts/pending');
|
return this.http.get('/recurringdepositproducts/pending');
|
||||||
|
|||||||
-1
@@ -27,7 +27,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
NgClass,
|
|
||||||
TransactionPaymentDetailComponent,
|
TransactionPaymentDetailComponent,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
DateFormatPipe
|
DateFormatPipe
|
||||||
|
|||||||
-1
@@ -60,7 +60,6 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
DatetimeFormatPipe,
|
DatetimeFormatPipe,
|
||||||
FormatNumberPipe,
|
FormatNumberPipe,
|
||||||
YesnoPipe,
|
|
||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatTooltipModule
|
MatTooltipModule
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -20,9 +20,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
templateUrl: './file-upload.component.html',
|
templateUrl: './file-upload.component.html',
|
||||||
styleUrls: ['./file-upload.component.scss'],
|
styleUrls: ['./file-upload.component.scss'],
|
||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS
|
||||||
NgStyle,
|
|
||||||
FaIconComponent
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class FileUploadComponent implements OnInit {
|
export class FileUploadComponent implements OnInit {
|
||||||
|
|||||||
@@ -42,10 +42,8 @@ import { MatOption } from '@angular/material/core';
|
|||||||
MatDialogContent,
|
MatDialogContent,
|
||||||
MatDialogActions,
|
MatDialogActions,
|
||||||
MatDialogClose,
|
MatDialogClose,
|
||||||
MatDivider,
|
|
||||||
MatButton,
|
MatButton,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
NgClass,
|
|
||||||
MatIcon,
|
MatIcon,
|
||||||
MatFormField,
|
MatFormField,
|
||||||
MatLabel,
|
MatLabel,
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ import { take } from 'rxjs/operators';
|
|||||||
FormsModule,
|
FormsModule,
|
||||||
MatFormField,
|
MatFormField,
|
||||||
MatLabel,
|
MatLabel,
|
||||||
MatInput,
|
MatInput
|
||||||
MatError
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class InlineCreateShortcutDialogComponent {
|
export class InlineCreateShortcutDialogComponent {
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ import { SponsorDDReconciliationService } from '../sponsor-dd-reconciliation.ser
|
|||||||
MatCardModule,
|
MatCardModule,
|
||||||
MatTableModule,
|
MatTableModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule
|
||||||
FaIconComponent
|
|
||||||
],
|
],
|
||||||
templateUrl: './reco-batch-list.component.html',
|
templateUrl: './reco-batch-list.component.html',
|
||||||
styles: [
|
styles: [
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ import { SponsorDDService } from '../sponsor-dd.service';
|
|||||||
MatTableModule,
|
MatTableModule,
|
||||||
MatButtonModule,
|
MatButtonModule,
|
||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule
|
||||||
FaIconComponent
|
|
||||||
],
|
],
|
||||||
templateUrl: './dd-inventory-list.component.html',
|
templateUrl: './dd-inventory-list.component.html',
|
||||||
styles: [
|
styles: [
|
||||||
|
|||||||
@@ -39,8 +39,7 @@ import { SponsorDDService } from '../sponsor-dd.service';
|
|||||||
MatDialogModule,
|
MatDialogModule,
|
||||||
MatSnackBarModule,
|
MatSnackBarModule,
|
||||||
MatFormFieldModule,
|
MatFormFieldModule,
|
||||||
MatInputModule,
|
MatInputModule
|
||||||
FaIconComponent
|
|
||||||
],
|
],
|
||||||
templateUrl: './dd-list.component.html',
|
templateUrl: './dd-list.component.html',
|
||||||
styles: [
|
styles: [
|
||||||
|
|||||||
+1
-4
@@ -7,7 +7,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="cv-tab-content">
|
<div class="cv-tab-content">
|
||||||
<!-- Action bar (search + advanced toggle + Approve/Delete/Reject) — only
|
<!-- Action bar (search + advanced toggle + Approve/Reject) — only
|
||||||
rendered when there's actual data to work with. An empty inbox shows
|
rendered when there's actual data to work with. An empty inbox shows
|
||||||
the friendly empty-state block below without these controls. -->
|
the friendly empty-state block below without these controls. -->
|
||||||
@if (checkerData) {
|
@if (checkerData) {
|
||||||
@@ -37,9 +37,6 @@
|
|||||||
<button mat-stroked-button class="cv-btn cv-btn-approve" (click)="approveChecker()">
|
<button mat-stroked-button class="cv-btn cv-btn-approve" (click)="approveChecker()">
|
||||||
<fa-icon icon="check" class="m-r-10"></fa-icon>{{ 'labels.buttons.Approve' | translate }}
|
<fa-icon icon="check" class="m-r-10"></fa-icon>{{ 'labels.buttons.Approve' | translate }}
|
||||||
</button>
|
</button>
|
||||||
<button mat-stroked-button class="cv-btn cv-btn-delete" (click)="deleteChecker()">
|
|
||||||
<fa-icon icon="trash" class="m-r-10"></fa-icon>{{ 'labels.buttons.Delete' | translate }}
|
|
||||||
</button>
|
|
||||||
<button mat-stroked-button class="cv-btn cv-btn-reject" (click)="rejectChecker()">
|
<button mat-stroked-button class="cv-btn cv-btn-reject" (click)="rejectChecker()">
|
||||||
<fa-icon icon="times" class="m-r-10"></fa-icon>{{ 'labels.buttons.Reject' | translate }}
|
<fa-icon icon="times" class="m-r-10"></fa-icon>{{ 'labels.buttons.Reject' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -112,15 +112,6 @@ $text-muted: #64748b;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.cv-btn-delete {
|
|
||||||
border-color: #dc2626;
|
|
||||||
color: #dc2626;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: #fef2f2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.cv-btn-reject {
|
.cv-btn-reject {
|
||||||
border-color: #64748b;
|
border-color: #64748b;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
|
|||||||
+100
-48
@@ -33,12 +33,14 @@ import { SettingsService } from 'app/settings/settings.service';
|
|||||||
|
|
||||||
/** Dialog Components */
|
/** Dialog Components */
|
||||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||||
|
import { ViewCheckerInboxComponent } from '../../view-checker-inbox/view-checker-inbox.component';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { MatCheckbox } from '@angular/material/checkbox';
|
import { MatCheckbox } from '@angular/material/checkbox';
|
||||||
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { isProductEntity, isTempTableAccountEdit } from '../../product-entities';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-checker-inbox',
|
selector: 'mifosx-checker-inbox',
|
||||||
@@ -104,27 +106,19 @@ export class CheckerInboxComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entities whose pending edits are gated by our own custom staging tables (m_savings_product_temp
|
* The Checker Inbox holds non-product pending requests only. Two groups are routed elsewhere:
|
||||||
* 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 -
|
* - Product requests of every action (CREATE, UPDATE, DELETE) belong to Approvals -> Product
|
||||||
* approving/rejecting them here would call the native /makercheckers/{id}?command=approve endpoint,
|
* Approval, which merges them with the product edits staged in m_saving_product_temp so a
|
||||||
* which replays the original command handler directly and never touches our staging table, leaving
|
* checker sees one queue per product rather than two.
|
||||||
* its lock/hold stuck forever. Action them from Approvals -> Pending Product Edits / Pending Account
|
* - Savings/current account edits are staged the same way as product edits and belong to
|
||||||
* Edits instead, where that's handled correctly.
|
* 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 = [
|
private excludeRoutedElsewhere(items: any[]): any[] {
|
||||||
'SAVINGSPRODUCT',
|
|
||||||
'CURRENTPRODUCT',
|
|
||||||
'SHAREPRODUCT',
|
|
||||||
'FIXEDDEPOSITPRODUCT',
|
|
||||||
'RECURRINGDEPOSITPRODUCT',
|
|
||||||
'SAVINGSACCOUNT',
|
|
||||||
'CURRENTACCOUNT'
|
|
||||||
];
|
|
||||||
|
|
||||||
private excludeProductEdits(items: any[]): any[] {
|
|
||||||
return (items || []).filter(
|
return (items || []).filter(
|
||||||
(item: any) => !(this.productEditEntities.includes(item?.entityName) && item?.actionName === 'UPDATE')
|
(item: any) => !isProductEntity(item?.entityName) && !isTempTableAccountEdit(item?.entityName, item?.actionName)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +135,7 @@ export class CheckerInboxComponent implements OnInit {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.route.data.subscribe((data: { makerCheckerResource: any; makerCheckerTemplate: any }) => {
|
this.route.data.subscribe((data: { makerCheckerResource: any; makerCheckerTemplate: any }) => {
|
||||||
const raw = data.makerCheckerResource;
|
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.checkerData = this.searchData.length > 0;
|
||||||
this.makerCheckerTemplate = data.makerCheckerTemplate ?? {};
|
this.makerCheckerTemplate = data.makerCheckerTemplate ?? {};
|
||||||
this.dataSource = new MatTableDataSource(this.searchData);
|
this.dataSource = new MatTableDataSource(this.searchData);
|
||||||
@@ -181,7 +175,7 @@ export class CheckerInboxComponent implements OnInit {
|
|||||||
makerDateTimeto: this.dateUtils.formatDate(this.makerCheckerSearchForm.value.makerDateTimeto, dateFormat)
|
makerDateTimeto: this.dateUtils.formatDate(this.makerCheckerSearchForm.value.makerDateTimeto, dateFormat)
|
||||||
};
|
};
|
||||||
this.tasksService.getMakerCheckerData(makerCheckerSearchParams).subscribe((response: any) => {
|
this.tasksService.getMakerCheckerData(makerCheckerSearchParams).subscribe((response: any) => {
|
||||||
this.searchData = this.excludeProductEdits(response);
|
this.searchData = this.excludeRoutedElsewhere(response);
|
||||||
if (this.searchData.length === 0) {
|
if (this.searchData.length === 0) {
|
||||||
this.noSearchedData = true;
|
this.noSearchedData = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -242,20 +236,6 @@ export class CheckerInboxComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteChecker() {
|
|
||||||
const deleteCheckerDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
||||||
data: {
|
|
||||||
heading: this.translateService.instant('labels.heading.Delete Checker'),
|
|
||||||
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to delete checker')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
deleteCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
|
||||||
if (response.confirm) {
|
|
||||||
this.bulkDeleteChecker();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
bulkCheckerApproveorReject(action: any) {
|
bulkCheckerApproveorReject(action: any) {
|
||||||
const selectedAccounts = this.selection.selected.length;
|
const selectedAccounts = this.selection.selected.length;
|
||||||
const listSelectedAccounts = this.selection.selected;
|
const listSelectedAccounts = this.selection.selected;
|
||||||
@@ -270,22 +250,94 @@ export class CheckerInboxComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bulkDeleteChecker() {
|
applyFilter(filterValue: string = '') {
|
||||||
const selectedAccounts = this.selection.selected.length;
|
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||||
const listSelectedAccounts = this.selection.selected;
|
}
|
||||||
let approvedAccounts = 0;
|
|
||||||
listSelectedAccounts.forEach((element: any) => {
|
/**
|
||||||
this.tasksService.deleteMakerChecker(element.id).subscribe((response: any) => {
|
* Maps a maker-checker entityName to the Angular route path for that entity's existing view page.
|
||||||
approvedAccounts++;
|
* Returns null for entity types that have no dedicated view page in this application.
|
||||||
if (selectedAccounts === approvedAccounts) {
|
*/
|
||||||
|
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);
|
||||||
|
|
||||||
|
// DIAGNOSTIC — open browser DevTools console to confirm the row payload.
|
||||||
|
// Remove after confirming root cause.
|
||||||
|
console.log('[CheckerInbox] viewEntry row =', {
|
||||||
|
id: row.id,
|
||||||
|
entityName,
|
||||||
|
actionName: row.actionName,
|
||||||
|
resourceId,
|
||||||
|
resolvedRoute: route
|
||||||
|
});
|
||||||
|
|
||||||
|
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 },
|
||||||
|
autoFocus: false
|
||||||
|
})
|
||||||
|
.afterClosed()
|
||||||
|
.subscribe((result: any) => {
|
||||||
|
// Only reload when something was actually actioned — a plain close must not throw away the
|
||||||
|
// checker's current search, which reload() does by re-navigating the route.
|
||||||
|
if (result?.refreshed) {
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
applyFilter(filterValue: string = '') {
|
|
||||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-2
@@ -98,8 +98,7 @@ const NATIONALITY_LABELS: Record<string, string> = {
|
|||||||
MatRowDef,
|
MatRowDef,
|
||||||
MatRow,
|
MatRow,
|
||||||
MatIcon,
|
MatIcon,
|
||||||
MatPaginatorModule,
|
MatPaginatorModule
|
||||||
ClientEditEmailDialogComponent
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class PendingClientEditsComponent implements OnInit {
|
export class PendingClientEditsComponent implements OnInit {
|
||||||
|
|||||||
+28
-4
@@ -11,7 +11,12 @@
|
|||||||
<div class="psp-action-bar">
|
<div class="psp-action-bar">
|
||||||
<mat-form-field appearance="outline" class="psp-search-field">
|
<mat-form-field appearance="outline" class="psp-search-field">
|
||||||
<mat-icon matPrefix>search</mat-icon>
|
<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>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -20,7 +25,16 @@
|
|||||||
<ng-container matColumnDef="productType">
|
<ng-container matColumnDef="productType">
|
||||||
<th mat-header-cell *matHeaderCellDef>Type</th>
|
<th mat-header-cell *matHeaderCellDef>Type</th>
|
||||||
<td mat-cell *matCellDef="let edit">
|
<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>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
@@ -49,8 +63,18 @@
|
|||||||
<ng-container matColumnDef="actions">
|
<ng-container matColumnDef="actions">
|
||||||
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
<th mat-header-cell *matHeaderCellDef>Actions</th>
|
||||||
<td mat-cell *matCellDef="let edit">
|
<td mat-cell *matCellDef="let edit">
|
||||||
<button mat-stroked-button class="psp-btn psp-btn-view" (click)="viewDiff(edit)">
|
<button
|
||||||
<fa-icon icon="eye" class="m-r-10"></fa-icon>Compare
|
mat-stroked-button
|
||||||
|
class="psp-btn psp-btn-view"
|
||||||
|
[disabled]="loadingDiffFor === edit"
|
||||||
|
(click)="viewDiff(edit)"
|
||||||
|
>
|
||||||
|
<fa-icon icon="eye" class="m-r-10"></fa-icon>
|
||||||
|
@if (loadingDiffFor === edit) {
|
||||||
|
Loading…
|
||||||
|
} @else {
|
||||||
|
{{ isPendingEdit(edit) ? 'Compare' : 'View' }}
|
||||||
|
}
|
||||||
</button>
|
</button>
|
||||||
<button mat-stroked-button class="psp-btn psp-btn-approve" (click)="approve(edit)">
|
<button mat-stroked-button class="psp-btn psp-btn-approve" (click)="approve(edit)">
|
||||||
<fa-icon icon="check" class="m-r-10"></fa-icon>Approve
|
<fa-icon icon="check" class="m-r-10"></fa-icon>Approve
|
||||||
|
|||||||
+11
@@ -85,6 +85,17 @@ $text-muted: #64748b;
|
|||||||
background: #e0e7ff;
|
background: #e0e7ff;
|
||||||
color: #3730a3;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.psp-diff-panel {
|
.psp-diff-panel {
|
||||||
|
|||||||
+95
-23
@@ -27,11 +27,15 @@ import { MatIconButton } from '@angular/material/button';
|
|||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
|
||||||
import { ProductsService } from 'app/products/products.service';
|
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 { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||||
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
|
||||||
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { productTypeDisplayLabel } from '../../product-entities';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-pending-savings-products',
|
selector: 'mifosx-pending-savings-products',
|
||||||
@@ -59,12 +63,14 @@ export class PendingSavingsProductsComponent {
|
|||||||
private router = inject(Router);
|
private router = inject(Router);
|
||||||
private dialog = inject(MatDialog);
|
private dialog = inject(MatDialog);
|
||||||
private productsService = inject(ProductsService);
|
private productsService = inject(ProductsService);
|
||||||
|
private tasksService = inject(TasksService);
|
||||||
|
|
||||||
dataSource: MatTableDataSource<any>;
|
dataSource: MatTableDataSource<any>;
|
||||||
showData = false;
|
showData = false;
|
||||||
|
|
||||||
displayedColumns: string[] = [
|
displayedColumns: string[] = [
|
||||||
'productType',
|
'productType',
|
||||||
|
'actionName',
|
||||||
'savingsProductName',
|
'savingsProductName',
|
||||||
'makerUsername',
|
'makerUsername',
|
||||||
'createdOn',
|
'createdOn',
|
||||||
@@ -76,6 +82,9 @@ export class PendingSavingsProductsComponent {
|
|||||||
originalProduct: any = null;
|
originalProduct: any = null;
|
||||||
diffRows: { label: string; original: any; proposed: any; changed: boolean }[] = [];
|
diffRows: { label: string; original: any; proposed: any; changed: boolean }[] = [];
|
||||||
|
|
||||||
|
/** Tracks which row currently has a diff loading in progress, to show a spinner on that row. */
|
||||||
|
loadingDiffFor: any = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.route.data.subscribe((data: { pendingSavingsProductsData: any }) => {
|
this.route.data.subscribe((data: { pendingSavingsProductsData: any }) => {
|
||||||
const items = data.pendingSavingsProductsData || [];
|
const items = data.pendingSavingsProductsData || [];
|
||||||
@@ -88,6 +97,14 @@ export class PendingSavingsProductsComponent {
|
|||||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
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 {
|
formatDate(date: any): string {
|
||||||
if (!date) return '';
|
if (!date) return '';
|
||||||
const d = Array.isArray(date)
|
const d = Array.isArray(date)
|
||||||
@@ -141,23 +158,54 @@ export class PendingSavingsProductsComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
viewDiff(edit: any): void {
|
/**
|
||||||
this.selectedEdit = edit;
|
* A staged edit (m_saving_product_temp) is approved through the product's own
|
||||||
this.diffRows = [];
|
* /{producttype}/{id}/approve endpoint; a native maker-checker entry through
|
||||||
this.getOriginalProduct$(edit).subscribe((original: any) => {
|
* /makercheckers/{id}?command=approve. Crossing the two would leave the staged edit's lock in place,
|
||||||
this.originalProduct = original;
|
* so every action below dispatches on this.
|
||||||
const proposed = edit.proposedChanges || {};
|
*/
|
||||||
const keys = Object.keys(proposed);
|
isPendingEdit(row: any): boolean {
|
||||||
this.diffRows = keys.map((key) => {
|
return row?.source === 'PENDING_EDIT';
|
||||||
const originalValue = original ? original[key] : undefined;
|
}
|
||||||
const proposedValue = proposed[key];
|
|
||||||
return {
|
/**
|
||||||
label: key,
|
* A staged edit is diffed against the live product. A maker-checker entry has no staged row to diff
|
||||||
original: originalValue,
|
* - and on CREATE no product exists yet - so it opens the existing command-detail dialog, which
|
||||||
proposed: proposedValue,
|
* renders the submitted payload and can action the entry itself.
|
||||||
changed: JSON.stringify(originalValue) !== JSON.stringify(proposedValue)
|
*/
|
||||||
};
|
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: row.savingsProductName,
|
||||||
|
original: original ?? {},
|
||||||
|
proposed: row.proposedChanges ?? {}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.loadingDiffFor = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,22 +215,46 @@ export class PendingSavingsProductsComponent {
|
|||||||
this.diffRows = [];
|
this.diffRows = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
approve(edit: any): void {
|
approve(row: any): void {
|
||||||
|
const isEdit = this.isPendingEdit(row);
|
||||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
heading: 'Approve Savings Product Edit',
|
heading: isEdit ? 'Approve Product Edit' : `Approve Product ${row.actionName}`,
|
||||||
dialogContext: `Apply the pending edit to "${edit.savingsProductName}"? This cannot be undone.`,
|
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'
|
type: 'basic'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe((response: any) => {
|
dialogRef.afterClosed().subscribe((response: any) => {
|
||||||
if (response?.confirm) {
|
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[] = [
|
const formfields: FormfieldBase[] = [
|
||||||
new InputBase({
|
new InputBase({
|
||||||
controlName: 'rejectReason',
|
controlName: 'rejectReason',
|
||||||
@@ -194,7 +266,7 @@ export class PendingSavingsProductsComponent {
|
|||||||
];
|
];
|
||||||
const dialogRef = this.dialog.open(FormDialogComponent, {
|
const dialogRef = this.dialog.open(FormDialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
title: `Reject edit for "${edit.savingsProductName}"`,
|
title: `Reject edit for "${row.savingsProductName}"`,
|
||||||
layout: { addButtonText: 'Reject' },
|
layout: { addButtonText: 'Reject' },
|
||||||
formfields
|
formfields
|
||||||
}
|
}
|
||||||
@@ -202,7 +274,7 @@ export class PendingSavingsProductsComponent {
|
|||||||
dialogRef.afterClosed().subscribe((response: any) => {
|
dialogRef.afterClosed().subscribe((response: any) => {
|
||||||
if (response?.data) {
|
if (response?.data) {
|
||||||
const rejectReason = response.data.value.rejectReason || '';
|
const rejectReason = response.data.value.rejectReason || '';
|
||||||
this.rejectEdit$(edit, rejectReason).subscribe(() => this.reload());
|
this.rejectEdit$(row, rejectReason).subscribe(() => this.reload());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
<!--
|
||||||
|
Copyright since 2025 Mifos Initiative
|
||||||
|
|
||||||
|
This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<div class="diff-dialog">
|
||||||
|
<!-- Header -->
|
||||||
|
<div class="diff-header" mat-dialog-title>
|
||||||
|
<div class="diff-header__title">
|
||||||
|
<span class="diff-header__icon">⊕</span>
|
||||||
|
Product Edit Diff
|
||||||
|
<span class="diff-header__name">{{ data.productName }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="diff-header__meta">
|
||||||
|
<span class="diff-badge" [ngClass]="changedCount > 0 ? 'diff-badge--changed' : 'diff-badge--none'">
|
||||||
|
{{ changedCount }} field{{ changedCount !== 1 ? 's' : '' }} changed
|
||||||
|
</span>
|
||||||
|
<button class="diff-toggle" (click)="showChangedOnly = !showChangedOnly">
|
||||||
|
{{ showChangedOnly ? 'Show All' : 'Changed Only' }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Body -->
|
||||||
|
<mat-dialog-content class="diff-body">
|
||||||
|
<table class="diff-table" *ngIf="visibleRows.length > 0; else noRows">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th class="diff-table__label">Field</th>
|
||||||
|
<th class="diff-table__val diff-table__val--orig">Current</th>
|
||||||
|
<th class="diff-table__val diff-table__val--prop">Proposed</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr *ngFor="let row of visibleRows" [ngClass]="{ 'diff-row--changed': row.changed }">
|
||||||
|
<td class="diff-table__label">{{ row.label }}</td>
|
||||||
|
<td class="diff-table__val diff-table__val--orig">{{ row.original }}</td>
|
||||||
|
<td class="diff-table__val diff-table__val--prop">
|
||||||
|
<span *ngIf="row.changed" class="diff-new">{{ row.proposed }}</span>
|
||||||
|
<span *ngIf="!row.changed">{{ row.proposed }}</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<ng-template #noRows>
|
||||||
|
<p class="diff-empty">No differences found.</p>
|
||||||
|
</ng-template>
|
||||||
|
</mat-dialog-content>
|
||||||
|
|
||||||
|
<!-- Actions -->
|
||||||
|
<mat-dialog-actions align="end" class="diff-actions">
|
||||||
|
<button mat-stroked-button (click)="close()">Close</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
</div>
|
||||||
+194
@@ -0,0 +1,194 @@
|
|||||||
|
/**
|
||||||
|
* Copyright since 2025 Mifos Initiative
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$border: #e2e8f0;
|
||||||
|
$bg-page: #f8fafc;
|
||||||
|
$text-dark: #1e293b;
|
||||||
|
$text-mid: #475569;
|
||||||
|
$text-soft: #94a3b8;
|
||||||
|
$changed: #fef9c3;
|
||||||
|
$changed-border: #fde047;
|
||||||
|
$new-text: #15803d;
|
||||||
|
|
||||||
|
.diff-dialog {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
min-width: 560px;
|
||||||
|
max-width: 820px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Header ───────────────────────────────────────────────────────────────────
|
||||||
|
.diff-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 16px 20px 12px;
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
background: $bg-page;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: $text-dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
font-size: 18px;
|
||||||
|
color: #2563eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: $text-mid;
|
||||||
|
border-left: 1px solid $border;
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__meta {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
|
||||||
|
&--changed {
|
||||||
|
background: #fef9c3;
|
||||||
|
color: #854d0e;
|
||||||
|
border: 1px solid #fde047;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--none {
|
||||||
|
background: #f0fdf4;
|
||||||
|
color: #166534;
|
||||||
|
border: 1px solid #86efac;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-toggle {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 4px 12px;
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: #fff;
|
||||||
|
color: $text-mid;
|
||||||
|
cursor: pointer;
|
||||||
|
transition:
|
||||||
|
background 0.15s,
|
||||||
|
color 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: $text-dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Body ─────────────────────────────────────────────────────────────────────
|
||||||
|
.diff-body {
|
||||||
|
max-height: 60vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 13px;
|
||||||
|
|
||||||
|
th,
|
||||||
|
td {
|
||||||
|
padding: 9px 14px;
|
||||||
|
text-align: left;
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
color: $text-soft;
|
||||||
|
background: $bg-page;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__label {
|
||||||
|
width: 28%;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $text-mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__val {
|
||||||
|
width: 36%;
|
||||||
|
color: $text-dark;
|
||||||
|
word-break: break-word;
|
||||||
|
|
||||||
|
&--orig {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--prop {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-row--changed {
|
||||||
|
background: $changed !important;
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-bottom-color: $changed-border;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-table__val--orig {
|
||||||
|
background: #fef2f2;
|
||||||
|
color: #b91c1c;
|
||||||
|
text-decoration: line-through;
|
||||||
|
text-decoration-color: #fca5a5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-table__val--prop {
|
||||||
|
background: #f0fdf4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-new {
|
||||||
|
color: $new-text;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-empty {
|
||||||
|
padding: 32px;
|
||||||
|
text-align: center;
|
||||||
|
color: $text-soft;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Actions ───────────────────────────────────────────────────────────────────
|
||||||
|
.diff-actions {
|
||||||
|
padding: 12px 20px;
|
||||||
|
border-top: 1px solid $border;
|
||||||
|
background: $bg-page;
|
||||||
|
}
|
||||||
+95
@@ -0,0 +1,95 @@
|
|||||||
|
/**
|
||||||
|
* Copyright since 2025 Mifos Initiative
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { Component, inject } from '@angular/core';
|
||||||
|
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { NgClass } from '@angular/common';
|
||||||
|
|
||||||
|
export interface ProductEditDiffDialogData {
|
||||||
|
productName: string;
|
||||||
|
original: Record<string, any>;
|
||||||
|
proposed: Record<string, any>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DiffRow {
|
||||||
|
label: string;
|
||||||
|
original: string;
|
||||||
|
proposed: string;
|
||||||
|
changed: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-product-edit-diff-dialog',
|
||||||
|
templateUrl: './product-edit-diff-dialog.component.html',
|
||||||
|
styleUrls: ['./product-edit-diff-dialog.component.scss'],
|
||||||
|
imports: [
|
||||||
|
MatDialogModule,
|
||||||
|
MatButtonModule,
|
||||||
|
NgClass
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ProductEditDiffDialogComponent {
|
||||||
|
dialogRef = inject(MatDialogRef<ProductEditDiffDialogComponent>);
|
||||||
|
data: ProductEditDiffDialogData = inject(MAT_DIALOG_DATA);
|
||||||
|
|
||||||
|
diffRows: DiffRow[] = [];
|
||||||
|
showChangedOnly = false;
|
||||||
|
|
||||||
|
get visibleRows(): DiffRow[] {
|
||||||
|
return this.showChangedOnly ? this.diffRows.filter((r) => r.changed) : this.diffRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
get changedCount(): number {
|
||||||
|
return this.diffRows.filter((r) => r.changed).length;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.diffRows = this.buildDiff(this.data.original, this.data.proposed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildDiff(original: Record<string, any>, proposed: Record<string, any>): DiffRow[] {
|
||||||
|
const allKeys = new Set([
|
||||||
|
...Object.keys(original),
|
||||||
|
...Object.keys(proposed)
|
||||||
|
]);
|
||||||
|
const rows: DiffRow[] = [];
|
||||||
|
allKeys.forEach((key) => {
|
||||||
|
const orig = original[key];
|
||||||
|
const prop = proposed[key];
|
||||||
|
const origStr = this.format(orig);
|
||||||
|
const propStr = this.format(prop);
|
||||||
|
rows.push({
|
||||||
|
label: this.labelFor(key),
|
||||||
|
original: origStr,
|
||||||
|
proposed: propStr,
|
||||||
|
changed: origStr !== propStr
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return rows.sort((a, b) => (a.changed === b.changed ? 0 : a.changed ? -1 : 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
private format(value: any): string {
|
||||||
|
if (value === null || value === undefined) return '—';
|
||||||
|
if (typeof value === 'boolean') return value ? 'Yes' : 'No';
|
||||||
|
if (typeof value === 'object') return JSON.stringify(value);
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private labelFor(key: string): string {
|
||||||
|
return key
|
||||||
|
.replace(/([a-z])([A-Z])/g, '$1 $2')
|
||||||
|
.replace(/[_\-.]+/g, ' ')
|
||||||
|
.replace(/\b\w/g, (c) => c.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
close(): void {
|
||||||
|
this.dialogRef.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
-1
@@ -31,7 +31,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
styleUrls: ['./rejected-account.component.scss'],
|
styleUrls: ['./rejected-account.component.scss'],
|
||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
FaIconComponent,
|
|
||||||
MatTable,
|
MatTable,
|
||||||
MatColumnDef,
|
MatColumnDef,
|
||||||
MatHeaderCellDef,
|
MatHeaderCellDef,
|
||||||
|
|||||||
-1
@@ -31,7 +31,6 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
styleUrls: ['./terminated-account.component.scss'],
|
styleUrls: ['./terminated-account.component.scss'],
|
||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
FaIconComponent,
|
|
||||||
MatTable,
|
MatTable,
|
||||||
MatColumnDef,
|
MatColumnDef,
|
||||||
MatHeaderCellDef,
|
MatHeaderCellDef,
|
||||||
|
|||||||
@@ -74,12 +74,12 @@
|
|||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
class="ac-tab"
|
class="ac-tab"
|
||||||
routerLink="./pending-savings-products"
|
routerLink="./product-approval"
|
||||||
routerLinkActive="ac-tab--active"
|
routerLinkActive="ac-tab--active"
|
||||||
*mifosxHasPermission="'ALL_FUNCTIONS_READ'"
|
*mifosxHasPermission="'ALL_FUNCTIONS_READ'"
|
||||||
>
|
>
|
||||||
<fa-icon icon="piggy-bank" class="ac-tab__ic"></fa-icon>
|
<fa-icon icon="piggy-bank" class="ac-tab__ic"></fa-icon>
|
||||||
<span>Pending Product Edits</span>
|
<span>Product Approval</span>
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
class="ac-tab"
|
class="ac-tab"
|
||||||
|
|||||||
@@ -11,15 +11,27 @@ import { Resolve } from '@angular/router';
|
|||||||
import { Observable, forkJoin, of } from 'rxjs';
|
import { Observable, forkJoin, of } from 'rxjs';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
import { catchError, map } from 'rxjs/operators';
|
||||||
import { ProductsService } from 'app/products/products.service';
|
import { ProductsService } from 'app/products/products.service';
|
||||||
|
import { TasksService } from '../tasks.service';
|
||||||
|
import { isProductEntity, isTempTableProductEdit, PRODUCT_ENTITY_TYPE_LABEL } from '../product-entities';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merges pending edits across all product types sharing the m_savings_product_temp backing table -
|
* Builds the Approvals -> Product Approval list from the two pending-request sources the platform
|
||||||
* Savings, Current Account, Share, Fixed Deposit, and Recurring Deposit products - into one list for
|
* already has. No new workflow or table is involved; both feeds are read as-is.
|
||||||
* the Pending Product Edits screen.
|
*
|
||||||
|
* 1. Pending product edits (m_saving_product_temp), via /{producttype}/pending. UPDATE only, for the
|
||||||
|
* five product types whose PUT handler stages the change instead of logging a command.
|
||||||
|
* 2. Native maker-checker entries (m_portfolio_command_source), via /makercheckers. This is where
|
||||||
|
* product CREATE and DELETE land - and LOANPRODUCT/CHARGE requests of every action, since those
|
||||||
|
* were never diverted to the staging table.
|
||||||
|
*
|
||||||
|
* Rows staged in (1) also have an audit-only command-source row that surfaces in (2), so the
|
||||||
|
* maker-checker feed drops them - see isTempTableProductEdit. Each source keeps its own approve/reject
|
||||||
|
* path in the component; the merge here is presentational only.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class GetPendingSavingsProducts implements Resolve<any> {
|
export class GetPendingSavingsProducts implements Resolve<any> {
|
||||||
private productsService = inject(ProductsService);
|
private productsService = inject(ProductsService);
|
||||||
|
private tasksService = inject(TasksService);
|
||||||
|
|
||||||
resolve(): Observable<any> {
|
resolve(): Observable<any> {
|
||||||
return forkJoin({
|
return forkJoin({
|
||||||
@@ -27,15 +39,73 @@ export class GetPendingSavingsProducts implements Resolve<any> {
|
|||||||
current: this.productsService.getPendingCurrentProductEdits().pipe(catchError(() => of([]))),
|
current: this.productsService.getPendingCurrentProductEdits().pipe(catchError(() => of([]))),
|
||||||
share: this.productsService.getPendingShareProductEdits().pipe(catchError(() => of([]))),
|
share: this.productsService.getPendingShareProductEdits().pipe(catchError(() => of([]))),
|
||||||
fd: this.productsService.getPendingFixedDepositProductEdits().pipe(catchError(() => of([]))),
|
fd: this.productsService.getPendingFixedDepositProductEdits().pipe(catchError(() => of([]))),
|
||||||
rd: this.productsService.getPendingRecurringDepositProductEdits().pipe(catchError(() => of([])))
|
rd: this.productsService.getPendingRecurringDepositProductEdits().pipe(catchError(() => of([]))),
|
||||||
|
// includeJson so a CREATE row - which has no resourceId, and therefore no product to look up -
|
||||||
|
// can still show the submitted product name.
|
||||||
|
makerChecker: this.tasksService.getMakerCheckerData({ includeJson: true }).pipe(catchError(() => of([])))
|
||||||
}).pipe(
|
}).pipe(
|
||||||
map((results) => [
|
map((results) => [
|
||||||
...(results.savings || []).map((e: any) => ({ ...e, productType: 'SAVINGS' })),
|
...this.asEditRows(results.savings, 'SAVINGS'),
|
||||||
...(results.current || []).map((e: any) => ({ ...e, productType: 'CURRENT' })),
|
...this.asEditRows(results.current, 'CURRENT'),
|
||||||
...(results.share || []).map((e: any) => ({ ...e, productType: 'SHARE' })),
|
...this.asEditRows(results.share, 'SHARE'),
|
||||||
...(results.fd || []).map((e: any) => ({ ...e, productType: 'FD' })),
|
...this.asEditRows(results.fd, 'FD'),
|
||||||
...(results.rd || []).map((e: any) => ({ ...e, productType: 'RD' }))
|
...this.asEditRows(results.rd, 'RD'),
|
||||||
|
...this.asMakerCheckerRows(results.makerChecker)
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Staged product edits, unchanged apart from the source/action tags the merged table needs. */
|
||||||
|
private asEditRows(edits: any[], productType: string): any[] {
|
||||||
|
return (edits || []).map((edit: any) => ({
|
||||||
|
...edit,
|
||||||
|
productType,
|
||||||
|
source: 'PENDING_EDIT',
|
||||||
|
actionName: 'UPDATE'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalises maker-checker entries onto the same field names the pending-edit table already renders,
|
||||||
|
* so the existing template keeps working for both sources.
|
||||||
|
*/
|
||||||
|
private asMakerCheckerRows(entries: any): any[] {
|
||||||
|
const items = Array.isArray(entries) ? entries : (entries?.pageItems ?? []);
|
||||||
|
return items
|
||||||
|
.filter((entry: any) => isProductEntity(entry?.entityName))
|
||||||
|
.filter((entry: any) => !isTempTableProductEdit(entry?.entityName, entry?.actionName))
|
||||||
|
.map((entry: any) => ({
|
||||||
|
id: entry.id,
|
||||||
|
source: 'MAKER_CHECKER',
|
||||||
|
entityName: entry.entityName,
|
||||||
|
actionName: (entry.actionName ?? '').toUpperCase(),
|
||||||
|
productType: PRODUCT_ENTITY_TYPE_LABEL[(entry.entityName ?? '').toUpperCase()] ?? entry.entityName,
|
||||||
|
savingsProductId: entry.resourceId ?? null,
|
||||||
|
savingsProductName: this.resolveName(entry),
|
||||||
|
makerUsername: entry.maker,
|
||||||
|
// /makercheckers returns madeOnDate as a Unix timestamp in seconds.
|
||||||
|
// new Date(seconds) misreads it as milliseconds → January 1970.
|
||||||
|
// Normalise to milliseconds here, matching DatetimeFormatPipe's unix() branch.
|
||||||
|
createdOn:
|
||||||
|
typeof entry.madeOnDate === 'number' && entry.madeOnDate < 1e12 ? entry.madeOnDate * 1000 : entry.madeOnDate,
|
||||||
|
status: 'PENDING'
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A CREATE has no resourceId - the product does not exist until approval - so the name comes from
|
||||||
|
* the submitted command payload. Falls back to the entity/id when the payload is absent (a DELETE
|
||||||
|
* carries none) or unparseable.
|
||||||
|
*/
|
||||||
|
private resolveName(entry: any): string {
|
||||||
|
try {
|
||||||
|
const payload = entry?.commandAsJson ? JSON.parse(entry.commandAsJson) : null;
|
||||||
|
if (payload?.name) {
|
||||||
|
return payload.name;
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
/* fall through to the identifier below */
|
||||||
|
}
|
||||||
|
return entry?.resourceId != null ? `${entry.entityName} #${entry.resourceId}` : entry.entityName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
/**
|
||||||
|
* Copyright since 2025 Mifos Initiative
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single source of truth for which maker-checker entities belong to Approvals -> Product Approval
|
||||||
|
* rather than the generic Checker Inbox.
|
||||||
|
*
|
||||||
|
* These are the entity names the application already treats as products: the five that own a
|
||||||
|
* /products/... view route and a pending-edit staging row, plus LOANPRODUCT and CHARGE, which are
|
||||||
|
* product-module entities whose maker-checker requests run entirely through the native pipeline.
|
||||||
|
* Deliberately excluded are the product-module *configuration* entities (tax groups, floating rates,
|
||||||
|
* delinquency buckets, product mixes, collaterals) - they stay in the Checker Inbox.
|
||||||
|
*/
|
||||||
|
export const PRODUCT_ENTITIES: readonly string[] = [
|
||||||
|
'LOANPRODUCT',
|
||||||
|
'SAVINGSPRODUCT',
|
||||||
|
'CURRENTPRODUCT',
|
||||||
|
'SHAREPRODUCT',
|
||||||
|
'FIXEDDEPOSITPRODUCT',
|
||||||
|
'RECURRINGDEPOSITPRODUCT',
|
||||||
|
'CHARGE'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The subset whose UPDATEs bypass the native command-source pipeline: the PUT handler calls
|
||||||
|
* submitEditForApproval, which stages the change in m_saving_product_temp and writes an *audit-only*
|
||||||
|
* command-source row alongside it. That row shows up in /makercheckers like any pending command, but
|
||||||
|
* approving it there replays the original handler and never clears the staging lock - so it must be
|
||||||
|
* actioned through /{producttype}/{id}/approve instead.
|
||||||
|
*
|
||||||
|
* Two consequences, both relied on below:
|
||||||
|
* - Product Approval must drop these rows from its maker-checker feed, since the pending-edit feed
|
||||||
|
* already supplies them (otherwise every product edit would be listed twice).
|
||||||
|
* - View Checker Inbox must not offer approve/reject on them.
|
||||||
|
*/
|
||||||
|
export const TEMP_TABLE_PRODUCT_ENTITIES: readonly string[] = [
|
||||||
|
'SAVINGSPRODUCT',
|
||||||
|
'CURRENTPRODUCT',
|
||||||
|
'SHAREPRODUCT',
|
||||||
|
'FIXEDDEPOSITPRODUCT',
|
||||||
|
'RECURRINGDEPOSITPRODUCT'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Account entities staged the same way (savings/current account Nominee and Digital-Feature edits).
|
||||||
|
* Not products - they belong to Approvals -> Pending Account Edits - but their UPDATE rows have to
|
||||||
|
* stay out of the Checker Inbox for exactly the same lock reason.
|
||||||
|
*/
|
||||||
|
export const TEMP_TABLE_ACCOUNT_ENTITIES: readonly string[] = [
|
||||||
|
'SAVINGSACCOUNT',
|
||||||
|
'CURRENTACCOUNT'
|
||||||
|
];
|
||||||
|
|
||||||
|
/** Short type badge shown in the Product Approval table, matching the pending-edit productType tags. */
|
||||||
|
export const PRODUCT_ENTITY_TYPE_LABEL: Record<string, string> = {
|
||||||
|
LOANPRODUCT: 'LOAN',
|
||||||
|
SAVINGSPRODUCT: 'SAVINGS',
|
||||||
|
CURRENTPRODUCT: 'CURRENT',
|
||||||
|
SHAREPRODUCT: 'SHARE',
|
||||||
|
FIXEDDEPOSITPRODUCT: 'FD',
|
||||||
|
RECURRINGDEPOSITPRODUCT: 'RD',
|
||||||
|
CHARGE: 'CHARGE'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Whether a maker-checker entry is a product request, and so belongs to Product Approval. */
|
||||||
|
export function isProductEntity(entityName: string | undefined | null): boolean {
|
||||||
|
return PRODUCT_ENTITIES.includes((entityName ?? '').toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether a maker-checker entry is a product edit already staged in m_saving_product_temp. */
|
||||||
|
export function isTempTableProductEdit(
|
||||||
|
entityName: string | undefined | null,
|
||||||
|
actionName: string | undefined | null
|
||||||
|
): boolean {
|
||||||
|
return (
|
||||||
|
TEMP_TABLE_PRODUCT_ENTITIES.includes((entityName ?? '').toUpperCase()) &&
|
||||||
|
(actionName ?? '').toUpperCase() === 'UPDATE'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether a maker-checker entry is an account edit already staged for Pending Account Edits. */
|
||||||
|
export function isTempTableAccountEdit(
|
||||||
|
entityName: string | undefined | null,
|
||||||
|
actionName: string | undefined | null
|
||||||
|
): boolean {
|
||||||
|
return (
|
||||||
|
TEMP_TABLE_ACCOUNT_ENTITIES.includes((entityName ?? '').toUpperCase()) &&
|
||||||
|
(actionName ?? '').toUpperCase() === 'UPDATE'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display-only expansion of the short type badge above, for the Product Approval table.
|
||||||
|
*
|
||||||
|
* Presentation layer only: `productType` is still the value the component switches on to pick the
|
||||||
|
* right fetch/approve/reject endpoint, so the underlying row data, filtering and routing are
|
||||||
|
* untouched. Both the short code ('FD') and the spelled-out form ('FIXED DEPOSIT') are accepted so
|
||||||
|
* either feed maps correctly.
|
||||||
|
*/
|
||||||
|
export const PRODUCT_TYPE_DISPLAY_LABEL: Record<string, string> = {
|
||||||
|
CURRENT: 'CURRENT PRODUCT',
|
||||||
|
SAVINGS: 'SAVINGS PRODUCT',
|
||||||
|
SHARE: 'SHARE PRODUCT',
|
||||||
|
CHARGE: 'CHARGE',
|
||||||
|
LOAN: 'LOAN PRODUCT',
|
||||||
|
FD: 'FIXED DEPOSIT PRODUCT',
|
||||||
|
'FIXED DEPOSIT': 'FIXED DEPOSIT PRODUCT',
|
||||||
|
RD: 'RECURRING DEPOSIT PRODUCT',
|
||||||
|
'RECURRING DEPOSIT': 'RECURRING DEPOSIT PRODUCT'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Label shown in the Product Approval Type column. Unmapped types render unchanged. */
|
||||||
|
export function productTypeDisplayLabel(productType: string | undefined | null): string {
|
||||||
|
const raw = (productType ?? '').toString();
|
||||||
|
return PRODUCT_TYPE_DISPLAY_LABEL[raw.trim().toUpperCase()] ?? raw;
|
||||||
|
}
|
||||||
@@ -124,13 +124,19 @@ const routes: Routes = [
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'pending-savings-products',
|
path: 'product-approval',
|
||||||
component: PendingSavingsProductsComponent,
|
component: PendingSavingsProductsComponent,
|
||||||
data: { title: 'Pending Savings Product Edits' },
|
data: { title: 'Product Approval' },
|
||||||
resolve: {
|
resolve: {
|
||||||
pendingSavingsProductsData: GetPendingSavingsProducts
|
pendingSavingsProductsData: GetPendingSavingsProducts
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// The tab was called "Pending Product Edits" until it grew to cover product CREATE and
|
||||||
|
// DELETE too; keep its old path working for bookmarks and saved links.
|
||||||
|
path: 'pending-savings-products',
|
||||||
|
redirectTo: 'product-approval'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'pending-savings-account-edits',
|
path: 'pending-savings-account-edits',
|
||||||
component: PendingSavingsAccountEditsComponent,
|
component: PendingSavingsAccountEditsComponent,
|
||||||
|
|||||||
@@ -249,14 +249,6 @@ export class TasksService {
|
|||||||
return this.http.post(`/makercheckers/${makerCheckerId}`, {}, { params: httpParams });
|
return this.http.post(`/makercheckers/${makerCheckerId}`, {}, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute Maker Checker Delete Action
|
|
||||||
* @param {makerCheckerId} MakerCheckerId
|
|
||||||
*/
|
|
||||||
deleteMakerChecker(makerCheckerId: any): Observable<any> {
|
|
||||||
return this.http.delete(`/makercheckers/${makerCheckerId}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Maker Checker Details.
|
* Get Maker Checker Details.
|
||||||
* @param {makerCheckerId} MakerCheckerId
|
* @param {makerCheckerId} MakerCheckerId
|
||||||
|
|||||||
@@ -6,108 +6,166 @@
|
|||||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<div class="vci" [class.vci--dialog]="isDialog">
|
||||||
|
<!-- The heading lives here in both modes, so a dialog does not end up showing it twice. -->
|
||||||
|
<div class="vci-head">
|
||||||
|
<span class="vci-head__title">{{ headingTitle }}</span>
|
||||||
|
@if (isDialog) {
|
||||||
|
<button type="button" class="vci-head__close" (click)="close()">
|
||||||
|
<fa-icon icon="times"></fa-icon>
|
||||||
|
<span>{{ 'labels.buttons.Close' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- As a dialog the detail is fetched rather than resolved, so nothing below can render until it
|
||||||
|
arrives — every field reads checkerInboxDetail.* directly. -->
|
||||||
|
@if (loading) {
|
||||||
|
<div class="vci-loading">
|
||||||
|
<fa-icon icon="spinner" class="vci-loading__ic"></fa-icon>
|
||||||
|
<span>{{ 'labels.heading.Loading' | translate }}…</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
@if (checkerInboxDetail) {
|
||||||
|
<div class="vci-body">
|
||||||
@if (isProductEditEntry) {
|
@if (isProductEditEntry) {
|
||||||
<div class="container m-b-20">
|
<div class="vci-notice">
|
||||||
<div class="mat-elevation-z1" style="padding: 12px 16px; border-left: 4px solid #f59e0b; background: #fffbeb">
|
|
||||||
This is a product edit awaiting approval. Approve or reject it from
|
This is a product edit awaiting approval. Approve or reject it from
|
||||||
<strong>Approvals > Pending Product Edits</strong> instead — actioning it here would not release its lock.
|
<strong>Approvals > Pending Product Edits</strong> instead — actioning it here would not release its lock.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
} @else {
|
} @else {
|
||||||
<div class="layout-row align-end gap-1percent layout-lt-md-column container m-b-20">
|
<div class="vci-actions">
|
||||||
<button mat-raised-button color="success" (click)="approveChecker()">
|
<button type="button" class="vci-btn vci-btn--approve" (click)="approveChecker()">
|
||||||
<fa-icon icon="check" class="m-r-10"></fa-icon>{{ 'labels.buttons.Approve' | translate }}
|
<fa-icon icon="check"></fa-icon><span>{{ 'labels.buttons.Approve' | translate }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button mat-raised-button color="warn" (click)="deleteChecker()">
|
<button type="button" class="vci-btn vci-btn--reject" (click)="rejectChecker()">
|
||||||
<fa-icon icon="trash" class="m-r-10"></fa-icon>{{ 'labels.buttons.Delete' | translate }}
|
<fa-icon icon="times"></fa-icon><span>{{ 'labels.buttons.Reject' | translate }}</span>
|
||||||
</button>
|
|
||||||
<button mat-raised-button color="reject" (click)="rejectChecker()">
|
|
||||||
<fa-icon icon="times" class="m-r-10"></fa-icon>{{ 'labels.buttons.Reject' | translate }}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="container">
|
<div class="vci-section">
|
||||||
<mat-card>
|
<div class="vci-section__title">{{ 'labels.heading.Details' | translate }}</div>
|
||||||
<mat-card-content>
|
<!-- A real label/value grid rather than the global flex-40/flex-60 utilities, which are sized
|
||||||
<div class="layout-row-wrap responsive-column">
|
for a full-width page and collapse into one run-together line inside a dialog. -->
|
||||||
<h2 class="mat-h2 flex-fill">{{ 'labels.heading.View Checker Inbox' | translate }}</h2>
|
<dl class="vci-grid">
|
||||||
|
<div class="vci-kv">
|
||||||
<mat-divider [inset]="true"></mat-divider>
|
<dt>{{ 'labels.inputs.ID' | translate }}</dt>
|
||||||
|
<dd>{{ checkerInboxDetail.id }}</dd>
|
||||||
<h3 class="mat-h3 flex-fill">{{ 'labels.heading.Details' | translate }}</h3>
|
|
||||||
|
|
||||||
<mat-divider [inset]="true"></mat-divider>
|
|
||||||
|
|
||||||
<div class="flex-fill">
|
|
||||||
<span class="flex-40">{{ 'labels.inputs.ID' | translate }}:</span>
|
|
||||||
<span class="flex-60">{{ checkerInboxDetail.id }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="vci-kv">
|
||||||
<div class="flex-fill">
|
<dt>{{ 'labels.inputs.Status' | translate }}</dt>
|
||||||
<span class="flex-40">{{ 'labels.inputs.Status' | translate }}:</span>
|
<dd>{{ checkerInboxDetail.processingResult || '—' }}</dd>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.processingResult }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="vci-kv">
|
||||||
<div class="flex-fill">
|
<dt>{{ 'labels.inputs.User' | translate }}</dt>
|
||||||
<span class="flex-40">{{ 'labels.inputs.User' | translate }}:</span>
|
<dd>{{ checkerInboxDetail.maker || '—' }}</dd>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.maker }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="vci-kv">
|
||||||
<div class="flex-fill">
|
<dt>{{ 'labels.inputs.Action' | translate }}</dt>
|
||||||
<span class="flex-40">{{ 'labels.inputs.Action' | translate }}:</span>
|
<dd>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.actionName }}</span>
|
<span class="vci-tag" [class.vci-tag--danger]="checkerInboxDetail.actionName === 'DELETE'">{{
|
||||||
|
checkerInboxDetail.actionName
|
||||||
|
}}</span>
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="vci-kv">
|
||||||
<div class="flex-fill">
|
<dt>{{ 'labels.inputs.Entity' | translate }}</dt>
|
||||||
<span class="flex-40">{{ 'labels.inputs.Entity' | translate }}:</span>
|
<dd>{{ checkerInboxDetail.entityName }}</dd>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.entityName }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (checkerInboxDetail.resourceId) {
|
@if (checkerInboxDetail.resourceId) {
|
||||||
<div class="flex-fill">
|
<div class="vci-kv">
|
||||||
<span class="flex-40">{{ 'labels.inputs.Resource ID' | translate }}:</span>
|
<dt>{{ 'labels.inputs.Resource ID' | translate }}</dt>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.resourceId }}</span>
|
<dd>{{ checkerInboxDetail.resourceId }}</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
<div class="vci-kv">
|
||||||
<div class="flex-fill">
|
<dt>{{ 'labels.inputs.Date' | translate }}</dt>
|
||||||
<span class="flex-40">{{ 'labels.inputs.Date' | translate }}:</span>
|
<dd>{{ checkerInboxDetail.madeOnDate | dateFormat }}</dd>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.madeOnDate | dateFormat }}</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (checkerInboxDetail.officeName) {
|
@if (checkerInboxDetail.officeName) {
|
||||||
<div class="flex-fill">
|
<div class="vci-kv">
|
||||||
<span class="flex-40">{{ 'labels.inputs.Office' | translate }}:</span>
|
<dt>{{ 'labels.inputs.Office' | translate }}</dt>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.officeName }}</span>
|
<dd>{{ checkerInboxDetail.officeName }}</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (checkerInboxDetail.savingsAccountNo) {
|
@if (checkerInboxDetail.savingsAccountNo) {
|
||||||
<div class="flex-fill">
|
<div class="vci-kv">
|
||||||
<span class="flex-40">{{ 'labels.inputs.Savings Account Number' | translate }}:</span>
|
<dt>{{ 'labels.inputs.Savings Account Number' | translate }}</dt>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.savingsAccountNo }}</span>
|
<dd>{{ checkerInboxDetail.savingsAccountNo }}</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (checkerInboxDetail.groupLevelName) {
|
@if (checkerInboxDetail.groupLevelName) {
|
||||||
<div class="flex-fill">
|
<div class="vci-kv">
|
||||||
<span class="flex-40"> {{ checkerInboxDetail.groupLevelName }}</span>
|
<dt>{{ checkerInboxDetail.groupLevelName }}</dt>
|
||||||
<span class="flex-60">{{ checkerInboxDetail.groupName }}</span>
|
<dd>{{ checkerInboxDetail.groupName }}</dd>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
|
||||||
@if (displayJSONData) {
|
@if (displayJSONData) {
|
||||||
<h3 class="mat-h3 flex-fill">{{ 'labels.heading.Command' | translate }}</h3>
|
<div class="vci-section">
|
||||||
<mat-divider [inset]="true"></mat-divider>
|
<div class="vci-section__title">{{ 'labels.heading.Command' | translate }}</div>
|
||||||
@for (json of jsondata | keyvalue; track json) {
|
<dl class="vci-grid">
|
||||||
<div class="flex-fill">
|
@for (field of commandFields; track $index) {
|
||||||
<span class="flex-40">{{ json.key }}:</span>
|
<ng-container *ngTemplateOutlet="commandField; context: { $implicit: field }"></ng-container>
|
||||||
<span class="flex-60">{{ json.value }}</span>
|
}
|
||||||
|
</dl>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Recursive renderer for one Command payload field. Scalars stay in the two-column grid; objects and
|
||||||
|
arrays span the full width so their nested content has room instead of overflowing the dialog. -->
|
||||||
|
<ng-template #commandField let-field>
|
||||||
|
@switch (field.kind) {
|
||||||
|
@case ('object') {
|
||||||
|
<div class="vci-kv vci-kv--wide">
|
||||||
|
<dt>{{ field.label }}</dt>
|
||||||
|
<dd>
|
||||||
|
<dl class="vci-subgrid">
|
||||||
|
@for (child of field.fields; track $index) {
|
||||||
|
<ng-container *ngTemplateOutlet="commandField; context: { $implicit: child }"></ng-container>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@case ('list') {
|
||||||
|
<div class="vci-kv vci-kv--wide">
|
||||||
|
<dt>
|
||||||
|
{{ field.label }} <span class="vci-count">{{ field.items.length }}</span>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
@if (field.items.length === 0) {
|
||||||
|
<span class="vci-none">None</span>
|
||||||
|
}
|
||||||
|
@for (item of field.items; track $index) {
|
||||||
|
@if (item.kind === 'scalar') {
|
||||||
|
<span class="vci-chip">{{ item.text }}</span>
|
||||||
|
} @else {
|
||||||
|
<div class="vci-entry">
|
||||||
|
<div class="vci-entry__head">{{ item.label }}</div>
|
||||||
|
<dl class="vci-subgrid">
|
||||||
|
@for (child of item.kind === 'object' ? item.fields : item.items; track $index) {
|
||||||
|
<ng-container *ngTemplateOutlet="commandField; context: { $implicit: child }"></ng-container>
|
||||||
|
}
|
||||||
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
</mat-card-content>
|
}
|
||||||
</mat-card>
|
@default {
|
||||||
|
<div class="vci-kv">
|
||||||
|
<dt>{{ field.label }}</dt>
|
||||||
|
<dd>{{ field.text }}</dd>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</ng-template>
|
||||||
|
|||||||
@@ -6,19 +6,321 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// ── Design tokens ─────────────────────────────────────────────────────────────
|
||||||
|
$border: #e2e8f0;
|
||||||
|
$bg-page: #f8fafc;
|
||||||
|
$text-dark: #1e293b;
|
||||||
|
$text-mid: #475569;
|
||||||
|
$text-soft: #94a3b8;
|
||||||
|
$success: #16a34a;
|
||||||
|
$warning: #d97706;
|
||||||
|
|
||||||
.mat-elevation-z1 {
|
.mat-elevation-z1 {
|
||||||
margin: 1em 0 1.5em;
|
margin: 1em 0 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2,
|
.vci {
|
||||||
h3,
|
background: #fff;
|
||||||
h4 {
|
|
||||||
|
/* Opened as a popup rather than a full page: sized to its own content, capped so a long command
|
||||||
|
payload scrolls inside the dialog instead of pushing it off screen. As a route it stays a
|
||||||
|
normal page-width card. */
|
||||||
|
&--dialog {
|
||||||
|
width: min(680px, 92vw);
|
||||||
|
max-height: 85vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:not(&--dialog) {
|
||||||
|
max-width: 900px;
|
||||||
|
margin: 20px auto;
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Header ───────────────────────────────────────────────────────────────────
|
||||||
|
.vci-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 14px 20px;
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
background: #fff;
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: $text-dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__close {
|
||||||
|
margin-left: auto;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 12.5px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: $text-soft;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: all 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: $text-mid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-loading {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 48px 24px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: $text-soft;
|
||||||
|
|
||||||
|
&__ic {
|
||||||
|
animation: vci-spin 1s linear infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes vci-spin {
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-body {
|
||||||
|
padding: 16px 20px 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Actions ──────────────────────────────────────────────────────────────────
|
||||||
|
.vci-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 7px;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 18px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 13.5px;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1.5px solid transparent;
|
||||||
|
transition: all 0.15s;
|
||||||
|
|
||||||
|
&--approve {
|
||||||
|
background: #f0fdf4;
|
||||||
|
color: $success;
|
||||||
|
border-color: #86efac;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $success;
|
||||||
|
color: #fff;
|
||||||
|
border-color: $success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--delete {
|
||||||
|
background: #fff7ed;
|
||||||
|
color: #c2410c;
|
||||||
|
border-color: #fdba74;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #ea580c;
|
||||||
|
color: #fff;
|
||||||
|
border-color: #ea580c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--reject {
|
||||||
|
background: #fff;
|
||||||
|
color: $text-mid;
|
||||||
|
border-color: $border;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f1f5f9;
|
||||||
|
color: $text-dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-notice {
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-left: 4px solid $warning;
|
||||||
|
background: #fffbeb;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: #92400e;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Detail sections ──────────────────────────────────────────────────────────
|
||||||
|
.vci-section {
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
padding: 10px 16px;
|
||||||
|
background: $bg-page;
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 800;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.07em;
|
||||||
|
color: $text-mid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* One label above its value, two pairs per row where there is room. This replaces the global
|
||||||
|
flex-40/flex-60 utilities, which are sized for a full-width page and ran every field together
|
||||||
|
onto a single line inside the dialog. */
|
||||||
|
.vci-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
|
||||||
|
gap: 14px 24px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
span {
|
.vci-kv {
|
||||||
margin: 0.5em 0;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 3px;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
dt {
|
||||||
|
font-size: 10.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.06em;
|
||||||
|
color: $text-soft;
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: $text-dark;
|
||||||
|
line-height: 1.35;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
// A nested object/array needs the full grid width, not one of the two columns, or its own
|
||||||
|
// label/value pairs get squeezed into a sliver and wrap character by character.
|
||||||
|
&--wide {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Nested object/array rendering inside the Command section. Reuses .vci-kv for the leaves, so a
|
||||||
|
nested field looks like every other label/value pair, just indented under its parent. */
|
||||||
|
.vci-subgrid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||||
|
gap: 10px 20px;
|
||||||
|
margin: 6px 0 0;
|
||||||
|
padding: 10px 12px;
|
||||||
|
border-left: 2px solid $border;
|
||||||
|
background: $bg-page;
|
||||||
|
border-radius: 0 6px 6px 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* One element of an array of objects. */
|
||||||
|
.vci-entry {
|
||||||
|
margin-top: 8px;
|
||||||
|
border: 1px solid $border;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
&__head {
|
||||||
|
padding: 6px 12px;
|
||||||
|
background: $bg-page;
|
||||||
|
border-bottom: 1px solid $border;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: $text-mid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-subgrid {
|
||||||
|
margin: 0;
|
||||||
|
border-left: 0;
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Count badge next to an array's label. */
|
||||||
|
.vci-count {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 6px;
|
||||||
|
padding: 0 7px;
|
||||||
|
border-radius: 20px;
|
||||||
|
background: $border;
|
||||||
|
color: $text-mid;
|
||||||
|
font-size: 10.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A scalar element of an array (e.g. a list of codes) - shown inline rather than as a card. */
|
||||||
|
.vci-chip {
|
||||||
|
display: inline-block;
|
||||||
|
margin: 3px 6px 0 0;
|
||||||
|
padding: 3px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
background: $bg-page;
|
||||||
|
border: 1px solid $border;
|
||||||
|
font-size: 12.5px;
|
||||||
|
color: $text-dark;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-none {
|
||||||
|
font-size: 13px;
|
||||||
|
font-style: italic;
|
||||||
|
color: $text-soft;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vci-tag {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
background: $bg-page;
|
||||||
|
color: $text-mid;
|
||||||
|
border: 1px solid $border;
|
||||||
|
|
||||||
|
&--danger {
|
||||||
|
background: #fff1f2;
|
||||||
|
color: #be123c;
|
||||||
|
border-color: #fda4af;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.margin-t {
|
.margin-t {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
import { Component, inject } from '@angular/core';
|
import { Component, inject } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { TasksService } from '../tasks.service';
|
import { TasksService } from '../tasks.service';
|
||||||
@@ -19,10 +19,62 @@ import { TasksService } from '../tasks.service';
|
|||||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { MatDivider } from '@angular/material/divider';
|
import { NgTemplateOutlet } from '@angular/common';
|
||||||
import { KeyValuePipe } from '@angular/common';
|
|
||||||
import { DateFormatPipe } from '../../pipes/date-format.pipe';
|
import { DateFormatPipe } from '../../pipes/date-format.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { isTempTableProductEdit } from '../product-entities';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One row of the rendered Command payload. The dialog turns the parsed command JSON into a tree of
|
||||||
|
* these so the template can lay nested objects out as label/value pairs and arrays as repeated
|
||||||
|
* entries, rather than dumping raw JSON at the checker. Purely a view model — the command data
|
||||||
|
* itself (`jsondata`) is left exactly as the API returned it.
|
||||||
|
*/
|
||||||
|
export type CommandField =
|
||||||
|
| { label: string; kind: 'scalar'; text: string }
|
||||||
|
| { label: string; kind: 'object'; fields: CommandField[] }
|
||||||
|
| { label: string; kind: 'list'; items: CommandField[] };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Segments that read as initialisms in this domain, so `upiFacility` becomes "UPI Facility" rather
|
||||||
|
* than "Upi Facility". Anything not listed just gets title-cased, so an unknown key still renders
|
||||||
|
* sensibly - no per-product hard-coding.
|
||||||
|
*/
|
||||||
|
const LABEL_ACRONYMS = new Set([
|
||||||
|
'upi',
|
||||||
|
'id',
|
||||||
|
'ids',
|
||||||
|
'url',
|
||||||
|
'api',
|
||||||
|
'ifsc',
|
||||||
|
'micr',
|
||||||
|
'kyc',
|
||||||
|
'ckyc',
|
||||||
|
'aml',
|
||||||
|
'pan',
|
||||||
|
'gst',
|
||||||
|
'cgst',
|
||||||
|
'sgst',
|
||||||
|
'igst',
|
||||||
|
'tds',
|
||||||
|
'gl',
|
||||||
|
'neft',
|
||||||
|
'rtgs',
|
||||||
|
'imps',
|
||||||
|
'nach',
|
||||||
|
'ecs',
|
||||||
|
'atm',
|
||||||
|
'nri',
|
||||||
|
'cif',
|
||||||
|
'dob',
|
||||||
|
'otp',
|
||||||
|
'sms',
|
||||||
|
'emi',
|
||||||
|
'fd',
|
||||||
|
'rd',
|
||||||
|
'mis',
|
||||||
|
'nef'
|
||||||
|
]);
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-view-checker-inbox',
|
selector: 'mifosx-view-checker-inbox',
|
||||||
@@ -31,8 +83,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
imports: [
|
imports: [
|
||||||
...STANDALONE_SHARED_IMPORTS,
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
MatDivider,
|
NgTemplateOutlet,
|
||||||
KeyValuePipe,
|
|
||||||
DateFormatPipe
|
DateFormatPipe
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@@ -43,6 +94,98 @@ export class ViewCheckerInboxComponent {
|
|||||||
private translateService = inject(TranslateService);
|
private translateService = inject(TranslateService);
|
||||||
private tasksService = inject(TasksService);
|
private tasksService = inject(TasksService);
|
||||||
|
|
||||||
|
/** Present only when opened as a popup from the Checker Inbox list; absent when reached by direct
|
||||||
|
* route (a bookmarked or shared link). Both entry points stay supported — this only changes where
|
||||||
|
* the detail comes from and how "done" is signalled: closing the dialog vs. navigating back. */
|
||||||
|
private dialogRef = inject(MatDialogRef<ViewCheckerInboxComponent>, { optional: true });
|
||||||
|
private dialogData = inject<{ checkerId: number | string; title?: string } | null>(MAT_DIALOG_DATA, {
|
||||||
|
optional: true
|
||||||
|
});
|
||||||
|
|
||||||
|
loading = false;
|
||||||
|
|
||||||
|
get isDialog(): boolean {
|
||||||
|
return !!this.dialogRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Heading text. Defaults to the Checker Inbox heading — which is what the Checker Inbox itself and
|
||||||
|
* the direct route both get — but a caller opening this dialog from another tab can supply its own,
|
||||||
|
* so the checker sees which queue the request came from. Nothing else about the dialog changes.
|
||||||
|
*/
|
||||||
|
get headingTitle(): string {
|
||||||
|
return this.dialogData?.title ?? this.translateService.instant('labels.heading.View Checker Inbox');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Command payload as a render tree. Built once per detail load rather than exposed as a getter,
|
||||||
|
* so change detection is not re-walking the payload on every cycle.
|
||||||
|
*/
|
||||||
|
commandFields: CommandField[] = [];
|
||||||
|
|
||||||
|
/** camelCase / snake_case key -> readable label, e.g. `upiFacility` -> "UPI Facility". */
|
||||||
|
private labelFor(key: string): string {
|
||||||
|
const spaced = String(key ?? '')
|
||||||
|
.replace(/[_\-.]+/g, ' ')
|
||||||
|
// splitAt lower|digit -> Upper, and at the tail of a run of capitals (`UPIFacility` -> `UPI Facility`)
|
||||||
|
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
||||||
|
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
|
||||||
|
.trim();
|
||||||
|
if (!spaced) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return spaced
|
||||||
|
.split(/\s+/)
|
||||||
|
.map((word) =>
|
||||||
|
LABEL_ACRONYMS.has(word.toLowerCase()) ? word.toUpperCase() : word.charAt(0).toUpperCase() + word.slice(1)
|
||||||
|
)
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Leaf rendering. Booleans read as Yes/No; everything else keeps the text it always had. */
|
||||||
|
private scalarText(value: any): string {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
return '—';
|
||||||
|
}
|
||||||
|
if (typeof value === 'boolean') {
|
||||||
|
return value ? 'Yes' : 'No';
|
||||||
|
}
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively turns one key/value pair into a render node. Nothing is dropped or summarised - every
|
||||||
|
* key in the payload produces a node, so the checker still sees the complete request.
|
||||||
|
*/
|
||||||
|
private toField(label: string, value: any): CommandField {
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
return {
|
||||||
|
label,
|
||||||
|
kind: 'list',
|
||||||
|
items: value.map((item, index) =>
|
||||||
|
item !== null && typeof item === 'object'
|
||||||
|
? this.toField(`${label} ${index + 1}`, item)
|
||||||
|
: { label: '', kind: 'scalar' as const, text: this.scalarText(item) }
|
||||||
|
)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (value !== null && typeof value === 'object') {
|
||||||
|
return {
|
||||||
|
label,
|
||||||
|
kind: 'object',
|
||||||
|
fields: Object.keys(value).map((key) => this.toField(this.labelFor(key), value[key]))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return { label, kind: 'scalar', text: this.scalarText(value) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private buildCommandFields(payload: any): CommandField[] {
|
||||||
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return Object.keys(payload).map((key) => this.toField(this.labelFor(key), payload[key]));
|
||||||
|
}
|
||||||
|
|
||||||
/** Checker Inbox Details Data */
|
/** Checker Inbox Details Data */
|
||||||
checkerInboxDetail: any;
|
checkerInboxDetail: any;
|
||||||
/** JsonData */
|
/** JsonData */
|
||||||
@@ -51,24 +194,16 @@ export class ViewCheckerInboxComponent {
|
|||||||
displayJSONData = false;
|
displayJSONData = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These entities' pending edits are gated by our own m_savings_product_temp lock, not the native
|
* A product edit staged in m_saving_product_temp is not approvable here: /makercheckers/{id} replays
|
||||||
* command-source pipeline. Approving/rejecting them here would replay the original command handler
|
* the original command handler and never clears the staging lock. Product Approval actions those
|
||||||
* directly via /makercheckers/{id}?command=approve and never clear our temp table's lock. Action them
|
* through the product's own approve/reject endpoint instead.
|
||||||
* from Approvals -> Pending Product Edits instead.
|
*
|
||||||
|
* Scoped to staged UPDATEs on purpose. Product CREATE and DELETE rows are ordinary command-source
|
||||||
|
* entries with no staging row, and Product Approval opens this dialog to action them - so they must
|
||||||
|
* keep their buttons.
|
||||||
*/
|
*/
|
||||||
private readonly productEditEntities = [
|
|
||||||
'SAVINGSPRODUCT',
|
|
||||||
'CURRENTPRODUCT',
|
|
||||||
'SHAREPRODUCT',
|
|
||||||
'FIXEDDEPOSITPRODUCT',
|
|
||||||
'RECURRINGDEPOSITPRODUCT'
|
|
||||||
];
|
|
||||||
|
|
||||||
get isProductEditEntry(): boolean {
|
get isProductEditEntry(): boolean {
|
||||||
return (
|
return isTempTableProductEdit(this.checkerInboxDetail?.entityName, this.checkerInboxDetail?.actionName);
|
||||||
this.productEditEntities.includes(this.checkerInboxDetail?.entityName) &&
|
|
||||||
this.checkerInboxDetail?.actionName === 'UPDATE'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,11 +214,58 @@ export class ViewCheckerInboxComponent {
|
|||||||
* @param {TasksService} tasksService Tasks Service.
|
* @param {TasksService} tasksService Tasks Service.
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
|
// Route entry: detail is pre-fetched by the resolver and injected via route.data.
|
||||||
this.route.data.subscribe((data: { checkerInboxDetail: any }) => {
|
this.route.data.subscribe((data: { checkerInboxDetail: any }) => {
|
||||||
this.checkerInboxDetail = data.checkerInboxDetail;
|
if (data.checkerInboxDetail) {
|
||||||
this.jsondata = JSON.parse(this.checkerInboxDetail.commandAsJson);
|
this.applyDetail(data.checkerInboxDetail);
|
||||||
this.displayJSONData = !_.isEmpty(this.jsondata);
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Dialog entry: no resolver fires, so fetch the detail imperatively using the
|
||||||
|
// checkerId the caller passed in MAT_DIALOG_DATA.
|
||||||
|
if (this.dialogData?.checkerId != null && !this.checkerInboxDetail) {
|
||||||
|
this.loading = true;
|
||||||
|
this.tasksService.getCheckerInboxDetail(this.dialogData.checkerId).subscribe({
|
||||||
|
next: (detail: any) => {
|
||||||
|
this.loading = false;
|
||||||
|
this.applyDetail(detail);
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyDetail(detail: any): void {
|
||||||
|
this.checkerInboxDetail = detail;
|
||||||
|
// commandAsJson is absent on some entries (a DELETE carries no payload), and JSON.parse(undefined)
|
||||||
|
// throws — which as a route only broke the page, but in a dialog would leave an empty shell open.
|
||||||
|
try {
|
||||||
|
this.jsondata = detail?.commandAsJson ? JSON.parse(detail.commandAsJson) : {};
|
||||||
|
} catch {
|
||||||
|
this.jsondata = {};
|
||||||
|
}
|
||||||
|
this.displayJSONData = !_.isEmpty(this.jsondata);
|
||||||
|
this.commandFields = this.buildCommandFields(this.jsondata);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** "Done" for this screen — closes the popup (telling the list to refresh) when opened as a
|
||||||
|
* dialog, or returns to the inbox route otherwise. */
|
||||||
|
private finish(): void {
|
||||||
|
if (this.dialogRef) {
|
||||||
|
this.dialogRef.close({ refreshed: true });
|
||||||
|
} else {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
close(): void {
|
||||||
|
if (this.dialogRef) {
|
||||||
|
this.dialogRef.close();
|
||||||
|
} else {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -99,7 +281,7 @@ export class ViewCheckerInboxComponent {
|
|||||||
approveCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
approveCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||||
if (response.confirm) {
|
if (response.confirm) {
|
||||||
this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'approve').subscribe((res: any) => {
|
this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'approve').subscribe((res: any) => {
|
||||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
this.finish();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -118,26 +300,7 @@ export class ViewCheckerInboxComponent {
|
|||||||
rejectCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
rejectCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||||
if (response.confirm) {
|
if (response.confirm) {
|
||||||
this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'reject').subscribe((res: any) => {
|
this.tasksService.executeMakerCheckerAction(this.checkerInboxDetail.id, 'reject').subscribe((res: any) => {
|
||||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
this.finish();
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete Checker
|
|
||||||
*/
|
|
||||||
deleteChecker() {
|
|
||||||
const deleteCheckerDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
|
||||||
data: {
|
|
||||||
heading: this.translateService.instant('labels.heading.Delete Checker'),
|
|
||||||
dialogContext: this.translateService.instant('labels.dialogContext.Are you sure you want to delete checker')
|
|
||||||
}
|
|
||||||
});
|
|
||||||
deleteCheckerDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
|
||||||
if (response.confirm) {
|
|
||||||
this.tasksService.deleteMakerChecker(this.checkerInboxDetail.id).subscribe((res: any) => {
|
|
||||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import { RevokeDscDialogComponent } from '../revoke-dsc-dialog/revoke-dsc-dialog
|
|||||||
MatRow,
|
MatRow,
|
||||||
MatButton,
|
MatButton,
|
||||||
MatIconButton,
|
MatIconButton,
|
||||||
MatIcon,
|
|
||||||
MatMenu,
|
MatMenu,
|
||||||
MatMenuItem,
|
MatMenuItem,
|
||||||
MatMenuTrigger,
|
MatMenuTrigger,
|
||||||
|
|||||||
Reference in New Issue
Block a user