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:
co-authored by
Claude Sonnet 4.6
parent
ed45c8637e
commit
d0370781e8
+32
-3
@@ -13,6 +13,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
/** Custom Services */
|
||||
import { FixedDepositsService } from '../fixed-deposits.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { AlertService } from 'app/core/alert/alert.service';
|
||||
|
||||
/** Custom Components */
|
||||
import { FixedDepositAccountDetailsStepComponent } from '../fixed-deposit-account-stepper/fixed-deposit-account-details-step/fixed-deposit-account-details-step.component';
|
||||
@@ -59,6 +60,7 @@ export class CreateFixedDepositAccountComponent {
|
||||
private dateUtils = inject(Dates);
|
||||
private fixedDepositsService = inject(FixedDepositsService);
|
||||
private settingsService = inject(SettingsService);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
@ViewChild(FixedDepositAccountDetailsStepComponent, { static: true })
|
||||
fixedDepositsAccountDetailsStep: FixedDepositAccountDetailsStepComponent;
|
||||
@@ -70,7 +72,14 @@ export class CreateFixedDepositAccountComponent {
|
||||
/** Fixed Deposit Account Product Template */
|
||||
fixedDepositsAccountProductTemplate: any;
|
||||
/** Tenure selected from the interest rate chart step */
|
||||
selectedTenure: { depositPeriod: number; depositPeriodFrequencyId: number; depositAmount?: number } | null = null;
|
||||
selectedTenure: {
|
||||
depositPeriod: number;
|
||||
depositPeriodFrequencyId: number;
|
||||
depositAmount?: number;
|
||||
maturityAmount?: number;
|
||||
interestEarned?: number;
|
||||
appliedRate?: number;
|
||||
} | null = null;
|
||||
|
||||
/**
|
||||
* Fetches FD account template from `resolve`
|
||||
@@ -94,7 +103,14 @@ export class CreateFixedDepositAccountComponent {
|
||||
this.fixedDepositsAccountProductTemplate = $event;
|
||||
}
|
||||
|
||||
onTenureSelected($event: { depositPeriod: number; depositPeriodFrequencyId: number; depositAmount?: number }) {
|
||||
onTenureSelected($event: {
|
||||
depositPeriod: number;
|
||||
depositPeriodFrequencyId: number;
|
||||
depositAmount?: number;
|
||||
maturityAmount?: number;
|
||||
interestEarned?: number;
|
||||
appliedRate?: number;
|
||||
}) {
|
||||
this.selectedTenure = $event;
|
||||
}
|
||||
|
||||
@@ -126,6 +142,14 @@ export class CreateFixedDepositAccountComponent {
|
||||
* Submits the fixed deposit form and creates a new fixed deposit account
|
||||
*/
|
||||
submit() {
|
||||
const detailsStep = this.fixedDepositsAccountDetailsStep;
|
||||
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';
|
||||
@@ -178,7 +202,12 @@ export class CreateFixedDepositAccountComponent {
|
||||
...this.fixedDepositAccount,
|
||||
...terms,
|
||||
...settings,
|
||||
...(this.selectedTenure ?? {}),
|
||||
...(this.selectedTenure
|
||||
? {
|
||||
depositPeriod: this.selectedTenure.depositPeriod,
|
||||
depositPeriodFrequencyId: this.selectedTenure.depositPeriodFrequencyId
|
||||
}
|
||||
: {}),
|
||||
clientId: this.fixedDepositsAccountTemplate.clientId,
|
||||
charges: rawCharges.map((charge: any) => ({
|
||||
chargeId: charge.chargeId ?? charge.id,
|
||||
|
||||
+20
-12
@@ -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';
|
||||
|
||||
/**
|
||||
* Fixed Deposits Account Details Step
|
||||
@@ -48,6 +49,7 @@ export class FixedDepositAccountDetailsStepComponent implements OnInit {
|
||||
private cdr = inject(ChangeDetectorRef);
|
||||
private clientsService = inject(ClientsService);
|
||||
private dialog = inject(MatDialog);
|
||||
private alertService = inject(AlertService);
|
||||
|
||||
/** Fixed Deposits Account Template */
|
||||
@Input() fixedDepositsAccountTemplate: any;
|
||||
@@ -221,15 +223,17 @@ export class FixedDepositAccountDetailsStepComponent 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,
|
||||
@@ -469,9 +473,13 @@ export class FixedDepositAccountDetailsStepComponent 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 = [
|
||||
@@ -582,7 +590,7 @@ export class FixedDepositAccountDetailsStepComponent 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) {
|
||||
|
||||
+8
-2
@@ -76,6 +76,9 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
|
||||
depositPeriod: number;
|
||||
depositPeriodFrequencyId: number;
|
||||
depositAmount?: number;
|
||||
maturityAmount?: number;
|
||||
interestEarned?: number;
|
||||
appliedRate?: number;
|
||||
}>();
|
||||
|
||||
interestRateChartData: any[] = [];
|
||||
@@ -254,13 +257,16 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
|
||||
|
||||
this.matchResult = result;
|
||||
|
||||
// Emit selected tenure and principal amount to parent for backend submission
|
||||
// Emit selected tenure and calculated maturity to parent
|
||||
const frequencyId = this.resolveFrequencyId(this.tenurePeriodUnit);
|
||||
if (frequencyId !== null) {
|
||||
this.tenureSelected.emit({
|
||||
depositPeriod: this.tenureValue,
|
||||
depositPeriodFrequencyId: frequencyId,
|
||||
depositAmount: this.principalAmount || undefined
|
||||
depositAmount: this.principalAmount || undefined,
|
||||
maturityAmount: result.maturityAmount,
|
||||
interestEarned: result.interestEarned,
|
||||
appliedRate: result.appliedRate
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+41
-17
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
}
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">Share Linking Enabled</span>
|
||||
<span class="preview-label">Deposit Account Link</span>
|
||||
<span
|
||||
class="preview-value preview-badge"
|
||||
[class.preview-badge--yes]="fixedDepositsAccountProductTemplate?.shareLinkingEnabled"
|
||||
@@ -103,17 +103,6 @@
|
||||
{{ fixedDepositsAccountProductTemplate?.shareLinkingEnabled ? 'Yes' : 'No' }}
|
||||
</span>
|
||||
</div>
|
||||
@if (fixedDepositsAccountProductTemplate?.introducerRequired !== undefined) {
|
||||
<div class="preview-field">
|
||||
<span class="preview-label">Introducer Required</span>
|
||||
<span
|
||||
class="preview-value preview-badge"
|
||||
[class.preview-badge--yes]="fixedDepositsAccountProductTemplate?.introducerRequired"
|
||||
>
|
||||
{{ fixedDepositsAccountProductTemplate?.introducerRequired ? 'Yes' : 'No' }}
|
||||
</span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -316,12 +305,19 @@
|
||||
</div>
|
||||
|
||||
<!-- ══ 2b. Dormancy Monitoring ═══════════════════════════════════ -->
|
||||
@if (fixedDepositsAccountProductTemplate?.dormancyAlert) {
|
||||
@if (
|
||||
fixedDepositsAccountProductTemplate?.dormancyAlert || fixedDepositsAccountProductTemplate?.isDormancyTrackingActive
|
||||
) {
|
||||
<div class="preview-section">
|
||||
<div class="preview-section__header">
|
||||
<i class="fas fa-moon preview-section__icon"></i>
|
||||
<span class="preview-section__title">Dormancy Monitoring</span>
|
||||
<span class="preview-section__badge preview-section__badge--active">Monitoring: Active</span>
|
||||
<span
|
||||
class="preview-section__badge"
|
||||
[class.preview-section__badge--active]="fixedDepositsAccountProductTemplate?.isDormancyTrackingActive"
|
||||
>
|
||||
{{ fixedDepositsAccountProductTemplate?.isDormancyTrackingActive ? 'Active' : 'Inactive' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="preview-body">
|
||||
<div class="preview-dormancy-timeline">
|
||||
@@ -330,7 +326,11 @@
|
||||
<div class="preview-dorm-step__body">
|
||||
<span class="preview-dorm-step__label">Inactive</span>
|
||||
<span class="preview-dorm-step__days">
|
||||
After {{ fixedDepositsAccountProductTemplate?.daysToInactiveFromProduct || 30 }} days of no transaction
|
||||
@if (fixedDepositsAccountProductTemplate?.daysToInactive != null) {
|
||||
After {{ fixedDepositsAccountProductTemplate.daysToInactive }} days of no transaction
|
||||
} @else {
|
||||
Not configured
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -340,7 +340,11 @@
|
||||
<div class="preview-dorm-step__body">
|
||||
<span class="preview-dorm-step__label">Dormant</span>
|
||||
<span class="preview-dorm-step__days">
|
||||
{{ fixedDepositsAccountProductTemplate?.daysToDormancyFromProduct || 60 }} days after inactive
|
||||
@if (fixedDepositsAccountProductTemplate?.daysToDormancy != null) {
|
||||
{{ fixedDepositsAccountProductTemplate.daysToDormancy }} days after inactive
|
||||
} @else {
|
||||
Not configured
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -350,11 +354,31 @@
|
||||
<div class="preview-dorm-step__body">
|
||||
<span class="preview-dorm-step__label">Escheat</span>
|
||||
<span class="preview-dorm-step__days">
|
||||
{{ fixedDepositsAccountProductTemplate?.daysToEscheatFromProduct || 90 }} days after dormant
|
||||
@if (fixedDepositsAccountProductTemplate?.daysToEscheat != null) {
|
||||
{{ fixedDepositsAccountProductTemplate.daysToEscheat }} days after dormant
|
||||
} @else {
|
||||
Not configured
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="preview-dorm-flags">
|
||||
<span
|
||||
class="preview-dorm-flag"
|
||||
[class.preview-dorm-flag--on]="fixedDepositsAccountProductTemplate?.dormancyAlert"
|
||||
>
|
||||
<i class="fas fa-bell"></i> Alert
|
||||
{{ fixedDepositsAccountProductTemplate?.dormancyAlert ? 'Enabled' : 'Disabled' }}
|
||||
</span>
|
||||
<span
|
||||
class="preview-dorm-flag"
|
||||
[class.preview-dorm-flag--on]="fixedDepositsAccountProductTemplate?.isDormancyTrackingActive"
|
||||
>
|
||||
<i class="fas fa-eye"></i> Tracking
|
||||
{{ fixedDepositsAccountProductTemplate?.isDormancyTrackingActive ? 'Active' : 'Inactive' }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
+36
-13
@@ -423,31 +423,25 @@
|
||||
.preview-dormancy-timeline {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
margin: 1.25rem 0;
|
||||
overflow-x: auto;
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.preview-dorm-step {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
flex: 0 0 140px;
|
||||
gap: 10px;
|
||||
flex: 1;
|
||||
gap: 6px;
|
||||
|
||||
&__dot {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 3px solid #e2e8f0;
|
||||
background: #f8fafc;
|
||||
position: relative;
|
||||
box-shadow: 0 0 0 4px #fff;
|
||||
z-index: 2;
|
||||
flex-shrink: 0;
|
||||
|
||||
&--inactive {
|
||||
border-color: #f59e0b;
|
||||
@@ -517,3 +511,32 @@
|
||||
margin-top: 16px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.preview-dorm-flags {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.preview-dorm-flag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 20px;
|
||||
font-size: 11.5px;
|
||||
font-weight: 600;
|
||||
background: #f1f5f9;
|
||||
color: #94a3b8;
|
||||
border: 1px solid #e2e8f0;
|
||||
|
||||
i {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
&--on {
|
||||
background: #f0fdf4;
|
||||
color: #15803d;
|
||||
border-color: #bbf7d0;
|
||||
}
|
||||
}
|
||||
|
||||
+23
-10
@@ -76,9 +76,15 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
@Input() fixedDepositsAccountProductTemplate: any;
|
||||
/** Fixed Deposits Account Data */
|
||||
@Input() fixedDepositAccountData: any;
|
||||
/** Tenure selected from the interest rate chart step */
|
||||
@Input() selectedTenure: { depositPeriod: number; depositPeriodFrequencyId: number; depositAmount?: number } | null =
|
||||
null;
|
||||
/** Tenure selected from the interest rate chart step (includes pre-calculated maturity if user used calculator) */
|
||||
@Input() selectedTenure: {
|
||||
depositPeriod: number;
|
||||
depositPeriodFrequencyId: number;
|
||||
depositAmount?: number;
|
||||
maturityAmount?: number;
|
||||
interestEarned?: number;
|
||||
appliedRate?: number;
|
||||
} | null = null;
|
||||
|
||||
/** Charges Displayed Columns */
|
||||
chargesDisplayedColumns: string[] = [
|
||||
@@ -237,6 +243,20 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
this.fixedDepositsAccountProductTemplate?.depositAmount ??
|
||||
0;
|
||||
|
||||
// If the chart step already calculated maturity, use those values directly
|
||||
if (this.selectedTenure?.maturityAmount != null && this.selectedTenure.maturityAmount > 0) {
|
||||
const interestRate =
|
||||
this.selectedTenure.appliedRate ?? this.fixedDepositsAccountProductTemplate?.nominalAnnualInterestRate ?? 0;
|
||||
return {
|
||||
depositAmount,
|
||||
maturityAmount: this.selectedTenure.maturityAmount,
|
||||
totalInterest: this.selectedTenure.interestEarned ?? this.selectedTenure.maturityAmount - depositAmount,
|
||||
interestRate,
|
||||
tenureLabel: this.selectedTenureLabel
|
||||
};
|
||||
}
|
||||
|
||||
// Fallback: recalculate using product template settings
|
||||
const chartRate =
|
||||
this.matchedSlabIndex >= 0 ? this.interestRateChartData[this.matchedSlabIndex]?.annualInterestRate : null;
|
||||
const interestRate = chartRate ?? this.fixedDepositsAccountProductTemplate?.nominalAnnualInterestRate ?? 0;
|
||||
@@ -248,20 +268,15 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
this.fixedDepositsAccountProductTemplate?.interestCalculationDaysInYearType?.id === 360 ? 360 : 365;
|
||||
|
||||
if (depositPeriodFrequencyId === 0) {
|
||||
// Days
|
||||
t = depositPeriod / daysInYear;
|
||||
} else if (depositPeriodFrequencyId === 1) {
|
||||
// Weeks
|
||||
t = (depositPeriod * 7) / daysInYear;
|
||||
} else if (depositPeriodFrequencyId === 2) {
|
||||
// Months
|
||||
t = depositPeriod / 12;
|
||||
} else if (depositPeriodFrequencyId === 3) {
|
||||
// Years
|
||||
t = depositPeriod;
|
||||
}
|
||||
|
||||
// Compounding frequency (n)
|
||||
const compPeriodValue = (
|
||||
this.fixedDepositsAccountProductTemplate?.interestCompoundingPeriodType?.value || ''
|
||||
).toLowerCase();
|
||||
@@ -273,7 +288,6 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
else if (compPeriodValue.includes('biannual')) n = 2;
|
||||
else if (compPeriodValue.includes('annual')) n = 1;
|
||||
|
||||
// Interest Calculation Type
|
||||
const calcTypeValue = (
|
||||
this.fixedDepositsAccountProductTemplate?.interestCalculationType?.value || ''
|
||||
).toLowerCase();
|
||||
@@ -283,7 +297,6 @@ export class FixedDepositAccountPreviewStepComponent implements OnChanges {
|
||||
if (isSimple) {
|
||||
maturityAmount = depositAmount + depositAmount * r * t;
|
||||
} else {
|
||||
// Compound interest: A = P(1 + r/n)^(nt)
|
||||
maturityAmount = depositAmount * Math.pow(1 + r / n, n * t);
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -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';
|
||||
|
||||
+20
-12
@@ -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) {
|
||||
|
||||
+11
-13
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user