Skip to content

Commit

Permalink
Show dates in sender time table
Browse files Browse the repository at this point in the history
  • Loading branch information
markusrt committed Jun 23, 2024
1 parent c5c7b46 commit 3763fe4
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 51 deletions.
2 changes: 2 additions & 0 deletions NRZMyk.Component.Playground/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton<IAccountService, MockAccountService>();
services.AddSingleton<IClinicalBreakpointService, MockClinicalBreakpointService>();
services.AddSingleton<IMicStepsService, MicStepsService>();
services.AddSingleton<IEmailNotificationService, MockEmailNotificationService>();
services.AddSingleton<IReminderService, ReminderService>();

services.AddScoped<AuthenticationStateProvider, MockAuthStateProvider>();
services.AddScoped<SignOutSessionStateManager>();
Expand Down
105 changes: 61 additions & 44 deletions NRZMyk.Components/Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
@page "/"
@using NRZMyk.Services.Models
@using NRZMyk.Services.Utils
@using Humanizer

@inherits IndexBase

<p>
Das vom Robert Koch-Institut und dem Bundesministerium für Gesundheit berufene
<strong>Nationale Referenzzentrum für Invasive Pilzinfektionen (NRZMyk)</strong> ist
Ansprechpartner für Ärzte und Mikrobiologen aus ganz Deutschland bei Fragen
zur Diagnostik und Behandlung invasiver Pilzinfektionen. Neben einer gezielten
Beratung bietet das NRZMyk auch spezielle diagnostische Verfahren zum Nachweis
von invasiven Pilzerkrankungen an. Es kooperiert dabei mit anderen Referenzlabors weltweit.
</p>
@if (Organizations == null)
{
<p><em>Lädt...</em></p>
}
else
{
<p>
Das vom Robert Koch-Institut und dem Bundesministerium für Gesundheit berufene
<strong>Nationale Referenzzentrum für Invasive Pilzinfektionen (NRZMyk)</strong> ist
Ansprechpartner für Ärzte und Mikrobiologen aus ganz Deutschland bei Fragen
zur Diagnostik und Behandlung invasiver Pilzinfektionen. Neben einer gezielten
Beratung bietet das NRZMyk auch spezielle diagnostische Verfahren zum Nachweis
von invasiven Pilzerkrankungen an. Es kooperiert dabei mit anderen Referenzlabors weltweit.
</p>

<p>
Das NRZMyk ist angesiedelt am
<a href="http://www.leibniz-hki.de" rel="noopener" target="_blank">Leibniz-Institut für Naturstoff-Forschung und
Infektionsbiologie - Hans-Knöll-Institut (HKI)</a>
in Jena. Einige Untersuchungen werden am
<a href="https://www.hygiene.uni-wuerzburg.de/startseite/" rel="noopener" target="_blank">Institut für Hygiene und
Mikrobiologie</a>
der Universität Würzburg (Lehrstuhl für Medizinische Mikrobiologie &amp; Mykologie, Prof. Kurzai) durchgeführt.
</p>
<p>
Das NRZMyk ist angesiedelt am
<a href="http://www.leibniz-hki.de" rel="noopener" target="_blank">Leibniz-Institut für Naturstoff-Forschung und
Infektionsbiologie - Hans-Knöll-Institut (HKI)</a>
in Jena. Einige Untersuchungen werden am
<a href="https://www.hygiene.uni-wuerzburg.de/startseite/" rel="noopener" target="_blank">Institut für Hygiene und
Mikrobiologie</a>
der Universität Würzburg (Lehrstuhl für Medizinische Mikrobiologie &amp; Mykologie, Prof. Kurzai) durchgeführt.
</p>

<AuthorizeView Roles="@nameof(Role.Guest)">
<Authorized>
<div class="alert alert-warning mr-5 ml-5" role="alert">
<span class="oi oi-lock-locked mr-2" aria-hidden="true"></span>
<strong>Eingeschränkter Gastzugang!</strong>
<p>
Sie sind als <string>Gast</string> mit dem Benutzernamen <i>@context.User.Identity.Name</i> angemeldet.
Bitte <a
href="mailto:[email protected]?subject=Sentinel Netzwerk: Freischaltung des Accounts [@context.User.Identity.Name]">kontaktieren
Sie das koordinierende Labor</a>
um ihren Account für die Datenerfassung freizuschalten
</p>
</div>
</Authorized>
</AuthorizeView>
<AuthorizeView Roles="@nameof(Role.Guest)">
<Authorized>
<div class="alert alert-warning mr-5 ml-5" role="alert">
<span class="oi oi-lock-locked mr-2" aria-hidden="true"></span>
<strong>Eingeschränkter Gastzugang!</strong>
<p>
Sie sind als <string>Gast</string> mit dem Benutzernamen <i>@context.User.Identity.Name</i> angemeldet.
Bitte
<a
href="mailto:[email protected]?subject=Sentinel Netzwerk: Freischaltung des Accounts [@context.User.Identity.Name]">kontaktieren
Sie das koordinierende Labor</a>
um ihren Account für die Datenerfassung freizuschalten
</p>
</div>
</Authorized>
</AuthorizeView>

<AuthorizeView Roles="@nameof(Role.User)">
<Authorized>
@if (Organizations == null)
{
<p><em>Lädt...</em></p>
}
else
{
<AuthorizeView Roles="@nameof(Role.User)">
<Authorized>
<h2>Feste Monate der Einsendung</h2>
<div class="row">
<div class="col-9">
Expand All @@ -55,6 +57,9 @@
<tr>
<th scope="col">Monat</th>
<th scope="col">Mikrobiologie</th>
<th scope="col">Letzte Datenerfassung</th>
<th scope="col">Letzte Einsendung</th>
<th scope="col">Nächstes Einsendefenster</th>
</tr>
</thead>
<tbody>
Expand All @@ -63,14 +68,26 @@
<tr>
<td>@EnumUtils.GetEnumDescription(organization.DispatchMonth)</td>
<td>@organization.Name</td>
<td>@organization.LatestDataEntryDate.ToString("dd.MM.yyyy")</td>
<td>@organization.LatestStrainArrivalDate.ToString("dd.MM.yyyy")</td>
<td>
@if (ReminderService.CalculateExpectedNextSending(organization) < DateTime.Today)
{
<span class="badge bg-warning">@ReminderService.HumanReadableExpectedNextSending(organization)</span>
}
else
{
<span class="badge bg-success">@ReminderService.HumanReadableExpectedNextSending(organization)</span>
}
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</Authorized>
</AuthorizeView>
</Authorized>
</AuthorizeView>

<SendSamples Title="Probeneinsendung" />
<SendSamples Title="Probeneinsendung"/>
}
12 changes: 8 additions & 4 deletions NRZMyk.Components/Pages/IndexBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,21 @@ public class IndexBase : BlazorComponent
[Inject]
private IAccountService AccountService { get; set; } = default!;

[Inject]
internal IReminderService ReminderService { get; set; } = default!;

[Inject]
private ILogger<IndexBase> Logger { get; set; } = default!;

internal ICollection<Organization> Organizations { get; set; } = default!;
internal ICollection<Organization> Organizations { get; private set; } = new List<Organization>();

internal SaveState SaveState { get; set; }

protected override async Task OnInitializedAsync()
{
Logger.LogInformation("Now loading... /Index");
Organizations = await AccountService.ListOrganizations().ConfigureAwait(true);
if (!Organizations.Any())
{
Organizations = await AccountService.ListOrganizations().ConfigureAwait(true);
}
await base.OnInitializedAsync().ConfigureAwait(true);
}
}
Expand Down
20 changes: 20 additions & 0 deletions NRZMyk.Mocks/MockServices/MockEmailNotificationService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NRZMyk.Services.Services;

namespace NRZMyk.Mocks.MockServices
{
public class MockEmailNotificationService : IEmailNotificationService
{
public Task NotifyNewUserRegistered(string userName, string userEmail, string userCity)
{
return Task.CompletedTask;
}

public void SendEmail(string email, string message)
{
}
}
}
7 changes: 6 additions & 1 deletion NRZMyk.Services/Services/IReminderService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
namespace NRZMyk.Services.Services;
using NRZMyk.Services.Data.Entities;
using System;

namespace NRZMyk.Services.Services;

public interface IReminderService
{
public string HumanReadableExpectedNextSending(Organization organization);
public DateTime CalculateExpectedNextSending(Organization organization);
}
3 changes: 1 addition & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"sdk": {
"version": "6.0.100",
"rollForward": "latestMajor"
"version": "6.0.100"
}
}

0 comments on commit 3763fe4

Please sign in to comment.