@page "/club"
@page "/club/members"
@page "/club/statistics"
@attribute [Authorize]

<div>
    <MudText Typo="Typo.h5" Class="mb-3">باشگاه مشتریان</MudText>

    <MudTabs Elevation="0" Rounded="true" Border="true" ApplyEffectsToContainer="true"
             PanelClass="pt-4" @bind-ActivePanelIndex="_activeTab">
        <MudTabPanel Text="اعضای باشگاه" Icon="@Icons.Material.Filled.Groups">
            <ClubMembers />
        </MudTabPanel>
        <MudTabPanel Text="آمار باشگاه" Icon="@Icons.Material.Filled.PieChart">
            <Statistics />
        </MudTabPanel>
    </MudTabs>
</div>

@code {
    private int _activeTab;

    protected override void OnInitialized()
    {
        var uri = Navigation.ToBaseRelativePath(Navigation.Uri).ToLowerInvariant().TrimEnd('/');
        _activeTab = uri switch
        {
            "club/statistics" => 1,
            _ => 0
        };
    }
}
