| | 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"> |
| | 10 | | <h4 class="modal-title">Neues Projekt</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="CreateConference"> |
| | 16 | | <DataAnnotationsValidator /> |
| | 17 | | <ValidationSummary /> |
| | 18 | | <div class="modal-body"> |
| | 19 | | <h3>Über Projekte</h3> |
| | 20 | | <p>Projekte sind den Konferenzen übergeordnet. Ein Projekt ist also eine Art Gruppe von Konf |
| | 21 | |
|
| | 22 | | <div class="row mb-15px"> |
| | 23 | | <label class="form-label col-form-label col-md-3">Konferenzname</label> |
| | 24 | | <div class="col-md-9"> |
| | 25 | | <InputText type="text" class="form-control mb-5px" placeholder="MUN ..." @bind-Value |
| | 26 | | <small class="fs-12px text-gray-500-darker">Ein kurzer Name für die Konferenz. Zum B |
| | 27 | | </div> |
| | 28 | | </div> |
| | 29 | |
|
| | 30 | | <div class="row mb-15px"> |
| | 31 | | <label class="form-label col-form-label col-md-3">Vollständiger Konferenzname</label> |
| | 32 | | <div class="col-md-9"> |
| | 33 | | <InputText type="text" class="form-control mb-5px" placeholder="Model United Nations |
| | 34 | | <small class="fs-12px text-gray-500-darker">Der komplette name der Konferenz zum Bei |
| | 35 | | </div> |
| | 36 | | </div> |
| | 37 | |
|
| | 38 | | <div class="row mb-15px"> |
| | 39 | | <label class="form-label col-form-label col-md-3">Kürzel</label> |
| | 40 | | <div class="col-md-9"> |
| | 41 | | <InputText type="text" class="form-control mb-5px" placeholder="MUN ..." @bind-Value |
| | 42 | | <small class="fs-12px text-gray-500-darker">Ein Kürzel für diese Konferenz. Dieses l |
| | 43 | | </div> |
| | 44 | | </div> |
| | 45 | |
|
| | 46 | | <div class="row mb-15px"> |
| | 47 | | <label class="form-label col-form-label col-md-3">Startdatum</label> |
| | 48 | | <div class="col-md-9"> |
| | 49 | | <InputDate type="text" class="form-control mb-5px" @bind-Value="@request.StartDate" |
| | 50 | | <small class="fs-12px text-gray-500-darker">Startdatum für die Konferenz. Darf auch |
| | 51 | | </div> |
| | 52 | | </div> |
| | 53 | |
|
| | 54 | | <div class="row mb-15px"> |
| | 55 | | <label class="form-label col-form-label col-md-3">Endatum</label> |
| | 56 | | <div class="col-md-9"> |
| | 57 | | <InputDate type="text" class="form-control mb-5px" @bind-Value="@request.EndDate" /> |
| | 58 | | <small class="fs-12px text-gray-500-darker">Enddatum für die Konferenz. Darf auch fr |
| | 59 | | </div> |
| | 60 | | </div> |
| | 61 | | </div> |
| | 62 | | <div class="modal-footer"> |
| 0 | 63 | | <button class="btn btn-white" @onclick="() => Hide()">Abbrechen</button> |
| | 64 | | <button class="btn btn-success" type="submit">Projekt erstellen</button> |
| | 65 | | </div> |
| | 66 | | </EditForm> |
| 0 | 67 | | } |
| | 68 | | else |
| 0 | 69 | | { |
| | 70 | | <div class="modal-body"> |
| | 71 | | <div class="col-12"> |
| 0 | 72 | | @if (!response.HasError) |
| 0 | 73 | | { |
| | 74 | | <div class="alert alert-success">Das Porjekt wurde erfolgreich erstellt. <button class=" |
| 0 | 75 | | } |
| | 76 | | </div> |
| | 77 | |
|
| | 78 | | </div> |
| | 79 | | <div class="modal-footer"> |
| 0 | 80 | | <button class="btn btn-white" @onclick="() => Hide()">Schließen</button> |
| | 81 | | </div> |
| 0 | 82 | | } |
| | 83 | |
|
| | 84 | | </div> |
| | 85 | | </div> |
| | 86 | | </div> |
| | 87 | | <div class="modal-backdrop fade show"></div> |
| 0 | 88 | | } |
| | 89 | |
|
| | 90 | |
|
| | 91 | | @code { |
| 0 | 92 | | private bool isVisible = false; |
| | 93 | |
|
| 0 | 94 | | [Parameter] public string ProjectId { get; set; } |
| | 95 | |
|
| 0 | 96 | | [CascadingParameter] public Task<AuthenticationState> authStateTask { get; set; } |
| | 97 | |
|
| | 98 | | private MUNity.Schema.Conference.CreateConferenceRequest request; |
| | 99 | |
|
| | 100 | | private MUNity.Schema.Conference.CreateConferenceResponse response; |
| | 101 | |
|
| | 102 | | protected override void OnInitialized() |
| 0 | 103 | | { |
| 0 | 104 | | this.request = new Schema.Conference.CreateConferenceRequest(); |
| 0 | 105 | | this.request.ProjectId = this.ProjectId; |
| 0 | 106 | | } |
| | 107 | |
|
| | 108 | | public void Show() |
| 0 | 109 | | { |
| 0 | 110 | | isVisible = true; |
| 0 | 111 | | StateHasChanged(); |
| 0 | 112 | | } |
| | 113 | |
|
| | 114 | | public void Hide() |
| 0 | 115 | | { |
| 0 | 116 | | isVisible = false; |
| 0 | 117 | | } |
| | 118 | |
|
| | 119 | | public async Task CreateConference() |
| 0 | 120 | | { |
| 0 | 121 | | var claim = (await authStateTask)?.User; |
| 0 | 122 | | if (claim != null) |
| 0 | 123 | | { |
| 0 | 124 | | this.response = conferenceService.CreateConference(request, claim); |
| 0 | 125 | | } |
| | 126 | |
|
| 0 | 127 | | } |
| | 128 | | } |