74 lines
2.6 KiB
Plaintext
74 lines
2.6 KiB
Plaintext
@using Microsoft.AspNetCore.Components.Sections
|
|
@using Microsoft.EntityFrameworkCore
|
|
@using CocktailWeb.Data
|
|
@page "/settings/flaschen"
|
|
@inject IDbContextFactory<DbDataContext> FlascheDataContextFactory;
|
|
|
|
<PageTitle>Flaschen</PageTitle>
|
|
|
|
<SectionContent SectionId="TopRow.Title">
|
|
<label>Einstellungen - Zutaten</label>
|
|
</SectionContent>
|
|
|
|
|
|
@if (CreateFormVisible && FlascheToCreate != null)
|
|
{
|
|
<h3>Flasche hinzufügen</h3>
|
|
<div class="row">
|
|
<label for="Name" class="col-4 col-form-label">Name</label>
|
|
<div class="col-8">
|
|
<input id="Name" name="Name" type="text" class="form-control" @bind="@FlascheToCreate.Name" />
|
|
</div>
|
|
</div>
|
|
<div class="form-group row">
|
|
<div class="offset-4 col-8">
|
|
<button name="submit" type="submit" class="btn btn-primary" @onclick="CreateNewFlasche">Hinzufügen</button>
|
|
</div>
|
|
</div>
|
|
}
|
|
else
|
|
{
|
|
|
|
<button name="submit" type="submit" class="btn btn-primary" @onclick="ShowCreateForm">Flasche hinzufügen</button>
|
|
}
|
|
|
|
@if (FlaschenListe != null && FlaschenListe.Count > 0)
|
|
{
|
|
<div class="table-responsive mt-3">
|
|
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Name</th>
|
|
<th style="text-align:right;" scope="col">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var flasche in FlaschenListe)
|
|
{
|
|
@if (EditFormVisible && FlascheToUpdate != null && FlascheToUpdate.Id == flasche.Id)
|
|
{
|
|
<tr>
|
|
<td> <input id="Name" name="Name" type="text" class="form-control" @bind="@FlascheToUpdate.Name" /></td>
|
|
<td><button name="submit" type="submit" class="btn btn-primary" @onclick="() => UpdateEmployee(FlascheToUpdate)">Speichern</button></td>
|
|
</tr>
|
|
}
|
|
else
|
|
{
|
|
<tr>
|
|
<td>@flasche.Name</td>
|
|
<td style="text-align:right;">
|
|
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => ShowEditForm(flasche)">Bearbeiten</button>
|
|
<button name="submit" type="submit" class="btn btn-outline-danger" @onclick="() => DeleteFlasche(flasche)">Löschen</button>
|
|
</td>
|
|
</tr>
|
|
}
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
}
|
|
|
|
@code {
|
|
|
|
}
|