| | 1 | | @using Microsoft.EntityFrameworkCore |
| | 2 | | @using MUNity.BlazorServer.Components.Conference.Application |
| | 3 | | @using MUNity.Base |
| | 4 | |
|
| | 5 | | @inject MUNity.Database.Context.MunityContext context |
| | 6 | | @inject UserManager<MUNity.Database.Models.User.MunityUser> userManager |
| | 7 | |
|
| 0 | 8 | | @if (application != null) |
| 0 | 9 | | { |
| | 10 | |
|
| 0 | 11 | | @if (step == 0) |
| 0 | 12 | | { |
| 0 | 13 | | <ApplicationUsersSelection ConferenceId="@ConferenceId" Application="application" UsersSelected="() => step = 1" |
| 0 | 14 | | } |
| 0 | 15 | | else if (step == 1) |
| 0 | 16 | | { |
| | 17 | | <div class="row"> |
| 0 | 18 | | <button class="btn btn-primary" @onclick="() => step = 0">Zurück zur Benutzerauswahl</button> |
| | 19 | | </div> |
| 0 | 20 | | <SelectableDelegationsComponent Application="@application" ConferenceId="@ConferenceId" DelegationsAdded="() => |
| 0 | 21 | | } |
| 0 | 22 | | else if (step == 2) |
| 0 | 23 | | { |
| 0 | 24 | | <DelegationApplicationFieldsComponent ConferenceId="@ConferenceId" Application="@application" Finished="() => st |
| 0 | 25 | | } |
| 0 | 26 | | else if (step == 3) |
| 0 | 27 | | { |
| | 28 | | <ApplicationReviewComponent Application="@application" ConferenceId="@ConferenceId" /> |
| 0 | 29 | | } |
| 0 | 30 | | } |
| | 31 | |
|
| | 32 | |
|
| | 33 | | @code { |
| 0 | 34 | | [CascadingParameter] public Task<AuthenticationState> AuthStateTask { get; set; } |
| | 35 | |
|
| 0 | 36 | | [Parameter] public string ConferenceId { get; set; } |
| | 37 | |
|
| 0 | 38 | | private int step = 0; |
| | 39 | |
|
| 0 | 40 | | [Parameter] public EventCallback<int> StepChanged { get; set; } |
| | 41 | |
|
| 0 | 42 | | [Parameter] public bool UseOnlineMode { get; set; } = false; |
| | 43 | |
|
| | 44 | | private MUNity.Database.Models.Conference.DelegationApplication application; |
| | 45 | |
|
| | 46 | |
|
| | 47 | | protected override async Task OnInitializedAsync() |
| 0 | 48 | | { |
| 0 | 49 | | await base.OnInitializedAsync(); |
| | 50 | |
|
| 0 | 51 | | application = new Database.Models.Conference.DelegationApplication() |
| 0 | 52 | | { |
| 0 | 53 | | Status = MUNity.Base.ApplicationStatuses.Writing, |
| 0 | 54 | | Conference = context.Conferences.Find(ConferenceId), |
| 0 | 55 | | ApplyDate = DateTime.Now |
| 0 | 56 | | }; |
| | 57 | |
|
| 0 | 58 | | var claim = (await AuthStateTask)?.User; |
| 0 | 59 | | var me = await userManager.GetUserAsync(claim); |
| | 60 | |
|
| 0 | 61 | | application.Users = new List<MUNity.Database.Models.Conference.DelegationApplicationUserEntry>(); |
| 0 | 62 | | application.Users.Add(new Database.Models.Conference.DelegationApplicationUserEntry() |
| 0 | 63 | | { |
| 0 | 64 | | Application = application, |
| 0 | 65 | | CanWrite = true, |
| 0 | 66 | | Status = DelegationApplicationUserEntryStatuses.Joined, |
| 0 | 67 | | User = me |
| 0 | 68 | | }); |
| | 69 | |
|
| 0 | 70 | | application.DelegationWishes = new List<MUNity.Database.Models.Conference.DelegationApplicationPickedDelegation> |
| | 71 | |
|
| 0 | 72 | | application.FormulaInputs = new List<Database.Models.Conference.ConferenceDelegationApplicationFieldInput>(); |
| | 73 | |
|
| | 74 | | // This is a quickfix to jump directly into the Delegation Selection |
| 0 | 75 | | if (UseOnlineMode) |
| 0 | 76 | | { |
| 0 | 77 | | this.step = 1; |
| 0 | 78 | | } |
| 0 | 79 | | } |
| | 80 | | } |