| | | 1 | | @inject MUNity.Database.Context.MunityContext context |
| | | 2 | | |
| | | 3 | | @page "/conference/application/review/{ApplicationId:int}" |
| | | 4 | | |
| | 0 | 5 | | @if (Application != null && isAllowedAccess.Value) |
| | 0 | 6 | | { |
| | | 7 | | <div class="invoice"> |
| | | 8 | | <!-- BEGIN invoice-company --> |
| | | 9 | | <div class="invoice-company"> |
| | | 10 | | <span class="float-end hidden-print"> |
| | 0 | 11 | | @if (Application.DelegationApplicationId == 0) |
| | 0 | 12 | | { |
| | | 13 | | |
| | 0 | 14 | | } |
| | 0 | 15 | | @if (Application.Status == MUNity.Base.ApplicationStatuses.Writing && IsApproved) |
| | 0 | 16 | | { |
| | 0 | 17 | | <button class="btn btn-outline-success mb-10px" @onclick="() => FinishApplication()"> |
| | | 18 | | <i class="fa fa-arrow-right t-plus-1 text-success fa-fw fa-lg"></i> Einreichen |
| | | 19 | | </button> |
| | 0 | 20 | | } |
| | 0 | 21 | | else if (Application.Status == MUNity.Base.ApplicationStatuses.Writing && !IsApproved) |
| | 0 | 22 | | { |
| | 0 | 23 | | <button class="btn btn-outline-info mb-10px" @onclick="() => SaveApplication()"> |
| | | 24 | | <i class="fa fa-save t-plus-1 fa-fw fa-lg"></i> Speichern |
| | | 25 | | </button> |
| | 0 | 26 | | } |
| | | 27 | | |
| | | 28 | | @*<a href="javascript:;" class="btn btn-sm btn-white mb-10px"><i class="fa fa-file-pdf t-plus-1 text-dan |
| | | 29 | | <a href="javascript:;" onclick="window.print()" class="btn btn-sm btn-white mb-10px"><i class="fa fa |
| | | 30 | | </span> |
| | | 31 | | Teilnahmebewerbung |
| | | 32 | | </div> |
| | | 33 | | <!-- END invoice-company --> |
| | | 34 | | <!-- BEGIN invoice-header --> |
| | | 35 | | <div class="invoice-header"> |
| | | 36 | | <div class="invoice-from"> |
| | | 37 | | <small>Von:</small> |
| | | 38 | | <address class="mt-5px mb-5px"> |
| | | 39 | | <strong class="text-inverse">BewerberInnen</strong><br> |
| | 0 | 40 | | @foreach (var user in this.Application.Users) |
| | 0 | 41 | | { |
| | 0 | 42 | | <span>@user.User.Forename @user.User.Lastname (@@@user.User.UserName)</span><br> |
| | 0 | 43 | | } |
| | | 44 | | </address> |
| | | 45 | | |
| | | 46 | | </div> |
| | | 47 | | |
| | | 48 | | <div class="invoice-to"> |
| | | 49 | | <small>Für</small> |
| | 0 | 50 | | @if (conference != null) |
| | 0 | 51 | | { |
| | | 52 | | <address class="mt-5px mb-5px"> |
| | 0 | 53 | | <strong class="text-inverse">@conference.ConferenceShort</strong><br> |
| | 0 | 54 | | @conference.FullName<br> |
| | 0 | 55 | | @if (conference.StartDate != null && conference.EndDate != null) |
| | 0 | 56 | | { |
| | 0 | 57 | | <span>@conference.StartDate.Value.ToShortDateString() - @conference.EndDate.Value.ToShortDat |
| | 0 | 58 | | }<br> |
| | | 59 | | </address> |
| | 0 | 60 | | } |
| | | 61 | | </div> |
| | | 62 | | |
| | | 63 | | <div class="invoice-date"> |
| | | 64 | | <small>Bewerbungsinfo</small> |
| | 0 | 65 | | <div class="date text-inverse mt-5px">@Application.ApplyDate.ToString("dd MMMM yyyy")</div> |
| | | 66 | | <div class="invoice-detail"> |
| | 0 | 67 | | #@Application.DelegationApplicationId<br> |
| | | 68 | | Delegationsbewerbung |
| | | 69 | | </div> |
| | | 70 | | </div> |
| | | 71 | | </div> |
| | | 72 | | <!-- END invoice-header --> |
| | | 73 | | <!-- BEGIN invoice-content --> |
| | | 74 | | <div class="invoice-content"> |
| | | 75 | | <!-- BEGIN table-responsive --> |
| | | 76 | | <div class="table-responsive"> |
| | | 77 | | <table class="table table-invoice"> |
| | | 78 | | <thead> |
| | | 79 | | <tr> |
| | | 80 | | <th width="5%">#</th> |
| | | 81 | | <th>Delegationen</th> |
| | | 82 | | </tr> |
| | | 83 | | </thead> |
| | | 84 | | <tbody> |
| | 0 | 85 | | @foreach (var delegationWish in Application.DelegationWishes) |
| | 0 | 86 | | { |
| | | 87 | | <tr> |
| | 0 | 88 | | <td>#@Application.DelegationWishes.ToList().IndexOf(delegationWish)</td> |
| | | 89 | | <td> |
| | 0 | 90 | | <span class="text-inverse">@delegationWish.Delegation.Name</span><br> |
| | | 91 | | </td> |
| | | 92 | | </tr> |
| | 0 | 93 | | } |
| | | 94 | | |
| | | 95 | | </tbody> |
| | | 96 | | </table> |
| | | 97 | | </div> |
| | | 98 | | <!-- END table-responsive --> |
| | | 99 | | <!-- BEGIN invoice-price --> |
| | | 100 | | <div class="invoice-price"> |
| | | 101 | | <div class="invoice-price-left"> |
| | | 102 | | <div class="invoice-price-row"> |
| | | 103 | | <div class="sub-price"> |
| | | 104 | | <small>Erfüllt Delegationsgröße</small> |
| | | 105 | | <span class="@((sizeIsCorrect) ? "text-success" : "text-danger")"><i class="fa @((sizeIsCorr |
| | | 106 | | </div> |
| | 0 | 107 | | @if (!sizeIsCorrect) |
| | 0 | 108 | | { |
| | | 109 | | <div class="sub-price"> |
| | | 110 | | <i class="fa fa-plus text-muted"></i> |
| | | 111 | | </div> |
| | | 112 | | <div class="sub-price"> |
| | | 113 | | <small>Öffentlich</small> |
| | | 114 | | <span class="@((Application.OpenToPublic) ? "text-success" : "text-danger")"><i class="f |
| | | 115 | | </div> |
| | 0 | 116 | | } |
| | | 117 | | |
| | | 118 | | </div> |
| | | 119 | | </div> |
| | 0 | 120 | | @if (IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Pending) |
| | 0 | 121 | | { |
| | | 122 | | <div class="invoice-price-right bg-success"> |
| | | 123 | | <small>Status</small> |
| | | 124 | | <span class="fw-bold">Gültig (eingereicht)</span> |
| | | 125 | | </div> |
| | 0 | 126 | | } |
| | 0 | 127 | | else if (IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Writing) |
| | 0 | 128 | | { |
| | | 129 | | <div class="invoice-price-right bg-warning"> |
| | | 130 | | <small>Status</small> |
| | | 131 | | <span class="fw-bold">Gültig (nicht eingereicht)</span> |
| | | 132 | | </div> |
| | 0 | 133 | | } |
| | 0 | 134 | | else if (!IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Pending) |
| | 0 | 135 | | { |
| | | 136 | | <div class="invoice-price-right bg-danger"> |
| | | 137 | | <small>Status</small> |
| | | 138 | | <span class="fw-bold">nicht gültig (eingereicht)</span> |
| | | 139 | | </div> |
| | 0 | 140 | | } |
| | 0 | 141 | | else if (!IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Writing) |
| | 0 | 142 | | { |
| | | 143 | | <div class="invoice-price-right bg-danger"> |
| | | 144 | | <small>Status</small> |
| | | 145 | | <span class="fw-bold">nicht gültig (nicht eingereicht)</span> |
| | | 146 | | </div> |
| | 0 | 147 | | } |
| | 0 | 148 | | else if (IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Saved) |
| | 0 | 149 | | { |
| | | 150 | | <div class="invoice-price-right bg-info"> |
| | | 151 | | <small>Status</small> |
| | | 152 | | <span class="fw-bold">Gültig (gespeichert)</span> |
| | | 153 | | </div> |
| | 0 | 154 | | } |
| | 0 | 155 | | else if (!IsApproved && Application.Status == MUNity.Base.ApplicationStatuses.Saved) |
| | 0 | 156 | | { |
| | | 157 | | <div class="invoice-price-right bg-warning"> |
| | | 158 | | <small>Status</small> |
| | | 159 | | <span class="fw-bold">nicht gültig (gespeichert)</span> |
| | | 160 | | </div> |
| | 0 | 161 | | } |
| | | 162 | | |
| | | 163 | | </div> |
| | | 164 | | <!-- END invoice-price --> |
| | | 165 | | </div> |
| | | 166 | | |
| | 0 | 167 | | @if (Application.DelegationApplicationId == 0) |
| | 0 | 168 | | { |
| | | 169 | | <div class="invoice-note"> |
| | | 170 | | <div class="alert alert-warning"> |
| | | 171 | | Die Bewerbung wurde noch nicht gespeichert/eingereicht. Gehen Sie oben auf Speichern/Einreichen um d |
| | | 172 | | </div> |
| | | 173 | | </div> |
| | 0 | 174 | | } |
| | | 175 | | |
| | | 176 | | |
| | | 177 | | <div class="invoice-note"> |
| | | 178 | | * Die zu der Bewerbung eingeladenen Benutzer müssen bis zum Ende der Anmeldephase die Bewerbung bestätigen. |
| | | 179 | | * Bei Fragen zu Ihrer Anmeldung können Sie sich jederzeit an unsere Teilnehmendenbetreuung wenden.<br> |
| | | 180 | | * Sie können diese Bewerbung unter dem Menüpunkt ,,Meine Bewerbungen´´ jederzeit zurückziehen oder bearbeite |
| | | 181 | | </div> |
| | | 182 | | |
| | | 183 | | <div class="invoice-footer"> |
| | | 184 | | <p class="text-center mb-5px fw-bold"> |
| | | 185 | | Danke für Ihre Bewerbung |
| | | 186 | | </p> |
| | | 187 | | <p class="text-center"> |
| | | 188 | | <span class="me-10px"><i class="fa fa-fw fa-lg fa-globe"></i> munbw.de</span> |
| | | 189 | | <span class="me-10px"><i class="fa fa-fw fa-lg fa-phone-volume"></i> T:016-18192302</span> |
| | | 190 | | <span class="me-10px"><i class="fa fa-fw fa-lg fa-envelope"></i> teilnehmende@@munbw.de</span> |
| | | 191 | | </p> |
| | | 192 | | </div> |
| | | 193 | | <!-- END invoice-footer --> |
| | | 194 | | </div> |
| | 0 | 195 | | } |
| | 0 | 196 | | else if (!isAllowedAccess.Value) |
| | 0 | 197 | | { |
| | | 198 | | <p>Keine Berechtigung diese Bewerbung zu sehen!</p> |
| | 0 | 199 | | } |
| | | 200 | | else |
| | 0 | 201 | | { |
| | | 202 | | <p>Anmeldung wird geladen.</p> |
| | 0 | 203 | | } |
| | | 204 | | |
| | | 205 | | |
| | | 206 | | |
| | | 207 | | @code { |
| | 0 | 208 | | [Parameter] public MUNity.Database.Models.Conference.DelegationApplication Application { get; set; } |
| | | 209 | | |
| | 0 | 210 | | [Parameter] public string ConferenceId { get; set; } |
| | | 211 | | |
| | 0 | 212 | | [Parameter] public int ApplicationId { get; set; } |
| | | 213 | | |
| | 0 | 214 | | [CascadingParameter] Task<AuthenticationState> AuthStateTask { get; set; } |
| | | 215 | | |
| | | 216 | | private bool? isAllowedAccess; |
| | | 217 | | |
| | | 218 | | private bool IsApproved; |
| | | 219 | | |
| | | 220 | | private bool sizeIsCorrect; |
| | | 221 | | |
| | | 222 | | private MUNity.Database.Models.Conference.Conference conference; |
| | | 223 | | |
| | | 224 | | protected override async Task OnInitializedAsync() |
| | 0 | 225 | | { |
| | 0 | 226 | | await base.OnInitializedAsync(); |
| | | 227 | | |
| | 0 | 228 | | } |
| | | 229 | | |
| | | 230 | | private async Task LoadApplication() |
| | 0 | 231 | | { |
| | | 232 | | |
| | 0 | 233 | | Application = await context.DelegationApplications |
| | 0 | 234 | | .Include(n => n.DelegationWishes) |
| | 0 | 235 | | .ThenInclude(n => n.Delegation) |
| | 0 | 236 | | .Include(n => n.Users) |
| | 0 | 237 | | .ThenInclude(n => n.User) |
| | 0 | 238 | | .FirstOrDefaultAsync(n => n.DelegationApplicationId == ApplicationId); |
| | | 239 | | |
| | | 240 | | |
| | 0 | 241 | | this.sizeIsCorrect = Application.DelegationWishes.All(n => context.Delegates.Count(a => a.Delegation.DelegationI |
| | | 242 | | |
| | 0 | 243 | | this.IsApproved = this.sizeIsCorrect || (this.sizeIsCorrect && Application.OpenToPublic); |
| | | 244 | | |
| | | 245 | | |
| | 0 | 246 | | this.conference = context.Conferences.AsNoTracking().FirstOrDefault(n => n.ConferenceId == ConferenceId); |
| | | 247 | | |
| | 0 | 248 | | } |
| | | 249 | | |
| | | 250 | | protected override async Task OnParametersSetAsync() |
| | 0 | 251 | | { |
| | 0 | 252 | | await base.OnParametersSetAsync(); |
| | 0 | 253 | | var claim = (await AuthStateTask)?.User; |
| | 0 | 254 | | if (claim == null) |
| | 0 | 255 | | { |
| | 0 | 256 | | this.isAllowedAccess = false; |
| | 0 | 257 | | } |
| | | 258 | | else |
| | 0 | 259 | | { |
| | 0 | 260 | | this.isAllowedAccess = await context.DelegationApplicationUserEntries |
| | 0 | 261 | | .AnyAsync(n => n.User.UserName == claim.Identity.Name && n.Application.DelegationApplicationId == Applic |
| | 0 | 262 | | } |
| | | 263 | | |
| | 0 | 264 | | if (this.isAllowedAccess.HasValue && this.isAllowedAccess.Value) |
| | 0 | 265 | | { |
| | 0 | 266 | | await LoadApplication(); |
| | 0 | 267 | | } |
| | 0 | 268 | | } |
| | | 269 | | |
| | | 270 | | private void FinishApplication() |
| | 0 | 271 | | { |
| | 0 | 272 | | if (!this.context.DelegationApplications.Contains(Application)) |
| | 0 | 273 | | { |
| | 0 | 274 | | this.context.DelegationApplications.Add(Application); |
| | | 275 | | |
| | 0 | 276 | | } |
| | 0 | 277 | | Application.Status = MUNity.Base.ApplicationStatuses.Pending; |
| | 0 | 278 | | var recaff = this.context.SaveChanges(); |
| | | 279 | | |
| | 0 | 280 | | } |
| | | 281 | | |
| | | 282 | | private void SaveApplication() |
| | 0 | 283 | | { |
| | 0 | 284 | | if (!this.context.DelegationApplications.Contains(Application)) |
| | 0 | 285 | | { |
| | 0 | 286 | | this.context.DelegationApplications.Add(Application); |
| | 0 | 287 | | } |
| | 0 | 288 | | Application.Status = MUNity.Base.ApplicationStatuses.Saved; |
| | 0 | 289 | | var recaff = this.context.SaveChanges(); |
| | | 290 | | |
| | 0 | 291 | | } |
| | | 292 | | } |