| | 1 | | @using MUNity.Schema.Conference |
| | 2 | | @using MUNity.Base |
| | 3 | | @inject Services.ConferenceRoleService conferenceRoleService |
| | 4 | | @inject Services.ConferenceService conferenceService |
| | 5 | |
|
| | 6 | | <div class="panel panel-inverse"> |
| | 7 | | <div class="panel-heading"> |
| | 8 | | <h4 class="panel-title">Freie Rollen</h4> |
| | 9 | | <div class="panel-heading-btn"> |
| 0 | 10 | | <a href="javascript:;" @onclick="() => showFreeRoles = !showFreeRoles" class="btn btn-xs btn-icon btn-warnin |
| | 11 | | </div> |
| | 12 | | </div> |
| | 13 | |
|
| 0 | 14 | | @if (showFreeRoles) |
| 0 | 15 | | { |
| | 16 | | <div class="alert alert-warning rounded-0 mb-0 fade show"> |
| | 17 | | Diese Rollen sind lediglich der Konferenz, nicht aber einen Gremium zugeordnet. Auch diese Rollen können Tei |
| | 18 | | </div> |
| | 19 | |
|
| | 20 | | <div class="panel-body"> |
| 0 | 21 | | <button class="btn btn-primary mb-2" @onclick="() => createFreeRoleModal.Show()">Neue freie Rolle</button> |
| | 22 | |
|
| | 23 | |
|
| | 24 | | <table class="table table-striped table-bordered align-middle dataTable no-footer dtr-inline"> |
| | 25 | | <thead> |
| | 26 | | <tr role="row"> |
| | 27 | | <th>#</th> |
| | 28 | | <th class="text-nowrap sorting">Name</th> |
| | 29 | | <th>Subtype</th> |
| | 30 | | <th>Bewerbungstyp</th> |
| | 31 | | <th>Ist belegt</th> |
| | 32 | | <th>Löschen</th> |
| | 33 | | </tr> |
| | 34 | | </thead> |
| | 35 | | <tbody> |
| | 36 | |
|
| | 37 | |
|
| 0 | 38 | | @if (Roles != null && Roles.Any()) |
| 0 | 39 | | { |
| 0 | 40 | | foreach (var role in Roles.Where(n => string.IsNullOrEmpty(n.RoleCommitteeId))) |
| 0 | 41 | | { |
| | 42 | | <tr> |
| 0 | 43 | | <td>@role.RoleId</td> |
| 0 | 44 | | <td>@role.RoleName</td> |
| 0 | 45 | | <td>@role.Subtype</td> |
| | 46 | | <td> |
| | 47 | | <select class="form-select" @bind="@role.ApplicationState"> |
| | 48 | | <option value="@EApplicationStates.Closed">Anmeldung geschlossen</option> |
| | 49 | | <option value="@EApplicationStates.Closed">Anmeldung auf Delegation (als Gruppe) |
| | 50 | | <option value="@EApplicationStates.Closed">Anmeldung auf Rolle (direkt)</option> |
| | 51 | | </select> |
| | 52 | | </td> |
| 0 | 53 | | <td>@((role.HasParicipant) ? "Ja" : "Nein")</td> |
| 0 | 54 | | <td><button class="btn btn-danger" @onclick="() => RequestRemoveFreeRole(role)">Löschen< |
| | 55 | | </tr> |
| 0 | 56 | | } |
| 0 | 57 | | } |
| | 58 | | </tbody> |
| | 59 | | </table> |
| | 60 | | </div> |
| 0 | 61 | | } |
| | 62 | |
|
| | 63 | |
|
| | 64 | | </div> |
| | 65 | |
|
| | 66 | | <MUNity.BlazorServer.Components.Conference.CreateFreeRoleModal ConferenceId="@ConferenceId" |
| 0 | 67 | | @ref="createFreeRoleModal" |
| | 68 | | Countries="@Countries" |
| | 69 | | Delegations="@Delegations" |
| | 70 | | SeatCreated="LoadData" /> |
| | 71 | |
|
| 0 | 72 | | <MUNity.BlazorServer.Components.General.DeleteWarningModal @ref="deleteWarningModal" /> |
| | 73 | |
|
| | 74 | | @code { |
| | 75 | | [CascadingParameter] |
| | 76 | | public Task<AuthenticationState> |
| | 77 | | AuthStateTask |
| 0 | 78 | | { get; set; } |
| | 79 | |
|
| 0 | 80 | | [Parameter] public string ConferenceId { get; set; } |
| | 81 | |
|
| 0 | 82 | | [Parameter] public List<MUNity.Schema.Conference.CountryInfo> Countries { get; set; } |
| | 83 | |
|
| 0 | 84 | | [Parameter] public List<MUNity.Schema.Conference.DelegationInfo> Delegations { get; set; } |
| | 85 | |
|
| 0 | 86 | | [Parameter] public List<MUNity.Schema.Conference.ManageDelegationRoleInfo> Roles { get; set; } |
| | 87 | |
|
| | 88 | | private bool showFreeRoles; |
| | 89 | |
|
| | 90 | | private MUNity.BlazorServer.Components.Conference.CreateFreeRoleModal createFreeRoleModal; |
| | 91 | |
|
| | 92 | | private MUNity.BlazorServer.Components.General.DeleteWarningModal deleteWarningModal; |
| | 93 | |
|
| | 94 | | private void RequestRemoveFreeRole(ManageDelegationRoleInfo role) |
| 0 | 95 | | { |
| 0 | 96 | | deleteWarningModal.OnAccepted = new Task(async () => await RemoveDelegateRole(role)); |
| 0 | 97 | | deleteWarningModal.Show($"{role.RoleName} löschen?", $"Soll die Rolle {role.RoleName} wirklich gelöscht werden?" |
| 0 | 98 | | } |
| | 99 | |
|
| | 100 | | private async Task RemoveDelegateRole(ManageDelegationRoleInfo role) |
| 0 | 101 | | { |
| 0 | 102 | | var claim = (await AuthStateTask)?.User; |
| 0 | 103 | | if (claim == null) |
| 0 | 104 | | return; |
| | 105 | |
|
| 0 | 106 | | var result = await conferenceRoleService.RemoveDelegateRole(role.RoleId, claim); |
| 0 | 107 | | if (result) |
| 0 | 108 | | { |
| 0 | 109 | | Roles.Remove(role); |
| 0 | 110 | | await this.InvokeAsync(this.StateHasChanged); |
| 0 | 111 | | } |
| 0 | 112 | | } |
| | 113 | |
|
| | 114 | | private async Task LoadData() |
| 0 | 115 | | { |
| 0 | 116 | | var claim = (await AuthStateTask)?.User; |
| 0 | 117 | | if (claim != null) |
| 0 | 118 | | { |
| 0 | 119 | | this.Roles = await conferenceRoleService.GetRoleInfos(ConferenceId, claim); |
| 0 | 120 | | } |
| 0 | 121 | | } |
| | 122 | | } |