fix(clients): stale signature bug, monthly turnover/annual income fields, senior citizen/PWD classification

- Fix signature-document reads picking the oldest upload instead of the latest across 7 call
  sites (CKYC tab, view/delete-signature dialogs, edit-wizard preview, cashier transaction entry,
  signatory service, record-master) by sorting on document id instead of an unsorted find().
- Add Monthly Turnover and Annual Income fields alongside the renamed Yearly Turnover field.
- Add Senior Citizen (auto-detected from DOB) and Person with Disability classification, with a
  required disability-certificate upload gate before client creation can proceed.
- Add Graduate and Diploma as distinct Education Levels, with diploma-specific degree options.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-28 10:49:28 +05:30
co-authored by Claude Sonnet 5
parent a9c60083bf
commit cb4260b7a3
11 changed files with 367 additions and 16 deletions
@@ -234,8 +234,12 @@ export class CkycTabComponent implements OnInit, OnDestroy {
};
}
// 2. Signature — client document with name='clientSignature'
const signatureDoc = (documents as any[])?.find((d: any) => d?.name === 'clientSignature');
// 2. Signature — client document with name='clientSignature'. Multiple rows 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 signatureDoc = (documents as any[])
?.filter((d: any) => d?.name === 'clientSignature')
?.sort((a: any, b: any) => b.id - a.id)?.[0];
if (signatureDoc) {
this.existing.CLIENT_SIGNATURE = {
present: true,
@@ -47,7 +47,13 @@ export class DeleteSignatureDialogComponent {
* @param {any} data Documents data
*/
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;
}
}
@@ -65,7 +65,13 @@ export class ViewSignatureDialogComponent implements OnInit {
* @param {any} data Documents data
*/
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.clientId = this.data.id;
}