Compare commits
No commits in common. "bdf7cabc0a34e3f3d052288fa41abba791fca77b" and "4b779dabbe312887101a2ee02e02ab1f5306497b" have entirely different histories.
bdf7cabc0a
...
4b779dabbe
@ -11,8 +11,6 @@ namespace CocktailWeb.Data
|
|||||||
public DbSet<Cocktail> Cocktails { get; set; }
|
public DbSet<Cocktail> Cocktails { get; set; }
|
||||||
public DbSet<Filler> Fillers { get; set; }
|
public DbSet<Filler> Fillers { get; set; }
|
||||||
|
|
||||||
public DbSet<Glas> Glaeser { get; set; }
|
|
||||||
|
|
||||||
public DbDataContext(IConfiguration configuration)
|
public DbDataContext(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
_configuration = configuration;
|
_configuration = configuration;
|
||||||
@ -27,8 +25,8 @@ namespace CocktailWeb.Data
|
|||||||
{
|
{
|
||||||
modelBuilder.Entity<Flasche>().ToTable("Flaschen");
|
modelBuilder.Entity<Flasche>().ToTable("Flaschen");
|
||||||
modelBuilder.Entity<Flasche>().HasData(
|
modelBuilder.Entity<Flasche>().HasData(
|
||||||
new Flasche("Jägermeister") { Id = 1, Alkoholisch = true },
|
new Flasche("Jägermeister") { Id = 1 },
|
||||||
new Flasche("Wodka") { Id = 2, Alkoholisch = true }
|
new Flasche("Wodka") { Id = 2 }
|
||||||
);
|
);
|
||||||
|
|
||||||
modelBuilder.Entity<Filler>().HasData(
|
modelBuilder.Entity<Filler>().HasData(
|
||||||
@ -48,8 +46,6 @@ namespace CocktailWeb.Data
|
|||||||
new Filler() { Id = 14, Pos = 14, Type = Filler.FillerType.Pump }
|
new Filler() { Id = 14, Pos = 14, Type = Filler.FillerType.Pump }
|
||||||
);
|
);
|
||||||
|
|
||||||
modelBuilder.Entity<Glas>().ToTable("Glaeser");
|
|
||||||
|
|
||||||
// modelBuilder.Entity<Cocktail>().HasMany(c => c.CocktailFlaschen).WithOne(c => c.Cocktail).HasForeignKey(c => c.CocktailID);
|
// modelBuilder.Entity<Cocktail>().HasMany(c => c.CocktailFlaschen).WithOne(c => c.Cocktail).HasForeignKey(c => c.CocktailID);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; } = "";
|
||||||
public bool Alkoholisch { get; set; }
|
|
||||||
public string? ImageURL { get; set; }
|
|
||||||
|
|
||||||
public Flasche()
|
public Flasche()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,15 +0,0 @@
|
|||||||
namespace CocktailWeb.Data
|
|
||||||
{
|
|
||||||
public class Glas
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string Name { get
|
|
||||||
{
|
|
||||||
return $"{Fuellmenge} ml";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public int Fuellmenge { get; set; }
|
|
||||||
public string? ImageURL { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@ -1,263 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using CocktailWeb.Data;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace CocktailWeb.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(DbDataContext))]
|
|
||||||
[Migration("20240207180034_ModifyFlascheAddGlas")]
|
|
||||||
partial class ModifyFlascheAddGlas
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ImageURL")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Cocktails");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("CocktailID")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("FlascheID")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Menge")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Reihenfolge")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CocktailID");
|
|
||||||
|
|
||||||
b.HasIndex("FlascheID");
|
|
||||||
|
|
||||||
b.ToTable("CocktailFlaschen");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int?>("FlascheId")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Pos")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Type")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("FlascheId");
|
|
||||||
|
|
||||||
b.ToTable("Fillers");
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Pos = 1,
|
|
||||||
Type = 0
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Pos = 2,
|
|
||||||
Type = 0
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 3,
|
|
||||||
Pos = 3,
|
|
||||||
Type = 0
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 4,
|
|
||||||
Pos = 4,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 5,
|
|
||||||
Pos = 5,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 6,
|
|
||||||
Pos = 6,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 7,
|
|
||||||
Pos = 7,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 8,
|
|
||||||
Pos = 8,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 9,
|
|
||||||
Pos = 9,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 10,
|
|
||||||
Pos = 10,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 11,
|
|
||||||
Pos = 11,
|
|
||||||
Type = 1
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 12,
|
|
||||||
Pos = 12,
|
|
||||||
Type = 0
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 13,
|
|
||||||
Pos = 13,
|
|
||||||
Type = 0
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 14,
|
|
||||||
Pos = 14,
|
|
||||||
Type = 0
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Flasche", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<bool>("Alkoholisch")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ImageURL")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Flaschen", (string)null);
|
|
||||||
|
|
||||||
b.HasData(
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Alkoholisch = true,
|
|
||||||
Name = "Jägermeister"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Alkoholisch = true,
|
|
||||||
Name = "Wodka"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Glas", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Fuellmenge")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ImageURL")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Glaeser", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("CocktailWeb.Data.Cocktail", "Cocktail")
|
|
||||||
.WithMany("Cocktailflaschen")
|
|
||||||
.HasForeignKey("CocktailID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlascheID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Cocktail");
|
|
||||||
|
|
||||||
b.Navigation("Flasche");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Filler", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("CocktailWeb.Data.Flasche", "Flasche")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("FlascheId");
|
|
||||||
|
|
||||||
b.Navigation("Flasche");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Cocktail", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Cocktailflaschen");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace CocktailWeb.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class ModifyFlascheAddGlas : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<bool>(
|
|
||||||
name: "Alkoholisch",
|
|
||||||
table: "Flaschen",
|
|
||||||
type: "INTEGER",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: false);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<string>(
|
|
||||||
name: "ImageURL",
|
|
||||||
table: "Flaschen",
|
|
||||||
type: "TEXT",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Glaeser",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
|
||||||
.Annotation("Sqlite:Autoincrement", true),
|
|
||||||
Fuellmenge = table.Column<int>(type: "INTEGER", nullable: false),
|
|
||||||
ImageURL = table.Column<string>(type: "TEXT", nullable: true)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Glaeser", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
|
||||||
table: "Flaschen",
|
|
||||||
keyColumn: "Id",
|
|
||||||
keyValue: 1,
|
|
||||||
columns: new[] { "Alkoholisch", "ImageURL" },
|
|
||||||
values: new object[] { true, null });
|
|
||||||
|
|
||||||
migrationBuilder.UpdateData(
|
|
||||||
table: "Flaschen",
|
|
||||||
keyColumn: "Id",
|
|
||||||
keyValue: 2,
|
|
||||||
columns: new[] { "Alkoholisch", "ImageURL" },
|
|
||||||
values: new object[] { true, null });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Glaeser");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Alkoholisch",
|
|
||||||
table: "Flaschen");
|
|
||||||
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "ImageURL",
|
|
||||||
table: "Flaschen");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -176,12 +176,6 @@ namespace CocktailWeb.Migrations
|
|||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<bool>("Alkoholisch")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ImageURL")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
@ -194,34 +188,15 @@ namespace CocktailWeb.Migrations
|
|||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 1,
|
Id = 1,
|
||||||
Alkoholisch = true,
|
|
||||||
Name = "Jägermeister"
|
Name = "Jägermeister"
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
Id = 2,
|
Id = 2,
|
||||||
Alkoholisch = true,
|
|
||||||
Name = "Wodka"
|
Name = "Wodka"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.Glas", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<int>("Fuellmenge")
|
|
||||||
.HasColumnType("INTEGER");
|
|
||||||
|
|
||||||
b.Property<string>("ImageURL")
|
|
||||||
.HasColumnType("TEXT");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Glaeser", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
modelBuilder.Entity("CocktailWeb.Data.CocktailFlasche", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("CocktailWeb.Data.Cocktail", "Cocktail")
|
b.HasOne("CocktailWeb.Data.Cocktail", "Cocktail")
|
||||||
|
|||||||
@ -31,32 +31,16 @@ else
|
|||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<h6>Zutaten:</h6>
|
<h6>Zutaten:</h6>
|
||||||
<ul>
|
<ul>
|
||||||
@foreach (var Zutat in SelectedCocktail.Cocktailflaschen.OrderBy(f => f.Reihenfolge))
|
@foreach (var Zutat in SelectedCocktail.Cocktailflaschen)
|
||||||
{
|
|
||||||
@if (MaschinenFiller != null && MaschinenFiller.Exists(f => f.Flasche == Zutat.Flasche))
|
|
||||||
{
|
{
|
||||||
<li>@Zutat.Flasche?.Name (@Zutat.Menge ml)</li>
|
<li>@Zutat.Flasche?.Name (@Zutat.Menge ml)</li>
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
@* Zutat nicht in MaschinenFiller gefunden - Daher ist Maschine nicht damit bestückt*@
|
|
||||||
<li class="text-danger">@Zutat.Flasche?.Name (@Zutat.Menge ml) (nicht geladen)</li>
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if (ValideMische)
|
|
||||||
{
|
|
||||||
<button class="btn btn-primary">Lets goooooo!</button>
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
<button class="btn btn-outline-primary">Lets goooooo!</button>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,10 +48,8 @@ else
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public string? CocktailId { get; set; }
|
public string? CocktailId { get; set; }
|
||||||
private DbDataContext? _DataContext;
|
private DbDataContext? _DataContext;
|
||||||
private Cocktail? SelectedCocktail;
|
|
||||||
private List<Filler>? MaschinenFiller;
|
|
||||||
|
|
||||||
private bool ValideMische = true;
|
private Cocktail? SelectedCocktail;
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
@ -77,9 +59,6 @@ else
|
|||||||
if (_DataContext != null)
|
if (_DataContext != null)
|
||||||
{
|
{
|
||||||
SelectedCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == id);
|
SelectedCocktail = _DataContext.Cocktails.Include(c => c.Cocktailflaschen).ThenInclude(cf => cf.Flasche).Single(c => c.Id == id);
|
||||||
MaschinenFiller = _DataContext.Fillers.Include(f => f.Flasche).OrderBy(f => f.Pos).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
<div class="modal @modalClass" tabindex="-1" role="dialog" style="display:@modalDisplay; overflow-y: auto;">
|
|
||||||
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title">@Title</h5>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
@Body
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
@Footer
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
@if (showBackdrop)
|
|
||||||
{
|
|
||||||
<div class="modal-backdrop fade show"></div>
|
|
||||||
}
|
|
||||||
|
|
||||||
@code {
|
|
||||||
[Parameter]
|
|
||||||
public RenderFragment? Title { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public RenderFragment? Body { get; set; }
|
|
||||||
|
|
||||||
[Parameter]
|
|
||||||
public RenderFragment? Footer { get; set; }
|
|
||||||
|
|
||||||
private string modalDisplay = "none;";
|
|
||||||
private string modalClass = "";
|
|
||||||
private bool showBackdrop = false;
|
|
||||||
|
|
||||||
public async Task OpenModal()
|
|
||||||
{
|
|
||||||
modalDisplay = "block;";
|
|
||||||
await Task.Delay(100);//Delay allows bootstrap to perform nice fade animation
|
|
||||||
modalClass = "show";
|
|
||||||
showBackdrop = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task Close()
|
|
||||||
{
|
|
||||||
modalDisplay = "none";
|
|
||||||
await Task.Delay(250);//Delay allows bootstrap to perform nice fade animation
|
|
||||||
modalClass = "";
|
|
||||||
showBackdrop = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -125,7 +125,7 @@ namespace CocktailWeb.Pages.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nav.NavigateTo("/settings/cocktails");
|
nav.NavigateTo("/cocktails");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,26 +19,12 @@
|
|||||||
@foreach (Cocktail c in CocktailListe)
|
@foreach (Cocktail c in CocktailListe)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td class="p-0" style="width:64px"><img src="@c.ImageURL" style="max-width:100%; max-height:auto;" /></td>
|
<td class="p-0"><img src="@c.ImageURL" style="max-height:40px;" /></td>
|
||||||
<td style="vertical-align:middle;">@c.Name</td>
|
<td>@c.Name</td>
|
||||||
<td style="text-align:right; vertical-align:middle;" >
|
<td> <a class="btn btn-primary" href="/settings/cocktails/edit/@c.Id">Bearbeiten</a></td>
|
||||||
<a class="btn btn-primary" href="/settings/cocktails/edit/@c.Id">Bearbeiten</a>
|
|
||||||
<button name="submit" type="submit" class="btn btn-outline-danger" @onclick="() => ConfirmDelete(c)">Löschen</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ModalComponent @ref="modal">
|
|
||||||
<Title>Löschen bestätigen</Title>
|
|
||||||
<Body>
|
|
||||||
Willst du den Cocktail wirklich löschen?
|
|
||||||
</Body>
|
|
||||||
<Footer>
|
|
||||||
<button class="btn btn-danger" @onclick="DeleteCocktail">Jo</button>
|
|
||||||
<button class="btn btn-primary" @onclick="CloseDialog">Nee</button>
|
|
||||||
</Footer>
|
|
||||||
</ModalComponent>
|
|
||||||
@ -10,8 +10,6 @@ namespace CocktailWeb.Pages.Settings
|
|||||||
public partial class Cocktails
|
public partial class Cocktails
|
||||||
{
|
{
|
||||||
private DbDataContext? _DataContext;
|
private DbDataContext? _DataContext;
|
||||||
private ModalComponent modal = null!;
|
|
||||||
private Cocktail? SelectedCocktail;
|
|
||||||
|
|
||||||
private List<Cocktail> CocktailListe { get; set; } = new();
|
private List<Cocktail> CocktailListe { get; set; } = new();
|
||||||
|
|
||||||
@ -28,31 +26,5 @@ namespace CocktailWeb.Pages.Settings
|
|||||||
CocktailListe = await _DataContext.Cocktails.OrderBy(f => f.Name).ToListAsync();
|
CocktailListe = await _DataContext.Cocktails.OrderBy(f => f.Name).ToListAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ConfirmDelete(Cocktail c)
|
|
||||||
{
|
|
||||||
SelectedCocktail = c;
|
|
||||||
await modal.OpenModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CloseDialog()
|
|
||||||
{
|
|
||||||
SelectedCocktail = null;
|
|
||||||
await modal.Close();
|
|
||||||
}
|
|
||||||
private async Task DeleteCocktail(MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (SelectedCocktail != null)
|
|
||||||
{
|
|
||||||
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
|
||||||
if (_DataContext != null)
|
|
||||||
{
|
|
||||||
_DataContext.Cocktails.Remove(SelectedCocktail);
|
|
||||||
await _DataContext.SaveChangesAsync();
|
|
||||||
await ShowCocktails();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await CloseDialog();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,18 +28,22 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="offset-4 col-8">
|
||||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="ShowCreateForm">Flasche hinzufügen</button>
|
<button name="submit" type="submit" class="btn btn-primary" @onclick="ShowCreateForm">Flasche hinzufügen</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (FlaschenListe != null && FlaschenListe.Count > 0)
|
@if (FlaschenListe != null && FlaschenListe.Count > 0)
|
||||||
{
|
{
|
||||||
<div class="table-responsive mt-3">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
<table class="table table-striped table-hover table-bordered table-dark border-dark">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<!--<th scope="col">ID</th>-->
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
<th style="text-align:right;" scope="col">Action</th>
|
<th scope="col">Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -48,6 +52,7 @@ else
|
|||||||
@if (EditFormVisible && FlascheToUpdate != null && FlascheToUpdate.Id == flasche.Id)
|
@if (EditFormVisible && FlascheToUpdate != null && FlascheToUpdate.Id == flasche.Id)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
|
<!-- <th scope="row">@FlascheToUpdate.Id</th>-->
|
||||||
<td> <input id="Name" name="Name" type="text" class="form-control" @bind="@FlascheToUpdate.Name" /></td>
|
<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>
|
<td><button name="submit" type="submit" class="btn btn-primary" @onclick="() => UpdateEmployee(FlascheToUpdate)">Speichern</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -55,10 +60,11 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
|
<!-- <th scope="row">@flasche.Id</th> -->
|
||||||
<td>@flasche.Name</td>
|
<td>@flasche.Name</td>
|
||||||
<td style="text-align:right;">
|
<td>
|
||||||
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => ShowEditForm(flasche)">Bearbeiten</button>
|
<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>
|
<button name="submit" type="submit" class="btn btn-primary" @onclick="() => DeleteFlasche(flasche)">Löschen</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
@page "/settings/glaeser"
|
|
||||||
@using Microsoft.AspNetCore.Components.Sections
|
|
||||||
|
|
||||||
<SectionContent SectionId="TopRow.Title">
|
|
||||||
<label>Einstellungen - Gläser</label>
|
|
||||||
</SectionContent>
|
|
||||||
|
|
||||||
@code {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -2,8 +2,6 @@
|
|||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using CocktailWeb.Data
|
@using CocktailWeb.Data
|
||||||
@using Microsoft.AspNetCore.Components.Sections
|
@using Microsoft.AspNetCore.Components.Sections
|
||||||
@using CocktailWeb.Shared
|
|
||||||
|
|
||||||
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
@inject IDbContextFactory<DbDataContext> DataContextFactory;
|
||||||
<PageTitle>Maschineneinstellungen</PageTitle>
|
<PageTitle>Maschineneinstellungen</PageTitle>
|
||||||
|
|
||||||
@ -16,7 +14,7 @@
|
|||||||
<div class="row pb-2 gap-2" style="height:45vh">
|
<div class="row pb-2 gap-2" style="height:45vh">
|
||||||
@foreach (Filler f in Fillers.Where(f => f.Type == Filler.FillerType.Pourer))
|
@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" @onclick="args => OpenSelectionDialog(args,f)">
|
<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
|
@f.Pos - @f.Flasche?.Name
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@ -26,30 +24,64 @@
|
|||||||
<div class="row gap-2" style="height:25vh">
|
<div class="row gap-2" style="height:25vh">
|
||||||
@foreach (Filler f in Fillers.Where(f => f.Type == Filler.FillerType.Pump))
|
@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" @onclick="args => OpenSelectionDialog(args,f)">
|
<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
|
@f.Pos - @f.Flasche?.Name
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ModalComponent @ref="modal">
|
<div class="modal fade" id="examplemodal" tabindex="-1" aria-hidden="true">
|
||||||
<Title>Flasche auswählen</Title>
|
<div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
|
||||||
<Body>
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
Testdialog
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item list-group-item-action align-middle @(SelectedFlasche == null ? "text-bg-success" : "")" @onclick="args => SelectFlasche(args,null)">
|
@if (Flaschen.Count == 0)
|
||||||
<label class="form-check-label stretched-link">(Leer)</label>
|
{
|
||||||
|
<li class="list-group-item list-group-item-action align-middle">
|
||||||
|
Es wurden noch keine Zutaten angelegt
|
||||||
</li>
|
</li>
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
@foreach (Flasche fl in Flaschen)
|
@foreach (Flasche fl in Flaschen)
|
||||||
{
|
{
|
||||||
<li class="list-group-item list-group-item-action align-middle @(SelectedFlasche == fl ? "text-bg-success" : "")" @onclick="args => SelectFlasche(args,fl)">
|
<li class="list-group-item list-group-item-action align-middle">
|
||||||
<label class="form-check-label stretched-link">@fl.Name</label>
|
<label class="form-check-label stretched-link">@fl.Name</label>
|
||||||
</li>
|
</li>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</ul>
|
</ul>
|
||||||
</Body>
|
</div>
|
||||||
<Footer>
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" @onclick="CloseDialog">Abbrechen</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Abbrechen</button>
|
||||||
<button type="button" class="btn btn-primary" @onclick="SaveSelection">Speichern</button>
|
<button type="button" class="btn btn-primary">Speichern</button>
|
||||||
</Footer>
|
</div>
|
||||||
</ModalComponent>
|
</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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,69 +1,6 @@
|
|||||||
using CocktailWeb.Data;
|
namespace CocktailWeb.Pages.Settings
|
||||||
using Microsoft.AspNetCore.Components.Web;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
namespace CocktailWeb.Pages.Settings
|
|
||||||
{
|
{
|
||||||
partial class Maschine
|
partial class Maschine
|
||||||
{
|
{
|
||||||
private DbDataContext? _DataContext;
|
|
||||||
private List<Filler> Fillers { get; set; } = new();
|
|
||||||
private List<Flasche> Flaschen { get; set; } = new();
|
|
||||||
|
|
||||||
private Filler? SelectedFiller { get; set; }
|
|
||||||
|
|
||||||
private Flasche? SelectedFlasche { get; set; }
|
|
||||||
|
|
||||||
private ModalComponent modal = null!;
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task OpenSelectionDialog(MouseEventArgs e, Filler f)
|
|
||||||
{
|
|
||||||
SelectedFiller = f;
|
|
||||||
SelectedFlasche = f.Flasche;
|
|
||||||
await modal.OpenModal();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void SelectFlasche(MouseEventArgs e, Flasche? fl)
|
|
||||||
{
|
|
||||||
SelectedFlasche = fl;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SaveSelection(MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (SelectedFiller != null)
|
|
||||||
{
|
|
||||||
SelectedFiller.Flasche = SelectedFlasche;
|
|
||||||
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
|
||||||
if (_DataContext != null)
|
|
||||||
{
|
|
||||||
_DataContext.Fillers.Update(SelectedFiller);
|
|
||||||
await _DataContext.SaveChangesAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await CloseDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CloseDialog()
|
|
||||||
{
|
|
||||||
SelectedFiller = null;
|
|
||||||
SelectedFlasche = null;
|
|
||||||
await modal.Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
@using Microsoft.AspNetCore.Components.Sections
|
@using Microsoft.AspNetCore.Components.Sections
|
||||||
|
|
||||||
|
|
||||||
<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 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">
|
<div class="d-flex gap-3 align-items-center">
|
||||||
<a class="btn btn-primary" href="/">
|
<a class="btn btn-primary" href="/">
|
||||||
@ -21,7 +22,6 @@
|
|||||||
<a class="dropdown-item" href="/settings/maschine">Maschine</a>
|
<a class="dropdown-item" href="/settings/maschine">Maschine</a>
|
||||||
<a class="dropdown-item" href="/settings/flaschen">Zutaten</a>
|
<a class="dropdown-item" href="/settings/flaschen">Zutaten</a>
|
||||||
<a class="dropdown-item" href="/settings/cocktails">Cocktails</a>
|
<a class="dropdown-item" href="/settings/cocktails">Cocktails</a>
|
||||||
<a class="dropdown-item" href="/settings/glaeser">Gläser</a>
|
|
||||||
<a class="dropdown-item" href="/serialtest">Serial Test</a>
|
<a class="dropdown-item" href="/serialtest">Serial Test</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
Loading…
x
Reference in New Issue
Block a user