feat: add database export, welcome kit dialog, and DIP/sanctions updates
build-run / Run Lint, Build and Deploy (push) Canceled after 0s
Publish Image in Docker Hub / build (push) Canceled after 0s
Playwright E2E Tests / Run Playwright Tests (push) Canceled after 0s
Tests / testRigor (push) Canceled after 0s

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-17 17:52:28 +05:30
co-authored by Claude Opus 5
parent c18219fce5
commit 7ef75c902d
33 changed files with 3042 additions and 208 deletions
@@ -70,6 +70,8 @@ export class SanctionsLogsComponent implements OnInit {
'screeningResult',
'disposition',
'matchCount',
'screeningSource',
'client',
'screenedBy',
'screenedAt',
'actions'
@@ -83,8 +85,16 @@ export class SanctionsLogsComponent implements OnInit {
* disposition) instead of the raw screening log. 'ALL' means every alert regardless of state.
*/
alertFilter: string | null = null;
/**
* Which screening run the rows came from: 'CLIENT_CREATION' for names screened while the client was being
* created, 'RESCREEN' for the periodic sweep over existing clients, null for both. Applied in the browser
* because neither the log nor the alert endpoint accepts a source filter.
*/
activeSource: 'CLIENT_CREATION' | 'RESCREEN' | null = null;
loading = false;
rescreening = false;
/** Full result set, kept so the source filter can be applied without another round trip. */
private allRows: any[] = [];
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
@ViewChild(MatSort, { static: true }) sort: MatSort;
@@ -98,16 +108,38 @@ export class SanctionsLogsComponent implements OnInit {
// The alert queue is a different endpoint, not a filter on the log list: it carries the
// disposition columns the review dialog needs.
// AWAITING_APPROVAL is a client-side view over all alerts rather than a disposition value:
// an alert waiting on the Principal Officer is one that HAS been assessed but not signed off,
// so it is identified by approvedBy being empty, not by its disposition.
const serverFilter =
this.alertFilter === 'ALL' || this.alertFilter === 'AWAITING_APPROVAL' ? undefined : this.alertFilter;
const request$ = this.alertFilter
? this.sanctionsLogsService.getAlerts(this.alertFilter === 'ALL' ? undefined : this.alertFilter)
? this.sanctionsLogsService.getAlerts(serverFilter)
: this.sanctionsLogsService.getLogs(this.buildLogFilters());
request$.subscribe({
next: (data: any) => this.applyRows(data || []),
next: (data: any) => this.applyRows(this.postFilter(data || [])),
error: () => this.applyRows([])
});
}
/** Narrows the fetched alerts for views the API has no dedicated filter for. */
private postFilter(rows: any[]): any[] {
if (this.alertFilter !== 'AWAITING_APPROVAL') {
return rows;
}
return rows.filter((row) => this.isAwaitingApproval(row));
}
/**
* True when the clerk has recorded an assessment and the Principal Officer has not yet approved
* it. This is the state in which the freeze is pending and nothing happens until someone acts.
*/
isAwaitingApproval(row: any): boolean {
return !!row?.disposition && row.disposition !== 'PENDING_REVIEW' && !row.approvedBy;
}
private buildLogFilters() {
const filters: any = {};
if (this.activeFilter) {
@@ -120,10 +152,50 @@ export class SanctionsLogsComponent implements OnInit {
}
private applyRows(rows: any[]) {
this.allRows = rows;
this.refreshTable();
this.loading = false;
}
/** Applies the source filter over the rows already fetched. */
private refreshTable() {
const rows = this.activeSource
? this.allRows.filter((row) => (this.activeSource === 'RESCREEN' ? this.isRescreen(row) : !this.isRescreen(row)))
: this.allRows;
this.dataSource = new MatTableDataSource(rows);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
this.loading = false;
}
/**
* A row came from the periodic sweep when the backend stamped it PERIODIC_RESCREEN; everything else was
* screened as the name was entered during client creation.
*/
isRescreen(row: any): boolean {
return (row?.screeningSource || '').toUpperCase().includes('RESCREEN');
}
sourceLabel(row: any): string {
return this.isRescreen(row) ? 'Re-screening' : 'Client Creation';
}
sourceClass(row: any): string {
return this.isRescreen(row) ? 'source-rescreen' : 'source-onboarding';
}
filterBySource(source: 'CLIENT_CREATION' | 'RESCREEN' | null) {
this.activeSource = this.activeSource === source ? null : source;
this.refreshTable();
}
/** Row counts behind each source chip, so the split is visible before filtering. */
get creationCount(): number {
return this.allRows.filter((row) => !this.isRescreen(row)).length;
}
get rescreenCount(): number {
return this.allRows.filter((row) => this.isRescreen(row)).length;
}
applySearch(value: string) {
@@ -149,6 +221,7 @@ export class SanctionsLogsComponent implements OnInit {
this.searchName = '';
this.activeFilter = null;
this.alertFilter = null;
this.activeSource = null;
this.loadLogs();
}