feat: add nominee, auto-debit, charges UI for SB/CA/FD/RD accounts; enforce required fields
- SB/CA/FD/RD Currency Step: add Nomination Facility toggle with multi-nominee form (NomineeFormComponent), auto-debit facility toggle, dormancy alert panel - SB/CA/FD/RD Preview Step: display nominees list, auto-debit status, dormancy info - FD/RD create component: validate Deposit Tenure, Monthly Installment (RD), and Customer Segment are filled before submit; show clear alert messages on missing fields - FD account details step: remove duplicate Currency section (already shown in Currency & Account Status Configuration step) - CA/SB create component: handle duplicate externalId API error with user-friendly alert instead of raw error display Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
37ac15f42c
commit
3df7d100df
+57
-5
@@ -73,11 +73,63 @@
|
||||
</span>
|
||||
</div>
|
||||
@if (currentAccountProductTemplate?.nominationFacility) {
|
||||
<mifosx-nominee-form
|
||||
[primaryClientId]="primaryClientId"
|
||||
[showActions]="false"
|
||||
(nomineeChange)="onNomineeChange($event)"
|
||||
></mifosx-nominee-form>
|
||||
<div class="nom-section">
|
||||
<div class="nom-header">
|
||||
<div class="nom-header__left"><i class="fas fa-user-friends"></i><span>Nominees</span></div>
|
||||
<span class="nom-share-badge" [class.nom-share-badge--full]="totalShare === 100"
|
||||
>{{ totalShare }}% / 100%</span
|
||||
>
|
||||
</div>
|
||||
@if (nominees.length > 0) {
|
||||
<div class="nom-list">
|
||||
@for (nom of nominees; track nom.nomineeClientId; let i = $index) {
|
||||
<div class="nom-item">
|
||||
<div class="nom-item__info">
|
||||
<span class="nom-item__name">{{ nom.nomineeDisplayName }}</span>
|
||||
<span class="nom-item__meta">{{ nom.relationshipName }} • {{ nom.percentageShare }}% share</span>
|
||||
@if (nom.nomineeIsMinor) {
|
||||
<span class="nom-item__minor">Minor — Guardian: {{ nom.guardianDisplayName }}</span>
|
||||
}
|
||||
</div>
|
||||
<button type="button" class="nom-remove-btn" (click)="removeNominee(i)">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (canAddMore && !showNomineeForm) {
|
||||
<button type="button" class="nom-add-btn" (click)="showNomineeForm = true">
|
||||
<i class="fas fa-plus"></i> Add Nominee
|
||||
@if (nominees.length > 0) {
|
||||
<span class="nom-add-btn__hint">({{ remainingShare }}% remaining)</span>
|
||||
}
|
||||
</button>
|
||||
}
|
||||
@if (totalShare === 100) {
|
||||
<div class="nom-complete"><i class="fas fa-check-circle"></i> Nominee allocation complete (100%)</div>
|
||||
}
|
||||
@if (showNomineeForm) {
|
||||
<div class="nom-form-wrap">
|
||||
@if (nomineeError) {
|
||||
<div class="nom-error"><i class="fas fa-exclamation-triangle"></i> {{ nomineeError }}</div>
|
||||
}
|
||||
<mifosx-nominee-form
|
||||
[primaryClientId]="primaryClientId"
|
||||
[showActions]="false"
|
||||
(nomineeChange)="onNomineeChange($event)"
|
||||
></mifosx-nominee-form>
|
||||
<div class="nom-form-actions">
|
||||
<button type="button" class="nom-cancel-btn" (click)="showNomineeForm = false; nomineeError = ''">
|
||||
Cancel
|
||||
</button>
|
||||
<button type="button" class="nom-confirm-btn" (click)="addNominee()">
|
||||
<i class="fas fa-plus"></i> Add
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+212
@@ -128,3 +128,215 @@ $gray-900: #202124;
|
||||
color: #0369a1;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Nominees ── */
|
||||
.nom-section {
|
||||
margin-top: 16px;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.nom-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 16px;
|
||||
background: #f8fafc;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
|
||||
&__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: #334155;
|
||||
|
||||
i {
|
||||
color: #1d4ed8;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.nom-share-badge {
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
background: #e0e7ff;
|
||||
color: #3730a3;
|
||||
border: 1px solid #c7d2fe;
|
||||
|
||||
&--full {
|
||||
background: #dcfce7;
|
||||
color: #15803d;
|
||||
border-color: #bbf7d0;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.nom-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 16px;
|
||||
border-bottom: 1px dashed #e2e8f0;
|
||||
|
||||
&__info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
&__name {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
font-size: 11px;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
&__minor {
|
||||
font-size: 11px;
|
||||
color: #b45309;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-remove-btn {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
border: 1px solid #fecaca;
|
||||
background: #fee2e2;
|
||||
color: #b91c1c;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 11px;
|
||||
flex-shrink: 0;
|
||||
transition: background 0.15s;
|
||||
|
||||
&:hover {
|
||||
background: #fecaca;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-add-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
padding: 10px 16px;
|
||||
background: #fff;
|
||||
border: none;
|
||||
border-top: 1px dashed #e2e8f0;
|
||||
color: #1d4ed8;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s;
|
||||
|
||||
i {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&__hint {
|
||||
font-size: 11px;
|
||||
color: #64748b;
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #eff6ff;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-complete {
|
||||
padding: 10px 16px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #15803d;
|
||||
background: #f0fdf4;
|
||||
border-top: 1px solid #bbf7d0;
|
||||
|
||||
i {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-form-wrap {
|
||||
padding: 16px;
|
||||
background: #f8fafc;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
|
||||
.nom-error {
|
||||
padding: 8px 12px;
|
||||
margin-bottom: 12px;
|
||||
background: #fee2e2;
|
||||
border: 1px solid #fecaca;
|
||||
border-radius: 6px;
|
||||
color: #b91c1c;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
|
||||
i {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-form-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
justify-content: flex-end;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.nom-cancel-btn {
|
||||
padding: 7px 18px;
|
||||
border-radius: 7px;
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #fff;
|
||||
color: #64748b;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
|
||||
&:hover {
|
||||
background: #f1f5f9;
|
||||
}
|
||||
}
|
||||
|
||||
.nom-confirm-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 7px 18px;
|
||||
border-radius: 7px;
|
||||
border: none;
|
||||
background: #1d4ed8;
|
||||
color: #fff;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
|
||||
i {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: #1e40af;
|
||||
}
|
||||
}
|
||||
|
||||
+42
-7
@@ -30,7 +30,10 @@ export class CurrentAccountCurrencyStepComponent implements OnChanges {
|
||||
@Input() primaryClientId: number | null = null;
|
||||
@ViewChild(NomineeFormComponent) nomineeFormComp: NomineeFormComponent;
|
||||
|
||||
nomineeData: any = null;
|
||||
nominees: any[] = [];
|
||||
pendingNominee: any = null;
|
||||
showNomineeForm = false;
|
||||
nomineeError = '';
|
||||
|
||||
// Editable feature toggles (pre-filled from product, overridable by user)
|
||||
balanceSwapOption = false;
|
||||
@@ -46,21 +49,53 @@ export class CurrentAccountCurrencyStepComponent implements OnChanges {
|
||||
}
|
||||
}
|
||||
|
||||
get totalShare(): number {
|
||||
return this.nominees.reduce((sum, n) => sum + (+n.percentageShare || 0), 0);
|
||||
}
|
||||
|
||||
get remainingShare(): number {
|
||||
return 100 - this.totalShare;
|
||||
}
|
||||
|
||||
get canAddMore(): boolean {
|
||||
return this.totalShare < 100;
|
||||
}
|
||||
|
||||
onNomineeChange(event: any): void {
|
||||
this.nomineeData = event;
|
||||
this.pendingNominee = event;
|
||||
this.nomineeError = '';
|
||||
}
|
||||
|
||||
get liveNomineeData(): any {
|
||||
return this.nomineeFormComp?.currentNomineeData ?? this.nomineeData;
|
||||
addNominee(): void {
|
||||
const data = this.nomineeFormComp?.currentNomineeData ?? this.pendingNominee;
|
||||
if (!data?.nomineeClientId) {
|
||||
this.nomineeError = 'Please select a nominee before adding.';
|
||||
return;
|
||||
}
|
||||
if (this.nominees.some((n) => n.nomineeClientId === data.nomineeClientId)) {
|
||||
this.nomineeError = 'This person is already added as a nominee.';
|
||||
return;
|
||||
}
|
||||
const newTotal = this.totalShare + (+data.percentageShare || 0);
|
||||
if (newTotal > 100) {
|
||||
this.nomineeError = `Total share cannot exceed 100%. Remaining: ${this.remainingShare}%`;
|
||||
return;
|
||||
}
|
||||
this.nominees.push({ ...data });
|
||||
this.pendingNominee = null;
|
||||
this.showNomineeForm = false;
|
||||
this.nomineeError = '';
|
||||
}
|
||||
|
||||
removeNominee(index: number): void {
|
||||
this.nominees.splice(index, 1);
|
||||
}
|
||||
|
||||
/** Called by parent to collect currency step values */
|
||||
get currencyStepData() {
|
||||
return {
|
||||
balanceSwapOption: this.balanceSwapOption,
|
||||
msme: this.msme,
|
||||
autoDebitFacility: this.autoDebitFacility,
|
||||
...(this.nomineeData ? { nominee: this.nomineeData } : {})
|
||||
autoDebitFacility: this.autoDebitFacility
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user