diff --git a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html index d9c5887a3..97a08deac 100644 --- a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html +++ b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.html @@ -54,8 +54,8 @@ account_balance
-
LincPay Co-operative Bank Ltd.
-
Current Account Statement
+
{{ bankName }}
+
{{ bankSubtitle }}
@@ -64,6 +64,25 @@
+ + @if (branchName || ifscCode || micrCode) { +
+ @if (branchName) { + {{ branchName }} Branch + } + @if (branchAddress) { + {{ branchAddress }} + } + @if (ifscCode) { + IFSC: {{ ifscCode }} + } + @if (micrCode) { + MICR: {{ micrCode }} + } +
+ } +
diff --git a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.scss b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.scss index 647d16d12..50d73a7f2 100644 --- a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.scss +++ b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.scss @@ -127,6 +127,18 @@ $header-text: #fff; } } +// ─── Branch Identification Line ────────────────────────────────────────────── +.branch-line { + background: #e8edf5; + border-bottom: 1px solid $border-color; + padding: 6px 24px; + display: flex; + flex-wrap: wrap; + gap: 4px 18px; + font-size: 11px; + color: #4a5a7a; +} + // ─── Account Details Band ──────────────────────────────────────────────────── .account-details-band { background: #f0f3f9; diff --git a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts index 697d53a5c..2c04ece28 100644 --- a/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts +++ b/src/app/current-accounts/current-account-view/passbook-tab/passbook-tab.component.ts @@ -11,11 +11,12 @@ import { Component, OnInit, OnDestroy, inject, ElementRef, ViewChild } from '@an import { ActivatedRoute } from '@angular/router'; import { UntypedFormBuilder } from '@angular/forms'; import { CurrencyPipe } from '@angular/common'; -import { Subject, takeUntil } from 'rxjs'; +import { Subject, takeUntil, catchError, forkJoin, of } from 'rxjs'; /** Custom Services */ import { SettingsService } from 'app/settings/settings.service'; import { Dates } from 'app/core/utils/dates'; +import { OrganizationService } from '../../../organization/organization.service'; import { Currency } from 'app/shared/models/general.model'; import { CurrentAccountTransaction, @@ -44,6 +45,7 @@ export class PassbookTabComponent implements OnInit, OnDestroy { private formBuilder = inject(UntypedFormBuilder); private settingsService = inject(SettingsService); private dateUtils = inject(Dates); + private organizationService = inject(OrganizationService); private destroy$ = new Subject(); @@ -60,6 +62,17 @@ export class PassbookTabComponent implements OnInit, OnDestroy { availableBalance: number = 0; activatedOnDate: any = null; + /** Bank/branch letterhead — real values from Institution Profile + Branch Profile (Organization + * module) rather than a hardcoded name, so a printed passbook actually identifies which bank and + * branch issued it, the way a real UCB's core banking system does. Falls back to a generic label + * if the profile was never filled in, rather than showing a fabricated bank name. */ + bankName = 'Bank'; + bankSubtitle = 'Current Account Statement'; + branchName = ''; + branchAddress = ''; + ifscCode = ''; + micrCode = ''; + /** Transactions */ allTransactions: CurrentAccountTransaction[] = []; filteredTransactions: CurrentAccountTransaction[] = []; @@ -92,6 +105,33 @@ export class PassbookTabComponent implements OnInit, OnDestroy { fromDate: [''], toDate: [''] }); + + this.loadLetterhead(); + } + + /** Institution Profile is the bank's own single record; Branch Profile is per-office. There is no + * office id on the current account data reaching this tab, and this deployment runs a single + * branch, so the first branch profile on record is the correct one here — a genuinely + * multi-branch deployment would need the account's own office id threaded through instead. */ + private loadLetterhead(): void { + forkJoin({ + institution: this.organizationService.getInstitutionProfile().pipe(catchError(() => of(null))), + branches: this.organizationService.getBranchProfiles().pipe(catchError(() => of([]))) + }).subscribe(({ institution, branches }: any) => { + if (institution) { + this.bankName = institution.passbookHeaderName || institution.bankName || institution.legalName || 'Bank'; + this.bankSubtitle = institution.licenseNumber + ? `Lic. No. ${institution.licenseNumber}` + : 'Current Account Statement'; + } + const branch = Array.isArray(branches) ? branches[0] : null; + if (branch) { + this.branchName = branch.officeName || ''; + this.branchAddress = branch.address || ''; + this.ifscCode = branch.ifscCode || ''; + this.micrCode = branch.micrCode || ''; + } + }); } private computeRunningBalances(transactions: CurrentAccountTransaction[]): CurrentAccountTransaction[] { @@ -279,6 +319,18 @@ export class PassbookTabComponent implements OnInit, OnDestroy { margin-top: 3px; } + /* Branch identification line */ + .branch-line { + background: #e8edf5; + border-bottom: 1px solid #d0d7e3; + padding: 5px 20px; + display: flex; + flex-wrap: wrap; + gap: 4px 16px; + font-size: 9.5px; + color: #4a5a7a; + } + /* Account details band */ .account-details-band { background: #f0f3f9;