| | 1 | | @using MUNity.Database.Models.Website |
| | 2 | | @using MUNity.Database.Context |
| | 3 | | @using Microsoft.EntityFrameworkCore |
| | 4 | | @using MUNity.Database.Models.Conference |
| | 5 | | @using Microsoft.AspNetCore.Components |
| | 6 | | @using System.Linq |
| | 7 | | @inject Services.UserConferenceAuthService conferenceAuthService |
| | 8 | | @inject MunityContext dbContext |
| | 9 | |
|
| 0 | 10 | | @if (saved) |
| 0 | 11 | | { |
| | 12 | | <div class="alert alert-success fade show rounded-0 mb-0 animate__animated animate__delay-3s animate__fadeOutUp"> |
| | 13 | | <div class="d-flex"> |
| | 14 | | <i class="fa fa-check fa-2x me-1"></i> |
| | 15 | | <div class="mb-0 ps-2"> |
| | 16 | | Änderungen gespeichert. |
| | 17 | | </div> |
| | 18 | | </div> |
| | 19 | | </div> |
| 0 | 20 | | } |
| | 21 | |
|
| 0 | 22 | | @if (_formula != null) |
| 0 | 23 | | { |
| 0 | 24 | | <EditForm Model="_formula" OnValidSubmit="() => { dbContext.SaveChanges(); saved = true; Task.Run(async () => { awai |
| | 25 | |
|
| | 26 | | @*<div class="row mb-3"> |
| | 27 | | <label class="form-label col-form-label col-md-3">Aktivieren</label> |
| | 28 | | <div class="col-md-9"> |
| | 29 | | <RadzenSwitch @bind-Value=_formula.IsActive /> |
| | 30 | | </div> |
| | 31 | | </div>*@ |
| | 32 | |
|
| | 33 | |
|
| | 34 | |
|
| | 35 | | <div class="row mb-3"> |
| | 36 | | <label class="form-label">Titel</label> |
| | 37 | | <InputText @bind-Value="_formula.Title" class="form-control"/> |
| | 38 | | </div> |
| | 39 | |
|
| | 40 | | @*<div class="row mb-3"> |
| | 41 | | <label class="form-label col-form-label col-md-3">Startdatum</label> |
| | 42 | | <div class="col-md-9"> |
| | 43 | | <RadzenDatePicker class="w-100" TValue="DateTime?" @bind-Value="_formula.ApplicationStartDate" ShowTime="tru |
| | 44 | | </div> |
| | 45 | | </div> |
| | 46 | |
|
| | 47 | | <div class="row mb-3"> |
| | 48 | | <label class="form-label col-form-label col-md-3">Enddatum</label> |
| | 49 | | <div class="col-md-9"> |
| | 50 | | <RadzenDatePicker class="w-100" TValue="DateTime?" @bind-Value="_formula.ApplicationEndDate" ShowTime="true" |
| | 51 | | </div> |
| | 52 | | </div>*@ |
| | 53 | |
|
| | 54 | | <div class="row mb-3"> |
| | 55 | | <label class="form-label col-md-3">BewerberInnen benötigen Namen im Profil</label> |
| | 56 | | <RadzenSwitch class="col-md-9" @bind-Value="_formula.RequiresName"/> |
| | 57 | | </div> |
| | 58 | |
|
| | 59 | | <div class="row mb-3"> |
| | 60 | | <label class="form-label col-md-3">BewerberInnen benötigen Adressdaten im Profil</label> |
| | 61 | | <RadzenSwitch class="col-md-9" @bind-Value="_formula.RequiresAddress"/> |
| | 62 | | </div> |
| | 63 | |
|
| | 64 | | <div class="row mb-3"> |
| | 65 | | <label class="form-label col-md-3">BewerberInnen benötigen angaben über eine Schule im Profil</label> |
| | 66 | | <RadzenSwitch class="col-md-9" @bind-Value="_formula.RequiresSchool"/> |
| | 67 | | </div> |
| | 68 | |
|
| | 69 | | <div class="row mb-3"> |
| | 70 | | <label class="form-label">Text vor der Anmeldung/Bewerbung</label> |
| | 71 | | <RadzenHtmlEditor @bind-Value=_formula.PreContent style="height: 250px; margin-bottom: 1rem;"> |
| | 72 | | <RadzenHtmlEditorBold/> |
| | 73 | | <RadzenHtmlEditorItalic/> |
| | 74 | | <RadzenHtmlEditorUnderline/> |
| | 75 | | <RadzenHtmlEditorStrikeThrough/> |
| | 76 | | <RadzenHtmlEditorSeparator/> |
| | 77 | | <RadzenHtmlEditorColor/> |
| | 78 | | <RadzenHtmlEditorBackground/> |
| | 79 | | <RadzenHtmlEditorRemoveFormat/> |
| | 80 | | </RadzenHtmlEditor> |
| | 81 | | </div> |
| | 82 | |
|
| 0 | 83 | | @if (_formula.Fields != null) |
| 0 | 84 | | { |
| | 85 | | <table class="table"> |
| | 86 | | <thead> |
| | 87 | | <tr> |
| | 88 | | <th>Name</th> |
| | 89 | | <th>Art</th> |
| | 90 | | <th>Beschreibung</th> |
| | 91 | | <th>Ist Pflichtfeld</th> |
| | 92 | | <th>Standardwert</th> |
| | 93 | | <th>Löschen</th> |
| | 94 | | </tr> |
| | 95 | | </thead> |
| | 96 | |
|
| | 97 | | <tbody> |
| 0 | 98 | | @foreach (var field in _formula.Fields) |
| 0 | 99 | | { |
| | 100 | | <tr> |
| | 101 | | <td> |
| | 102 | | <div class="form-floating"> |
| | 103 | | <input type="text" class="form-control h-45px fs-13px" placeholder="@field.FieldName" @b |
| | 104 | | <label class="d-flex align-items-center fs-13px text-gray-600">Name</label> |
| | 105 | | </div> |
| | 106 | | </td> |
| | 107 | | <td> |
| | 108 | | <select class="form-control" @bind="@field.FieldType"> |
| | 109 | | <option value="@ConferenceApplicationFieldTypes.Text">Textfeld</option> |
| | 110 | | <option value="@ConferenceApplicationFieldTypes.MultiLineText">Mehrzeiliger Text</option |
| | 111 | | <option value="@ConferenceApplicationFieldTypes.Number">Zahl</option> |
| | 112 | | <option value="@ConferenceApplicationFieldTypes.Date">Datum</option> |
| | 113 | | <option value="@ConferenceApplicationFieldTypes.Time">Uhrzeit</option> |
| | 114 | | <option value="@ConferenceApplicationFieldTypes.Check">Checkbox</option> |
| | 115 | | <option value="@ConferenceApplicationFieldTypes.Country">Land</option> |
| | 116 | | <option value="@ConferenceApplicationFieldTypes.School">Schule</option> |
| | 117 | | </select> |
| | 118 | | </td> |
| | 119 | | <td> |
| | 120 | | <div class="form-floating"> |
| | 121 | | <input type="text" class="form-control h-45px fs-13px" placeholder="@field.FieldDescript |
| | 122 | | <label class="d-flex align-items-center fs-13px text-gray-600">Beschreibung</label> |
| | 123 | | </div> |
| | 124 | | </td> |
| | 125 | |
|
| | 126 | | <td> |
| | 127 | |
|
| | 128 | | <RadzenSwitch @bind-Value="@field.IsRequired"/> |
| | 129 | | </td> |
| | 130 | |
|
| | 131 | | <td> |
| | 132 | | <div class="form-floating"> |
| | 133 | | <input type="text" class="form-control h-45px fs-13px" placeholder="@field.DefaultValue" |
| | 134 | | <label class="d-flex align-items-center fs-13px text-gray-600">Standardwert</label> |
| | 135 | | </div> |
| | 136 | | </td> |
| | 137 | |
|
| | 138 | | <td> |
| 0 | 139 | | <a class="btn btn-danger" @onclick="() => _formula.Fields.Remove(field)">Löschen</a> |
| | 140 | | </td> |
| | 141 | | </tr> |
| 0 | 142 | | } |
| | 143 | | </tbody> |
| | 144 | |
|
| | 145 | | </table> |
| | 146 | |
|
| | 147 | | <a class="btn btn-primary w-100 mb-3" @onclick="AddField">Feld hinzufügen</a> |
| 0 | 148 | | } |
| | 149 | |
|
| | 150 | | <div class="row mb-3"> |
| | 151 | | <label class="form-label">Text nach der Anmeldung/Bewerbung</label> |
| | 152 | | <RadzenHtmlEditor @bind-Value=_formula.PostContent style="height: 250px; margin-bottom: 1rem;"> |
| | 153 | | <RadzenHtmlEditorBold/> |
| | 154 | | <RadzenHtmlEditorItalic/> |
| | 155 | | <RadzenHtmlEditorUnderline/> |
| | 156 | | <RadzenHtmlEditorStrikeThrough/> |
| | 157 | | <RadzenHtmlEditorSeparator/> |
| | 158 | | <RadzenHtmlEditorColor/> |
| | 159 | | <RadzenHtmlEditorBackground/> |
| | 160 | | <RadzenHtmlEditorRemoveFormat/> |
| | 161 | | </RadzenHtmlEditor> |
| | 162 | | </div> |
| | 163 | |
|
| | 164 | |
|
| | 165 | | <div class="row mb-3"> |
| | 166 | | <button type="submit" class="btn btn-success w-100px me-5px">Speichern</button> |
| | 167 | | </div> |
| | 168 | | </EditForm> |
| 0 | 169 | | } |
| | 170 | |
|
| | 171 | |
|
| | 172 | | @code { |
| 0 | 173 | | [Parameter] public string ConferenceId { get; set; } |
| | 174 | |
|
| | 175 | | ConferenceApplicationFormula _formula; |
| | 176 | |
|
| | 177 | |
|
| 0 | 178 | | private bool saved = false; |
| | 179 | |
|
| | 180 | | private void AddField() |
| 0 | 181 | | { |
| 0 | 182 | | if (_formula != null) |
| 0 | 183 | | { |
| 0 | 184 | | var newField = new MUNity.Database.Models.Conference.ConferenceApplicationField() |
| 0 | 185 | | { |
| 0 | 186 | | Forumula = _formula |
| 0 | 187 | | }; |
| 0 | 188 | | _formula.Fields.Add(newField); |
| 0 | 189 | | this.StateHasChanged(); |
| 0 | 190 | | } |
| 0 | 191 | | } |
| | 192 | |
|
| | 193 | | protected override async Task OnInitializedAsync() |
| 0 | 194 | | { |
| 0 | 195 | | await base.OnInitializedAsync(); |
| 0 | 196 | | _formula = dbContext.ConferenceApplicationFormulas |
| 0 | 197 | | .Include(n => n.Fields) |
| 0 | 198 | | .FirstOrDefault(n => n.Options.Conference.ConferenceId == ConferenceId); |
| 0 | 199 | | } |
| | 200 | | } |