fix: nominee share & joint ownership validation across all account types

- Block 0% nominee share in all steppers (Savings, FD, RD, Current) —
  Add button disabled via isValid, addNominee() guards < 1, nominee-form
  error condition fixed for value=0
- Joint ownership: default primary share 50%, enforce min 1% on blur,
  max 100% on input with DOM clamp via $event, auto-redistribute
  co-holders proportionally when primary share changes,
  isJointOwnershipValid guards each holder >= 1
- Pending/Rejected account tabs: normalize date format to 22 May 2026
  for both array and string date values from API

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-05-23 14:05:00 +05:30
co-authored by Claude Sonnet 4.6
parent df96be9a0e
commit ad6f629c3f
25 changed files with 337 additions and 35 deletions
@@ -143,7 +143,9 @@
<mat-form-field appearance="outline" class="nom-edit-field nom-edit-field--sm">
<mat-label>Share %</mat-label>
<input matInput type="number" [(ngModel)]="editShare" min="1" [max]="maxShareForEdit(i)" />
@if (editShare && editShare > maxShareForEdit(i)) {
@if (editShare !== null && editShare !== undefined && editShare < 1) {
<mat-error>Share must be at least 1%</mat-error>
} @else if (editShare && editShare > maxShareForEdit(i)) {
<mat-error>Max {{ maxShareForEdit(i) }}%</mat-error>
}
</mat-form-field>
@@ -152,7 +154,7 @@
color="primary"
type="button"
class="nom-edit-save"
[disabled]="!editRelId || !editShare || editShare > maxShareForEdit(i)"
[disabled]="!editRelId || !editShare || editShare < 1 || editShare > maxShareForEdit(i)"
(click)="saveEdit(nominee, i)"
>
<mat-icon>check</mat-icon>
@@ -317,7 +319,9 @@
<mat-form-field appearance="outline" class="nom-field-item nom-field-item--sm">
<mat-label>Share %</mat-label>
<input matInput type="number" [(ngModel)]="nomineeShare" min="1" [max]="maxAllowedShare" />
@if (nomineeShare && nomineeShare > maxAllowedShare) {
@if (nomineeShare !== null && nomineeShare !== undefined && nomineeShare < 1) {
<mat-error>Share must be at least 1%</mat-error>
} @else if (nomineeShare && nomineeShare > maxAllowedShare) {
<mat-error>Max {{ maxAllowedShare }}%</mat-error>
}
</mat-form-field>
@@ -398,6 +402,7 @@
[disabled]="
!nomineeRelationshipId ||
!nomineeShare ||
nomineeShare < 1 ||
nomineeSaving ||
nomineeShare > maxAllowedShare ||
(nomineeIsMinor && !selectedGuardian) ||
@@ -351,7 +351,7 @@ export class AccountNomineesTabComponent implements OnInit {
}
saveNominee(): void {
if (!this.selectedClient || !this.nomineeRelationshipId || !this.nomineeShare) return;
if (!this.selectedClient || !this.nomineeRelationshipId || !this.nomineeShare || this.nomineeShare < 1) return;
if (this.totalShare + this.nomineeShare > 100) return;
if (this.guardianSameAsNominee) return;
@@ -429,7 +429,8 @@ export class AccountNomineesTabComponent implements OnInit {
}
saveEdit(nominee: any, index: number): void {
if (!this.editRelId || !this.editShare || this.editShare > this.maxShareForEdit(index)) return;
if (!this.editRelId || !this.editShare || this.editShare < 1 || this.editShare > this.maxShareForEdit(index))
return;
const payload: any = {
relationshipId: this.editRelId,
@@ -162,8 +162,12 @@
<mat-form-field appearance="outline" class="nom-field-item nom-field-item--sm">
<mat-label>Share %</mat-label>
<input matInput type="number" [(ngModel)]="percentageShare" min="1" max="100" />
@if (percentageShare && (percentageShare < 1 || percentageShare > 100)) {
<mat-error>1–100</mat-error>
@if (
percentageShare !== null &&
percentageShare !== undefined &&
(percentageShare < 1 || percentageShare > 100)
) {
<mat-error>Share must be 1–100%</mat-error>
}
</mat-form-field>