From 79d0608491314c0121ff0ee16d225c2e4374d936 Mon Sep 17 00:00:00 2001 From: Soni Jay Date: Wed, 17 Dec 2025 22:23:45 +0530 Subject: [PATCH] WEB-457 Tenant aware feature (#2854) * refactor: use inject() for DI in HomeComponent (eslint fix) * Tenant Fix * fix: JSON syntax in translation file --- src/app/home/home.component.html | 7 +- src/app/home/home.component.ts | 15 ++++ src/app/shared/footer/footer.component.html | 78 +++++++++--------- src/app/shared/footer/footer.component.ts | 10 +++ .../{mifos_lg-logo.png => default_home.png} | Bin src/assets/translations/cs-CS.json | 2 + src/assets/translations/de-DE.json | 2 + src/assets/translations/en-US.json | 2 + src/assets/translations/es-CL.json | 2 + src/assets/translations/es-MX.json | 2 + src/assets/translations/fr-FR.json | 2 + src/assets/translations/it-IT.json | 2 + src/assets/translations/ko-KO.json | 2 + src/assets/translations/lt-LT.json | 2 + src/assets/translations/lv-LV.json | 2 + src/assets/translations/ne-NE.json | 2 + src/assets/translations/pt-PT.json | 2 + src/assets/translations/sw-SW.json | 2 + 18 files changed, 95 insertions(+), 41 deletions(-) rename src/assets/images/{mifos_lg-logo.png => default_home.png} (100%) diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html index 9f1fc3d9d..b0f73ce92 100644 --- a/src/app/home/home.component.html +++ b/src/app/home/home.component.html @@ -10,7 +10,10 @@
- {{ 'labels.text.Welcome' | translate }}, {{ username }}! + + {{ 'labels.text.Welcome' | translate }} {{ username }} {{ 'labels.text.To' | translate }} + {{ tenant | titlecase }}! + @@ -30,7 +33,7 @@ - Mifos X + Mifos X
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index 52b375000..234024ea8 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -16,6 +16,7 @@ import { WarningDialogComponent } from './warning-dialog/warning-dialog.componen import { AuthenticationService } from '../core/authentication/authentication.service'; import { PopoverService } from '../configuration-wizard/popover/popover.service'; import { ConfigurationWizardService } from '../configuration-wizard/configuration-wizard.service'; +import { SettingsService } from 'app/settings/settings.service'; /** Custom Components */ import { NextStepDialogComponent } from '../configuration-wizard/next-step-dialog/next-step-dialog.component'; @@ -50,9 +51,12 @@ export class HomeComponent implements OnInit, AfterViewInit { private dialog = inject(MatDialog); private configurationWizardService = inject(ConfigurationWizardService); private popoverService = inject(PopoverService); + private settingsService = inject(SettingsService); /** Username of authenticated user. */ username: string; + /** Tenant name */ + tenant: string; /** Activity Form. */ activityForm: any; /** Search Text. */ @@ -71,6 +75,9 @@ export class HomeComponent implements OnInit, AfterViewInit { /* Template for popover on search activity */ @ViewChild('templateSearchActivity', { static: false }) templateSearchActivity: TemplateRef; + // All dependencies are injected using inject() above. No constructor needed. + constructor() {} + /** * Sets the username of the authenticated user. * Set Form. @@ -78,6 +85,7 @@ export class HomeComponent implements OnInit, AfterViewInit { ngOnInit() { const credentials = this.authenticationService.getCredentials(); this.username = credentials.username; + this.tenant = this.tenantIdentifier(); this.setFilteredActivities(); if (!this.authenticationService.hasDialogBeenShown()) { this.dialog.open(WarningDialogComponent); @@ -183,4 +191,11 @@ export class HomeComponent implements OnInit, AfterViewInit { this.router.onSameUrlNavigation = 'reload'; this.router.navigate(['/home']); } + + tenantIdentifier() { + if (!this.settingsService.tenantIdentifier || this.settingsService.tenantIdentifier === '') { + return 'default'; + } + return this.settingsService.tenantIdentifier; + } } diff --git a/src/app/shared/footer/footer.component.html b/src/app/shared/footer/footer.component.html index 66c48c161..ec59f71ba 100644 --- a/src/app/shared/footer/footer.component.html +++ b/src/app/shared/footer/footer.component.html @@ -1,41 +1,41 @@ -@if (displayBackEndInfo) { -