@page "/performance" @using Microsoft.AspNetCore.Authorization @using Indotalent.Infrastructure.Authorization.Identity @attribute [Authorize(Roles = $"{ApplicationRoles.Admin},{ApplicationRoles.Member}")] @using Indotalent.Features.Performance.Appraisal.Components @using Indotalent.Features.Performance.Evaluation @using Indotalent.Features.Performance.Appraisal @using Indotalent.Features.Performance.Evaluation.Components @using Indotalent.Features.Performance.Promotion @using Indotalent.Features.Performance.Promotion.Components @using Indotalent.Features.Performance.Transfer @using Indotalent.Features.Performance.Transfer.Components @using MudBlazor @inject NavigationManager NavigationManager
@code { private int _activeTabIndex = 0; protected override void OnInitialized() { var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); if (Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query).TryGetValue("tab", out var tabValue)) { _activeTabIndex = tabValue.ToString().ToLower() switch { "evaluation" => 0, "appraisal" => 1, "promotion" => 2, "transfer" => 3, _ => 0 }; } } private void OnTabChanged(int index) { _activeTabIndex = index; string tabName = index switch { 0 => "evaluation", 1 => "appraisal", 2 => "promotion", 3 => "transfer", _ => "evaluation" }; NavigationManager.NavigateTo($"/performance?tab={tabName}", replace: false); } }