Edit-mode now shows the previously selected KYC document type + uploaded file thumbnail
(loads from /clients/{id}/identifiers + /client_identifiers/{id}/documents). Same for
address proof on the India address step. Closes the gap where editing a client showed
an empty file picker even when proof had been uploaded on create.
Identifier-save hardened across all three callsites (create-client, edit-client,
identities-tab.createIdentifierWithDocs) - the KYC chip picker proofId is a CODE
string ('AADHAAR'), but backend ClientIdentifierRequest.documentTypeId is Long, which
Spring rejects with HttpMessageNotReadableException -> 400. resolveDocumentTypeId
helper looks up the code against /kyc/proof-types?type=id and substitutes the numeric
CodeValue id before posting. Skips silently for constitution-specific non-individual
docs that have no CodeValue mapping.
KYC payload normalises panNumber / enterprisePan / gstinNumber / cinNumber via
toUpperCase + whitespace strip so user-typed lowercase or trailing spaces don't trip
the backend regex (validation.msg.CLIENTKYC.panNumber.does.not.match.regexp).
State name match in client-address save now normalises both sides (lowercase, collapse
underscores + spaces) so legacy MADHYA_PRADESH resolves to 'Madhya Pradesh' returned
by api.postalpincode.in. Backed by tenant migration 0297.
Identities-tab resolver flattened - was returning identifiers before the per-row
forkJoin(getClientIdentificationDocuments) completed, so the view rendered empty
documents arrays. Now uses switchMap + forkJoin so the resolver awaits completion.
Also bundles concurrent work-in-progress on letter-mgmt, organization, users,
bank-calendar, shell, nominee/notes/identifier dialogs, and theming.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
82 lines
2.5 KiB
TypeScript
82 lines
2.5 KiB
TypeScript
/**
|
|
* Copyright since 2025 Mifos Initiative
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
/** Angular Imports */
|
|
import { Component, OnInit, inject } from '@angular/core';
|
|
import {
|
|
MatDialogRef,
|
|
MAT_DIALOG_DATA,
|
|
MatDialogTitle,
|
|
MatDialogActions,
|
|
MatDialogClose
|
|
} from '@angular/material/dialog';
|
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|
import { minWordsValidator } from 'app/shared/validators/min-words.validator';
|
|
|
|
@Component({
|
|
selector: 'mifosx-edit-notes-dialog',
|
|
templateUrl: './edit-notes-dialog.component.html',
|
|
styleUrls: ['./edit-notes-dialog.component.scss'],
|
|
imports: [
|
|
...STANDALONE_SHARED_IMPORTS,
|
|
MatDialogTitle,
|
|
MatDialogActions,
|
|
MatDialogClose,
|
|
MatTooltip
|
|
]
|
|
})
|
|
export class EditNotesDialogComponent implements OnInit {
|
|
dialogRef = inject<MatDialogRef<EditNotesDialogComponent>>(MatDialogRef);
|
|
private formBuilder = inject(UntypedFormBuilder);
|
|
data = inject(MAT_DIALOG_DATA);
|
|
|
|
noteForm: UntypedFormGroup;
|
|
|
|
ngOnInit() {
|
|
this.createNoteForm();
|
|
}
|
|
|
|
createNoteForm() {
|
|
this.noteForm = this.formBuilder.group({
|
|
// Same rule as the entity-notes Add form — reject whitespace / single-word.
|
|
note: [
|
|
this.data.noteContent,
|
|
[
|
|
Validators.required,
|
|
minWordsValidator(2)
|
|
]
|
|
]
|
|
});
|
|
}
|
|
|
|
/** Block whitespace at position 0 of an otherwise-empty textarea. */
|
|
onNoteKeyDown(event: KeyboardEvent): void {
|
|
if (event.key !== ' ' && event.key !== 'Tab' && event.key !== 'Enter') return;
|
|
const el = event.target as HTMLTextAreaElement;
|
|
if (el.selectionStart === 0 && el.value.trim() === '') {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
|
|
/** Strip leading whitespace + collapse internal runs of spaces/tabs. */
|
|
onNoteInput(event: Event): void {
|
|
const el = event.target as HTMLTextAreaElement;
|
|
const before = el.value;
|
|
const after = before.replace(/^[ \t]+/, '').replace(/[ \t]{2,}/g, ' ');
|
|
if (before !== after) {
|
|
const cursorDelta = before.length - after.length;
|
|
const pos = Math.max(0, (el.selectionStart ?? after.length) - cursorDelta);
|
|
el.value = after;
|
|
this.noteForm.get('note')!.setValue(after, { emitEvent: false });
|
|
el.setSelectionRange(pos, pos);
|
|
}
|
|
}
|
|
}
|