|
206 | 206 | <thead class="table-success"> |
207 | 207 | <tr> |
208 | 208 | <th>Organisation Name</th> |
209 | | - <th>Contact Name</th> |
210 | | - <th>Contact Email</th> |
211 | | - <th>Contact Phone</th> |
212 | | - <th>Contact Address</th> |
| 209 | + <th>Emails</th> |
213 | 210 | <th>Licence Pathway</th> |
214 | 211 | <th>Annual Turnover</th> |
215 | 212 | <th>Application Date</th> |
|
222 | 219 | { |
223 | 220 | <tr> |
224 | 221 | <td>@organisation.Name</td> |
225 | | - <td>@organisation.ContactName</td> |
226 | | - <td>@organisation.ContactEmail</td> |
227 | | - <td>@organisation.ContactPhone</td> |
228 | | - <td>@organisation.ContactAddress</td> |
| 222 | + <td>@string.Join(",", organisation.Emails )</td> |
229 | 223 | <td>@organisation.LicencePathway.GetDescription()</td> |
230 | 224 | <td>@organisation.AnnualTurnover.GetDescription()</td> |
231 | 225 | <td>@organisation.DateCreated.ToShortDateString()</td> |
|
250 | 244 | <div class="member-org-panel h-100"> |
251 | 245 | <h3>Add New Member Organisation</h3> |
252 | 246 | <EditForm Model="MemberOrganisation" OnValidSubmit="HandleNewMemberOrganisationSubmit"> |
253 | | - <DataAnnotationsValidator /> |
254 | | - <ValidationSummary /> |
255 | 247 | <label for="organisationName" class="form-label">Organisation Name</label> |
256 | 248 | <InputText id="organisationName" class="form-control" @bind-Value="MemberOrganisation.Name" |
257 | 249 | placeholder="Enter organisation name e.g. CSIRO" /> |
258 | | - <InputText id="contactName" class="form-control mt-2" @bind-Value="MemberOrganisation.ContactName" |
259 | | - placeholder="Enter contact name e.g. John Doe" /> |
260 | | - <InputText id="contactEmail" class="form-control mt-2" @bind-Value="MemberOrganisation.ContactEmail" |
261 | | - placeholder="Enter contact email e.g. john.doe@example.com" /> |
262 | | - <InputText id="contactPhone" class="form-control mt-2" @bind-Value="MemberOrganisation.ContactPhone" |
263 | | - placeholder="Enter contact phone e.g. +61 123 456 789" /> |
264 | | - <InputText id="contactAddress" class="form-control mt-2" @bind-Value="MemberOrganisation.ContactAddress" |
265 | | - placeholder="Enter contact address e.g. 123 Main St, City, Country" /> |
266 | 250 | <InputSelect id="licencePathway" class="form-select mt-2" @bind-Value="MemberOrganisation.LicencePathway"> |
267 | | - <option value="@LicencePathway.APSIMInitiativeMember" selected>@LicencePathway.APSIMInitiativeMember.GetDescription()</option> |
| 251 | + @foreach (var licencePathway in Enum.GetValues<LicencePathway>()) |
| 252 | + { |
| 253 | + <option value="@licencePathway">@licencePathway.GetDescription()</option> |
| 254 | + } |
268 | 255 | </InputSelect> |
269 | 256 | <InputSelect id="annualTurnover" class="form-select mt-2" @bind-Value="MemberOrganisation.AnnualTurnover"> |
270 | 257 | <option value="@AnnualTurnover.BelowTwoMillion" selected>@AnnualTurnover.BelowTwoMillion.GetDescription()</option> |
| 258 | + @foreach (var annualTurnover in Enum.GetValues<AnnualTurnover>()) |
| 259 | + { |
| 260 | + <option value="@annualTurnover">@annualTurnover.GetDescription()</option> |
| 261 | + } |
271 | 262 | </InputSelect> |
272 | 263 | <InputSelect id="licenceStatus" class="form-select mt-2" @bind-Value="MemberOrganisation.LicenceStatus"> |
273 | 264 | <option value="@OrganisationLicenceStatus.Active" selected>@OrganisationLicenceStatus.Active.GetDescription()</option> |
| 265 | + @foreach (var licenceStatus in Enum.GetValues<OrganisationLicenceStatus>()) |
| 266 | + { |
| 267 | + <option value="@licenceStatus">@licenceStatus.GetDescription()</option> |
| 268 | + } |
274 | 269 | </InputSelect> |
275 | 270 | <button type="submit" class="btn btn-success rounded-pill pill-button mt-4">Add Member Organisation</button> |
276 | 271 | </EditForm> |
|
325 | 320 | @if (SpecialOrganisation is not null) |
326 | 321 | { |
327 | 322 | <EditForm Model="SpecialOrganisation" OnValidSubmit="HandleSpecialOrganisationSubmit" class="mt-4"> |
328 | | - <DataAnnotationsValidator /> |
329 | | - <ValidationSummary /> |
330 | | - |
331 | 323 | <label for="specialOrganisationName" class="form-label">Organisation Name</label> |
332 | 324 | <InputText id="specialOrganisationName" class="form-control" @bind-Value="SpecialOrganisation.Name" placeholder="Organisation name" /> |
333 | 325 |
|
334 | | - <label for="specialContactName" class="form-label mt-2">Contact Name</label> |
335 | | - <InputText id="specialContactName" class="form-control" @bind-Value="SpecialOrganisation.ContactName" placeholder="Contact name" /> |
336 | | - <label for="specialContactEmail" class="form-label mt-2">Contact Email</label> |
337 | | - <InputText id="specialContactEmail" class="form-control" @bind-Value="SpecialOrganisation.ContactEmail" placeholder="Contact email" /> |
338 | | - <label for="specialContactPhone" class="form-label mt-2">Contact Phone</label> |
339 | | - <InputText id="specialContactPhone" class="form-control" @bind-Value="SpecialOrganisation.ContactPhone" placeholder="Contact phone" /> |
340 | | - <label for="specialContactAddress" class="form-label mt-2">Contact Address</label> |
341 | | - <InputText id="specialContactAddress" class="form-control" @bind-Value="SpecialOrganisation.ContactAddress" placeholder="Contact address" /> |
342 | | - |
343 | 326 | <label for="specialOrganisationEmails" class="form-label mt-3">Organisation Emails/Domains</label> |
344 | 327 | <InputTextArea id="specialOrganisationEmails" class="form-control" rows="3" @bind-Value="specialOrganisationEmailsText" /> |
345 | 328 | <div class="form-text">Use comma, semicolon, or newline separators (example: *@@domain.org).</div> |
|
507 | 490 | LicenceStatus = OrganisationLicenceStatus.Active |
508 | 491 | }; |
509 | 492 | ShowModal("Success", "Member organisation added successfully."); |
510 | | - await LoadAdminDataAsync(); |
| 493 | + await RefreshUsersAndOrganisationsAsync(); |
511 | 494 | } |
512 | 495 | else |
513 | 496 | { |
|
534 | 517 | try |
535 | 518 | { |
536 | 519 | Logger.LogInformation("Admin page authenticated. Fetching registrations and member organisations."); |
537 | | - users = await WebApiUtility.GetUsersAsync(); |
538 | | - organisations = await WebApiUtility.GetOrganisationsAsync(); |
| 520 | + await RefreshUsersAndOrganisationsAsync(); |
539 | 521 | await LoadDownloadMetricsAsync(); |
540 | | - |
541 | | - if (!string.IsNullOrWhiteSpace(selectedSpecialOrganisationId)) |
542 | | - { |
543 | | - var selected = organisations.FirstOrDefault(o => o.Id.ToString() == selectedSpecialOrganisationId); |
544 | | - SpecialOrganisation = selected is null ? null : CloneOrganisation(selected); |
545 | | - if (selected is null) |
546 | | - { |
547 | | - selectedSpecialOrganisationId = string.Empty; |
548 | | - specialOrganisationEmailsText = string.Empty; |
549 | | - } |
550 | | - else |
551 | | - { |
552 | | - specialOrganisationEmailsText = string.Join(Environment.NewLine, SpecialOrganisation!.Emails); |
553 | | - } |
554 | | - } |
555 | 522 | } |
556 | 523 | catch (Exception ex) |
557 | 524 | { |
|
560 | 527 | } |
561 | 528 | } |
562 | 529 |
|
| 530 | + private async Task RefreshUsersAndOrganisationsAsync() |
| 531 | + { |
| 532 | + users = await WebApiUtility.GetUsersAsync(); |
| 533 | + organisations = await WebApiUtility.GetOrganisationsAsync(); |
| 534 | + |
| 535 | + if (!string.IsNullOrWhiteSpace(selectedSpecialOrganisationId)) |
| 536 | + { |
| 537 | + var selected = organisations.FirstOrDefault(o => o.Id.ToString() == selectedSpecialOrganisationId); |
| 538 | + SpecialOrganisation = selected is null ? null : CloneOrganisation(selected); |
| 539 | + if (selected is null) |
| 540 | + { |
| 541 | + selectedSpecialOrganisationId = string.Empty; |
| 542 | + specialOrganisationEmailsText = string.Empty; |
| 543 | + } |
| 544 | + else |
| 545 | + { |
| 546 | + specialOrganisationEmailsText = string.Join(Environment.NewLine, SpecialOrganisation!.Emails); |
| 547 | + } |
| 548 | + } |
| 549 | + |
| 550 | + await InvokeAsync(StateHasChanged); |
| 551 | + } |
| 552 | + |
563 | 553 | private async Task LoadDownloadMetricsAsync() |
564 | 554 | { |
565 | 555 | isDownloadMetricsLoading = true; |
|
740 | 730 | if (response.IsSuccessStatusCode) |
741 | 731 | { |
742 | 732 | ShowModal("Success", $"Organisation '{SpecialOrganisation.Name}' updated successfully."); |
743 | | - await LoadAdminDataAsync(); |
| 733 | + await RefreshUsersAndOrganisationsAsync(); |
744 | 734 | return; |
745 | 735 | } |
746 | 736 |
|
|
754 | 744 | if (response.IsSuccessStatusCode) |
755 | 745 | { |
756 | 746 | ShowModal("Success", $"User '{user.Email}' deleted successfully."); |
757 | | - await LoadAdminDataAsync(); |
| 747 | + await RefreshUsersAndOrganisationsAsync(); |
758 | 748 | return; |
759 | 749 | } |
760 | 750 |
|
|
0 commit comments