Files
cbsnexora/src/app/clients/clients-view/personal-data-tab/personal-data-tab.component.ts
T
AdityaandClaude Opus 4.6 b890d24bb7 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>
2026-04-04 15:10:51 +05:30

110 lines
3.2 KiB
TypeScript

/**
* 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/.
*/
/** Angular Imports */
import { Component, inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
/** Custom Imports */
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
import { DecimalPipe } from '@angular/common';
import { LegalFormId } from 'app/clients/models/legal-form.enum';
/** Interfaces */
interface ClientViewData {
id: number;
accountNo?: string;
externalId?: string;
status?: { id: number; code: string; value: string };
active?: boolean;
activationDate?: number[];
firstname?: string;
middlename?: string;
lastname?: string;
fullname?: string;
displayName?: string;
mobileNo?: string;
emailAddress?: string;
dateOfBirth?: number[];
gender?: { id: number; name: string; active?: boolean };
clientType?: { id: number; name: string; active?: boolean };
clientClassification?: { id: number; name: string; active?: boolean };
legalForm?: { id: number; name: string };
officeId?: number;
officeName?: string;
staffId?: number;
staffName?: string;
savingsProductId?: number;
savingsProductName?: string;
[key: string]: any; // Allow additional properties from API
}
/**
* Personal Data Tab Component.
* Displays all personal/client details in a read-only format.
*/
@Component({
selector: 'mifosx-personal-data-tab',
templateUrl: './personal-data-tab.component.html',
styleUrls: ['./personal-data-tab.component.scss'],
standalone: true,
imports: [
...STANDALONE_SHARED_IMPORTS,
DateFormatPipe,
DecimalPipe
]
})
export class PersonalDataTabComponent {
private route = inject(ActivatedRoute);
/** Client View Data */
clientViewData!: ClientViewData;
constructor() {
this.route.parent.data.pipe(takeUntilDestroyed()).subscribe((data: { clientViewData: ClientViewData }) => {
this.clientViewData = data.clientViewData;
});
}
/**
* Check if client is a person (individual)
*/
isPerson(): boolean {
return this.clientViewData?.legalForm?.id === LegalFormId.PERSON;
}
/**
* Check if client is a legal entity (organization)
*/
isLegalEntity(): boolean {
return this.clientViewData?.legalForm?.id === LegalFormId.ENTITY;
}
/**
* Format ISO timestamp to DD-MM-YYYY HH:MM:SS
*/
formatDateTime(value: string): string {
if (!value) return '-';
try {
const d = new Date(value);
if (isNaN(d.getTime())) return value;
const dd = String(d.getDate()).padStart(2, '0');
const mm = String(d.getMonth() + 1).padStart(2, '0');
const yyyy = d.getFullYear();
const hh = String(d.getHours()).padStart(2, '0');
const min = String(d.getMinutes()).padStart(2, '0');
const ss = String(d.getSeconds()).padStart(2, '0');
return `${dd}-${mm}-${yyyy} ${hh}:${min}:${ss}`;
} catch {
return value;
}
}
}