-
-
Notifications
You must be signed in to change notification settings - Fork 750
Expand file tree
/
Copy pathUsers.razor
More file actions
95 lines (92 loc) · 6.14 KB
/
Users.razor
File metadata and controls
95 lines (92 loc) · 6.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
@page "/identity/users"
@attribute [Authorize(Policy = Permissions.Users.View)]
@inject Microsoft.Extensions.Localization.IStringLocalizer<Users> _localizer
@using BlazorHero.CleanArchitecture.Application.Responses.Identity
<style>
.mud-table-container {
overflow: auto;
}
</style>
<HeroTitle Title="@_localizer["Users"]" Description="@_localizer["Manage Users"]" />
@if (!_loaded)
{
<MudProgressCircular Color="Color.Primary" Indeterminate="true" />
}
else
{
<MudTable Hover="true" Elevation="25" Items="_userList" Dense="@_dense" Bordered="@_bordered" Striped="@_striped" Filter="new Func<UserResponse, bool>(Search)" @bind-user="_user">
<ToolBarContent>
<div class="justify-center mud-text-align-center">
@if (_canCreateUsers)
{
<MudButton DisableElevation Variant="Variant.Filled" Color="Color.Primary" OnClick="(() => InvokeModal())" StartIcon="@Icons.Material.Filled.Add" IconColor="Color.Surface">@_localizer["Register New User"]</MudButton>
<MudButton DisableElevation Variant="Variant.Filled" OnClick="GetUsersAsync" StartIcon="@Icons.Material.Filled.Refresh" IconColor="Color.Surface" Color="Color.Secondary">@_localizer["Reload"]</MudButton>
@if (_canExportUsers)
{
<MudButton DisableElevation Variant="Variant.Filled" OnClick="ExportToExcel" StartIcon="@Icons.Custom.FileFormats.FileExcel" IconColor="Color.Secondary" Color="Color.Surface" Style="margin-left: 5px;">@_localizer["Export"]</MudButton>
}
}
else
{
<MudButton DisableElevation Variant="Variant.Filled" OnClick="GetUsersAsync" StartIcon="@Icons.Material.Filled.Refresh" IconColor="Color.Surface" Color="Color.Secondary">@_localizer["Reload"]</MudButton>
@if (_canExportUsers)
{
<MudButton DisableElevation Variant="Variant.Filled" OnClick="ExportToExcel" StartIcon="@Icons.Custom.FileFormats.FileExcel" IconColor="Color.Secondary" Color="Color.Surface" Style="margin-left: 5px;">@_localizer["Export"]</MudButton>
}
}
</div>
<MudSpacer />
@if (_canSearchUsers)
{
<MudTextField @bind-Value="_searchString" Immediate="true" FullWidth=false Placeholder="@_localizer["Search For Users"]" Adornment="Adornment.End" AdornmentIcon="@Icons.Material.Filled.Search" IconSize="Size.Medium" Class="mt-0 mb-3"></MudTextField>
}
</ToolBarContent>
<HeaderContent>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.FirstName)">@_localizer["First Name"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.LastName)">@_localizer["Last Name"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.UserName)">@_localizer["UserName"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.Email)">@_localizer["Email"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.PhoneNumber)">@_localizer["PhoneNumber"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.EmailConfirmed)">@_localizer["Email Confirmation"]</MudTableSortLabel></MudTh>
<MudTh><MudTableSortLabel SortBy="new Func<UserResponse, object>(x => x.IsActive)">@_localizer["Active"]</MudTableSortLabel></MudTh>
<MudTh Style="text-align:right">@_localizer["Actions"]</MudTh>
</HeaderContent>
<RowTemplate>
<MudTd DataLabel="FirstName">
<MudHighlighter Text="@context.FirstName" HighlightedText="@_searchString" />
</MudTd>
<MudTd DataLabel="LastName">
<MudHighlighter Text="@context.LastName" HighlightedText="@_searchString" />
</MudTd>
<MudTd DataLabel="UserName">
<MudHighlighter Text="@context.UserName" HighlightedText="@_searchString" />
</MudTd>
<MudTd DataLabel="Email">
<MudHighlighter Text="@context.Email" HighlightedText="@_searchString" />
</MudTd>
<MudTd DataLabel="PhoneNumber">
<MudHighlighter Text="@context.PhoneNumber" HighlightedText="@_searchString" />
</MudTd>
<MudTd DataLabel="EmailConfirmed"><MudCheckBox @bind-Checked="@context.EmailConfirmed" ReadOnly Color="Color.Secondary"></MudCheckBox></MudTd>
<MudTd DataLabel="Active"><MudCheckBox @bind-Checked="@context.IsActive" ReadOnly Color="Color.Secondary"></MudCheckBox></MudTd>
<MudTd DataLabel="Actions" Style="text-align:right">
<MudMenu Label="@_localizer["Actions"]" Variant="Variant.Filled" DisableElevation="true" EndIcon="@Icons.Filled.KeyboardArrowDown" IconColor="Color.Secondary" Direction="Direction.Left" OffsetX="true">
<MudMenuItem OnClick="(()=>ViewProfile(context.Id))">@_localizer["View Profile"]</MudMenuItem>
@if (_canViewRoles)
{
<MudMenuItem OnClick="(()=>ManageRoles(context.Id, context.Email))">@_localizer["Manage Roles"]</MudMenuItem>
}
<MudMenuItem OnClick="(()=>SendMail(context.Id))">@_localizer["(Re) Send Confimation Mail"]</MudMenuItem>
</MudMenu>
</MudTd>
</RowTemplate>
<FooterContent>
<MudSwitch @bind-Checked="@_dense" Color="Color.Secondary" Style="margin-left: 5px;">@_localizer["Dense"]</MudSwitch>
<MudSwitch @bind-Checked="@_striped" Color="Color.Tertiary" Style="margin-left: 5px;">@_localizer["Striped"]</MudSwitch>
<MudSwitch @bind-Checked="@_bordered" Color="Color.Warning" Style="margin-left: 5px;">@_localizer["Bordered"]</MudSwitch>
</FooterContent>
<PagerContent>
<TablePager />
</PagerContent>
</MudTable>
}