| | 1 | | @layout MUNity.BlazorServer.Shared.ConferenceFrontEndLayout |
| | 2 | | @inject Services.ConferenceApplicationService applicationService |
| | 3 | | @inject MUNity.Database.Context.MunityContext context |
| | 4 | |
|
| | 5 | | <div class="pos-booking"> |
| | 6 | | <div class="pos-booking-body" style="margin-top: 0px;"> |
| | 7 | | <!-- BEGIN pos-booking-content --> |
| | 8 | | <div class="pos-booking-content" style="margin-top: 0px;"> |
| | 9 | | <div class="pos-booking-content-container" style="margin-top: 0px;"> |
| | 10 | | <div class="row"> |
| 0 | 11 | | <h4>Bitte wählen Sie @maxPickDelegations Delegationen, welche sie gerne belegen möchten</h4> |
| | 12 | | <p>Hierbei bitte die angezeigte Nummer beachten. Diese ist die Priorität mit welcher Sie diese Deleg |
| | 13 | | </div> |
| | 14 | | <div class="row"> |
| 0 | 15 | | @foreach (var delegation in pickedDelegations) |
| 0 | 16 | | { |
| | 17 | | <SelectableDelegationComponent SelectionText="@((pickedDelegations.IndexOf(delegation) + 1).ToSt |
| | 18 | | Delegation="delegation" |
| 0 | 19 | | Clicked="(n) => this.pickedDelegations.Remove(n)"/> |
| 0 | 20 | | } |
| | 21 | | </div> |
| | 22 | |
|
| | 23 | |
|
| 0 | 24 | | @if (pickedDelegations.Count < this.maxPickDelegations && AllDeleations.Count >= this.maxPickDelegations |
| 0 | 25 | | (pickedDelegations.Count < this.AllDeleations.Count && this.AllDeleations.Count < this.maxPickDelega |
| 0 | 26 | | { |
| | 27 | | <div class="d-md-flex align-items-center mb-4"> |
| | 28 | | <div class="pos-booking-title flex-1"> |
| | 29 | | <div class="fs-24px mb-1">Verfügbare Delegationen</div> |
| | 30 | | <div class="mb-2 mb-md-0 d-flex"> |
| | 31 | | <div class="d-flex align-items-center me-3"> |
| | 32 | | <i class="fa fa-circle fa-fw text-gray-700 fs-9px me-1"></i> Passend |
| | 33 | | </div> |
| | 34 | | <div class="d-flex align-items-center me-3"> |
| | 35 | | <i class="fa fa-circle fa-fw text-warning fs-9px me-1"></i> Unzureichende Anzahl Plä |
| | 36 | | </div> |
| | 37 | | <div class="d-flex align-items-center me-3"> |
| | 38 | | <i class="fa fa-circle fa-fw text-success fs-9px me-1"></i> In-progress |
| | 39 | | </div> |
| | 40 | | </div> |
| | 41 | | </div> |
| | 42 | | <div> |
| | 43 | | <div class="input-group date mb-0"> |
| | 44 | | <input type="text" class="form-control" placeholder="Suchen" @bind="@searchTerm" @bind:e |
| | 45 | | </div> |
| | 46 | | </div> |
| | 47 | | </div> |
| | 48 | |
|
| | 49 | | <div class="row"> |
| 0 | 50 | | @if (AllDeleations != null && AllDeleations.Count > 0) |
| 0 | 51 | | { |
| 0 | 52 | | @foreach (var delegation in displayDelegation) |
| 0 | 53 | | { |
| 0 | 54 | | <SelectableDelegationComponent IsSelected="@(Application.DelegationWishes.Any(n => n.Del |
| | 55 | | Delegation="delegation" |
| | 56 | | Clicked="DelegationSelected" /> |
| 0 | 57 | | } |
| 0 | 58 | | } |
| | 59 | | else |
| 0 | 60 | | { |
| 0 | 61 | | <div class="alert alert-info">Es wurden keine Delegationen gefunden. Möglicherweise existier |
| 0 | 62 | | } |
| | 63 | |
|
| | 64 | | </div> |
| 0 | 65 | | } |
| | 66 | | else |
| 0 | 67 | | { |
| | 68 | |
|
| 0 | 69 | | @if (!Application.OpenToPublic && pickedDelegations.Any(n => n.Roles.Count > Application.Users.Count |
| 0 | 70 | | { |
| | 71 | | <div class="alert alert-warning"> |
| | 72 | | <h4>Warnung</h4> |
| | 73 | | <p> |
| 0 | 74 | | @string.Join(", ", pickedDelegations.Where(n => n.Roles.Count > Application.Users.Count) |
| | 75 | | Öffentlichkeit freigegeben. Wenn Sie diese Bewerbung freigeben, können andere Interessierte |
| | 76 | | </p> |
| | 77 | | </div> |
| 0 | 78 | | } |
| | 79 | |
|
| 0 | 80 | | @if (AllDeleations.Count < this.maxPickDelegations) |
| 0 | 81 | | { |
| | 82 | | <div class="alert alert-cyan"> |
| 0 | 83 | | Offenbar stehen weniger Delegationen zur Verfügung als eigentlich angegeben werden sollten (@max |
| | 84 | | </div> |
| 0 | 85 | | } |
| | 86 | |
|
| 0 | 87 | | if (pickedDelegations.Count == maxPickDelegations || pickedDelegations.Count == AllDeleations.Count) |
| 0 | 88 | | { |
| | 89 | | <button class="btn btn-primary" @onclick="Finish">Auswahl bestätigen</button> |
| | 90 | |
|
| 0 | 91 | | } |
| 0 | 92 | | } |
| | 93 | |
|
| | 94 | | </div> |
| | 95 | | </div> |
| | 96 | | <!-- END pos-counter-content --> |
| | 97 | | </div> |
| | 98 | | </div> |
| | 99 | |
|
| | 100 | |
|
| | 101 | | @code { |
| 0 | 102 | | [Parameter] public string ConferenceId { get; set; } |
| | 103 | |
|
| 0 | 104 | | [Parameter] public MUNity.Database.Models.Conference.DelegationApplication Application { get; set; } |
| | 105 | |
|
| 0 | 106 | | [Parameter] public EventCallback DelegationsAdded { get; set; } |
| | 107 | |
|
| 0 | 108 | | [Parameter] public bool UseOnlineMode { get; set; } |
| | 109 | |
|
| 0 | 110 | | private List<MUNity.Schema.Conference.ApplicationAvailableDelegation> pickedDelegations = new List<Schema.Conference |
| | 111 | |
|
| | 112 | | private int maxPickDelegations; |
| | 113 | |
|
| | 114 | | private void DelegationSelected(MUNity.Schema.Conference.ApplicationAvailableDelegation delegation) |
| 0 | 115 | | { |
| | 116 | | // |
| | 117 | | //InvokeAsync(StateHasChanged); |
| 0 | 118 | | pickedDelegations.Add(delegation); |
| 0 | 119 | | InvokeAsync(StateHasChanged); |
| 0 | 120 | | } |
| | 121 | |
|
| | 122 | | private void Finish() |
| 0 | 123 | | { |
| 0 | 124 | | foreach(var delegation in pickedDelegations) |
| 0 | 125 | | { |
| | 126 | |
|
| 0 | 127 | | var realDelegation = context.Delegations.Find(delegation.DelegationId); |
| 0 | 128 | | if (realDelegation != null) |
| 0 | 129 | | { |
| 0 | 130 | | this.Application.DelegationWishes.Add(new Database.Models.Conference.DelegationApplicationPickedDelegati |
| 0 | 131 | | { |
| 0 | 132 | | Application = this.Application, |
| 0 | 133 | | Delegation = realDelegation, |
| 0 | 134 | | Priority = (byte)this.Application.DelegationWishes.Count |
| 0 | 135 | | }); |
| 0 | 136 | | } |
| 0 | 137 | | } |
| 0 | 138 | | DelegationsAdded.InvokeAsync(); |
| 0 | 139 | | } |
| | 140 | |
|
| | 141 | | private List<MUNity.Schema.Conference.ApplicationAvailableDelegation> AllDeleations; |
| | 142 | |
|
| 0 | 143 | | private string searchTerm = ""; |
| | 144 | |
|
| | 145 | | private IEnumerable<MUNity.Schema.Conference.ApplicationAvailableDelegation> displayDelegation |
| | 146 | | { |
| | 147 | | get |
| 0 | 148 | | { |
| 0 | 149 | | if (AllDeleations == null) return null; |
| 0 | 150 | | var termLowered = searchTerm.ToLower(); |
| 0 | 151 | | var dels = searchTerm.Length > 2 ? AllDeleations.Where(n => n.Name.ToLower().Contains(termLowered)) : AllDel |
| 0 | 152 | | return dels.Except(pickedDelegations).OrderBy(n => n.Roles.Count).ThenBy(n => n.Name); |
| 0 | 153 | | } |
| | 154 | | } |
| | 155 | |
|
| | 156 | | protected override void OnInitialized() |
| 0 | 157 | | { |
| 0 | 158 | | base.OnInitialized(); |
| 0 | 159 | | if (UseOnlineMode) |
| 0 | 160 | | AllDeleations = applicationService.AvailableDelegations(ConferenceId, Application.Users.Count, Services.Conf |
| | 161 | | else |
| 0 | 162 | | AllDeleations = applicationService.AvailableDelegations(ConferenceId, Application.Users.Count, Services.Conf |
| | 163 | |
|
| 0 | 164 | | maxPickDelegations = context.ConferenceApplicationFormulas.Where(n => n.Options.ConferenceId == this.ConferenceI |
| 0 | 165 | | n.FormulaType == ConferenceApplicationFormulaTypes.Delegation) |
| 0 | 166 | | .Select(n => n.MaxWishes) |
| 0 | 167 | | .FirstOrDefault().Value; |
| 0 | 168 | | } |
| | 169 | | } |