update code account saving,current,RD

This commit is contained in:
Nitesh Yadav
2026-04-24 16:24:28 +05:30
parent fc1c5126fc
commit fbaec18552
49 changed files with 4221 additions and 2260 deletions
@@ -35,7 +35,7 @@
</ng-template>
<!-- Step 1: Details -->
<mat-step [stepControl]="currentAccountDetailsForm">
<mat-step>
<ng-template matStepLabel>{{ 'labels.inputs.DETAILS' | translate }}</ng-template>
<mifosx-current-account-details-step
@@ -45,64 +45,48 @@
</mifosx-current-account-details-step>
</mat-step>
<!-- Step 2: Currency -->
<mat-step>
<ng-template matStepLabel>CURRENCY</ng-template>
@if (currentAccountProductTemplate) {
<!-- Step 2: Currency -->
<mat-step>
<ng-template matStepLabel>CURRENCY</ng-template>
<mifosx-current-account-currency-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
></mifosx-current-account-currency-step>
</mat-step>
<!-- Step 3: Term (Interest Rate) -->
<mat-step [stepControl]="currentAccountTermForm">
<ng-template matStepLabel>{{ 'labels.inputs.TERMS' | translate }}</ng-template>
<mifosx-current-account-term-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
></mifosx-current-account-term-step>
</mat-step>
<!-- Step 4: Settings -->
<mat-step>
<ng-template matStepLabel>SETTINGS</ng-template>
<mifosx-current-account-settings-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
></mifosx-current-account-settings-step>
</mat-step>
<!-- Step 5: Digital -->
<mat-step>
<ng-template matStepLabel>DIGITAL</ng-template>
<mifosx-current-account-digital-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
></mifosx-current-account-digital-step>
</mat-step>
<!-- Step 6: Charges -->
<mat-step>
<ng-template matStepLabel>{{ 'labels.inputs.CHARGES' | translate }}</ng-template>
<mifosx-current-account-charges-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
[currentAccountTemplate]="currentAccountTemplate"
[currencyCode]="currentAccountTermsForm.get('currencyCode')"
>
</mifosx-current-account-charges-step>
<!-- Hidden terms step to keep currencyCode form populated -->
<div style="display: none">
<mifosx-current-account-terms-step
<mifosx-current-account-currency-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
[currentAccountTemplate]="currentAccountTemplate"
></mifosx-current-account-terms-step>
</div>
</mat-step>
></mifosx-current-account-currency-step>
<!-- Step 7: Preview -->
@if (currentAccountFormValid) {
<div class="layout-row align-center gap-2percent margin-t responsive-column">
<button mat-raised-button matStepperPrevious>
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Previous' | translate }}
</button>
<button mat-raised-button matStepperNext>
{{ 'labels.buttons.Next' | translate }}
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
</button>
</div>
</mat-step>
<!-- Step 3: Digital -->
<mat-step>
<ng-template matStepLabel>DIGITAL</ng-template>
<mifosx-current-account-digital-step
[currentAccountProductTemplate]="currentAccountProductTemplate"
></mifosx-current-account-digital-step>
<div class="layout-row align-center gap-2percent margin-t responsive-column">
<button mat-raised-button matStepperPrevious>
<fa-icon icon="arrow-left" class="m-r-10"></fa-icon>
{{ 'labels.buttons.Previous' | translate }}
</button>
<button mat-raised-button matStepperNext>
{{ 'labels.buttons.Next' | translate }}
<fa-icon icon="arrow-right" class="m-l-10"></fa-icon>
</button>
</div>
</mat-step>
<!-- Step 4: Preview -->
<mat-step completed>
<ng-template matStepLabel>{{ 'labels.inputs.PREVIEW' | translate }}</ng-template>
<mifosx-current-account-preview-step
@@ -27,11 +27,14 @@
.mat-step-content {
padding: 1.5rem;
margin: 1rem 0;
overflow: visible !important;
}
}
// Form field spacing within steps
:host ::ng-deep mat-step-content {
overflow: visible !important;
mat-form-field {
margin-bottom: 1rem;
width: 100%;
@@ -12,10 +12,6 @@ import { Router, ActivatedRoute } from '@angular/router';
/** Custom Components */
import { CurrentAccountDetailsStepComponent } from '../current-account-stepper/current-account-details-step/current-account-details-step.component';
import { CurrentAccountTermsStepComponent } from '../current-account-stepper/current-account-terms-step/current-account-terms-step.component';
import { CurrentAccountTermStepComponent } from '../current-account-stepper/current-account-term-step/current-account-term-step.component';
import { CurrentAccountSettingsStepComponent } from '../current-account-stepper/current-account-settings-step/current-account-settings-step.component';
import { CurrentAccountChargesStepComponent } from '../current-account-stepper/current-account-charges-step/current-account-charges-step.component';
import { CurrentAccountCurrencyStepComponent } from '../current-account-stepper/current-account-currency-step/current-account-currency-step.component';
import { CurrentAccountDigitalStepComponent } from '../current-account-stepper/current-account-digital-step/current-account-digital-step.component';
@@ -23,10 +19,18 @@ import { CurrentAccountDigitalStepComponent } from '../current-account-stepper/c
import { CurrentAccountsService } from '../current-accounts.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { MatStepper, MatStepperIcon, MatStep, MatStepLabel } from '@angular/material/stepper';
import {
MatStepper,
MatStepperIcon,
MatStep,
MatStepLabel,
MatStepperNext,
MatStepperPrevious
} from '@angular/material/stepper';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { CurrentAccountPreviewStepComponent } from '../current-account-stepper/current-account-preview-step/current-account-preview-step.component';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { FormGroup } from '@angular/forms';
/**
* Create Current Account Component
@@ -39,16 +43,14 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
...STANDALONE_SHARED_IMPORTS,
MatStepper,
MatStepperIcon,
MatStepperNext,
MatStepperPrevious,
FaIconComponent,
MatStep,
MatStepLabel,
CurrentAccountDetailsStepComponent,
CurrentAccountCurrencyStepComponent,
CurrentAccountTermStepComponent,
CurrentAccountSettingsStepComponent,
CurrentAccountDigitalStepComponent,
CurrentAccountTermsStepComponent,
CurrentAccountChargesStepComponent,
CurrentAccountPreviewStepComponent
]
})
@@ -67,18 +69,10 @@ export class CreateCurrentAccountComponent {
/** Current Account Details Step */
@ViewChild(CurrentAccountDetailsStepComponent, { static: true })
currentAccountDetailsStep: CurrentAccountDetailsStepComponent;
/** Current Account Term Step (new) */
@ViewChild(CurrentAccountTermStepComponent, { static: true })
currentAccountTermStep: CurrentAccountTermStepComponent;
/** Current Account Settings Step */
@ViewChild(CurrentAccountSettingsStepComponent, { static: true })
currentAccountSettingsStep: CurrentAccountSettingsStepComponent;
/** Current Account Terms Step (old — kept for currencyCode access) */
@ViewChild(CurrentAccountTermsStepComponent, { static: true })
currentAccountTermsStep: CurrentAccountTermsStepComponent;
/** Current Account Charges Step */
@ViewChild(CurrentAccountChargesStepComponent, { static: true })
currentAccountChargesStep: CurrentAccountChargesStepComponent;
/** Current Account Currency Step */
@ViewChild(CurrentAccountCurrencyStepComponent, { static: true })
currentAccountCurrencyStep: CurrentAccountCurrencyStepComponent;
constructor() {
this.route.data.subscribe((data: { currentAccountTemplate: any }) => {
@@ -100,32 +94,17 @@ export class CreateCurrentAccountComponent {
return this.currentAccountDetailsStep.currentAccountDetailsForm;
}
/**
* Retrieves new term form (interest rate).
*/
get currentAccountTermForm() {
return this.currentAccountTermStep.currentAccountTermForm;
/** Stub forms needed by preview step inputs */
get currentAccountTermForm(): FormGroup {
return new FormGroup({});
}
/**
* Retrieves settings form.
*/
get currentAccountSettingsForm() {
return this.currentAccountSettingsStep.currentAccountSettingsForm;
get currentAccountSettingsForm(): FormGroup {
return new FormGroup({});
}
/**
* Retrieves old terms form — still used for currencyCode by charges step.
*/
get currentAccountTermsForm() {
return this.currentAccountTermsStep.currentAccountTermsForm;
}
/**
* Checks validity of overall current account form.
*/
get currentAccountFormValid() {
return this.currentAccountDetailsForm.valid && this.currentAccountTermForm.valid;
get currentAccountTermsForm(): FormGroup {
return new FormGroup({});
}
/**
@@ -133,10 +112,7 @@ export class CreateCurrentAccountComponent {
*/
get currentAccount() {
return {
...this.currentAccountDetailsStep.currentAccountDetails,
...this.currentAccountTermStep.currentAccountTerms,
...this.currentAccountSettingsStep.currentAccountSettings,
...this.currentAccountChargesStep.currentAccountCharges
...this.currentAccountDetailsStep.currentAccountDetails
};
}
@@ -149,15 +125,8 @@ export class CreateCurrentAccountComponent {
const monthDayFormat = 'dd MMMM';
const currentAccount = {
...this.currentAccount,
charges: this.currentAccount.charges.map((charge: any) => ({
chargeId: charge.id,
amount: charge.amount,
dueDate: charge.dueDate ? this.dateUtils.formatDate(charge.dueDate, dateFormat) : charge.dueDate,
feeOnMonthDay: charge.feeOnMonthDay
? this.dateUtils.formatDate(charge.feeOnMonthDay, monthDayFormat)
: charge.feeOnMonthDay,
feeInterval: charge.feeInterval
})),
...this.currentAccountCurrencyStep.currencyStepData,
charges: [],
submittedOnDate: this.dateUtils.formatDate(this.currentAccount.submittedOnDate, dateFormat),
dateFormat,
monthDayFormat,