|
9 | 9 | <PageTitle>Modix - Channels</PageTitle> |
10 | 10 | <MudText Typo="Typo.h4">Channel Designations</MudText> |
11 | 11 |
|
12 | | -<CascadingAuthenticationState> |
13 | | - @if (DesignatedChannelMappings is not null && DesignatedChannelTypes is not null) |
14 | | - { |
15 | | - <MudDialog @bind-IsVisible="_createDialogVisible" Options="new DialogOptions { FullWidth= true }"> |
16 | | - <TitleContent> |
17 | | - <MudText Typo="Typo.h5">Assign a Channel</MudText> |
18 | | - </TitleContent> |
19 | | - <DialogContent> |
20 | | - <AutoComplete T="ChannelInformation" |
21 | | - SearchFunc="(query) => AutoCompleteChannels(query)" |
22 | | - Placeholder="@("#general")" |
23 | | - SelectedItemChanged="SelectedChannelChanged" |
24 | | - Title="Channel Name" /> |
25 | | - <MudText Class="mt-5" Typo="Typo.h5">Designation</MudText> |
26 | | - <MudSelect T="DesignatedChannelType?" @bind-Value="_selectedDesignatedChannelType"> |
27 | | - @foreach (var designation in DesignatedChannelTypes) |
28 | | - { |
29 | | - <MudSelectItem T="DesignatedChannelType?" Value="@designation"></MudSelectItem> |
30 | | - } |
31 | | - </MudSelect> |
32 | | - </DialogContent> |
33 | | - <DialogActions> |
34 | | - <MudButton Variant="Variant.Filled" |
35 | | - Disabled="_selectedDesignatedChannelType is null || _selectedChannel is null" |
36 | | - Color="Color.Success" |
37 | | - OnClick="SaveDesignation"> |
38 | | - Assign |
39 | | - </MudButton> |
40 | | - <MudSpacer /> |
41 | | - <MudButton Variant="Variant.Filled" Color="Color.Error" OnClick="ToggleCreateDialog">Cancel</MudButton> |
42 | | - </DialogActions> |
43 | | - </MudDialog> |
44 | | - |
45 | | - <MudPaper> |
46 | | - <MudList Clickable="true" DisablePadding="true"> |
47 | | - @foreach (var designatedChannelType in DesignatedChannelTypes.OrderBy(x => x.ToString())) |
| 12 | +@if (DesignatedChannelMappings is not null && DesignatedChannelTypes is not null) |
| 13 | +{ |
| 14 | + <MudDialog @bind-IsVisible="_createDialogVisible" Options="new DialogOptions { FullWidth= true }"> |
| 15 | + <TitleContent> |
| 16 | + <MudText Typo="Typo.h5">Assign a Channel</MudText> |
| 17 | + </TitleContent> |
| 18 | + <DialogContent> |
| 19 | + <AutoComplete T="ChannelInformation" |
| 20 | + SearchFunc="(query) => AutoCompleteChannels(query)" |
| 21 | + Placeholder="@("#general")" |
| 22 | + SelectedItemChanged="SelectedChannelChanged" |
| 23 | + Title="Channel Name" /> |
| 24 | + <MudText Class="mt-5" Typo="Typo.h5">Designation</MudText> |
| 25 | + <MudSelect T="DesignatedChannelType?" @bind-Value="_selectedDesignatedChannelType"> |
| 26 | + @foreach (var designation in DesignatedChannelTypes) |
48 | 27 | { |
49 | | - <MudListItem DisableRipple="true"> |
50 | | - <div class="d-flex align-center"> |
51 | | - <div> |
52 | | - <MudText> |
53 | | - <b>@designatedChannelType.ToString().Titleize()</b> |
| 28 | + <MudSelectItem T="DesignatedChannelType?" Value="@designation"></MudSelectItem> |
| 29 | + } |
| 30 | + </MudSelect> |
| 31 | + </DialogContent> |
| 32 | + <DialogActions> |
| 33 | + <MudButton Variant="Variant.Filled" |
| 34 | + Disabled="_selectedDesignatedChannelType is null || _selectedChannel is null" |
| 35 | + Color="Color.Success" |
| 36 | + OnClick="SaveDesignation"> |
| 37 | + Assign |
| 38 | + </MudButton> |
| 39 | + <MudSpacer /> |
| 40 | + <MudButton Variant="Variant.Filled" Color="Color.Error" OnClick="ToggleCreateDialog">Cancel</MudButton> |
| 41 | + </DialogActions> |
| 42 | + </MudDialog> |
| 43 | + |
| 44 | + <MudPaper> |
| 45 | + <MudList Clickable="true" DisablePadding="true"> |
| 46 | + @foreach (var designatedChannelType in DesignatedChannelTypes.OrderBy(x => x.ToString())) |
| 47 | + { |
| 48 | + <MudListItem DisableRipple="true"> |
| 49 | + <div class="d-flex align-center"> |
| 50 | + <div> |
| 51 | + <MudText> |
| 52 | + <b>@designatedChannelType.ToString().Titleize()</b> |
| 53 | + </MudText> |
| 54 | + @if (!DesignatedChannelMappings.TryGetValue(designatedChannelType, out var channelDesignations) || !channelDesignations.Any()) |
| 55 | + { |
| 56 | + <MudText Style="color: grey; letter-spacing: 1px" Typo="Typo.caption"> |
| 57 | + <b>NONE ASSIGNED</b> |
54 | 58 | </MudText> |
55 | | - @if (!DesignatedChannelMappings.TryGetValue(designatedChannelType, out var channelDesignations) || !channelDesignations.Any()) |
56 | | - { |
57 | | - <MudText Style="color: grey; letter-spacing: 1px" Typo="Typo.caption"> |
58 | | - <b>NONE ASSIGNED</b> |
59 | | - </MudText> |
60 | | - } |
61 | | - else |
| 59 | + } |
| 60 | + else |
| 61 | + { |
| 62 | + @foreach (var designatedChannelMapping in channelDesignations) |
62 | 63 | { |
63 | | - @foreach (var designatedChannelMapping in channelDesignations) |
64 | | - { |
65 | | - <IndividualDesignation AuthorizationRoleForDelete="@nameof(AuthorizationClaim.DesignatedChannelMappingDelete)" |
66 | | - Id="@designatedChannelMapping.Id" |
67 | | - NamePrefix="@("#")" |
68 | | - Name="@designatedChannelMapping.Name" |
69 | | - RemoveDesignation="(id) => RemoveDesignation(id, designatedChannelMapping.ChannelDesignation)" /> |
70 | | - } |
| 64 | + <IndividualDesignation AuthorizationRoleForDelete="@nameof(AuthorizationClaim.DesignatedChannelMappingDelete)" |
| 65 | + Id="@designatedChannelMapping.Id" |
| 66 | + NamePrefix="@("#")" |
| 67 | + Name="@designatedChannelMapping.Name" |
| 68 | + RemoveDesignation="(id) => RemoveDesignation(id, designatedChannelMapping.ChannelDesignation)" /> |
71 | 69 | } |
72 | | - </div> |
73 | | - <MudSpacer /> |
74 | | - <div> |
75 | | - <AuthorizeView Roles="@nameof(AuthorizationClaim.DesignatedChannelMappingCreate)"> |
76 | | - <MudIconButton OnClick="ToggleCreateDialog" Icon="@Icons.Material.Filled.Add" Variant="Variant.Filled" Color="Color.Success" /> |
77 | | - </AuthorizeView> |
78 | | - </div> |
| 70 | + } |
79 | 71 | </div> |
80 | | - </MudListItem> |
81 | | - <MudDivider /> |
82 | | - } |
83 | | - </MudList> |
84 | | - </MudPaper> |
85 | | - } |
86 | | -</CascadingAuthenticationState> |
| 72 | + <MudSpacer /> |
| 73 | + <div> |
| 74 | + <AuthorizeView Roles="@nameof(AuthorizationClaim.DesignatedChannelMappingCreate)"> |
| 75 | + <MudIconButton OnClick="ToggleCreateDialog" Icon="@Icons.Material.Filled.Add" Variant="Variant.Filled" Color="Color.Success" /> |
| 76 | + </AuthorizeView> |
| 77 | + </div> |
| 78 | + </div> |
| 79 | + </MudListItem> |
| 80 | + <MudDivider /> |
| 81 | + } |
| 82 | + </MudList> |
| 83 | + </MudPaper> |
| 84 | +} |
87 | 85 |
|
88 | 86 | @code { |
89 | 87 | [Inject] |
|
0 commit comments