Matches the backend change that stopped auto-depositing money at activation: removes the opening-balance field from every Activate screen (Savings, Current, FD, RD) since funding now happens as a separate deposit afterward, and removes the Digital-Facility step from every Create wizard since every facility starts disabled by default and gets turned on later through Edit Nominee & Features. Also merges Approve+Activate into a single action for Savings, Current, FD and RD accounts -- one click takes the account straight to Active instead of two separate screens.
166 lines
5.3 KiB
TypeScript
166 lines
5.3 KiB
TypeScript
/**
|
|
* Copyright since 2025 Mifos Initiative
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
/** Angular Imports */
|
|
import { Component, Input, Output, EventEmitter, OnChanges, inject } from '@angular/core';
|
|
import { TranslateService } from '@ngx-translate/core';
|
|
import {
|
|
MatTableDataSource,
|
|
MatTable,
|
|
MatColumnDef,
|
|
MatHeaderCellDef,
|
|
MatHeaderCell,
|
|
MatCellDef,
|
|
MatCell,
|
|
MatHeaderRowDef,
|
|
MatHeaderRow,
|
|
MatRowDef,
|
|
MatRow
|
|
} from '@angular/material/table';
|
|
import { MatDivider } from '@angular/material/divider';
|
|
import { ExternalIdentifierComponent } from '../../../shared/external-identifier/external-identifier.component';
|
|
import { MatStepperPrevious } from '@angular/material/stepper';
|
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
|
import { FindPipe } from '../../../pipes/find.pipe';
|
|
import { DateFormatPipe } from '../../../pipes/date-format.pipe';
|
|
import { FormatNumberPipe } from '../../../pipes/format-number.pipe';
|
|
import { YesnoPipe } from '../../../pipes/yesno.pipe';
|
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|
|
|
/**
|
|
* Current account preview step
|
|
*/
|
|
@Component({
|
|
selector: 'mifosx-current-account-preview-step',
|
|
templateUrl: './current-account-preview-step.component.html',
|
|
styleUrls: ['./current-account-preview-step.component.scss'],
|
|
imports: [
|
|
...STANDALONE_SHARED_IMPORTS,
|
|
MatDivider,
|
|
ExternalIdentifierComponent,
|
|
MatTable,
|
|
MatColumnDef,
|
|
MatHeaderCellDef,
|
|
MatHeaderCell,
|
|
MatCellDef,
|
|
MatCell,
|
|
MatHeaderRowDef,
|
|
MatHeaderRow,
|
|
MatRowDef,
|
|
MatRow,
|
|
MatStepperPrevious,
|
|
FaIconComponent,
|
|
FindPipe,
|
|
DateFormatPipe,
|
|
FormatNumberPipe,
|
|
YesnoPipe
|
|
]
|
|
})
|
|
export class CurrentAccountPreviewStepComponent implements OnChanges {
|
|
readonly digitalFacilityLabels = [
|
|
{ key: 'atmFacility', label: 'ATM Facility' },
|
|
{ key: 'atmWithdrawalFacility', label: 'ATM Withdrawal' },
|
|
{ key: 'upiFacility', label: 'UPI Facility' },
|
|
{ key: 'posTransactionsFacility', label: 'POS Transactions' },
|
|
{ key: 'chequeBook', label: 'Cheque Book' },
|
|
{ key: 'impsFacility', label: 'IMPS Facility' },
|
|
{ key: 'smsAlerts', label: 'SMS Alerts' },
|
|
{ key: 'bbpsFacility', label: 'BBPS Facility' },
|
|
{ key: 'insuranceCover', label: 'Insurance Cover' },
|
|
{ key: 'bepgFacility', label: 'BEPG Facility' },
|
|
{ key: 'neftFacility', label: 'NEFT Facility' },
|
|
{ key: 'rtgsFacility', label: 'RTGS Facility' },
|
|
{ key: 'interBankTotalCapFacility', label: 'Inter-Bank Total Cap' },
|
|
{ key: 'withdrawalFacility', label: 'Withdrawal Facility' },
|
|
{ key: 'depositFacilityKyc', label: 'Deposit Facility (KYC)' },
|
|
{ key: 'virtualDebitCard', label: 'Virtual Debit Card' },
|
|
{ key: 'internetBanking', label: 'Internet Banking' },
|
|
{ key: 'mobileBanking', label: 'Mobile Banking' }
|
|
];
|
|
|
|
private translateService = inject(TranslateService);
|
|
|
|
@Input() currentAccountProductTemplate: any;
|
|
@Input() currentAccountTemplate: any;
|
|
@Input() hideButtons = false;
|
|
@Input() currentAccountTermsForm: any;
|
|
@Input() currentAccountTermForm: any;
|
|
@Input() currentAccountSettingsForm: any;
|
|
@Input() currentAccount: any;
|
|
@Input() currentAccountDigital: any;
|
|
@Input() currentAccountNominees: any[] = [];
|
|
@Input() currentAccountCurrencyFlags: any;
|
|
@Input() activeClientMembers?: any;
|
|
|
|
/** Table Data Source */
|
|
dataSource: any;
|
|
|
|
/** Display columns for charges table */
|
|
chargesDisplayedColumns: string[] = [
|
|
'name',
|
|
'chargeCalculationType',
|
|
'amount',
|
|
'chargeTimeType',
|
|
'date',
|
|
'repaymentsEvery'
|
|
];
|
|
/** Columns to be displayed in active members table. */
|
|
membersDisplayedColumns: string[] = [
|
|
'id',
|
|
'name'
|
|
];
|
|
|
|
/** Form submission event */
|
|
@Output() submitEvent = new EventEmitter();
|
|
|
|
ngOnChanges(): void {
|
|
if (this.activeClientMembers?.length > 0) {
|
|
this.dataSource = new MatTableDataSource<any>(this.activeClientMembers.filter((member: any) => member.selected));
|
|
}
|
|
}
|
|
|
|
getCatalogTranslation(text: string): string {
|
|
return this.translateService.instant('labels.catalogs.' + text);
|
|
}
|
|
|
|
get termPreview(): any {
|
|
return this.currentAccountTermForm?.getRawValue?.() || this.currentAccount || {};
|
|
}
|
|
|
|
get settingsPreview(): any {
|
|
return this.currentAccountSettingsForm?.getRawValue?.() || this.currentAccount || {};
|
|
}
|
|
|
|
/** Digital facility config as actually captured by a digital step in this wizard -- no fallback
|
|
* to the product's own defaults, since account creation no longer has a digital step at all and
|
|
* must not preview facilities the officer never actually chose. */
|
|
get digitalFacilityConfig(): any {
|
|
return this.currentAccountDigital?.accountFacilityConfig ?? null;
|
|
}
|
|
|
|
get hasDigitalSection(): boolean {
|
|
return !!this.digitalFacilityConfig;
|
|
}
|
|
|
|
get currencyName(): string {
|
|
return (
|
|
this.currentAccountProductTemplate?.currency?.name ||
|
|
this.currentAccountTermsForm?.get?.('currencyCode')?.value ||
|
|
'—'
|
|
);
|
|
}
|
|
|
|
get decimalPlaces(): string | number {
|
|
return this.currentAccountProductTemplate?.currency?.decimalPlaces ?? '—';
|
|
}
|
|
|
|
get inMultiplesOf(): string | number {
|
|
return this.currentAccountProductTemplate?.currency?.inMultiplesOf ?? '—';
|
|
}
|
|
}
|