feat: non-individual entity UI improvements — hide individual-only sections, fix legal form display, send extended fields to API
- Hide Family Members tab/section for non-individual entities in client view, create flow, and preview - Hide Financial & Classification section for non-individual entities in personal data and preview - Fix legal form column in clients list — fetch legalForm from client API for correct display - Add person/business icon before client name in list rows - Remove unsupportedNpd filter — send authorizedSignatory, additionalInfo, dateOfRegistration to API - Add registration number format hint (mat-hint) based on constitution type - Add spacing between verification row and constitution type dropdowns - Reduce table cell padding and prevent action buttons from being clipped - Add missing MPL-2.0 license headers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
ab01111424
commit
b890d24bb7
@@ -29,11 +29,15 @@ import {
|
||||
import { environment } from '../../environments/environment';
|
||||
import { ClientsService } from './clients.service';
|
||||
import { NgClass } from '@angular/common';
|
||||
import { forkJoin, of } from 'rxjs';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { MatProgressBar } from '@angular/material/progress-bar';
|
||||
import { AccountNumberComponent } from '../shared/account-number/account-number.component';
|
||||
import { ExternalIdentifierComponent } from '../shared/external-identifier/external-identifier.component';
|
||||
import { StatusLookupPipe } from '../pipes/status-lookup.pipe';
|
||||
import { MatIconButton, MatButton } from '@angular/material/button';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatTooltip } from '@angular/material/tooltip';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
@@ -54,14 +58,17 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
AccountNumberComponent,
|
||||
ExternalIdentifierComponent,
|
||||
NgClass,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatPaginator,
|
||||
StatusLookupPipe
|
||||
StatusLookupPipe,
|
||||
MatIconButton,
|
||||
MatButton,
|
||||
MatIcon,
|
||||
MatTooltip
|
||||
]
|
||||
})
|
||||
export class ClientsComponent implements OnInit {
|
||||
@@ -87,9 +94,11 @@ export class ClientsComponent implements OnInit {
|
||||
'displayName',
|
||||
'accountNumber',
|
||||
'cifNumber',
|
||||
'externalId',
|
||||
'legalForm',
|
||||
'status',
|
||||
'officeName'
|
||||
'profileCompletion',
|
||||
'officeName',
|
||||
'actions'
|
||||
];
|
||||
dataSource: MatTableDataSource<any> = new MatTableDataSource();
|
||||
|
||||
@@ -131,12 +140,13 @@ export class ClientsComponent implements OnInit {
|
||||
.subscribe(
|
||||
(data: any) => {
|
||||
this.dataSource.data = data.content;
|
||||
|
||||
this.totalRows = data.totalElements;
|
||||
|
||||
this.existsClientsToFilter = data.numberOfElements > 0;
|
||||
this.notExistsClientsToFilter = !this.existsClientsToFilter;
|
||||
this.isLoading = false;
|
||||
|
||||
// Fetch KYC & address status for visible rows
|
||||
this.loadProfileStatus(data.content);
|
||||
},
|
||||
(error: any) => {
|
||||
this.isLoading = false;
|
||||
@@ -144,6 +154,43 @@ export class ClientsComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches KYC and address status for each client row to update profile dots.
|
||||
*/
|
||||
private loadProfileStatus(clients: any[]) {
|
||||
if (!clients?.length) return;
|
||||
|
||||
// Use individual subscriptions instead of forkJoin to avoid EMPTY observable issues
|
||||
clients.forEach((client, i) => {
|
||||
this.clientService.getClientData(client.id?.toString()).pipe(
|
||||
catchError(() => of(null))
|
||||
).subscribe((data: any) => {
|
||||
if (data?.legalForm) {
|
||||
clients[i].legalForm = data.legalForm;
|
||||
this.dataSource.data = [...clients];
|
||||
}
|
||||
});
|
||||
|
||||
this.clientService.getClientKyc(client.id?.toString()).pipe(
|
||||
catchError(() => of(null))
|
||||
).subscribe((kyc: any) => {
|
||||
if (kyc) {
|
||||
clients[i]._kycDone = kyc.kycStatus === 300;
|
||||
this.dataSource.data = [...clients];
|
||||
}
|
||||
});
|
||||
|
||||
this.clientService.getClientAddressData(client.id?.toString()).pipe(
|
||||
catchError(() => of(null))
|
||||
).subscribe((addr: any) => {
|
||||
if (addr && Array.isArray(addr) && addr.length > 0) {
|
||||
clients[i]._addressDone = true;
|
||||
this.dataSource.data = [...clients];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
pageChanged(event: PageEvent) {
|
||||
this.pageSize = event.pageSize;
|
||||
this.currentPage = event.pageIndex;
|
||||
@@ -162,6 +209,22 @@ export class ClientsComponent implements OnInit {
|
||||
this.getClients();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns profile completion steps for a client row.
|
||||
* Each step: { label, done }
|
||||
*/
|
||||
getProfileSteps(row: any): { label: string; done: boolean }[] {
|
||||
return [
|
||||
{ label: 'General', done: !!(row.firstname || row.displayName) && !!row.officeName },
|
||||
{ label: 'KYC', done: !!row._kycDone },
|
||||
{ label: 'Address', done: !!row._addressDone }
|
||||
];
|
||||
}
|
||||
|
||||
getCompletedCount(row: any): number {
|
||||
return this.getProfileSteps(row).filter(s => s.done).length;
|
||||
}
|
||||
|
||||
private resetPaginator() {
|
||||
this.currentPage = 0;
|
||||
this.paginator.firstPage();
|
||||
|
||||
Reference in New Issue
Block a user