Bearbeiten der Maschine weitergebaut

This commit is contained in:
BuildTools 2024-02-05 19:16:51 +01:00
parent 5aae28d7ab
commit 4b779dabbe
3 changed files with 77 additions and 2 deletions

Binary file not shown.

View File

@ -1,4 +1,5 @@
@page "/"
@page "/cocktails"
@using CocktailWeb.Data
@using Microsoft.AspNetCore.Components.Sections
@using Microsoft.EntityFrameworkCore

View File

@ -2,12 +2,86 @@
@using Microsoft.EntityFrameworkCore
@using CocktailWeb.Data
@using Microsoft.AspNetCore.Components.Sections
@inject IDbContextFactory<DbDataContext> FlascheDataContextFactory;
<PageTitle>Maschine</PageTitle>
@inject IDbContextFactory<DbDataContext> DataContextFactory;
<PageTitle>Maschineneinstellungen</PageTitle>
<SectionContent SectionId="TopRow.Title">
<label>Einstellungen - Maschine</label>
</SectionContent>
<div class="container">
<h4>Ausgießer</h4>
<div class="row pb-2 gap-2" style="height:45vh">
@foreach (Filler f in Fillers.Where(f => f.Type == Filler.FillerType.Pourer))
{
<a class="col border border-1 rounded-2 text-decoration-none text-light" href="#" data-bs-toggle="modal" data-bs-target="#examplemodal">
@f.Pos - @f.Flasche?.Name
</a>
}
</div>
<h4>Pumpen</h4>
<div class="row gap-2" style="height:25vh">
@foreach (Filler f in Fillers.Where(f => f.Type == Filler.FillerType.Pump))
{
<a class="col border border-1 rounded-2 text-decoration-none text-light" href="#" data-bs-toggle="modal" data-bs-target="#examplemodal">
@f.Pos - @f.Flasche?.Name
</a>
}
</div>
</div>
<div class="modal fade" id="examplemodal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
Testdialog
</div>
<div class="modal-body">
<ul class="list-group">
@if (Flaschen.Count == 0)
{
<li class="list-group-item list-group-item-action align-middle">
Es wurden noch keine Zutaten angelegt
</li>
}
else
{
@foreach (Flasche fl in Flaschen)
{
<li class="list-group-item list-group-item-action align-middle">
<label class="form-check-label stretched-link">@fl.Name</label>
</li>
}
}
</ul>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
<button type="button" class="btn btn-primary">Speichern</button>
</div>
</div>
</div>
</div>
@code {
private DbDataContext? _DataContext;
private List<Filler> Fillers { get; set; } = new();
private List<Flasche> Flaschen { get; set; } = new();
protected override async Task OnInitializedAsync()
{
await ShowFillers();
}
private async Task ShowFillers()
{
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
if (_DataContext != null)
{
Fillers = await _DataContext.Fillers.Include(f => f.Flasche).OrderBy(f => f.Pos).ToListAsync();
Flaschen = await _DataContext.Flaschen.OrderBy(fl => fl.Name).ToListAsync();
}
}
}