Login form with Tenant dropdown menu

This commit is contained in:
Jose Alberto Hernandez
2022-11-29 22:18:54 -06:00
parent 8f1c17acdf
commit 7275ba8dda
25 changed files with 189 additions and 20 deletions
@@ -0,0 +1,42 @@
import { Component, OnInit } from '@angular/core';
import { FormControl } from '@angular/forms';
import { SettingsService } from 'app/settings/settings.service';
@Component({
selector: 'mifosx-tenant-selector',
templateUrl: './tenant-selector.component.html',
styleUrls: ['./tenant-selector.component.scss']
})
export class TenantSelectorComponent implements OnInit {
/** Tenant selector form control. */
tenantSelector = new FormControl();
/**
* Sets the Tenant Identifier of the application in the selector on initial setup.
* @param {SettingsService} settingsService Settings Service.
*/
constructor(private settingsService: SettingsService) {
this.tenantSelector.setValue(this.settingsService.tenantIdentifier);
}
ngOnInit(): void {
}
/**
* Returns all the languages supported by the application.
* @return {string[]} Supported languages.
*/
get tenants(): string[] {
return this.settingsService.tenantIdentifiers || [];
}
setTenantIdentifier(): void {
this.settingsService.setTenantIdentifier(this.tenantSelector.value);
}
allowSelection(): boolean {
return (this.tenants.length > 1);
}
}