2022-09-11 18:33:58 +02:00
|
|
|
@inject HttpClient Client
|
2024-05-17 00:32:46 +02:00
|
|
|
@inject AuthService AuthService
|
2023-10-16 11:38:27 +02:00
|
|
|
@inject NavigationManager NavigationManager
|
2024-08-13 17:07:39 +02:00
|
|
|
@inject BreadcrumbsStateContainer BreadcrumbsStateContainer
|
2024-03-09 07:07:34 +01:00
|
|
|
|
2024-06-05 17:33:37 +02:00
|
|
|
@using TaikoWebUI.Components;
|
2022-09-10 06:56:53 +02:00
|
|
|
|
2023-11-11 22:04:11 +01:00
|
|
|
@page "/Users"
|
2022-09-10 06:56:53 +02:00
|
|
|
|
|
|
|
<MudGrid Class="my-8">
|
2024-05-17 00:32:46 +02:00
|
|
|
@if (!AuthService.LoginRequired || (AuthService.LoginRequired && AuthService.IsAdmin)) {
|
2024-06-06 02:38:52 +02:00
|
|
|
<MudItem xs="12">
|
2024-06-06 03:34:13 +02:00
|
|
|
<div class="d-flex justify-content-end gap-2">
|
|
|
|
<MudInput
|
|
|
|
@bind-Value="searchTerm"
|
|
|
|
TextChanged="(async term => { isLoading = true; await OnSearch(term); })"
|
|
|
|
Immediate="true"
|
|
|
|
FullWidth="true"
|
|
|
|
Clearable="true"
|
|
|
|
Margin="Margin.Dense"
|
|
|
|
Label="@Localizer["Search"]"
|
2024-06-06 04:05:51 +02:00
|
|
|
Placeholder="@Localizer["Search by Name, ID, or Access Code"]"
|
2024-06-06 03:34:13 +02:00
|
|
|
Variant="Variant.Outlined"
|
|
|
|
Adornment="Adornment.Start"
|
|
|
|
AdornmentIcon="@Icons.Material.Filled.Search"
|
|
|
|
Style="width: 100%" />
|
|
|
|
</div>
|
2024-06-06 02:38:52 +02:00
|
|
|
</MudItem>
|
|
|
|
@if (isLoading || response == null)
|
2024-06-05 17:42:35 +02:00
|
|
|
{
|
2024-05-17 00:32:46 +02:00
|
|
|
// Loading...
|
2024-06-06 06:18:49 +02:00
|
|
|
for (uint i = 0; i < pageSize; i++) {
|
2024-06-05 17:46:59 +02:00
|
|
|
<MudItem xs="12" md="6" lg="4" xl="3">
|
2024-05-17 00:32:46 +02:00
|
|
|
<MudCard Outlined="true">
|
|
|
|
<MudCardContent>
|
|
|
|
<MudSkeleton Width="30%" Height="42px;" Class="mb-5" />
|
|
|
|
<MudSkeleton Width="80%" />
|
|
|
|
<MudSkeleton Width="100%" />
|
|
|
|
</MudCardContent>
|
|
|
|
<MudCardActions>
|
|
|
|
<MudStack Row="true" Style="width:100%" Spacing="4" Justify="Justify.FlexEnd">
|
|
|
|
<MudSkeleton Width="64px" Height="40px" />
|
|
|
|
<MudSkeleton Width="64px" Height="40px" />
|
|
|
|
</MudStack>
|
|
|
|
</MudCardActions>
|
|
|
|
</MudCard>
|
|
|
|
</MudItem>
|
2024-03-09 07:07:34 +01:00
|
|
|
}
|
2024-06-05 17:42:35 +02:00
|
|
|
} else if (response.Users.Count > 0) {
|
|
|
|
foreach (var user in response.Users)
|
2024-03-09 07:07:34 +01:00
|
|
|
{
|
2024-06-05 17:46:59 +02:00
|
|
|
<MudItem xs="12" md="6" lg="4" xl="3">
|
2024-06-05 17:42:35 +02:00
|
|
|
<UserCard User="user" UserSetting="user.UserSetting" />
|
2024-05-17 00:32:46 +02:00
|
|
|
</MudItem>
|
2024-03-09 07:07:34 +01:00
|
|
|
}
|
2024-05-17 00:32:46 +02:00
|
|
|
} else { // No users in the database
|
2024-03-09 07:07:34 +01:00
|
|
|
<MudItem xs="12">
|
|
|
|
<MudText Align="Align.Center" Class="my-8">
|
2024-06-05 15:59:33 +02:00
|
|
|
@Localizer["No Data"]
|
2024-03-09 07:07:34 +01:00
|
|
|
</MudText>
|
|
|
|
</MudItem>
|
|
|
|
}
|
2024-05-17 00:32:46 +02:00
|
|
|
} else if (AuthService.LoginRequired && !AuthService.IsLoggedIn) {
|
|
|
|
// Not logged in, redirect
|
|
|
|
NavigationManager.NavigateTo("/Login");
|
|
|
|
} else {
|
|
|
|
NavigationManager.NavigateTo("/");
|
2022-09-10 06:56:53 +02:00
|
|
|
}
|
2024-06-05 17:42:35 +02:00
|
|
|
|
|
|
|
@if (response != null && TotalPages > 1)
|
|
|
|
{
|
|
|
|
<MudItem xs="12">
|
|
|
|
<div class="d-flex flex-column align-center">
|
|
|
|
<MudPagination Class="pa-4" Rectangular="true" DisableElevation="true" Count="@TotalPages" Selected="currentPage" SelectedChanged="(page) => OnPageChange(page)" BoundaryCount="1" MiddleCount="3" />
|
|
|
|
</div>
|
|
|
|
</MudItem>
|
2022-09-10 06:56:53 +02:00
|
|
|
}
|
2024-03-08 18:05:20 +01:00
|
|
|
</MudGrid>
|