| | 1 | | <!-- Create Project Modal --> |
| | 2 | | @inject Services.ConferenceService conferenceService; |
| | 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"> |
| 0 | 10 | | <h4 class="modal-title">Neuen Sitz in @CommitteeName</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 Sitze</h3> |
| 0 | 20 | | <p>Über diesen Dialog kann @CommitteeName ein Sitz in Form einer Rolle hinzugefügt werden. D |
| | 21 | |
|
| | 22 | | <div class="row mb-15px"> |
| | 23 | | <label class="form-label col-form-label col-md-3">Rollenname</label> |
| | 24 | | <div class="col-md-9"> |
| | 25 | | <InputText type="text" class="form-control mb-5px" placeholder="Generalversammlung" |
| | 26 | | <small class="fs-12px text-gray-500-darker">z.B. Abgeordneter Deutschland/ Präsident |
| | 27 | | </div> |
| | 28 | | </div> |
| | 29 | |
|
| 0 | 30 | | @if (Countries != null) |
| 0 | 31 | | { |
| | 32 | | <div class="row mb-15px"> |
| | 33 | | <label class="form-label col-form-label col-md-3">Repräsentiertes Land</label> |
| | 34 | | <div class="col-md-9"> |
| | 35 | | <InputSelect @bind-Value="@request.CountryId" class="form-select"> |
| | 36 | | <option value="-1">Keinem Land zugehörig</option> |
| 0 | 37 | | @foreach (var country in Countries) |
| 0 | 38 | | { |
| 0 | 39 | | <option value="@country.CountryId">@country.Name</option> |
| 0 | 40 | | } |
| | 41 | | </InputSelect> |
| | 42 | | <small class="fs-12px text-gray-500-darker"></small> |
| | 43 | | </div> |
| | 44 | | </div> |
| 0 | 45 | | } |
| | 46 | |
|
| 0 | 47 | | @if (Delegations != null) |
| 0 | 48 | | { |
| | 49 | | <div class="row mb-15px"> |
| | 50 | | <label class="form-label col-form-label col-md-3">DelegationWishes</label> |
| | 51 | | <div class="col-md-9"> |
| | 52 | | <InputSelect @bind-Value="@request.DelegationId" class="form-select"> |
| | 53 | | <option value="">Keine DelegationWishes</option> |
| 0 | 54 | | @foreach (var delegation in Delegations) |
| 0 | 55 | | { |
| 0 | 56 | | <option value="@delegation.DelegationId">@delegation.DelegationName</opt |
| 0 | 57 | | } |
| | 58 | | </InputSelect> |
| | 59 | | <small class="fs-12px text-gray-500-darker"></small> |
| | 60 | | </div> |
| | 61 | | </div> |
| 0 | 62 | | } |
| | 63 | |
|
| | 64 | |
|
| | 65 | | </div> |
| | 66 | | <div class="modal-footer"> |
| 0 | 67 | | <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button> |
| | 68 | | <button class="btn btn-success" type="submit">Sitz erstellen</button> |
| | 69 | | </div> |
| | 70 | | </EditForm> |
| 0 | 71 | | } |
| | 72 | | else |
| 0 | 73 | | { |
| | 74 | | <div class="modal-body"> |
| | 75 | | <div class="col-12"> |
| 0 | 76 | | @if (!response.HasError) |
| 0 | 77 | | { |
| 0 | 78 | | <div class="alert alert-success">Sitz erfolgreich erstellt <button class="btn btn-sm btn |
| 0 | 79 | | } |
| | 80 | | </div> |
| | 81 | |
|
| | 82 | | </div> |
| | 83 | | <div class="modal-footer"> |
| 0 | 84 | | <button class="btn btn-white" @onclick="() => Hide()">Schließen</button> |
| | 85 | | </div> |
| 0 | 86 | | } |
| | 87 | |
|
| | 88 | | </div> |
| | 89 | | </div> |
| | 90 | | </div> |
| | 91 | | <div class="modal-backdrop fade show"></div> |
| 0 | 92 | | } |
| | 93 | |
|
| | 94 | |
|
| | 95 | | @code { |
| 0 | 96 | | private bool isVisible = false; |
| | 97 | |
|
| 0 | 98 | | [CascadingParameter] public Task<AuthenticationState> authStateTask { get; set; } |
| | 99 | |
|
| 0 | 100 | | [Parameter] public string CommitteeId { get; set; } |
| | 101 | |
|
| 0 | 102 | | [Parameter] public string CommitteeName { get; set; } |
| | 103 | |
|
| 0 | 104 | | [Parameter] public EventCallback SeatCreated { get; set; } |
| | 105 | |
|
| 0 | 106 | | [Parameter] public List<MUNity.Schema.Conference.CountryInfo> Countries { get; set; } |
| | 107 | |
|
| 0 | 108 | | [Parameter] public List<MUNity.Schema.Conference.DelegationInfo> Delegations { get; set; } |
| | 109 | |
|
| 0 | 110 | | private int groupId { get; set; } |
| | 111 | |
|
| | 112 | | private Schema.Conference.CreateCommitteeSeatRequest request; |
| | 113 | |
|
| | 114 | | private Schema.Conference.CreateSeatResponse response; |
| | 115 | |
|
| | 116 | |
|
| | 117 | | protected override void OnInitialized() |
| 0 | 118 | | { |
| 0 | 119 | | this.request = new Schema.Conference.CreateCommitteeSeatRequest(); |
| 0 | 120 | | this.request.CommitteeId = CommitteeId; |
| 0 | 121 | | } |
| | 122 | |
|
| | 123 | | public void Show() |
| 0 | 124 | | { |
| 0 | 125 | | isVisible = true; |
| 0 | 126 | | StateHasChanged(); |
| 0 | 127 | | } |
| | 128 | |
|
| | 129 | | public void Hide() |
| 0 | 130 | | { |
| 0 | 131 | | isVisible = false; |
| 0 | 132 | | } |
| | 133 | |
|
| | 134 | | public async Task CreateRoleGroup() |
| 0 | 135 | | { |
| 0 | 136 | | var claim = (await authStateTask)?.User; |
| 0 | 137 | | if (claim != null) |
| 0 | 138 | | { |
| 0 | 139 | | this.response = await conferenceService.CreateCommitteeSeat(request, claim); |
| 0 | 140 | | if (!response.HasError) |
| 0 | 141 | | await SeatCreated.InvokeAsync(); |
| 0 | 142 | | } |
| | 143 | |
|
| 0 | 144 | | } |
| | 145 | |
|
| | 146 | | private void Reset() |
| 0 | 147 | | { |
| 0 | 148 | | request.CountryId = -1; |
| 0 | 149 | | request.DelegationId = null; |
| 0 | 150 | | request.RoleName = null; |
| 0 | 151 | | request.Subtype = null; |
| 0 | 152 | | response = null; |
| 0 | 153 | | } |
| | 154 | | } |