Files
blazor-cms/Features/Thirdparty/ThirdpartyPage.razor
T
2026-07-21 13:52:43 +07:00

123 lines
4.1 KiB
Plaintext

@page "/thirdparty"
@using Indotalent.Features.Thirdparty.Patient.Components
@using Indotalent.Features.Thirdparty.PatientCategory.Components
@using Indotalent.Features.Thirdparty.PatientContact.Components
@using Indotalent.Features.Thirdparty.PatientGroup.Components
@using Indotalent.Features.Thirdparty.Vendor.Components
@using Indotalent.Features.Thirdparty.VendorCategory.Components
@using Indotalent.Features.Thirdparty.VendorContact.Components
@using Indotalent.Features.Thirdparty.VendorGroup.Components
@using Microsoft.AspNetCore.Authorization
@using Indotalent.Infrastructure.Authorization.Identity
@using MudBlazor
@inject NavigationManager NavigationManager
@attribute [Authorize(Roles = $"{ApplicationRoles.Admin},{ApplicationRoles.Member}")]
<style>
.clean-white-tabs .mud-tabs-toolbar {
background-color: white !important;
border-bottom: 2px solid #DCEBFA;
border-radius: 0px !important;
}
.clean-white-tabs .mud-tab {
color: #94a3b8 !important;
text-transform: none;
font-weight: 500;
min-width: 160px;
border-radius: 0px !important;
}
.clean-white-tabs .mud-tab-active {
color: var(--mud-palette-primary) !important;
font-weight: 800;
}
.clean-white-tabs .mud-tabs-slider {
background-color: var(--mud-palette-primary) !important;
height: 3px !important;
bottom: 0;
}
</style>
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="mt-2 mb-8">
<div class="clean-white-tabs">
<MudTabs Elevation="0"
ActivePanelIndex="@_activeTabIndex"
ActivePanelIndexChanged="OnTabChanged"
ApplyEffectsToContainer="true"
TabPanelsClass="pt-4"
ScrollButtons="ScrollButtons.Always">
<MudTabPanel Text="Patient Group" Icon="@Icons.Material.Outlined.GroupWork">
<PatientGroupPage />
</MudTabPanel>
<MudTabPanel Text="Patient Category" Icon="@Icons.Material.Outlined.Class">
<PatientCategoryPage />
</MudTabPanel>
<MudTabPanel Text="Patient" Icon="@Icons.Material.Outlined.Person">
<PatientPage />
</MudTabPanel>
<MudTabPanel Text="Patient Contact" Icon="@Icons.Material.Outlined.ContactPhone">
<PatientContactPage />
</MudTabPanel>
<MudTabPanel Text="Vendor Group" Icon="@Icons.Material.Outlined.Hub">
<VendorGroupPage />
</MudTabPanel>
<MudTabPanel Text="Vendor Category" Icon="@Icons.Material.Outlined.Label">
<VendorCategoryPage />
</MudTabPanel>
<MudTabPanel Text="Vendor" Icon="@Icons.Material.Outlined.Store">
<VendorPage />
</MudTabPanel>
<MudTabPanel Text="Vendor Contact" Icon="@Icons.Material.Outlined.ContactMail">
<VendorContactPage />
</MudTabPanel>
</MudTabs>
</div>
</MudContainer>
@code {
private int _activeTabIndex = 0;
private readonly Dictionary<int, string> _tabMapping = new()
{
{ 0, "patient-group" },
{ 1, "patient-category" },
{ 2, "patient" },
{ 3, "patient-contact" },
{ 4, "vendor-group" },
{ 5, "vendor-category" },
{ 6, "vendor" },
{ 7, "vendor-contact" }
};
protected override void OnInitialized()
{
var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri);
if (Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query).TryGetValue("tab", out var tabValue))
{
var tabStr = tabValue.ToString().ToLower();
var match = _tabMapping.FirstOrDefault(x => x.Value == tabStr);
_activeTabIndex = match.Value != null ? match.Key : 0;
}
}
private void OnTabChanged(int index)
{
_activeTabIndex = index;
_tabMapping.TryGetValue(index, out var tabName);
NavigationManager.NavigateTo($"/thirdparty?tab={tabName ?? "patient-group"}", replace: false);
}
}