Compare commits

...

3 Commits

Author SHA1 Message Date
BuildTools
4b779dabbe Bearbeiten der Maschine weitergebaut 2024-02-05 19:16:51 +01:00
BuildTools
5aae28d7ab Theme auf Darkmode angepasst 2024-02-05 19:16:27 +01:00
BuildTools
60a27f08b2 Fehler beim Bearbeiten von Cocktails behoben 2024-02-05 19:15:24 +01:00
10 changed files with 106 additions and 14 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

@ -27,7 +27,7 @@
</div>
<h5>Cocktail-Zutaten</h5>
<table class="table align-middle">
<table class="table table-dark align-middle">
<tbody>
@if (EditCocktail.Cocktailflaschen.Count == 0)
{

View File

@ -24,7 +24,7 @@ namespace CocktailWeb.Pages.Settings
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
if (_DataContext != null)
{
EditCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == Convert.ToInt32(id));
EditCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == Convert.ToInt32(id));
}
}
// Falls keine ID angegeben wurde oder der Cocktail in der Datenbank nicht gefunden wurde, gehen wir davon aus dass ein neuer Cocktail erstellt wird.
@ -34,7 +34,7 @@ namespace CocktailWeb.Pages.Settings
}
await FillFlaschenListe();
await InvokeAsync(StateHasChanged);
await InvokeAsync(StateHasChanged);
}
public async Task FillFlaschenListe()
@ -89,7 +89,14 @@ namespace CocktailWeb.Pages.Settings
if (EditCocktail != null && _DataContext != null)
{
_DataContext.Cocktails.Add(EditCocktail);
if (id != null)
{
_DataContext.Cocktails.Update(EditCocktail);
}
else
{
_DataContext.Cocktails.Add(EditCocktail);
}
await _DataContext.SaveChangesAsync();
if (CocktaiLBildDatei != null)

View File

@ -14,7 +14,7 @@
<a class="btn btn-primary mb-3" href="/settings/cocktails/edit">Cocktail hinzufügen</a>
<div class="table-responsive">
<table class="table table-striped table-hover table-bordered table-light border-dark">
<table class="table table-striped table-hover table-bordered table-dark border-dark">
<tbody>
@foreach (Cocktail c in CocktailListe)
{

View File

@ -38,7 +38,7 @@ else
@if (FlaschenListe != null && FlaschenListe.Count > 0)
{
<div class="table-responsive">
<table class="table table-striped table-hover table-bordered table-light border-dark">
<table class="table table-striped table-hover table-bordered table-dark border-dark">
<thead>
<tr>
<!--<th scope="col">ID</th>-->

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();
}
}
}

View File

@ -9,7 +9,7 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.dark.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="CocktailWeb.styles.css" rel="stylesheet" />
<link rel="icon" type="image/png" href="favicon.png"/>

View File

@ -1,16 +1,14 @@
@using Microsoft.AspNetCore.Components.Sections
<div class="d-flex fixed-top justify-content-between px-4" style="background-color: #f7f7f7; border-bottom: 1px solid #d6d5d5; height: 56px; align-items: center; top: 0; z-index: 1;">
<div class="d-flex gap-3">
<div class="d-flex align-items-center fixed-top justify-content-between px-4 bg-dark border-primary-subtle" style="border-bottom: 1px solid #d6d5d5; height: 56px; align-items: center; top: 0; z-index: 1;">
<div class="d-flex gap-3 align-items-center">
<a class="btn btn-primary" href="/">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" class="bi bi-house" viewBox="0 0 16 16">
<path d="M8.707 1.5a1 1 0 0 0-1.414 0L.646 8.146a.5.5 0 0 0 .708.708L2 8.207V13.5A1.5 1.5 0 0 0 3.5 15h9a1.5 1.5 0 0 0 1.5-1.5V8.207l.646.647a.5.5 0 0 0 .708-.708L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293zM13 7.207V13.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V7.207l5-5z" />
</svg>
</a>
<h3>
<SectionOutlet SectionId="Title" />
</h3>
<SectionOutlet SectionId="Title" />
</div>
<div class="dropdown show">

File diff suppressed because one or more lines are too long