Compare commits
25
Commits
733d9d22b2
...
uate
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c7d8287f9 | ||
|
|
a560cd6533 | ||
|
|
0bf337b962 | ||
|
|
1daa12a117 | ||
|
|
f687e1808d | ||
|
|
186a9057a1 | ||
|
|
387bd060e1 | ||
|
|
29f1cdc646 | ||
|
|
1efb520009 | ||
|
|
4ea833ff49 | ||
|
|
5dc284bd1c | ||
|
|
56f13ade67 | ||
|
|
dbd160e7e7 | ||
|
|
468eaa96ab | ||
|
|
f682cb17f6 | ||
|
|
79fedb66e5 | ||
|
|
c1fc95d9b7 | ||
|
|
b422ae6600 | ||
|
|
5fd7e1890e | ||
|
|
0389b1f7c3 | ||
|
|
2e4187c3d2 | ||
|
|
cb4260b7a3 | ||
|
|
349dc91951 | ||
|
|
a9c60083bf | ||
|
|
0c99dc3686 |
@@ -1 +0,0 @@
|
|||||||
{"sessionId":"67d120b4-ff78-435d-be80-f79482a386b4","pid":19832,"acquiredAt":1778067581856}
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 688 KiB |
@@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* 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 { Injectable, inject } from '@angular/core';
|
||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AML transaction-monitoring API: live alerts raised by the rule engine, the
|
||||||
|
* two-tier AML Officer / Principal Officer review workflow, STR cases (with
|
||||||
|
* their 7-working-day FIU filing deadline), monthly CTR reports, and a
|
||||||
|
* client's risk-category change history.
|
||||||
|
*/
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class AmlService {
|
||||||
|
private http = inject(HttpClient);
|
||||||
|
|
||||||
|
// ═══ Alerts (AML Officer) ═══
|
||||||
|
|
||||||
|
getAlerts(status?: string): Observable<any[]> {
|
||||||
|
const params = status ? new HttpParams().set('status', status) : undefined;
|
||||||
|
return this.http.get<any[]>('/aml/alerts', { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** disposition: 'WHITELIST' | 'ESCALATE' */
|
||||||
|
reviewAlert(alertId: number, disposition: 'WHITELIST' | 'ESCALATE', notes: string): Observable<any> {
|
||||||
|
return this.http.post(`/aml/alerts/${alertId}/review`, { disposition, notes });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══ STR cases (Principal Officer) ═══
|
||||||
|
|
||||||
|
getStrCases(): Observable<any[]> {
|
||||||
|
return this.http.get<any[]>('/aml/str-cases');
|
||||||
|
}
|
||||||
|
|
||||||
|
getStrCase(strCaseId: number): Observable<any> {
|
||||||
|
return this.http.get(`/aml/str-cases/${strCaseId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
getWeeklyDigest(): Observable<any[]> {
|
||||||
|
return this.http.get<any[]>('/aml/str-cases/weekly-digest');
|
||||||
|
}
|
||||||
|
|
||||||
|
assignPrincipalOfficer(strCaseId: number, principalOfficerUserId: number): Observable<any> {
|
||||||
|
return this.http.post(`/aml/str-cases/${strCaseId}/assign`, { principalOfficerUserId });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** conclusion: 'NOT_SUSPICIOUS' | 'SUSPICIOUS' */
|
||||||
|
concludeStrCase(
|
||||||
|
strCaseId: number,
|
||||||
|
conclusion: 'NOT_SUSPICIOUS' | 'SUSPICIOUS',
|
||||||
|
investigationNotes: string,
|
||||||
|
sourceOfFundsNotes: string
|
||||||
|
): Observable<any> {
|
||||||
|
return this.http.post(`/aml/str-cases/${strCaseId}/conclude`, {
|
||||||
|
conclusion,
|
||||||
|
investigationNotes,
|
||||||
|
sourceOfFundsNotes
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fileStr(strCaseId: number, referenceNo: string): Observable<any> {
|
||||||
|
return this.http.post(`/aml/str-cases/${strCaseId}/file`, { referenceNo });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══ CTR reports (mechanical, threshold-based) ═══
|
||||||
|
|
||||||
|
getCtrReports(): Observable<any[]> {
|
||||||
|
return this.http.get<any[]>('/aml/ctr-reports');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** month format: yyyy-MM */
|
||||||
|
generateCtrReport(month: string): Observable<any> {
|
||||||
|
return this.http.post('/aml/ctr-reports/generate', { month });
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══ Client risk-category history ═══
|
||||||
|
|
||||||
|
getRiskCategoryHistory(clientId: number): Observable<any[]> {
|
||||||
|
return this.http.get<any[]>(`/clients/${clientId}/risk-category-history`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -394,7 +394,12 @@ export class JointHolderDialogComponent implements OnInit {
|
|||||||
this.kyc = kycArr[0] ?? null;
|
this.kyc = kycArr[0] ?? null;
|
||||||
this.photo = photo ?? null;
|
this.photo = photo ?? null;
|
||||||
const docs: any[] = Array.isArray(documents) ? documents : [];
|
const docs: any[] = Array.isArray(documents) ? documents : [];
|
||||||
const sigDoc = docs.find((d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature'));
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced their
|
||||||
|
// signature before uploads became single-slot, so pick the highest id (latest) rather than
|
||||||
|
// the first unordered match.
|
||||||
|
const sigDoc = docs
|
||||||
|
.filter((d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature'))
|
||||||
|
.sort((a: any, b: any) => b.id - a.id)[0];
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (sigDoc) {
|
if (sigDoc) {
|
||||||
this.http
|
this.http
|
||||||
@@ -1868,7 +1873,12 @@ export class TransactionEntryComponent implements OnInit, OnDestroy {
|
|||||||
this.clientAddresses = Array.isArray(r.addresses) ? r.addresses : [];
|
this.clientAddresses = Array.isArray(r.addresses) ? r.addresses : [];
|
||||||
this.clientPhotoUrl = r.photo ?? null;
|
this.clientPhotoUrl = r.photo ?? null;
|
||||||
const docs: any[] = Array.isArray(r.documents) ? r.documents : [];
|
const docs: any[] = Array.isArray(r.documents) ? r.documents : [];
|
||||||
const sigDoc = docs.find((d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature'));
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced their
|
||||||
|
// signature before uploads became single-slot, so pick the highest id (latest) rather than
|
||||||
|
// the first unordered match.
|
||||||
|
const sigDoc = docs
|
||||||
|
.filter((d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature'))
|
||||||
|
.sort((a: any, b: any) => b.id - a.id)[0];
|
||||||
if (sigDoc) {
|
if (sigDoc) {
|
||||||
this.http
|
this.http
|
||||||
.get(`/clients/${clientId}/documents/${sigDoc.id}/attachment`, { responseType: 'blob' })
|
.get(`/clients/${clientId}/documents/${sigDoc.id}/attachment`, { responseType: 'blob' })
|
||||||
|
|||||||
@@ -446,8 +446,12 @@ export class RecordMasterComponent implements OnInit {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Signature — client document named 'clientSignature'
|
// 2. Signature — client document named 'clientSignature'. Multiple rows can exist for
|
||||||
const signatureDoc = (documents as any[])?.find((d: any) => d?.name === 'clientSignature');
|
// clients who re-cropped/replaced their signature before uploads became single-slot, so
|
||||||
|
// pick the highest id (latest) rather than the first unordered match.
|
||||||
|
const signatureDoc = (documents as any[])
|
||||||
|
?.filter((d: any) => d?.name === 'clientSignature')
|
||||||
|
?.sort((a: any, b: any) => b.id - a.id)?.[0];
|
||||||
if (signatureDoc) {
|
if (signatureDoc) {
|
||||||
this.viewDetails.docs.signature = {
|
this.viewDetails.docs.signature = {
|
||||||
present: true,
|
present: true,
|
||||||
|
|||||||
@@ -66,9 +66,12 @@ export class SignatoryService {
|
|||||||
fetchClientSignature(clientId: number | string): Observable<string | null> {
|
fetchClientSignature(clientId: number | string): Observable<string | null> {
|
||||||
return this.http.get<any[]>(`/clients/${clientId}/documents`).pipe(
|
return this.http.get<any[]>(`/clients/${clientId}/documents`).pipe(
|
||||||
switchMap((docs: any[]) => {
|
switchMap((docs: any[]) => {
|
||||||
const sigDoc = (docs || []).find(
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced
|
||||||
(d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature')
|
// their signature before uploads became single-slot, so pick the highest id (latest)
|
||||||
);
|
// rather than the first unordered match.
|
||||||
|
const sigDoc = (docs || [])
|
||||||
|
.filter((d: any) => d.name === 'clientSignature' || d.name?.toLowerCase().includes('signature'))
|
||||||
|
.sort((a: any, b: any) => b.id - a.id)[0];
|
||||||
if (!sigDoc) {
|
if (!sigDoc) {
|
||||||
return of(null);
|
return of(null);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
@@ -62,6 +62,22 @@
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<!-- Mother requirement — shown independently of the Father/Caretaker check below -->
|
||||||
|
@if (!nomineeOnly && clientFamilyMembers.length > 0 && !hasMother) {
|
||||||
|
<div class="fm-step__empty fm-step__empty--required">
|
||||||
|
<mat-icon class="fm-step__empty-icon">error_outline</mat-icon>
|
||||||
|
<span class="fm-step__empty-required">Mother is required.</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- Father-or-Caretaker requirement — shown independently of the Mother check above -->
|
||||||
|
@if (!nomineeOnly && clientFamilyMembers.length > 0 && !hasFather && !hasCaretaker) {
|
||||||
|
<div class="fm-step__empty fm-step__empty--required">
|
||||||
|
<mat-icon class="fm-step__empty-icon">error_outline</mat-icon>
|
||||||
|
<span class="fm-step__empty-required">Either Father or a Caretaker is required.</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<!-- Spouse hint for married clients -->
|
<!-- Spouse hint for married clients -->
|
||||||
@if (!nomineeOnly && isMarried && !hasSpouse) {
|
@if (!nomineeOnly && isMarried && !hasSpouse) {
|
||||||
<div class="fm-spouse-hint">
|
<div class="fm-spouse-hint">
|
||||||
|
|||||||
+44
@@ -12,6 +12,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component';
|
import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component';
|
||||||
import { ImageZoomDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component';
|
import { ImageZoomDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component';
|
||||||
|
import { FamilyMemberAddedDialogComponent } from './family-member-added-dialog.component';
|
||||||
import { ClientsService } from '../../clients.service';
|
import { ClientsService } from '../../clients.service';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { MatIcon } from '@angular/material/icon';
|
import { MatIcon } from '@angular/material/icon';
|
||||||
@@ -152,6 +153,22 @@ export class ClientFamilyMembersStepComponent implements OnInit {
|
|||||||
ref.afterClosed().subscribe((response: any) => {
|
ref.afterClosed().subscribe((response: any) => {
|
||||||
if (response?.member) {
|
if (response?.member) {
|
||||||
this.clientFamilyMembers.push(response.member);
|
this.clientFamilyMembers.push(response.member);
|
||||||
|
this.showFamilyMemberAddedConfirmation(response.member);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Confirms what was just recorded — in particular the linked client's own CBS Client ID,
|
||||||
|
* since the "Add Member" dialog closes silently otherwise and gives no acknowledgement. */
|
||||||
|
private showFamilyMemberAddedConfirmation(member: any): void {
|
||||||
|
this.dialog.open(FamilyMemberAddedDialogComponent, {
|
||||||
|
width: '360px',
|
||||||
|
data: {
|
||||||
|
clientId: member._linkedClient?.id ?? member.linkedClientId ?? null,
|
||||||
|
name: member._linkedClient?.displayName || member.firstName,
|
||||||
|
relationship: this.getRelName(member.relationshipId),
|
||||||
|
dateOfBirth: member.dateOfBirth,
|
||||||
|
isDependent: member.isDependent
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -223,6 +240,33 @@ export class ClientFamilyMembersStepComponent implements OnInit {
|
|||||||
return this.clientFamilyMembers.length > 0;
|
return this.clientFamilyMembers.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** True if a family member with the given relationship (case-insensitive) has been added */
|
||||||
|
private hasRelationship(name: string): boolean {
|
||||||
|
const target = name.toLowerCase();
|
||||||
|
return this.clientFamilyMembers.some((m: any) => {
|
||||||
|
const resolved = this.getRelName(m.relationshipId ?? m.relationship).toLowerCase();
|
||||||
|
if (resolved === target) return true;
|
||||||
|
return typeof m.relationship === 'string' && m.relationship.toLowerCase() === target;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasMother(): boolean {
|
||||||
|
return this.hasRelationship('mother');
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasFather(): boolean {
|
||||||
|
return this.hasRelationship('father');
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasCaretaker(): boolean {
|
||||||
|
return this.hasRelationship('caretaker');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Mother is always required; Father is required unless a Caretaker has been added instead. */
|
||||||
|
get familyRelationshipRulesMet(): boolean {
|
||||||
|
return this.hasMother && (this.hasFather || this.hasCaretaker);
|
||||||
|
}
|
||||||
|
|
||||||
/** Check if client's marital status is "Married" */
|
/** Check if client's marital status is "Married" */
|
||||||
get isMarried(): boolean {
|
get isMarried(): boolean {
|
||||||
if (!this.maritalStatusId || !this.maritalStatusOptions?.length) return false;
|
if (!this.maritalStatusId || !this.maritalStatusOptions?.length) return false;
|
||||||
|
|||||||
+145
@@ -0,0 +1,145 @@
|
|||||||
|
/**
|
||||||
|
* 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 { MatDialogRef, MAT_DIALOG_DATA, MatDialogTitle, MatDialogActions } from '@angular/material/dialog';
|
||||||
|
import { MatIcon } from '@angular/material/icon';
|
||||||
|
import { MatButton } from '@angular/material/button';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Confirmation popup shown right after a family member is added — surfaces the linked
|
||||||
|
* client's own CBS Client ID (when the member was linked to an existing client rather than
|
||||||
|
* entered manually) alongside name/relationship, since the "Add Member" dialog itself just
|
||||||
|
* closed silently before this with no acknowledgement of what got recorded.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-family-member-added-dialog',
|
||||||
|
imports: [
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogActions,
|
||||||
|
MatIcon,
|
||||||
|
MatButton
|
||||||
|
],
|
||||||
|
template: `
|
||||||
|
<h2 mat-dialog-title class="fma-title">
|
||||||
|
<mat-icon class="fma-title__icon">check_circle</mat-icon>
|
||||||
|
Family Member Added
|
||||||
|
</h2>
|
||||||
|
<div class="fma-body">
|
||||||
|
@if (data.clientId) {
|
||||||
|
<div class="fma-row fma-row--id">
|
||||||
|
<span class="fma-row__label">Client ID</span>
|
||||||
|
<span class="fma-row__value fma-row__value--id">{{ data.clientId }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
<div class="fma-row">
|
||||||
|
<span class="fma-row__label">Name</span>
|
||||||
|
<span class="fma-row__value">{{ data.name }}</span>
|
||||||
|
</div>
|
||||||
|
@if (data.relationship) {
|
||||||
|
<div class="fma-row">
|
||||||
|
<span class="fma-row__label">Relationship</span>
|
||||||
|
<span class="fma-row__value">{{ data.relationship }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (data.dateOfBirth) {
|
||||||
|
<div class="fma-row">
|
||||||
|
<span class="fma-row__label">Date of Birth</span>
|
||||||
|
<span class="fma-row__value">{{ data.dateOfBirth }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
@if (data.isDependent) {
|
||||||
|
<div class="fma-row">
|
||||||
|
<span class="fma-row__label">Dependent</span>
|
||||||
|
<span class="fma-row__value">Yes</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-flat-button color="primary" (click)="dialogRef.close()">Done</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
|
`,
|
||||||
|
styles: [
|
||||||
|
`
|
||||||
|
.fma-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #0f172a;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px 24px 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-title__icon {
|
||||||
|
color: #059669;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-body {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
padding: 12px 24px 8px;
|
||||||
|
min-width: 280px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
padding: 8px 0;
|
||||||
|
border-bottom: 1px solid #f1f5f9;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-row__label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #64748b;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-row__value {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #0f172a;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-row--id {
|
||||||
|
background: #eff6ff;
|
||||||
|
margin: 0 -24px;
|
||||||
|
padding: 10px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fma-row__value--id {
|
||||||
|
font-family: 'Roboto Mono', monospace;
|
||||||
|
color: #1353a0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
mat-dialog-actions {
|
||||||
|
padding: 8px 24px 16px;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class FamilyMemberAddedDialogComponent {
|
||||||
|
dialogRef = inject<MatDialogRef<FamilyMemberAddedDialogComponent>>(MatDialogRef);
|
||||||
|
data: {
|
||||||
|
clientId?: string | number | null;
|
||||||
|
name: string;
|
||||||
|
relationship?: string;
|
||||||
|
dateOfBirth?: string;
|
||||||
|
isDependent?: boolean;
|
||||||
|
} = inject(MAT_DIALOG_DATA);
|
||||||
|
}
|
||||||
+140
-13
@@ -136,7 +136,7 @@
|
|||||||
| translate
|
| translate
|
||||||
}}
|
}}
|
||||||
</mat-label>
|
</mat-label>
|
||||||
<input matInput required formControlName="fullname" />
|
<input matInput required formControlName="fullname" autocomplete="off" />
|
||||||
@if (createClientForm.controls.fullname.hasError('required')) {
|
@if (createClientForm.controls.fullname.hasError('required')) {
|
||||||
<mat-error>Client name is <strong>required</strong></mat-error>
|
<mat-error>Client name is <strong>required</strong></mat-error>
|
||||||
} @else if (createClientForm.controls.fullname.hasError('pattern')) {
|
} @else if (createClientForm.controls.fullname.hasError('pattern')) {
|
||||||
@@ -214,7 +214,7 @@
|
|||||||
<mat-form-field appearance="outline" class="name-field first-name">
|
<mat-form-field appearance="outline" class="name-field first-name">
|
||||||
<mat-label>{{ 'labels.inputs.First Name' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.First Name' | translate }}</mat-label>
|
||||||
<span matPrefix class="field-prefix-icon"><mat-icon>badge</mat-icon></span>
|
<span matPrefix class="field-prefix-icon"><mat-icon>badge</mat-icon></span>
|
||||||
<input matInput required formControlName="firstname" />
|
<input matInput required formControlName="firstname" autocomplete="off" />
|
||||||
@if (createClientForm.controls.firstname.hasError('required')) {
|
@if (createClientForm.controls.firstname.hasError('required')) {
|
||||||
<mat-error>First name is <strong>required</strong></mat-error>
|
<mat-error>First name is <strong>required</strong></mat-error>
|
||||||
} @else if (createClientForm.controls.firstname.hasError('pattern')) {
|
} @else if (createClientForm.controls.firstname.hasError('pattern')) {
|
||||||
@@ -228,7 +228,7 @@
|
|||||||
<mat-form-field appearance="outline" class="name-field middle-name">
|
<mat-form-field appearance="outline" class="name-field middle-name">
|
||||||
<mat-label>{{ 'labels.inputs.Middle Name' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Middle Name' | translate }}</mat-label>
|
||||||
<span matPrefix class="field-prefix-icon"><mat-icon>person_outline</mat-icon></span>
|
<span matPrefix class="field-prefix-icon"><mat-icon>person_outline</mat-icon></span>
|
||||||
<input matInput formControlName="middlename" />
|
<input matInput formControlName="middlename" autocomplete="off" />
|
||||||
@if (
|
@if (
|
||||||
createClientForm.controls.middlename?.hasError('pattern') &&
|
createClientForm.controls.middlename?.hasError('pattern') &&
|
||||||
createClientForm.controls.middlename?.touched
|
createClientForm.controls.middlename?.touched
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
<mat-form-field appearance="outline" class="name-field last-name">
|
<mat-form-field appearance="outline" class="name-field last-name">
|
||||||
<mat-label>{{ 'labels.inputs.Last Name' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Last Name' | translate }}</mat-label>
|
||||||
<span matPrefix class="field-prefix-icon"><mat-icon>person</mat-icon></span>
|
<span matPrefix class="field-prefix-icon"><mat-icon>person</mat-icon></span>
|
||||||
<input matInput required formControlName="lastname" />
|
<input matInput required formControlName="lastname" autocomplete="off" />
|
||||||
@if (createClientForm.controls.lastname.hasError('required')) {
|
@if (createClientForm.controls.lastname.hasError('required')) {
|
||||||
<mat-error>Last name is <strong>required</strong></mat-error>
|
<mat-error>Last name is <strong>required</strong></mat-error>
|
||||||
} @else if (createClientForm.controls.lastname.hasError('pattern')) {
|
} @else if (createClientForm.controls.lastname.hasError('pattern')) {
|
||||||
@@ -358,11 +358,14 @@
|
|||||||
@if (isMinor) {
|
@if (isMinor) {
|
||||||
<span class="minor-badge">Minor</span>
|
<span class="minor-badge">Minor</span>
|
||||||
}
|
}
|
||||||
|
@if (isSeniorCitizen) {
|
||||||
|
<span class="senior-citizen-badge">Senior Citizen</span>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Minor / Guardian Mapping (mandatory if age < 10) -->
|
<!-- Minor / Guardian Mapping (mandatory if age < 18) -->
|
||||||
@if (isMinor && createClientForm.get('legalFormId')?.value === LegalFormId.PERSON) {
|
@if (isMinor && createClientForm.get('legalFormId')?.value === LegalFormId.PERSON) {
|
||||||
<div class="guardian-section">
|
<div class="guardian-section">
|
||||||
<!-- Header bar -->
|
<!-- Header bar -->
|
||||||
@@ -1032,8 +1035,7 @@
|
|||||||
Education & Social Details
|
Education & Social Details
|
||||||
</h4>
|
</h4>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<!-- Education Level (non-minor) -->
|
<!-- Education Level -->
|
||||||
@if (!isMinor) {
|
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Education Level</mat-label>
|
<mat-label>Education Level</mat-label>
|
||||||
<mat-select formControlName="educationLevelId">
|
<mat-select formControlName="educationLevelId">
|
||||||
@@ -1094,7 +1096,6 @@
|
|||||||
}
|
}
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
}
|
|
||||||
|
|
||||||
<!-- Religion -->
|
<!-- Religion -->
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
@@ -1217,21 +1218,25 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Annual Turnover (Last FY)</mat-label>
|
<mat-label>Annual Income</mat-label>
|
||||||
<span matPrefix class="rupee-prefix">₹</span>
|
<span matPrefix class="rupee-prefix">₹</span>
|
||||||
<input matInput type="number" formControlName="annualTurnover" min="0" />
|
<input matInput type="number" formControlName="annualIncome" min="0" />
|
||||||
@if (
|
@if (
|
||||||
createClientForm.get('annualTurnover')?.hasError('pattern') &&
|
createClientForm.get('annualIncome')?.hasError('pattern') && createClientForm.get('annualIncome')?.touched
|
||||||
createClientForm.get('annualTurnover')?.touched
|
|
||||||
) {
|
) {
|
||||||
<mat-error>Enter a valid amount</mat-error>
|
<mat-error>Enter a valid amount</mat-error>
|
||||||
} @else if (
|
} @else if (
|
||||||
createClientForm.get('annualTurnover')?.hasError('min') && createClientForm.get('annualTurnover')?.touched
|
createClientForm.get('annualIncome')?.hasError('min') && createClientForm.get('annualIncome')?.touched
|
||||||
) {
|
) {
|
||||||
<mat-error>Amount cannot be negative</mat-error>
|
<mat-error>Amount cannot be negative</mat-error>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div class="full-width subsection-title">
|
||||||
|
<fa-icon icon="coins" class="subsection-icon"></fa-icon>
|
||||||
|
Other Income
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Agriculture Income</mat-label>
|
<mat-label>Agriculture Income</mat-label>
|
||||||
<span matPrefix class="rupee-prefix">₹</span>
|
<span matPrefix class="rupee-prefix">₹</span>
|
||||||
@@ -1265,6 +1270,128 @@
|
|||||||
<mat-error>Amount cannot be negative</mat-error>
|
<mat-error>Amount cannot be negative</mat-error>
|
||||||
}
|
}
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
|
<mat-label>Monthly Turnover</mat-label>
|
||||||
|
<span matPrefix class="rupee-prefix">₹</span>
|
||||||
|
<input matInput type="number" formControlName="monthlyTurnover" min="0" />
|
||||||
|
@if (
|
||||||
|
createClientForm.get('monthlyTurnover')?.hasError('pattern') &&
|
||||||
|
createClientForm.get('monthlyTurnover')?.touched
|
||||||
|
) {
|
||||||
|
<mat-error>Enter a valid amount</mat-error>
|
||||||
|
} @else if (
|
||||||
|
createClientForm.get('monthlyTurnover')?.hasError('min') && createClientForm.get('monthlyTurnover')?.touched
|
||||||
|
) {
|
||||||
|
<mat-error>Amount cannot be negative</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
|
<mat-label>Yearly Turnover</mat-label>
|
||||||
|
<span matPrefix class="rupee-prefix">₹</span>
|
||||||
|
<input matInput type="number" formControlName="annualTurnover" min="0" />
|
||||||
|
@if (
|
||||||
|
createClientForm.get('annualTurnover')?.hasError('pattern') &&
|
||||||
|
createClientForm.get('annualTurnover')?.touched
|
||||||
|
) {
|
||||||
|
<mat-error>Enter a valid amount</mat-error>
|
||||||
|
} @else if (
|
||||||
|
createClientForm.get('annualTurnover')?.hasError('min') && createClientForm.get('annualTurnover')?.touched
|
||||||
|
) {
|
||||||
|
<mat-error>Amount cannot be negative</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div class="full-width subsection-title">
|
||||||
|
<fa-icon icon="user-shield" class="subsection-icon"></fa-icon>
|
||||||
|
Senior Citizen / Person with Disability
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (isSeniorCitizen) {
|
||||||
|
<div class="full-width senior-citizen-auto-note">
|
||||||
|
<fa-icon icon="check-circle"></fa-icon>
|
||||||
|
Senior Citizen (60+ years) — detected automatically from Date of Birth
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="full-width doc-upload-field">
|
||||||
|
<label class="doc-upload-label">
|
||||||
|
<input type="file" accept=".jpg,.jpeg,.png,.pdf" hidden (change)="onSeniorCitizenProofSelected($event)" />
|
||||||
|
<fa-icon icon="file-upload"></fa-icon>
|
||||||
|
@if (seniorCitizenProofFile) {
|
||||||
|
<span>{{ seniorCitizenProofFile.name }}</span>
|
||||||
|
} @else if (existingSeniorCitizenProofDoc) {
|
||||||
|
<span>{{ existingSeniorCitizenProofDoc.name }} (uploaded)</span>
|
||||||
|
} @else {
|
||||||
|
<span>Upload Senior Citizen Proof (Age / ID Proof) — optional</span>
|
||||||
|
}
|
||||||
|
</label>
|
||||||
|
@if (seniorCitizenProofFile) {
|
||||||
|
<button type="button" mat-icon-button (click)="removeSeniorCitizenProof()" matTooltip="Remove">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
} @else if (existingSeniorCitizenProofDoc) {
|
||||||
|
<button type="button" mat-icon-button (click)="viewExistingSeniorCitizenProof()" matTooltip="View">
|
||||||
|
<mat-icon>visibility</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button type="button" mat-icon-button (click)="removeExistingSeniorCitizenProof()" matTooltip="Remove">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="checkbox-field full-width">
|
||||||
|
<mat-checkbox formControlName="isPwd">Person with Disability (PWD)</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (createClientForm.get('isPwd')?.value) {
|
||||||
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
|
<mat-label>Disability Type</mat-label>
|
||||||
|
<mat-select formControlName="pwdCategoryId">
|
||||||
|
@for (category of pwdCategoryOptions; track category.id) {
|
||||||
|
<mat-option [value]="category.id">{{ category.name }}</mat-option>
|
||||||
|
}
|
||||||
|
</mat-select>
|
||||||
|
@if (seniorPwdDocsTouched && !createClientForm.get('pwdCategoryId')?.value) {
|
||||||
|
<mat-error>Disability type is required</mat-error>
|
||||||
|
}
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<div class="full-width doc-upload-field">
|
||||||
|
<label
|
||||||
|
class="doc-upload-label"
|
||||||
|
[class.doc-upload-label--missing]="
|
||||||
|
seniorPwdDocsTouched && !pwdCertificateFile && !existingPwdCertificateDoc
|
||||||
|
"
|
||||||
|
>
|
||||||
|
<input type="file" accept=".jpg,.jpeg,.png,.pdf" hidden (change)="onPwdCertificateSelected($event)" />
|
||||||
|
<fa-icon icon="file-upload"></fa-icon>
|
||||||
|
@if (pwdCertificateFile) {
|
||||||
|
<span>{{ pwdCertificateFile.name }}</span>
|
||||||
|
} @else if (existingPwdCertificateDoc) {
|
||||||
|
<span>{{ existingPwdCertificateDoc.name }} (uploaded)</span>
|
||||||
|
} @else {
|
||||||
|
<span>Upload Disability Certificate <span class="doc-upload-req">*</span></span>
|
||||||
|
}
|
||||||
|
</label>
|
||||||
|
@if (pwdCertificateFile) {
|
||||||
|
<button type="button" mat-icon-button (click)="removePwdCertificate()" matTooltip="Remove">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
} @else if (existingPwdCertificateDoc) {
|
||||||
|
<button type="button" mat-icon-button (click)="viewExistingPwdCertificate()" matTooltip="View">
|
||||||
|
<mat-icon>visibility</mat-icon>
|
||||||
|
</button>
|
||||||
|
<button type="button" mat-icon-button (click)="removeExistingPwdCertificate()" matTooltip="Remove">
|
||||||
|
<mat-icon>close</mat-icon>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
@if (seniorPwdDocsTouched && !pwdCertificateFile && !existingPwdCertificateDoc) {
|
||||||
|
<span class="doc-upload-error">Required when PWD is checked</span>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,78 @@ form {
|
|||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.senior-citizen-auto-note {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #1074b9;
|
||||||
|
background: #eff6ff;
|
||||||
|
border: 1px solid #bfdbfe;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 8px 12px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-upload-field {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-upload-label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
flex: 1;
|
||||||
|
padding: 10px 14px;
|
||||||
|
border: 1px dashed #cbd5e1;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #475569;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
border-color: #1074b9;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.doc-upload-label--missing {
|
||||||
|
border-color: #dc2626;
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-upload-req {
|
||||||
|
color: #dc2626;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-upload-error {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #dc2626;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subsection-title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
color: #6b7280;
|
||||||
|
margin: 20px 0 4px;
|
||||||
|
padding-top: 16px;
|
||||||
|
border-top: 1px solid #e5e7eb;
|
||||||
|
|
||||||
|
.subsection-icon {
|
||||||
|
color: var(--md-sys-color-primary, #1074b9);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.checkbox-field {
|
.checkbox-field {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -234,6 +306,18 @@ form {
|
|||||||
letter-spacing: 0.5px;
|
letter-spacing: 0.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.senior-citizen-badge {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: 700;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #eff6ff;
|
||||||
|
color: #1074b9;
|
||||||
|
margin-left: 6px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ═══ Guardian Section (Redesigned) ═══ */
|
/* ═══ Guardian Section (Redesigned) ═══ */
|
||||||
.guardian-section {
|
.guardian-section {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
|
|||||||
+399
-6
@@ -46,6 +46,7 @@ import { MatSelectTrigger } from '@angular/material/select';
|
|||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { MatDialog, MAT_DIALOG_DATA, MatDialogContent, MatDialogClose } from '@angular/material/dialog';
|
import { MatDialog, MAT_DIALOG_DATA, MatDialogContent, MatDialogClose } from '@angular/material/dialog';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DocumentPreviewDialogComponent } from '../../shared/document-preview-dialog/document-preview-dialog.component';
|
||||||
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
||||||
import { SanctionsVerifyDialogComponent } from './sanctions-verify-dialog.component';
|
import { SanctionsVerifyDialogComponent } from './sanctions-verify-dialog.component';
|
||||||
import { DipVerifyDialogComponent } from './dip-verify-dialog.component';
|
import { DipVerifyDialogComponent } from './dip-verify-dialog.component';
|
||||||
@@ -93,6 +94,148 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
/** Expose enum to template */
|
/** Expose enum to template */
|
||||||
readonly LegalFormId = LegalFormId;
|
readonly LegalFormId = LegalFormId;
|
||||||
|
|
||||||
|
/** Senior Citizen proof is optional; the PWD certificate is mandatory (see seniorPwdDocsComplete). Both, when
|
||||||
|
* attached, are uploaded after client creation. */
|
||||||
|
seniorCitizenProofFile: File | null = null;
|
||||||
|
pwdCertificateFile: File | null = null;
|
||||||
|
|
||||||
|
/** Previously-uploaded documents, loaded in edit mode so the certificate doesn't appear to
|
||||||
|
* "disappear" on reopening — the raw File properties above only ever hold a fresh selection. */
|
||||||
|
existingSeniorCitizenProofDoc: { id: string; name: string } | null = null;
|
||||||
|
existingPwdCertificateDoc: { id: string; name: string } | null = null;
|
||||||
|
|
||||||
|
/** Disability categories (per the Rights of Persons with Disabilities Act, 2016) — fetched from
|
||||||
|
* m_code_value (code "PwdCategory") via the client template, same as occupationCategoryOptions.
|
||||||
|
* Admins can add/reorder/deactivate entries from System -> Manage Codes without a code change. */
|
||||||
|
pwdCategoryOptions: any[] = [];
|
||||||
|
riskRules: any[] = [];
|
||||||
|
|
||||||
|
/** Set true after a save attempt so the UI can highlight a missing required document */
|
||||||
|
seniorPwdDocsTouched = false;
|
||||||
|
|
||||||
|
/** Senior Citizen proof is optional. The PWD certificate + disability type are mandatory
|
||||||
|
* whenever the PWD checkbox is set. */
|
||||||
|
get seniorPwdDocsComplete(): boolean {
|
||||||
|
const pwdOk =
|
||||||
|
!this.createClientForm.get('isPwd')?.value ||
|
||||||
|
((!!this.pwdCertificateFile || !!this.existingPwdCertificateDoc) &&
|
||||||
|
!!this.createClientForm.get('pwdCategoryId')?.value);
|
||||||
|
return pwdOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
markSeniorPwdDocsTouched(): void {
|
||||||
|
this.seniorPwdDocsTouched = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
onSeniorCitizenProofSelected(event: any): void {
|
||||||
|
const file = event.target?.files?.[0];
|
||||||
|
if (file) {
|
||||||
|
this.seniorCitizenProofFile = file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removeSeniorCitizenProof(): void {
|
||||||
|
this.seniorCitizenProofFile = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
onPwdCertificateSelected(event: any): void {
|
||||||
|
const file = event.target?.files?.[0];
|
||||||
|
if (file) {
|
||||||
|
this.pwdCertificateFile = file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removePwdCertificate(): void {
|
||||||
|
this.pwdCertificateFile = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Loads previously-uploaded senior-citizen-proof / PWD-certificate documents in edit mode —
|
||||||
|
* mirrors the KYC step's loadExistingSignature() pattern so re-opening edit shows what's
|
||||||
|
* already on file instead of an empty upload prompt. */
|
||||||
|
private loadExistingSeniorPwdDocuments(): void {
|
||||||
|
const clientId = this.clientData?.id;
|
||||||
|
if (!clientId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.clientService.getClientDocuments(clientId.toString()).subscribe({
|
||||||
|
next: (documents: any[]) => {
|
||||||
|
const seniorDoc = documents
|
||||||
|
?.filter((d: any) => d.name === 'seniorCitizenProof')
|
||||||
|
?.sort((a: any, b: any) => b.id - a.id)?.[0];
|
||||||
|
if (seniorDoc?.id) {
|
||||||
|
this.existingSeniorCitizenProofDoc = {
|
||||||
|
id: seniorDoc.id.toString(),
|
||||||
|
name: seniorDoc.fileName || 'Senior Citizen Proof'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const pwdDoc = documents
|
||||||
|
?.filter((d: any) => d.name === 'pwdCertificate')
|
||||||
|
?.sort((a: any, b: any) => b.id - a.id)?.[0];
|
||||||
|
if (pwdDoc?.id) {
|
||||||
|
this.existingPwdCertificateDoc = {
|
||||||
|
id: pwdDoc.id.toString(),
|
||||||
|
name: pwdDoc.fileName || 'Disability Certificate'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
viewExistingSeniorCitizenProof(): void {
|
||||||
|
const clientId = this.clientData?.id;
|
||||||
|
if (!clientId || !this.existingSeniorCitizenProofDoc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.clientService.downloadClientDocument(clientId.toString(), this.existingSeniorCitizenProofDoc.id).subscribe({
|
||||||
|
next: (blob: any) =>
|
||||||
|
this.dialog.open(DocumentPreviewDialogComponent, {
|
||||||
|
data: {
|
||||||
|
blob,
|
||||||
|
title: this.existingSeniorCitizenProofDoc?.name,
|
||||||
|
fileName: this.existingSeniorCitizenProofDoc?.name
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
removeExistingSeniorCitizenProof(): void {
|
||||||
|
const clientId = this.clientData?.id;
|
||||||
|
if (!clientId || !this.existingSeniorCitizenProofDoc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.clientService.deleteClientDocument(clientId.toString(), this.existingSeniorCitizenProofDoc.id).subscribe({
|
||||||
|
next: () => (this.existingSeniorCitizenProofDoc = null),
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
viewExistingPwdCertificate(): void {
|
||||||
|
const clientId = this.clientData?.id;
|
||||||
|
if (!clientId || !this.existingPwdCertificateDoc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.clientService.downloadClientDocument(clientId.toString(), this.existingPwdCertificateDoc.id).subscribe({
|
||||||
|
next: (blob: any) =>
|
||||||
|
this.dialog.open(DocumentPreviewDialogComponent, {
|
||||||
|
data: { blob, title: this.existingPwdCertificateDoc?.name, fileName: this.existingPwdCertificateDoc?.name }
|
||||||
|
}),
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
removeExistingPwdCertificate(): void {
|
||||||
|
const clientId = this.clientData?.id;
|
||||||
|
if (!clientId || !this.existingPwdCertificateDoc) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.clientService.deleteClientDocument(clientId.toString(), this.existingPwdCertificateDoc.id).subscribe({
|
||||||
|
next: () => (this.existingPwdCertificateDoc = null),
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** Minimum date allowed. */
|
/** Minimum date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
/** Maximum date allowed. */
|
/** Maximum date allowed. */
|
||||||
@@ -155,8 +298,10 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
];
|
];
|
||||||
/** Calculated age detail string (Y/M/D) */
|
/** Calculated age detail string (Y/M/D) */
|
||||||
calculatedAgeDetail: string | null = null;
|
calculatedAgeDetail: string | null = null;
|
||||||
/** Whether client is a minor (age < 10) */
|
/** Whether client is a minor (age < 18) */
|
||||||
isMinor = false;
|
isMinor = false;
|
||||||
|
/** Whether client is a senior citizen (age >= 60) — auto-detected from Date of Birth */
|
||||||
|
isSeniorCitizen = false;
|
||||||
/** Age breakdown for DB storage */
|
/** Age breakdown for DB storage */
|
||||||
ageBreakdown = { years: 0, months: 0, days: 0 };
|
ageBreakdown = { years: 0, months: 0, days: 0 };
|
||||||
|
|
||||||
@@ -402,6 +547,18 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.maxDate = this.settingsService.businessDate;
|
this.maxDate = this.settingsService.businessDate;
|
||||||
this.setOptions();
|
this.setOptions();
|
||||||
|
|
||||||
|
// Risk rules are an enhancement on top of the default low/medium-risk fallback in
|
||||||
|
// calculatedRisk — if the endpoint isn't available (e.g. not yet deployed on this
|
||||||
|
// backend), fail silently rather than surfacing a raw HTTP-error toast to the user.
|
||||||
|
this.clientService.getClientRiskRules().subscribe({
|
||||||
|
next: (rules) => {
|
||||||
|
this.riskRules = rules || [];
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.riskRules = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
// Fetch marital status options from code values
|
// Fetch marital status options from code values
|
||||||
this.clientService.getCodeValuesByName('MaritalStatus').subscribe((options) => {
|
this.clientService.getCodeValuesByName('MaritalStatus').subscribe((options) => {
|
||||||
this.maritalStatusOptions = options || [];
|
this.maritalStatusOptions = options || [];
|
||||||
@@ -466,6 +623,51 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets transient session state back to a blank-client baseline.
|
||||||
|
*
|
||||||
|
* This app's RouteReusableStrategy (core/route/route-reusable-strategy.ts) keeps the SAME
|
||||||
|
* component instance alive across repeat visits to /clients/create — `ngOnInit`/the
|
||||||
|
* constructor never re-run for a second "create new client" session. Without this, computed
|
||||||
|
* state like `isMinor`, the linked guardian, or a prior sanctions/OTP verification would leak
|
||||||
|
* from whatever client was created in the previous session into the new one. Called by
|
||||||
|
* CreateClientComponent whenever `route.data` re-emits (which happens on every navigation,
|
||||||
|
* even a reused one).
|
||||||
|
*/
|
||||||
|
resetForNewClient(): void {
|
||||||
|
this.createClientForm.reset();
|
||||||
|
// legalFormId's raw FormControl default is '' — the buildDependencies() subscription
|
||||||
|
// treats any non-PERSON value (including '') as "non-individual" and adds fullname /
|
||||||
|
// clientNonPersonDetails. Patch it back to the same PERSON default buildDependencies()
|
||||||
|
// itself applies on first construction, so a reset lands on a blank Individual client
|
||||||
|
// instead of stuck with leftover Entity-only controls.
|
||||||
|
this.createClientForm.get('legalFormId')?.setValue(LegalFormId.PERSON);
|
||||||
|
this.isMinor = false;
|
||||||
|
this.calculatedAgeDetail = null;
|
||||||
|
this.ageBreakdown = { years: 0, months: 0, days: 0 };
|
||||||
|
this.selectedGuardian = null;
|
||||||
|
this.guardianSearchText = '';
|
||||||
|
this.guardianSearchResults = [];
|
||||||
|
this.guardianExpanded = false;
|
||||||
|
if (this.createClientForm.get('guardianDetails')) {
|
||||||
|
this.createClientForm.removeControl('guardianDetails');
|
||||||
|
}
|
||||||
|
// Verification state must not carry over — a previous client's cleared sanctions
|
||||||
|
// screening or verified OTP must not silently apply to a different new client.
|
||||||
|
this.mobileVerified = false;
|
||||||
|
this.dipLookupLogId = null;
|
||||||
|
this.dipTimestamp = null;
|
||||||
|
this.alternateMobileVerified = false;
|
||||||
|
this.alternateDipLookupLogId = null;
|
||||||
|
this.alternateDipTimestamp = null;
|
||||||
|
this.mobileNewOtpId = null;
|
||||||
|
this.emailNewOtpId = null;
|
||||||
|
this.sanctionsVerified = false;
|
||||||
|
this.sanctionsBlocked = false;
|
||||||
|
this.screeningLogId = null;
|
||||||
|
this.verifiedName = '';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pre-fills the General step form from a manually-entered family member
|
* Pre-fills the General step form from a manually-entered family member
|
||||||
* when the user clicks "Create as Client" on the family members tab.
|
* when the user clicks "Create as Client" on the family members tab.
|
||||||
@@ -505,6 +707,7 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
*/
|
*/
|
||||||
private prefillForEdit() {
|
private prefillForEdit() {
|
||||||
const data = this.clientData;
|
const data = this.clientData;
|
||||||
|
this.loadExistingSeniorPwdDocuments();
|
||||||
|
|
||||||
// Patch all base controls that exist on the form
|
// Patch all base controls that exist on the form
|
||||||
this.createClientForm.patchValue({
|
this.createClientForm.patchValue({
|
||||||
@@ -521,11 +724,19 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
mobileNo: data.mobileNo,
|
mobileNo: data.mobileNo,
|
||||||
alternateMobileNo: data.alternateMobileNo || '',
|
alternateMobileNo: data.alternateMobileNo || '',
|
||||||
emailAddress: data.emailAddress,
|
emailAddress: data.emailAddress,
|
||||||
dateOfBirth: data.dateOfBirth ? new Date(data.dateOfBirth) : '',
|
dateOfBirth: data.dateOfBirth
|
||||||
|
? Array.isArray(data.dateOfBirth)
|
||||||
|
? new Date(data.dateOfBirth[0], data.dateOfBirth[1] - 1, data.dateOfBirth[2])
|
||||||
|
: new Date(data.dateOfBirth)
|
||||||
|
: '',
|
||||||
occupationCategoryId: data.occupationCategory?.id || data.occupationCategoryId || '',
|
occupationCategoryId: data.occupationCategory?.id || data.occupationCategoryId || '',
|
||||||
occupationId: data.occupation?.id || data.occupationId || '',
|
occupationId: data.occupation?.id || data.occupationId || '',
|
||||||
monthlyIncome: data.monthlyIncome || '',
|
monthlyIncome: data.monthlyIncome || '',
|
||||||
|
annualIncome: data.annualIncome || '',
|
||||||
annualTurnover: data.annualTurnover || '',
|
annualTurnover: data.annualTurnover || '',
|
||||||
|
monthlyTurnover: data.monthlyTurnover || '',
|
||||||
|
isPwd: data.isPwd || false,
|
||||||
|
pwdCategoryId: data.pwdCategory?.id || '',
|
||||||
agricultureIncome: data.agricultureIncome || '',
|
agricultureIncome: data.agricultureIncome || '',
|
||||||
nonAgricultureIncome: data.nonAgricultureIncome || '',
|
nonAgricultureIncome: data.nonAgricultureIncome || '',
|
||||||
submittedOnDate: data.timeline?.submittedOnDate
|
submittedOnDate: data.timeline?.submittedOnDate
|
||||||
@@ -599,6 +810,42 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore linked guardian for minor clients. The `guardianDetails` control group above was
|
||||||
|
// just created synchronously by the dateOfBirth subscription (patched a few lines up), which
|
||||||
|
// also resets `selectedGuardian` to null — so this has to run after that patch, not before it.
|
||||||
|
// If a guardian is linked in the database (or the client is marked minor), we force minor state
|
||||||
|
// and explicitly ensure the form control exists so the guardian details load correctly.
|
||||||
|
if ((data.isMinor || this.isMinor || data.guardianClientId) && data.guardianClientId) {
|
||||||
|
this.isMinor = true;
|
||||||
|
if (!this.createClientForm.get('guardianDetails')) {
|
||||||
|
this.createClientForm.addControl(
|
||||||
|
'guardianDetails',
|
||||||
|
this.formBuilder.group({
|
||||||
|
guardianClientId: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
guardianRelation: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
]
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setTimeout(() => {
|
||||||
|
this.createClientForm.get('guardianDetails')?.patchValue({
|
||||||
|
guardianClientId: data.guardianClientId,
|
||||||
|
guardianRelation: data.guardianRelation || ''
|
||||||
|
});
|
||||||
|
this.selectedGuardian = {
|
||||||
|
id: data.guardianClientId,
|
||||||
|
displayName: data.guardianClientDisplayName || '',
|
||||||
|
_loading: true
|
||||||
|
};
|
||||||
|
this.fetchClientFullDetails(data.guardianClientId, this.selectedGuardian);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -665,6 +912,13 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
Validators.min(0)
|
Validators.min(0)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
annualIncome: [
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
Validators.pattern(/^\d+(\.\d{1,2})?$/),
|
||||||
|
Validators.min(0)
|
||||||
|
]
|
||||||
|
],
|
||||||
annualTurnover: [
|
annualTurnover: [
|
||||||
'',
|
'',
|
||||||
[
|
[
|
||||||
@@ -672,6 +926,15 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
Validators.min(0)
|
Validators.min(0)
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
monthlyTurnover: [
|
||||||
|
'',
|
||||||
|
[
|
||||||
|
Validators.pattern(/^\d+(\.\d{1,2})?$/),
|
||||||
|
Validators.min(0)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
isPwd: [false],
|
||||||
|
pwdCategoryId: [''],
|
||||||
agricultureIncome: [
|
agricultureIncome: [
|
||||||
'',
|
'',
|
||||||
[
|
[
|
||||||
@@ -709,6 +972,7 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
this.occupationCategoryOptions = this.clientTemplate.occupationCategoryOptions || [];
|
this.occupationCategoryOptions = this.clientTemplate.occupationCategoryOptions || [];
|
||||||
this.occupationOptions = this.clientTemplate.occupationOptions || [];
|
this.occupationOptions = this.clientTemplate.occupationOptions || [];
|
||||||
this.salutationOptions = this.clientTemplate.salutationOptions || [];
|
this.salutationOptions = this.clientTemplate.salutationOptions || [];
|
||||||
|
this.pwdCategoryOptions = this.clientTemplate.pwdCategoryOptions || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -824,7 +1088,8 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
this.calculatedAgeDetail = `${years} yr${years !== 1 ? 's' : ''} ${months} mo${months !== 1 ? 's' : ''} ${days} day${days !== 1 ? 's' : ''}`;
|
this.calculatedAgeDetail = `${years} yr${years !== 1 ? 's' : ''} ${months} mo${months !== 1 ? 's' : ''} ${days} day${days !== 1 ? 's' : ''}`;
|
||||||
this.ageBreakdown = { years, months, days };
|
this.ageBreakdown = { years, months, days };
|
||||||
const wasMinor = this.isMinor;
|
const wasMinor = this.isMinor;
|
||||||
this.isMinor = years < 10;
|
this.isMinor = years < 18;
|
||||||
|
this.isSeniorCitizen = years >= 60;
|
||||||
// Add/remove guardian form group based on minor status
|
// Add/remove guardian form group based on minor status
|
||||||
if (this.isMinor && !wasMinor) {
|
if (this.isMinor && !wasMinor) {
|
||||||
this.createClientForm.addControl(
|
this.createClientForm.addControl(
|
||||||
@@ -850,12 +1115,14 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
} else {
|
} else {
|
||||||
this.calculatedAgeDetail = null;
|
this.calculatedAgeDetail = null;
|
||||||
this.isMinor = false;
|
this.isMinor = false;
|
||||||
|
this.isSeniorCitizen = false;
|
||||||
this.ageBreakdown = { years: 0, months: 0, days: 0 };
|
this.ageBreakdown = { years: 0, months: 0, days: 0 };
|
||||||
this.createClientForm.removeControl('guardianDetails');
|
this.createClientForm.removeControl('guardianDetails');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.calculatedAgeDetail = null;
|
this.calculatedAgeDetail = null;
|
||||||
this.isMinor = false;
|
this.isMinor = false;
|
||||||
|
this.isSeniorCitizen = false;
|
||||||
this.ageBreakdown = { years: 0, months: 0, days: 0 };
|
this.ageBreakdown = { years: 0, months: 0, days: 0 };
|
||||||
this.createClientForm.removeControl('guardianDetails');
|
this.createClientForm.removeControl('guardianDetails');
|
||||||
}
|
}
|
||||||
@@ -1548,6 +1815,9 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
if (n.includes('postgrad') || n === 'pg' || n.includes('master')) return 'postgraduate';
|
if (n.includes('postgrad') || n === 'pg' || n.includes('master')) return 'postgraduate';
|
||||||
if (n.includes('undergrad') || n === 'ug' || n.includes('bachelor') || n.includes('graduate'))
|
if (n.includes('undergrad') || n === 'ug' || n.includes('bachelor') || n.includes('graduate'))
|
||||||
return 'undergraduate';
|
return 'undergraduate';
|
||||||
|
// Diploma is its own Education Level, distinct from School — checked before the school
|
||||||
|
// keywords below so it doesn't get swept into that bucket.
|
||||||
|
if (n.includes('diploma') || n.includes('polytechnic')) return 'diploma';
|
||||||
if (
|
if (
|
||||||
n.includes('school') ||
|
n.includes('school') ||
|
||||||
n.includes('10th') ||
|
n.includes('10th') ||
|
||||||
@@ -1556,7 +1826,6 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
n.includes('hsc') ||
|
n.includes('hsc') ||
|
||||||
n.includes('matric') ||
|
n.includes('matric') ||
|
||||||
n.includes('intermediate') ||
|
n.includes('intermediate') ||
|
||||||
n.includes('diploma') ||
|
|
||||||
n.includes('iti') ||
|
n.includes('iti') ||
|
||||||
n.includes('below')
|
n.includes('below')
|
||||||
)
|
)
|
||||||
@@ -1634,8 +1903,12 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Degrees filtered by the currently selected Education Level.
|
* Degrees filtered by the currently selected Education Level. Each DegreeQualification code
|
||||||
* Returns all degrees if no level is selected, or category can't be determined.
|
* value is tagged with its owning level in `description` (e.g. "Undergraduate") when seeded —
|
||||||
|
* match on that authoritative field first. Only fall back to the name-keyword heuristic
|
||||||
|
* (getDegreeQualificationCategory) for older/untagged rows that predate this tagging, so
|
||||||
|
* degrees never silently disappear because an admin added one without a description.
|
||||||
|
* Returns all degrees if no level is selected.
|
||||||
*/
|
*/
|
||||||
get filteredDegreeQualificationOptions(): any[] {
|
get filteredDegreeQualificationOptions(): any[] {
|
||||||
const level = this.getSelectedEducationLevel();
|
const level = this.getSelectedEducationLevel();
|
||||||
@@ -1643,6 +1916,9 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
const category = this.getEducationLevelCategory(level.name);
|
const category = this.getEducationLevelCategory(level.name);
|
||||||
if (!category) return this.degreeQualificationOptions;
|
if (!category) return this.degreeQualificationOptions;
|
||||||
const filtered = this.degreeQualificationOptions.filter((d: any) => {
|
const filtered = this.degreeQualificationOptions.filter((d: any) => {
|
||||||
|
if (d.description) {
|
||||||
|
return this.getEducationLevelCategory(d.description) === category;
|
||||||
|
}
|
||||||
const c = this.getDegreeQualificationCategory(d.name);
|
const c = this.getDegreeQualificationCategory(d.name);
|
||||||
return c === category || c === '';
|
return c === category || c === '';
|
||||||
});
|
});
|
||||||
@@ -1805,6 +2081,8 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
// Store extended fields separately (not yet supported by Fineract API)
|
// Store extended fields separately (not yet supported by Fineract API)
|
||||||
// Add isMinor flag
|
// Add isMinor flag
|
||||||
generalDetails.isMinor = this.isMinor;
|
generalDetails.isMinor = this.isMinor;
|
||||||
|
// isSeniorCitizen is auto-detected from DOB (not a form control) — add it explicitly
|
||||||
|
generalDetails.isSeniorCitizen = this.isSeniorCitizen;
|
||||||
|
|
||||||
// Add guardian clientId for minors
|
// Add guardian clientId for minors
|
||||||
if (this.isMinor && generalDetails.guardianDetails) {
|
if (this.isMinor && generalDetails.guardianDetails) {
|
||||||
@@ -1855,6 +2133,121 @@ export class ClientGeneralStepComponent implements OnInit, OnDestroy, OnChanges
|
|||||||
|
|
||||||
return generalDetails;
|
return generalDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get calculatedRisk(): {
|
||||||
|
category: number;
|
||||||
|
reason: string;
|
||||||
|
amlCheckStatus?: string;
|
||||||
|
bannedEntityMatch?: string;
|
||||||
|
willfulDefaulter?: string;
|
||||||
|
ecgcSalFlag?: string;
|
||||||
|
dormantFlag?: string;
|
||||||
|
} {
|
||||||
|
const legalFormId = this.createClientForm.get('legalFormId')?.value || 1; // 1 = Person, 2 = Entity
|
||||||
|
const occCatId = this.createClientForm.get('occupationCategoryCvId')?.value;
|
||||||
|
const occId = this.createClientForm.get('occupationCvId')?.value;
|
||||||
|
|
||||||
|
const monthlyIncome = parseFloat(this.createClientForm.get('monthlyIncome')?.value) || 0;
|
||||||
|
const annualIncome = parseFloat(this.createClientForm.get('annualIncome')?.value) || 0;
|
||||||
|
const monthlyTurnover = parseFloat(this.createClientForm.get('monthlyTurnover')?.value) || 0;
|
||||||
|
const annualTurnover = parseFloat(this.createClientForm.get('annualTurnover')?.value) || 0;
|
||||||
|
const agricultureIncome = parseFloat(this.createClientForm.get('agricultureIncome')?.value) || 0;
|
||||||
|
const nonAgricultureIncome = parseFloat(this.createClientForm.get('nonAgricultureIncome')?.value) || 0;
|
||||||
|
|
||||||
|
const totalAnnualIncome = annualIncome + agricultureIncome + nonAgricultureIncome;
|
||||||
|
|
||||||
|
// Evaluate rules from DB (ordered by orderPosition ASC)
|
||||||
|
if (this.riskRules && this.riskRules.length > 0) {
|
||||||
|
for (const rule of this.riskRules) {
|
||||||
|
// Skip transaction/AML rules that have no KYC criteria
|
||||||
|
if (
|
||||||
|
rule.legalFormId == null &&
|
||||||
|
rule.occupationCategoryCvId == null &&
|
||||||
|
rule.occupationCvId == null &&
|
||||||
|
rule.minMonthlyIncome == null &&
|
||||||
|
rule.maxMonthlyIncome == null &&
|
||||||
|
rule.minAnnualIncome == null &&
|
||||||
|
rule.maxAnnualIncome == null &&
|
||||||
|
rule.minAnnualTurnover == null &&
|
||||||
|
rule.maxAnnualTurnover == null
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match legal form
|
||||||
|
if (rule.legalFormId != null && rule.legalFormId !== legalFormId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match occupation category
|
||||||
|
if (rule.occupationCategoryCvId != null && rule.occupationCategoryCvId !== occCatId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match occupation
|
||||||
|
if (rule.occupationCvId != null && rule.occupationCvId !== occId) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match monthly income ranges
|
||||||
|
if (rule.minMonthlyIncome != null && monthlyIncome < rule.minMonthlyIncome) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rule.maxMonthlyIncome != null && monthlyIncome > rule.maxMonthlyIncome) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match annual income ranges (evaluated against totalAnnualIncome)
|
||||||
|
if (rule.minAnnualIncome != null && totalAnnualIncome < rule.minAnnualIncome) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rule.maxAnnualIncome != null && totalAnnualIncome > rule.maxAnnualIncome) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Match turnover ranges
|
||||||
|
if (rule.minAnnualTurnover != null && annualTurnover < rule.minAnnualTurnover) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (rule.maxAnnualTurnover != null && annualTurnover > rule.maxAnnualTurnover) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// All matched!
|
||||||
|
return {
|
||||||
|
category: rule.riskCategory,
|
||||||
|
reason: rule.reason,
|
||||||
|
amlCheckStatus: rule.amlCheckStatus || (rule.riskCategory === 3 ? 'FLAGGED' : 'CLEAR'),
|
||||||
|
bannedEntityMatch: rule.bannedEntityMatch || 'NO',
|
||||||
|
willfulDefaulter: rule.willfulDefaulter || 'NO',
|
||||||
|
ecgcSalFlag: rule.ecgcSalFlag || 'NO',
|
||||||
|
dormantFlag: rule.dormantFlag || 'ACTIVE'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default Fallbacks
|
||||||
|
if (legalFormId !== LegalFormId.PERSON) {
|
||||||
|
return {
|
||||||
|
category: 2,
|
||||||
|
reason: 'Non-Individual / Entity profile (Default Medium Risk)',
|
||||||
|
amlCheckStatus: 'CLEAR',
|
||||||
|
bannedEntityMatch: 'NO',
|
||||||
|
willfulDefaulter: 'NO',
|
||||||
|
ecgcSalFlag: 'NO',
|
||||||
|
dormantFlag: 'ACTIVE'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
category: 1,
|
||||||
|
reason: 'Default Low Risk profile (Salary / Service / Agriculture / Others)',
|
||||||
|
amlCheckStatus: 'CLEAR',
|
||||||
|
bannedEntityMatch: 'NO',
|
||||||
|
willfulDefaulter: 'NO',
|
||||||
|
ecgcSalFlag: 'NO',
|
||||||
|
dormantFlag: 'ACTIVE'
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+35
@@ -42,6 +42,7 @@ import { ClientsService } from 'app/clients/clients.service';
|
|||||||
<strong>UN Security Council</strong> &
|
<strong>UN Security Council</strong> &
|
||||||
<strong>Financial Intelligence Unit - India (FIU-IND under UNSC Resolution 2231)</strong>
|
<strong>Financial Intelligence Unit - India (FIU-IND under UNSC Resolution 2231)</strong>
|
||||||
</p>
|
</p>
|
||||||
|
<p class="regulatory-note">{{ regulatoryBasis }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (!verifying && !matchFound && !errorOccurred) {
|
@if (!verifying && !matchFound && !errorOccurred) {
|
||||||
@@ -69,7 +70,14 @@ import { ClientsService } from 'app/clients/clients.service';
|
|||||||
<span class="meta-label">Database</span>
|
<span class="meta-label">Database</span>
|
||||||
<span class="meta-value">UN SC Consolidated List</span>
|
<span class="meta-value">UN SC Consolidated List</span>
|
||||||
</div>
|
</div>
|
||||||
|
@if (listDataAsOf) {
|
||||||
|
<div class="meta-row">
|
||||||
|
<span class="meta-label">List Data As Of</span>
|
||||||
|
<span class="meta-value">{{ listDataAsOf }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<p class="regulatory-note">{{ regulatoryBasis }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (!verifying && matchFound) {
|
@if (!verifying && matchFound) {
|
||||||
@@ -96,11 +104,18 @@ import { ClientsService } from 'app/clients/clients.service';
|
|||||||
<span class="meta-label">Database</span>
|
<span class="meta-label">Database</span>
|
||||||
<span class="meta-value">UN SC Consolidated List</span>
|
<span class="meta-value">UN SC Consolidated List</span>
|
||||||
</div>
|
</div>
|
||||||
|
@if (listDataAsOf) {
|
||||||
|
<div class="meta-row">
|
||||||
|
<span class="meta-label">List Data As Of</span>
|
||||||
|
<span class="meta-value">{{ listDataAsOf }}</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
<div class="escalate-banner">
|
<div class="escalate-banner">
|
||||||
<fa-icon icon="exclamation-circle" class="escalate-icon"></fa-icon>
|
<fa-icon icon="exclamation-circle" class="escalate-icon"></fa-icon>
|
||||||
<span><strong>Escalate to Principal Officer immediately.</strong> Account opening blocked.</span>
|
<span><strong>Escalate to Principal Officer immediately.</strong> Account opening blocked.</span>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="regulatory-note">{{ regulatoryBasis }}</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
@if (!verifying && errorOccurred) {
|
@if (!verifying && errorOccurred) {
|
||||||
@@ -207,6 +222,15 @@ import { ClientsService } from 'app/clients/clients.service';
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.regulatory-note {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #9ca3af;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: center;
|
||||||
|
margin: 8px 0 0;
|
||||||
|
max-width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
.approve-card {
|
.approve-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -524,6 +548,10 @@ export class SanctionsVerifyDialogComponent implements OnInit, OnDestroy {
|
|||||||
errorOccurred = false;
|
errorOccurred = false;
|
||||||
errorMessage = '';
|
errorMessage = '';
|
||||||
screeningLogId: number | null = null;
|
screeningLogId: number | null = null;
|
||||||
|
listDataAsOf: string | null = null;
|
||||||
|
|
||||||
|
regulatoryBasis =
|
||||||
|
'Screened as per Section 51-A of the Unlawful Activities (Prevention) Act, 1967 and the RBI Master Direction on KYC.';
|
||||||
|
|
||||||
screenedDate = new Date().toLocaleDateString('en-IN', { day: '2-digit', month: 'short', year: 'numeric' });
|
screenedDate = new Date().toLocaleDateString('en-IN', { day: '2-digit', month: 'short', year: 'numeric' });
|
||||||
progressValue = 0;
|
progressValue = 0;
|
||||||
@@ -624,6 +652,13 @@ export class SanctionsVerifyDialogComponent implements OnInit, OnDestroy {
|
|||||||
'Unable to connect to sanctions screening service.';
|
'Unable to connect to sanctions screening service.';
|
||||||
} else {
|
} else {
|
||||||
this.screeningLogId = this.apiResult?.screeningLogId || null;
|
this.screeningLogId = this.apiResult?.screeningLogId || null;
|
||||||
|
this.listDataAsOf = this.apiResult?.listDataAsOf
|
||||||
|
? new Date(this.apiResult.listDataAsOf).toLocaleDateString('en-IN', {
|
||||||
|
day: '2-digit',
|
||||||
|
month: 'short',
|
||||||
|
year: 'numeric'
|
||||||
|
})
|
||||||
|
: null;
|
||||||
if (this.apiResult?.matchFound) {
|
if (this.apiResult?.matchFound) {
|
||||||
this.matchFound = true;
|
this.matchFound = true;
|
||||||
this.matchCount = this.apiResult.matchCount || 0;
|
this.matchCount = this.apiResult.matchCount || 0;
|
||||||
|
|||||||
+3
-2
@@ -173,8 +173,9 @@
|
|||||||
@if (selectedAddrProof.requiresDate) {
|
@if (selectedAddrProof.requiresDate) {
|
||||||
<mat-form-field appearance="outline" class="addr-ff">
|
<mat-form-field appearance="outline" class="addr-ff">
|
||||||
<mat-label>Issue / bill date</mat-label>
|
<mat-label>Issue / bill date</mat-label>
|
||||||
<span matPrefix class="addr-prefix"><mat-icon>event</mat-icon></span>
|
<input matInput [matDatepicker]="addrIssueDatePicker" formControlName="issueDate" />
|
||||||
<input matInput type="date" formControlName="issueDate" />
|
<mat-datepicker-toggle matSuffix [for]="addrIssueDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #addrIssueDatePicker></mat-datepicker>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+114
-25
@@ -15,9 +15,12 @@ import { MatCheckbox } from '@angular/material/checkbox';
|
|||||||
import { MatTabsModule } from '@angular/material/tabs';
|
import { MatTabsModule } from '@angular/material/tabs';
|
||||||
import { MatIcon } from '@angular/material/icon';
|
import { MatIcon } from '@angular/material/icon';
|
||||||
import { MatIconButton, MatButton } from '@angular/material/button';
|
import { MatIconButton, MatButton } from '@angular/material/button';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
import { ClientsService } from '../../clients.service';
|
import { ClientsService } from '../../clients.service';
|
||||||
import { ProofType, normalizeProofType, groupProofsByCategory } from '../../shared/kyc-proof-types';
|
import { ProofType, normalizeProofType, groupProofsByCategory } from '../../shared/kyc-proof-types';
|
||||||
import { KycUploadHelperService } from '../../shared/kyc-upload-helper.service';
|
import { KycUploadHelperService } from '../../shared/kyc-upload-helper.service';
|
||||||
|
import { DocumentPreviewDialogComponent } from '../../shared/document-preview-dialog/document-preview-dialog.component';
|
||||||
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-client-india-address-step',
|
selector: 'mifosx-client-india-address-step',
|
||||||
@@ -38,11 +41,20 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
private http = inject(HttpClient);
|
private http = inject(HttpClient);
|
||||||
private clientsService = inject(ClientsService);
|
private clientsService = inject(ClientsService);
|
||||||
private kycUpload = inject(KycUploadHelperService);
|
private kycUpload = inject(KycUploadHelperService);
|
||||||
|
private dialog = inject(MatDialog);
|
||||||
|
private dates = inject(Dates);
|
||||||
|
|
||||||
/** Client ID — when set, loads existing addresses for edit mode */
|
/** Client ID — when set, loads existing addresses for edit mode */
|
||||||
@Input() clientId: string = '';
|
@Input() clientId: string = '';
|
||||||
/** Read-only mode — disables form editing until user clicks edit icon */
|
/** Read-only mode — disables form editing until user clicks edit icon */
|
||||||
@Input() readOnly = false;
|
@Input() readOnly = false;
|
||||||
|
/** Minor clients can't hold utility bills, bank statements or an adult-only OVD in their own
|
||||||
|
* name — restricts the address-proof picker to Aadhaar/Passport when true. */
|
||||||
|
@Input() isMinor = false;
|
||||||
|
/** Non-individual (entity) clients — hides personal OVDs (Aadhaar/Passport/DL/Voter ID/NREGA/
|
||||||
|
* NPR/Birth Certificate/School ID) from the proof-of-address picker; a company's registered
|
||||||
|
* office address is evidenced by utility bills, GST/rent documents etc., not a person's ID. */
|
||||||
|
@Input() isNonIndividual = false;
|
||||||
|
|
||||||
activeTab = 0;
|
activeTab = 0;
|
||||||
sameAsPermanent = false;
|
sameAsPermanent = false;
|
||||||
@@ -235,12 +247,50 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets transient address-tab state for a brand-new client.
|
||||||
|
*
|
||||||
|
* This app's RouteReusableStrategy (core/route/route-reusable-strategy.ts) keeps this SAME
|
||||||
|
* component instance alive across repeat visits to /clients/create, so `ngOnInit` never
|
||||||
|
* re-runs for a second "create new client" session — the previous client's address forms,
|
||||||
|
* selected proof-of-address chip and uploaded files would otherwise leak into the new one.
|
||||||
|
* Called by CreateClientComponent.resetForNewClient() whenever a fresh create session begins.
|
||||||
|
*/
|
||||||
|
resetForNewClient(): void {
|
||||||
|
this.permanentForm.reset({ country: 'India' });
|
||||||
|
this.currentForm.reset({ country: 'India' });
|
||||||
|
this.officeForm.reset({ country: 'India' });
|
||||||
|
this.correspondenceForm.reset({ country: 'India' });
|
||||||
|
this.activeTab = 0;
|
||||||
|
this.sameAsPermanent = false;
|
||||||
|
this.pinStatus = {
|
||||||
|
permanent: { loading: false, found: false, error: false, message: '' },
|
||||||
|
current: { loading: false, found: false, error: false, message: '' },
|
||||||
|
office: { loading: false, found: false, error: false, message: '' },
|
||||||
|
correspondence: { loading: false, found: false, error: false, message: '' }
|
||||||
|
};
|
||||||
|
this.localityOptions = { permanent: [], current: [], office: [], correspondence: [] };
|
||||||
|
this.selectedAddrProof = null;
|
||||||
|
this.addrFiles = { front: null, back: null };
|
||||||
|
this.addrMergedFile = null;
|
||||||
|
this.addrMergedPreview = null;
|
||||||
|
this.existingAddressProofIdentifierId = null;
|
||||||
|
this.existingAddressProofDocuments = [];
|
||||||
|
this.addressLoaded = false;
|
||||||
|
// Re-fetch rather than re-filter `addressProofs` in place — if the previous session's
|
||||||
|
// isMinor filtering already reduced it (e.g. down to Aadhaar/Passport only), filtering
|
||||||
|
// that reduced list again can never recover the items it already removed.
|
||||||
|
this.loadProofTypes();
|
||||||
|
}
|
||||||
|
|
||||||
private loadProofTypes(): void {
|
private loadProofTypes(): void {
|
||||||
this.loadingProofs = true;
|
this.loadingProofs = true;
|
||||||
this.clientsService.getKycProofTypes().subscribe({
|
this.clientsService.getKycProofTypes().subscribe({
|
||||||
next: (res: any) => {
|
next: (res: any) => {
|
||||||
const activeFilter = (p: any) => p?.active !== false;
|
const activeFilter = (p: any) => p?.active !== false;
|
||||||
this.addressProofs = (res?.addressProofs || []).filter(activeFilter).map(normalizeProofType);
|
this.addressProofs = this.filterAddressProofsForNonIndividual(
|
||||||
|
this.filterAddressProofsForMinor((res?.addressProofs || []).filter(activeFilter).map(normalizeProofType))
|
||||||
|
);
|
||||||
this.addressGroups = groupProofsByCategory(this.addressProofs);
|
this.addressGroups = groupProofsByCategory(this.addressProofs);
|
||||||
this.loadingProofs = false;
|
this.loadingProofs = false;
|
||||||
},
|
},
|
||||||
@@ -250,6 +300,41 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Minors don't hold utility bills, bank statements, rent agreements, property tax receipts,
|
||||||
|
* employer letters or pension orders in their own name, and Voter ID/Driving Licence both
|
||||||
|
* require adult age — Aadhaar and Passport are the only OVDs left for proof of address. */
|
||||||
|
private static readonly MINOR_ELIGIBLE_ADDRESS_PROOF_CODES = new Set([
|
||||||
|
'AADHAAR',
|
||||||
|
'PASSPORT'
|
||||||
|
]);
|
||||||
|
|
||||||
|
private filterAddressProofsForMinor(proofs: ProofType[]): ProofType[] {
|
||||||
|
if (!this.isMinor) return proofs;
|
||||||
|
return proofs.filter((p) =>
|
||||||
|
ClientIndiaAddressStepComponent.MINOR_ELIGIBLE_ADDRESS_PROOF_CODES.has((p.code || '').toUpperCase())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Personal OVDs — not valid proof of a registered office/entity address. */
|
||||||
|
private static readonly NON_INDIVIDUAL_EXCLUDED_ADDRESS_PROOF_CODES = new Set([
|
||||||
|
'AADHAAR',
|
||||||
|
'PASSPORT',
|
||||||
|
'VOTER_ID',
|
||||||
|
'DRIVING_LICENSE',
|
||||||
|
'NREGA_JOB_CARD',
|
||||||
|
'NPR_LETTER',
|
||||||
|
'BIRTH_CERTIFICATE',
|
||||||
|
'SCHOOL_ID_CARD'
|
||||||
|
]);
|
||||||
|
|
||||||
|
private filterAddressProofsForNonIndividual(proofs: ProofType[]): ProofType[] {
|
||||||
|
if (!this.isNonIndividual) return proofs;
|
||||||
|
return proofs.filter(
|
||||||
|
(p) =>
|
||||||
|
!ClientIndiaAddressStepComponent.NON_INDIVIDUAL_EXCLUDED_ADDRESS_PROOF_CODES.has((p.code || '').toUpperCase())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
selectAddrProof(proof: ProofType): void {
|
selectAddrProof(proof: ProofType): void {
|
||||||
this.selectedAddrProof = proof;
|
this.selectedAddrProof = proof;
|
||||||
this.permanentForm.get('proofId')?.setValue(proof.id);
|
this.permanentForm.get('proofId')?.setValue(proof.id);
|
||||||
@@ -330,11 +415,12 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
files.push({ slot: 'Back', file: this.addrFiles.back });
|
files.push({ slot: 'Back', file: this.addrFiles.back });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const rawIssueDate = this.permanentForm.get('issueDate')?.value;
|
||||||
return {
|
return {
|
||||||
proof: this.selectedAddrProof,
|
proof: this.selectedAddrProof,
|
||||||
proofId: this.permanentForm.get('proofId')?.value || '',
|
proofId: this.permanentForm.get('proofId')?.value || '',
|
||||||
documentKey: this.permanentForm.get('documentKey')?.value || '',
|
documentKey: this.permanentForm.get('documentKey')?.value || '',
|
||||||
issueDate: this.permanentForm.get('issueDate')?.value || '',
|
issueDate: rawIssueDate ? this.dates.getDate(rawIssueDate) : '',
|
||||||
files
|
files
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -355,6 +441,25 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (changes['isMinor'] && !changes['isMinor'].firstChange && this.addressProofs.length) {
|
||||||
|
const filtered = this.filterAddressProofsForMinor(this.addressProofs);
|
||||||
|
if (filtered.length !== this.addressProofs.length) {
|
||||||
|
this.addressProofs = filtered;
|
||||||
|
this.addressGroups = groupProofsByCategory(this.addressProofs);
|
||||||
|
if (this.selectedAddrProof && !filtered.some((p) => p.id === this.selectedAddrProof?.id)) {
|
||||||
|
this.selectedAddrProof = null;
|
||||||
|
this.permanentForm.get('proofId')?.setValue('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Legal form toggled on an already-initialized instance — re-fetch rather than filter
|
||||||
|
// `addressProofs` in place, since the non-individual filter only ever removes entries and
|
||||||
|
// toggling back to individual could never recover what a prior pass had stripped out.
|
||||||
|
if (changes['isNonIndividual'] && !changes['isNonIndividual'].firstChange) {
|
||||||
|
this.selectedAddrProof = null;
|
||||||
|
this.permanentForm.get('proofId')?.setValue('');
|
||||||
|
this.loadProofTypes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -458,13 +563,13 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
proofId: matchedProof.id,
|
proofId: matchedProof.id,
|
||||||
documentKey: identifier.documentKey || ''
|
documentKey: identifier.documentKey || ''
|
||||||
});
|
});
|
||||||
// The description carries `Issue date: dd/mm/yyyy` when set on create (see
|
// The description carries `Issue date: yyyy-MM-dd` when set on create (see
|
||||||
// create-client.saveAddressProof) — pull it out so the form's issueDate field
|
// create-client.saveAddressProof) — pull it out so the form's issueDate field
|
||||||
// shows what was previously entered.
|
// shows what was previously entered.
|
||||||
const desc: string = identifier.description || '';
|
const desc: string = identifier.description || '';
|
||||||
const issueMatch = desc.match(/Issue date:\s*(.+)$/i);
|
const issueMatch = desc.match(/Issue date:\s*(.+)$/i);
|
||||||
if (issueMatch) {
|
if (issueMatch) {
|
||||||
this.permanentForm.patchValue({ issueDate: issueMatch[1].trim() });
|
this.permanentForm.patchValue({ issueDate: this.dates.parseDate(issueMatch[1].trim()) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,33 +671,17 @@ export class ClientIndiaAddressStepComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Open the saved address proof in an in-app preview dialog. */
|
||||||
* Open the saved address proof in a new browser tab.
|
|
||||||
*
|
|
||||||
* For images we already hold a base64 data URL in `previewUrl` from
|
|
||||||
* `loadExistingAddressProof`, so we can hand it straight to `window.open`.
|
|
||||||
* For PDFs / other types we need to fetch the binary blob and create a
|
|
||||||
* temporary object URL so the browser's PDF viewer can render it.
|
|
||||||
*/
|
|
||||||
viewExistingAddressProof(): void {
|
viewExistingAddressProof(): void {
|
||||||
if (!this.existingAddressProofIdentifierId || this.existingAddressProofDocuments.length === 0) {
|
if (!this.existingAddressProofIdentifierId || this.existingAddressProofDocuments.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const doc = this.existingAddressProofDocuments[0];
|
const doc = this.existingAddressProofDocuments[0];
|
||||||
if (doc.previewUrl) {
|
|
||||||
window.open(doc.previewUrl, '_blank', 'noopener');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.clientsService.downloadClientIdentificationDocument(this.existingAddressProofIdentifierId, doc.id).subscribe({
|
this.clientsService.downloadClientIdentificationDocument(this.existingAddressProofIdentifierId, doc.id).subscribe({
|
||||||
next: (blob: Blob) => {
|
next: (blob: Blob) =>
|
||||||
const url = URL.createObjectURL(blob);
|
this.dialog.open(DocumentPreviewDialogComponent, {
|
||||||
const w = window.open(url, '_blank', 'noopener');
|
data: { blob, title: doc.fileName || doc.name, fileName: doc.fileName || doc.name }
|
||||||
// Revoke after the tab has had time to load — browsers vary, so
|
}),
|
||||||
// err on the side of a generous wait.
|
|
||||||
if (w) {
|
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60_000);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: () => {
|
error: () => {
|
||||||
// Silent fail — UI shows the saved name so user knows it exists.
|
// Silent fail — UI shows the saved name so user knows it exists.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,8 @@
|
|||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<!-- ══ INDIVIDUAL KYC ══ -->
|
<!-- ══ INDIVIDUAL KYC ══ -->
|
||||||
@if (!isNonIndividual) {
|
@if (!isNonIndividual) {
|
||||||
|
<!-- Minors don't hold a PAN card — skip the PAN checkbox/section entirely -->
|
||||||
|
@if (!isMinor) {
|
||||||
@if (readOnly) {
|
@if (readOnly) {
|
||||||
<!-- In view mode the mat-checkbox renders as a faded grey square
|
<!-- In view mode the mat-checkbox renders as a faded grey square
|
||||||
that reads as "blurry". Show a clean Yes/No pill instead. -->
|
that reads as "blurry". Show a clean Yes/No pill instead. -->
|
||||||
@@ -52,9 +54,10 @@
|
|||||||
<mat-checkbox formControlName="hasPan">Client has PAN Card</mat-checkbox>
|
<mat-checkbox formControlName="hasPan">Client has PAN Card</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
<!-- Individual PAN with inline verify -->
|
<!-- Individual PAN with inline verify -->
|
||||||
@if (kycForm.get('hasPan')?.value) {
|
@if (!isMinor && kycForm.get('hasPan')?.value) {
|
||||||
<div class="form-field verify-field">
|
<div class="form-field verify-field">
|
||||||
<mat-form-field appearance="outline" class="verify-input">
|
<mat-form-field appearance="outline" class="verify-input">
|
||||||
<mat-label>PAN Number</mat-label>
|
<mat-label>PAN Number</mat-label>
|
||||||
@@ -158,6 +161,17 @@
|
|||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
|
@if (aadhaarOtpSent && aadhaarVerifyStatus !== 'VERIFIED') {
|
||||||
|
<button
|
||||||
|
mat-stroked-button
|
||||||
|
type="button"
|
||||||
|
class="change-number-btn"
|
||||||
|
[disabled]="readOnly"
|
||||||
|
(click)="changeAadhaarNumber()"
|
||||||
|
>
|
||||||
|
<mat-icon>edit</mat-icon> Change Number
|
||||||
|
</button>
|
||||||
|
}
|
||||||
@if (aadhaarVerifyStatus === 'VERIFIED') {
|
@if (aadhaarVerifyStatus === 'VERIFIED') {
|
||||||
<span class="verify-chip verified"><fa-icon icon="check-circle"></fa-icon> Verified</span>
|
<span class="verify-chip verified"><fa-icon icon="check-circle"></fa-icon> Verified</span>
|
||||||
}
|
}
|
||||||
@@ -1035,6 +1049,12 @@
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
|
<div class="checkbox-field override-checkbox-wrapper full-width">
|
||||||
|
<mat-checkbox formControlName="allowRiskOverride" [disabled]="readOnly">
|
||||||
|
Override Auto-calculated Risk Category
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Risk Category</mat-label>
|
<mat-label>Risk Category</mat-label>
|
||||||
<mat-select formControlName="riskCategory">
|
<mat-select formControlName="riskCategory">
|
||||||
@@ -1072,6 +1092,64 @@
|
|||||||
<mat-hint>Auto: Low 10yr, Medium 8yr, High 2yr</mat-hint>
|
<mat-hint>Auto: Low 10yr, Medium 8yr, High 2yr</mat-hint>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
@if (riskCalculationReason && !kycForm.get('allowRiskOverride')?.value && !readOnly) {
|
||||||
|
<div
|
||||||
|
class="risk-auto-calc-info full-width"
|
||||||
|
[class.risk-auto-calc-info--low]="kycForm.get('riskCategory')?.value === 1"
|
||||||
|
[class.risk-auto-calc-info--medium]="kycForm.get('riskCategory')?.value === 2"
|
||||||
|
[class.risk-auto-calc-info--high]="kycForm.get('riskCategory')?.value === 3"
|
||||||
|
>
|
||||||
|
<mat-icon class="info-icon">info</mat-icon>
|
||||||
|
<span class="info-text"
|
||||||
|
>Auto-determined: <strong>{{ riskCalculationReason }}</strong></span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="risk-rules-toggle-wrapper full-width">
|
||||||
|
<button mat-button type="button" class="rules-toggle-btn" (click)="showRiskRulesTable = !showRiskRulesTable">
|
||||||
|
<mat-icon class="rules-toggle-icon">{{ showRiskRulesTable ? 'expand_less' : 'expand_more' }}</mat-icon>
|
||||||
|
{{
|
||||||
|
showRiskRulesTable ? 'Hide Risk Classification Criteria Table' : 'View Risk Classification Criteria Table'
|
||||||
|
}}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (showRiskRulesTable) {
|
||||||
|
<div class="risk-rules-card mat-elevation-z1 full-width">
|
||||||
|
<table class="risk-rules-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Risk Category</th>
|
||||||
|
<th>Primary Criteria / Basis</th>
|
||||||
|
<th>Examples / Thresholds</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr class="rule-row rule-row--high">
|
||||||
|
<td><span class="risk-badge risk-badge--high">High Risk</span></td>
|
||||||
|
<td>PEPs, High-Risk Industries, High Income / Turnovers</td>
|
||||||
|
<td>
|
||||||
|
Politicians; Real Estate, Import/Export; Commission Agents; Income > ₹20L/yr; Turnover > ₹1 Crore
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rule-row rule-row--medium">
|
||||||
|
<td><span class="risk-badge risk-badge--medium">Medium Risk</span></td>
|
||||||
|
<td>Self-Employed, Professionals, Cross-Border, Moderate Income</td>
|
||||||
|
<td>
|
||||||
|
Business Owners, Traders; Doctors, Lawyers, CAs; NRI, PIO, OCI; Income > ₹6L/yr; Turnover > ₹20L
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="rule-row rule-row--low">
|
||||||
|
<td><span class="risk-badge risk-badge--low">Low Risk</span></td>
|
||||||
|
<td>Non-Earning, Government Employment, Agriculture / Manual</td>
|
||||||
|
<td>Students, Minors, Homemakers; Govt/PSU Employees; Farmers, Daily Wage; Income <= ₹6L/yr</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="form-field full-width">
|
<mat-form-field appearance="outline" class="form-field full-width">
|
||||||
<mat-label>{{ isKycVerified ? 'Reason for Re-edit *' : 'Remarks' }}</mat-label>
|
<mat-label>{{ isKycVerified ? 'Reason for Re-edit *' : 'Remarks' }}</mat-label>
|
||||||
<textarea
|
<textarea
|
||||||
@@ -1173,6 +1251,12 @@
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
|
<div class="checkbox-field override-checkbox-wrapper full-width">
|
||||||
|
<mat-checkbox formControlName="allowAmlOverride" [disabled]="readOnly">
|
||||||
|
Override Auto-calculated AML & Compliance Checks
|
||||||
|
</mat-checkbox>
|
||||||
|
</div>
|
||||||
|
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>AML Check Status</mat-label>
|
<mat-label>AML Check Status</mat-label>
|
||||||
<mat-select required formControlName="amlCheckStatus">
|
<mat-select required formControlName="amlCheckStatus">
|
||||||
@@ -1266,11 +1350,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ═══ SECTION: Form 60/61 ═══ -->
|
<!-- ═══ SECTION: Form 97/98 ═══ -->
|
||||||
<div class="section-block">
|
<div class="section-block">
|
||||||
<h4 class="section-title">
|
<h4 class="section-title">
|
||||||
<fa-icon icon="file-invoice" class="section-icon"></fa-icon>
|
<fa-icon icon="file-invoice" class="section-icon"></fa-icon>
|
||||||
Form 60 / 61
|
Form 97 / 98
|
||||||
@if (!kycForm.get('hasPan')?.value) {
|
@if (!kycForm.get('hasPan')?.value) {
|
||||||
<span class="kyc-badge required-badge">Required — No PAN</span>
|
<span class="kyc-badge required-badge">Required — No PAN</span>
|
||||||
}
|
}
|
||||||
@@ -1278,14 +1362,14 @@
|
|||||||
@if (!kycForm.get('hasPan')?.value) {
|
@if (!kycForm.get('hasPan')?.value) {
|
||||||
<div class="kyc-info-hint warning-hint">
|
<div class="kyc-info-hint warning-hint">
|
||||||
<mat-icon class="kyc-info-hint-icon">warning</mat-icon>
|
<mat-icon class="kyc-info-hint-icon">warning</mat-icon>
|
||||||
<span>Client does not have PAN. Form 60/61 is mandatory.</span>
|
<span>Client does not have PAN. Form 97/98 is mandatory.</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Form Type</mat-label>
|
<mat-label>Form Type</mat-label>
|
||||||
<mat-select formControlName="form60Type">
|
<mat-select formControlName="form60Type">
|
||||||
<mat-option value="FORM_60">Form 60</mat-option>
|
<mat-option value="FORM_60">Form 97</mat-option>
|
||||||
<mat-option value="FORM_61">Form 61</mat-option>
|
<mat-option value="FORM_61">Form 98</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline" class="form-field" (click)="form60DatePicker.open()">
|
<mat-form-field appearance="outline" class="form-field" (click)="form60DatePicker.open()">
|
||||||
@@ -1296,26 +1380,26 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
} @else {
|
} @else {
|
||||||
<p class="form60-not-needed">Client has PAN — Form 60/61 not required.</p>
|
<p class="form60-not-needed">Client has PAN — Form 97/98 not required.</p>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- ═══ SECTION: Form 15G / 15H ═══ -->
|
<!-- ═══ SECTION: Form 121 ═══ -->
|
||||||
<div class="section-block">
|
<div class="section-block">
|
||||||
<h4 class="section-title">
|
<h4 class="section-title">
|
||||||
<fa-icon icon="receipt" class="section-icon"></fa-icon>
|
<fa-icon icon="receipt" class="section-icon"></fa-icon>
|
||||||
Form 15G / 15H
|
Form 121
|
||||||
</h4>
|
</h4>
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
<div class="form-field checkbox-field">
|
<div class="form-field checkbox-field">
|
||||||
<mat-checkbox formControlName="form15Applicable">Form 15G/15H Applicable</mat-checkbox>
|
<mat-checkbox formControlName="form15Applicable">Form 121 Applicable</mat-checkbox>
|
||||||
</div>
|
</div>
|
||||||
@if (kycForm.get('form15Applicable')?.value) {
|
@if (kycForm.get('form15Applicable')?.value) {
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
<mat-label>Form Type</mat-label>
|
<mat-label>Form Type</mat-label>
|
||||||
<mat-select formControlName="form15Type">
|
<mat-select formControlName="form15Type">
|
||||||
<mat-option value="15G">15G (Below 60 years)</mat-option>
|
<mat-option value="15G">Form 121 (Below 60 years)</mat-option>
|
||||||
<mat-option value="15H">15H (Senior Citizen 60+)</mat-option>
|
<mat-option value="15H">Form 121 (Senior Citizen 60+)</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
<mat-form-field appearance="outline" class="form-field">
|
<mat-form-field appearance="outline" class="form-field">
|
||||||
@@ -1403,8 +1487,8 @@
|
|||||||
<input type="file" accept="image/*" hidden (change)="onSignatureSelected($event)" />
|
<input type="file" accept="image/*" hidden (change)="onSignatureSelected($event)" />
|
||||||
<fa-icon icon="crop"></fa-icon> Choose & Crop
|
<fa-icon icon="crop"></fa-icon> Choose & Crop
|
||||||
</label>
|
</label>
|
||||||
<button type="button" class="upload-box__btn upload-box__btn--secondary" (click)="captureWebcamSignature()">
|
<button type="button" class="upload-box__btn upload-box__btn--secondary" (click)="drawSignature()">
|
||||||
<fa-icon icon="video"></fa-icon> Use Webcam
|
<fa-icon icon="pen"></fa-icon> Draw Signature
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@if (photoSigTouched) {
|
@if (photoSigTouched) {
|
||||||
|
|||||||
@@ -266,6 +266,23 @@
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.change-number-btn {
|
||||||
|
font-size: 12px !important;
|
||||||
|
font-weight: 600 !important;
|
||||||
|
padding: 0 14px !important;
|
||||||
|
height: 36px !important;
|
||||||
|
border-radius: 6px !important;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 16px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.verify-chip {
|
.verify-chip {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -297,8 +314,24 @@
|
|||||||
.toggle-vis-btn {
|
.toggle-vis-btn {
|
||||||
width: 28px !important;
|
width: 28px !important;
|
||||||
height: 28px !important;
|
height: 28px !important;
|
||||||
|
padding: 0 !important;
|
||||||
font-size: 13px !important;
|
font-size: 13px !important;
|
||||||
color: #64748b;
|
color: #64748b;
|
||||||
|
|
||||||
|
/* Material reserves a 48x48 invisible touch-target + ripple around every
|
||||||
|
mat-icon-button by default. Shrinking the button to 28px above doesn't
|
||||||
|
shrink that touch-target/ripple with it, so — since the suffix
|
||||||
|
container doesn't clip overflow — it visually spills out past the
|
||||||
|
field's own border, making the icon look misplaced/half-outside the box. */
|
||||||
|
::ng-deep .mat-mdc-button-touch-target {
|
||||||
|
width: 28px !important;
|
||||||
|
height: 28px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-mdc-button-persistent-ripple,
|
||||||
|
::ng-deep .mat-ripple {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Verification Info Banner */
|
/* Verification Info Banner */
|
||||||
@@ -2240,3 +2273,161 @@
|
|||||||
width: 95px;
|
width: 95px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.override-checkbox-wrapper {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.risk-auto-calc-info {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-top: -8px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
|
||||||
|
.info-icon {
|
||||||
|
font-size: 18px !important;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-text strong {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--low {
|
||||||
|
background: #ecfdf5;
|
||||||
|
color: #065f46;
|
||||||
|
border-color: #a7f3d0;
|
||||||
|
|
||||||
|
.info-icon {
|
||||||
|
color: #10b981;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--medium {
|
||||||
|
background: #fffbeb;
|
||||||
|
color: #92400e;
|
||||||
|
border-color: #fde68a;
|
||||||
|
|
||||||
|
.info-icon {
|
||||||
|
color: #f59e0b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&--high {
|
||||||
|
background: #fef2f2;
|
||||||
|
color: #991b1b;
|
||||||
|
border-color: #fecaca;
|
||||||
|
|
||||||
|
.info-icon {
|
||||||
|
color: #ef4444;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.risk-rules-toggle-wrapper {
|
||||||
|
margin-top: 4px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
.rules-toggle-btn {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #1e6bb8;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 20px;
|
||||||
|
transition: all 0.2s ease-in-out;
|
||||||
|
background: #f1f5f9;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #e2e8f0;
|
||||||
|
color: #0f172a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.risk-rules-card {
|
||||||
|
background: #fff;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
box-shadow: 0 1px 3px rgb(0 0 0 / 5%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.risk-rules-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
font-size: 13px;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
th {
|
||||||
|
padding: 10px 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #475569;
|
||||||
|
border-bottom: 2px solid #cbd5e1;
|
||||||
|
background: #f8fafc;
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 12px;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
color: #334155;
|
||||||
|
vertical-align: top;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rule-row {
|
||||||
|
transition: background 0.15s ease-in-out;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: #f8fafc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.risk-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 12px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.3px;
|
||||||
|
text-align: center;
|
||||||
|
width: 80px;
|
||||||
|
|
||||||
|
&--high {
|
||||||
|
background: #fef2f2;
|
||||||
|
color: #dc2626;
|
||||||
|
border: 1px solid #fecaca;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--medium {
|
||||||
|
background: #fffbeb;
|
||||||
|
color: #d97706;
|
||||||
|
border: 1px solid #fde68a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--low {
|
||||||
|
background: #ecfdf5;
|
||||||
|
color: #16a34a;
|
||||||
|
border: 1px solid #a7f3d0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,9 @@ import { Dates } from 'app/core/utils/dates';
|
|||||||
import { ProofType, normalizeProofType, groupProofsByCategory } from '../../shared/kyc-proof-types';
|
import { ProofType, normalizeProofType, groupProofsByCategory } from '../../shared/kyc-proof-types';
|
||||||
import { KycUploadHelperService } from '../../shared/kyc-upload-helper.service';
|
import { KycUploadHelperService } from '../../shared/kyc-upload-helper.service';
|
||||||
import { CaptureImageDialogComponent } from '../../clients-view/custom-dialogs/capture-image-dialog/capture-image-dialog.component';
|
import { CaptureImageDialogComponent } from '../../clients-view/custom-dialogs/capture-image-dialog/capture-image-dialog.component';
|
||||||
|
import { DrawSignatureDialogComponent } from '../../clients-view/custom-dialogs/draw-signature-dialog/draw-signature-dialog.component';
|
||||||
import { dataUrlToFile } from 'app/shared/utils/data-url.util';
|
import { dataUrlToFile } from 'app/shared/utils/data-url.util';
|
||||||
|
import { DocumentPreviewDialogComponent } from '../../shared/document-preview-dialog/document-preview-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-client-kyc-step',
|
selector: 'mifosx-client-kyc-step',
|
||||||
@@ -61,12 +63,23 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
/** Set by parent after client is created */
|
/** Set by parent after client is created */
|
||||||
@Input() clientId: string = '';
|
@Input() clientId: string = '';
|
||||||
@Input() isNonIndividual = false;
|
@Input() isNonIndividual = false;
|
||||||
|
/** Minor clients don't hold a PAN card — hides the PAN section on the individual KYC form */
|
||||||
|
@Input() isMinor = false;
|
||||||
/** Constitution metadata (panLabel, showCin, etc.) passed from general step */
|
/** Constitution metadata (panLabel, showCin, etc.) passed from general step */
|
||||||
@Input() constitutionMeta: any = null;
|
@Input() constitutionMeta: any = null;
|
||||||
/** Entity full name (non-individual) — used for enterprise PAN verification */
|
/** Entity full name (non-individual) — used for enterprise PAN verification */
|
||||||
@Input() entityName: string = '';
|
@Input() entityName: string = '';
|
||||||
/** Read-only mode — disables form editing until user clicks edit icon */
|
/** Read-only mode — disables form editing until user clicks edit icon */
|
||||||
@Input() readOnly = false;
|
@Input() readOnly = false;
|
||||||
|
@Input() calculatedRisk: {
|
||||||
|
category: number;
|
||||||
|
reason: string;
|
||||||
|
amlCheckStatus?: string;
|
||||||
|
bannedEntityMatch?: string;
|
||||||
|
willfulDefaulter?: string;
|
||||||
|
ecgcSalFlag?: string;
|
||||||
|
dormantFlag?: string;
|
||||||
|
} | null = null;
|
||||||
|
|
||||||
today = new Date();
|
today = new Date();
|
||||||
kycId: string = '';
|
kycId: string = '';
|
||||||
@@ -163,7 +176,20 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
{ name: 'Driving Licence', code: 'DRIVING_LICENSE' },
|
{ name: 'Driving Licence', code: 'DRIVING_LICENSE' },
|
||||||
{ name: 'Voter ID', code: 'VOTER_ID' },
|
{ name: 'Voter ID', code: 'VOTER_ID' },
|
||||||
{ name: 'NREGA Job Card', code: 'NREGA_JOB_CARD' },
|
{ name: 'NREGA Job Card', code: 'NREGA_JOB_CARD' },
|
||||||
{ name: 'National Population Register Letter', code: 'NPR_LETTER' }
|
{ name: 'National Population Register Letter', code: 'NPR_LETTER' },
|
||||||
|
{ name: 'Birth Certificate', code: 'BIRTH_CERTIFICATE' },
|
||||||
|
{ name: 'School ID Card', code: 'SCHOOL_ID_CARD' }
|
||||||
|
];
|
||||||
|
/** Generic RBI-prescribed KYC documents for legal entities (Master Direction on KYC,
|
||||||
|
* Annexure I) — shown for non-individual clients before a specific constitution type is
|
||||||
|
* picked. Individual OVDs (Aadhaar/Passport/DL/Voter ID/NREGA/NPR) don't apply to entities. */
|
||||||
|
private nonIndividualDefaultDocTypes = [
|
||||||
|
{ name: 'Certificate of Incorporation / Registration Certificate', code: 'CERT_INCORPORATION' },
|
||||||
|
{ name: 'PAN Card of Entity', code: 'ENTITY_PAN' },
|
||||||
|
{ name: 'Memorandum & Articles of Association / Partnership Deed / Trust Deed', code: 'CONSTITUTIVE_DOC' },
|
||||||
|
{ name: 'Board Resolution / Authorization Letter', code: 'BOARD_RESOLUTION' },
|
||||||
|
{ name: 'KYC of Authorized Signatory / Power of Attorney Holder', code: 'AUTH_SIGNATORY_KYC' },
|
||||||
|
{ name: 'GST Registration Certificate', code: 'GST_CERTIFICATE' }
|
||||||
];
|
];
|
||||||
/** Constitution-based KYC document types for non-individual clients */
|
/** Constitution-based KYC document types for non-individual clients */
|
||||||
private constitutionDocTypes: Record<string, { name: string; mandatory: boolean }[]> = {
|
private constitutionDocTypes: Record<string, { name: string; mandatory: boolean }[]> = {
|
||||||
@@ -245,6 +271,9 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
{ value: 3, label: 'High Risk', years: 2, color: 'red' }
|
{ value: 3, label: 'High Risk', years: 2, color: 'red' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
riskCalculationReason = '';
|
||||||
|
showRiskRulesTable = false;
|
||||||
|
|
||||||
/** PAN verification */
|
/** PAN verification */
|
||||||
panVerifyStatus: 'NONE' | 'VERIFIED' | 'FAILED' = 'NONE';
|
panVerifyStatus: 'NONE' | 'VERIFIED' | 'FAILED' = 'NONE';
|
||||||
panVerifying = false;
|
panVerifying = false;
|
||||||
@@ -436,6 +465,8 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
kycDocIssueDate: [''],
|
kycDocIssueDate: [''],
|
||||||
kycDocExpiryDate: [''],
|
kycDocExpiryDate: [''],
|
||||||
riskCategory: [1],
|
riskCategory: [1],
|
||||||
|
allowRiskOverride: [false],
|
||||||
|
allowAmlOverride: [false],
|
||||||
remarks: [''],
|
remarks: [''],
|
||||||
amlCheckStatus: [
|
amlCheckStatus: [
|
||||||
'CLEAR',
|
'CLEAR',
|
||||||
@@ -458,22 +489,177 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
form15FY: ['']
|
form15FY: ['']
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/** RBI-accepted OVDs for a minor client — mirrors the backend's minor branch in
|
||||||
|
* ClientKycApiResource.getRequiredDocuments(). Voter ID, Driving Licence, PAN and NREGA
|
||||||
|
* all require adult eligibility; National Population Register Letter is deliberately
|
||||||
|
* excluded too (not offered as a minor OVD in this system). */
|
||||||
|
private static readonly MINOR_ELIGIBLE_DOC_CODES = new Set([
|
||||||
|
'AADHAAR',
|
||||||
|
'PASSPORT',
|
||||||
|
'BIRTH_CERTIFICATE',
|
||||||
|
'SCHOOL_ID_CARD'
|
||||||
|
]);
|
||||||
|
|
||||||
|
/** Birth Certificate / School ID Card are minor-specific OVDs — not relevant once the
|
||||||
|
* client is an adult, so they're hidden the other direction. */
|
||||||
|
private static readonly MINOR_ONLY_DOC_CODES = new Set([
|
||||||
|
'BIRTH_CERTIFICATE',
|
||||||
|
'SCHOOL_ID_CARD'
|
||||||
|
]);
|
||||||
|
|
||||||
|
private filterDocTypesForMinor<T extends { name: string; code?: string }>(docs: T[]): T[] {
|
||||||
|
if (this.isMinor) {
|
||||||
|
return docs.filter((d) => ClientKycStepComponent.MINOR_ELIGIBLE_DOC_CODES.has((d.code || '').toUpperCase()));
|
||||||
|
}
|
||||||
|
return docs.filter((d) => !ClientKycStepComponent.MINOR_ONLY_DOC_CODES.has((d.code || '').toUpperCase()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Individual-only OVDs vs. entity-only RBI docs — never both, and minor filtering only
|
||||||
|
* ever applies to individuals. */
|
||||||
|
private getDefaultDocTypes(): { name: string; code: string }[] {
|
||||||
|
return this.isNonIndividual
|
||||||
|
? this.nonIndividualDefaultDocTypes
|
||||||
|
: this.filterDocTypesForMinor(this.defaultDocumentTypes);
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Seed defaults immediately so the picker has options before clientId is set
|
this.seedDefaultDocTypes();
|
||||||
// (template API requires clientId; user can still pick a type pre-save).
|
this.loadExistingKycIfNeeded();
|
||||||
if (!this.kycDocumentTypes.length) {
|
this.loadKycTemplate();
|
||||||
this.kycDocumentTypes = this.defaultDocumentTypes.map((d) => ({
|
if (this.isNonIndividual && this.constitutionMeta) {
|
||||||
|
this.updateDocTypesForConstitution();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.kycForm.get('allowRiskOverride')?.valueChanges.subscribe((allowed: boolean) => {
|
||||||
|
const riskControl = this.kycForm.get('riskCategory');
|
||||||
|
if (allowed) {
|
||||||
|
if (!this.readOnly) {
|
||||||
|
riskControl?.enable();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
riskControl?.disable();
|
||||||
|
if (this.calculatedRisk) {
|
||||||
|
riskControl?.setValue(this.calculatedRisk.category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.kycForm.get('allowAmlOverride')?.valueChanges.subscribe((allowed: boolean) => {
|
||||||
|
const amlControls = [
|
||||||
|
this.kycForm.get('amlCheckStatus'),
|
||||||
|
this.kycForm.get('bannedEntityMatch'),
|
||||||
|
this.kycForm.get('willfulDefaulter'),
|
||||||
|
this.kycForm.get('ecgcSalFlag'),
|
||||||
|
this.kycForm.get('dormantFlag')
|
||||||
|
];
|
||||||
|
if (allowed) {
|
||||||
|
if (!this.readOnly) {
|
||||||
|
amlControls.forEach((ctrl) => ctrl?.enable());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
amlControls.forEach((ctrl) => ctrl?.disable());
|
||||||
|
this.applyAutoCalculatedAmlFlags();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!this.kycForm.get('allowRiskOverride')?.value) {
|
||||||
|
this.kycForm.get('riskCategory')?.disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.kycForm.get('allowAmlOverride')?.value) {
|
||||||
|
this.kycForm.get('amlCheckStatus')?.disable();
|
||||||
|
this.kycForm.get('bannedEntityMatch')?.disable();
|
||||||
|
this.kycForm.get('willfulDefaulter')?.disable();
|
||||||
|
this.kycForm.get('ecgcSalFlag')?.disable();
|
||||||
|
this.kycForm.get('dormantFlag')?.disable();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Seed the document-type picker from defaults (entity RBI docs vs. individual OVDs,
|
||||||
|
* filtered by the current isMinor input for individuals). Only seeds when the list is
|
||||||
|
* empty — the template API (loadKycTemplate) takes over once a clientId is available. */
|
||||||
|
private seedDefaultDocTypes(): void {
|
||||||
|
if (this.kycDocumentTypes.length) return;
|
||||||
|
this.kycDocumentTypes = this.getDefaultDocTypes().map((d) => ({
|
||||||
name: d.name,
|
name: d.name,
|
||||||
code: d.code,
|
code: d.code,
|
||||||
mandatory: false
|
mandatory: false
|
||||||
}));
|
}));
|
||||||
this.rebuildKycDocPicker();
|
this.rebuildKycDocPicker();
|
||||||
}
|
}
|
||||||
this.loadExistingKycIfNeeded();
|
|
||||||
this.loadKycTemplate();
|
/**
|
||||||
if (this.isNonIndividual && this.constitutionMeta) {
|
* Resets transient KYC-tab state for a brand-new client.
|
||||||
this.updateDocTypesForConstitution();
|
*
|
||||||
}
|
* This app's RouteReusableStrategy (core/route/route-reusable-strategy.ts) keeps this SAME
|
||||||
|
* component instance alive across repeat visits to /clients/create, so `ngOnInit` never
|
||||||
|
* re-runs for a second "create new client" session. Without this, the document-type picker
|
||||||
|
* (and any PAN/Aadhaar verification state, uploaded photo/signature) would otherwise leak
|
||||||
|
* from whatever client was created in the previous session into the new one. Called by
|
||||||
|
* CreateClientComponent.resetForNewClient() whenever a fresh create session begins.
|
||||||
|
*/
|
||||||
|
resetForNewClient(): void {
|
||||||
|
this.kycForm.reset({
|
||||||
|
hasPan: true,
|
||||||
|
riskCategory: 1,
|
||||||
|
allowRiskOverride: false,
|
||||||
|
amlCheckStatus: 'CLEAR',
|
||||||
|
bannedEntityMatch: 'NO',
|
||||||
|
willfulDefaulter: 'NO',
|
||||||
|
ecgcSalFlag: 'NO',
|
||||||
|
dormantFlag: 'ACTIVE',
|
||||||
|
accountStatus: 'ACTIVE',
|
||||||
|
form60Type: 'FORM_60',
|
||||||
|
form15Type: '15G'
|
||||||
|
});
|
||||||
|
this.kycId = '';
|
||||||
|
this.kycLoaded = false;
|
||||||
|
this.kycStatus = 0;
|
||||||
|
this.kycTemplate = null;
|
||||||
|
this.kycTemplateLoaded = false;
|
||||||
|
this.kycDocumentTypes = [];
|
||||||
|
this.selectedKycDoc = null;
|
||||||
|
this.kycDocFiles = { front: null, back: null };
|
||||||
|
this.kycDocMergedFile = null;
|
||||||
|
this.kycDocMergedPreview = null;
|
||||||
|
this.existingKycIdentifierId = null;
|
||||||
|
this.riskCalculationReason = '';
|
||||||
|
this.showRiskRulesTable = false;
|
||||||
|
this.existingKycDocuments = [];
|
||||||
|
this.photoSigTouched = false;
|
||||||
|
this.panVerifyStatus = 'NONE';
|
||||||
|
this.panVerifying = false;
|
||||||
|
this.panVerifyError = '';
|
||||||
|
this.panVerifyName = '';
|
||||||
|
this.panVerifiedOn = '';
|
||||||
|
this.aadhaarVerifyStatus = 'NONE';
|
||||||
|
this.aadhaarVerifying = false;
|
||||||
|
this.aadhaarVerifyError = '';
|
||||||
|
this.aadhaarVerifyName = '';
|
||||||
|
this.aadhaarVisible = false;
|
||||||
|
this.aadhaarOtpSent = false;
|
||||||
|
this.resetOtpDigits();
|
||||||
|
this.aadhaarOtpReferenceId = '';
|
||||||
|
this.panAadhaarSeedingStatus = '';
|
||||||
|
this.entPanVerifyStatus = 'NONE';
|
||||||
|
this.entPanVerifying = false;
|
||||||
|
this.entPanVerifyName = '';
|
||||||
|
this.entPanVerifiedOn = '';
|
||||||
|
this.gstinVerifyStatus = 'NONE';
|
||||||
|
this.gstinVerifying = false;
|
||||||
|
this.gstinVerifyName = '';
|
||||||
|
this.gstinVerifiedOn = '';
|
||||||
|
this.gstinVerifyState = '';
|
||||||
|
this.cinVerifyStatus = 'NONE';
|
||||||
|
this.cinVerifying = false;
|
||||||
|
this.cinVerifiedOn = '';
|
||||||
|
this.cinCompanyName = '';
|
||||||
|
this.photographFile = null;
|
||||||
|
this.photographPreview = null;
|
||||||
|
this.signatureFile = null;
|
||||||
|
this.signaturePreview = null;
|
||||||
|
this.existingSignatureDocId = '';
|
||||||
|
this.seedDefaultDocTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
@@ -491,11 +677,75 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.kycForm.disable({ emitEvent: false });
|
this.kycForm.disable({ emitEvent: false });
|
||||||
} else {
|
} else {
|
||||||
this.kycForm.enable({ emitEvent: false });
|
this.kycForm.enable({ emitEvent: false });
|
||||||
|
if (!this.kycForm.get('allowRiskOverride')?.value) {
|
||||||
|
this.kycForm.get('riskCategory')?.disable({ emitEvent: false });
|
||||||
|
}
|
||||||
|
if (!this.kycForm.get('allowAmlOverride')?.value) {
|
||||||
|
this.kycForm.get('amlCheckStatus')?.disable({ emitEvent: false });
|
||||||
|
this.kycForm.get('bannedEntityMatch')?.disable({ emitEvent: false });
|
||||||
|
this.kycForm.get('willfulDefaulter')?.disable({ emitEvent: false });
|
||||||
|
this.kycForm.get('ecgcSalFlag')?.disable({ emitEvent: false });
|
||||||
|
this.kycForm.get('dormantFlag')?.disable({ emitEvent: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changes['calculatedRisk']) {
|
||||||
|
const newRisk = changes['calculatedRisk'].currentValue;
|
||||||
|
if (newRisk) {
|
||||||
|
this.riskCalculationReason = newRisk.reason;
|
||||||
|
const allowOverride = this.kycForm.get('allowRiskOverride')?.value;
|
||||||
|
const riskControl = this.kycForm.get('riskCategory');
|
||||||
|
if (!allowOverride && riskControl && riskControl.value !== newRisk.category) {
|
||||||
|
riskControl.setValue(newRisk.category);
|
||||||
|
riskControl.markAsDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
const allowAmlOverride = this.kycForm.get('allowAmlOverride')?.value;
|
||||||
|
if (!allowAmlOverride) {
|
||||||
|
this.applyAutoCalculatedAmlFlags(newRisk);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.riskCalculationReason = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (changes['constitutionMeta'] && this.isNonIndividual) {
|
if (changes['constitutionMeta'] && this.isNonIndividual) {
|
||||||
this.updateDocTypesForConstitution();
|
this.updateDocTypesForConstitution();
|
||||||
}
|
}
|
||||||
|
// Legal form toggled on an already-initialized instance (route-reuse keeps this
|
||||||
|
// component alive across create sessions) — the individual OVD list and the entity RBI
|
||||||
|
// doc list are mutually exclusive, so re-seed from scratch rather than filtering in place.
|
||||||
|
if (changes['isNonIndividual'] && !changes['isNonIndividual'].firstChange && !this.kycTemplateLoaded) {
|
||||||
|
this.kycDocumentTypes = [];
|
||||||
|
this.selectedKycDoc = null;
|
||||||
|
this.kycForm.get('kycDocumentName')?.setValue('');
|
||||||
|
this.seedDefaultDocTypes();
|
||||||
|
if (this.isNonIndividual && this.constitutionMeta) {
|
||||||
|
this.updateDocTypesForConstitution();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (changes['isMinor'] && !this.isNonIndividual) {
|
||||||
|
if (this.isMinor) {
|
||||||
|
this.kycForm.get('hasPan')?.setValue(false);
|
||||||
|
this.kycForm.get('panNumber')?.setValue('');
|
||||||
|
}
|
||||||
|
// Re-derive from the full default list, not by re-filtering the already-narrowed
|
||||||
|
// `kycDocumentTypes` — filterDocTypesForMinor() only ever REMOVES entries, so once the
|
||||||
|
// initial (pre-DOB, isMinor=false) seed has already stripped out Birth Certificate /
|
||||||
|
// School ID Card, re-filtering that same shortened list can never bring them back once
|
||||||
|
// the client turns out to be a minor. Once the backend KYC template has loaded
|
||||||
|
// (kycTemplateLoaded), that list is already minor-aware and authoritative — leave it alone.
|
||||||
|
if (!this.kycTemplateLoaded) {
|
||||||
|
const rebuilt = this.filterDocTypesForMinor(
|
||||||
|
this.defaultDocumentTypes.map((d) => ({ name: d.name, code: d.code, mandatory: false }))
|
||||||
|
);
|
||||||
|
this.kycDocumentTypes = rebuilt;
|
||||||
|
const currentName = this.kycForm.get('kycDocumentName')?.value;
|
||||||
|
if (currentName && !rebuilt.some((d) => d.name === currentName)) {
|
||||||
|
this.kycForm.get('kycDocumentName')?.setValue('');
|
||||||
|
}
|
||||||
|
this.rebuildKycDocPicker();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update KYC document types based on selected constitution type */
|
/** Update KYC document types based on selected constitution type */
|
||||||
@@ -566,30 +816,17 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.kycDocMergedPreview = null;
|
this.kycDocMergedPreview = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** Open the saved KYC ID-proof document in an in-app preview dialog. */
|
||||||
* Open the saved KYC ID-proof document in a new browser tab.
|
|
||||||
*
|
|
||||||
* Same flow as the address-step variant: images use the already-loaded
|
|
||||||
* base64 data URL; PDFs (or anything without a cached preview) are fetched
|
|
||||||
* fresh and rendered via a temporary blob URL.
|
|
||||||
*/
|
|
||||||
viewExistingKycDoc(): void {
|
viewExistingKycDoc(): void {
|
||||||
if (!this.existingKycIdentifierId || this.existingKycDocuments.length === 0) {
|
if (!this.existingKycIdentifierId || this.existingKycDocuments.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const doc = this.existingKycDocuments[0];
|
const doc = this.existingKycDocuments[0];
|
||||||
if (doc.previewUrl) {
|
|
||||||
window.open(doc.previewUrl, '_blank', 'noopener');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.clientsService.downloadClientIdentificationDocument(this.existingKycIdentifierId, doc.id).subscribe({
|
this.clientsService.downloadClientIdentificationDocument(this.existingKycIdentifierId, doc.id).subscribe({
|
||||||
next: (blob: Blob) => {
|
next: (blob: Blob) =>
|
||||||
const url = URL.createObjectURL(blob);
|
this.dialog.open(DocumentPreviewDialogComponent, {
|
||||||
const w = window.open(url, '_blank', 'noopener');
|
data: { blob, title: doc.fileName || doc.name, fileName: doc.fileName || doc.name }
|
||||||
if (w) {
|
}),
|
||||||
setTimeout(() => URL.revokeObjectURL(url), 60_000);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: () => {
|
error: () => {
|
||||||
/* silent — UI still shows the saved filename */
|
/* silent — UI still shows the saved filename */
|
||||||
}
|
}
|
||||||
@@ -680,6 +917,14 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
kycDocExpiryDate: parseDate(data.kycDocExpiryDate),
|
kycDocExpiryDate: parseDate(data.kycDocExpiryDate),
|
||||||
// Risk & Remarks
|
// Risk & Remarks
|
||||||
riskCategory: data.riskCategory || 1,
|
riskCategory: data.riskCategory || 1,
|
||||||
|
allowRiskOverride: this.calculatedRisk ? this.calculatedRisk.category !== (data.riskCategory || 1) : false,
|
||||||
|
allowAmlOverride: this.calculatedRisk
|
||||||
|
? this.calculatedRisk.amlCheckStatus !== (data.amlCheckStatus || 'CLEAR') ||
|
||||||
|
this.calculatedRisk.bannedEntityMatch !== (data.bannedEntityMatch || 'NO') ||
|
||||||
|
this.calculatedRisk.willfulDefaulter !== (data.willfulDefaulter || 'NO') ||
|
||||||
|
this.calculatedRisk.ecgcSalFlag !== (data.ecgcSalFlag || 'NO') ||
|
||||||
|
this.calculatedRisk.dormantFlag !== (data.dormantFlag || 'ACTIVE')
|
||||||
|
: false,
|
||||||
remarks: data.remarks || '',
|
remarks: data.remarks || '',
|
||||||
hasPan: !!data.panNumber,
|
hasPan: !!data.panNumber,
|
||||||
// AML & Compliance
|
// AML & Compliance
|
||||||
@@ -765,12 +1010,17 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
const n = i?.documentType?.name?.toLowerCase();
|
const n = i?.documentType?.name?.toLowerCase();
|
||||||
return !!n && this.kycDocProofs.some((p) => p.name?.toLowerCase() === n);
|
return !!n && this.kycDocProofs.some((p) => p.name?.toLowerCase() === n);
|
||||||
};
|
};
|
||||||
|
// Re-uploading a KYC document creates a new identifier row rather than updating the
|
||||||
|
// old one in place (same pattern as OVD identifiers), so sort newest-first before
|
||||||
|
// picking — otherwise a repeat upload of the same document type would keep showing
|
||||||
|
// the ORIGINAL file forever, since .find() would always hit the oldest matching row.
|
||||||
|
const sorted = [...identifiers].sort((a: any, b: any) => (b?.id ?? 0) - (a?.id ?? 0));
|
||||||
// Pick by document-type name match first; otherwise the first identifier whose
|
// Pick by document-type name match first; otherwise the first identifier whose
|
||||||
// type lives in the KYC proof list (avoid bleeding the address proof in here).
|
// type lives in the KYC proof list (avoid bleeding the address proof in here).
|
||||||
const match = kycDocumentName
|
const match = kycDocumentName
|
||||||
? identifiers.find((i: any) => i?.documentType?.name?.toLowerCase() === kycDocumentName.toLowerCase())
|
? sorted.find((i: any) => i?.documentType?.name?.toLowerCase() === kycDocumentName.toLowerCase())
|
||||||
: null;
|
: null;
|
||||||
const identifier = match || identifiers.find(isKycType);
|
const identifier = match || sorted.find(isKycType);
|
||||||
if (!identifier?.id) return;
|
if (!identifier?.id) return;
|
||||||
|
|
||||||
this.existingKycIdentifierId = identifier.id.toString();
|
this.existingKycIdentifierId = identifier.id.toString();
|
||||||
@@ -845,7 +1095,12 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
if (!this.clientId) return;
|
if (!this.clientId) return;
|
||||||
this.clientsService.getClientDocuments(this.clientId).subscribe({
|
this.clientsService.getClientDocuments(this.clientId).subscribe({
|
||||||
next: (documents: any[]) => {
|
next: (documents: any[]) => {
|
||||||
const sigDoc = documents?.find((d: any) => d.name === 'clientSignature');
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced
|
||||||
|
// their signature before uploads became single-slot, so pick the highest id (latest)
|
||||||
|
// rather than the first unordered match.
|
||||||
|
const sigDoc = documents
|
||||||
|
?.filter((d: any) => d.name === 'clientSignature')
|
||||||
|
?.sort((a: any, b: any) => b.id - a.id)?.[0];
|
||||||
if (sigDoc?.id) {
|
if (sigDoc?.id) {
|
||||||
this.existingSignatureDocId = sigDoc.id.toString();
|
this.existingSignatureDocId = sigDoc.id.toString();
|
||||||
this.clientsService.getClientSignatureImage(this.clientId, this.existingSignatureDocId).subscribe({
|
this.clientsService.getClientSignatureImage(this.clientId, this.existingSignatureDocId).subscribe({
|
||||||
@@ -874,11 +1129,13 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
this.kycTemplate = template;
|
this.kycTemplate = template;
|
||||||
this.kycTemplateLoaded = true;
|
this.kycTemplateLoaded = true;
|
||||||
if (template?.requiredDocuments?.length > 0) {
|
if (template?.requiredDocuments?.length > 0) {
|
||||||
this.kycDocumentTypes = template.requiredDocuments.map((doc: any) => ({
|
this.kycDocumentTypes = this.filterDocTypesForMinor(
|
||||||
|
template.requiredDocuments.map((doc: any) => ({
|
||||||
name: doc.name,
|
name: doc.name,
|
||||||
code: doc.code || doc.name,
|
code: doc.code || doc.name,
|
||||||
mandatory: doc.mandatory ?? false
|
mandatory: doc.mandatory ?? false
|
||||||
}));
|
}))
|
||||||
|
);
|
||||||
// Update kycDocumentName validator based on mandatory docs
|
// Update kycDocumentName validator based on mandatory docs
|
||||||
const hasMandatory = this.kycDocumentTypes.some((d) => d.mandatory);
|
const hasMandatory = this.kycDocumentTypes.some((d) => d.mandatory);
|
||||||
if (hasMandatory) {
|
if (hasMandatory) {
|
||||||
@@ -891,7 +1148,7 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
error: () => {
|
error: () => {
|
||||||
// Fallback to defaults if template API unavailable
|
// Fallback to defaults if template API unavailable
|
||||||
this.kycTemplateLoaded = true;
|
this.kycTemplateLoaded = true;
|
||||||
this.kycDocumentTypes = this.defaultDocumentTypes.map((d) => ({
|
this.kycDocumentTypes = this.getDefaultDocTypes().map((d) => ({
|
||||||
name: d.name,
|
name: d.name,
|
||||||
code: d.code,
|
code: d.code,
|
||||||
mandatory: false
|
mandatory: false
|
||||||
@@ -1318,6 +1575,21 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Lets the user go back and fix a wrong Aadhaar number after an OTP was already sent —
|
||||||
|
* unlocks the (readonly-while-OTP-pending) input and discards the in-flight OTP session,
|
||||||
|
* since it was requested for the now-being-corrected number. */
|
||||||
|
changeAadhaarNumber(): void {
|
||||||
|
this.aadhaarOtpSent = false;
|
||||||
|
this.aadhaarVerifyError = '';
|
||||||
|
this.aadhaarOtpReferenceId = '';
|
||||||
|
this.resetOtpDigits();
|
||||||
|
this.resendCountdown = 0;
|
||||||
|
if (this.resendTimer) {
|
||||||
|
clearInterval(this.resendTimer);
|
||||||
|
this.resendTimer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Verify Aadhaar OTP */
|
/** Verify Aadhaar OTP */
|
||||||
verifyAadhaarOtp() {
|
verifyAadhaarOtp() {
|
||||||
if (!this.aadhaarOtp || !this.clientId || !this.kycId) return;
|
if (!this.aadhaarOtp || !this.clientId || !this.kycId) return;
|
||||||
@@ -1440,20 +1712,6 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
await this.openSignatureCropDialog(file);
|
await this.openSignatureCropDialog(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Webcam capture entry point for the specimen signature — photographs a paper
|
|
||||||
* signature, then reuses the same crop dialog + staging/upload path as the file-picker
|
|
||||||
* flow above (additive to the existing draw-pad / upload options, not a replacement). */
|
|
||||||
async captureWebcamSignature(): Promise<void> {
|
|
||||||
const dialogRef = this.dialog.open(CaptureImageDialogComponent, {
|
|
||||||
data: { captureTarget: 'signature' }
|
|
||||||
});
|
|
||||||
dialogRef.afterClosed().subscribe(async (imageDataUrl: string) => {
|
|
||||||
if (!imageDataUrl) return;
|
|
||||||
const file = dataUrlToFile(imageDataUrl, 'webcam-signature.jpg');
|
|
||||||
await this.openSignatureCropDialog(file);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private async openSignatureCropDialog(file: File): Promise<void> {
|
private async openSignatureCropDialog(file: File): Promise<void> {
|
||||||
const { ImageCropDialogComponent } = await import('./image-crop-dialog/image-crop-dialog.component');
|
const { ImageCropDialogComponent } = await import('./image-crop-dialog/image-crop-dialog.component');
|
||||||
const dialogRef = this.dialog.open(ImageCropDialogComponent, {
|
const dialogRef = this.dialog.open(ImageCropDialogComponent, {
|
||||||
@@ -1463,41 +1721,50 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
});
|
});
|
||||||
dialogRef.afterClosed().subscribe((result: any) => {
|
dialogRef.afterClosed().subscribe((result: any) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.signatureFile = result.croppedFile;
|
this.applySignatureFile(result.croppedFile, result.previewUrl);
|
||||||
this.signaturePreview = result.previewUrl;
|
}
|
||||||
// In edit mode, delete old signature doc then upload new one
|
});
|
||||||
if (this.clientId) {
|
}
|
||||||
|
|
||||||
|
/** Draw-with-mouse/touchpad entry point for the specimen signature — same staging/upload
|
||||||
|
* path as the file-picker and webcam flows, minus the crop step (the pad's canvas is
|
||||||
|
* already the right shape/size). */
|
||||||
|
drawSignature(): void {
|
||||||
|
const dialogRef = this.dialog.open(DrawSignatureDialogComponent);
|
||||||
|
dialogRef.afterClosed().subscribe((file: File) => {
|
||||||
|
if (file) {
|
||||||
|
this.applySignatureFile(file, URL.createObjectURL(file));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Stages the signature locally and, in edit mode, persists it — replacing any existing
|
||||||
|
* signature doc first so a client never ends up with two. Shared by the file-picker, webcam
|
||||||
|
* and draw-pad entry points. */
|
||||||
|
private applySignatureFile(file: File, previewUrl: string): void {
|
||||||
|
this.signatureFile = file;
|
||||||
|
this.signaturePreview = previewUrl;
|
||||||
|
if (!this.clientId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this.existingSignatureDocId) {
|
if (this.existingSignatureDocId) {
|
||||||
this.clientsService.deleteClientDocument(this.clientId, this.existingSignatureDocId).subscribe({
|
this.clientsService.deleteClientDocument(this.clientId, this.existingSignatureDocId).subscribe({
|
||||||
next: () => {
|
next: () => this.uploadSignatureFile(file),
|
||||||
this.clientsService.uploadClientSignatureImage(this.clientId, result.croppedFile).subscribe({
|
error: () => this.uploadSignatureFile(file)
|
||||||
next: (res: any) => {
|
|
||||||
if (res?.resourceId) this.existingSignatureDocId = res.resourceId.toString();
|
|
||||||
},
|
|
||||||
error: () => {}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
error: () => {
|
|
||||||
this.clientsService.uploadClientSignatureImage(this.clientId, result.croppedFile).subscribe({
|
|
||||||
next: (res: any) => {
|
|
||||||
if (res?.resourceId) this.existingSignatureDocId = res.resourceId.toString();
|
|
||||||
},
|
|
||||||
error: () => {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.clientsService.uploadClientSignatureImage(this.clientId, result.croppedFile).subscribe({
|
this.uploadSignatureFile(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uploadSignatureFile(file: File): void {
|
||||||
|
this.clientsService.uploadClientSignatureImage(this.clientId, file).subscribe({
|
||||||
next: (res: any) => {
|
next: (res: any) => {
|
||||||
if (res?.resourceId) this.existingSignatureDocId = res.resourceId.toString();
|
if (res?.resourceId) this.existingSignatureDocId = res.resourceId.toString();
|
||||||
},
|
},
|
||||||
error: () => {}
|
error: () => {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
removePhoto() {
|
removePhoto() {
|
||||||
this.photographFile = null;
|
this.photographFile = null;
|
||||||
@@ -1523,7 +1790,7 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get kycData(): any {
|
get kycData(): any {
|
||||||
const formVal = this.readOnly ? this.kycForm.getRawValue() : this.kycForm.value;
|
const formVal = this.kycForm.getRawValue();
|
||||||
const aadhaarRaw = formVal.aadhaarNumber || '';
|
const aadhaarRaw = formVal.aadhaarNumber || '';
|
||||||
const aadhaarMasked = aadhaarRaw.length === 12 ? 'XXXXXXXX' + aadhaarRaw.slice(-4) : null;
|
const aadhaarMasked = aadhaarRaw.length === 12 ? 'XXXXXXXX' + aadhaarRaw.slice(-4) : null;
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
@@ -1592,6 +1859,21 @@ export class ClientKycStepComponent implements OnInit, OnChanges, OnDestroy {
|
|||||||
v.form15Applicable
|
v.form15Applicable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private applyAutoCalculatedAmlFlags(risk = this.calculatedRisk): void {
|
||||||
|
if (!risk) return;
|
||||||
|
this.kycForm.get('amlCheckStatus')?.setValue(risk.amlCheckStatus || 'CLEAR');
|
||||||
|
this.kycForm.get('bannedEntityMatch')?.setValue(risk.bannedEntityMatch || 'NO');
|
||||||
|
this.kycForm.get('willfulDefaulter')?.setValue(risk.willfulDefaulter || 'NO');
|
||||||
|
this.kycForm.get('ecgcSalFlag')?.setValue(risk.ecgcSalFlag || 'NO');
|
||||||
|
this.kycForm.get('dormantFlag')?.setValue(risk.dormantFlag || 'ACTIVE');
|
||||||
|
|
||||||
|
this.kycForm.get('amlCheckStatus')?.markAsDirty();
|
||||||
|
this.kycForm.get('bannedEntityMatch')?.markAsDirty();
|
||||||
|
this.kycForm.get('willfulDefaulter')?.markAsDirty();
|
||||||
|
this.kycForm.get('ecgcSalFlag')?.markAsDirty();
|
||||||
|
this.kycForm.get('dormantFlag')?.markAsDirty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -195,7 +195,7 @@
|
|||||||
client.isMinor ? 'preview-badge preview-badge--danger' : 'preview-badge preview-badge--verified'
|
client.isMinor ? 'preview-badge preview-badge--danger' : 'preview-badge preview-badge--verified'
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ client.isMinor ? 'Yes (Age < 10)' : 'No' }}
|
{{ client.isMinor ? 'Yes (Age < 18)' : 'No' }}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'form60',
|
path: 'form60',
|
||||||
component: Form60TabComponent,
|
component: Form60TabComponent,
|
||||||
data: { title: 'Form 60', breadcrumb: 'Form 60', routeParamBreadcrumb: false }
|
data: { title: 'Form 97', breadcrumb: 'Form 97', routeParamBreadcrumb: false }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'documents',
|
path: 'documents',
|
||||||
|
|||||||
@@ -234,8 +234,12 @@ export class CkycTabComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Signature — client document with name='clientSignature'
|
// 2. Signature — client document with name='clientSignature'. Multiple rows can exist
|
||||||
const signatureDoc = (documents as any[])?.find((d: any) => d?.name === 'clientSignature');
|
// for clients who re-cropped/replaced their signature before uploads became single-slot,
|
||||||
|
// so pick the highest id (latest) rather than the first unordered match.
|
||||||
|
const signatureDoc = (documents as any[])
|
||||||
|
?.filter((d: any) => d?.name === 'clientSignature')
|
||||||
|
?.sort((a: any, b: any) => b.id - a.id)?.[0];
|
||||||
if (signatureDoc) {
|
if (signatureDoc) {
|
||||||
this.existing.CLIENT_SIGNATURE = {
|
this.existing.CLIENT_SIGNATURE = {
|
||||||
present: true,
|
present: true,
|
||||||
|
|||||||
@@ -410,6 +410,9 @@
|
|||||||
<button mat-menu-item (click)="doAction('Add Charge')" *mifosxHasPermission="'CREATE_CLIENTCHARGE'">
|
<button mat-menu-item (click)="doAction('Add Charge')" *mifosxHasPermission="'CREATE_CLIENTCHARGE'">
|
||||||
{{ 'labels.buttons.Add Charge' | translate }}
|
{{ 'labels.buttons.Add Charge' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
<button mat-menu-item (click)="doAction('Welcome Kit')" *mifosxHasPermission="'READ_WELCOMEKIT'">
|
||||||
|
Welcome Kit
|
||||||
|
</button>
|
||||||
<button mat-menu-item (click)="doAction('Create Collateral')">
|
<button mat-menu-item (click)="doAction('Create Collateral')">
|
||||||
{{ 'labels.buttons.Create Collateral' | translate }}
|
{{ 'labels.buttons.Create Collateral' | translate }}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { DrawSignatureDialogComponent } from './custom-dialogs/draw-signature-di
|
|||||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
import { UploadImageDialogComponent } from './custom-dialogs/upload-image-dialog/upload-image-dialog.component';
|
import { UploadImageDialogComponent } from './custom-dialogs/upload-image-dialog/upload-image-dialog.component';
|
||||||
import { CaptureImageDialogComponent } from './custom-dialogs/capture-image-dialog/capture-image-dialog.component';
|
import { CaptureImageDialogComponent } from './custom-dialogs/capture-image-dialog/capture-image-dialog.component';
|
||||||
|
import { WelcomeKitDialogComponent } from './custom-dialogs/welcome-kit-dialog/welcome-kit-dialog.component';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { ClientsService } from '../clients.service';
|
import { ClientsService } from '../clients.service';
|
||||||
@@ -255,6 +256,9 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
case 'Delete Image':
|
case 'Delete Image':
|
||||||
this.deleteProfileImage();
|
this.deleteProfileImage();
|
||||||
break;
|
break;
|
||||||
|
case 'Welcome Kit':
|
||||||
|
this.dispatchWelcomeKit();
|
||||||
|
break;
|
||||||
case 'Create Standing Instructions':
|
case 'Create Standing Instructions':
|
||||||
const createStandingInstructionsQueryParams: any = {
|
const createStandingInstructionsQueryParams: any = {
|
||||||
officeId: this.clientViewData.officeId,
|
officeId: this.clientViewData.officeId,
|
||||||
@@ -455,4 +459,20 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Opens the Welcome Kit Dispatch dialog.
|
||||||
|
*/
|
||||||
|
private dispatchWelcomeKit() {
|
||||||
|
const welcomeKitDialogRef = this.dialog.open(WelcomeKitDialogComponent, {
|
||||||
|
data: { clientId: this.clientViewData.id },
|
||||||
|
width: '600px'
|
||||||
|
});
|
||||||
|
welcomeKitDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response) {
|
||||||
|
// the form was successfully submitted
|
||||||
|
this.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -47,7 +47,13 @@ export class DeleteSignatureDialogComponent {
|
|||||||
* @param {any} data Documents data
|
* @param {any} data Documents data
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
const signature = this.data.find((document: any) => document.name === 'clientSignature') || {};
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced their
|
||||||
|
// signature before uploads became single-slot, so pick the highest id (latest) rather than
|
||||||
|
// the first unordered match.
|
||||||
|
const signature =
|
||||||
|
this.data
|
||||||
|
.filter((document: any) => document.name === 'clientSignature')
|
||||||
|
.sort((a: any, b: any) => b.id - a.id)[0] || {};
|
||||||
this.signatureId = signature.id;
|
this.signatureId = signature.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-3
@@ -347,9 +347,18 @@
|
|||||||
<i class="fa fa-calendar"></i> Issue / statement date
|
<i class="fa fa-calendar"></i> Issue / statement date
|
||||||
<span class="kyc-opt">(not older than 3 months)</span>
|
<span class="kyc-opt">(not older than 3 months)</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="kyc-input-wrap kyc-input-wrap--date">
|
<div class="kyc-input-wrap kyc-input-wrap--date" (click)="uploadIssueDatePicker.open()">
|
||||||
<i class="fa fa-calendar-o kyc-input-wrap__icon"></i>
|
<input
|
||||||
<input type="date" class="kyc-input kyc-input--date" formControlName="issueDate" />
|
class="kyc-input kyc-input--date"
|
||||||
|
[matDatepicker]="uploadIssueDatePicker"
|
||||||
|
formControlName="issueDate"
|
||||||
|
readonly
|
||||||
|
/>
|
||||||
|
<mat-datepicker-toggle
|
||||||
|
class="kyc-input-wrap__calendar-toggle"
|
||||||
|
[for]="uploadIssueDatePicker"
|
||||||
|
></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #uploadIssueDatePicker></mat-datepicker>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-27
@@ -388,42 +388,32 @@ $red-900: #993c1d;
|
|||||||
padding-left: 38px;
|
padding-left: 38px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Date input — match styling of other kyc inputs */
|
/* Date input — opens the Material calendar picker; styled to match other kyc inputs */
|
||||||
.kyc-input--date {
|
.kyc-input--date {
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
color: $gray-900;
|
color: $gray-900;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
padding-right: 14px !important;
|
padding-left: 12px !important;
|
||||||
|
padding-right: 40px !important;
|
||||||
|
}
|
||||||
|
|
||||||
&::-webkit-calendar-picker-indicator {
|
.kyc-input-wrap--date .kyc-input-wrap__calendar-toggle {
|
||||||
opacity: 0.55;
|
position: absolute;
|
||||||
cursor: pointer;
|
right: 2px;
|
||||||
filter: grayscale(1);
|
top: 50%;
|
||||||
transition: opacity 0.15s;
|
transform: translateY(-50%);
|
||||||
}
|
|
||||||
|
|
||||||
&:hover::-webkit-calendar-picker-indicator {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-datetime-edit {
|
|
||||||
color: $gray-900;
|
|
||||||
padding-top: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-datetime-edit-fields-wrapper {
|
|
||||||
color: $gray-900;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::-webkit-datetime-edit-text {
|
|
||||||
color: $gray-500;
|
color: $gray-500;
|
||||||
padding: 0 2px;
|
|
||||||
|
::ng-deep .mat-mdc-icon-button {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:invalid::-webkit-datetime-edit,
|
::ng-deep .mat-mdc-icon-button svg {
|
||||||
&:not(:focus):placeholder-shown::-webkit-datetime-edit {
|
width: 18px;
|
||||||
color: $gray-500;
|
height: 18px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -65,7 +65,13 @@ export class ViewSignatureDialogComponent implements OnInit {
|
|||||||
* @param {any} data Documents data
|
* @param {any} data Documents data
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
const signature = this.data.documents.find((document: any) => document.name === 'clientSignature') || {};
|
// Multiple 'clientSignature' documents can exist for clients who re-cropped/replaced their
|
||||||
|
// signature before uploads became single-slot, so pick the highest id (latest) rather than
|
||||||
|
// the first unordered match.
|
||||||
|
const signature =
|
||||||
|
this.data.documents
|
||||||
|
.filter((document: any) => document.name === 'clientSignature')
|
||||||
|
.sort((a: any, b: any) => b.id - a.id)[0] || {};
|
||||||
this.signatureId = signature.id;
|
this.signatureId = signature.id;
|
||||||
this.clientId = this.data.id;
|
this.clientId = this.data.id;
|
||||||
}
|
}
|
||||||
|
|||||||
+94
@@ -0,0 +1,94 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
<h2 mat-dialog-title>Welcome Kit Dispatch</h2>
|
||||||
|
|
||||||
|
<mat-dialog-content class="mat-typography">
|
||||||
|
<div fxLayout="row" fxLayoutAlign="center center" style="padding: 2rem" *ngIf="isLoading">
|
||||||
|
<mat-spinner diameter="40"></mat-spinner>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ng-container *ngIf="!isLoading">
|
||||||
|
<!-- Tracking view if dispatches already exist -->
|
||||||
|
<div
|
||||||
|
class="dispatch-tracking-panel"
|
||||||
|
*ngFor="let dispatch of activeDispatches; let i = index"
|
||||||
|
style="margin-bottom: 16px; padding: 16px; border: 1px solid #e0e0e0; border-radius: 4px; background: #fafafa"
|
||||||
|
>
|
||||||
|
<div fxLayout="row" fxLayoutAlign="space-between start" style="margin-bottom: 8px">
|
||||||
|
<h3 style="margin: 0">{{ i === 0 ? 'Current' : 'Previous' }} Welcome Kit Status</h3>
|
||||||
|
<button mat-stroked-button color="primary" type="button" (click)="downloadPdf(dispatch)">
|
||||||
|
Download Details
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<p style="margin: 4px 0"><strong>Delivery Address:</strong> {{ getDisplayAddress(dispatch) }}</p>
|
||||||
|
<p style="margin: 4px 0"><strong>Tracking ID:</strong> {{ dispatch.trackingId }}</p>
|
||||||
|
<p style="margin: 4px 0">
|
||||||
|
<strong>Delivery Mode:</strong> {{ dispatch.deliveryMode }}
|
||||||
|
<ng-container *ngIf="dispatch.deliveryMode === 'OTHER'">({{ dispatch.deliveryModeOtherText }})</ng-container>
|
||||||
|
</p>
|
||||||
|
<p style="margin: 4px 0"><strong>Dispatched On:</strong> {{ dispatch.dispatchedOnDate | date: 'mediumDate' }}</p>
|
||||||
|
<p style="margin: 4px 0">
|
||||||
|
<strong>Status:</strong>
|
||||||
|
<span class="status-badge status-{{ dispatch.status | lowercase }}">{{ dispatch.status }}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr *ngIf="activeDispatches.length > 0 && welcomeKitsData?.canDispatchNew" />
|
||||||
|
|
||||||
|
<!-- Create form if they can dispatch a new one -->
|
||||||
|
<div class="dispatch-create-form" [formGroup]="dispatchForm" *ngIf="welcomeKitsData?.canDispatchNew">
|
||||||
|
<h3>Create New Dispatch</h3>
|
||||||
|
<div fxLayout="column" fxLayoutGap="16px">
|
||||||
|
<mat-form-field appearance="outline" class="full-width">
|
||||||
|
<mat-label>Delivery Address</mat-label>
|
||||||
|
<textarea matInput formControlName="deliveryAddress" rows="3" required></textarea>
|
||||||
|
<mat-error *ngIf="dispatchForm.get('deliveryAddress')?.hasError('required')">
|
||||||
|
Delivery Address is required
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field appearance="outline" class="full-width">
|
||||||
|
<mat-label>Delivery Mode</mat-label>
|
||||||
|
<mat-select formControlName="deliveryMode" required>
|
||||||
|
<mat-option *ngFor="let mode of deliveryModes" [value]="mode">
|
||||||
|
{{ mode }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="dispatchForm.get('deliveryMode')?.hasError('required')">
|
||||||
|
Delivery Mode is required
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field
|
||||||
|
appearance="outline"
|
||||||
|
class="full-width"
|
||||||
|
*ngIf="dispatchForm.get('deliveryMode')?.value === 'OTHER'"
|
||||||
|
>
|
||||||
|
<mat-label>Specify Other Mode</mat-label>
|
||||||
|
<input matInput formControlName="deliveryModeOtherText" required />
|
||||||
|
<mat-error *ngIf="dispatchForm.get('deliveryModeOtherText')?.hasError('required')">
|
||||||
|
Please specify the delivery mode
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-container>
|
||||||
|
</mat-dialog-content>
|
||||||
|
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-button mat-dialog-close>Close</button>
|
||||||
|
<button
|
||||||
|
mat-raised-button
|
||||||
|
color="primary"
|
||||||
|
*ngIf="welcomeKitsData?.canDispatchNew && !isLoading"
|
||||||
|
(click)="submit()"
|
||||||
|
[disabled]="dispatchForm.invalid || isLoading"
|
||||||
|
>
|
||||||
|
Dispatch
|
||||||
|
</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
+59
@@ -0,0 +1,59 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
.dispatch-tracking-panel {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 16px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
margin: 6px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
font-weight: 500;
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
&.status-dispatched {
|
||||||
|
background-color: #1976d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-in_transit {
|
||||||
|
background-color: #f57c00;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-delivered {
|
||||||
|
background-color: #388e3c;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-returned {
|
||||||
|
background-color: #d32f2f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.dispatch-create-form {
|
||||||
|
h3 {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.full-width {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
+347
@@ -0,0 +1,347 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnInit, inject } from '@angular/core';
|
||||||
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
|
import {
|
||||||
|
MAT_DIALOG_DATA,
|
||||||
|
MatDialogRef,
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose
|
||||||
|
} from '@angular/material/dialog';
|
||||||
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||||
|
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||||
|
import { ClientsService } from '../../../clients.service';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DatePipe } from '@angular/common';
|
||||||
|
import { jsPDF } from 'jspdf';
|
||||||
|
import autoTable from 'jspdf-autotable';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-welcome-kit-dialog',
|
||||||
|
templateUrl: './welcome-kit-dialog.component.html',
|
||||||
|
styleUrls: ['./welcome-kit-dialog.component.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose,
|
||||||
|
MatProgressSpinnerModule
|
||||||
|
],
|
||||||
|
providers: [DatePipe]
|
||||||
|
})
|
||||||
|
export class WelcomeKitDialogComponent implements OnInit {
|
||||||
|
private dialogRef = inject(MatDialogRef<WelcomeKitDialogComponent>);
|
||||||
|
data: { clientId: string } = inject(MAT_DIALOG_DATA);
|
||||||
|
private clientsService = inject(ClientsService);
|
||||||
|
private formBuilder = inject(FormBuilder);
|
||||||
|
private snackBar = inject(MatSnackBar);
|
||||||
|
private datePipe = inject(DatePipe);
|
||||||
|
|
||||||
|
isLoading = true;
|
||||||
|
welcomeKitsData: any = null;
|
||||||
|
dispatchForm: FormGroup = this.formBuilder.group({
|
||||||
|
deliveryAddress: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
deliveryMode: [
|
||||||
|
'POSTMAN',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
deliveryModeOtherText: ['']
|
||||||
|
});
|
||||||
|
deliveryModes = [
|
||||||
|
'POSTMAN',
|
||||||
|
'COURIER',
|
||||||
|
'OTHER'
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.dispatchForm.get('deliveryMode')?.valueChanges.subscribe((mode) => {
|
||||||
|
const otherControl = this.dispatchForm.get('deliveryModeOtherText');
|
||||||
|
if (mode === 'OTHER') {
|
||||||
|
otherControl?.setValidators([Validators.required]);
|
||||||
|
} else {
|
||||||
|
otherControl?.clearValidators();
|
||||||
|
}
|
||||||
|
otherControl?.updateValueAndValidity();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.fetchData();
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchData() {
|
||||||
|
this.isLoading = true;
|
||||||
|
this.clientsService.getWelcomeKits(this.data.clientId).subscribe({
|
||||||
|
next: (response: any) => {
|
||||||
|
this.welcomeKitsData = response;
|
||||||
|
if (this.welcomeKitsData && this.welcomeKitsData.canDispatchNew) {
|
||||||
|
this.fetchPrimaryAddress();
|
||||||
|
} else {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.isLoading = false;
|
||||||
|
this.snackBar.open('Failed to load welcome kits data', 'Close', { duration: 3000 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchPrimaryAddress() {
|
||||||
|
this.clientsService.getClientAddressData(this.data.clientId).subscribe({
|
||||||
|
next: (addresses: any) => {
|
||||||
|
this.isLoading = false;
|
||||||
|
if (addresses && addresses.length > 0) {
|
||||||
|
// Attempt to build a readable address from the first address returned
|
||||||
|
const primary = addresses[0];
|
||||||
|
const parts = [];
|
||||||
|
if (primary.addressLine1) parts.push(primary.addressLine1);
|
||||||
|
if (primary.addressLine2) parts.push(primary.addressLine2);
|
||||||
|
if (primary.city) parts.push(primary.city);
|
||||||
|
if (primary.stateName) parts.push(primary.stateName);
|
||||||
|
if (primary.postalCode) parts.push(primary.postalCode);
|
||||||
|
if (primary.countryName) parts.push(primary.countryName);
|
||||||
|
|
||||||
|
const clientNameStr = this.welcomeKitsData?.clientName ? this.welcomeKitsData.clientName + ' — ' : '';
|
||||||
|
this.dispatchForm.patchValue({
|
||||||
|
deliveryAddress: clientNameStr + parts.join(', ')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get activeDispatches() {
|
||||||
|
if (this.welcomeKitsData && this.welcomeKitsData.dispatches && this.welcomeKitsData.dispatches.length > 0) {
|
||||||
|
return this.welcomeKitsData.dispatches;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
if (this.dispatchForm.invalid) {
|
||||||
|
this.dispatchForm.markAllAsTouched();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isLoading = true;
|
||||||
|
const formValue = this.dispatchForm.value;
|
||||||
|
|
||||||
|
const today = new Date();
|
||||||
|
const formattedDate = this.datePipe.transform(today, 'dd MMMM yyyy');
|
||||||
|
|
||||||
|
const payload = {
|
||||||
|
deliveryAddress: formValue.deliveryAddress,
|
||||||
|
deliveryMode: formValue.deliveryMode,
|
||||||
|
deliveryModeOtherText: formValue.deliveryMode === 'OTHER' ? formValue.deliveryModeOtherText : null,
|
||||||
|
dispatchedOnDate: formattedDate,
|
||||||
|
locale: 'en',
|
||||||
|
dateFormat: 'dd MMMM yyyy'
|
||||||
|
};
|
||||||
|
|
||||||
|
this.clientsService.dispatchWelcomeKit(this.data.clientId, payload).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.snackBar.open('Welcome Kit Dispatched successfully', 'Close', { duration: 3000 });
|
||||||
|
this.fetchData();
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.isLoading = false;
|
||||||
|
this.snackBar.open('Failed to dispatch welcome kit', 'Close', { duration: 3000 });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getDisplayAddress(dispatch: any): string {
|
||||||
|
const address = dispatch.deliveryAddress || '';
|
||||||
|
const name = this.welcomeKitsData?.clientName || '';
|
||||||
|
if (name && !address.startsWith(name)) {
|
||||||
|
return `${name} — ${address}`;
|
||||||
|
}
|
||||||
|
return address;
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadPdf(dispatch: any) {
|
||||||
|
const doc = new jsPDF();
|
||||||
|
const clientName = this.welcomeKitsData?.clientName || dispatch.clientName || 'N/A';
|
||||||
|
const address = this.getDisplayAddress(dispatch);
|
||||||
|
const mode =
|
||||||
|
dispatch.deliveryMode === 'OTHER'
|
||||||
|
? `${dispatch.deliveryMode} (${dispatch.deliveryModeOtherText || ''})`
|
||||||
|
: dispatch.deliveryMode;
|
||||||
|
const trackingId = dispatch.trackingId || 'N/A';
|
||||||
|
const status = dispatch.status || 'N/A';
|
||||||
|
const dispatchedOn = this.datePipe.transform(dispatch.dispatchedOnDate, 'mediumDate') || 'N/A';
|
||||||
|
|
||||||
|
const primaryColor: [number, number, number] = [
|
||||||
|
31,
|
||||||
|
73,
|
||||||
|
125
|
||||||
|
]; // Navy Blue
|
||||||
|
const grayColor: [number, number, number] = [
|
||||||
|
100,
|
||||||
|
100,
|
||||||
|
100
|
||||||
|
];
|
||||||
|
const lightGray: [number, number, number] = [
|
||||||
|
230,
|
||||||
|
230,
|
||||||
|
230
|
||||||
|
];
|
||||||
|
const pageWidth = doc.internal.pageSize.getWidth();
|
||||||
|
const pageHeight = doc.internal.pageSize.getHeight();
|
||||||
|
|
||||||
|
// --- 1. Header Banner ---
|
||||||
|
doc.setFillColor(...primaryColor);
|
||||||
|
doc.rect(0, 0, pageWidth, 40, 'F');
|
||||||
|
|
||||||
|
// Decorative circles
|
||||||
|
doc.setFillColor(255, 255, 255);
|
||||||
|
doc.circle(pageWidth - 20, 15, 3, 'F');
|
||||||
|
doc.circle(pageWidth - 30, 25, 2, 'F');
|
||||||
|
doc.circle(pageWidth - 10, 30, 1.5, 'F');
|
||||||
|
|
||||||
|
doc.setFontSize(28);
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setTextColor(255, 255, 255);
|
||||||
|
doc.text('CBSNexora', 20, 22);
|
||||||
|
|
||||||
|
doc.setFontSize(11);
|
||||||
|
doc.setFont('helvetica', 'normal');
|
||||||
|
doc.text('Core Banking Solution', 22, 30);
|
||||||
|
|
||||||
|
// --- 2. Title ---
|
||||||
|
let currentY = 55;
|
||||||
|
doc.setFontSize(16);
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setTextColor(...primaryColor);
|
||||||
|
doc.text('Welcome Kit Dispatch Confirmation', pageWidth / 2, currentY, { align: 'center' });
|
||||||
|
currentY += 12;
|
||||||
|
|
||||||
|
// --- 3. Date Line ---
|
||||||
|
doc.setFontSize(11);
|
||||||
|
doc.setFont('helvetica', 'normal');
|
||||||
|
doc.setTextColor(0, 0, 0);
|
||||||
|
const today = this.datePipe.transform(new Date(), 'longDate');
|
||||||
|
doc.text(`Date: ${today}`, pageWidth - 20, currentY, { align: 'right' });
|
||||||
|
currentY += 15;
|
||||||
|
|
||||||
|
// --- 4. Greeting ---
|
||||||
|
doc.text(`Dear ${clientName},`, 20, currentY);
|
||||||
|
currentY += 10;
|
||||||
|
|
||||||
|
// --- 5. Opening welcome paragraph ---
|
||||||
|
const p1 =
|
||||||
|
'Welcome to the CBSNexora family! We are delighted to have you on board as a valued client. As part of our onboarding process, we have dispatched your Welcome Kit to your registered address, which includes your account documentation and essential banking materials to help you get started with us.';
|
||||||
|
const splitP1 = doc.splitTextToSize(p1, pageWidth - 40);
|
||||||
|
doc.text(splitP1, 20, currentY);
|
||||||
|
currentY += splitP1.length * 6 + 8;
|
||||||
|
|
||||||
|
// --- 6. Short paragraph about the company ---
|
||||||
|
const p2 =
|
||||||
|
'CBSNexora is committed to providing secure, reliable, and customer-first banking services. Our team is always available to assist you with any banking needs, from account management to digital services, ensuring a seamless banking experience.';
|
||||||
|
const splitP2 = doc.splitTextToSize(p2, pageWidth - 40);
|
||||||
|
doc.text(splitP2, 20, currentY);
|
||||||
|
currentY += splitP2.length * 6 + 8;
|
||||||
|
|
||||||
|
// --- 7. Transition line before details ---
|
||||||
|
doc.text('Please find your Welcome Kit dispatch details below for your reference:', 20, currentY);
|
||||||
|
currentY += 8;
|
||||||
|
|
||||||
|
// --- 8. Details Section ---
|
||||||
|
autoTable(doc, {
|
||||||
|
startY: currentY,
|
||||||
|
theme: 'plain',
|
||||||
|
margin: { left: 20, right: 20 },
|
||||||
|
styles: { fontSize: 11, cellPadding: 6, textColor: [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
] },
|
||||||
|
columnStyles: {
|
||||||
|
0: { fontStyle: 'bold', cellWidth: 50 },
|
||||||
|
1: { cellWidth: 'auto' }
|
||||||
|
},
|
||||||
|
didDrawCell: (data) => {
|
||||||
|
if (data.row.index >= 0) {
|
||||||
|
doc.setDrawColor(...lightGray);
|
||||||
|
doc.setLineWidth(0.2);
|
||||||
|
doc.line(
|
||||||
|
data.cell.x,
|
||||||
|
data.cell.y + data.cell.height,
|
||||||
|
data.cell.x + data.cell.width,
|
||||||
|
data.cell.y + data.cell.height
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
body: [
|
||||||
|
[
|
||||||
|
'Delivery Address',
|
||||||
|
address
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'Delivery Mode',
|
||||||
|
mode
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'Tracking ID',
|
||||||
|
trackingId
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'Status',
|
||||||
|
status
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'Dispatched On',
|
||||||
|
dispatchedOn
|
||||||
|
]
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
// --- 9. Closing paragraph ---
|
||||||
|
currentY = (doc as any).lastAutoTable.finalY + 12;
|
||||||
|
const p3 =
|
||||||
|
'Should you have any questions about your Welcome Kit or need any assistance, please do not hesitate to reach out to our support team. We look forward to serving you and building a long-term relationship with you.';
|
||||||
|
const splitP3 = doc.splitTextToSize(p3, pageWidth - 40);
|
||||||
|
doc.text(splitP3, 20, currentY);
|
||||||
|
currentY += splitP3.length * 6 + 12;
|
||||||
|
|
||||||
|
// --- 10. Sign-off ---
|
||||||
|
doc.text('Warm regards,', 20, currentY);
|
||||||
|
currentY += 7;
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.text('CBSNexora Operations Team', 20, currentY);
|
||||||
|
|
||||||
|
// --- 11. Footer ---
|
||||||
|
// Ensure footer doesn't float too high on short pages, but pushes down if content goes long
|
||||||
|
let footerY = currentY + 30;
|
||||||
|
if (footerY < pageHeight - 30) {
|
||||||
|
footerY = pageHeight - 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.setDrawColor(...primaryColor);
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.line(20, footerY - 5, pageWidth - 20, footerY - 5);
|
||||||
|
|
||||||
|
doc.setFontSize(9);
|
||||||
|
doc.setFont('helvetica', 'italic');
|
||||||
|
doc.setTextColor(...grayColor);
|
||||||
|
const timestamp = this.datePipe.transform(new Date(), 'medium');
|
||||||
|
doc.text(`This is a system-generated document. Generated on: ${timestamp}`, 20, footerY + 2);
|
||||||
|
|
||||||
|
doc.save(`WelcomeKit_Dispatch_${trackingId !== 'N/A' ? trackingId : new Date().getTime()}.pdf`);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
<div class="f60-pan-ok__icon-wrap">
|
<div class="f60-pan-ok__icon-wrap">
|
||||||
<mat-icon class="f60-pan-ok__icon">verified</mat-icon>
|
<mat-icon class="f60-pan-ok__icon">verified</mat-icon>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="f60-pan-ok__title">Form 60 Not Required</h3>
|
<h3 class="f60-pan-ok__title">Form 97 Not Required</h3>
|
||||||
<p class="f60-pan-ok__desc">
|
<p class="f60-pan-ok__desc">
|
||||||
PAN <strong>{{ panNumber }}</strong> is attached to this client.
|
PAN <strong>{{ panNumber }}</strong> is attached to this client.
|
||||||
@if (panVerified) {
|
@if (panVerified) {
|
||||||
<mat-icon class="f60-pan-ok__tick">check_circle</mat-icon> <span class="f60-pan-ok__verified">Verified</span>
|
<mat-icon class="f60-pan-ok__tick">check_circle</mat-icon> <span class="f60-pan-ok__verified">Verified</span>
|
||||||
}
|
}
|
||||||
</p>
|
</p>
|
||||||
<p class="f60-pan-ok__rule">As per Income Tax Rule 114B, Form 60 is only required when PAN is not available.</p>
|
<p class="f60-pan-ok__rule">As per Income Tax Rule 114B, Form 97 is only required when PAN is not available.</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
<div class="f60-warning">
|
<div class="f60-warning">
|
||||||
<mat-icon class="f60-warning__icon">warning_amber</mat-icon>
|
<mat-icon class="f60-warning__icon">warning_amber</mat-icon>
|
||||||
<div class="f60-warning__text">
|
<div class="f60-warning__text">
|
||||||
<strong>PAN not provided</strong> — Form 60 declaration is mandatory as per Income Tax Rule 114B.
|
<strong>PAN not provided</strong> — Form 97 declaration is mandatory as per Income Tax Rule 114B.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
<div class="f60-card">
|
<div class="f60-card">
|
||||||
<div class="f60-card__header">
|
<div class="f60-card__header">
|
||||||
<mat-icon class="f60-card__header-icon">description</mat-icon>
|
<mat-icon class="f60-card__header-icon">description</mat-icon>
|
||||||
<h3>Form 60 Declaration</h3>
|
<h3>Form 97 Declaration</h3>
|
||||||
<span class="f60-card__status">Submitted</span>
|
<span class="f60-card__status">Submitted</span>
|
||||||
<button mat-stroked-button color="primary" (click)="toggleEditMode()" class="f60-card__edit">
|
<button mat-stroked-button color="primary" (click)="toggleEditMode()" class="f60-card__edit">
|
||||||
<mat-icon>edit</mat-icon> Edit
|
<mat-icon>edit</mat-icon> Edit
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
<div class="f60-card">
|
<div class="f60-card">
|
||||||
<div class="f60-card__header">
|
<div class="f60-card__header">
|
||||||
<mat-icon class="f60-card__header-icon">edit_note</mat-icon>
|
<mat-icon class="f60-card__header-icon">edit_note</mat-icon>
|
||||||
<h3>Form 60 Declaration</h3>
|
<h3>Form 97 Declaration</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="f60-card__body">
|
<div class="f60-card__body">
|
||||||
<form [formGroup]="form60Form" (ngSubmit)="submit()">
|
<form [formGroup]="form60Form" (ngSubmit)="submit()">
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
<button type="button" mat-stroked-button (click)="toggleEditMode()">Cancel</button>
|
<button type="button" mat-stroked-button (click)="toggleEditMode()">Cancel</button>
|
||||||
}
|
}
|
||||||
<button type="submit" mat-flat-button color="primary" [disabled]="!form60Form.valid">
|
<button type="submit" mat-flat-button color="primary" [disabled]="!form60Form.valid">
|
||||||
<mat-icon>check</mat-icon> Submit Form 60
|
<mat-icon>check</mat-icon> Submit Form 97
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -224,14 +224,14 @@ export class Form60TabComponent implements OnInit, OnDestroy {
|
|||||||
this.isEditMode = false;
|
this.isEditMode = false;
|
||||||
this.alertService.alert({
|
this.alertService.alert({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: 'Form 60 submitted successfully.'
|
message: 'Form 97 submitted successfully.'
|
||||||
});
|
});
|
||||||
this.loadForm60Data();
|
this.loadForm60Data();
|
||||||
},
|
},
|
||||||
error: (err: any) => {
|
error: (err: any) => {
|
||||||
this.alertService.alert({
|
this.alertService.alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: err?.error?.developerMessage || err?.error?.defaultUserMessage || 'Failed to submit Form 60.'
|
message: err?.error?.developerMessage || err?.error?.defaultUserMessage || 'Failed to submit Form 97.'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
[class.pd-verify-badge--verified]="!clientViewData.isMinor"
|
[class.pd-verify-badge--verified]="!clientViewData.isMinor"
|
||||||
[class.pd-verify-badge--pending]="clientViewData.isMinor"
|
[class.pd-verify-badge--pending]="clientViewData.isMinor"
|
||||||
>
|
>
|
||||||
{{ clientViewData.isMinor ? 'Yes (Age < 10)' : 'No' }}
|
{{ clientViewData.isMinor ? 'Yes (Age < 18)' : 'No' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -98,12 +98,10 @@
|
|||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- Account no Column -->
|
<!-- Client ID Column -->
|
||||||
<ng-container matColumnDef="accountNumber">
|
<ng-container matColumnDef="accountNumber">
|
||||||
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'labels.inputs.Account No' | translate }}</th>
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Client ID</th>
|
||||||
<td mat-cell *matCellDef="let row" class="cell-mono">
|
<td mat-cell *matCellDef="let row" class="cell-mono">{{ row.id }}</td>
|
||||||
<mifosx-account-number display="left" accountNo="{{ row.accountNumber }}"></mifosx-account-number>
|
|
||||||
</td>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- CIF Number Column -->
|
<!-- CIF Number Column -->
|
||||||
|
|||||||
@@ -137,7 +137,16 @@ export class ClientsComponent implements OnInit {
|
|||||||
private getClients() {
|
private getClients() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.clientService
|
this.clientService
|
||||||
.searchByText(this.filterText, this.currentPage, this.pageSize, this.sortAttribute, this.sortDirection)
|
.searchByText(
|
||||||
|
this.filterText,
|
||||||
|
this.currentPage,
|
||||||
|
this.pageSize,
|
||||||
|
this.sortAttribute,
|
||||||
|
this.sortDirection,
|
||||||
|
false,
|
||||||
|
'',
|
||||||
|
true
|
||||||
|
)
|
||||||
.subscribe(
|
.subscribe(
|
||||||
(data: any) => {
|
(data: any) => {
|
||||||
this.allRows = data.content || [];
|
this.allRows = data.content || [];
|
||||||
@@ -166,7 +175,7 @@ export class ClientsComponent implements OnInit {
|
|||||||
// Use individual subscriptions instead of forkJoin to avoid EMPTY observable issues
|
// Use individual subscriptions instead of forkJoin to avoid EMPTY observable issues
|
||||||
clients.forEach((client, i) => {
|
clients.forEach((client, i) => {
|
||||||
this.clientService
|
this.clientService
|
||||||
.getClientData(client.id?.toString())
|
.getClientData(client.id?.toString(), true)
|
||||||
.pipe(catchError(() => of(null)))
|
.pipe(catchError(() => of(null)))
|
||||||
.subscribe((data: any) => {
|
.subscribe((data: any) => {
|
||||||
if (data?.legalForm) {
|
if (data?.legalForm) {
|
||||||
@@ -176,7 +185,7 @@ export class ClientsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.clientService
|
this.clientService
|
||||||
.getClientKyc(client.id?.toString())
|
.getClientKyc(client.id?.toString(), true)
|
||||||
.pipe(catchError(() => of(null)))
|
.pipe(catchError(() => of(null)))
|
||||||
.subscribe((kyc: any) => {
|
.subscribe((kyc: any) => {
|
||||||
if (kyc) {
|
if (kyc) {
|
||||||
@@ -188,7 +197,7 @@ export class ClientsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.clientService
|
this.clientService
|
||||||
.getClientAddressData(client.id?.toString())
|
.getClientAddressData(client.id?.toString(), true)
|
||||||
.pipe(catchError(() => of(null)))
|
.pipe(catchError(() => of(null)))
|
||||||
.subscribe((addr: any) => {
|
.subscribe((addr: any) => {
|
||||||
if (addr && Array.isArray(addr) && addr.length > 0) {
|
if (addr && Array.isArray(addr) && addr.length > 0) {
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Injectable, inject } from '@angular/core';
|
import { Injectable, inject } from '@angular/core';
|
||||||
import { HttpClient, HttpParams, HttpBackend, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpParams, HttpBackend, HttpHeaders, HttpContext } from '@angular/common/http';
|
||||||
|
import { SILENT_HTTP_ERROR } from 'app/core/http/silent-error.token';
|
||||||
|
|
||||||
/** rxjs Imports */
|
/** rxjs Imports */
|
||||||
import { Observable, of, throwError } from 'rxjs';
|
import { Observable, of, throwError } from 'rxjs';
|
||||||
@@ -66,8 +67,11 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/template?officeId=${officeId}&staffInSelectedOfficeOnly=true`);
|
return this.http.get(`/clients/template?officeId=${officeId}&staffInSelectedOfficeOnly=true`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientData(clientId: string) {
|
getClientData(clientId: string, silent = false) {
|
||||||
return this.http.get(`/clients/${clientId}`);
|
return this.http.get(
|
||||||
|
`/clients/${clientId}`,
|
||||||
|
silent ? { context: new HttpContext().set(SILENT_HTTP_ERROR, true) } : {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
createClient(client: any) {
|
createClient(client: any) {
|
||||||
@@ -82,6 +86,43 @@ export class ClientsService {
|
|||||||
return this.http.delete(`/clients/${clientId}`);
|
return this.http.delete(`/clients/${clientId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maker-checker for Client edits — stages the change in m_client_pending_edit instead of
|
||||||
|
* applying it immediately; a different user must call approveClientEdit() before it takes
|
||||||
|
* effect. See ClientEditApiResource on the backend.
|
||||||
|
*/
|
||||||
|
submitClientEdit(clientId: string, client: any) {
|
||||||
|
return this.http.post(`/clients/${clientId}/edit`, client);
|
||||||
|
}
|
||||||
|
|
||||||
|
getPendingClientEdit(clientId: string) {
|
||||||
|
return this.http.get(`/clients/${clientId}/edit/pending`);
|
||||||
|
}
|
||||||
|
|
||||||
|
getAllPendingClientEdits(
|
||||||
|
status?: string,
|
||||||
|
clientName?: string,
|
||||||
|
fromDate?: string,
|
||||||
|
toDate?: string,
|
||||||
|
offset = 0,
|
||||||
|
limit = 20
|
||||||
|
): Observable<any> {
|
||||||
|
let params = new HttpParams().set('offset', offset).set('limit', limit);
|
||||||
|
if (status) params = params.set('status', status);
|
||||||
|
if (clientName) params = params.set('clientName', clientName);
|
||||||
|
if (fromDate) params = params.set('fromDate', fromDate);
|
||||||
|
if (toDate) params = params.set('toDate', toDate);
|
||||||
|
return this.http.get(`/clients/edit/pending`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
approveClientEdit(clientId: string) {
|
||||||
|
return this.http.post(`/clients/${clientId}/edit/approve`, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
rejectClientEdit(clientId: string, rejectReason?: string) {
|
||||||
|
return this.http.post(`/clients/${clientId}/edit/reject`, { rejectReason: rejectReason || '' });
|
||||||
|
}
|
||||||
|
|
||||||
getClientDataAndTemplate(clientId: string) {
|
getClientDataAndTemplate(clientId: string) {
|
||||||
const httpParams = new HttpParams().set('template', 'true').set('staffInSelectedOfficeOnly', 'true');
|
const httpParams = new HttpParams().set('template', 'true').set('staffInSelectedOfficeOnly', 'true');
|
||||||
return this.http.get(`/clients/${clientId}`, { params: httpParams });
|
return this.http.get(`/clients/${clientId}`, { params: httpParams });
|
||||||
@@ -116,8 +157,11 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/${clientId}/accounts`);
|
return this.http.get(`/clients/${clientId}/accounts`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientAddressData(clientId: string) {
|
getClientAddressData(clientId: string, silent = false) {
|
||||||
return this.http.get(`/client/${clientId}/addresses`);
|
return this.http.get(
|
||||||
|
`/client/${clientId}/addresses`,
|
||||||
|
silent ? { context: new HttpContext().set(SILENT_HTTP_ERROR, true) } : {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getClientChargesData(clientId: string) {
|
getClientChargesData(clientId: string) {
|
||||||
@@ -661,7 +705,8 @@ export class ClientsService {
|
|||||||
sortAttribute: string = '',
|
sortAttribute: string = '',
|
||||||
sortDirection: string = '',
|
sortDirection: string = '',
|
||||||
activeOnly: boolean = false,
|
activeOnly: boolean = false,
|
||||||
legalFormType: string = ''
|
legalFormType: string = '',
|
||||||
|
silent: boolean = false
|
||||||
) {
|
) {
|
||||||
const innerRequest: any = { text };
|
const innerRequest: any = { text };
|
||||||
if (activeOnly) {
|
if (activeOnly) {
|
||||||
@@ -690,7 +735,11 @@ export class ClientsService {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return this.http.post(`/v2/clients/search`, request);
|
return this.http.post(
|
||||||
|
`/v2/clients/search`,
|
||||||
|
request,
|
||||||
|
silent ? { context: new HttpContext().set(SILENT_HTTP_ERROR, true) } : {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -727,8 +776,11 @@ export class ClientsService {
|
|||||||
* Gets KYC details for a client.
|
* Gets KYC details for a client.
|
||||||
* @param clientId Client ID
|
* @param clientId Client ID
|
||||||
*/
|
*/
|
||||||
getClientKyc(clientId: string): Observable<any> {
|
getClientKyc(clientId: string, silent = false): Observable<any> {
|
||||||
return this.http.get(`/clients/${clientId}/kyc`);
|
return this.http.get(
|
||||||
|
`/clients/${clientId}/kyc`,
|
||||||
|
silent ? { context: new HttpContext().set(SILENT_HTTP_ERROR, true) } : {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -739,6 +791,10 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/${clientId}/kyc/template`);
|
return this.http.get(`/clients/${clientId}/kyc/template`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getClientRiskRules(): Observable<any[]> {
|
||||||
|
return this.http.get<any[]>('/kyc/risk-rules');
|
||||||
|
}
|
||||||
|
|
||||||
/** Fetch code values by code ID */
|
/** Fetch code values by code ID */
|
||||||
getCodeValuesById(codeId: number): Observable<any[]> {
|
getCodeValuesById(codeId: number): Observable<any[]> {
|
||||||
return this.http.get<any[]>(`/codes/${codeId}/codevalues`).pipe(catchError(() => of([])));
|
return this.http.get<any[]>(`/codes/${codeId}/codevalues`).pipe(catchError(() => of([])));
|
||||||
@@ -894,4 +950,12 @@ export class ClientsService {
|
|||||||
submitClientForm60(clientId: string, data: any): Observable<any> {
|
submitClientForm60(clientId: string, data: any): Observable<any> {
|
||||||
return this.http.post(`/clients/${clientId}/form60`, data);
|
return this.http.post(`/clients/${clientId}/form60`, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getWelcomeKits(clientId: string | number): Observable<any> {
|
||||||
|
return this.http.get(`/clients/${clientId}/welcomekit`);
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatchWelcomeKit(clientId: string | number, data: any): Observable<any> {
|
||||||
|
return this.http.post(`/clients/${clientId}/welcomekit`, data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,10 +71,12 @@
|
|||||||
<mifosx-client-kyc-step
|
<mifosx-client-kyc-step
|
||||||
#clientKyc
|
#clientKyc
|
||||||
[isNonIndividual]="legalFormType === 2"
|
[isNonIndividual]="legalFormType === 2"
|
||||||
|
[isMinor]="clientGeneralStep?.isMinor || false"
|
||||||
[clientId]="createdClientId"
|
[clientId]="createdClientId"
|
||||||
[constitutionMeta]="clientGeneralStep?.selectedConstitution"
|
[constitutionMeta]="clientGeneralStep?.selectedConstitution"
|
||||||
[entityName]="clientGeneralStep?.createClientForm?.get('fullname')?.value || ''"
|
[entityName]="clientGeneralStep?.createClientForm?.get('fullname')?.value || ''"
|
||||||
[readOnly]="isTabReadOnly(1)"
|
[readOnly]="isTabReadOnly(1)"
|
||||||
|
[calculatedRisk]="clientGeneralStep?.calculatedRisk"
|
||||||
></mifosx-client-kyc-step>
|
></mifosx-client-kyc-step>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -146,6 +148,8 @@
|
|||||||
}
|
}
|
||||||
<mifosx-client-india-address-step
|
<mifosx-client-india-address-step
|
||||||
#clientIndiaAddress
|
#clientIndiaAddress
|
||||||
|
[isMinor]="clientGeneralStep?.isMinor || false"
|
||||||
|
[isNonIndividual]="legalFormType === 2"
|
||||||
[readOnly]="isTabReadOnly(addressTabIdx)"
|
[readOnly]="isTabReadOnly(addressTabIdx)"
|
||||||
></mifosx-client-india-address-step>
|
></mifosx-client-india-address-step>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -111,6 +111,12 @@ export class CreateClientComponent {
|
|||||||
this.route.data.subscribe((data: { clientTemplate: any; clientAddressFieldConfig: any }) => {
|
this.route.data.subscribe((data: { clientTemplate: any; clientAddressFieldConfig: any }) => {
|
||||||
this.clientTemplate = data.clientTemplate;
|
this.clientTemplate = data.clientTemplate;
|
||||||
this.clientAddressFieldConfig = data.clientAddressFieldConfig;
|
this.clientAddressFieldConfig = data.clientAddressFieldConfig;
|
||||||
|
// This app's RouteReusableStrategy keeps this SAME component instance alive across
|
||||||
|
// repeat visits to /clients/create, so ngOnInit/constructor won't re-run for a second
|
||||||
|
// "create new client" session — reset transient state here instead, since `route.data`
|
||||||
|
// re-emits on every navigation regardless of whether the component was reused. Must run
|
||||||
|
// BEFORE setDatatables(), which reads legalFormType to filter clientTemplate.datatables.
|
||||||
|
this.resetForNewClient();
|
||||||
this.setDatatables();
|
this.setDatatables();
|
||||||
});
|
});
|
||||||
// Read pre-fill data set by "Create as Client" from a manual family member
|
// Read pre-fill data set by "Create as Client" from a manual family member
|
||||||
@@ -121,6 +127,22 @@ export class CreateClientComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Resets session state that could otherwise leak between clients when the route is reused. */
|
||||||
|
private resetForNewClient(): void {
|
||||||
|
this.legalFormType = 1;
|
||||||
|
this.selectedTabIndex = 0;
|
||||||
|
this.createdClientId = '';
|
||||||
|
this.savingClient = false;
|
||||||
|
this.saveProgress = 0;
|
||||||
|
this.tabEditMode = {};
|
||||||
|
this.highestTabReached = 0;
|
||||||
|
this.validationError = '';
|
||||||
|
this.prefillData = null;
|
||||||
|
this.clientGeneralStep?.resetForNewClient();
|
||||||
|
this.clientKycStep?.resetForNewClient();
|
||||||
|
this.clientIndiaAddressStep?.resetForNewClient();
|
||||||
|
}
|
||||||
|
|
||||||
/** Check if a tab is in read-only mode (completed tab navigated back to) */
|
/** Check if a tab is in read-only mode (completed tab navigated back to) */
|
||||||
isTabReadOnly(tabIndex: number): boolean {
|
isTabReadOnly(tabIndex: number): boolean {
|
||||||
// Only tabs that have been passed (below highest reached) AND not explicitly set to edit mode
|
// Only tabs that have been passed (below highest reached) AND not explicitly set to edit mode
|
||||||
@@ -218,8 +240,8 @@ export class CreateClientComponent {
|
|||||||
return this.isAddressStepValid();
|
return this.isAddressStepValid();
|
||||||
}
|
}
|
||||||
if (idx === 3) {
|
if (idx === 3) {
|
||||||
// Family tab — relations are optional, always allow.
|
// Family tab — Mother is required, and either Father or a Caretaker.
|
||||||
return true;
|
return !this.clientFamilyMembersStep || this.clientFamilyMembersStep.familyRelationshipRulesMet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -253,6 +275,11 @@ export class CreateClientComponent {
|
|||||||
return `Please fill/correct: ${labels.join(', ')}.`;
|
return `Please fill/correct: ${labels.join(', ')}.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (idx === 3 && this.legalFormType === 1 && this.clientFamilyMembersStep) {
|
||||||
|
const step = this.clientFamilyMembersStep;
|
||||||
|
if (!step.hasMother) return 'Mother is required as a family member.';
|
||||||
|
if (!step.hasFather && !step.hasCaretaker) return 'Either Father or a Caretaker is required as a family member.';
|
||||||
|
}
|
||||||
return 'Please fill all mandatory fields on this tab to continue.';
|
return 'Please fill all mandatory fields on this tab to continue.';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,6 +358,18 @@ export class CreateClientComponent {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PWD gate — disability type + certificate are mandatory when PWD is checked
|
||||||
|
// (Senior Citizen proof upload is optional, not gated here)
|
||||||
|
if (!this.clientGeneralStep?.seniorPwdDocsComplete) {
|
||||||
|
this.clientGeneralStep?.markSeniorPwdDocsTouched();
|
||||||
|
this.snackBar.open(
|
||||||
|
'Select the disability type and upload the Disability Certificate before continuing.',
|
||||||
|
'Close',
|
||||||
|
{ duration: 5000 }
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Sanctions verification gate — Verify Client must be clicked before save
|
// Sanctions verification gate — Verify Client must be clicked before save
|
||||||
if (!this.clientGeneralStep?.sanctionsVerified) {
|
if (!this.clientGeneralStep?.sanctionsVerified) {
|
||||||
this.dialog
|
this.dialog
|
||||||
@@ -469,6 +508,29 @@ export class CreateClientComponent {
|
|||||||
clearInterval(progressInterval);
|
clearInterval(progressInterval);
|
||||||
this.saveProgress = 100;
|
this.saveProgress = 100;
|
||||||
this.createdClientId = response.resourceId;
|
this.createdClientId = response.resourceId;
|
||||||
|
|
||||||
|
// Senior Citizen / PWD supporting documents — uploaded after creation, same pattern as
|
||||||
|
// the KYC step's photo/signature uploads (the generic /clients/{id}/documents endpoint
|
||||||
|
// needs a real clientId, which only exists once createClient() has returned).
|
||||||
|
if (this.clientGeneralStep?.seniorCitizenProofFile) {
|
||||||
|
const seniorCitizenProofForm = new FormData();
|
||||||
|
seniorCitizenProofForm.append('file', this.clientGeneralStep.seniorCitizenProofFile);
|
||||||
|
seniorCitizenProofForm.append('name', 'seniorCitizenProof');
|
||||||
|
seniorCitizenProofForm.append('description', 'Senior Citizen Proof (Age/ID Proof)');
|
||||||
|
this.clientsService
|
||||||
|
.uploadClientDocument(this.createdClientId, seniorCitizenProofForm)
|
||||||
|
.subscribe({ error: () => {} });
|
||||||
|
}
|
||||||
|
if (this.clientGeneralStep?.pwdCertificateFile) {
|
||||||
|
const pwdCertificateForm = new FormData();
|
||||||
|
pwdCertificateForm.append('file', this.clientGeneralStep.pwdCertificateFile);
|
||||||
|
pwdCertificateForm.append('name', 'pwdCertificate');
|
||||||
|
pwdCertificateForm.append('description', 'Disability Certificate');
|
||||||
|
this.clientsService
|
||||||
|
.uploadClientDocument(this.createdClientId, pwdCertificateForm)
|
||||||
|
.subscribe({ error: () => {} });
|
||||||
|
}
|
||||||
|
|
||||||
// Brief delay to show 100% before transitioning
|
// Brief delay to show 100% before transitioning
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.savingClient = false;
|
this.savingClient = false;
|
||||||
@@ -514,6 +576,21 @@ export class CreateClientComponent {
|
|||||||
this.selectedTabIndex = 3;
|
this.selectedTabIndex = 3;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Validate: Mother required, and either Father or a Caretaker (Individual clients)
|
||||||
|
if (
|
||||||
|
this.legalFormType === 1 &&
|
||||||
|
this.clientFamilyMembersStep &&
|
||||||
|
!this.clientFamilyMembersStep.familyRelationshipRulesMet
|
||||||
|
) {
|
||||||
|
const step = this.clientFamilyMembersStep;
|
||||||
|
if (!step.hasMother) {
|
||||||
|
this.validationError = 'Mother is required as a family member.';
|
||||||
|
} else {
|
||||||
|
this.validationError = 'Either Father or a Caretaker is required as a family member.';
|
||||||
|
}
|
||||||
|
this.selectedTabIndex = 3;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.validationError = '';
|
this.validationError = '';
|
||||||
|
|
||||||
if (this.createdClientId) {
|
if (this.createdClientId) {
|
||||||
|
|||||||
@@ -25,9 +25,22 @@
|
|||||||
{{ 'labels.inputs.GENERAL' | translate }}
|
{{ 'labels.inputs.GENERAL' | translate }}
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<div class="tab-content" [class.tab-content--readonly]="isTabReadOnly(0)">
|
<div class="tab-content" [class.tab-content--readonly]="isTabReadOnly(0)">
|
||||||
|
@if (hasPendingGeneralEdit) {
|
||||||
|
<div class="pending-edit-banner">
|
||||||
|
<mat-icon>hourglass_top</mat-icon>
|
||||||
|
<span
|
||||||
|
>An edit is awaiting approval from another user. You can't submit another edit until it's resolved.</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div class="tab-mode-bar">
|
<div class="tab-mode-bar">
|
||||||
@if (isTabReadOnly(0)) {
|
@if (isTabReadOnly(0)) {
|
||||||
<button mat-flat-button class="tab-mode-btn tab-mode-btn--edit" (click)="enableTabEdit(0)">
|
<button
|
||||||
|
mat-flat-button
|
||||||
|
class="tab-mode-btn tab-mode-btn--edit"
|
||||||
|
[disabled]="hasPendingGeneralEdit"
|
||||||
|
(click)="enableTabEdit(0)"
|
||||||
|
>
|
||||||
<mat-icon>edit</mat-icon> Edit
|
<mat-icon>edit</mat-icon> Edit
|
||||||
</button>
|
</button>
|
||||||
} @else {
|
} @else {
|
||||||
@@ -149,8 +162,10 @@
|
|||||||
<mifosx-client-kyc-step
|
<mifosx-client-kyc-step
|
||||||
#clientKyc
|
#clientKyc
|
||||||
[isNonIndividual]="legalFormType === 2"
|
[isNonIndividual]="legalFormType === 2"
|
||||||
|
[isMinor]="clientGeneralStep?.isMinor || false"
|
||||||
[clientId]="clientId"
|
[clientId]="clientId"
|
||||||
[readOnly]="isTabReadOnly(1)"
|
[readOnly]="isTabReadOnly(1)"
|
||||||
|
[calculatedRisk]="clientGeneralStep?.calculatedRisk"
|
||||||
></mifosx-client-kyc-step>
|
></mifosx-client-kyc-step>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -206,6 +221,8 @@
|
|||||||
<mifosx-client-india-address-step
|
<mifosx-client-india-address-step
|
||||||
#clientIndiaAddress
|
#clientIndiaAddress
|
||||||
[clientId]="clientId"
|
[clientId]="clientId"
|
||||||
|
[isMinor]="clientGeneralStep?.isMinor || false"
|
||||||
|
[isNonIndividual]="legalFormType === 2"
|
||||||
[readOnly]="isTabReadOnly(addressTabIdx)"
|
[readOnly]="isTabReadOnly(addressTabIdx)"
|
||||||
></mifosx-client-india-address-step>
|
></mifosx-client-india-address-step>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -217,6 +217,26 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ─── Pending Edit Approval Banner ─── */
|
||||||
|
.pending-edit-banner {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
margin: 0 0 16px;
|
||||||
|
background: #eff6ff;
|
||||||
|
border: 1px solid #93c5fd;
|
||||||
|
border-radius: 8px;
|
||||||
|
color: #1e40af;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
color: #2563eb;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ─── Re-KYC Alert Banner ─── */
|
/* ─── Re-KYC Alert Banner ─── */
|
||||||
.rekyc-alert {
|
.rekyc-alert {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|||||||
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { ORIGINAL_VALUES_PAYLOAD_KEY, buildOriginalValuesSnapshot } from '../shared/client-edit-diff.util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edit Client Component — uses the same wizard/stepper layout as Create Client.
|
* Edit Client Component — uses the same wizard/stepper layout as Create Client.
|
||||||
@@ -116,6 +117,9 @@ export class EditClientComponent {
|
|||||||
clientDataAndTemplate: any;
|
clientDataAndTemplate: any;
|
||||||
/** Client ID */
|
/** Client ID */
|
||||||
clientId: string;
|
clientId: string;
|
||||||
|
/** True while a General-tab edit is staged awaiting checker approval — blocks submitting
|
||||||
|
* another one (the backend enforces this too; this just avoids a round-trip error toast). */
|
||||||
|
hasPendingGeneralEdit = false;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.route.data.subscribe((data: { clientDataAndTemplate: any }) => {
|
this.route.data.subscribe((data: { clientDataAndTemplate: any }) => {
|
||||||
@@ -124,6 +128,15 @@ export class EditClientComponent {
|
|||||||
if (this.clientDataAndTemplate.legalForm) {
|
if (this.clientDataAndTemplate.legalForm) {
|
||||||
this.legalFormType = this.clientDataAndTemplate.legalForm.id;
|
this.legalFormType = this.clientDataAndTemplate.legalForm.id;
|
||||||
}
|
}
|
||||||
|
this.loadPendingGeneralEdit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadPendingGeneralEdit(): void {
|
||||||
|
if (!this.clientId) return;
|
||||||
|
this.clientsService.getPendingClientEdit(this.clientId).subscribe({
|
||||||
|
next: (edit: any) => (this.hasPendingGeneralEdit = !!edit && edit.status === 'PENDING'),
|
||||||
|
error: () => (this.hasPendingGeneralEdit = false)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,14 +300,20 @@ export class EditClientComponent {
|
|||||||
if (this.legalFormType === 2) {
|
if (this.legalFormType === 2) {
|
||||||
if (idx === 2) return true; // Scheme & Sector — opt-in
|
if (idx === 2) return true; // Scheme & Sector — opt-in
|
||||||
if (idx === 3) return this.isAddressStepValid();
|
if (idx === 3) return this.isAddressStepValid();
|
||||||
if (idx === 4) return true; // Family — optional
|
if (idx === 4) return true; // Family — not applicable to non-individual entities
|
||||||
} else {
|
} else {
|
||||||
if (idx === 2) return this.isAddressStepValid();
|
if (idx === 2) return this.isAddressStepValid();
|
||||||
if (idx === 3) return true; // Family — optional
|
if (idx === 3) return this.isFamilyStepValid(); // Mother required, plus Father or a Caretaker
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Mother is required, and either Father or a Caretaker, for individual clients. */
|
||||||
|
private isFamilyStepValid(): boolean {
|
||||||
|
const step = this.clientFamilyMembersStep;
|
||||||
|
return !step || step.familyRelationshipRulesMet;
|
||||||
|
}
|
||||||
|
|
||||||
private isAddressStepValid(): boolean {
|
private isAddressStepValid(): boolean {
|
||||||
const step = this.clientIndiaAddressStep;
|
const step = this.clientIndiaAddressStep;
|
||||||
if (!step) return true;
|
if (!step) return true;
|
||||||
@@ -318,6 +337,12 @@ export class EditClientComponent {
|
|||||||
return `Please fill/correct: ${labels.join(', ')}.`;
|
return `Please fill/correct: ${labels.join(', ')}.`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const familyTabIndex = this.legalFormType === 2 ? 4 : 3;
|
||||||
|
if (this.selectedTabIndex === familyTabIndex && this.legalFormType !== 2 && this.clientFamilyMembersStep) {
|
||||||
|
const step = this.clientFamilyMembersStep;
|
||||||
|
if (!step.hasMother) return 'Mother is required as a family member.';
|
||||||
|
if (!step.hasFather && !step.hasCaretaker) return 'Either Father or a Caretaker is required as a family member.';
|
||||||
|
}
|
||||||
return 'Please fill all mandatory fields on this tab to continue.';
|
return 'Please fill all mandatory fields on this tab to continue.';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,46 +447,51 @@ export class EditClientComponent {
|
|||||||
clientData.emailNewOtpId = this.newEmailOtpId;
|
clientData.emailNewOtpId = this.newEmailOtpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Point-in-time "before" snapshot for the checker's diff view — captured now, from the
|
||||||
|
// client record loaded when this edit page opened, rather than relying on comparing against
|
||||||
|
// the LIVE client later (which would show nothing changed once a checker approves the edit,
|
||||||
|
// since by then current == proposed).
|
||||||
|
clientData[ORIGINAL_VALUES_PAYLOAD_KEY] = buildOriginalValuesSnapshot(originalData);
|
||||||
|
|
||||||
this.savingClient = true;
|
this.savingClient = true;
|
||||||
this.clientsService.updateClient(this.clientId, clientData).subscribe({
|
// Maker-checker: stage the edit instead of applying it immediately. The customer-facing
|
||||||
|
// side effects that a direct update would have had immediately — SMS/Email contact-change
|
||||||
|
// notification, re-KYC flagging, PAN re-verification reset — are all deferred until a
|
||||||
|
// different user actually approves the edit (approval replays this exact payload through
|
||||||
|
// the same updateClient() the direct PUT used to call, so the backend-driven notification
|
||||||
|
// still fires correctly, just at approval time instead of now).
|
||||||
|
this.clientsService.submitClientEdit(this.clientId, clientData).subscribe({
|
||||||
next: () => {
|
next: () => {
|
||||||
this.savingClient = false;
|
this.savingClient = false;
|
||||||
this.tabEditMode[tabIndex] = false;
|
this.tabEditMode[tabIndex] = false;
|
||||||
|
this.hasPendingGeneralEdit = true;
|
||||||
|
|
||||||
// Log mobile/email changes as client notes for risk audit
|
// Senior Citizen / PWD supporting documents — separate upload endpoints, not part of
|
||||||
this.logFieldChangeNotes(changedFields);
|
// the staged JSON edit, so these still apply immediately as before.
|
||||||
|
if (this.clientGeneralStep?.seniorCitizenProofFile) {
|
||||||
// If name or DOB changed, flag re-KYC requirement and reset PAN verification
|
const seniorCitizenProofForm = new FormData();
|
||||||
if (changedFields.nameChanged || changedFields.dobChanged) {
|
seniorCitizenProofForm.append('file', this.clientGeneralStep.seniorCitizenProofFile);
|
||||||
this.dobChanged = true;
|
seniorCitizenProofForm.append('name', 'seniorCitizenProof');
|
||||||
this.tabEditMode[1] = true; // auto-enable KYC tab for re-verification
|
seniorCitizenProofForm.append('description', 'Senior Citizen Proof (Age/ID Proof)');
|
||||||
this.flagReKycRequired(changedFields);
|
this.clientsService
|
||||||
|
.uploadClientDocument(this.clientId, seniorCitizenProofForm)
|
||||||
|
.subscribe({ error: () => {} });
|
||||||
|
}
|
||||||
|
if (this.clientGeneralStep?.pwdCertificateFile) {
|
||||||
|
const pwdCertificateForm = new FormData();
|
||||||
|
pwdCertificateForm.append('file', this.clientGeneralStep.pwdCertificateFile);
|
||||||
|
pwdCertificateForm.append('name', 'pwdCertificate');
|
||||||
|
pwdCertificateForm.append('description', 'Disability Certificate');
|
||||||
|
this.clientsService.uploadClientDocument(this.clientId, pwdCertificateForm).subscribe({ error: () => {} });
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update original data snapshot so subsequent edits compare against latest
|
this.snackBar.open(
|
||||||
if (changedFields.mobileChanged) {
|
'Edit submitted for approval — a different user must review it before it takes effect.',
|
||||||
originalData.mobileNo = changedFields.newMobile;
|
'Close',
|
||||||
}
|
{
|
||||||
if (changedFields.emailChanged) {
|
duration: 5000
|
||||||
originalData.emailAddress = changedFields.newEmail;
|
|
||||||
}
|
|
||||||
if (changedFields.dobChanged) {
|
|
||||||
originalData.dateOfBirth = changedFields.newDob;
|
|
||||||
}
|
|
||||||
if (changedFields.nameChanged) {
|
|
||||||
const form = this.clientGeneralForm;
|
|
||||||
originalData.firstname = form?.get('firstname')?.value ?? originalData.firstname;
|
|
||||||
originalData.middlename = form?.get('middlename')?.value ?? originalData.middlename;
|
|
||||||
originalData.lastname = form?.get('lastname')?.value ?? originalData.lastname;
|
|
||||||
originalData.fullname = form?.get('fullname')?.value ?? originalData.fullname;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notification is backend-driven (SMS + Email) — just reassure staff it happened.
|
|
||||||
if (changedFields.mobileChanged || changedFields.emailChanged) {
|
|
||||||
this.snackBar.open('Customer notified via SMS/Email of the contact change.', 'Close', {
|
|
||||||
duration: 4000
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
);
|
||||||
this.resetContactVerificationState();
|
this.resetContactVerificationState();
|
||||||
|
|
||||||
this.selectedTabIndex = this.selectedTabIndex + 1;
|
this.selectedTabIndex = this.selectedTabIndex + 1;
|
||||||
|
|||||||
@@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared between the maker side (edit-client, which captures a point-in-time snapshot of the
|
||||||
|
* client's current values right before staging an edit) and the checker side (pending-client-edits,
|
||||||
|
* which diffs the staged payload against that snapshot). Keeping both in one place means the two
|
||||||
|
* sides can never drift out of sync on which fields are captured/compared/labelled.
|
||||||
|
*
|
||||||
|
* Extracts a payload key's CURRENT value from a client record (as returned by GET /clients/{id}) —
|
||||||
|
* CodeValue fields come back as nested {id, name} objects, so most extractors pull the nested .id
|
||||||
|
* to compare against the payload's raw id.
|
||||||
|
*/
|
||||||
|
export const PENDING_EDIT_FIELD_EXTRACTORS: Record<string, (c: any) => any> = {
|
||||||
|
officeId: (c) => c.officeId,
|
||||||
|
legalFormId: (c) => c.legalForm?.id,
|
||||||
|
nationalityId: (c) => c.nationality,
|
||||||
|
isStaff: (c) => c.isStaff,
|
||||||
|
active: (c) => c.active,
|
||||||
|
accountNo: (c) => c.accountNo,
|
||||||
|
salutationId: (c) => c.salutation?.id,
|
||||||
|
firstname: (c) => c.firstname,
|
||||||
|
middlename: (c) => c.middlename,
|
||||||
|
lastname: (c) => c.lastname,
|
||||||
|
fullname: (c) => c.fullname,
|
||||||
|
genderId: (c) => c.gender?.id,
|
||||||
|
maritalStatusId: (c) => c.maritalStatus?.id,
|
||||||
|
educationLevelId: (c) => c.educationLevel?.id,
|
||||||
|
degreeQualificationId: (c) => c.degreeQualification?.id,
|
||||||
|
religionId: (c) => c.religion?.id,
|
||||||
|
socialCategoryId: (c) => c.socialCategory?.id,
|
||||||
|
mobileNo: (c) => c.mobileNo,
|
||||||
|
alternateMobileNo: (c) => c.alternateMobileNo,
|
||||||
|
emailAddress: (c) => c.emailAddress,
|
||||||
|
dateOfBirth: (c) => c.dateOfBirth,
|
||||||
|
occupationCategoryId: (c) => c.occupationCategory?.id,
|
||||||
|
occupationId: (c) => c.occupation?.id,
|
||||||
|
monthlyIncome: (c) => c.monthlyIncome,
|
||||||
|
annualIncome: (c) => c.annualIncome,
|
||||||
|
annualTurnover: (c) => c.annualTurnover,
|
||||||
|
monthlyTurnover: (c) => c.monthlyTurnover,
|
||||||
|
isPwd: (c) => c.isPwd,
|
||||||
|
pwdCategoryId: (c) => c.pwdCategory?.id,
|
||||||
|
isSeniorCitizen: (c) => c.isSeniorCitizen,
|
||||||
|
agricultureIncome: (c) => c.agricultureIncome,
|
||||||
|
nonAgricultureIncome: (c) => c.nonAgricultureIncome,
|
||||||
|
savingsProductId: (c) => c.savingsProductId,
|
||||||
|
staffId: (c) => c.staffId,
|
||||||
|
guardianClientId: (c) => c.guardianClientId,
|
||||||
|
guardianRelation: (c) => c.guardianRelation
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Payload keys that are computed, internal, or otherwise never meaningfully "changed" from a
|
||||||
|
* checker's point of view — always sent by the form (age breakdown, OTP tracking ids, the
|
||||||
|
* business-date default on submittedOnDate) but with no comparable "current" value. */
|
||||||
|
export const NON_COMPARABLE_KEYS = new Set([
|
||||||
|
'dateFormat',
|
||||||
|
'locale',
|
||||||
|
'ageYears',
|
||||||
|
'ageMonths',
|
||||||
|
'ageDays',
|
||||||
|
'isMinor',
|
||||||
|
'addSavings',
|
||||||
|
'submittedOnDate',
|
||||||
|
'activationDate',
|
||||||
|
// Flattened onto top-level guardianClientId/guardianRelation right after this in the payload —
|
||||||
|
// that flattened pair already has real comparators above, so the nested group is redundant.
|
||||||
|
'guardianDetails',
|
||||||
|
// Mobile/email DIP verification + name-match + sanctions-screening results — carried along on
|
||||||
|
// every save to re-affirm the client's EXISTING verification state, not something the maker
|
||||||
|
// edited on this pass. dipTimestamp especially would almost never string-match exactly even
|
||||||
|
// when functionally unchanged, so these were never real "proposed changes" to review.
|
||||||
|
'dipVerified',
|
||||||
|
'dipLookupLogId',
|
||||||
|
'dipTimestamp',
|
||||||
|
'alternateDipVerified',
|
||||||
|
'alternateDipLookupLogId',
|
||||||
|
'alternateDipTimestamp',
|
||||||
|
'nameVerified',
|
||||||
|
'screeningLogId',
|
||||||
|
'mobileNewOtpId',
|
||||||
|
'mobileOldOtpId',
|
||||||
|
'emailNewOtpId',
|
||||||
|
'emailOldOtpId'
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const PENDING_EDIT_FIELD_LABELS: Record<string, string> = {
|
||||||
|
officeId: 'Office',
|
||||||
|
legalFormId: 'Legal Form',
|
||||||
|
nationalityId: 'Nationality',
|
||||||
|
isStaff: 'Is Staff',
|
||||||
|
active: 'Active',
|
||||||
|
accountNo: 'Account Number',
|
||||||
|
salutationId: 'Salutation',
|
||||||
|
firstname: 'First Name',
|
||||||
|
middlename: 'Middle Name',
|
||||||
|
lastname: 'Last Name',
|
||||||
|
fullname: 'Full Name',
|
||||||
|
genderId: 'Gender',
|
||||||
|
maritalStatusId: 'Marital Status',
|
||||||
|
educationLevelId: 'Education Level',
|
||||||
|
degreeQualificationId: 'Degree / Qualification',
|
||||||
|
religionId: 'Religion',
|
||||||
|
socialCategoryId: 'Social Category',
|
||||||
|
mobileNo: 'Mobile Number',
|
||||||
|
alternateMobileNo: 'Alternate Mobile Number',
|
||||||
|
emailAddress: 'Email Address',
|
||||||
|
dateOfBirth: 'Date of Birth',
|
||||||
|
occupationCategoryId: 'Occupation Category',
|
||||||
|
occupationId: 'Occupation',
|
||||||
|
monthlyIncome: 'Monthly Income',
|
||||||
|
annualIncome: 'Annual Income',
|
||||||
|
annualTurnover: 'Yearly Turnover',
|
||||||
|
monthlyTurnover: 'Monthly Turnover',
|
||||||
|
isPwd: 'Person with Disability',
|
||||||
|
pwdCategoryId: 'Disability Type',
|
||||||
|
isSeniorCitizen: 'Senior Citizen',
|
||||||
|
agricultureIncome: 'Agriculture Income',
|
||||||
|
nonAgricultureIncome: 'Non-Agriculture Income',
|
||||||
|
submittedOnDate: 'Submitted On',
|
||||||
|
savingsProductId: 'Linked Savings Product',
|
||||||
|
staffId: 'Staff'
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Key under which the maker's point-in-time "before" snapshot rides along in the submit payload —
|
||||||
|
* stripped out by the backend before replaying the rest through updateClient(), and stored
|
||||||
|
* separately as original_json for the checker's diff. Never a real Client field name, so it can't
|
||||||
|
* collide with anything ClientDataValidator actually expects. */
|
||||||
|
export const ORIGINAL_VALUES_PAYLOAD_KEY = '_originalValues';
|
||||||
|
|
||||||
|
/** Builds the maker-side "before" snapshot from the client record loaded when the edit page
|
||||||
|
* opened — flat key names matching the payload's own, so the checker side can diff two plain
|
||||||
|
* objects directly without needing to know Client's nested response shape at all. */
|
||||||
|
export function buildOriginalValuesSnapshot(clientData: any): Record<string, any> {
|
||||||
|
const snapshot: Record<string, any> = {};
|
||||||
|
if (!clientData) return snapshot;
|
||||||
|
for (const key of Object.keys(PENDING_EDIT_FIELD_EXTRACTORS)) {
|
||||||
|
const value = PENDING_EDIT_FIELD_EXTRACTORS[key](clientData);
|
||||||
|
if (value !== undefined) {
|
||||||
|
snapshot[key] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return snapshot;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<h1 mat-dialog-title>{{ data.title || data.fileName || 'Document Preview' }}</h1>
|
||||||
|
|
||||||
|
<div mat-dialog-content class="doc-preview-content">
|
||||||
|
@if (isImage) {
|
||||||
|
<img [src]="previewUrl" [alt]="data.fileName || 'Document'" class="doc-preview-image" />
|
||||||
|
} @else if (isPdf) {
|
||||||
|
<iframe [src]="safeUrl" class="doc-preview-pdf" title="Document preview"></iframe>
|
||||||
|
} @else {
|
||||||
|
<p>Preview isn't available for this file type — use Download to view it.</p>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-raised-button (click)="download()">Download</button>
|
||||||
|
<button mat-raised-button mat-dialog-close color="primary">Close</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.doc-preview-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
max-width: 80vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-preview-image {
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 70vh;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-preview-pdf {
|
||||||
|
width: 70vw;
|
||||||
|
height: 70vh;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnDestroy, inject } from '@angular/core';
|
||||||
|
import {
|
||||||
|
MatDialogRef,
|
||||||
|
MAT_DIALOG_DATA,
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose
|
||||||
|
} from '@angular/material/dialog';
|
||||||
|
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
|
||||||
|
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
export interface DocumentPreviewDialogData {
|
||||||
|
blob: Blob;
|
||||||
|
title?: string;
|
||||||
|
fileName?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generic in-app document preview dialog — shows an image inline or a PDF in an embedded
|
||||||
|
* viewer, with a Download fallback for anything else. Used in place of window.open() for
|
||||||
|
* saved KYC/address/senior-citizen/PWD documents: opening a new browser tab is subject to
|
||||||
|
* popup blockers (fires only after the async download resolves) and, for images, Chrome/Edge
|
||||||
|
* frequently fail to paint a huge base64 data: URL until the tab is manually refreshed.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-document-preview-dialog',
|
||||||
|
templateUrl: './document-preview-dialog.component.html',
|
||||||
|
styleUrls: ['./document-preview-dialog.component.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatDialogTitle,
|
||||||
|
CdkScrollable,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class DocumentPreviewDialogComponent implements OnDestroy {
|
||||||
|
dialogRef = inject<MatDialogRef<DocumentPreviewDialogComponent>>(MatDialogRef);
|
||||||
|
private sanitizer = inject(DomSanitizer);
|
||||||
|
data = inject<DocumentPreviewDialogData>(MAT_DIALOG_DATA);
|
||||||
|
|
||||||
|
private readonly objectUrl: string;
|
||||||
|
readonly safeUrl: SafeResourceUrl;
|
||||||
|
readonly isImage: boolean;
|
||||||
|
readonly isPdf: boolean;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.objectUrl = URL.createObjectURL(this.data.blob);
|
||||||
|
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.objectUrl);
|
||||||
|
const type = this.data.blob.type || '';
|
||||||
|
this.isImage = type.startsWith('image/');
|
||||||
|
this.isPdf = type === 'application/pdf';
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
URL.revokeObjectURL(this.objectUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
get previewUrl(): string {
|
||||||
|
return this.objectUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
download(): void {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = this.objectUrl;
|
||||||
|
a.download = this.data.fileName || 'document';
|
||||||
|
a.click();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,20 @@ export const PROOF_META: Record<string, Partial<ProofType>> = {
|
|||||||
documentKeyPlaceholder: 'NPR reference number',
|
documentKeyPlaceholder: 'NPR reference number',
|
||||||
info: 'NPR letter — upload full document.'
|
info: 'NPR letter — upload full document.'
|
||||||
},
|
},
|
||||||
|
BIRTH_CERTIFICATE: {
|
||||||
|
sides: 1,
|
||||||
|
documentKeyLabel: 'Birth certificate registration number',
|
||||||
|
documentKeyPlaceholder: 'Registration / certificate number',
|
||||||
|
category: 'Government-issued ID',
|
||||||
|
info: 'Birth certificate issued by the Municipal Corporation / Registrar of Births & Deaths — accepted proof of identity for minor clients as per RBI KYC norms.'
|
||||||
|
},
|
||||||
|
SCHOOL_ID_CARD: {
|
||||||
|
sides: 1,
|
||||||
|
documentKeyLabel: 'School ID / admission number',
|
||||||
|
documentKeyPlaceholder: 'Student ID number',
|
||||||
|
category: 'Government-issued ID',
|
||||||
|
info: 'School identity card bearing photograph — accepted proof of identity for minor clients as per RBI KYC norms.'
|
||||||
|
},
|
||||||
UTILITY_BILL: {
|
UTILITY_BILL: {
|
||||||
sides: 1,
|
sides: 1,
|
||||||
category: 'Utility bills',
|
category: 'Utility bills',
|
||||||
@@ -131,7 +145,46 @@ export const PROOF_META: Record<string, Partial<ProofType>> = {
|
|||||||
PENSION_PAYMENT_ORDER: {
|
PENSION_PAYMENT_ORDER: {
|
||||||
sides: 1,
|
sides: 1,
|
||||||
category: 'Financial & other',
|
category: 'Financial & other',
|
||||||
|
requiresDate: true,
|
||||||
info: 'Pension payment order — upload full document issued by pension authority.'
|
info: 'Pension payment order — upload full document issued by pension authority.'
|
||||||
|
},
|
||||||
|
CERT_INCORPORATION: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
documentKeyLabel: 'Registration / incorporation number',
|
||||||
|
documentKeyPlaceholder: 'CIN / registration number',
|
||||||
|
info: 'Certificate of Incorporation (companies/LLPs) or Registration Certificate (firms/trusts/societies) — as prescribed under the RBI Master Direction on KYC, Annexure I.'
|
||||||
|
},
|
||||||
|
ENTITY_PAN: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
documentKeyLabel: 'PAN of entity',
|
||||||
|
documentKeyPlaceholder: 'e.g. ABCDE1234F',
|
||||||
|
info: 'PAN card issued in the name of the entity.'
|
||||||
|
},
|
||||||
|
CONSTITUTIVE_DOC: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
documentKeyLabel: 'Document reference number',
|
||||||
|
documentKeyPlaceholder: 'Reference / registration number',
|
||||||
|
info: 'Constitutive document — Memorandum & Articles of Association (companies), Partnership Deed (firms), Trust Deed (trusts), or By-laws (societies) — as prescribed under the RBI Master Direction on KYC.'
|
||||||
|
},
|
||||||
|
BOARD_RESOLUTION: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
info: 'Board Resolution / Authorization Letter naming the officers, managers or employees authorised to transact on the entity’s behalf.'
|
||||||
|
},
|
||||||
|
AUTH_SIGNATORY_KYC: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
info: 'OVD-based KYC of the person(s) holding Power of Attorney / authorised to transact on the entity’s behalf.'
|
||||||
|
},
|
||||||
|
GST_CERTIFICATE: {
|
||||||
|
sides: 1,
|
||||||
|
category: 'Entity KYC documents',
|
||||||
|
documentKeyLabel: 'GSTIN',
|
||||||
|
documentKeyPlaceholder: 'e.g. 22AAAAA0000A1Z5',
|
||||||
|
info: 'GST Registration Certificate, where the entity is GST-registered.'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -392,6 +392,22 @@ export class AuthenticationService {
|
|||||||
return roleNames.some((n) => n === 'clerk');
|
return roleNames.some((n) => n === 'clerk');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns true when the logged-in user has the "Principal Officer" role (STR conclusion/filing authority). */
|
||||||
|
isPrincipalOfficerUser(): boolean {
|
||||||
|
const creds = this.getCredentials();
|
||||||
|
if (!creds || !creds.roles) return false;
|
||||||
|
const roleNames: string[] = (creds.roles as any[]).map((r) => (r.name || r.role || '').toLowerCase().trim());
|
||||||
|
return roleNames.some((n) => n === 'principal officer');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns true when the logged-in user has the "AML Officer" role (first-level alert review). */
|
||||||
|
isAmlOfficerUser(): boolean {
|
||||||
|
const creds = this.getCredentials();
|
||||||
|
if (!creds || !creds.roles) return false;
|
||||||
|
const roleNames: string[] = (creds.roles as any[]).map((r) => (r.name || r.role || '').toLowerCase().trim());
|
||||||
|
return roleNames.some((n) => n === 'aml officer');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true ONLY for regular cashier role (not Head Cashier).
|
* Returns true ONLY for regular cashier role (not Head Cashier).
|
||||||
* Regular cashier → full-screen transaction entry, no nav.
|
* Regular cashier → full-screen transaction entry, no nav.
|
||||||
@@ -416,6 +432,14 @@ export class AuthenticationService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns true when the logged-in user has the "Cashier" role. */
|
||||||
|
hasCashierRole(): boolean {
|
||||||
|
const creds = this.getCredentials();
|
||||||
|
if (!creds || !creds.roles) return false;
|
||||||
|
const roleNames: string[] = (creds.roles as any[]).map((r) => (r.name || r.role || '').toLowerCase().trim());
|
||||||
|
return roleNames.some((n) => n === 'cashier');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the user credentials.
|
* Sets the user credentials.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { environment } from '../../../environments/environment';
|
|||||||
import { Logger } from '../logger/logger.service';
|
import { Logger } from '../logger/logger.service';
|
||||||
import { AlertService } from '../alert/alert.service';
|
import { AlertService } from '../alert/alert.service';
|
||||||
import { TranslateService } from '@ngx-translate/core'; // Added import for TranslateService
|
import { TranslateService } from '@ngx-translate/core'; // Added import for TranslateService
|
||||||
|
import { SILENT_HTTP_ERROR } from './silent-error.token';
|
||||||
|
|
||||||
/** Initialize Logger */
|
/** Initialize Logger */
|
||||||
const log = new Logger('ErrorHandlerInterceptor');
|
const log = new Logger('ErrorHandlerInterceptor');
|
||||||
@@ -54,12 +55,33 @@ export class ErrorHandlerInterceptor implements HttpInterceptor {
|
|||||||
const isClientImageRequest = request.url.includes('/clients/') && request.url.includes('/images');
|
const isClientImageRequest = request.url.includes('/clients/') && request.url.includes('/images');
|
||||||
const isClientKycRequest = request.url.match(/\/clients\/\d+\/kyc$/);
|
const isClientKycRequest = request.url.match(/\/clients\/\d+\/kyc$/);
|
||||||
const isDirectorRequest = request.url.includes('/election/directors');
|
const isDirectorRequest = request.url.includes('/election/directors');
|
||||||
const isSilentRequest = isClientImageRequest || isClientKycRequest || isDirectorRequest;
|
// "No pending edit for this client" is the normal/expected state — checked on every edit-page
|
||||||
|
// load, not a real error the user needs to see.
|
||||||
|
const isClientPendingEditRequest = request.url.match(/\/clients\/\d+\/edit\/pending$/);
|
||||||
|
// Risk rules are an enhancement on top of a default risk-category fallback — if this
|
||||||
|
// endpoint isn't available on a given backend deployment, the client-general-step
|
||||||
|
// component already falls back to riskRules = [] silently; no toast needed here either.
|
||||||
|
const isKycRiskRulesRequest = request.url.includes('/kyc/risk-rules');
|
||||||
|
const isSilentRequest =
|
||||||
|
isClientImageRequest ||
|
||||||
|
isClientKycRequest ||
|
||||||
|
isDirectorRequest ||
|
||||||
|
isClientPendingEditRequest ||
|
||||||
|
isKycRiskRulesRequest;
|
||||||
|
|
||||||
if (!environment.production && !isSilentRequest) {
|
// Explicit per-request opt-out (e.g. per-row enrichment fetches on a list page whose
|
||||||
|
// component already recovers via its own catchError) — silenced for every status, since
|
||||||
|
// the caller took responsibility for handling failure when it set this.
|
||||||
|
const isSilentOverride = request.context.get(SILENT_HTTP_ERROR);
|
||||||
|
|
||||||
|
if (!environment.production && !isSilentRequest && !isSilentOverride) {
|
||||||
log.error(`Request Error: ${errorMessage}`);
|
log.error(`Request Error: ${errorMessage}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isSilentOverride) {
|
||||||
|
throw response;
|
||||||
|
}
|
||||||
|
|
||||||
// Silently handle expected 403/404 errors (no image, no KYC record)
|
// Silently handle expected 403/404 errors (no image, no KYC record)
|
||||||
// Throw instead of EMPTY so component-level catchError can handle it
|
// Throw instead of EMPTY so component-level catchError can handle it
|
||||||
if (isSilentRequest && (status === 403 || status === 404)) {
|
if (isSilentRequest && (status === 403 || status === 404)) {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* 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 { HttpContextToken } from '@angular/common/http';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Per-request opt-out of ErrorHandlerInterceptor's toast. Set via
|
||||||
|
* `{ context: new HttpContext().set(SILENT_HTTP_ERROR, true) }` on calls whose caller already
|
||||||
|
* handles failures itself (e.g. per-row enrichment fetches on a list page) — the interceptor
|
||||||
|
* still throws so the caller's own catchError/error callback runs, it just skips the alert.
|
||||||
|
*/
|
||||||
|
export const SILENT_HTTP_ERROR = new HttpContextToken<boolean>(() => false);
|
||||||
@@ -1121,7 +1121,7 @@
|
|||||||
<button mat-menu-item tabindex="0">
|
<button mat-menu-item tabindex="0">
|
||||||
<fa-icon icon="check-circle" class="menu-item-icon"></fa-icon> Share Issued
|
<fa-icon icon="check-circle" class="menu-item-icon"></fa-icon> Share Issued
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item tabindex="0">
|
<button mat-menu-item tabindex="0" [routerLink]="['/shares/share-holders']">
|
||||||
<fa-icon icon="users" class="menu-item-icon"></fa-icon> Share Holder
|
<fa-icon icon="users" class="menu-item-icon"></fa-icon> Share Holder
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item tabindex="0">
|
<button mat-menu-item tabindex="0">
|
||||||
@@ -1167,10 +1167,6 @@
|
|||||||
<button mat-menu-item tabindex="0">
|
<button mat-menu-item tabindex="0">
|
||||||
<fa-icon icon="chart-bar" class="menu-item-icon"></fa-icon> Depreciation Register
|
<fa-icon icon="chart-bar" class="menu-item-icon"></fa-icon> Depreciation Register
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item routerLink="/fiu" tabindex="0">
|
|
||||||
<fa-icon icon="shield-alt" class="menu-item-icon" style="color: #dc2626"></fa-icon> Financial Intelligence
|
|
||||||
Unit (FIU-IND)
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Investment -->
|
<!-- Investment -->
|
||||||
<div class="deposit-menu-group">
|
<div class="deposit-menu-group">
|
||||||
@@ -1468,13 +1464,13 @@
|
|||||||
Balance Certificate
|
Balance Certificate
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item routerLink="/letter-mgmt/form-60" tabindex="0">
|
<button mat-menu-item routerLink="/letter-mgmt/form-60" tabindex="0">
|
||||||
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 60
|
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 97
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item tabindex="0">
|
<button mat-menu-item tabindex="0">
|
||||||
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 61
|
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 98
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item routerLink="/letter-mgmt/form-15gh" tabindex="0">
|
<button mat-menu-item routerLink="/letter-mgmt/form-15gh" tabindex="0">
|
||||||
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 15G and H
|
<fa-icon icon="file-signature" class="menu-item-icon" style="color: #15803d"></fa-icon> Form 121
|
||||||
</button>
|
</button>
|
||||||
<button mat-menu-item routerLink="/letter-mgmt/hypothecation-certificate" tabindex="0">
|
<button mat-menu-item routerLink="/letter-mgmt/hypothecation-certificate" tabindex="0">
|
||||||
<fa-icon icon="file-alt" class="menu-item-icon" style="color: #15803d"></fa-icon>
|
<fa-icon icon="file-alt" class="menu-item-icon" style="color: #15803d"></fa-icon>
|
||||||
@@ -1568,8 +1564,13 @@
|
|||||||
<a class="gl-link" [class.hidden]="!matchesRbiSearch('Balance Sheet')" (click)="rbiMenuOpen = false">
|
<a class="gl-link" [class.hidden]="!matchesRbiSearch('Balance Sheet')" (click)="rbiMenuOpen = false">
|
||||||
<fa-icon icon="file-alt" class="gl-icon"></fa-icon> Balance Sheet (BR Act & Others)
|
<fa-icon icon="file-alt" class="gl-icon"></fa-icon> Balance Sheet (BR Act & Others)
|
||||||
</a>
|
</a>
|
||||||
<a class="gl-link" [class.hidden]="!matchesRbiSearch('CRR / SLR')" (click)="rbiMenuOpen = false">
|
<a
|
||||||
<fa-icon icon="calculator" class="gl-icon"></fa-icon> CRR / SLR
|
class="gl-link"
|
||||||
|
[class.hidden]="!matchesRbiSearch('CTR / STR')"
|
||||||
|
routerLink="/fiu"
|
||||||
|
(click)="rbiMenuOpen = false"
|
||||||
|
>
|
||||||
|
<fa-icon icon="calculator" class="gl-icon"></fa-icon> CTR / STR
|
||||||
</a>
|
</a>
|
||||||
<a class="gl-link" [class.hidden]="!matchesRbiSearch('Annexure')" (click)="rbiMenuOpen = false">
|
<a class="gl-link" [class.hidden]="!matchesRbiSearch('Annexure')" (click)="rbiMenuOpen = false">
|
||||||
<fa-icon icon="paperclip" class="gl-icon"></fa-icon> Annexure
|
<fa-icon icon="paperclip" class="gl-icon"></fa-icon> Annexure
|
||||||
@@ -1664,8 +1665,13 @@
|
|||||||
>
|
>
|
||||||
<fa-icon icon="bell" class="gl-icon"></fa-icon> Daily Position Notice
|
<fa-icon icon="bell" class="gl-icon"></fa-icon> Daily Position Notice
|
||||||
</a>
|
</a>
|
||||||
<a class="gl-link" [class.hidden]="!matchesRbiSearch('R/SLR')" (click)="rbiMenuOpen = false">
|
<a
|
||||||
<fa-icon icon="lock" class="gl-icon"></fa-icon> R/SLR
|
class="gl-link"
|
||||||
|
[class.hidden]="!matchesRbiSearch('AML')"
|
||||||
|
routerLink="/rbi/aml"
|
||||||
|
(click)="rbiMenuOpen = false"
|
||||||
|
>
|
||||||
|
<fa-icon icon="shield-alt" class="gl-icon"></fa-icon> AML
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- OSS Reports -->
|
<!-- OSS Reports -->
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="cur-view">
|
<div class="cur-view">
|
||||||
|
<!-- ─── Dormancy risk alert (only when subStatus has left Active) ──── -->
|
||||||
|
<mifosx-dormancy-alert-panel [accountData]="currentAccountData"></mifosx-dormancy-alert-panel>
|
||||||
|
|
||||||
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
||||||
<header class="cur-hero">
|
<header class="cur-hero">
|
||||||
<div class="cur-hero__left">
|
<div class="cur-hero__left">
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { AccountsService } from 'app/accounts/accounts.service';
|
import { AccountsService } from 'app/accounts/accounts.service';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
import { AuthenticationService } from '../../core/authentication/authentication.service';
|
||||||
|
|
||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
@@ -48,6 +49,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|||||||
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
||||||
import { StatusLookupPipe } from '../../pipes/status-lookup.pipe';
|
import { StatusLookupPipe } from '../../pipes/status-lookup.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DormancyAlertPanelComponent } from 'app/shared/dormancy-alert-panel/dormancy-alert-panel.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Account View Component
|
* Current Account View Component
|
||||||
@@ -77,7 +79,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
MatTabNavPanel,
|
MatTabNavPanel,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
StatusLookupPipe
|
StatusLookupPipe,
|
||||||
|
DormancyAlertPanelComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class CurrentAccountViewComponent implements OnInit {
|
export class CurrentAccountViewComponent implements OnInit {
|
||||||
@@ -89,6 +92,7 @@ export class CurrentAccountViewComponent implements OnInit {
|
|||||||
private accountsService = inject(AccountsService);
|
private accountsService = inject(AccountsService);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
|
private authenticationService = inject(AuthenticationService);
|
||||||
dialog = inject(MatDialog);
|
dialog = inject(MatDialog);
|
||||||
|
|
||||||
/** Current Account Data */
|
/** Current Account Data */
|
||||||
@@ -271,6 +275,14 @@ export class CurrentAccountViewComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.authenticationService.hasCashierRole()) {
|
||||||
|
this.buttonConfig.buttonsArray = this.buttonConfig.buttonsArray.filter(
|
||||||
|
(btn) => btn.name !== 'Deposit' && btn.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
this.buttonConfig.optionArray = this.buttonConfig.optionArray.filter(
|
||||||
|
(opt) => opt.name !== 'Deposit' && opt.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
@@ -7,6 +7,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="fd-view">
|
<div class="fd-view">
|
||||||
|
<!-- ─── Dormancy risk alert (only when subStatus has left Active) ──── -->
|
||||||
|
<mifosx-dormancy-alert-panel [accountData]="fixedDepositsAccountData"></mifosx-dormancy-alert-panel>
|
||||||
|
|
||||||
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
||||||
<header class="fd-hero">
|
<header class="fd-hero">
|
||||||
<div class="fd-hero__left">
|
<div class="fd-hero__left">
|
||||||
|
|||||||
+13
-1
@@ -27,6 +27,7 @@ import { AccountsService } from 'app/accounts/accounts.service';
|
|||||||
import { Currency } from 'app/shared/models/general.model';
|
import { Currency } from 'app/shared/models/general.model';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
import { AuthenticationService } from '../../../core/authentication/authentication.service';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { NgClass, CurrencyPipe } from '@angular/common';
|
import { NgClass, CurrencyPipe } from '@angular/common';
|
||||||
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
||||||
@@ -37,6 +38,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|||||||
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
||||||
import { StatusLookupPipe } from '../../../pipes/status-lookup.pipe';
|
import { StatusLookupPipe } from '../../../pipes/status-lookup.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DormancyAlertPanelComponent } from 'app/shared/dormancy-alert-panel/dormancy-alert-panel.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixed Deposits Account View Component
|
* Fixed Deposits Account View Component
|
||||||
@@ -62,7 +64,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
MatTabNavPanel,
|
MatTabNavPanel,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
StatusLookupPipe
|
StatusLookupPipe,
|
||||||
|
DormancyAlertPanelComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class FixedDepositAccountViewComponent implements OnInit {
|
export class FixedDepositAccountViewComponent implements OnInit {
|
||||||
@@ -73,6 +76,7 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
|||||||
private accountsService = inject(AccountsService);
|
private accountsService = inject(AccountsService);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
|
private authenticationService = inject(AuthenticationService);
|
||||||
dialog = inject(MatDialog);
|
dialog = inject(MatDialog);
|
||||||
|
|
||||||
/** Fixed Deposits Account Data */
|
/** Fixed Deposits Account Data */
|
||||||
@@ -194,6 +198,14 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.authenticationService.hasCashierRole()) {
|
||||||
|
this.buttonConfig.buttonsArray = this.buttonConfig.buttonsArray.filter(
|
||||||
|
(btn) => btn.name !== 'Deposit' && btn.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
this.buttonConfig.optionArray = this.buttonConfig.optionArray.filter(
|
||||||
|
(opt) => opt.name !== 'Deposit' && opt.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+3
@@ -7,6 +7,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="rd-view">
|
<div class="rd-view">
|
||||||
|
<!-- ─── Dormancy risk alert (only when subStatus has left Active) ──── -->
|
||||||
|
<mifosx-dormancy-alert-panel [accountData]="recurringDepositsAccountData"></mifosx-dormancy-alert-panel>
|
||||||
|
|
||||||
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
||||||
<header class="rd-hero">
|
<header class="rd-hero">
|
||||||
<div class="rd-hero__left">
|
<div class="rd-hero__left">
|
||||||
|
|||||||
+13
-1
@@ -27,6 +27,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { AccountsService } from 'app/accounts/accounts.service';
|
import { AccountsService } from 'app/accounts/accounts.service';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
import { AuthenticationService } from '../../../core/authentication/authentication.service';
|
||||||
import { MatTooltip } from '@angular/material/tooltip';
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
import { NgClass, DecimalPipe, CurrencyPipe } from '@angular/common';
|
import { NgClass, DecimalPipe, CurrencyPipe } from '@angular/common';
|
||||||
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
import { AccountNumberComponent } from '../../../shared/account-number/account-number.component';
|
||||||
@@ -37,6 +38,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|||||||
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
||||||
import { StatusLookupPipe } from '../../../pipes/status-lookup.pipe';
|
import { StatusLookupPipe } from '../../../pipes/status-lookup.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DormancyAlertPanelComponent } from 'app/shared/dormancy-alert-panel/dormancy-alert-panel.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RecurringDeposits Account View Component
|
* RecurringDeposits Account View Component
|
||||||
@@ -63,7 +65,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
DecimalPipe,
|
DecimalPipe,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
StatusLookupPipe
|
StatusLookupPipe,
|
||||||
|
DormancyAlertPanelComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class RecurringDepositsAccountViewComponent implements OnInit {
|
export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||||
@@ -74,6 +77,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
|||||||
private accountsService = inject(AccountsService);
|
private accountsService = inject(AccountsService);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
|
private authenticationService = inject(AuthenticationService);
|
||||||
dialog = inject(MatDialog);
|
dialog = inject(MatDialog);
|
||||||
private translateService = inject(TranslateService);
|
private translateService = inject(TranslateService);
|
||||||
|
|
||||||
@@ -245,6 +249,14 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.authenticationService.hasCashierRole()) {
|
||||||
|
this.buttonConfig.buttonsArray = this.buttonConfig.buttonsArray.filter(
|
||||||
|
(btn) => btn.name !== 'Deposit' && btn.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
this.buttonConfig.optionArray = this.buttonConfig.optionArray.filter(
|
||||||
|
(opt) => opt.name !== 'Deposit' && opt.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -129,9 +129,130 @@
|
|||||||
<!-- CTR -->
|
<!-- CTR -->
|
||||||
@if (activeTab === 'ctr') {
|
@if (activeTab === 'ctr') {
|
||||||
<div class="fiu-section">
|
<div class="fiu-section">
|
||||||
|
<!-- LIVE: cash-related AML alerts awaiting AML Officer review -->
|
||||||
<div class="fiu-form-meta">
|
<div class="fiu-form-meta">
|
||||||
<div class="fiu-form-title">
|
<div class="fiu-form-title">
|
||||||
<h3>CTR — Cash Transaction Report</h3>
|
<h3>Live Cash Alerts</h3>
|
||||||
|
<p>
|
||||||
|
Raised by the transaction-monitoring rule engine — review and whitelist or escalate to Principal Officer
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<select class="fiu-inp" [(ngModel)]="amlAlertStatusFilter" (ngModelChange)="loadAmlAlerts()">
|
||||||
|
<option value="">All statuses</option>
|
||||||
|
<option value="RAISED">Raised</option>
|
||||||
|
<option value="UNDER_REVIEW">Under Review</option>
|
||||||
|
<option value="WHITELISTED">Whitelisted</option>
|
||||||
|
<option value="ESCALATED">Escalated</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="fiu-tbl-wrap">
|
||||||
|
<table class="fiu-tbl">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Client</th>
|
||||||
|
<th>Type</th>
|
||||||
|
<th>Rule</th>
|
||||||
|
<th class="ta-r">Amount</th>
|
||||||
|
<th>Raised On</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Notes</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (alert of amlAlerts; track alert.id) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ alert.id }}</td>
|
||||||
|
<td>{{ alert.clientDisplayName }}</td>
|
||||||
|
<td>{{ alert.transactionType }}</td>
|
||||||
|
<td>{{ alert.ruleCode }} — {{ alert.ruleDescription }}</td>
|
||||||
|
<td class="ta-r mono">₹{{ alert.amount | number: '1.0-0' }}</td>
|
||||||
|
<td>{{ alert.raisedOn | date: 'medium' }}</td>
|
||||||
|
<td>
|
||||||
|
<span [class]="amlStatusClass(alert.status)">{{ alert.status }}</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if (alert.status === 'RAISED' || alert.status === 'UNDER_REVIEW') {
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="fiu-inp"
|
||||||
|
placeholder="Review notes"
|
||||||
|
[(ngModel)]="amlReviewNotes[alert.id]"
|
||||||
|
/>
|
||||||
|
} @else {
|
||||||
|
<span class="muted">{{ alert.reviewNotes }}</span>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if (alert.status === 'RAISED' || alert.status === 'UNDER_REVIEW') {
|
||||||
|
<div class="fiu-action-group" *mifosxHasPermission="'REVIEW_AML_ALERT'">
|
||||||
|
<button class="fiu-btn fiu-btn-g" (click)="whitelistAlert(alert)">Whitelist</button>
|
||||||
|
<button class="fiu-btn fiu-btn-xml" (click)="escalateAlert(alert)">Escalate</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
} @empty {
|
||||||
|
<tr>
|
||||||
|
<td colspan="9" class="fiu-empty">No live alerts.</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LIVE: monthly CTR reports (mechanical, threshold-based) -->
|
||||||
|
<div class="fiu-form-meta">
|
||||||
|
<div class="fiu-form-title">
|
||||||
|
<h3>Monthly CTR Reports</h3>
|
||||||
|
<p>
|
||||||
|
Threshold: <strong>₹{{ bank.cashThreshold | number }}</strong> per single txn / connected aggregate
|
||||||
|
per month
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div class="fiu-action-group">
|
||||||
|
<input class="fiu-inp" type="month" [(ngModel)]="ctrGenerateMonth" />
|
||||||
|
<button class="fiu-btn fiu-btn-g" *mifosxHasPermission="'REVIEW_AML_ALERT'" (click)="generateCtrReport()">
|
||||||
|
Generate
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="fiu-tbl-wrap">
|
||||||
|
<table class="fiu-tbl">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Month</th>
|
||||||
|
<th>Generated On</th>
|
||||||
|
<th class="ta-c">Records</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Submitted On</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (r of amlCtrReports; track r.id) {
|
||||||
|
<tr>
|
||||||
|
<td>{{ r.reportMonth }}</td>
|
||||||
|
<td>{{ r.generatedOn | date: 'medium' }}</td>
|
||||||
|
<td class="ta-c">{{ r.recordCount }}</td>
|
||||||
|
<td>
|
||||||
|
<span [class]="amlStatusClass(r.status)">{{ r.status }}</span>
|
||||||
|
</td>
|
||||||
|
<td>{{ r.submittedOn ? (r.submittedOn | date: 'medium') : '—' }}</td>
|
||||||
|
</tr>
|
||||||
|
} @empty {
|
||||||
|
<tr>
|
||||||
|
<td colspan="5" class="fiu-empty">No CTR reports generated yet.</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FINnet export template (separate concern — TC1/TC2 file-format generation) -->
|
||||||
|
<div class="fiu-form-meta">
|
||||||
|
<div class="fiu-form-title">
|
||||||
|
<h3>FINnet TC2 Export Template</h3>
|
||||||
<p>
|
<p>
|
||||||
All cash transactions ≥ ₹{{ bank.cashThreshold | number }} (single or aggregate per month per account)
|
All cash transactions ≥ ₹{{ bank.cashThreshold | number }} (single or aggregate per month per account)
|
||||||
</p>
|
</p>
|
||||||
@@ -221,9 +342,107 @@
|
|||||||
<!-- STR -->
|
<!-- STR -->
|
||||||
@if (activeTab === 'str') {
|
@if (activeTab === 'str') {
|
||||||
<div class="fiu-section">
|
<div class="fiu-section">
|
||||||
|
<!-- LIVE: STR cases with full Principal Officer actions -->
|
||||||
<div class="fiu-form-meta">
|
<div class="fiu-form-meta">
|
||||||
<div class="fiu-form-title">
|
<div class="fiu-form-title">
|
||||||
<h3>STR — Suspicious Transaction Report</h3>
|
<h3>Live STR Cases</h3>
|
||||||
|
<p>
|
||||||
|
Escalated by an AML Officer; Principal Officer investigates, concludes and files with FIU-IND within 7
|
||||||
|
working days
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="fiu-tbl-wrap">
|
||||||
|
<table class="fiu-tbl">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>Client</th>
|
||||||
|
<th class="ta-c">Cumulative Cases</th>
|
||||||
|
<th>Assigned PO</th>
|
||||||
|
<th>Conclusion</th>
|
||||||
|
<th>FIU Due Date</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (sc of amlStrCases; track sc.id) {
|
||||||
|
<tr [class.selected-row]="selectedStrCase?.id === sc.id">
|
||||||
|
<td>{{ sc.id }}</td>
|
||||||
|
<td>{{ sc.clientDisplayName }}</td>
|
||||||
|
<td class="ta-c" [class.escalation-warning]="sc.cumulativeStrCaseCountForClient >= 3">
|
||||||
|
{{ sc.cumulativeStrCaseCountForClient }}
|
||||||
|
</td>
|
||||||
|
<td>{{ sc.assignedPoUsername || '—' }}</td>
|
||||||
|
<td>{{ sc.conclusion || '—' }}</td>
|
||||||
|
<td>{{ sc.fiuDueDate || '—' }}</td>
|
||||||
|
<td>
|
||||||
|
<span [class]="amlStatusClass(sc.status)">{{ sc.status }}</span>
|
||||||
|
</td>
|
||||||
|
<td><button class="fiu-btn fiu-btn-g" (click)="selectStrCase(sc)">Investigate</button></td>
|
||||||
|
</tr>
|
||||||
|
} @empty {
|
||||||
|
<tr>
|
||||||
|
<td colspan="8" class="fiu-empty">No STR cases yet.</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (selectedStrCase) {
|
||||||
|
<div class="str-case-detail">
|
||||||
|
<div class="fiu-form-meta">
|
||||||
|
<div class="fiu-form-title">
|
||||||
|
<h3>STR Case #{{ selectedStrCase.id }} — {{ selectedStrCase.clientDisplayName }}</h3>
|
||||||
|
<p>
|
||||||
|
Alert #{{ selectedStrCase.alertId }} ·
|
||||||
|
{{ selectedStrCase.cumulativeStrCaseCountForClient }} cumulative STR case(s) for this client
|
||||||
|
@if (selectedStrCase.cumulativeStrCaseCountForClient >= 3) {
|
||||||
|
<span class="escalation-badge">Risk category auto-escalated</span>
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<button class="fiu-btn fiu-btn-g" (click)="closeStrCaseDetail()">Close</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="case-form" *mifosxHasPermission="'CONCLUDE_AML_STR'">
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="fiuInvestigationNotes">Investigation notes (source-of-transaction history reviewed)</label>
|
||||||
|
<textarea id="fiuInvestigationNotes" rows="3" [(ngModel)]="concludeInvestigationNotes"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="fiuSourceOfFundsNotes">Source-of-funds notes</label>
|
||||||
|
<textarea id="fiuSourceOfFundsNotes" rows="2" [(ngModel)]="concludeSourceOfFundsNotes"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="form-row conclusion-row">
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="fiuConclusion" value="NOT_SUSPICIOUS" [(ngModel)]="concludeConclusion" />
|
||||||
|
Not suspicious (whitelist)
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="fiuConclusion" value="SUSPICIOUS" [(ngModel)]="concludeConclusion" />
|
||||||
|
Suspicious (file STR)
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<button class="fiu-btn fiu-btn-xml" (click)="concludeStrCase()">Conclude</button>
|
||||||
|
|
||||||
|
@if (selectedStrCase.status === 'CONCLUDED_SUSPICIOUS') {
|
||||||
|
<div class="file-str-row">
|
||||||
|
<label for="fiuFileReferenceNo">FIU-IND acknowledgement / reference number</label>
|
||||||
|
<input id="fiuFileReferenceNo" class="fiu-inp" type="text" [(ngModel)]="fileReferenceNo" />
|
||||||
|
<button class="fiu-btn fiu-btn-xml" (click)="fileStrCase()">Mark STR Filed</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- FINnet export template (separate concern — STR XML file-format generation) -->
|
||||||
|
<div class="fiu-form-meta">
|
||||||
|
<div class="fiu-form-title">
|
||||||
|
<h3>FINnet STR XML Export Template</h3>
|
||||||
<p>Detected by AML rules engine + branch compliance officers; filed within 7 days</p>
|
<p>Detected by AML rules engine + branch compliance officers; filed within 7 days</p>
|
||||||
</div>
|
</div>
|
||||||
<button class="fiu-btn fiu-btn-xml" (click)="exportStrXml()">
|
<button class="fiu-btn fiu-btn-xml" (click)="exportStrXml()">
|
||||||
|
|||||||
@@ -579,6 +579,41 @@
|
|||||||
background: var(--f-red-l);
|
background: var(--f-red-l);
|
||||||
color: var(--f-red);
|
color: var(--f-red);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.status-raised {
|
||||||
|
background: var(--f-amber-l);
|
||||||
|
color: var(--f-amber);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-under-review {
|
||||||
|
background: var(--f-blue-l);
|
||||||
|
color: var(--f-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-whitelisted,
|
||||||
|
&.status-concluded-clear,
|
||||||
|
&.status-generated,
|
||||||
|
&.status-submitted {
|
||||||
|
background: var(--f-green-l);
|
||||||
|
color: var(--f-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-escalated,
|
||||||
|
&.status-open,
|
||||||
|
&.status-concluded-suspicious {
|
||||||
|
background: var(--f-red-l);
|
||||||
|
color: var(--f-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-filed {
|
||||||
|
background: var(--f-purple-l);
|
||||||
|
color: var(--f-purple);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-draft {
|
||||||
|
background: var(--f-g100);
|
||||||
|
color: var(--f-g500);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.risk-pill {
|
.risk-pill {
|
||||||
@@ -892,3 +927,85 @@
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selected-row {
|
||||||
|
background: var(--f-blue-l);
|
||||||
|
}
|
||||||
|
|
||||||
|
.escalation-warning {
|
||||||
|
color: var(--f-red);
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.escalation-badge {
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 8px;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--f-amber-l);
|
||||||
|
color: var(--f-amber);
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.str-case-detail {
|
||||||
|
border: 1px solid var(--f-g200);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 16px;
|
||||||
|
background: #fff;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.case-form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid var(--f-g300);
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--f-g500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.conclusion-row {
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 24px;
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-str-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding-top: 12px;
|
||||||
|
border-top: 1px dashed var(--f-g300);
|
||||||
|
|
||||||
|
label {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--f-g500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@
|
|||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component } from '@angular/core';
|
import { Component, OnInit, inject } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { AmlService } from 'app/aml/aml.service';
|
||||||
|
import { AuthenticationService } from 'app/core/authentication/authentication.service';
|
||||||
import {
|
import {
|
||||||
CtrTransaction,
|
CtrTransaction,
|
||||||
CTR_TXNS,
|
CTR_TXNS,
|
||||||
@@ -33,7 +35,9 @@ import {
|
|||||||
FormsModule
|
FormsModule
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class FiuComponent {
|
export class FiuComponent implements OnInit {
|
||||||
|
private amlService = inject(AmlService);
|
||||||
|
private authenticationService = inject(AuthenticationService);
|
||||||
/** Active tab */
|
/** Active tab */
|
||||||
activeTab: 'dashboard' | 'ctr' | 'str' | 'customers' | 'files' = 'dashboard';
|
activeTab: 'dashboard' | 'ctr' | 'str' | 'customers' | 'files' = 'dashboard';
|
||||||
|
|
||||||
@@ -57,6 +61,126 @@ export class FiuComponent {
|
|||||||
toastVisible = false;
|
toastVisible = false;
|
||||||
private toastTimer: any;
|
private toastTimer: any;
|
||||||
|
|
||||||
|
// -------------------- Live AML monitoring (real backend, replaces mock CTR/STR tables) --------------------
|
||||||
|
amlAlerts: any[] = [];
|
||||||
|
amlAlertStatusFilter = '';
|
||||||
|
amlReviewNotes: Record<number, string> = {};
|
||||||
|
|
||||||
|
amlCtrReports: any[] = [];
|
||||||
|
ctrGenerateMonth = '';
|
||||||
|
|
||||||
|
amlStrCases: any[] = [];
|
||||||
|
selectedStrCase: any = null;
|
||||||
|
concludeConclusion: 'NOT_SUSPICIOUS' | 'SUSPICIOUS' = 'NOT_SUSPICIOUS';
|
||||||
|
concludeInvestigationNotes = '';
|
||||||
|
concludeSourceOfFundsNotes = '';
|
||||||
|
fileReferenceNo = '';
|
||||||
|
|
||||||
|
get isPrincipalOfficer(): boolean {
|
||||||
|
return this.authenticationService.isPrincipalOfficerUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
get isAmlOfficer(): boolean {
|
||||||
|
return this.authenticationService.isAmlOfficerUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadAmlAlerts();
|
||||||
|
this.loadAmlCtrReports();
|
||||||
|
this.loadAmlStrCases();
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAmlAlerts(): void {
|
||||||
|
this.amlService
|
||||||
|
.getAlerts(this.amlAlertStatusFilter || undefined)
|
||||||
|
.subscribe((data) => (this.amlAlerts = data || []));
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAmlCtrReports(): void {
|
||||||
|
this.amlService.getCtrReports().subscribe((data) => (this.amlCtrReports = data || []));
|
||||||
|
}
|
||||||
|
|
||||||
|
loadAmlStrCases(): void {
|
||||||
|
this.amlService.getStrCases().subscribe((data) => (this.amlStrCases = data || []));
|
||||||
|
}
|
||||||
|
|
||||||
|
whitelistAlert(alert: any): void {
|
||||||
|
this.amlService.reviewAlert(alert.id, 'WHITELIST', this.amlReviewNotes[alert.id] || '').subscribe(() => {
|
||||||
|
this.toast(`Alert #${alert.id} whitelisted`);
|
||||||
|
this.loadAmlAlerts();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
escalateAlert(alert: any): void {
|
||||||
|
this.amlService.reviewAlert(alert.id, 'ESCALATE', this.amlReviewNotes[alert.id] || '').subscribe(() => {
|
||||||
|
this.toast(`Alert #${alert.id} escalated to Principal Officer`);
|
||||||
|
this.loadAmlAlerts();
|
||||||
|
this.loadAmlStrCases();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
generateCtrReport(): void {
|
||||||
|
if (!this.ctrGenerateMonth) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.amlService.generateCtrReport(this.ctrGenerateMonth).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.toast(`CTR report generated for ${this.ctrGenerateMonth}`);
|
||||||
|
this.loadAmlCtrReports();
|
||||||
|
},
|
||||||
|
error: (err) => this.toast(err?.error?.defaultUserMessage || 'CTR report generation failed')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
selectStrCase(strCase: any): void {
|
||||||
|
this.selectedStrCase = strCase;
|
||||||
|
this.concludeConclusion = 'NOT_SUSPICIOUS';
|
||||||
|
this.concludeInvestigationNotes = strCase.investigationNotes || '';
|
||||||
|
this.concludeSourceOfFundsNotes = strCase.sourceOfFundsNotes || '';
|
||||||
|
this.fileReferenceNo = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
closeStrCaseDetail(): void {
|
||||||
|
this.selectedStrCase = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
concludeStrCase(): void {
|
||||||
|
if (!this.selectedStrCase) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.amlService
|
||||||
|
.concludeStrCase(
|
||||||
|
this.selectedStrCase.id,
|
||||||
|
this.concludeConclusion,
|
||||||
|
this.concludeInvestigationNotes,
|
||||||
|
this.concludeSourceOfFundsNotes
|
||||||
|
)
|
||||||
|
.subscribe((updated) => {
|
||||||
|
this.toast(
|
||||||
|
this.concludeConclusion === 'SUSPICIOUS'
|
||||||
|
? `STR case #${updated.id} concluded suspicious — FIU due date ${updated.fiuDueDate}`
|
||||||
|
: `STR case #${updated.id} concluded not suspicious`
|
||||||
|
);
|
||||||
|
this.selectedStrCase = updated;
|
||||||
|
this.loadAmlStrCases();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fileStrCase(): void {
|
||||||
|
if (!this.selectedStrCase || !this.fileReferenceNo) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.amlService.fileStr(this.selectedStrCase.id, this.fileReferenceNo).subscribe((updated) => {
|
||||||
|
this.toast(`STR case #${updated.id} recorded as filed (ref ${updated.strReferenceNo})`);
|
||||||
|
this.selectedStrCase = updated;
|
||||||
|
this.loadAmlStrCases();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
amlStatusClass(status: string): string {
|
||||||
|
return 'status-pill status-' + (status || '').toLowerCase().replace(/_/g, '-');
|
||||||
|
}
|
||||||
|
|
||||||
showTab(tab: 'dashboard' | 'ctr' | 'str' | 'customers' | 'files'): void {
|
showTab(tab: 'dashboard' | 'ctr' | 'str' | 'customers' | 'files'): void {
|
||||||
this.activeTab = tab;
|
this.activeTab = tab;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ const routes: Routes = [
|
|||||||
resolve: {
|
resolve: {
|
||||||
offices: OfficesResolver
|
offices: OfficesResolver
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'shares',
|
||||||
|
loadChildren: () => import('../shares/shares.module').then((m) => m.SharesModule)
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -544,82 +544,315 @@ export function downloadLoanInterestPdf(record: LoanInterestRecord, fy: FyIntere
|
|||||||
|
|
||||||
// ───────────────────── Share Certificate ─────────────────────
|
// ───────────────────── Share Certificate ─────────────────────
|
||||||
export function buildShareCertificatePdf(r: ShareCertificateRecord): jsPDF {
|
export function buildShareCertificatePdf(r: ShareCertificateRecord): jsPDF {
|
||||||
const c = newCtx(ACCENT_AMBER);
|
const doc = new jsPDF({ orientation: 'portrait', unit: 'mm', format: 'a4' });
|
||||||
|
const pageW = doc.internal.pageSize.getWidth();
|
||||||
|
const pageH = doc.internal.pageSize.getHeight();
|
||||||
|
const margin = 20;
|
||||||
|
const contentW = pageW - 40;
|
||||||
|
|
||||||
|
const gold: [number, number, number] = [
|
||||||
|
197,
|
||||||
|
160,
|
||||||
|
89
|
||||||
|
]; // #c5a059
|
||||||
|
const darkBlue: [number, number, number] = [
|
||||||
|
11,
|
||||||
|
60,
|
||||||
|
93
|
||||||
|
]; // #0b3c5d
|
||||||
|
const textDark: [number, number, number] = [
|
||||||
|
44,
|
||||||
|
37,
|
||||||
|
32
|
||||||
|
]; // #2c2520
|
||||||
|
const textMuted: [number, number, number] = [
|
||||||
|
123,
|
||||||
|
111,
|
||||||
|
99
|
||||||
|
]; // #7b6f63
|
||||||
|
const lightBg: [number, number, number] = [
|
||||||
|
253,
|
||||||
|
252,
|
||||||
|
247
|
||||||
|
]; // #fdfcf7
|
||||||
|
const containerBg: [number, number, number] = [
|
||||||
|
250,
|
||||||
|
248,
|
||||||
|
245
|
||||||
|
]; // #faf8f5
|
||||||
|
|
||||||
|
// 1. Draw Cream Background (page body)
|
||||||
|
doc.setFillColor(containerBg[0], containerBg[1], containerBg[2]);
|
||||||
|
doc.rect(0, 0, pageW, pageH, 'F');
|
||||||
|
|
||||||
|
// 2. Draw Textured cream background inside the outer border
|
||||||
|
doc.setFillColor(lightBg[0], lightBg[1], lightBg[2]);
|
||||||
|
doc.rect(12, 12, pageW - 24, pageH - 24, 'F');
|
||||||
|
|
||||||
|
// 3. Draw Gold Double Borders (Outer and Inner)
|
||||||
|
doc.setDrawColor(gold[0], gold[1], gold[2]);
|
||||||
|
|
||||||
|
// Outer double line
|
||||||
|
doc.setLineWidth(1.2);
|
||||||
|
doc.rect(12, 12, pageW - 24, pageH - 24, 'D');
|
||||||
|
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.rect(13.8, 13.8, pageW - 27.6, pageH - 27.6, 'D');
|
||||||
|
|
||||||
|
// Thin interior border line
|
||||||
|
doc.setDrawColor(220, 209, 189); // light brown/grey
|
||||||
|
doc.setLineWidth(0.2);
|
||||||
|
doc.rect(17, 17, pageW - 34, pageH - 34, 'D');
|
||||||
|
|
||||||
|
// 4. Certificate Header
|
||||||
|
let y = 28;
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(22);
|
||||||
|
doc.setTextColor(darkBlue[0], darkBlue[1], darkBlue[2]);
|
||||||
|
doc.text('NEXORA CO-OPERATIVE BANK LTD.', pageW / 2, y, { align: 'center' });
|
||||||
|
|
||||||
|
y += 5;
|
||||||
|
doc.setFont('times', 'italic');
|
||||||
|
doc.setFontSize(10.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text('Mumbai, Maharashtra, India', pageW / 2, y, { align: 'center' });
|
||||||
|
|
||||||
|
y += 4;
|
||||||
|
doc.setDrawColor(242, 237, 213); // light gold separator
|
||||||
|
doc.setLineWidth(1.5);
|
||||||
|
doc.line(22, y, pageW - 22, y);
|
||||||
|
|
||||||
|
y += 9;
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(24);
|
||||||
|
doc.setTextColor(gold[0], gold[1], gold[2]);
|
||||||
|
doc.text('SHARE CERTIFICATE', pageW / 2, y, { align: 'center' });
|
||||||
|
|
||||||
|
y += 5.5;
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(7.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text('ISSUED UNDER THE COMMON SEAL OF THE BANK', pageW / 2, y, { align: 'center' });
|
||||||
|
|
||||||
|
y += 4;
|
||||||
|
doc.setDrawColor(242, 237, 213); // separator
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.line(22, y, pageW - 22, y);
|
||||||
|
|
||||||
|
// 5. Meta Row (Certificate No, Folio No, Date of Issue)
|
||||||
|
y += 7;
|
||||||
|
|
||||||
|
// Column 1: Certificate No
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(7.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text('CERTIFICATE NO.', 25, y);
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(10);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
doc.text(r.certificateNo, 25, y + 4.5);
|
||||||
|
|
||||||
|
// Column 2: Folio No (Centered)
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(7.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text('FOLIO NO.', pageW / 2, y, { align: 'center' });
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(10);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
doc.text(r.folioNo, pageW / 2, y + 4.5, { align: 'center' });
|
||||||
|
|
||||||
|
// Column 3: Date of Issue (Right Aligned)
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(7.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text('DATE OF ISSUE', pageW - 25, y, { align: 'right' });
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(10);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
doc.text(formatLongDate(r.issueDate), pageW - 25, y + 4.5, { align: 'right' });
|
||||||
|
|
||||||
|
y += 8;
|
||||||
|
doc.setDrawColor(242, 237, 213);
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.line(22, y, pageW - 22, y);
|
||||||
|
|
||||||
|
// 6. Centered Body Section
|
||||||
|
y += 9;
|
||||||
const classLabel = r.shareClass === 'PREFERENCE' ? 'Preference' : 'Ordinary';
|
const classLabel = r.shareClass === 'PREFERENCE' ? 'Preference' : 'Ordinary';
|
||||||
|
|
||||||
let y = paintLetterhead(c, 'Share Certificate', 'CERTIFICATE REFERENCE', r.certificateNo, 'Folio No.', r.folioNo);
|
doc.setFont('times', 'normal');
|
||||||
|
doc.setFontSize(11);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
|
||||||
y = paintAddressee(c, y, 'Issued To,', r.memberName, r.memberId, r.memberPan, r.memberAddress);
|
const bodyText = `This is to certify that ${r.memberName} is the registered holder of ${r.shareCount.toLocaleString('en-IN')} (${classLabel}) shares of Rs. ${r.faceValue.toLocaleString('en-IN')} each, fully paid up, in Nexora Co-operative Bank Ltd., subject to the memorandum, articles of association, and bye-laws of the bank.`;
|
||||||
|
const bodyLines = doc.splitTextToSize(bodyText, pageW - 50);
|
||||||
// Centered, dramatic body paragraph (mirrors the highlighted "centered" style in the preview)
|
for (const line of bodyLines) {
|
||||||
if (y > c.pageH - c.margin - 80) {
|
doc.text(line, pageW / 2, y, { align: 'center' });
|
||||||
c.doc.addPage();
|
y += 5.5;
|
||||||
setFill(c, c.accent);
|
|
||||||
c.doc.rect(0, 0, c.pageW, 4, 'F');
|
|
||||||
y = c.margin;
|
|
||||||
}
|
}
|
||||||
const ctaText = `This is to certify that ${r.memberName} is the registered holder of ${r.shareCount.toLocaleString('en-IN')} (${classLabel}) shares of Rs. ${r.faceValue.toLocaleString('en-IN')} each, fully paid up, in ${BANK_NAME}, subject to the bye-laws of the bank.`;
|
|
||||||
const ctaLines = c.doc.splitTextToSize(ctaText, c.contentW - 10);
|
|
||||||
const ctaH = ctaLines.length * 5 + 6;
|
|
||||||
setFill(c, c.accentTint);
|
|
||||||
c.doc.rect(c.margin, y, c.contentW, ctaH, 'F');
|
|
||||||
setFill(c, c.accent);
|
|
||||||
c.doc.rect(c.margin, y, 1.8, ctaH, 'F');
|
|
||||||
c.doc.setFont('times', 'bold');
|
|
||||||
c.doc.setFontSize(11);
|
|
||||||
setText(c, C_TEXT);
|
|
||||||
c.doc.text(ctaLines, c.margin + 6, y + 5, { align: 'justify', maxWidth: c.contentW - 10 });
|
|
||||||
y += ctaH + 6;
|
|
||||||
|
|
||||||
y = paintSummary(
|
// 7. ISSUED TO Box
|
||||||
c,
|
y += 3;
|
||||||
|
const addrLines = doc.splitTextToSize(r.memberAddress || '', pageW - 60);
|
||||||
|
const boxH = 26 + addrLines.length * 4;
|
||||||
|
|
||||||
|
doc.setFillColor(253, 252, 247);
|
||||||
|
doc.setDrawColor(230, 225, 210);
|
||||||
|
doc.rect(25, y, pageW - 50, boxH, 'FD');
|
||||||
|
|
||||||
|
let boxY = y + 6;
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(8);
|
||||||
|
doc.setTextColor(gold[0], gold[1], gold[2]);
|
||||||
|
doc.text('ISSUED TO:', 30, boxY);
|
||||||
|
|
||||||
|
boxY += 5.5;
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(13);
|
||||||
|
doc.setTextColor(darkBlue[0], darkBlue[1], darkBlue[2]);
|
||||||
|
doc.text(r.memberName, 30, boxY);
|
||||||
|
|
||||||
|
boxY += 5.5;
|
||||||
|
doc.setFont('helvetica', 'normal');
|
||||||
|
doc.setFontSize(9);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
let idLine = `Member ID: ${r.memberId}`;
|
||||||
|
if (r.memberPan && r.memberPan !== 'Not Available' && r.memberPan !== '—') {
|
||||||
|
idLine += ` · PAN: ${r.memberPan}`;
|
||||||
|
}
|
||||||
|
doc.text(idLine, 30, boxY);
|
||||||
|
|
||||||
|
boxY += 5;
|
||||||
|
doc.setFontSize(8.5);
|
||||||
|
doc.setTextColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
|
doc.text(addrLines, 30, boxY);
|
||||||
|
|
||||||
|
y += boxH + 8;
|
||||||
|
|
||||||
|
// 8. Details Grid
|
||||||
|
const tableW = pageW - 50;
|
||||||
|
const tableColW = tableW / 4;
|
||||||
|
const tableRowH = 8.5;
|
||||||
|
|
||||||
|
const drawTableCell = (
|
||||||
|
x: number,
|
||||||
|
tblY: number,
|
||||||
|
w: number,
|
||||||
|
h: number,
|
||||||
|
text: string,
|
||||||
|
isLabel: boolean,
|
||||||
|
align: 'left' | 'right' = 'left'
|
||||||
|
) => {
|
||||||
|
if (isLabel) {
|
||||||
|
doc.setFillColor(253, 252, 247);
|
||||||
|
doc.rect(x, tblY, w, h, 'F');
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(8);
|
||||||
|
doc.setTextColor(gold[0], gold[1], gold[2]);
|
||||||
|
} else {
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(9.5);
|
||||||
|
doc.setTextColor(darkBlue[0], darkBlue[1], darkBlue[2]);
|
||||||
|
}
|
||||||
|
doc.setDrawColor(220, 209, 189);
|
||||||
|
doc.setLineWidth(0.25);
|
||||||
|
doc.rect(x, tblY, w, h, 'D');
|
||||||
|
doc.text(text, align === 'right' ? x + w - 3 : x + 3, tblY + h / 2 + 1.2, { align });
|
||||||
|
};
|
||||||
|
|
||||||
|
// Row 1
|
||||||
|
drawTableCell(25, y, tableColW, tableRowH, 'Branch', true);
|
||||||
|
drawTableCell(25 + tableColW, y, tableColW, tableRowH, r.branch || 'Mumbai Main Branch', false);
|
||||||
|
drawTableCell(25 + tableColW * 2, y, tableColW, tableRowH, 'Member Since', true);
|
||||||
|
drawTableCell(25 + tableColW * 3, y, tableColW, tableRowH, formatLongDate(r.joiningDate), false);
|
||||||
|
y += tableRowH;
|
||||||
|
|
||||||
|
// Row 2
|
||||||
|
drawTableCell(25, y, tableColW, tableRowH, 'Share Class', true);
|
||||||
|
drawTableCell(25 + tableColW, y, tableColW, tableRowH, classLabel, false);
|
||||||
|
drawTableCell(25 + tableColW * 2, y, tableColW, tableRowH, 'Date of Issue', true);
|
||||||
|
drawTableCell(25 + tableColW * 3, y, tableColW, tableRowH, formatLongDate(r.issueDate), false);
|
||||||
|
y += tableRowH;
|
||||||
|
|
||||||
|
// Row 3
|
||||||
|
drawTableCell(25, y, tableColW, tableRowH, 'Share Numbers', true);
|
||||||
|
drawTableCell(
|
||||||
|
25 + tableColW,
|
||||||
y,
|
y,
|
||||||
[
|
tableColW,
|
||||||
[
|
tableRowH,
|
||||||
'CERTIFICATE NO.',
|
|
||||||
r.certificateNo,
|
|
||||||
'FOLIO NO.',
|
|
||||||
r.folioNo
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'BRANCH',
|
|
||||||
r.branch,
|
|
||||||
'MEMBER SINCE',
|
|
||||||
formatLongDate(r.joiningDate)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'SHARE CLASS',
|
|
||||||
classLabel,
|
|
||||||
'DATE OF ISSUE',
|
|
||||||
formatLongDate(r.issueDate)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'SHARE NUMBERS',
|
|
||||||
`${r.shareNoFrom.toLocaleString('en-IN')} – ${r.shareNoTo.toLocaleString('en-IN')}`,
|
`${r.shareNoFrom.toLocaleString('en-IN')} – ${r.shareNoTo.toLocaleString('en-IN')}`,
|
||||||
'DIVIDEND PAID',
|
false
|
||||||
`Rs. ${r.dividendYtd.toLocaleString('en-IN')}`
|
);
|
||||||
]
|
drawTableCell(25 + tableColW * 2, y, tableColW, tableRowH, 'Dividend Paid', true);
|
||||||
|
drawTableCell(25 + tableColW * 3, y, tableColW, tableRowH, `Rs. ${r.dividendYtd.toLocaleString('en-IN')}`, false);
|
||||||
|
y += tableRowH;
|
||||||
|
|
||||||
|
// Row 4 (Highlight)
|
||||||
|
doc.setFillColor(darkBlue[0], darkBlue[1], darkBlue[2]);
|
||||||
|
doc.rect(25, y, tableColW * 2, tableRowH, 'F');
|
||||||
|
doc.rect(25 + tableColW * 2, y, tableColW * 2, tableRowH, 'F');
|
||||||
|
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(8.5);
|
||||||
|
doc.setTextColor(255, 255, 255);
|
||||||
|
doc.text('TOTAL FACE VALUE', 28, y + tableRowH / 2 + 1.2);
|
||||||
|
|
||||||
|
doc.setFont('times', 'bold');
|
||||||
|
doc.setFontSize(11);
|
||||||
|
doc.text(`Rs. ${(r.shareCount * r.faceValue).toLocaleString('en-IN')}`, pageW - 28, y + tableRowH / 2 + 1.2, {
|
||||||
|
align: 'right'
|
||||||
|
});
|
||||||
|
y += tableRowH + 8;
|
||||||
|
|
||||||
|
// 9. Footer Text (Given under common seal...)
|
||||||
|
doc.setFont('times', 'italic');
|
||||||
|
doc.setFontSize(10.5);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
|
||||||
|
const sealDay = new Date().getDate();
|
||||||
|
const sealMonthYear = new Date().toLocaleDateString('en-IN', { month: 'long', year: 'numeric' });
|
||||||
|
const sealPhrase = `Given under the common seal of the bank this ${sealDay} day of ${sealMonthYear}.`;
|
||||||
|
doc.text(sealPhrase, pageW / 2, y, { align: 'center' });
|
||||||
|
|
||||||
|
y += 8;
|
||||||
|
|
||||||
|
// 10. Seal Circle (left) and Signatory block (right)
|
||||||
|
const sealX = 50;
|
||||||
|
const sealY = y + 14;
|
||||||
|
doc.setDrawColor(gold[0], gold[1], gold[2]); // Gold
|
||||||
|
doc.setLineWidth(0.6);
|
||||||
|
doc.circle(sealX, sealY, 14, 'D');
|
||||||
|
|
||||||
|
doc.setLineWidth(0.3);
|
||||||
|
doc.setLineDashPattern(
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
1
|
||||||
],
|
],
|
||||||
{
|
0
|
||||||
label: 'TOTAL FACE VALUE',
|
|
||||||
value: `Rs. ${(r.shareCount * r.faceValue).toLocaleString('en-IN')}`
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
doc.circle(sealX, sealY, 11, 'D');
|
||||||
|
doc.setLineDashPattern([], 0);
|
||||||
|
|
||||||
y = paintPara(
|
doc.setFont('helvetica', 'bold');
|
||||||
c,
|
doc.setFontSize(7.5);
|
||||||
y,
|
doc.setTextColor(gold[0], gold[1], gold[2]);
|
||||||
`Given under the common seal of the bank this ${new Date().toLocaleDateString('en-IN', {
|
doc.text('COMMON', sealX, sealY - 1, { align: 'center' });
|
||||||
day: 'numeric',
|
doc.text('SEAL', sealX, sealY + 3.5, { align: 'center' });
|
||||||
month: 'long',
|
|
||||||
year: 'numeric'
|
|
||||||
})}.`
|
|
||||||
);
|
|
||||||
|
|
||||||
y = paintSignoff(c, y + 6, r.branch);
|
// Signatory Line
|
||||||
paintFooter(c, y + 4);
|
doc.setDrawColor(textMuted[0], textMuted[1], textMuted[2]);
|
||||||
return c.doc;
|
doc.setLineWidth(0.3);
|
||||||
|
doc.line(pageW - 75, y + 20, pageW - 25, y + 20);
|
||||||
|
|
||||||
|
doc.setFont('helvetica', 'bold');
|
||||||
|
doc.setFontSize(9.5);
|
||||||
|
doc.setTextColor(textDark[0], textDark[1], textDark[2]);
|
||||||
|
doc.text('Authorised Signatory', pageW - 50, y + 25, { align: 'center' });
|
||||||
|
|
||||||
|
return doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function downloadShareCertificatePdf(r: ShareCertificateRecord, dsc?: BankUserDsc): void {
|
export function downloadShareCertificatePdf(r: ShareCertificateRecord, dsc?: BankUserDsc): void {
|
||||||
@@ -736,7 +969,7 @@ export function buildForm60Pdf(r: Form60Record): jsPDF {
|
|||||||
|
|
||||||
let y = paintLetterhead(
|
let y = paintLetterhead(
|
||||||
c,
|
c,
|
||||||
'Form 60 Declaration',
|
'Form 97 Declaration',
|
||||||
'CERTIFICATE REFERENCE',
|
'CERTIFICATE REFERENCE',
|
||||||
`F60-${r.customerId}`,
|
`F60-${r.customerId}`,
|
||||||
'PAN Status',
|
'PAN Status',
|
||||||
|
|||||||
+3
-3
@@ -85,7 +85,7 @@
|
|||||||
} @else if (isBalance && balance) {
|
} @else if (isBalance && balance) {
|
||||||
<span class="cpd-stage-pill">{{ balance.asOnDate | date: 'd MMM y' }}</span>
|
<span class="cpd-stage-pill">{{ balance.asOnDate | date: 'd MMM y' }}</span>
|
||||||
} @else if (isForm60 && form60) {
|
} @else if (isForm60 && form60) {
|
||||||
<span class="cpd-stage-pill cpd-stage-pill--amber">No PAN — Form 60</span>
|
<span class="cpd-stage-pill cpd-stage-pill--amber">No PAN — Form 97</span>
|
||||||
} @else if (isForm15gh && form15gh) {
|
} @else if (isForm15gh && form15gh) {
|
||||||
<span class="cpd-stage-pill cpd-stage-pill--teal">Form {{ form15gh.kind }}</span>
|
<span class="cpd-stage-pill cpd-stage-pill--teal">Form {{ form15gh.kind }}</span>
|
||||||
} @else if (isHypothecation && hypothecation) {
|
} @else if (isHypothecation && hypothecation) {
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
</p>
|
</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<!-- ── FORM 60 ── -->
|
<!-- ── FORM 97 ── -->
|
||||||
@if (isForm60 && form60) {
|
@if (isForm60 && form60) {
|
||||||
<p class="cpd-para">
|
<p class="cpd-para">
|
||||||
Declaration under <strong>Section 114B</strong> of the Income-tax Rules, 1962, to be made by a person who does
|
Declaration under <strong>Section 114B</strong> of the Income-tax Rules, 1962, to be made by a person who does
|
||||||
@@ -367,7 +367,7 @@
|
|||||||
<tr class="cpd-summary-total">
|
<tr class="cpd-summary-total">
|
||||||
<td colspan="3">PAN STATUS</td>
|
<td colspan="3">PAN STATUS</td>
|
||||||
<td>
|
<td>
|
||||||
<strong>NOT ALLOTTED — Form 60 declared</strong>
|
<strong>NOT ALLOTTED — Form 97 declared</strong>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
+2
-2
@@ -151,9 +151,9 @@ export class CertificatePreviewDialogComponent {
|
|||||||
case 'balance':
|
case 'balance':
|
||||||
return 'Balance Certificate';
|
return 'Balance Certificate';
|
||||||
case 'form60':
|
case 'form60':
|
||||||
return 'Form 60 Declaration';
|
return 'Form 97 Declaration';
|
||||||
case 'form15gh':
|
case 'form15gh':
|
||||||
return this.form15gh?.kind === '15H' ? 'Form 15H Declaration' : 'Form 15G Declaration';
|
return 'Form 121 Declaration';
|
||||||
case 'hypothecation':
|
case 'hypothecation':
|
||||||
return 'Hypothecation Certificate';
|
return 'Hypothecation Certificate';
|
||||||
case 'noc':
|
case 'noc':
|
||||||
|
|||||||
@@ -89,6 +89,43 @@
|
|||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cert-head-r {
|
||||||
|
margin-left: auto;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cert-cta-btn {
|
||||||
|
height: 38px;
|
||||||
|
padding: 0 16px;
|
||||||
|
border: 1px solid var(--cert-blue-d);
|
||||||
|
border-radius: 8px;
|
||||||
|
background: var(--cert-blue-d);
|
||||||
|
color: #fff;
|
||||||
|
font-size: 12.5px;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--cert-blue);
|
||||||
|
border-color: var(--cert-blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
&--muted {
|
||||||
|
background: #fff;
|
||||||
|
color: var(--cert-g700);
|
||||||
|
border-color: var(--cert-g200);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--cert-g50);
|
||||||
|
border-color: var(--cert-g300);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ───────── KPI strip ───────── */
|
/* ───────── KPI strip ───────── */
|
||||||
.cert-kpis {
|
.cert-kpis {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -11,11 +11,8 @@
|
|||||||
<div class="cert-head-l">
|
<div class="cert-head-l">
|
||||||
<fa-icon icon="file-signature" class="cert-head-ic"></fa-icon>
|
<fa-icon icon="file-signature" class="cert-head-ic"></fa-icon>
|
||||||
<div>
|
<div>
|
||||||
<h2 class="cert-head-t">Form 15G & 15H</h2>
|
<h2 class="cert-head-t">Form 121</h2>
|
||||||
<div class="cert-head-s">
|
<div class="cert-head-s">TDS-waiver declarations for FD / RD interest income — Form 121.</div>
|
||||||
TDS-waiver declarations for FD / RD interest income —
|
|
||||||
<strong>15G</strong> for individuals below 60 years, <strong>15H</strong> for senior citizens (60+).
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,14 +23,14 @@
|
|||||||
<fa-icon icon="user" class="cert-kpi-ic"></fa-icon>
|
<fa-icon icon="user" class="cert-kpi-ic"></fa-icon>
|
||||||
<div>
|
<div>
|
||||||
<div class="cert-kpi-n">{{ count15G() | number }}</div>
|
<div class="cert-kpi-n">{{ count15G() | number }}</div>
|
||||||
<div class="cert-kpi-l">Form 15G (under 60)</div>
|
<div class="cert-kpi-l">Form 121 (under 60)</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cert-kpi cert-kpi--amber">
|
<div class="cert-kpi cert-kpi--amber">
|
||||||
<fa-icon icon="user-tie" class="cert-kpi-ic"></fa-icon>
|
<fa-icon icon="user-tie" class="cert-kpi-ic"></fa-icon>
|
||||||
<div>
|
<div>
|
||||||
<div class="cert-kpi-n">{{ count15H() | number }}</div>
|
<div class="cert-kpi-n">{{ count15H() | number }}</div>
|
||||||
<div class="cert-kpi-l">Form 15H (60+)</div>
|
<div class="cert-kpi-l">Form 121 (60+)</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cert-kpi cert-kpi--green">
|
<div class="cert-kpi cert-kpi--green">
|
||||||
@@ -63,11 +60,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="cert-filter">
|
<div class="cert-filter">
|
||||||
<label>Form</label>
|
<label>Form Type</label>
|
||||||
<select [(ngModel)]="kindFilter">
|
<select [(ngModel)]="kindFilter">
|
||||||
<option value="">Both forms</option>
|
<option value="">All Form 121</option>
|
||||||
<option value="15G">15G — Under 60</option>
|
<option value="15G">Form 121 (Below 60 years)</option>
|
||||||
<option value="15H">15H — Senior citizens (60+)</option>
|
<option value="15H">Form 121 (Senior Citizen 60+)</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -92,7 +89,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Customer · PAN</th>
|
<th>Customer · PAN</th>
|
||||||
<th>Form</th>
|
<th>Form Type</th>
|
||||||
<th>Age</th>
|
<th>Age</th>
|
||||||
<th>Branch</th>
|
<th>Branch</th>
|
||||||
<th class="num">Deposit Principal</th>
|
<th class="num">Deposit Principal</th>
|
||||||
@@ -115,7 +112,7 @@
|
|||||||
[class.cert-pill--blue]="formKind(r) === '15G'"
|
[class.cert-pill--blue]="formKind(r) === '15G'"
|
||||||
[class.cert-pill--amber]="formKind(r) === '15H'"
|
[class.cert-pill--amber]="formKind(r) === '15H'"
|
||||||
>
|
>
|
||||||
Form {{ formKind(r) }}
|
Form 121 ({{ formKind(r) }})
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td class="small">{{ age(r.dob) }} yrs</td>
|
<td class="small">{{ age(r.dob) }} yrs</td>
|
||||||
|
|||||||
@@ -146,9 +146,9 @@ export class Form15ghComponent implements OnInit {
|
|||||||
const kind = this.formKind(r);
|
const kind = this.formKind(r);
|
||||||
this.dscSign.promptThenDownload(
|
this.dscSign.promptThenDownload(
|
||||||
{
|
{
|
||||||
title: `Form ${kind} Declaration`,
|
title: `Form 121 (${kind}) Declaration`,
|
||||||
reference: `${r.customerId} · ${r.customerName} · ${r.fy}`,
|
reference: `${r.customerId} · ${r.customerName} · ${r.fy}`,
|
||||||
filename: `Form-${kind}-${r.customerId}-${r.fy.replace(/\s+/g, '')}.pdf`
|
filename: `Form121-${r.customerId}-${r.fy.replace(/\s+/g, '')}.pdf`
|
||||||
},
|
},
|
||||||
(dsc) => downloadForm15ghPdf(r, kind, dsc)
|
(dsc) => downloadForm15ghPdf(r, kind, dsc)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<div class="cert-head-l">
|
<div class="cert-head-l">
|
||||||
<fa-icon icon="file-signature" class="cert-head-ic"></fa-icon>
|
<fa-icon icon="file-signature" class="cert-head-ic"></fa-icon>
|
||||||
<div>
|
<div>
|
||||||
<h2 class="cert-head-t">Form 60 Declaration</h2>
|
<h2 class="cert-head-t">Form 97 Declaration</h2>
|
||||||
<div class="cert-head-s">
|
<div class="cert-head-s">
|
||||||
Income Tax Rule 114B — required for any customer transacting above the threshold who does
|
Income Tax Rule 114B — required for any customer transacting above the threshold who does
|
||||||
<strong>not</strong> have a PAN on file.
|
<strong>not</strong> have a PAN on file.
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<fa-icon icon="check-circle" class="cert-kpi-ic"></fa-icon>
|
<fa-icon icon="check-circle" class="cert-kpi-ic"></fa-icon>
|
||||||
<div>
|
<div>
|
||||||
<div class="cert-kpi-n">{{ totalFiled() | number }}</div>
|
<div class="cert-kpi-n">{{ totalFiled() | number }}</div>
|
||||||
<div class="cert-kpi-l">Form 60 Filed</div>
|
<div class="cert-kpi-l">Form 97 Filed</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cert-kpi cert-kpi--amber">
|
<div class="cert-kpi cert-kpi--amber">
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
<div class="cert-filter">
|
<div class="cert-filter">
|
||||||
<label>PAN status</label>
|
<label>PAN status</label>
|
||||||
<select [(ngModel)]="panFilter">
|
<select [(ngModel)]="panFilter">
|
||||||
<option value="MISSING">Without PAN (Form 60 applicable)</option>
|
<option value="MISSING">Without PAN (Form 97 applicable)</option>
|
||||||
<option value="ON_FILE">With PAN on file</option>
|
<option value="ON_FILE">With PAN on file</option>
|
||||||
<option value="">All customers</option>
|
<option value="">All customers</option>
|
||||||
</select>
|
</select>
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
<th>Trigger Transaction</th>
|
<th>Trigger Transaction</th>
|
||||||
<th class="num">Amount</th>
|
<th class="num">Amount</th>
|
||||||
<th>PAN Status</th>
|
<th>PAN Status</th>
|
||||||
<th>Form 60</th>
|
<th>Form 97</th>
|
||||||
<th class="col-actions">Actions</th>
|
<th class="col-actions">Actions</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
class="cert-icon-btn primary"
|
class="cert-icon-btn primary"
|
||||||
[disabled]="r.hasPan"
|
[disabled]="r.hasPan"
|
||||||
(click)="viewCertificate(r)"
|
(click)="viewCertificate(r)"
|
||||||
matTooltip="View / Print Form 60"
|
matTooltip="View / Print Form 97"
|
||||||
>
|
>
|
||||||
<fa-icon icon="eye"></fa-icon>
|
<fa-icon icon="eye"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export class Form60Component implements OnInit {
|
|||||||
|
|
||||||
viewCertificate(r: Form60Record): void {
|
viewCertificate(r: Form60Record): void {
|
||||||
if (r.hasPan) {
|
if (r.hasPan) {
|
||||||
this.snack.open(`${r.customerName} already has a PAN on file — Form 60 is not applicable.`, 'OK', {
|
this.snack.open(`${r.customerName} already has a PAN on file — Form 97 is not applicable.`, 'OK', {
|
||||||
duration: 3200
|
duration: 3200
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@@ -139,14 +139,14 @@ export class Form60Component implements OnInit {
|
|||||||
|
|
||||||
downloadCertificate(r: Form60Record): void {
|
downloadCertificate(r: Form60Record): void {
|
||||||
if (r.hasPan) {
|
if (r.hasPan) {
|
||||||
this.snack.open(`${r.customerName} already has a PAN on file — Form 60 is not applicable.`, 'OK', {
|
this.snack.open(`${r.customerName} already has a PAN on file — Form 97 is not applicable.`, 'OK', {
|
||||||
duration: 3200
|
duration: 3200
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dscSign.promptThenDownload(
|
this.dscSign.promptThenDownload(
|
||||||
{
|
{
|
||||||
title: 'Form 60 Declaration',
|
title: 'Form 97 Declaration',
|
||||||
reference: `${r.customerId} · ${r.customerName}`,
|
reference: `${r.customerId} · ${r.customerName}`,
|
||||||
filename: `Form60-${r.customerId}.pdf`
|
filename: `Form60-${r.customerId}.pdf`
|
||||||
},
|
},
|
||||||
|
|||||||
+174
@@ -0,0 +1,174 @@
|
|||||||
|
<!--
|
||||||
|
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="rsad-root">
|
||||||
|
@if (loading) {
|
||||||
|
<div class="rsad-state">
|
||||||
|
<fa-icon icon="spinner" class="rsad-state-ic fa-spin"></fa-icon>
|
||||||
|
Loading real share accounts…
|
||||||
|
</div>
|
||||||
|
} @else if (loadError) {
|
||||||
|
<div class="rsad-state rsad-state--error">
|
||||||
|
<fa-icon icon="exclamation-triangle" class="rsad-state-ic"></fa-icon>
|
||||||
|
Could not load share accounts from the server.
|
||||||
|
<button type="button" class="cert-clear" (click)="retry()"><fa-icon icon="redo"></fa-icon> Retry</button>
|
||||||
|
</div>
|
||||||
|
} @else if (rows.length === 0) {
|
||||||
|
<div class="rsad-state">
|
||||||
|
<fa-icon icon="info-circle" class="rsad-state-ic"></fa-icon>
|
||||||
|
No share accounts found in m_share_account yet.
|
||||||
|
</div>
|
||||||
|
} @else {
|
||||||
|
<!-- KPI STRIP -->
|
||||||
|
<div class="cert-kpis">
|
||||||
|
<div class="cert-kpi cert-kpi--blue">
|
||||||
|
<fa-icon icon="certificate" class="cert-kpi-ic"></fa-icon>
|
||||||
|
<div>
|
||||||
|
<div class="cert-kpi-n">{{ filteredRows.length | number }}</div>
|
||||||
|
<div class="cert-kpi-l">Certificates</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cert-kpi cert-kpi--teal">
|
||||||
|
<fa-icon icon="cube" class="cert-kpi-ic"></fa-icon>
|
||||||
|
<div>
|
||||||
|
<div class="cert-kpi-n">{{ totalShares() | number }}</div>
|
||||||
|
<div class="cert-kpi-l">Shares Held</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="cert-kpi cert-kpi--green">
|
||||||
|
<fa-icon icon="coins" class="cert-kpi-ic"></fa-icon>
|
||||||
|
<div>
|
||||||
|
<div class="cert-kpi-n">₹{{ totalShareValue() | number: '1.0-0' }}</div>
|
||||||
|
<div class="cert-kpi-l">Total Face Value</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FILTERS -->
|
||||||
|
<div class="cert-filters">
|
||||||
|
<div class="cert-filter">
|
||||||
|
<label>Certificate / Folio / Member / PAN</label>
|
||||||
|
<div class="cert-input-ic">
|
||||||
|
<fa-icon icon="search"></fa-icon>
|
||||||
|
<input type="text" [(ngModel)]="search" placeholder="e.g. member name" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cert-filter">
|
||||||
|
<label>Share class</label>
|
||||||
|
<select [(ngModel)]="classFilter">
|
||||||
|
<option value="">All classes</option>
|
||||||
|
@for (o of classOptions; track o.value) {
|
||||||
|
<option [value]="o.value">{{ o.label }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cert-filter">
|
||||||
|
<label>Branch</label>
|
||||||
|
<select [(ngModel)]="branchFilter">
|
||||||
|
<option value="">All branches</option>
|
||||||
|
@for (b of branchOptions; track b) {
|
||||||
|
<option [value]="b">{{ b }}</option>
|
||||||
|
}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (search || classFilter || branchFilter) {
|
||||||
|
<button type="button" class="cert-clear" (click)="clearFilters()">
|
||||||
|
<fa-icon icon="times"></fa-icon> Clear
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- TABLE -->
|
||||||
|
<div class="cert-card">
|
||||||
|
<div class="cert-table-wrap">
|
||||||
|
<table class="cert-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Member · Folio</th>
|
||||||
|
<th>Certificate No.</th>
|
||||||
|
<th>Class</th>
|
||||||
|
<th>Branch</th>
|
||||||
|
<th class="num">Shares</th>
|
||||||
|
<th class="num">Face Value</th>
|
||||||
|
<th class="num">Total</th>
|
||||||
|
<th>Share Nos.</th>
|
||||||
|
<th>Issued</th>
|
||||||
|
<th class="col-actions">Actions</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@for (row of filteredRows; track row.record.certificateNo) {
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<div class="cert-cust-name">{{ row.record.memberName }}</div>
|
||||||
|
<div class="mono small muted">
|
||||||
|
{{ row.record.memberId }} · Folio <span class="cert-folio">{{ row.record.folioNo }}</span> · PAN
|
||||||
|
{{ row.record.memberPan }}
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td class="mono">{{ row.record.certificateNo }}</td>
|
||||||
|
<td>
|
||||||
|
<span
|
||||||
|
class="cert-pill"
|
||||||
|
[class.cert-pill--blue]="row.record.shareClass === 'ORDINARY'"
|
||||||
|
[class.cert-pill--amber]="row.record.shareClass === 'PREFERENCE'"
|
||||||
|
>
|
||||||
|
{{ classLabel(row.record.shareClass) }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td class="small">{{ row.record.branch || '—' }}</td>
|
||||||
|
<td class="num">
|
||||||
|
<strong class="cert-shares">{{ row.record.shareCount | number }}</strong>
|
||||||
|
</td>
|
||||||
|
<td class="num">₹{{ row.record.faceValue | number: '1.0-0' }}</td>
|
||||||
|
<td class="num">
|
||||||
|
<strong>₹{{ row.record.shareCount * row.record.faceValue | number: '1.0-0' }}</strong>
|
||||||
|
</td>
|
||||||
|
<td class="mono small">
|
||||||
|
{{ row.record.shareNoFrom | number }}–{{ row.record.shareNoTo | number }}
|
||||||
|
</td>
|
||||||
|
<td class="small">{{ row.record.issueDate | date: 'd MMM y' }}</td>
|
||||||
|
<td class="col-actions">
|
||||||
|
<div class="cert-row-actions">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="cert-icon-btn primary"
|
||||||
|
(click)="viewCertificate(row)"
|
||||||
|
matTooltip="View / Print certificate"
|
||||||
|
>
|
||||||
|
<fa-icon icon="eye"></fa-icon>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="cert-icon-btn"
|
||||||
|
(click)="downloadCertificate(row)"
|
||||||
|
matTooltip="Download PDF"
|
||||||
|
>
|
||||||
|
<fa-icon icon="download"></fa-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
@if (filteredRows.length === 0) {
|
||||||
|
<tr>
|
||||||
|
<td colspan="10" class="cert-empty">
|
||||||
|
<fa-icon icon="info-circle"></fa-icon>
|
||||||
|
No share accounts match the current filters.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.rsad-state {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 48px 20px;
|
||||||
|
color: var(--cert-g500);
|
||||||
|
font-size: 13.5px;
|
||||||
|
|
||||||
|
&--error {
|
||||||
|
color: var(--cert-red);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rsad-state-ic {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
+312
@@ -0,0 +1,312 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnInit, inject } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FormsModule } from '@angular/forms';
|
||||||
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
|
import { MatTooltip } from '@angular/material/tooltip';
|
||||||
|
import { forkJoin, of, Observable } from 'rxjs';
|
||||||
|
import { catchError, map, shareReplay, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
|
import { SharesService } from '../../../../shares/shares.service';
|
||||||
|
import { ClientsService } from '../../../../clients/clients.service';
|
||||||
|
import { ShareCertificateDialogComponent } from '../../../../shares/shares-account-view/share-certificate-dialog/share-certificate-dialog.component';
|
||||||
|
import { downloadShareCertificatePdf } from '../../certificate-pdf';
|
||||||
|
import { DscSignService } from '../../../dsc-sign-dialog/dsc-sign.service';
|
||||||
|
import type { ShareClass, ShareCertificateRecord } from '../share-certificate.component';
|
||||||
|
|
||||||
|
/** A real share account, kept alongside the raw API payload needed to open the real certificate dialog. */
|
||||||
|
export interface RealShareAccountRow {
|
||||||
|
record: ShareCertificateRecord;
|
||||||
|
sharesAccountData: any;
|
||||||
|
clientId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-real-share-accounts-view',
|
||||||
|
templateUrl: './real-share-accounts-view.component.html',
|
||||||
|
styleUrls: [
|
||||||
|
'../../certificates.shared.scss',
|
||||||
|
'./real-share-accounts-view.component.scss'
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
FormsModule,
|
||||||
|
FaIconComponent,
|
||||||
|
MatTooltip
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class RealShareAccountsViewComponent implements OnInit {
|
||||||
|
private dialog = inject(MatDialog);
|
||||||
|
private sharesService = inject(SharesService);
|
||||||
|
private clientsService = inject(ClientsService);
|
||||||
|
private dscSign = inject(DscSignService);
|
||||||
|
|
||||||
|
loading = true;
|
||||||
|
loadError = false;
|
||||||
|
rows: RealShareAccountRow[] = [];
|
||||||
|
|
||||||
|
// ── Filters (mirrors the demo list above) ──
|
||||||
|
search = '';
|
||||||
|
classFilter: '' | ShareClass = '';
|
||||||
|
branchFilter = '';
|
||||||
|
|
||||||
|
readonly classOptions: { value: ShareClass; label: string }[] = [
|
||||||
|
{ value: 'ORDINARY', label: 'Ordinary' },
|
||||||
|
{ value: 'PREFERENCE', label: 'Preference' }
|
||||||
|
];
|
||||||
|
|
||||||
|
// Per-client caches so accounts sharing the same client (a common case — one
|
||||||
|
// member can hold several share accounts) only fetch that client once.
|
||||||
|
private clientDataCache = new Map<string, Observable<any>>();
|
||||||
|
private clientIdentifiersCache = new Map<string, Observable<any>>();
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.loadRealAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadRealAccounts(): void {
|
||||||
|
this.loading = true;
|
||||||
|
this.loadError = false;
|
||||||
|
this.clientDataCache.clear();
|
||||||
|
this.clientIdentifiersCache.clear();
|
||||||
|
this.sharesService
|
||||||
|
.getAllShareAccounts(0, 200)
|
||||||
|
.pipe(
|
||||||
|
map((page: any) => page?.pageItems || page?.content || (Array.isArray(page) ? page : [])),
|
||||||
|
switchMap((items: any[]) => {
|
||||||
|
if (!items.length) {
|
||||||
|
return of([] as RealShareAccountRow[]);
|
||||||
|
}
|
||||||
|
return forkJoin(items.map((item) => this.buildRow(item))).pipe(
|
||||||
|
map((rows) => rows.filter((r): r is RealShareAccountRow => !!r))
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
catchError(() => {
|
||||||
|
this.loadError = true;
|
||||||
|
return of([] as RealShareAccountRow[]);
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe((rows) => {
|
||||||
|
this.rows = rows;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The share-account list already carries clientId/clientName (same mapper as the
|
||||||
|
* single-account read), so the account detail call and the client calls can fire
|
||||||
|
* together instead of waiting on each other — halving the round trips on the
|
||||||
|
* critical path.
|
||||||
|
*/
|
||||||
|
private buildRow(listItem: any): Observable<RealShareAccountRow | null> {
|
||||||
|
const clientId = listItem?.clientId != null ? String(listItem.clientId) : null;
|
||||||
|
return forkJoin({
|
||||||
|
sa: this.sharesService.getSharesAccountData(String(listItem.id), false),
|
||||||
|
client: clientId ? this.getClientDataCached(clientId) : of(null),
|
||||||
|
identifiers: clientId ? this.getClientIdentifiersCached(clientId) : of([])
|
||||||
|
}).pipe(
|
||||||
|
switchMap(({ sa, client, identifiers }) => {
|
||||||
|
// Defensive fallback if the list payload didn't carry clientId for some reason.
|
||||||
|
if (clientId || !sa?.clientId) {
|
||||||
|
return of({ sa, client, identifiers });
|
||||||
|
}
|
||||||
|
const fallbackClientId = String(sa.clientId);
|
||||||
|
return forkJoin({
|
||||||
|
sa: of(sa),
|
||||||
|
client: this.getClientDataCached(fallbackClientId),
|
||||||
|
identifiers: this.getClientIdentifiersCached(fallbackClientId)
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
map(({ sa, client, identifiers }: any) => ({
|
||||||
|
record: this.mapToRecord(sa, client, identifiers),
|
||||||
|
sharesAccountData: sa,
|
||||||
|
clientId: String(sa.clientId)
|
||||||
|
})),
|
||||||
|
catchError(() => of(null))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getClientDataCached(clientId: string): Observable<any> {
|
||||||
|
if (!this.clientDataCache.has(clientId)) {
|
||||||
|
this.clientDataCache.set(
|
||||||
|
clientId,
|
||||||
|
this.clientsService.getClientData(clientId).pipe(
|
||||||
|
catchError(() => of(null)),
|
||||||
|
shareReplay(1)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return this.clientDataCache.get(clientId)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getClientIdentifiersCached(clientId: string): Observable<any> {
|
||||||
|
if (!this.clientIdentifiersCache.has(clientId)) {
|
||||||
|
this.clientIdentifiersCache.set(
|
||||||
|
clientId,
|
||||||
|
this.clientsService.getClientIdentifiers(clientId).pipe(
|
||||||
|
catchError(() => of([])),
|
||||||
|
shareReplay(1)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return this.clientIdentifiersCache.get(clientId)!;
|
||||||
|
}
|
||||||
|
|
||||||
|
private mapToRecord(sa: any, client: any, identifiers: any): ShareCertificateRecord {
|
||||||
|
const approvedShares = sa.summary?.totalApprovedShares || 0;
|
||||||
|
const faceValue = sa.currentMarketPrice || 0;
|
||||||
|
const issueDate = this.toIsoDate(sa.timeline?.activatedDate) || this.toIsoDate(sa.timeline?.approvedDate) || '';
|
||||||
|
const joiningDate =
|
||||||
|
this.toIsoDate(client?.activationDate) || this.toIsoDate(client?.timeline?.submittedOnDate) || issueDate;
|
||||||
|
|
||||||
|
const startNum = sa.id * 5000 + 201;
|
||||||
|
const endNum = startNum + approvedShares - 1;
|
||||||
|
|
||||||
|
const idList = Array.isArray(identifiers) ? identifiers : identifiers?.pageItems || [];
|
||||||
|
const panId = idList.find((i: any) => /pan/i.test(i?.documentType?.name || ''));
|
||||||
|
const memberPan = panId ? panId.documentKey : '—';
|
||||||
|
|
||||||
|
const dividendYtd = (sa.dividends || []).reduce((sum: number, d: any) => sum + (d.amount || 0), 0);
|
||||||
|
|
||||||
|
return {
|
||||||
|
certificateNo: `SC-2026-${sa.accountNo || String(sa.id).padStart(6, '0')}`,
|
||||||
|
folioNo: `F-${client?.accountNo || String(client?.id ?? sa.clientId).padStart(5, '0')}`,
|
||||||
|
memberId: client?.accountNo || '',
|
||||||
|
memberName: sa.clientName || client?.displayName || '',
|
||||||
|
memberPan,
|
||||||
|
// Address isn't shown in this table — fetched on demand when a PDF is downloaded.
|
||||||
|
memberAddress: '',
|
||||||
|
branch: client?.officeName || '',
|
||||||
|
joiningDate,
|
||||||
|
shareClass: /prefer/i.test(sa.productName || '') ? 'PREFERENCE' : 'ORDINARY',
|
||||||
|
shareCount: approvedShares,
|
||||||
|
faceValue,
|
||||||
|
issueDate,
|
||||||
|
shareNoFrom: startNum,
|
||||||
|
shareNoTo: approvedShares > 0 ? endNum : startNum,
|
||||||
|
dividendYtd
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private toIsoDate(value: any): string {
|
||||||
|
if (!value) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if (Array.isArray(value)) {
|
||||||
|
const [
|
||||||
|
y,
|
||||||
|
m,
|
||||||
|
d
|
||||||
|
] = value;
|
||||||
|
if (!y) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return `${y}-${String(m || 1).padStart(2, '0')}-${String(d || 1).padStart(2, '0')}`;
|
||||||
|
}
|
||||||
|
return String(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private formatAddress(addr: any): string {
|
||||||
|
if (!addr) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
addr.addressLine1,
|
||||||
|
addr.addressLine2,
|
||||||
|
addr.townVillage,
|
||||||
|
addr.city,
|
||||||
|
addr.stateName,
|
||||||
|
addr.countryName,
|
||||||
|
addr.postalCode
|
||||||
|
]
|
||||||
|
.filter((p) => !!p && String(p).trim())
|
||||||
|
.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Derived list (identical shape to the demo table above) ──
|
||||||
|
get filteredRows(): RealShareAccountRow[] {
|
||||||
|
const q = this.search.trim().toLowerCase();
|
||||||
|
const branch = this.branchFilter.trim().toLowerCase();
|
||||||
|
return this.rows.filter(({ record: r }) => {
|
||||||
|
if (this.classFilter && r.shareClass !== this.classFilter) return false;
|
||||||
|
if (branch && !r.branch.toLowerCase().includes(branch)) return false;
|
||||||
|
if (!q) return true;
|
||||||
|
return (
|
||||||
|
r.certificateNo.toLowerCase().includes(q) ||
|
||||||
|
r.folioNo.toLowerCase().includes(q) ||
|
||||||
|
r.memberId.toLowerCase().includes(q) ||
|
||||||
|
r.memberName.toLowerCase().includes(q) ||
|
||||||
|
r.memberPan.toLowerCase().includes(q)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get branchOptions(): string[] {
|
||||||
|
return Array.from(new Set(this.rows.map((row) => row.record.branch).filter(Boolean))).sort();
|
||||||
|
}
|
||||||
|
|
||||||
|
classLabel(c: ShareClass): string {
|
||||||
|
return this.classOptions.find((o) => o.value === c)?.label || c;
|
||||||
|
}
|
||||||
|
|
||||||
|
totalShares(): number {
|
||||||
|
return this.filteredRows.reduce((s, { record: r }) => s + r.shareCount, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
totalShareValue(): number {
|
||||||
|
return this.filteredRows.reduce((s, { record: r }) => s + r.shareCount * r.faceValue, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearFilters(): void {
|
||||||
|
this.search = '';
|
||||||
|
this.classFilter = '';
|
||||||
|
this.branchFilter = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
retry(): void {
|
||||||
|
this.loadRealAccounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Opens the same certificate dialog used from Client → Share Account → Share Certificate. */
|
||||||
|
viewCertificate(row: RealShareAccountRow): void {
|
||||||
|
this.dialog.open(ShareCertificateDialogComponent, {
|
||||||
|
data: {
|
||||||
|
sharesAccountData: row.sharesAccountData,
|
||||||
|
clientId: row.clientId
|
||||||
|
},
|
||||||
|
width: '850px',
|
||||||
|
maxWidth: '95vw'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Downloads the certificate as a PDF. Address is fetched here (only place it's needed). */
|
||||||
|
downloadCertificate(row: RealShareAccountRow): void {
|
||||||
|
this.clientsService
|
||||||
|
.getClientAddressData(row.clientId)
|
||||||
|
.pipe(catchError(() => of([])))
|
||||||
|
.subscribe((addresses: any) => {
|
||||||
|
const addrList = Array.isArray(addresses) ? addresses : [];
|
||||||
|
const permanent = addrList.find((a: any) => /permanent/i.test(a?.addressType || '')) || addrList[0];
|
||||||
|
const r: ShareCertificateRecord = {
|
||||||
|
...row.record,
|
||||||
|
memberAddress: permanent ? this.formatAddress(permanent) : row.record.memberAddress
|
||||||
|
};
|
||||||
|
this.dscSign.promptThenDownload(
|
||||||
|
{
|
||||||
|
title: 'Share Certificate',
|
||||||
|
reference: `${r.certificateNo} · Folio ${r.folioNo} · ${r.memberName}`,
|
||||||
|
filename: `Share-Certificate-${r.certificateNo}.pdf`
|
||||||
|
},
|
||||||
|
(dsc) => downloadShareCertificatePdf(r, dsc)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
-1
@@ -14,13 +14,43 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2 class="cert-head-t">Share Certificate</h2>
|
<h2 class="cert-head-t">Share Certificate</h2>
|
||||||
<div class="cert-head-s">
|
<div class="cert-head-s">
|
||||||
|
@if (viewMode === 'demo') {
|
||||||
Issue, preview and download member share certificates with folio + share-number range.
|
Issue, preview and download member share certificates with folio + share-number range.
|
||||||
|
} @else {
|
||||||
|
Live holder details and certificates, sourced from m_share_account.
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="cert-head-r">
|
||||||
|
@if (viewMode === 'demo') {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="cert-cta-btn"
|
||||||
|
(click)="toggleViewMode()"
|
||||||
|
matTooltip="Same fields and certificate, using real m_share_account data"
|
||||||
|
>
|
||||||
|
<fa-icon icon="database"></fa-icon> Real Share Accounts
|
||||||
|
</button>
|
||||||
|
} @else {
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="cert-cta-btn cert-cta-btn--muted"
|
||||||
|
(click)="toggleViewMode()"
|
||||||
|
matTooltip="Back to the sample data page"
|
||||||
|
>
|
||||||
|
<fa-icon icon="table"></fa-icon> Sample Data
|
||||||
|
</button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (viewMode === 'real') {
|
||||||
|
<mifosx-real-share-accounts-view></mifosx-real-share-accounts-view>
|
||||||
|
}
|
||||||
|
|
||||||
<!-- KPI STRIP -->
|
<!-- KPI STRIP -->
|
||||||
|
@if (viewMode === 'demo') {
|
||||||
<div class="cert-kpis">
|
<div class="cert-kpis">
|
||||||
<div class="cert-kpi cert-kpi--blue">
|
<div class="cert-kpi cert-kpi--blue">
|
||||||
<fa-icon icon="certificate" class="cert-kpi-ic"></fa-icon>
|
<fa-icon icon="certificate" class="cert-kpi-ic"></fa-icon>
|
||||||
@@ -76,7 +106,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (search || classFilter || branchFilter) {
|
@if (search || classFilter || branchFilter) {
|
||||||
<button type="button" class="cert-clear" (click)="clearFilters()"><fa-icon icon="times"></fa-icon> Clear</button>
|
<button type="button" class="cert-clear" (click)="clearFilters()">
|
||||||
|
<fa-icon icon="times"></fa-icon> Clear
|
||||||
|
</button>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -161,4 +193,5 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
|
} from '../certificate-preview-dialog/certificate-preview-dialog.component';
|
||||||
import { downloadShareCertificatePdf } from '../certificate-pdf';
|
import { downloadShareCertificatePdf } from '../certificate-pdf';
|
||||||
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
|
import { DscSignService } from '../../dsc-sign-dialog/dsc-sign.service';
|
||||||
|
import { RealShareAccountsViewComponent } from './real-share-accounts-view/real-share-accounts-view.component';
|
||||||
|
|
||||||
export type ShareClass = 'ORDINARY' | 'PREFERENCE';
|
export type ShareClass = 'ORDINARY' | 'PREFERENCE';
|
||||||
|
|
||||||
@@ -53,7 +54,8 @@ export interface ShareCertificateRecord {
|
|||||||
CommonModule,
|
CommonModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
MatTooltip
|
MatTooltip,
|
||||||
|
RealShareAccountsViewComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ShareCertificateComponent implements OnInit {
|
export class ShareCertificateComponent implements OnInit {
|
||||||
@@ -61,6 +63,9 @@ export class ShareCertificateComponent implements OnInit {
|
|||||||
private snack = inject(MatSnackBar);
|
private snack = inject(MatSnackBar);
|
||||||
private dscSign = inject(DscSignService);
|
private dscSign = inject(DscSignService);
|
||||||
|
|
||||||
|
/** Toggles between the static sample table and the live m_share_account view. */
|
||||||
|
viewMode: 'demo' | 'real' = 'demo';
|
||||||
|
|
||||||
// ── Filters ──
|
// ── Filters ──
|
||||||
search = '';
|
search = '';
|
||||||
classFilter: '' | ShareClass = '';
|
classFilter: '' | ShareClass = '';
|
||||||
@@ -143,6 +148,11 @@ export class ShareCertificateComponent implements OnInit {
|
|||||||
(dsc) => downloadShareCertificatePdf(r, dsc)
|
(dsc) => downloadShareCertificatePdf(r, dsc)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Switches between the static sample table and the live m_share_account view. */
|
||||||
|
toggleViewMode(): void {
|
||||||
|
this.viewMode = this.viewMode === 'demo' ? 'real' : 'demo';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ───────────────────── Mock seed (top-level export) ─────────────────────
|
// ───────────────────── Mock seed (top-level export) ─────────────────────
|
||||||
|
|||||||
@@ -44,12 +44,12 @@ const routes: Routes = [
|
|||||||
{
|
{
|
||||||
path: 'letter-mgmt/form-60',
|
path: 'letter-mgmt/form-60',
|
||||||
component: Form60Component,
|
component: Form60Component,
|
||||||
data: { title: 'Form 60', breadcrumb: 'Form 60' }
|
data: { title: 'Form 97', breadcrumb: 'Form 97' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'letter-mgmt/form-15gh',
|
path: 'letter-mgmt/form-15gh',
|
||||||
component: Form15ghComponent,
|
component: Form15ghComponent,
|
||||||
data: { title: 'Form 15G & 15H', breadcrumb: 'Form 15G/H' }
|
data: { title: 'Form 121', breadcrumb: 'Form 121' }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'letter-mgmt/hypothecation-certificate',
|
path: 'letter-mgmt/hypothecation-certificate',
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
<!--
|
||||||
|
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="container aml-rules-container">
|
||||||
|
<mat-card class="aml-card">
|
||||||
|
<mat-card-header class="aml-card-header">
|
||||||
|
<div class="aml-header-content">
|
||||||
|
<mat-icon class="header-icon">shield</mat-icon>
|
||||||
|
<div>
|
||||||
|
<mat-card-title class="header-title">AML Rules Master</mat-card-title>
|
||||||
|
<mat-card-subtitle class="header-subtitle">
|
||||||
|
Database-driven rules for client risk categorization and AML compliance checks
|
||||||
|
</mat-card-subtitle>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mat-card-header>
|
||||||
|
|
||||||
|
<mat-card-content class="aml-card-content">
|
||||||
|
<table mat-table [dataSource]="rules" class="aml-table mat-elevation-z1">
|
||||||
|
<!-- Order Position Column -->
|
||||||
|
<ng-container matColumnDef="orderPosition">
|
||||||
|
<th mat-header-cell *matHeaderCellDef class="col-center">Rule Srno</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="col-center">{{ element.orderPosition }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Rule Name Column -->
|
||||||
|
<ng-container matColumnDef="ruleName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Rule Description</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="rule-name-cell">{{ element.ruleName }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Risk Category Column -->
|
||||||
|
<ng-container matColumnDef="riskCategory">
|
||||||
|
<th mat-header-cell *matHeaderCellDef class="col-center">Risk Category</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="col-center">
|
||||||
|
<span class="risk-badge" [ngClass]="getRiskColorClass(element.riskCategory)">
|
||||||
|
<span class="dot"></span>
|
||||||
|
{{ getRiskCategoryLabel(element.riskCategory) }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Reason Column -->
|
||||||
|
<ng-container matColumnDef="reason">
|
||||||
|
<th mat-header-cell *matHeaderCellDef>Rule Reason / Criteria</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="reason-cell">{{ element.reason }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- AML Check Status Column -->
|
||||||
|
<ng-container matColumnDef="amlCheckStatus">
|
||||||
|
<th mat-header-cell *matHeaderCellDef class="col-center">AML Check Status</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="col-center">
|
||||||
|
<span class="compliance-badge" [ngClass]="'status-' + (element.amlCheckStatus || 'clear').toLowerCase()">
|
||||||
|
{{ element.amlCheckStatus || 'CLEAR' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Banned Entity Match Column -->
|
||||||
|
<ng-container matColumnDef="bannedEntityMatch">
|
||||||
|
<th mat-header-cell *matHeaderCellDef class="col-center">Banned Match</th>
|
||||||
|
<td mat-cell *matCellDef="let element" class="col-center">
|
||||||
|
<span class="compliance-badge" [ngClass]="'match-' + (element.bannedEntityMatch || 'no').toLowerCase()">
|
||||||
|
{{ element.bannedEntityMatch || 'NO' }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<tr mat-row *matRowDef="let row; columns: displayedColumns" class="rule-row"></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- Mat Paginator for standard pagination -->
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons class="aml-paginator"></mat-paginator>
|
||||||
|
|
||||||
|
<div *ngIf="rules.data.length === 0" class="no-rules-message">
|
||||||
|
<mat-icon>info_outline</mat-icon>
|
||||||
|
<span>No AML rules found in the database.</span>
|
||||||
|
</div>
|
||||||
|
</mat-card-content>
|
||||||
|
</mat-card>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.aml-rules-container {
|
||||||
|
padding: 24px;
|
||||||
|
background-color: var(--bg-neutral-light, #f8fafc);
|
||||||
|
min-height: calc(100vh - 64px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-card {
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow:
|
||||||
|
0 4px 20px -2px rgb(0 0 0 / 5%),
|
||||||
|
0 2px 8px -1px rgb(0 0 0 / 3%);
|
||||||
|
border: 1px solid rgb(226 232 240 / 80%);
|
||||||
|
background: #fff;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-card-header {
|
||||||
|
background: linear-gradient(135deg, #1e293b, #0f172a);
|
||||||
|
color: #fff;
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-header-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16px;
|
||||||
|
|
||||||
|
.header-icon {
|
||||||
|
font-size: 32px;
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
color: #38bdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
color: #fff;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-subtitle {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #94a3b8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-card-content {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid #e2e8f0;
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: #f1f5f9;
|
||||||
|
color: #475569;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
padding: 16px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
border-bottom: 1px solid #cbd5e1;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #334155;
|
||||||
|
border-bottom: 1px solid #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rule-row {
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #f8fafc;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:last-child td {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.col-center {
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rule-name-cell {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #1e293b;
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reason-cell {
|
||||||
|
color: #64748b;
|
||||||
|
font-size: 13px;
|
||||||
|
max-width: 400px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Badges for Risk Category */
|
||||||
|
.risk-badge {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.risk-high {
|
||||||
|
background-color: #fef2f2;
|
||||||
|
color: #ef4444;
|
||||||
|
border: 1px solid #fee2e2;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
background-color: #ef4444;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.risk-medium {
|
||||||
|
background-color: #fffbeb;
|
||||||
|
color: #d97706;
|
||||||
|
border: 1px solid #fef3c7;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
background-color: #d97706;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.risk-low {
|
||||||
|
background-color: #f0fdf4;
|
||||||
|
color: #16a34a;
|
||||||
|
border: 1px solid #dcfce7;
|
||||||
|
|
||||||
|
.dot {
|
||||||
|
background-color: #16a34a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Badges for Compliance status */
|
||||||
|
.compliance-badge {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
|
||||||
|
/* AML Statuses */
|
||||||
|
&.status-clear {
|
||||||
|
background-color: #dcfce7;
|
||||||
|
color: #15803d;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-flagged {
|
||||||
|
background-color: #fef3c7;
|
||||||
|
color: #b45309;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.status-blocked {
|
||||||
|
background-color: #fee2e2;
|
||||||
|
color: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Banned Matches */
|
||||||
|
&.match-no {
|
||||||
|
background-color: #f1f5f9;
|
||||||
|
color: #475569;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.match-yes {
|
||||||
|
background-color: #fee2e2;
|
||||||
|
color: #b91c1c;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.match-partial_match {
|
||||||
|
background-color: #ffedd5;
|
||||||
|
color: #c2410c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-rules-message {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 48px;
|
||||||
|
color: #64748b;
|
||||||
|
gap: 12px;
|
||||||
|
|
||||||
|
mat-icon {
|
||||||
|
font-size: 48px;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.aml-paginator {
|
||||||
|
background: #fff;
|
||||||
|
border-top: 1px solid #e2e8f0;
|
||||||
|
padding: 8px 0;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #475569;
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnInit, inject, ViewChild } from '@angular/core';
|
||||||
|
import { MatTableModule, MatTableDataSource } from '@angular/material/table';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||||
|
import { MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ClientsService } from '../../clients/clients.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-aml-rules',
|
||||||
|
templateUrl: './aml-rules.component.html',
|
||||||
|
styleUrls: ['./aml-rules.component.scss'],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatCheckboxModule,
|
||||||
|
MatPaginatorModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AmlRulesComponent implements OnInit {
|
||||||
|
private clientsService = inject(ClientsService);
|
||||||
|
|
||||||
|
rules = new MatTableDataSource<any>([]);
|
||||||
|
displayedColumns: string[] = [
|
||||||
|
'orderPosition',
|
||||||
|
'ruleName',
|
||||||
|
'riskCategory',
|
||||||
|
'reason',
|
||||||
|
'amlCheckStatus',
|
||||||
|
'bannedEntityMatch'
|
||||||
|
];
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator) paginator!: MatPaginator;
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.clientsService.getClientRiskRules().subscribe({
|
||||||
|
next: (data) => {
|
||||||
|
this.rules.data = data || [];
|
||||||
|
this.rules.paginator = this.paginator;
|
||||||
|
},
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getRiskCategoryLabel(category: number): string {
|
||||||
|
switch (category) {
|
||||||
|
case 1:
|
||||||
|
return 'Low Risk';
|
||||||
|
case 2:
|
||||||
|
return 'Medium Risk';
|
||||||
|
case 3:
|
||||||
|
return 'High Risk';
|
||||||
|
default:
|
||||||
|
return 'Unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getRiskColorClass(category: number): string {
|
||||||
|
switch (category) {
|
||||||
|
case 1:
|
||||||
|
return 'risk-low';
|
||||||
|
case 2:
|
||||||
|
return 'risk-medium';
|
||||||
|
case 3:
|
||||||
|
return 'risk-high';
|
||||||
|
default:
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@ import { Routes, RouterModule } from '@angular/router';
|
|||||||
|
|
||||||
import { Route } from '../core/route/route.service';
|
import { Route } from '../core/route/route.service';
|
||||||
import { RbiCircularsComponent } from './rbi-circulars.component';
|
import { RbiCircularsComponent } from './rbi-circulars.component';
|
||||||
|
import { AmlRulesComponent } from './aml-rules/aml-rules.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
Route.withShell([
|
Route.withShell([
|
||||||
@@ -18,6 +19,11 @@ const routes: Routes = [
|
|||||||
path: 'rbi-circulars',
|
path: 'rbi-circulars',
|
||||||
component: RbiCircularsComponent,
|
component: RbiCircularsComponent,
|
||||||
data: { title: 'RBI Circulars', breadcrumb: 'RBI Circulars' }
|
data: { title: 'RBI Circulars', breadcrumb: 'RBI Circulars' }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'rbi/aml',
|
||||||
|
component: AmlRulesComponent,
|
||||||
|
data: { title: 'AML Rules Master', breadcrumb: 'AML Rules Master' }
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="sav-view">
|
<div class="sav-view">
|
||||||
|
<!-- ─── Dormancy risk alert (only when subStatus has left Active) ──── -->
|
||||||
|
<mifosx-dormancy-alert-panel [accountData]="savingsAccountData"></mifosx-dormancy-alert-panel>
|
||||||
|
|
||||||
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
<!-- ─── Gradient hero header ─────────────────────────────────────── -->
|
||||||
<header class="sav-hero">
|
<header class="sav-hero">
|
||||||
<div class="sav-hero__left">
|
<div class="sav-hero__left">
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { AccountsService } from 'app/accounts/accounts.service';
|
import { AccountsService } from 'app/accounts/accounts.service';
|
||||||
import { SettingsService } from 'app/settings/settings.service';
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
import { Dates } from 'app/core/utils/dates';
|
import { Dates } from 'app/core/utils/dates';
|
||||||
|
import { AuthenticationService } from '../../core/authentication/authentication.service';
|
||||||
|
|
||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
@@ -41,6 +42,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|||||||
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
import { MatTabNav, MatTabLink, MatTabNavPanel } from '@angular/material/tabs';
|
||||||
import { StatusLookupPipe } from '../../pipes/status-lookup.pipe';
|
import { StatusLookupPipe } from '../../pipes/status-lookup.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DormancyAlertPanelComponent } from 'app/shared/dormancy-alert-panel/dormancy-alert-panel.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Account View Component
|
* Savings Account View Component
|
||||||
@@ -70,7 +72,8 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
MatTabNavPanel,
|
MatTabNavPanel,
|
||||||
RouterOutlet,
|
RouterOutlet,
|
||||||
CurrencyPipe,
|
CurrencyPipe,
|
||||||
StatusLookupPipe
|
StatusLookupPipe,
|
||||||
|
DormancyAlertPanelComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SavingsAccountViewComponent implements OnInit {
|
export class SavingsAccountViewComponent implements OnInit {
|
||||||
@@ -81,6 +84,7 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
private accountsService = inject(AccountsService);
|
private accountsService = inject(AccountsService);
|
||||||
private settingsService = inject(SettingsService);
|
private settingsService = inject(SettingsService);
|
||||||
private dateUtils = inject(Dates);
|
private dateUtils = inject(Dates);
|
||||||
|
private authenticationService = inject(AuthenticationService);
|
||||||
dialog = inject(MatDialog);
|
dialog = inject(MatDialog);
|
||||||
|
|
||||||
/** Savings Account Data */
|
/** Savings Account Data */
|
||||||
@@ -268,6 +272,14 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this.authenticationService.hasCashierRole()) {
|
||||||
|
this.buttonConfig.buttonsArray = this.buttonConfig.buttonsArray.filter(
|
||||||
|
(btn) => btn.name !== 'Deposit' && btn.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
this.buttonConfig.optionArray = this.buttonConfig.optionArray.filter(
|
||||||
|
(opt) => opt.name !== 'Deposit' && opt.name !== 'Withdrawal'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -195,6 +195,9 @@
|
|||||||
@if (statusId >= 100) {
|
@if (statusId >= 100) {
|
||||||
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
||||||
<span class="dap__card-hint">Account is inactive</span>
|
<span class="dap__card-hint">Account is inactive</span>
|
||||||
|
} @else if (isOverdue(daysToInactive)) {
|
||||||
|
<span class="dap__reached"><i class="fas fa-flag"></i> Overdue {{ -daysToInactive! }}d</span>
|
||||||
|
<span class="dap__card-hint">{{ inactiveSubtext() }}</span>
|
||||||
} @else if (daysToInactive !== null) {
|
} @else if (daysToInactive !== null) {
|
||||||
<span class="dap__number" [class.dap__number--warn]="daysToInactive <= 30">
|
<span class="dap__number" [class.dap__number--warn]="daysToInactive <= 30">
|
||||||
{{ daysToInactive }}<small>days</small>
|
{{ daysToInactive }}<small>days</small>
|
||||||
@@ -217,6 +220,9 @@
|
|||||||
@if (statusId >= 200) {
|
@if (statusId >= 200) {
|
||||||
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
||||||
<span class="dap__card-hint">Account is dormant</span>
|
<span class="dap__card-hint">Account is dormant</span>
|
||||||
|
} @else if (isOverdue(daysToDormancy)) {
|
||||||
|
<span class="dap__reached"><i class="fas fa-flag"></i> Overdue {{ -daysToDormancy! }}d</span>
|
||||||
|
<span class="dap__card-hint">{{ dormancySubtext() }}</span>
|
||||||
} @else if (daysToDormancy !== null) {
|
} @else if (daysToDormancy !== null) {
|
||||||
<span class="dap__number" [class.dap__number--warn]="daysToDormancy <= 30">
|
<span class="dap__number" [class.dap__number--warn]="daysToDormancy <= 30">
|
||||||
{{ daysToDormancy }}<small>days</small>
|
{{ daysToDormancy }}<small>days</small>
|
||||||
@@ -239,6 +245,9 @@
|
|||||||
@if (statusId >= 300) {
|
@if (statusId >= 300) {
|
||||||
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
<span class="dap__reached"><i class="fas fa-flag"></i> Threshold Reached</span>
|
||||||
<span class="dap__card-hint">Pending regulatory transfer</span>
|
<span class="dap__card-hint">Pending regulatory transfer</span>
|
||||||
|
} @else if (isOverdue(daysToEscheat)) {
|
||||||
|
<span class="dap__reached"><i class="fas fa-flag"></i> Overdue {{ -daysToEscheat! }}d</span>
|
||||||
|
<span class="dap__card-hint">{{ escheatSubtext() }}</span>
|
||||||
} @else if (daysToEscheat !== null) {
|
} @else if (daysToEscheat !== null) {
|
||||||
<span class="dap__number" [class.dap__number--warn]="daysToEscheat <= 30">
|
<span class="dap__number" [class.dap__number--warn]="daysToEscheat <= 30">
|
||||||
{{ daysToEscheat }}<small>days</small>
|
{{ daysToEscheat }}<small>days</small>
|
||||||
@@ -295,7 +304,9 @@
|
|||||||
{{ step.label }}
|
{{ step.label }}
|
||||||
<i class="fas fa-info-circle dap__tl-info"></i>
|
<i class="fas fa-info-circle dap__tl-info"></i>
|
||||||
</span>
|
</span>
|
||||||
@if (!step.reached && step.days !== null) {
|
@if (!step.reached && isOverdue(step.days)) {
|
||||||
|
<span class="dap__tl-reached-tag">Overdue {{ -step.days! }}d</span>
|
||||||
|
} @else if (!step.reached && step.days !== null) {
|
||||||
<span class="dap__tl-days">{{ step.days }}d</span>
|
<span class="dap__tl-days">{{ step.days }}d</span>
|
||||||
} @else if (step.reached) {
|
} @else if (step.reached) {
|
||||||
<span class="dap__tl-reached-tag">Reached</span>
|
<span class="dap__tl-reached-tag">Reached</span>
|
||||||
|
|||||||
@@ -113,12 +113,10 @@ export class DormancyAlertPanelComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.computeRiskFromAccount();
|
this.computeRiskFromAccount();
|
||||||
this.shouldShow =
|
// Only surface this panel once the account has actually left "Active" —
|
||||||
this.isAlertEnabled ||
|
// i.e. subStatus is Inactive/Dormant/Escheat. A healthy active account
|
||||||
this.isMonitoringActive ||
|
// (statusId === 0) should never show a danger-colored dormancy alert.
|
||||||
this.statusId > 0 ||
|
this.shouldShow = this.statusId > 0;
|
||||||
(this.daysToInactive !== null && this.daysToInactive <= 90) ||
|
|
||||||
!!this.lastTxnDate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private computeRiskFromAccount(): void {
|
private computeRiskFromAccount(): void {
|
||||||
@@ -179,17 +177,36 @@ export class DormancyAlertPanelComponent implements OnInit {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** e.g. "Inactive after 30 days of no transaction" */
|
/** true when the threshold date has already passed but the batch job hasn't reclassified the account yet */
|
||||||
|
isOverdue(days: number | null): boolean {
|
||||||
|
return days !== null && days < 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** e.g. "11d" when still counting down, "Overdue 5d" when the threshold date already passed */
|
||||||
|
daysLabel(days: number | null): string {
|
||||||
|
if (days === null) return '';
|
||||||
|
return this.isOverdue(days) ? `Overdue ${Math.abs(days)}d` : `${days}d`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** e.g. "Moves Active → Inactive after 30 days" */
|
||||||
inactiveSubtext(): string {
|
inactiveSubtext(): string {
|
||||||
return this.daysToInactive !== null ? `No transaction for ${this.daysToInactive} days` : 'Threshold not configured';
|
if (this.daysToInactive === null) return 'Threshold not configured';
|
||||||
|
return this.isOverdue(this.daysToInactive)
|
||||||
|
? `Active → Inactive was due ${Math.abs(this.daysToInactive)} days ago`
|
||||||
|
: `Moves Active → Inactive after ${this.daysToInactive} days`;
|
||||||
}
|
}
|
||||||
|
|
||||||
dormancySubtext(): string {
|
dormancySubtext(): string {
|
||||||
const total = (this.daysToInactive ?? 0) + (this.daysToDormancy ?? 0);
|
if (this.daysToDormancy === null) return 'Threshold not configured';
|
||||||
return this.daysToDormancy !== null ? `${this.daysToDormancy} days after inactive` : 'Threshold not configured';
|
return this.isOverdue(this.daysToDormancy)
|
||||||
|
? `Inactive → Dormant was due ${Math.abs(this.daysToDormancy)} days ago`
|
||||||
|
: `Moves Inactive → Dormant after ${this.daysToDormancy} days`;
|
||||||
}
|
}
|
||||||
|
|
||||||
escheatSubtext(): string {
|
escheatSubtext(): string {
|
||||||
return this.daysToEscheat !== null ? `${this.daysToEscheat} days after dormant` : 'Threshold not configured';
|
if (this.daysToEscheat === null) return 'Threshold not configured';
|
||||||
|
return this.isOverdue(this.daysToEscheat)
|
||||||
|
? `Dormant → Escheat was due ${Math.abs(this.daysToEscheat)} days ago`
|
||||||
|
: `Moves Dormant → Escheat after ${this.daysToEscheat} days`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
<!--
|
||||||
|
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="container">
|
||||||
|
@if (hasPendingEdit) {
|
||||||
|
<div class="mat-elevation-z1" style="padding: 12px 16px; margin-bottom: 16px; background-color: #fff8e1">
|
||||||
|
<fa-icon icon="lock" class="m-r-10"></fa-icon>
|
||||||
|
An edit submitted by {{ pendingEdit.makerUsername }} is already pending approval. You cannot submit another edit
|
||||||
|
until it is resolved.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
<mat-stepper
|
||||||
|
orientation="vertical"
|
||||||
|
[linear]="false"
|
||||||
|
class="mat-elevation-z8"
|
||||||
|
labelPosition="bottom"
|
||||||
|
#shareProductStepper
|
||||||
|
>
|
||||||
|
<ng-template matStepperIcon="number">
|
||||||
|
<fa-icon icon="pencil-alt" size="sm"></fa-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template matStepperIcon="edit">
|
||||||
|
<fa-icon icon="pencil-alt" size="sm"></fa-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template matStepperIcon="done">
|
||||||
|
<fa-icon icon="check" size="sm"></fa-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template matStepperIcon="error">
|
||||||
|
<fa-icon icon="exclamation-triangle" size="lg"></fa-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<ng-template matStepperIcon="preview">
|
||||||
|
<fa-icon icon="eye" size="sm"></fa-icon>
|
||||||
|
</ng-template>
|
||||||
|
|
||||||
|
<mat-step [stepControl]="sharesAccountDetailsForm">
|
||||||
|
<ng-template matStepLabel>{{ 'labels.inputs.DETAILS' | translate }}</ng-template>
|
||||||
|
|
||||||
|
<mifosx-shares-account-details-step
|
||||||
|
[sharesAccountTemplate]="sharesAccountAndTemplate"
|
||||||
|
[approvalEditMode]="true"
|
||||||
|
(sharesAccountProductTemplate)="setTemplate($event)"
|
||||||
|
>
|
||||||
|
</mifosx-shares-account-details-step>
|
||||||
|
</mat-step>
|
||||||
|
|
||||||
|
<mat-step [stepControl]="sharesAccountTermsForm">
|
||||||
|
<ng-template matStepLabel>{{ 'labels.inputs.TERMS' | translate }}</ng-template>
|
||||||
|
|
||||||
|
<mifosx-shares-account-terms-step
|
||||||
|
[sharesAccountProductTemplate]="sharesAccountProductTemplate"
|
||||||
|
[sharesAccountTemplate]="sharesAccountAndTemplate"
|
||||||
|
[approvalEditMode]="true"
|
||||||
|
>
|
||||||
|
</mifosx-shares-account-terms-step>
|
||||||
|
</mat-step>
|
||||||
|
|
||||||
|
<mat-step>
|
||||||
|
<ng-template matStepLabel>{{ 'labels.inputs.CHARGES' | translate }}</ng-template>
|
||||||
|
|
||||||
|
<mifosx-shares-account-charges-step
|
||||||
|
[sharesAccountProductTemplate]="sharesAccountProductTemplate"
|
||||||
|
[sharesAccountTemplate]="sharesAccountAndTemplate"
|
||||||
|
[currencyCode]="sharesAccountTermsForm.get('currencyCode')"
|
||||||
|
[approvalEditMode]="true"
|
||||||
|
>
|
||||||
|
</mifosx-shares-account-charges-step>
|
||||||
|
</mat-step>
|
||||||
|
|
||||||
|
@if (sharesAccountFormValidAndNotPristine) {
|
||||||
|
<mat-step completed>
|
||||||
|
<ng-template matStepLabel>{{ 'labels.inputs.PREVIEW' | translate }}</ng-template>
|
||||||
|
<mifosx-shares-account-preview-step
|
||||||
|
[sharesAccountProductTemplate]="sharesAccountProductTemplate"
|
||||||
|
[sharesAccountTemplate]="sharesAccountAndTemplate"
|
||||||
|
[sharesAccountTermsForm]="sharesAccountTermsForm"
|
||||||
|
[sharesAccount]="sharesAccount"
|
||||||
|
(submitEvent)="submit()"
|
||||||
|
>
|
||||||
|
</mifosx-shares-account-preview-step>
|
||||||
|
</mat-step>
|
||||||
|
}
|
||||||
|
</mat-stepper>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
/**
|
||||||
|
* 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, ViewChild, inject } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import { MatStepper, MatStepperIcon, MatStep, MatStepLabel } from '@angular/material/stepper';
|
||||||
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
|
/** Custom Components */
|
||||||
|
import { SharesAccountDetailsStepComponent } from '../shares-account-stepper/shares-account-details-step/shares-account-details-step.component';
|
||||||
|
import { SharesAccountTermsStepComponent } from '../shares-account-stepper/shares-account-terms-step/shares-account-terms-step.component';
|
||||||
|
import { SharesAccountChargesStepComponent } from '../shares-account-stepper/shares-account-charges-step/shares-account-charges-step.component';
|
||||||
|
import { SharesAccountPreviewStepComponent } from '../shares-account-stepper/shares-account-preview-step/shares-account-preview-step.component';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { SharesService } from '../shares.service';
|
||||||
|
import { SettingsService } from 'app/settings/settings.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit Share Account Details — maker-checker submission screen.
|
||||||
|
*
|
||||||
|
* Reuses the same Details/Terms/Charges/Preview stepper as Create/Modify Application, but with
|
||||||
|
* Product, External ID, Resolution Number, Total Number of Shares, Application Date and Charges
|
||||||
|
* locked (`approvalEditMode`) - only Default Savings Account, Allow Dividends for Inactive Clients,
|
||||||
|
* Minimum Active Period and Lockin Period are actually editable and submitted. Nothing is applied
|
||||||
|
* immediately: the request is staged and a different user (checker) must approve it from the
|
||||||
|
* "Pending Share Account Edits" screen before it takes effect.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-edit-share-account-details',
|
||||||
|
templateUrl: './edit-share-account-details.component.html',
|
||||||
|
styleUrls: ['./edit-share-account-details.component.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatStepper,
|
||||||
|
MatStepperIcon,
|
||||||
|
FaIconComponent,
|
||||||
|
MatStep,
|
||||||
|
MatStepLabel,
|
||||||
|
SharesAccountDetailsStepComponent,
|
||||||
|
SharesAccountTermsStepComponent,
|
||||||
|
SharesAccountChargesStepComponent,
|
||||||
|
SharesAccountPreviewStepComponent
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class EditShareAccountDetailsComponent {
|
||||||
|
private route = inject(ActivatedRoute);
|
||||||
|
private router = inject(Router);
|
||||||
|
private sharesService = inject(SharesService);
|
||||||
|
private settingsService = inject(SettingsService);
|
||||||
|
|
||||||
|
/** Shares Account and Template */
|
||||||
|
sharesAccountAndTemplate: any;
|
||||||
|
/** Shares Account Product Template */
|
||||||
|
sharesAccountProductTemplate: any;
|
||||||
|
|
||||||
|
/** Pending edit already submitted for this account, if any. */
|
||||||
|
pendingEdit: any = null;
|
||||||
|
pendingEditLoading = true;
|
||||||
|
submitting = false;
|
||||||
|
|
||||||
|
@ViewChild(SharesAccountDetailsStepComponent, { static: true })
|
||||||
|
sharesAccountDetailsStep: SharesAccountDetailsStepComponent;
|
||||||
|
@ViewChild(SharesAccountTermsStepComponent, { static: true }) sharesAccountTermsStep: SharesAccountTermsStepComponent;
|
||||||
|
@ViewChild(SharesAccountChargesStepComponent, { static: true })
|
||||||
|
sharesAccountChargesStep: SharesAccountChargesStepComponent;
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.route.data.subscribe((data: { sharesAccountAndTemplate: any }) => {
|
||||||
|
this.sharesAccountAndTemplate = data.sharesAccountAndTemplate;
|
||||||
|
this.loadPendingEdit();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private loadPendingEdit(): void {
|
||||||
|
this.pendingEditLoading = true;
|
||||||
|
this.sharesService.getPendingShareAccountEdit(this.sharesAccountAndTemplate.id).subscribe({
|
||||||
|
next: (edit: any) => {
|
||||||
|
this.pendingEdit = edit && edit.status === 'PENDING' ? edit : null;
|
||||||
|
this.pendingEditLoading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.pendingEdit = null;
|
||||||
|
this.pendingEditLoading = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
get hasPendingEdit(): boolean {
|
||||||
|
return !!this.pendingEdit;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTemplate($event: any) {
|
||||||
|
this.sharesAccountProductTemplate = $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
get sharesAccountDetailsForm() {
|
||||||
|
return this.sharesAccountDetailsStep.sharesAccountDetailsForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
get sharesAccountTermsForm() {
|
||||||
|
return this.sharesAccountTermsStep.sharesAccountTermsForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
get sharesAccountFormValidAndNotPristine() {
|
||||||
|
return (
|
||||||
|
this.sharesAccountTermsForm.valid &&
|
||||||
|
!this.sharesAccountTermsForm.pristine &&
|
||||||
|
!this.hasPendingEdit &&
|
||||||
|
!this.pendingEditLoading
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
get sharesAccount() {
|
||||||
|
return {
|
||||||
|
...this.sharesAccountDetailsStep.sharesAccountDetails,
|
||||||
|
...this.sharesAccountTermsStep.sharesAccountTerms,
|
||||||
|
...this.sharesAccountChargesStep.sharesAccountCharges
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits only the 6 fields this flow supports for approval - Product, External ID, Resolution
|
||||||
|
* Number, Total Number of Shares, Application Date and Charges are locked in the UI and are never
|
||||||
|
* part of this payload.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
if (!this.sharesAccountFormValidAndNotPristine || this.submitting) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const locale = this.settingsService.language.code;
|
||||||
|
const terms = this.sharesAccountTermsForm.value;
|
||||||
|
const payload: any = {
|
||||||
|
locale,
|
||||||
|
dateFormat: 'yyyy-MM-dd',
|
||||||
|
savingsAccountId: terms.savingsAccountId,
|
||||||
|
allowDividendCalculationForInactiveClients: terms.allowDividendCalculationForInactiveClients
|
||||||
|
};
|
||||||
|
if (terms.minimumActivePeriod) {
|
||||||
|
payload.minimumActivePeriod = terms.minimumActivePeriod;
|
||||||
|
}
|
||||||
|
if (terms.minimumActivePeriodFrequencyType) {
|
||||||
|
payload.minimumActivePeriodFrequencyType = terms.minimumActivePeriodFrequencyType;
|
||||||
|
}
|
||||||
|
if (terms.lockinPeriodFrequency) {
|
||||||
|
payload.lockinPeriodFrequency = terms.lockinPeriodFrequency;
|
||||||
|
}
|
||||||
|
if (terms.lockinPeriodFrequencyType) {
|
||||||
|
payload.lockinPeriodFrequencyType = terms.lockinPeriodFrequencyType;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.submitting = true;
|
||||||
|
this.sharesService.submitShareAccountEdit(this.sharesAccountAndTemplate.id, payload).subscribe({
|
||||||
|
next: () => {
|
||||||
|
this.submitting = false;
|
||||||
|
this.router.navigate(['../'], { relativeTo: this.route });
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.submitting = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
<mat-card class="container">
|
||||||
|
<div class="table-header">
|
||||||
|
<div class="table-header-row">
|
||||||
|
<div class="table-title-group">
|
||||||
|
<h2 class="table-title">
|
||||||
|
<div class="t-logomark"><span></span><span></span><span></span><span></span></div>
|
||||||
|
Share Holders
|
||||||
|
</h2>
|
||||||
|
<span class="table-count" *ngIf="totalRows">{{ totalRows }} records</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-buttons"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-filters">
|
||||||
|
<mat-form-field class="table-search" appearance="outline">
|
||||||
|
<input matInput placeholder="Search by client name or account number" [formControl]="searchControl" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="table-filter" appearance="outline">
|
||||||
|
<mat-select [(value)]="branchFilter" (selectionChange)="applyFilters()" placeholder="Branch">
|
||||||
|
<mat-option value="">All Branches</mat-option>
|
||||||
|
<mat-option *ngFor="let office of offices" [value]="office.id">
|
||||||
|
{{ office.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="table-filter" appearance="outline">
|
||||||
|
<mat-select [(value)]="productFilter" (selectionChange)="applyFilters()" placeholder="Share Product">
|
||||||
|
<mat-option value="">All Products</mat-option>
|
||||||
|
<mat-option *ngFor="let product of products" [value]="product.id">
|
||||||
|
{{ product.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="table-filter" appearance="outline">
|
||||||
|
<mat-select [(value)]="statusFilter" (selectionChange)="applyFilters()" placeholder="Status">
|
||||||
|
<mat-option value="">All Status</mat-option>
|
||||||
|
<mat-option value="active">Active</mat-option>
|
||||||
|
<mat-option value="approved">Approved</mat-option>
|
||||||
|
<mat-option value="submitted and pending approval">Pending</mat-option>
|
||||||
|
<mat-option value="closed">Closed</mat-option>
|
||||||
|
<mat-option value="rejected">Rejected</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="table-filter" appearance="outline" (click)="picker.open()">
|
||||||
|
<mat-date-range-input [formGroup]="dateRangeForm" [rangePicker]="picker">
|
||||||
|
<input matStartDate formControlName="start" placeholder="Start date" (dateChange)="applyFilters()" />
|
||||||
|
<input matEndDate formControlName="end" placeholder="End date" (dateChange)="applyFilters()" />
|
||||||
|
</mat-date-range-input>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
|
||||||
|
<mat-date-range-picker #picker></mat-date-range-picker>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<button mat-icon-button matTooltip="Clear Filters" (click)="clearFilters()">
|
||||||
|
<mat-icon>clear</mat-icon>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="table-container">
|
||||||
|
<mat-progress-bar *ngIf="isLoading" mode="indeterminate" class="table-loader"></mat-progress-bar>
|
||||||
|
|
||||||
|
<table mat-table [dataSource]="dataSource" matSort class="modern-table">
|
||||||
|
<!-- Member Name Column (clientName) -->
|
||||||
|
<ng-container matColumnDef="clientName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Client Name</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.clientName || 'N/A' }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Folio Number Column (accountNo) -->
|
||||||
|
<ng-container matColumnDef="accountNo">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Account No</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.accountNo || 'N/A' }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Class Column (productName) -->
|
||||||
|
<ng-container matColumnDef="productName">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Share Product Name</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.productName || 'N/A' }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Approved Shares Column -->
|
||||||
|
<ng-container matColumnDef="totalApprovedShares">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Approved Shares</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.totalApprovedShares || 0 }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Pending Shares Column -->
|
||||||
|
<ng-container matColumnDef="totalPendingForApprovalShares">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Pending Shares</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.totalPendingForApprovalShares || 0 }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Currency Column -->
|
||||||
|
<ng-container matColumnDef="currency">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Currency</th>
|
||||||
|
<td mat-cell *matCellDef="let element">{{ element.currency?.code || 'N/A' }}</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<!-- Activated Date Column -->
|
||||||
|
<ng-container matColumnDef="activatedDate">
|
||||||
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>Activated On</th>
|
||||||
|
<td mat-cell *matCellDef="let element">
|
||||||
|
{{ element.activatedDate ? (element.activatedDate | dateFormat) : 'Not Activated' }}
|
||||||
|
</td>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||||
|
<!-- We can route to /shares/{accountId} or /clients/{clientId}/shares-accounts/{accountId}/general depending on preference -->
|
||||||
|
<tr
|
||||||
|
mat-row
|
||||||
|
*matRowDef="let row; columns: displayedColumns"
|
||||||
|
[routerLink]="['/clients', row.clientId, 'shares-accounts', row.id, 'general']"
|
||||||
|
></tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<mat-paginator [pageSizeOptions]="[10, 25, 50, 100]" showFirstLastButtons></mat-paginator>
|
||||||
|
</div>
|
||||||
|
</mat-card>
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
.container {
|
||||||
|
margin: 1.5rem;
|
||||||
|
padding: 0;
|
||||||
|
border-radius: var(--radius-xl);
|
||||||
|
background: var(--bg-card);
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-header {
|
||||||
|
padding: 1.5rem;
|
||||||
|
border-bottom: 1px solid var(--border-light);
|
||||||
|
|
||||||
|
.table-header-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-title-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 1rem;
|
||||||
|
|
||||||
|
.table-title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 1.25rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--text-main);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.75rem;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
|
||||||
|
.t-logomark {
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 2px;
|
||||||
|
padding: 2px;
|
||||||
|
background: var(--bg-hover);
|
||||||
|
border-radius: 6px;
|
||||||
|
|
||||||
|
span {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--primary-main);
|
||||||
|
opacity: 0.8;
|
||||||
|
|
||||||
|
&:nth-child(2) {
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(3) {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(4) {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-count {
|
||||||
|
padding: 0.25rem 0.75rem;
|
||||||
|
background: var(--bg-hover);
|
||||||
|
color: var(--text-muted);
|
||||||
|
border-radius: var(--radius-full);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 500;
|
||||||
|
letter-spacing: 0.02em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-filters {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
mat-form-field {
|
||||||
|
width: 240px;
|
||||||
|
margin-bottom: -1.25em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-container {
|
||||||
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
border-radius: 0 0 var(--radius-xl) var(--radius-xl);
|
||||||
|
|
||||||
|
.table-loader {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.modern-table {
|
||||||
|
width: 100%;
|
||||||
|
background: transparent;
|
||||||
|
|
||||||
|
tr.mat-row {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--bg-hover);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,199 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnInit, ViewChild, inject } from '@angular/core';
|
||||||
|
import { MatTableDataSource, MatTableModule } from '@angular/material/table';
|
||||||
|
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
|
||||||
|
import { MatSort, MatSortModule } from '@angular/material/sort';
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
||||||
|
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||||
|
import { MatInputModule } from '@angular/material/input';
|
||||||
|
import { MatSelectModule } from '@angular/material/select';
|
||||||
|
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||||
|
import { MatNativeDateModule } from '@angular/material/core';
|
||||||
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
|
import { MatButtonModule } from '@angular/material/button';
|
||||||
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { FormsModule, ReactiveFormsModule, FormGroup, FormControl } from '@angular/forms';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
import { forkJoin, of } from 'rxjs';
|
||||||
|
import { catchError, debounceTime, distinctUntilChanged, filter, switchMap, tap, startWith } from 'rxjs/operators';
|
||||||
|
import { DateFormatPipe } from '../../pipes/date-format.pipe';
|
||||||
|
import { SharesService } from '../shares.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-share-holders',
|
||||||
|
templateUrl: './share-holders.component.html',
|
||||||
|
styleUrls: ['./share-holders.component.scss'],
|
||||||
|
standalone: true,
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
RouterModule,
|
||||||
|
MatCardModule,
|
||||||
|
MatTableModule,
|
||||||
|
MatPaginatorModule,
|
||||||
|
MatSortModule,
|
||||||
|
MatProgressBarModule,
|
||||||
|
MatFormFieldModule,
|
||||||
|
MatInputModule,
|
||||||
|
MatSelectModule,
|
||||||
|
MatDatepickerModule,
|
||||||
|
MatNativeDateModule,
|
||||||
|
MatIconModule,
|
||||||
|
MatButtonModule,
|
||||||
|
MatTooltipModule,
|
||||||
|
FormsModule,
|
||||||
|
ReactiveFormsModule,
|
||||||
|
DateFormatPipe
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ShareHoldersComponent implements OnInit {
|
||||||
|
displayedColumns: string[] = [
|
||||||
|
'clientName',
|
||||||
|
'accountNo',
|
||||||
|
'productName',
|
||||||
|
'totalApprovedShares',
|
||||||
|
'totalPendingForApprovalShares',
|
||||||
|
'currency',
|
||||||
|
'activatedDate'
|
||||||
|
];
|
||||||
|
dataSource = new MatTableDataSource<any>();
|
||||||
|
isLoading = true;
|
||||||
|
totalRows = 0;
|
||||||
|
|
||||||
|
// Filter Data
|
||||||
|
offices: any[] = [];
|
||||||
|
products: any[] = [];
|
||||||
|
|
||||||
|
// Filter State
|
||||||
|
searchValue = '';
|
||||||
|
branchFilter = '';
|
||||||
|
productFilter = '';
|
||||||
|
statusFilter = '';
|
||||||
|
dateRangeForm = new FormGroup({
|
||||||
|
start: new FormControl<Date | null>(null),
|
||||||
|
end: new FormControl<Date | null>(null)
|
||||||
|
});
|
||||||
|
|
||||||
|
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
|
||||||
|
@ViewChild(MatSort, { static: true }) sort!: MatSort;
|
||||||
|
|
||||||
|
searchControl = new FormControl('');
|
||||||
|
|
||||||
|
private sharesService = inject(SharesService);
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dataSource.paginator = this.paginator;
|
||||||
|
this.dataSource.sort = this.sort;
|
||||||
|
this.setupFilterPredicate();
|
||||||
|
|
||||||
|
this.searchControl.valueChanges
|
||||||
|
.pipe(
|
||||||
|
startWith(''),
|
||||||
|
debounceTime(400),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
filter((term: string | null) => !term || term.trim().length === 0 || term.trim().length >= 2),
|
||||||
|
tap((term: string | null) => {
|
||||||
|
this.searchValue = term || '';
|
||||||
|
this.isLoading = true;
|
||||||
|
}),
|
||||||
|
switchMap((term: string | null) => {
|
||||||
|
const search = term ? term.trim() : '';
|
||||||
|
return forkJoin({
|
||||||
|
accounts: this.sharesService.getShareAccountSummaries(search || undefined).pipe(catchError(() => of([]))),
|
||||||
|
offices: this.sharesService.getOffices().pipe(catchError(() => of([]))),
|
||||||
|
products: this.sharesService.getShareProducts().pipe(catchError(() => of([])))
|
||||||
|
});
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe({
|
||||||
|
next: (results: any) => {
|
||||||
|
this.offices = results.offices || [];
|
||||||
|
|
||||||
|
const allShareAccounts = results.accounts || [];
|
||||||
|
|
||||||
|
// Derive unique products from the actual active share accounts to ensure no garbage/dummy
|
||||||
|
// products (like NextGen Tech Pvt Ltd) show up in the dropdown.
|
||||||
|
const uniqueProductsMap = new Map();
|
||||||
|
allShareAccounts.forEach((acc: any) => {
|
||||||
|
if (acc.productId && acc.productName) {
|
||||||
|
uniqueProductsMap.set(acc.productId, { id: acc.productId, name: acc.productName });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.products = Array.from(uniqueProductsMap.values());
|
||||||
|
|
||||||
|
this.dataSource.data = allShareAccounts;
|
||||||
|
this.totalRows = allShareAccounts.length;
|
||||||
|
this.isLoading = false;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.isLoading = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
setupFilterPredicate() {
|
||||||
|
this.dataSource.filterPredicate = (data: any, filter: string) => {
|
||||||
|
let branchMatch = true;
|
||||||
|
if (this.branchFilter) {
|
||||||
|
branchMatch = data.officeId?.toString() === this.branchFilter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
let productMatch = true;
|
||||||
|
if (this.productFilter) {
|
||||||
|
productMatch = data.productId?.toString() === this.productFilter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
let statusMatch = true;
|
||||||
|
if (this.statusFilter) {
|
||||||
|
statusMatch =
|
||||||
|
data.status?.value?.toLowerCase() === this.statusFilter.toLowerCase() ||
|
||||||
|
data.status?.id?.toString() === this.statusFilter.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
let dateMatch = true;
|
||||||
|
if (this.dateRangeForm.value.start && data.activatedDate) {
|
||||||
|
const rowDate = new Date(data.activatedDate[0], data.activatedDate[1] - 1, data.activatedDate[2]);
|
||||||
|
const start = this.dateRangeForm.value.start;
|
||||||
|
const end = this.dateRangeForm.value.end || new Date(); // If no end date, use today
|
||||||
|
|
||||||
|
// Reset hours for accurate comparison
|
||||||
|
rowDate.setHours(0, 0, 0, 0);
|
||||||
|
start.setHours(0, 0, 0, 0);
|
||||||
|
end.setHours(0, 0, 0, 0);
|
||||||
|
|
||||||
|
dateMatch = rowDate >= start && rowDate <= end;
|
||||||
|
}
|
||||||
|
|
||||||
|
return branchMatch && productMatch && statusMatch && dateMatch;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
applyFilters() {
|
||||||
|
// We update the filter string to a random/unique value to trigger the filterPredicate
|
||||||
|
this.dataSource.filter = Math.random().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
search(filterValue: string) {
|
||||||
|
this.searchControl.setValue(filterValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearFilters() {
|
||||||
|
this.searchValue = '';
|
||||||
|
this.branchFilter = '';
|
||||||
|
this.productFilter = '';
|
||||||
|
this.statusFilter = '';
|
||||||
|
this.dateRangeForm.reset();
|
||||||
|
|
||||||
|
// Trigger server-side reload without search term
|
||||||
|
this.searchControl.setValue('', { emitEvent: true });
|
||||||
|
// Trigger client-side filters update
|
||||||
|
this.applyFilters();
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -7,6 +7,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="layout-row-wrap gap-2px responsive-column">
|
<div class="layout-row-wrap gap-2px responsive-column">
|
||||||
|
@if (!approvalEditMode) {
|
||||||
<mat-form-field class="flex-48">
|
<mat-form-field class="flex-48">
|
||||||
<mat-label>{{ 'labels.inputs.Charge' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Charge' | translate }}</mat-label>
|
||||||
<mat-select #charge>
|
<mat-select #charge>
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
{{ 'labels.buttons.Add' | translate }}
|
{{ 'labels.buttons.Add' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
<table
|
<table
|
||||||
class="flex-98 mat-elevation-z1"
|
class="flex-98 mat-elevation-z1"
|
||||||
@@ -49,9 +51,11 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
|
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Amount' | translate }}</th>
|
||||||
<td mat-cell *matCellDef="let charge">
|
<td mat-cell *matCellDef="let charge">
|
||||||
{{ charge.amount || charge.amountOrPercentage }}
|
{{ charge.amount || charge.amountOrPercentage }}
|
||||||
|
@if (!approvalEditMode) {
|
||||||
<button mat-icon-button color="primary" (click)="editCharge(charge)">
|
<button mat-icon-button color="primary" (click)="editCharge(charge)">
|
||||||
<fa-icon icon="pen"></fa-icon>
|
<fa-icon icon="pen"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
@@ -65,9 +69,11 @@
|
|||||||
<ng-container matColumnDef="action">
|
<ng-container matColumnDef="action">
|
||||||
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
|
<th mat-header-cell *matHeaderCellDef>{{ 'labels.inputs.Actions' | translate }}</th>
|
||||||
<td mat-cell *matCellDef="let charge">
|
<td mat-cell *matCellDef="let charge">
|
||||||
|
@if (!approvalEditMode) {
|
||||||
<button mat-icon-button color="warn" (click)="deleteCharge(charge)">
|
<button mat-icon-button color="warn" (click)="deleteCharge(charge)">
|
||||||
<fa-icon icon="trash"></fa-icon>
|
<fa-icon icon="trash"></fa-icon>
|
||||||
</button>
|
</button>
|
||||||
|
}
|
||||||
</td>
|
</td>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
+3
@@ -73,6 +73,9 @@ export class SharesAccountChargesStepComponent implements OnInit, OnChanges {
|
|||||||
@Input() sharesAccountTemplate: any;
|
@Input() sharesAccountTemplate: any;
|
||||||
/** Currency Code */
|
/** Currency Code */
|
||||||
@Input() currencyCode: UntypedFormControl;
|
@Input() currencyCode: UntypedFormControl;
|
||||||
|
/** When true (Share Account "Edit Details" maker-checker flow), charges are locked - they aren't
|
||||||
|
* part of that flow's editable field set. */
|
||||||
|
@Input() approvalEditMode = false;
|
||||||
|
|
||||||
/** Charge Data */
|
/** Charge Data */
|
||||||
chargeData: any = [];
|
chargeData: any = [];
|
||||||
|
|||||||
+14
-1
@@ -45,6 +45,15 @@
|
|||||||
<mat-label>{{ 'labels.inputs.External ID' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.External ID' | translate }}</mat-label>
|
||||||
<input matInput formControlName="externalId" />
|
<input matInput formControlName="externalId" />
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="flex-48">
|
||||||
|
<mat-label>{{ 'labels.inputs.Resolution Number' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="resolutionNumber" required />
|
||||||
|
<mat-error>
|
||||||
|
{{ 'labels.inputs.Resolution Number' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="layout-row align-center gap-2percent margin-t responsive-column">
|
<div class="layout-row align-center gap-2percent margin-t responsive-column">
|
||||||
@@ -56,7 +65,11 @@
|
|||||||
mat-raised-button
|
mat-raised-button
|
||||||
matStepperNext
|
matStepperNext
|
||||||
[disabled]="
|
[disabled]="
|
||||||
!(sharesAccountDetailsForm.get('productId')?.value && sharesAccountDetailsForm.get('submittedDate')?.value)
|
!(
|
||||||
|
sharesAccountDetailsForm.get('productId')?.value &&
|
||||||
|
sharesAccountDetailsForm.get('submittedDate')?.value &&
|
||||||
|
sharesAccountDetailsForm.get('resolutionNumber')?.value
|
||||||
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
{{ 'labels.buttons.Next' | translate }}
|
{{ 'labels.buttons.Next' | translate }}
|
||||||
|
|||||||
+13
-2
@@ -38,6 +38,9 @@ export class SharesAccountDetailsStepComponent implements OnInit {
|
|||||||
|
|
||||||
/** Shares Account Template */
|
/** Shares Account Template */
|
||||||
@Input() sharesAccountTemplate: any;
|
@Input() sharesAccountTemplate: any;
|
||||||
|
/** When true (Share Account "Edit Details" maker-checker flow), Product/Submitted On/External ID/
|
||||||
|
* Resolution Number are locked - none of them are part of that flow's editable field set. */
|
||||||
|
@Input() approvalEditMode = false;
|
||||||
|
|
||||||
/** Minimum date allowed. */
|
/** Minimum date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
@@ -72,10 +75,14 @@ export class SharesAccountDetailsStepComponent implements OnInit {
|
|||||||
submittedDate:
|
submittedDate:
|
||||||
this.sharesAccountTemplate.timeline.submittedOnDate &&
|
this.sharesAccountTemplate.timeline.submittedOnDate &&
|
||||||
new Date(this.sharesAccountTemplate.timeline.submittedOnDate),
|
new Date(this.sharesAccountTemplate.timeline.submittedOnDate),
|
||||||
externalId: this.sharesAccountTemplate.externalId
|
externalId: this.sharesAccountTemplate.externalId,
|
||||||
|
resolutionNumber: this.sharesAccountTemplate.resolutionNumber
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.approvalEditMode) {
|
||||||
|
this.sharesAccountDetailsForm.disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +98,11 @@ export class SharesAccountDetailsStepComponent implements OnInit {
|
|||||||
'',
|
'',
|
||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
externalId: ['']
|
externalId: [''],
|
||||||
|
resolutionNumber: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
@@ -36,6 +36,11 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flex-fill">
|
||||||
|
<span class="flex-40">{{ 'labels.inputs.Resolution Number' | translate }}</span>
|
||||||
|
<span class="flex-60">{{ sharesAccount.resolutionNumber }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3 class="mat-h3 flex-fill">{{ 'labels.heading.Terms' | translate }}</h3>
|
<h3 class="mat-h3 flex-fill">{{ 'labels.heading.Terms' | translate }}</h3>
|
||||||
|
|
||||||
<mat-divider class="flex-fill"></mat-divider>
|
<mat-divider class="flex-fill"></mat-divider>
|
||||||
|
|||||||
+8
@@ -41,6 +41,10 @@ export class SharesAccountTermsStepComponent implements OnChanges, OnInit {
|
|||||||
@Input() sharesAccountProductTemplate: any;
|
@Input() sharesAccountProductTemplate: any;
|
||||||
/** [Optional] Shares Account Template */
|
/** [Optional] Shares Account Template */
|
||||||
@Input() sharesAccountTemplate: any;
|
@Input() sharesAccountTemplate: any;
|
||||||
|
/** When true (Share Account "Edit Details" maker-checker flow), only Default Savings Account, Allow
|
||||||
|
* Dividends, Minimum Active Period and Lockin Period stay editable - Total Number of Shares and
|
||||||
|
* Application Date are transactional/historical and aren't part of that flow's editable field set. */
|
||||||
|
@Input() approvalEditMode = false;
|
||||||
|
|
||||||
/** Minimum date allowed. */
|
/** Minimum date allowed. */
|
||||||
minDate = new Date(2000, 0, 1);
|
minDate = new Date(2000, 0, 1);
|
||||||
@@ -105,6 +109,10 @@ export class SharesAccountTermsStepComponent implements OnChanges, OnInit {
|
|||||||
this.sharesAccountTemplate.allowDividendCalculationForInactiveClients
|
this.sharesAccountTemplate.allowDividendCalculationForInactiveClients
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (this.approvalEditMode) {
|
||||||
|
this.sharesAccountTermsForm.get('requestedShares').disable();
|
||||||
|
this.sharesAccountTermsForm.get('applicationDate').disable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,6 +7,13 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<div class="tab-container mat-typography">
|
<div class="tab-container mat-typography">
|
||||||
|
@if (pendingEdit) {
|
||||||
|
<div class="mat-elevation-z1" style="padding: 12px 16px; margin-bottom: 16px; background-color: #fff8e1">
|
||||||
|
<fa-icon icon="lock" class="m-r-10"></fa-icon>
|
||||||
|
A details edit submitted by {{ pendingEdit.makerUsername }} is awaiting checker approval. You cannot submit
|
||||||
|
another edit until it is resolved.
|
||||||
|
</div>
|
||||||
|
}
|
||||||
<div class="shares-account-tables layout-row gap-2percent">
|
<div class="shares-account-tables layout-row gap-2percent">
|
||||||
<div class="flex-49">
|
<div class="flex-49">
|
||||||
<h4 class="table-headers">{{ 'labels.heading.Shares Details' | translate }}</h4>
|
<h4 class="table-headers">{{ 'labels.heading.Shares Details' | translate }}</h4>
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import { AccountNumberComponent } from '../../../shared/account-number/account-n
|
|||||||
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
||||||
import { FormatNumberPipe } from '../../../pipes/format-number.pipe';
|
import { FormatNumberPipe } from '../../../pipes/format-number.pipe';
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { SharesService } from '../../shares.service';
|
||||||
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-general-tab',
|
selector: 'mifosx-general-tab',
|
||||||
@@ -23,15 +25,20 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
ExternalIdentifierComponent,
|
ExternalIdentifierComponent,
|
||||||
AccountNumberComponent,
|
AccountNumberComponent,
|
||||||
DateFormatPipe,
|
DateFormatPipe,
|
||||||
FormatNumberPipe
|
FormatNumberPipe,
|
||||||
|
FaIconComponent
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class GeneralTabComponent {
|
export class GeneralTabComponent {
|
||||||
private route = inject(ActivatedRoute);
|
private route = inject(ActivatedRoute);
|
||||||
|
private sharesService = inject(SharesService);
|
||||||
|
|
||||||
/** Shares Account Data */
|
/** Shares Account Data */
|
||||||
sharesAccountData: any;
|
sharesAccountData: any;
|
||||||
|
|
||||||
|
/** Pending details edit awaiting checker approval, if any. */
|
||||||
|
pendingEdit: any = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches shares account data from `resolve`
|
* Fetches shares account data from `resolve`
|
||||||
* @param {ActivatedRoute} route Activated Route
|
* @param {ActivatedRoute} route Activated Route
|
||||||
@@ -39,6 +46,14 @@ export class GeneralTabComponent {
|
|||||||
constructor() {
|
constructor() {
|
||||||
this.route.data.subscribe((data: { sharesAccountData: any }) => {
|
this.route.data.subscribe((data: { sharesAccountData: any }) => {
|
||||||
this.sharesAccountData = data.sharesAccountData;
|
this.sharesAccountData = data.sharesAccountData;
|
||||||
|
this.sharesService.getPendingShareAccountEdit(this.sharesAccountData.id).subscribe({
|
||||||
|
next: (edit: any) => {
|
||||||
|
this.pendingEdit = edit && edit.status === 'PENDING' ? edit : null;
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
this.pendingEdit = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+139
@@ -0,0 +1,139 @@
|
|||||||
|
<!--
|
||||||
|
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/.
|
||||||
|
-->
|
||||||
|
<h2 mat-dialog-title class="dialog-header no-print">
|
||||||
|
<span>Share Certificate View</span>
|
||||||
|
<span class="flex-auto"></span>
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div mat-dialog-content class="dialog-content-container">
|
||||||
|
<!-- Certificate Page Frame -->
|
||||||
|
<div class="certificate-container" id="share-certificate-print">
|
||||||
|
<div class="certificate-border-outer">
|
||||||
|
<div class="certificate-border-inner">
|
||||||
|
<!-- Certificate Watermark Icon/Seal -->
|
||||||
|
<div class="certificate-watermark">
|
||||||
|
<mat-icon class="watermark-icon">verified_user</mat-icon>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="certificate-header">
|
||||||
|
<div class="bank-name">Nexora Co-operative Bank Ltd.</div>
|
||||||
|
<div class="bank-sub">Mumbai, Maharashtra, India</div>
|
||||||
|
<div class="cert-title">SHARE CERTIFICATE</div>
|
||||||
|
<div class="cert-subtitle">Issued under the Common Seal of the Bank</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cert-meta-row">
|
||||||
|
<div class="meta-item">
|
||||||
|
<span class="meta-label">Certificate No.</span>
|
||||||
|
<span class="meta-value">{{ certificateNo }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="meta-item">
|
||||||
|
<span class="meta-label">Folio No.</span>
|
||||||
|
<span class="meta-value">{{ folioNo }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="meta-item">
|
||||||
|
<span class="meta-label">Date of Issue</span>
|
||||||
|
<span class="meta-value">{{ issueDate | dateFormat }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="cert-body-section">
|
||||||
|
<p class="cert-main-text">
|
||||||
|
This is to certify that <strong class="highlight-text">{{ sharesAccountData.clientName }}</strong> is the
|
||||||
|
registered holder of
|
||||||
|
<strong class="highlight-text">{{ sharesAccountData.summary?.totalApprovedShares | formatNumber }}</strong>
|
||||||
|
({{ sharesAccountData.productName || 'Ordinary' }}) shares of
|
||||||
|
<strong class="highlight-text">{{
|
||||||
|
sharesAccountData.currentMarketPrice | currency: sharesAccountData.currency.code : 'symbol-narrow'
|
||||||
|
}}</strong>
|
||||||
|
each, fully paid up, in <strong class="highlight-text">Nexora Co-operative Bank Ltd.</strong>, subject to
|
||||||
|
the memorandum, articles of association, and bye-laws of the bank.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="issued-to-details">
|
||||||
|
<div class="issued-to-title">ISSUED TO:</div>
|
||||||
|
<div class="client-name-details">{{ sharesAccountData.clientName }}</div>
|
||||||
|
<div class="client-ids">
|
||||||
|
<span *ngIf="memberId"><strong>Member ID:</strong> {{ memberId }}</span>
|
||||||
|
<span *ngIf="panNumber && panNumber !== 'Not Available'">
|
||||||
|
· <strong>PAN:</strong> {{ panNumber }}</span
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<div class="client-address" *ngIf="clientAddress">
|
||||||
|
{{ clientAddress }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Details Grid -->
|
||||||
|
<table class="certificate-details-table">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl-col">Branch</td>
|
||||||
|
<td class="val-col">{{ clientData?.officeName || 'Mumbai Main Branch' }}</td>
|
||||||
|
<td class="lbl-col">Member Since</td>
|
||||||
|
<td class="val-col">
|
||||||
|
{{
|
||||||
|
(clientData?.activationDate
|
||||||
|
? (clientData.activationDate | dateFormat)
|
||||||
|
: (clientData?.timeline?.submittedOnDate | dateFormat)) || 'N/A'
|
||||||
|
}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl-col">Share Class</td>
|
||||||
|
<td class="val-col">{{ sharesAccountData.productName || 'Ordinary' }}</td>
|
||||||
|
<td class="lbl-col">Date of Issue</td>
|
||||||
|
<td class="val-col">{{ issueDate | dateFormat }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="lbl-col">Share Numbers</td>
|
||||||
|
<td class="val-col">{{ shareNumbersRange }}</td>
|
||||||
|
<td class="lbl-col">Dividend Paid (Cumulative)</td>
|
||||||
|
<td class="val-col">
|
||||||
|
{{ cumulativeDividend | currency: sharesAccountData.currency.code : 'symbol-narrow' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="highlight-row">
|
||||||
|
<td colspan="2" class="lbl-col-highlight">TOTAL FACE VALUE</td>
|
||||||
|
<td colspan="2" class="val-col-highlight">
|
||||||
|
{{ totalFaceValue | currency: sharesAccountData.currency.code : 'symbol-narrow' }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="cert-footer">
|
||||||
|
<div class="seal-container">
|
||||||
|
<div class="seal-ring">
|
||||||
|
<div class="seal-text">COMMON SEAL</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="closing-text">
|
||||||
|
Given under the common seal of the bank this {{ todayDate | date: 'd' }} day of
|
||||||
|
{{ todayDate | date: 'MMMM yyyy' }}.
|
||||||
|
</div>
|
||||||
|
<div class="signatures-container">
|
||||||
|
<div class="signature-block">
|
||||||
|
<div class="signature-line"></div>
|
||||||
|
<div class="signatory-title">Authorised Signatory</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<mat-dialog-actions align="end" class="no-print">
|
||||||
|
<button mat-button mat-dialog-close>{{ 'labels.buttons.Close' | translate }}</button>
|
||||||
|
<button mat-raised-button color="primary" (click)="printCertificate()">
|
||||||
|
<mat-icon class="m-r-5">print</mat-icon>
|
||||||
|
Print Certificate
|
||||||
|
</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
+351
@@ -0,0 +1,351 @@
|
|||||||
|
/**
|
||||||
|
* 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/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.dialog-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-bottom: 1px solid #e0e0e0;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #1a252c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dialog-content-container {
|
||||||
|
max-height: 80vh;
|
||||||
|
overflow-y: auto;
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Certificate Outer Container */
|
||||||
|
.certificate-container {
|
||||||
|
background-color: #faf8f5;
|
||||||
|
padding: 20px;
|
||||||
|
font-family: Georgia, 'Times New Roman', Times, serif;
|
||||||
|
color: #2c2520;
|
||||||
|
box-shadow: 0 4px 20px rgb(0 0 0 / 8%);
|
||||||
|
border-radius: 8px;
|
||||||
|
max-width: 800px;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Classic Ornate Border System */
|
||||||
|
.certificate-border-outer {
|
||||||
|
border: 5px double #c5a059; /* Gold double border */
|
||||||
|
padding: 8px;
|
||||||
|
background-color: #fdfcf7; /* Textured light cream */
|
||||||
|
border-radius: 4px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-border-inner {
|
||||||
|
border: 1px solid #dcd1bd;
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 2px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Watermark */
|
||||||
|
.certificate-watermark {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
opacity: 0.03;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.watermark-icon {
|
||||||
|
font-size: 280px;
|
||||||
|
width: 280px;
|
||||||
|
height: 280px;
|
||||||
|
color: #c5a059;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-header,
|
||||||
|
.cert-meta-row,
|
||||||
|
.cert-body-section,
|
||||||
|
.certificate-details-table,
|
||||||
|
.cert-footer {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2; /* Ensure content is above watermark */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Header styling */
|
||||||
|
.certificate-header {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
border-bottom: 2px solid #f2edd5;
|
||||||
|
padding-bottom: 20px;
|
||||||
|
|
||||||
|
.bank-name {
|
||||||
|
font-size: 26px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #0b3c5d; /* Dark Premium Blue */
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 1.5px;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bank-sub {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #7b6f63;
|
||||||
|
font-style: italic;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cert-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: #c5a059; /* Classic Gold */
|
||||||
|
letter-spacing: 4px;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-family: Georgia, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cert-subtitle {
|
||||||
|
font-size: 11px;
|
||||||
|
color: #7b6f63;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Meta Data Grid (Top of cert) */
|
||||||
|
.cert-meta-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
border-bottom: 1px solid #f2edd5;
|
||||||
|
padding-bottom: 15px;
|
||||||
|
|
||||||
|
.meta-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.meta-label {
|
||||||
|
font-size: 11px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: #928374;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
margin-bottom: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-value {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #322f2b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Body text */
|
||||||
|
.cert-body-section {
|
||||||
|
margin-bottom: 35px;
|
||||||
|
|
||||||
|
.cert-main-text {
|
||||||
|
font-size: 15px;
|
||||||
|
line-height: 1.8;
|
||||||
|
text-align: center;
|
||||||
|
color: #4a453f;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
|
||||||
|
.highlight-text {
|
||||||
|
color: #1a202c;
|
||||||
|
font-weight: 600;
|
||||||
|
border-bottom: 1px dotted #c5a059;
|
||||||
|
padding-bottom: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Issued To Details Block */
|
||||||
|
.issued-to-details {
|
||||||
|
border: 1px solid #f0e6d2;
|
||||||
|
background-color: #fbfaf5;
|
||||||
|
padding: 15px 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin: 20px auto;
|
||||||
|
max-width: 90%;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
|
.issued-to-title {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #c5a059;
|
||||||
|
letter-spacing: 1.5px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-name-details {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #0b3c5d;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-ids {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.client-address {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #7b6f63;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Certificate Data Table */
|
||||||
|
.certificate-details-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 10px 12px;
|
||||||
|
border: 1px solid #ede8db;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbl-col {
|
||||||
|
background-color: #f7f5ee;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #7b6f63;
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.val-col {
|
||||||
|
color: #322f2b;
|
||||||
|
width: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight-row {
|
||||||
|
background-color: #f5f2e9;
|
||||||
|
border-top: 2px solid #c5a059;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lbl-col-highlight {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #0b3c5d;
|
||||||
|
font-size: 14px;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.val-col-highlight {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #b8860b; /* Dark Goldenrod */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Certificate Footer Seal / Signatures */
|
||||||
|
.cert-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
|
||||||
|
.seal-container {
|
||||||
|
width: 25%;
|
||||||
|
|
||||||
|
.seal-ring {
|
||||||
|
width: 90px;
|
||||||
|
height: 90px;
|
||||||
|
border: 2px dashed #b8860b;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin: 0 auto;
|
||||||
|
transform: rotate(-15deg);
|
||||||
|
|
||||||
|
.seal-text {
|
||||||
|
font-size: 10px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #b8860b;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 1.2;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.closing-text {
|
||||||
|
width: 45%;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #7b6f63;
|
||||||
|
font-style: italic;
|
||||||
|
line-height: 1.5;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.signatures-container {
|
||||||
|
width: 30%;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.signature-block {
|
||||||
|
display: inline-block;
|
||||||
|
width: 80%;
|
||||||
|
|
||||||
|
.signature-line {
|
||||||
|
border-bottom: 1px solid #7b6f63;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
height: 40px; /* Space for signature */
|
||||||
|
}
|
||||||
|
|
||||||
|
.signatory-title {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #7b6f63;
|
||||||
|
font-weight: bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Print CSS */
|
||||||
|
@media print {
|
||||||
|
/* Hide non-overlay contents during print */
|
||||||
|
body > :not(.cdk-overlay-container) {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make certificate fill page */
|
||||||
|
#share-certificate-print {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100% !important;
|
||||||
|
height: 100% !important;
|
||||||
|
padding: 0 !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
background-color: #fff !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.certificate-border-outer {
|
||||||
|
border-width: 8px !important;
|
||||||
|
background-color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.no-print {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mat-mdc-dialog-container {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
+145
@@ -0,0 +1,145 @@
|
|||||||
|
/**
|
||||||
|
* 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, OnInit, inject } from '@angular/core';
|
||||||
|
import {
|
||||||
|
MAT_DIALOG_DATA,
|
||||||
|
MatDialogRef,
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose
|
||||||
|
} from '@angular/material/dialog';
|
||||||
|
import { ClientsService } from 'app/clients/clients.service';
|
||||||
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
||||||
|
import { FormatNumberPipe } from '../../../pipes/format-number.pipe';
|
||||||
|
import { CurrencyPipe } from '@angular/common';
|
||||||
|
import { MatButton } from '@angular/material/button';
|
||||||
|
import { MatIcon } from '@angular/material/icon';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-share-certificate-dialog',
|
||||||
|
templateUrl: './share-certificate-dialog.component.html',
|
||||||
|
styleUrls: ['./share-certificate-dialog.component.scss'],
|
||||||
|
imports: [
|
||||||
|
...STANDALONE_SHARED_IMPORTS,
|
||||||
|
MatDialogTitle,
|
||||||
|
MatDialogContent,
|
||||||
|
MatDialogActions,
|
||||||
|
MatDialogClose,
|
||||||
|
DateFormatPipe,
|
||||||
|
FormatNumberPipe,
|
||||||
|
CurrencyPipe,
|
||||||
|
MatButton,
|
||||||
|
MatIcon
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ShareCertificateDialogComponent implements OnInit {
|
||||||
|
dialogRef = inject<MatDialogRef<ShareCertificateDialogComponent>>(MatDialogRef);
|
||||||
|
data = inject(MAT_DIALOG_DATA);
|
||||||
|
clientsService = inject(ClientsService);
|
||||||
|
|
||||||
|
sharesAccountData: any;
|
||||||
|
clientId: string;
|
||||||
|
|
||||||
|
clientData: any;
|
||||||
|
clientAddress: string = '';
|
||||||
|
panNumber: string = 'Not Available';
|
||||||
|
memberId: string = '';
|
||||||
|
|
||||||
|
certificateNo: string = '';
|
||||||
|
folioNo: string = '';
|
||||||
|
shareNumbersRange: string = '';
|
||||||
|
cumulativeDividend: number = 0;
|
||||||
|
totalFaceValue: number = 0;
|
||||||
|
issueDate: Date = new Date();
|
||||||
|
todayDate: Date = new Date();
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.sharesAccountData = this.data.sharesAccountData;
|
||||||
|
this.clientId = String(this.data.clientId);
|
||||||
|
|
||||||
|
// Initialize shares certificate values
|
||||||
|
this.issueDate = this.sharesAccountData.timeline?.activatedDate
|
||||||
|
? new Date(this.sharesAccountData.timeline.activatedDate)
|
||||||
|
: new Date();
|
||||||
|
|
||||||
|
this.certificateNo = `SC-2026-${this.sharesAccountData.accountNo || String(this.sharesAccountData.id).padStart(6, '0')}`;
|
||||||
|
|
||||||
|
// Calculate total face value
|
||||||
|
const approvedShares = this.sharesAccountData.summary?.totalApprovedShares || 0;
|
||||||
|
const price = this.sharesAccountData.currentMarketPrice || 0;
|
||||||
|
this.totalFaceValue = approvedShares * price;
|
||||||
|
|
||||||
|
// Calculate share numbers range (seeded dynamically from account ID)
|
||||||
|
const startNum = this.sharesAccountData.id * 5000 + 201;
|
||||||
|
const endNum = startNum + approvedShares - 1;
|
||||||
|
this.shareNumbersRange = approvedShares > 0 ? `${startNum.toLocaleString()} – ${endNum.toLocaleString()}` : 'None';
|
||||||
|
|
||||||
|
// Calculate cumulative dividends
|
||||||
|
if (this.sharesAccountData.dividends) {
|
||||||
|
this.cumulativeDividend = this.sharesAccountData.dividends.reduce(
|
||||||
|
(sum: number, d: any) => sum + (d.amount || 0),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fetch client details
|
||||||
|
this.clientsService.getClientData(this.clientId).subscribe({
|
||||||
|
next: (client: any) => {
|
||||||
|
this.clientData = client;
|
||||||
|
this.memberId = client.accountNo || '';
|
||||||
|
this.folioNo = `F-${client.accountNo || String(client.id).padStart(5, '0')}`;
|
||||||
|
},
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fetch address details
|
||||||
|
this.clientsService.getClientAddressData(this.clientId).subscribe({
|
||||||
|
next: (addresses: any[]) => {
|
||||||
|
if (addresses && addresses.length > 0) {
|
||||||
|
const permanent = addresses.find((a) => /permanent/i.test(a?.addressType || '')) || addresses[0];
|
||||||
|
this.clientAddress = this.formatAddress(permanent);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Fetch identifiers (for PAN number)
|
||||||
|
this.clientsService.getClientIdentifiers(this.clientId).subscribe({
|
||||||
|
next: (identifiers: any[]) => {
|
||||||
|
const idList = Array.isArray(identifiers) ? identifiers : (identifiers as any)?.pageItems || [];
|
||||||
|
const panId = idList.find((id: any) => /pan/i.test(id?.documentType?.name || ''));
|
||||||
|
if (panId) {
|
||||||
|
this.panNumber = panId.documentKey;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: () => {}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
formatAddress(addr: any): string {
|
||||||
|
if (!addr) return '';
|
||||||
|
return [
|
||||||
|
addr.addressLine1,
|
||||||
|
addr.addressLine2,
|
||||||
|
addr.townVillage,
|
||||||
|
addr.city,
|
||||||
|
addr.stateName,
|
||||||
|
addr.countryName,
|
||||||
|
addr.postalCode
|
||||||
|
]
|
||||||
|
.filter((p) => !!p && String(p).trim())
|
||||||
|
.join(', ');
|
||||||
|
}
|
||||||
|
|
||||||
|
printCertificate() {
|
||||||
|
window.print();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<span class="flex-auto"></span>
|
<span class="flex-auto"></span>
|
||||||
<div class="flex-40">
|
<div class="flex-10" style="display: flex; justify-content: flex-end; align-items: flex-start">
|
||||||
@if (buttonConfig.singleButtons.length > 0) {
|
@if (buttonConfig.singleButtons.length > 0) {
|
||||||
<button
|
<button
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
@@ -105,7 +105,15 @@
|
|||||||
<mat-menu #More="matMenu">
|
<mat-menu #More="matMenu">
|
||||||
@for (option of buttonConfig.options; track option) {
|
@for (option of buttonConfig.options; track option) {
|
||||||
<span>
|
<span>
|
||||||
<button mat-menu-item *mifosxHasPermission="option.taskPermissionName" (click)="doAction(option.name)">
|
<button
|
||||||
|
mat-menu-item
|
||||||
|
*mifosxHasPermission="option.taskPermissionName"
|
||||||
|
[disabled]="option.name === 'Edit Details'"
|
||||||
|
[matTooltip]="
|
||||||
|
option.name === 'Edit Details' ? ('tooltips.Editing details is disabled' | translate) : ''
|
||||||
|
"
|
||||||
|
(click)="doAction(option.name)"
|
||||||
|
>
|
||||||
{{ 'labels.menus.' + option.name | translate }}
|
{{ 'labels.menus.' + option.name | translate }}
|
||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user