| | 1 | | <!-- Create Project Modal --> |
| | 2 | | @inject Services.ConferenceRoleService _conferenceRoleService |
| | 3 | |
|
| 0 | 4 | | @if (isVisible) |
| 0 | 5 | | { |
| | 6 | | <div class="modal fade show" style="display: block;" role="dialog"> |
| | 7 | | <div class="modal-dialog"> |
| | 8 | | <div class="modal-content"> |
| | 9 | | <div class="modal-header"> |
| | 10 | | <h4 class="modal-title">Neue Teamrolle</h4> |
| 0 | 11 | | <button type="button" class="btn-close" @onclick="() => Hide()"></button> |
| | 12 | | </div> |
| 0 | 13 | | @if (response == null) |
| 0 | 14 | | { |
| | 15 | | <EditForm Model="request" OnValidSubmit="CreateRoleGroup"> |
| | 16 | | <DataAnnotationsValidator /> |
| | 17 | | <ValidationSummary /> |
| | 18 | | <div class="modal-body"> |
| | 19 | | <h3>Über Teamrollen</h3> |
| | 20 | | <p>Um später MitgliederInnen zum Team hinzufügen zu können müssen hierfür Rollen definiert w |
| | 21 | | <p>Im Gegensatz zu Gruppennamen ist es erlaubt, den gleichen Namen mehrfach zu vergeben. Rol |
| | 22 | |
|
| | 23 | | <div class="row mb-15px"> |
| | 24 | | <label class="form-label col-form-label col-md-3">Rollenname</label> |
| | 25 | | <div class="col-md-9"> |
| | 26 | | <InputText type="text" class="form-control mb-5px" placeholder="Projektleitung" @bin |
| | 27 | | <small class="fs-12px text-gray-500-darker">Der Name der Role. Zum Beispiel Projektl |
| | 28 | | </div> |
| | 29 | | </div> |
| | 30 | |
|
| | 31 | | <div class="row mb-15px"> |
| | 32 | | <label class="form-label col-form-label col-md-3">Vollständiger Rollenname</label> |
| | 33 | | <div class="col-md-9"> |
| | 34 | | <InputText type="text" class="form-control mb-5px" placeholder="Projektleitung MUN.. |
| | 35 | | <small class="fs-12px text-gray-500-darker">Ein erweiterter Name für die Gruppe. Zum |
| | 36 | | </div> |
| | 37 | | </div> |
| | 38 | |
|
| | 39 | | <div class="row mb-15px"> |
| | 40 | | <label class="form-label col-form-label col-md-3">Rollenkürzel</label> |
| | 41 | | <div class="col-md-9"> |
| | 42 | | <InputText type="text" class="form-control mb-5px" placeholder="PL" @bind-Value="@re |
| | 43 | | <small class="fs-12px text-gray-500-darker">Eine Kurzform für die Rolle zum Beispiel |
| | 44 | | </div> |
| | 45 | | </div> |
| | 46 | |
|
| 0 | 47 | | @if (GroupInfos != null) |
| 0 | 48 | | { |
| | 49 | | <div class="row mb-15px"> |
| | 50 | | <label class="form-label col-form-label col-md-3">Übergeordnete Rolle</label> |
| | 51 | | <div class="col-md-9"> |
| | 52 | | <InputSelect @bind-Value="@request.ParentRoleId" class="form-select"> |
| | 53 | | <option value="-1">Keine</option> |
| 0 | 54 | | @foreach (var group in GroupInfos) |
| 0 | 55 | | { |
| | 56 | | <optgroup label="@group.Name"> |
| 0 | 57 | | @if (group.Roles != null && group.Roles.Count > 0) |
| 0 | 58 | | { |
| 0 | 59 | | foreach (var role in group.Roles) |
| 0 | 60 | | { |
| 0 | 61 | | <option value="@role.TeamRoleId">@role.Name</option> |
| | 62 | |
|
| 0 | 63 | | } |
| 0 | 64 | | } |
| | 65 | |
|
| | 66 | | </optgroup> |
| 0 | 67 | | } |
| | 68 | | </InputSelect> |
| | 69 | | <small class="fs-12px text-gray-500-darker">Eine Rolle, welcher diese Rolle untersteht. |
| | 70 | | </div> |
| | 71 | | </div> |
| 0 | 72 | | } |
| | 73 | |
|
| | 74 | |
|
| | 75 | | </div> |
| | 76 | | <div class="modal-footer"> |
| 0 | 77 | | <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button> |
| | 78 | | <button class="btn btn-success" type="submit">Rolle erstellen</button> |
| | 79 | | </div> |
| | 80 | | </EditForm> |
| 0 | 81 | | } |
| | 82 | | else |
| 0 | 83 | | { |
| | 84 | | <div class="modal-body"> |
| | 85 | | <div class="col-12"> |
| 0 | 86 | | @if (!response.HasError) |
| 0 | 87 | | { |
| 0 | 88 | | <div class="alert alert-success">Die Rolle wurde erfolgreich erstellt <button class="btn |
| 0 | 89 | | } |
| | 90 | | </div> |
| | 91 | |
|
| | 92 | | </div> |
| | 93 | | <div class="modal-footer"> |
| 0 | 94 | | <button class="btn btn-white" @onclick="() => Hide()">Schließen</button> |
| | 95 | | </div> |
| 0 | 96 | | } |
| | 97 | |
|
| | 98 | | </div> |
| | 99 | | </div> |
| | 100 | | </div> |
| | 101 | | <div class="modal-backdrop fade show"></div> |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | |
|
| | 105 | | @code { |
| 0 | 106 | | private bool isVisible = false; |
| | 107 | |
|
| 0 | 108 | | [CascadingParameter] public Task<AuthenticationState> AuthStateTask { get; set; } |
| | 109 | |
|
| 0 | 110 | | [Parameter] public EventCallback RolesChanged { get; set; } |
| | 111 | |
|
| 0 | 112 | | [Parameter] public List<MUNity.Schema.Conference.TeamRoleGroupInfo> GroupInfos { get; set; } |
| | 113 | |
|
| 0 | 114 | | private int groupId { get; set; } |
| | 115 | |
|
| | 116 | | private Schema.Conference.CreateTeamRoleRequest request; |
| | 117 | |
|
| | 118 | | private Schema.Conference.CreateTeamRoleResponse response; |
| | 119 | |
|
| | 120 | |
|
| | 121 | | protected override void OnInitialized() |
| 0 | 122 | | { |
| 0 | 123 | | this.request = new Schema.Conference.CreateTeamRoleRequest(); |
| 0 | 124 | | } |
| | 125 | |
|
| | 126 | | public void Show(int groupId) |
| 0 | 127 | | { |
| 0 | 128 | | isVisible = true; |
| 0 | 129 | | this.request.RoleGroupId = groupId; |
| 0 | 130 | | StateHasChanged(); |
| 0 | 131 | | } |
| | 132 | |
|
| | 133 | | public void Hide() |
| 0 | 134 | | { |
| 0 | 135 | | isVisible = false; |
| 0 | 136 | | } |
| | 137 | |
|
| | 138 | | public async Task CreateRoleGroup() |
| 0 | 139 | | { |
| 0 | 140 | | var claim = (await AuthStateTask)?.User; |
| 0 | 141 | | if (claim != null) |
| 0 | 142 | | { |
| 0 | 143 | | this.response = await _conferenceRoleService.CreateTeamRoleAsync(request, claim); |
| 0 | 144 | | if (!response.HasError) |
| 0 | 145 | | await RolesChanged.InvokeAsync(); |
| 0 | 146 | | } |
| | 147 | |
|
| 0 | 148 | | } |
| | 149 | |
|
| | 150 | | private void Reset() |
| 0 | 151 | | { |
| 0 | 152 | | request.ParentRoleId = -1; |
| 0 | 153 | | request.RoleFullName = null; |
| 0 | 154 | | request.RoleName = null; |
| 0 | 155 | | request.RoleShort = null; |
| 0 | 156 | | response = null; |
| 0 | 157 | | } |
| | 158 | | } |