Overflow/Overflow.Web/Components/Pages/SpillsCalendarPage.razor

40 lines
1.4 KiB
Plaintext

@page "/spills-cal"
@using MongoDB.Driver
@using Overflow.SouthernWater
@rendermode RenderMode.InteractiveServer
<PageTitle>Southern Water Spills</PageTitle>
<h1>Spills</h1>
<p>This shows the data that you can see on the Southern Water Beachbuoy system</p>
<RadzenCard class="my-4">
<RadzenStack Orientation="Orientation.Vertical" AlignItems="AlignItems.Start" Wrap="FlexWrap.Wrap">
@if (job is not null)
{
<RadzenText TextStyle="TextStyle.Body1">Last updated at <b>@job.EndTime</b></RadzenText>
}
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Start" Wrap="FlexWrap.Wrap">
<RadzenCheckBox @bind-Value=@genuineOnly Name="genuineOnly" />
<RadzenLabel Text="Genuine Events Only" Component="genuineOnly" Style="margin-left: 8px; vertical-align: middle;" />
</RadzenStack>
</RadzenStack>
</RadzenCard>
<SpillsCalendar Job="@job" GenuineOnly="@genuineOnly" />
@code {
private SouthernWaterApiJob? job;
[Inject] private IMongoDatabase database { get; set; }
// private bool showIds;
private bool genuineOnly = true;
protected override async Task OnInitializedAsync()
{
job = database.GetCollection<SouthernWaterApiJob>(Static.CollectionName)
.AsQueryable()
.OrderByDescending(j => j.EndTime)
.FirstOrDefault();
}
}