update loan product code and rd,fd,saving,current account validation add

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Nitesh Yadav
2026-05-14 07:40:04 +05:30
co-authored by Claude Sonnet 4.6
parent ed45c8637e
commit d0370781e8
30 changed files with 1286 additions and 213 deletions
@@ -14,6 +14,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { RecurringDepositsService } from '../recurring-deposits.service';
import { SettingsService } from 'app/settings/settings.service';
import { ProductsService } from 'app/products/products.service';
import { AlertService } from 'app/core/alert/alert.service';
/** Step Components */
import { RecurringDepositsAccountDetailsStepComponent } from '../recurring-deposits-account-stepper/recurring-deposits-account-details-step/recurring-deposits-account-details-step.component';
@@ -61,6 +62,7 @@ export class CreateRecurringDepositsAccountComponent {
private recurringDepositsService = inject(RecurringDepositsService);
private settingsService = inject(SettingsService);
private productsService = inject(ProductsService);
private alertService = inject(AlertService);
@ViewChild(RecurringDepositsAccountDetailsStepComponent, { static: true })
recurringDepositsAccountDetailsStep: RecurringDepositsAccountDetailsStepComponent;
@@ -157,6 +159,14 @@ export class CreateRecurringDepositsAccountComponent {
* Submits the recurring deposit form to create a new recurring deposit account
*/
submit() {
const detailsStep = this.recurringDepositsAccountDetailsStep;
if (detailsStep.selectedAccountStatus === 'JOINT' && detailsStep.totalJointSharePercentage !== 100) {
this.alertService.alert({
type: 'Error',
message: `Total ownership is ${detailsStep.totalJointSharePercentage}%. It must equal 100% before submitting.`
});
return;
}
const locale = this.settingsService.language.code;
const dateFormat = this.settingsService.dateFormat;
const monthDayFormat = 'dd MMMM';
@@ -22,6 +22,7 @@ import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { MatIcon } from '@angular/material/icon';
import { AddRelatedClientDialogComponent } from 'app/current-accounts/current-account-stepper/current-account-details-step/add-related-client-dialog/add-related-client-dialog.component';
import { AlertService } from 'app/core/alert/alert.service';
/**
* Recurring Deposits Account Details Step
@@ -48,6 +49,7 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
private cdr = inject(ChangeDetectorRef);
private clientsService = inject(ClientsService);
private dialog = inject(MatDialog);
private alertService = inject(AlertService);
/** Recurring Deposits Account Template */
@Input() recurringDepositsAccountTemplate: any;
@@ -198,15 +200,17 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
this.dalLoading = true;
this.clientsService.getClientAccountData(clientId).subscribe({
next: (data: any) => {
this.dalAllSavings = (data?.savingsAccounts ?? []).map((a: any) => ({
id: a.id,
accountNo: a.accountNo,
productName: a.productName ?? '',
accountType: 'SAVINGS' as const,
status: a.status?.value ?? '',
balance: a.accountBalance ?? 0,
currencyCode: a.currency?.code ?? ''
}));
this.dalAllSavings = (data?.savingsAccounts ?? [])
.filter((a: any) => a.depositType?.code === 'depositAccountType.savingsDeposit')
.map((a: any) => ({
id: a.id,
accountNo: a.accountNo,
productName: a.productName ?? '',
accountType: 'SAVINGS' as const,
status: a.status?.value ?? '',
balance: a.accountBalance ?? 0,
currencyCode: a.currency?.code ?? ''
}));
this.dalAllCurrent = (data?.currentAccounts ?? []).map((a: any) => ({
id: a.id,
accountNo: a.accountNo,
@@ -430,9 +434,13 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
});
ref.afterClosed().subscribe((result) => {
if (result) {
const duplicate = this.jointHolders.some((h) => h.clientCif && h.clientCif === result.clientCif);
const isPrimary = this.primaryClientCif && this.primaryClientCif === result.clientCif;
const duplicate = isPrimary || this.jointHolders.some((h) => h.clientCif && h.clientCif === result.clientCif);
if (duplicate) {
alert(`Account holder with CIF ${result.clientCif} is already added.`);
this.alertService.alert({
type: 'Error',
message: `Account holder with CIF ${result.clientCif} is already added.`
});
return;
}
this.jointHolders = [
@@ -540,7 +548,7 @@ export class RecurringDepositsAccountDetailsStepComponent implements OnInit {
value.guardianName = this.guardianName;
value.guardianCifNumber = this.guardianCif;
value.guardianRelationship = this.guardianRelationship;
value.minorDateOfBirth = this.minorDob ? this.dateUtils.formatDate(this.minorDob, 'yyyy-MM-dd') : null;
value.minorDateOfBirth = this.minorDob ? this.dateUtils.formatDate(this.minorDob, 'dd MMMM yyyy') : null;
}
if (this.selectedLinkedAccount) {
@@ -463,7 +463,7 @@
<!-- ══ 5. Dormancy Monitoring ════════════════════════════════════ -->
@if (
recurringDepositsAccountProductTemplate?.dormancyAlert ||
recurringDepositsAccountProductTemplate?.isDormancyTrackingActiveFromProduct
recurringDepositsAccountProductTemplate?.isDormancyTrackingActive
) {
<div class="preview-section">
<div class="preview-section__header">
@@ -471,11 +471,9 @@
<span class="preview-section__title">Dormancy Monitoring</span>
<span
class="preview-section__badge"
[class.preview-section__badge--active]="
recurringDepositsAccountProductTemplate?.isDormancyTrackingActiveFromProduct
"
[class.preview-section__badge--active]="recurringDepositsAccountProductTemplate?.isDormancyTrackingActive"
>
{{ recurringDepositsAccountProductTemplate?.isDormancyTrackingActiveFromProduct ? 'Active' : 'Inactive' }}
{{ recurringDepositsAccountProductTemplate?.isDormancyTrackingActive ? 'Active' : 'Inactive' }}
</span>
</div>
<div class="preview-body">
@@ -485,8 +483,8 @@
<div class="preview-dorm-step__body">
<span class="preview-dorm-step__label">Inactive</span>
<span class="preview-dorm-step__days">
@if (recurringDepositsAccountProductTemplate?.daysToInactiveFromProduct !== null) {
After {{ recurringDepositsAccountProductTemplate.daysToInactiveFromProduct }} days of no transaction
@if (recurringDepositsAccountProductTemplate?.daysToInactive != null) {
After {{ recurringDepositsAccountProductTemplate.daysToInactive }} days of no transaction
} @else {
Not configured
}
@@ -499,8 +497,8 @@
<div class="preview-dorm-step__body">
<span class="preview-dorm-step__label">Dormant</span>
<span class="preview-dorm-step__days">
@if (recurringDepositsAccountProductTemplate?.daysToDormancyFromProduct !== null) {
{{ recurringDepositsAccountProductTemplate.daysToDormancyFromProduct }} days after inactive
@if (recurringDepositsAccountProductTemplate?.daysToDormancy != null) {
{{ recurringDepositsAccountProductTemplate.daysToDormancy }} days after inactive
} @else {
Not configured
}
@@ -513,8 +511,8 @@
<div class="preview-dorm-step__body">
<span class="preview-dorm-step__label">Escheat</span>
<span class="preview-dorm-step__days">
@if (recurringDepositsAccountProductTemplate?.daysToEscheatFromProduct !== null) {
{{ recurringDepositsAccountProductTemplate.daysToEscheatFromProduct }} days after dormant
@if (recurringDepositsAccountProductTemplate?.daysToEscheat != null) {
{{ recurringDepositsAccountProductTemplate.daysToEscheat }} days after dormant
} @else {
Not configured
}
@@ -532,10 +530,10 @@
</span>
<span
class="preview-dorm-flag"
[class.preview-dorm-flag--on]="recurringDepositsAccountProductTemplate?.isDormancyTrackingActiveFromProduct"
[class.preview-dorm-flag--on]="recurringDepositsAccountProductTemplate?.isDormancyTrackingActive"
>
<i class="fas fa-eye"></i> Tracking
{{ recurringDepositsAccountProductTemplate?.isDormancyTrackingActiveFromProduct ? 'Active' : 'Inactive' }}
{{ recurringDepositsAccountProductTemplate?.isDormancyTrackingActive ? 'Active' : 'Inactive' }}
</span>
</div>
</div>