existing account saving and current add or remove nominee and digital & account features and also FE & RD nominee add or remove
This commit is contained in:
@@ -14,13 +14,37 @@
|
||||
<p class="nom-page-header__sub">Manage nominees for this account. Nominees are account-specific.</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (!loading && !nomineesLoading && totalShare < 100 && !showAddForm) {
|
||||
@if (!loading && !nomineesLoading && totalShare < 100 && !showAddForm && !hasPendingEdit) {
|
||||
<button mat-flat-button color="primary" class="nom-add-btn" (click)="showAddForm = true">
|
||||
<mat-icon>add</mat-icon> Add Nominee
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (pendingEditLoading) {
|
||||
<div class="esf-loading">
|
||||
<mat-progress-spinner diameter="20" mode="indeterminate"></mat-progress-spinner>
|
||||
<span>Checking for pending edits...</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!pendingEditLoading && hasPendingEdit) {
|
||||
<div class="esf-pending-banner">
|
||||
<mat-icon>hourglass_top</mat-icon>
|
||||
<div class="esf-pending-banner__text">
|
||||
<strong>An edit is already pending approval for this account.</strong>
|
||||
<span>
|
||||
Submitted by {{ pendingEdit.makerUsername || 'a maker' }} on {{ pendingEdit.createdOn | dateFormat }}. Status:
|
||||
<span class="esf-pending-banner__status">{{ pendingEdit.status }}</span>
|
||||
@if (pendingEdit.holdAmount) {
|
||||
· Hold placed: {{ pendingEdit.holdAmount }}
|
||||
}
|
||||
</span>
|
||||
<span>You cannot submit another edit until this one is approved or rejected.</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (loading) {
|
||||
<div class="nom-loading">
|
||||
<mat-progress-spinner diameter="24" mode="indeterminate"></mat-progress-spinner>
|
||||
@@ -98,18 +122,20 @@
|
||||
<button mat-icon-button type="button" matTooltip="View" (click)="viewNominee(nominee)">
|
||||
<mat-icon>visibility</mat-icon>
|
||||
</button>
|
||||
<button mat-icon-button type="button" matTooltip="Edit" (click)="editNominee(nominee, i)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
matTooltip="Delete"
|
||||
class="nom-card__delete"
|
||||
(click)="deleteNominee(nominee, i)"
|
||||
>
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
@if (!hasPendingEdit) {
|
||||
<button mat-icon-button type="button" matTooltip="Edit" (click)="editNominee(nominee, i)">
|
||||
<mat-icon>edit</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
mat-icon-button
|
||||
type="button"
|
||||
matTooltip="Delete"
|
||||
class="nom-card__delete"
|
||||
(click)="deleteNominee(nominee, i)"
|
||||
>
|
||||
<mat-icon>delete</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@if (nominee.nomineeIsMinor && (nominee.guardianDisplayName || nominee.guardianName)) {
|
||||
|
||||
@@ -645,3 +645,56 @@ $primary-light: #e8f0fe;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
$border: #e2e8f0;
|
||||
$muted: #64748b;
|
||||
$amber: #92400e;
|
||||
$amber-bg: #fffbeb;
|
||||
$amber-border: #fde68a;
|
||||
|
||||
.esf-loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 20px 0;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
color: $muted;
|
||||
|
||||
&--sm {
|
||||
padding: 10px 0;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.esf-pending-banner {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 10px;
|
||||
padding: 12px 16px;
|
||||
background: $amber-bg;
|
||||
border: 1px solid $amber-border;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 16px;
|
||||
color: $amber;
|
||||
|
||||
mat-icon {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
&__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
font-size: 12.5px;
|
||||
|
||||
strong {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
&__status {
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ import { MatSlideToggle } from '@angular/material/slide-toggle';
|
||||
import { DateFormatPipe } from '../../pipes/date-format.pipe';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { SuccessDialogComponent } from 'app/shared/success-dialog/success-dialog.component';
|
||||
import { CurrentAccountsService } from 'app/current-accounts/current-accounts.service';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-account-nominees-tab',
|
||||
@@ -41,11 +44,14 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
private clientsService = inject(ClientsService);
|
||||
private dialog = inject(MatDialog);
|
||||
private sanitizer = inject(DomSanitizer);
|
||||
private savingsService = inject(SavingsService);
|
||||
private currentAccountsService = inject(CurrentAccountsService);
|
||||
|
||||
/** Set by route data */
|
||||
accountDataKey: string = '';
|
||||
accountType: string = '';
|
||||
|
||||
accountId: string = '';
|
||||
clientId: string = '';
|
||||
accountNo: string = '';
|
||||
loading = true;
|
||||
@@ -53,6 +59,9 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
nominees: any[] = [];
|
||||
nomineesLoading = false;
|
||||
|
||||
pendingEdit: any = null;
|
||||
pendingEditLoading = true;
|
||||
|
||||
showAddForm = false;
|
||||
searchText = '';
|
||||
searchResults: any[] = [];
|
||||
@@ -110,15 +119,45 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
this.route.parent.data.subscribe((data: any) => {
|
||||
const accountData = data[this.accountDataKey];
|
||||
if (accountData) {
|
||||
this.accountId = accountData.id?.toString() || this.route.parent.snapshot.params['savingAccountId'] || '';
|
||||
this.clientId = accountData.clientId?.toString() || '';
|
||||
this.accountNo = accountData.accountNo || '';
|
||||
this.loading = false;
|
||||
this.loadPendingEdit();
|
||||
this.loadNominees();
|
||||
this.loadTemplate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private loadPendingEdit(): void {
|
||||
this.pendingEditLoading = true;
|
||||
const fetch$ =
|
||||
this.accountType === 'CB'
|
||||
? this.currentAccountsService.getPendingCurrentAccountEdit(this.accountId)
|
||||
: this.savingsService.getPendingSavingsAccountEdit(this.accountId);
|
||||
fetch$.subscribe({
|
||||
next: (edit: any) => {
|
||||
this.pendingEdit = edit && edit.id ? edit : null;
|
||||
this.pendingEditLoading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.pendingEdit = null;
|
||||
this.pendingEditLoading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
get hasPendingEdit(): boolean {
|
||||
return !!this.pendingEdit && this.pendingEdit.status === 'PENDING';
|
||||
}
|
||||
|
||||
private todayIso(): string {
|
||||
const d = new Date();
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
||||
}
|
||||
|
||||
private loadTemplate(): void {
|
||||
this.clientsService.getClientNomineeTemplate(this.clientId).subscribe({
|
||||
next: (template: any) => {
|
||||
@@ -356,27 +395,34 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
if (this.guardianSameAsNominee) return;
|
||||
|
||||
this.nomineeSaving = true;
|
||||
const payload: any = {
|
||||
const nomineePayload: any = {
|
||||
operation: 'ADD',
|
||||
nomineeId: null,
|
||||
nomineeClientId: this.selectedClient.id,
|
||||
accountNo: this.accountNo,
|
||||
accountType: this.accountType,
|
||||
nominationType: this.nomineeNomType,
|
||||
relationshipId: this.nomineeRelationshipId,
|
||||
percentageShare: this.nomineeShare,
|
||||
isActive: true,
|
||||
nomineeIsMinor: this.nomineeIsMinor,
|
||||
remarks: this.nomineeRemarks || null,
|
||||
locale: 'en'
|
||||
guardianClientId: this.nomineeIsMinor && this.selectedGuardian ? this.selectedGuardian.id : null,
|
||||
guardianRelationshipId: null,
|
||||
effectiveDate: this.todayIso(),
|
||||
remarks: this.nomineeRemarks || null
|
||||
};
|
||||
|
||||
if (this.nomineeIsMinor && this.selectedGuardian) {
|
||||
payload.guardianClientId = this.selectedGuardian.id;
|
||||
}
|
||||
const payload = {
|
||||
locale: 'en',
|
||||
dateFormat: 'yyyy-MM-dd',
|
||||
nominee: nomineePayload
|
||||
};
|
||||
|
||||
this.clientsService.addNominee(this.clientId, payload).subscribe({
|
||||
const submit$ =
|
||||
this.accountType === 'CB'
|
||||
? this.currentAccountsService.submitCurrentAccountEdit(this.accountId, payload)
|
||||
: this.savingsService.submitSavingsAccountEdit(this.accountId, payload);
|
||||
submit$.subscribe({
|
||||
next: () => {
|
||||
this.nomineeSaving = false;
|
||||
this.loadNominees();
|
||||
this.resetAddForm();
|
||||
this.showSuccess();
|
||||
},
|
||||
error: () => {
|
||||
this.nomineeSaving = false;
|
||||
@@ -384,6 +430,24 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
private showSuccess(): void {
|
||||
const ref = this.dialog.open(SuccessDialogComponent, {
|
||||
width: '420px',
|
||||
maxWidth: '92vw',
|
||||
autoFocus: false,
|
||||
data: {
|
||||
title: 'Submitted for Approval',
|
||||
message: 'Your changes have been submitted and are awaiting checker approval.',
|
||||
buttonLabel: 'Done'
|
||||
}
|
||||
});
|
||||
ref.afterClosed().subscribe(() => {
|
||||
this.loadPendingEdit();
|
||||
this.loadNominees();
|
||||
this.resetAddForm();
|
||||
});
|
||||
}
|
||||
|
||||
viewNominee(nominee: any): void {
|
||||
const clientId = nominee.nomineeClientId || nominee.linkedClientId || nominee.clientId;
|
||||
const displayName = nominee.nomineeDisplayName || nominee.firstName || '';
|
||||
@@ -432,17 +496,33 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
if (!this.editRelId || !this.editShare || this.editShare < 1 || this.editShare > this.maxShareForEdit(index))
|
||||
return;
|
||||
|
||||
const payload: any = {
|
||||
const nomineePayload: any = {
|
||||
operation: 'UPDATE',
|
||||
nomineeId: nominee.id,
|
||||
relationshipId: this.editRelId,
|
||||
percentageShare: this.editShare,
|
||||
nominationType: this.editNomType,
|
||||
locale: 'en'
|
||||
isActive: nominee.isActive !== undefined ? !!nominee.isActive : true,
|
||||
nomineeIsMinor: !!nominee.nomineeIsMinor,
|
||||
guardianClientId: nominee.nomineeIsMinor ? nominee.guardianClientId : null,
|
||||
guardianRelationshipId: nominee.nomineeIsMinor ? nominee.guardianRelationshipId : null,
|
||||
effectiveDate: this.todayIso(),
|
||||
remarks: nominee.remarks || null
|
||||
};
|
||||
|
||||
this.clientsService.updateNominee(this.clientId, nominee.id.toString(), payload).subscribe({
|
||||
const payload = {
|
||||
locale: 'en',
|
||||
dateFormat: 'yyyy-MM-dd',
|
||||
nominee: nomineePayload
|
||||
};
|
||||
|
||||
const submit$ =
|
||||
this.accountType === 'CB'
|
||||
? this.currentAccountsService.submitCurrentAccountEdit(this.accountId, payload)
|
||||
: this.savingsService.submitSavingsAccountEdit(this.accountId, payload);
|
||||
submit$.subscribe({
|
||||
next: () => {
|
||||
this.loadNominees();
|
||||
this.editingIndex = null;
|
||||
this.showSuccess();
|
||||
},
|
||||
error: () => {}
|
||||
});
|
||||
@@ -454,9 +534,26 @@ export class AccountNomineesTabComponent implements OnInit {
|
||||
});
|
||||
ref.afterClosed().subscribe((response: any) => {
|
||||
if (response?.delete) {
|
||||
this.clientsService.deleteNominee(this.clientId, nominee.id.toString()).subscribe({
|
||||
next: () => this.nominees.splice(index, 1),
|
||||
error: () => this.nominees.splice(index, 1)
|
||||
const nomineePayload: any = {
|
||||
operation: 'DELETE',
|
||||
nomineeId: nominee.id
|
||||
};
|
||||
|
||||
const payload = {
|
||||
locale: 'en',
|
||||
dateFormat: 'yyyy-MM-dd',
|
||||
nominee: nomineePayload
|
||||
};
|
||||
|
||||
const submit$ =
|
||||
this.accountType === 'CB'
|
||||
? this.currentAccountsService.submitCurrentAccountEdit(this.accountId, payload)
|
||||
: this.savingsService.submitSavingsAccountEdit(this.accountId, payload);
|
||||
submit$.subscribe({
|
||||
next: () => {
|
||||
this.showSuccess();
|
||||
},
|
||||
error: () => {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,7 +19,13 @@
|
||||
<div class="intro-search-wrap">
|
||||
<mat-form-field appearance="outline" class="intro-search-field">
|
||||
<mat-label>Search by Name or Client ID</mat-label>
|
||||
<input matInput [value]="searchText" (input)="onSearch($any($event.target).value)" autocomplete="off" />
|
||||
<input
|
||||
matInput
|
||||
[value]="searchText"
|
||||
(input)="onSearch($any($event.target).value)"
|
||||
autocomplete="off"
|
||||
[disabled]="disabled"
|
||||
/>
|
||||
<mat-icon matSuffix>search</mat-icon>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -86,9 +92,11 @@
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<button mat-icon-button type="button" (click)="removeClient()" class="intro-card__remove">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
@if (!disabled) {
|
||||
<button mat-icon-button type="button" (click)="removeClient()" class="intro-card__remove">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (fetchingLinkedData) {
|
||||
|
||||
@@ -33,6 +33,7 @@ export class IntroducerSearchComponent implements OnChanges {
|
||||
|
||||
@Input() excludedClientIds: number[] = [];
|
||||
@Input() preselectedIntroducer: { clientId: number; displayName: string; cifNumber?: string } | null = null;
|
||||
@Input() disabled = false;
|
||||
@Output() introducerChange = new EventEmitter<{ clientId: number; displayName: string; cifNumber?: string } | null>();
|
||||
|
||||
entryMode: 'linked' = 'linked';
|
||||
|
||||
Reference in New Issue
Block a user