Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div class="mb-6 flex items-center gap-4" data-testid="organization-selector">
<label for="organization-select" class="text-sm font-semibold text-gray-700">Organization:</label>
<lfx-select
[form]="accountForm"
[form]="form"
control="selectedAccountId"
[options]="availableAccounts()"
optionLabel="accountName"
Expand All @@ -17,8 +17,7 @@
[showClear]="false"
styleClass="min-w-[300px]"
inputId="organization-select"
data-testid="organization-select"
(onChange)="handleAccountChange($event)" />
data-testid="organization-select" />
</div>

<!-- Dashboard Sections -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// SPDX-License-Identifier: MIT

import { Component, computed, inject, Signal } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
import { Account } from '@lfx-one/shared/interfaces';

import { SelectComponent } from '../../../shared/components/select/select.component';
import { AccountContextService } from '../../../shared/services/account-context.service';
import { FoundationHealthComponent } from '../components/foundation-health/foundation-health.component';
Expand All @@ -20,20 +22,21 @@ import { PendingActionsComponent } from '../components/pending-actions/pending-a
export class BoardMemberDashboardComponent {
private readonly accountContextService = inject(AccountContextService);

protected readonly accountForm = new FormGroup({
public readonly form = new FormGroup({
selectedAccountId: new FormControl<string>(this.accountContextService.selectedAccount().accountId),
});

protected readonly availableAccounts: Signal<Account[]> = computed(() => this.accountContextService.availableAccounts);
public readonly availableAccounts: Signal<Account[]> = computed(() => this.accountContextService.availableAccounts);

/**
* Handle account selection change
*/
protected handleAccountChange(event: any): void {
const selectedAccountId = event.value as string;
const selectedAccount = this.accountContextService.availableAccounts.find((acc) => acc.accountId === selectedAccountId);
if (selectedAccount) {
this.accountContextService.setAccount(selectedAccount);
}
public constructor() {
this.form
.get('selectedAccountId')
?.valueChanges.pipe(takeUntilDestroyed())
.subscribe((value) => {
const selectedAccount = this.accountContextService.availableAccounts.find((acc) => acc.accountId === value);
if (selectedAccount) {
this.accountContextService.setAccount(selectedAccount as Account);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,16 @@ <h3 class="text-sm font-medium">{{ metric.title }}</h3>
<div class="space-y-2 pt-1">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-500">Tier</span>
<div class="flex items-center gap-2">
<span class="px-2 py-0.5 text-xs font-medium rounded bg-gradient-to-r from-gray-400 to-gray-300 text-white border border-gray-300">
{{ metric.tier }}
</span>
<span class="text-xs text-gray-500">since {{ metric.tierSince }}</span>
</div>
<span class="px-2 py-0.5 text-xs font-medium rounded bg-gradient-to-r from-gray-400 to-gray-300 text-white border border-gray-300">
{{ metric.tier }}
</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-500">Annual Fee</span>
<span class="text-sm font-medium">{{ metric.annualFee }}</span>
<span class="text-sm text-gray-500">Member Since</span>
<span class="text-sm font-medium">{{ metric.tierSince }}</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-500">Next Due</span>
<span class="text-sm text-gray-500">Renewal Date</span>
<span class="text-sm font-medium">{{ metric.nextDue }}</span>
</div>
</div>
Expand Down Expand Up @@ -87,7 +84,7 @@ <h3 class="text-sm font-medium">{{ metric.title }}</h3>
}
}
<div class="space-y-0.5">
<div class="text-xl font-medium">{{ metric.value | number }}</div>
<div class="text-xl font-medium">{{ metric.value }}</div>
@if (metric.subtitle) {
<div class="text-xs text-gray-500">{{ metric.subtitle }}</div>
}
Expand Down
Loading