mirror of
https://github.com/yummy4friends/y4f.git
synced 2024-12-27 07:38:21 +01:00
Merge branch 'dev' into YUM04-RegistrierungKunde
This commit is contained in:
commit
6c627add92
@ -6,7 +6,7 @@ Yummy4Friends ist eine benutzerfreundliche und visuell ansprechende Webapp zur O
|
||||
|
||||
## Description (English)
|
||||
|
||||
Yummy4Friends is a user friendly and visually appealing WebApp for ordering food or other things online. Food or other stuff get dynamically fetched from a customer and food database while also taking into account special requests. To attract customers one can also offer limeted time sales/coupons, ordering in advance as well as being able to choosing their preferred pickup time.
|
||||
Yummy4Friends is a user-friendly and visually appealing WebApp for ordering food or other things online. Food or other stuff gets dynamically fetched from a customer and food database while also taking into account special requests. To attract customers, one can also offer limited-time sales and coupons, order in advance, and have the option to choose the preferred pickup time.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
|
@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Data;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class BestellungspositionHasMenuitemsController : ControllerBase
|
||||
{
|
||||
private readonly WebApiContext _context;
|
||||
|
||||
public BestellungspositionHasMenuitemsController(WebApiContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/BestellungspositionHasMenuitems
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<BestellungspositionHasMenuitem>>> GetBestellungspositionHasMenuitem()
|
||||
{
|
||||
if (_context.BestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return await _context.BestellungspositionHasMenuitem.ToListAsync();
|
||||
}
|
||||
|
||||
// GET: api/BestellungspositionHasMenuitems/5
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<BestellungspositionHasMenuitem>> GetBestellungspositionHasMenuitem(int? id)
|
||||
{
|
||||
if (_context.BestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var bestellungspositionHasMenuitem = await _context.BestellungspositionHasMenuitem.FindAsync(id);
|
||||
|
||||
if (bestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return bestellungspositionHasMenuitem;
|
||||
}
|
||||
|
||||
// PUT: api/BestellungspositionHasMenuitems/5
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutBestellungspositionHasMenuitem(int? id, BestellungspositionHasMenuitem bestellungspositionHasMenuitem)
|
||||
{
|
||||
if (id != bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(bestellungspositionHasMenuitem).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!BestellungspositionHasMenuitemExists(id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// POST: api/BestellungspositionHasMenuitems
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<BestellungspositionHasMenuitem>> PostBestellungspositionHasMenuitem(BestellungspositionHasMenuitem bestellungspositionHasMenuitem)
|
||||
{
|
||||
if (_context.BestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return Problem("Entity set 'WebApiContext.BestellungspositionHasMenuitem' is null.");
|
||||
}
|
||||
_context.BestellungspositionHasMenuitem.Add(bestellungspositionHasMenuitem);
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateException)
|
||||
{
|
||||
if (BestellungspositionHasMenuitemExists(bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung))
|
||||
{
|
||||
return Conflict();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return CreatedAtAction("GetBestellungspositionHasMenuitem", new { id = bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung }, bestellungspositionHasMenuitem);
|
||||
}
|
||||
|
||||
// DELETE: api/BestellungspositionHasMenuitems/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteBestellungspositionHasMenuitem(int? id)
|
||||
{
|
||||
if (_context.BestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var bestellungspositionHasMenuitem = await _context.BestellungspositionHasMenuitem.FindAsync(id);
|
||||
if (bestellungspositionHasMenuitem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.BestellungspositionHasMenuitem.Remove(bestellungspositionHasMenuitem);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
private bool BestellungspositionHasMenuitemExists(int? id)
|
||||
{
|
||||
return (_context.BestellungspositionHasMenuitem?.Any(e => e.Bestellungsposition_IDBestellung == id)).GetValueOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
@ -29,6 +29,8 @@ public partial class WebApiContext : DbContext
|
||||
|
||||
public virtual DbSet<Admin> Admins { get; set; }
|
||||
|
||||
public virtual DbSet<BestellungspositionHasMenuitem> BestellungspositionHasMenuitem { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
@ -81,31 +83,31 @@ public partial class WebApiContext : DbContext
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_Rabatt1");
|
||||
|
||||
entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BestellungspositionHasMenuitem",
|
||||
r => r.HasOne<Menuitem>().WithMany()
|
||||
.HasForeignKey("MenuItemIdmenuItem")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"),
|
||||
l => l.HasOne<Bestellungsposition>().WithMany()
|
||||
.HasForeignKey("BestellungspositionIdbestellung")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem")
|
||||
.HasName("PRIMARY")
|
||||
.HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
|
||||
j.ToTable("bestellungsposition_has_menuitem");
|
||||
j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1");
|
||||
j.IndexerProperty<int>("BestellungspositionIdbestellung")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Bestellungsposition_IDBestellung");
|
||||
j.IndexerProperty<int>("MenuItemIdmenuItem")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("MenuItem_IDMenuItem");
|
||||
});
|
||||
//entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs)
|
||||
// .UsingEntity<Dictionary<string, object>>(
|
||||
// "BestellungspositionHasMenuitem",
|
||||
// r => r.HasOne<Menuitem>().WithMany()
|
||||
// .HasForeignKey("MenuItemIdmenuItem")
|
||||
// .OnDelete(DeleteBehavior.ClientSetNull)
|
||||
// .HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"),
|
||||
// l => l.HasOne<Bestellungsposition>().WithMany()
|
||||
// .HasForeignKey("BestellungspositionIdbestellung")
|
||||
// .OnDelete(DeleteBehavior.ClientSetNull)
|
||||
// .HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"),
|
||||
// j =>
|
||||
// {
|
||||
// j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem")
|
||||
// .HasName("PRIMARY")
|
||||
// .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
|
||||
// j.ToTable("bestellungsposition_has_menuitem");
|
||||
// j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1");
|
||||
// j.IndexerProperty<int>("BestellungspositionIdbestellung")
|
||||
// .HasColumnType("int(11)")
|
||||
// .HasColumnName("Bestellungsposition_IDBestellung");
|
||||
// j.IndexerProperty<int>("MenuItemIdmenuItem")
|
||||
// .HasColumnType("int(11)")
|
||||
// .HasColumnName("MenuItem_IDMenuItem");
|
||||
// });
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Kunde>(entity =>
|
||||
@ -212,16 +214,16 @@ public partial class WebApiContext : DbContext
|
||||
entity.Property(e => e.Password).HasMaxLength(100);
|
||||
});
|
||||
|
||||
//modelBuilder.Entity<BestellungspositionHasMenuitem>(entity =>
|
||||
//{
|
||||
// entity.HasKey(e => new { e.BestellungspositionId, e.MenuitemId })
|
||||
// .HasName("PRIMARY");
|
||||
modelBuilder.Entity<BestellungspositionHasMenuitem>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.Bestellungsposition_IDBestellung, e.MenuItem_IDMenuItem })
|
||||
.HasName("PRIMARY");
|
||||
|
||||
// entity.ToTable("bestellungsposition_has_menuitem");
|
||||
entity.ToTable("bestellungsposition_has_menuitem");
|
||||
|
||||
// entity.Property(e => e.BestellungspositionId).HasColumnType("int(11)");
|
||||
// entity.Property(e => e.MenuitemId).HasColumnType("int(11)");
|
||||
//});
|
||||
entity.Property(e => e.Bestellungsposition_IDBestellung).HasColumnType("int(11)").HasColumnName("Bestellungsposition_IDBestellung");
|
||||
entity.Property(e => e.MenuItem_IDMenuItem).HasColumnType("int(11)").HasColumnName("MenuItem_IDMenuItem");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MenuitemHasAllergie>(entity =>
|
||||
{
|
||||
|
@ -1,23 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int? Menge { get; set; }
|
||||
public int? Menge { get; set; }
|
||||
|
||||
public DateTime? Datum { get; set; }
|
||||
public DateTime? Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
public virtual Kunde? KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
|
||||
public virtual Rabatt? RabattIdrabattNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
|
||||
public virtual ICollection<Menuitem>? MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
|
11
src/WebApi/Models/BestellungspositionHasMenuitem.cs
Normal file
11
src/WebApi/Models/BestellungspositionHasMenuitem.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebApi.Models;
|
||||
|
||||
public partial class BestellungspositionHasMenuitem
|
||||
{
|
||||
public int? Bestellungsposition_IDBestellung { get; set; }
|
||||
|
||||
public int? MenuItem_IDMenuItem { get; set; }
|
||||
}
|
@ -1,90 +1,125 @@
|
||||
@page "/allergene"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<PageTitle>Allergene</PageTitle>
|
||||
|
||||
<table class="tg">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-c3ow" colspan="3">Allergeninformation<br>gemäß Codex-Empfehlung </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tg-0pky">Visuelles</td>
|
||||
<td class="tg-0pky">Kurzbezeichnung</td>
|
||||
<td class="tg-0pky">Buchstabencode</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/getreide.png" alt="Getreide"></td>
|
||||
<td class="tg-0pky">glutenhaltiges Getreide</td>
|
||||
<td class="tg-c3ow">A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/krebstiere.png" alt="Krebstiere"></td>
|
||||
<td class="tg-0pky">Krebstiere</td>
|
||||
<td class="tg-c3ow">B</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/ei.png" alt="Ei"></td>
|
||||
<td class="tg-0pky">Ei</td>
|
||||
<td class="tg-c3ow">C</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/fisch.png" alt="Fisch"></td>
|
||||
<td class="tg-0pky">Fisch</td>
|
||||
<td class="tg-c3ow">D</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/erdnuss.png" alt="Erdnuss"></td>
|
||||
<td class="tg-0pky">Erdnuss</td>
|
||||
<td class="tg-c3ow">E</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/soja.png" alt="Soja"></td>
|
||||
<td class="tg-0pky">Soja</td>
|
||||
<td class="tg-c3ow">F</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/milch.png" alt="Milch oder Laktose"></td>
|
||||
<td class="tg-0pky">Milch oder Laktose</td>
|
||||
<td class="tg-c3ow">G</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/schalenfruechte.png" alt="Schalenfrüchte"></td>
|
||||
<td class="tg-0pky">Schalenfrüchte</td>
|
||||
<td class="tg-c3ow">H</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sellerie.png" alt="Sellerie"></td>
|
||||
<td class="tg-0pky">Sellerie</td>
|
||||
<td class="tg-c3ow">L</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/senf.png" alt="Senf"></td>
|
||||
<td class="tg-0pky">Senf</td>
|
||||
<td class="tg-c3ow">M</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sesam.png" alt="Sesam"></td>
|
||||
<td class="tg-0pky">Sesam</td>
|
||||
<td class="tg-c3ow">N</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sulfite.png" alt="Sulfite"></td>
|
||||
<td class="tg-0pky">Sulfite</td>
|
||||
<td class="tg-c3ow">O</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/lupinen.png" alt="Lupinen"></td>
|
||||
<td class="tg-0pky">Lupinen</td>
|
||||
<td class="tg-c3ow">P</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/weichtiere.png" alt="Weichtiere"></td>
|
||||
<td class="tg-0pky">Weichtiere</td>
|
||||
<td class="tg-c3ow">R</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tg-c3ow" colspan="3">Allergeninformation<br>gemäß Codex-Empfehlung </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="tg-0pky">Visuelles</td>
|
||||
<td class="tg-0pky">Kurzbezeichnung</td>
|
||||
<td class="tg-0pky">Buchstabencode</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/getreide.png" alt="Getreide"></td>
|
||||
<td class="tg-0pky">glutenhaltiges Getreide</td>
|
||||
<td class="tg-c3ow">A</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/krebstiere.png" alt="Krebstiere"></td>
|
||||
<td class="tg-0pky">Krebstiere</td>
|
||||
<td class="tg-c3ow">B</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/ei.png" alt="Ei"></td>
|
||||
<td class="tg-0pky">Ei</td>
|
||||
<td class="tg-c3ow">C</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/fisch.png" alt="Fisch"></td>
|
||||
<td class="tg-0pky">Fisch</td>
|
||||
<td class="tg-c3ow">D</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/erdnuss.png" alt="Erdnuss"></td>
|
||||
<td class="tg-0pky">Erdnuss</td>
|
||||
<td class="tg-c3ow">E</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/soja.png" alt="Soja"></td>
|
||||
<td class="tg-0pky">Soja</td>
|
||||
<td class="tg-c3ow">F</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/milch.png" alt="Milch oder Laktose"></td>
|
||||
<td class="tg-0pky">Milch oder Laktose</td>
|
||||
<td class="tg-c3ow">G</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/schalenfruechte.png" alt="Schalenfrüchte"></td>
|
||||
<td class="tg-0pky">Schalenfrüchte</td>
|
||||
<td class="tg-c3ow">H</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sellerie.png" alt="Sellerie"></td>
|
||||
<td class="tg-0pky">Sellerie</td>
|
||||
<td class="tg-c3ow">L</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/senf.png" alt="Senf"></td>
|
||||
<td class="tg-0pky">Senf</td>
|
||||
<td class="tg-c3ow">M</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sesam.png" alt="Sesam"></td>
|
||||
<td class="tg-0pky">Sesam</td>
|
||||
<td class="tg-c3ow">N</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/sulfite.png" alt="Sulfite"></td>
|
||||
<td class="tg-0pky">Sulfite</td>
|
||||
<td class="tg-c3ow">O</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/lupinen.png" alt="Lupinen"></td>
|
||||
<td class="tg-0pky">Lupinen</td>
|
||||
<td class="tg-c3ow">P</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tg-0pky"><img class="icon" src="assets/weichtiere.png" alt="Weichtiere"></td>
|
||||
<td class="tg-0pky">Weichtiere</td>
|
||||
<td class="tg-c3ow">R</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br><br><br><br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
@ -1,5 +1,33 @@
|
||||
@page "/cookies"
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
|
@ -1,5 +1,33 @@
|
||||
@page "/datenschutzerklärung"
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
|
@ -4,6 +4,8 @@
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
@inject IJSRuntime JSRuntime;
|
||||
|
||||
|
||||
<PageTitle>Yummy4Friends</PageTitle>
|
||||
|
||||
@ -32,14 +34,25 @@
|
||||
{
|
||||
localStorage.SetItem("kunde", kunde);
|
||||
_navigationManager.NavigateTo("/speisekarte");
|
||||
break;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
JSRuntime.InvokeVoidAsync("alert", "Zugangscode ist falsch!");
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
// if already logged in navigate to speisekarte
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
{
|
||||
_navigationManager.NavigateTo("/speisekarte");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
|
@ -1,5 +1,37 @@
|
||||
@page "/Kontakt"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<h3>Kontakt</h3>
|
||||
|
||||
<h4>Kundenservice</h4>
|
||||
|
@ -91,8 +91,8 @@
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px;">
|
||||
<div style="margin:20px;">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<input type="number" style="width:80px" min="10" max="19" />
|
||||
<input type="number" style="width:80px" min="0" max="59" />
|
||||
<input type="number" style="width:80px" min="10" max="19" @bind-value="@hour" @onclick="@(()=>UpdateTime())" />
|
||||
<input type="number" style="width:80px" min="0" max="59" @bind-value="@minute" @onclick="@(()=>UpdateTime())" />
|
||||
|
||||
Uhr
|
||||
</div>
|
||||
@ -111,7 +111,7 @@
|
||||
<div class="col mt-auto ">
|
||||
<div class="d-flex flex-column align-items-center ">
|
||||
<a href="/speisekarte" class="btn_bg w-75 btn text-center">Zurück</a>
|
||||
<a href="#" class="btn_forward btn w-75 ">Weiter</a>
|
||||
<a class="btn_forward btn w-75 " @onclick="@(() => SetBestllung())">Weiter</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -121,9 +121,31 @@
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public int hour;
|
||||
public int minute;
|
||||
private void UpdateTime()
|
||||
{
|
||||
localStorage.SetItem<int>("Hour", hour);
|
||||
localStorage.SetItem<int>("Minute", minute);
|
||||
}
|
||||
|
||||
private void SetBestllung()
|
||||
{
|
||||
if (menuitemIds.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
UpdateTime();
|
||||
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
|
||||
_navigationManager.NavigateTo("/Bestellabschluss");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public decimal summe;
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -163,7 +185,6 @@
|
||||
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
@ -171,6 +192,17 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
|
||||
// get data from localstorage
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
@ -180,7 +212,6 @@
|
||||
// get data from api
|
||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||
@ -199,6 +230,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
localStorage.SetItem<decimal>("Summe", summe);
|
||||
|
||||
// if hour/minute is set, set the values
|
||||
if (localStorage.GetItem<int>("Hour") != 0)
|
||||
{
|
||||
hour = localStorage.GetItem<int>("Hour");
|
||||
}
|
||||
if (localStorage.GetItem<int>("Minute") != 0)
|
||||
{
|
||||
minute = localStorage.GetItem<int>("Minute");
|
||||
}
|
||||
}
|
||||
|
||||
public class Allergie
|
||||
@ -219,7 +261,7 @@
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
<h1>Speisekarte</h1>
|
||||
<div class="row justify-content-center">
|
||||
@foreach (var item in menuitemueberkategories)
|
||||
@ -25,18 +26,39 @@
|
||||
<tr>
|
||||
<td><a href="/SpeisekarteChinesich">@item2.Bezeichnung</a></td>
|
||||
</tr>
|
||||
@if (@item2.Bezeichnung == "Nachspeise")
|
||||
{
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else if (@item.Bezeichnung == "Japanisch")
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/SpeisekarteJapanisch">@item2.Bezeichnung</a></td>
|
||||
</tr>
|
||||
@if (@item2.Bezeichnung == "Nachspeise")
|
||||
{
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
}
|
||||
else if (@item.Bezeichnung == "Getränke")
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/SpeisekarteGetraenke">@item2.Bezeichnung</a></td>
|
||||
</tr>
|
||||
@if (@item2.Bezeichnung == "Bier")
|
||||
{
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr><tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else if (@item.Bezeichnung == "Sonstiges")
|
||||
{
|
||||
@ -46,15 +68,9 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/">@item2.Bezeichnung</a></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
|
||||
@ -72,6 +88,9 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
@ -81,18 +100,14 @@
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/MenuItemKategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/MenuItemUeberkategories");
|
||||
@ -123,5 +138,5 @@
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -90,6 +90,9 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
private void SetMenuItemId(int id)
|
||||
@ -108,7 +111,6 @@
|
||||
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
@ -117,19 +119,17 @@
|
||||
private Kunde curretKunde = new Kunde();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
@ -163,7 +163,7 @@
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
|
@ -94,6 +94,8 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -115,7 +117,6 @@
|
||||
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
@ -124,20 +125,17 @@
|
||||
private Kunde curretKunde = new Kunde();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
@ -170,7 +168,7 @@
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
|
@ -94,6 +94,8 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -113,7 +115,6 @@
|
||||
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
@ -122,21 +123,17 @@
|
||||
private Kunde curretKunde = new Kunde();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
@ -168,7 +165,7 @@
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
|
@ -93,6 +93,8 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -112,7 +114,6 @@
|
||||
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
@ -121,21 +122,17 @@
|
||||
private Kunde curretKunde = new Kunde();
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
@ -167,7 +164,7 @@
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int RabattIdrabatt { get; set; }
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
@page "/TestFetchAllergienData"
|
||||
|
||||
@inject HttpClient Http
|
||||
|
||||
|
||||
<PageTitle>Allergien</PageTitle>
|
||||
|
||||
<h1>Allergien</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the mysql server.</p>
|
||||
|
||||
@if (allergien == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Beschreibung</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var allergie in allergien)
|
||||
{
|
||||
<tr>
|
||||
<td>@allergie.Idallergie</td>
|
||||
<td>@allergie.Beschreibung</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
@code {
|
||||
private const string ServiceEndpoint = "https://localhost:7076/api/Allergien";
|
||||
private Allergie[]? allergien;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
allergien = await Http.GetFromJsonAsync<Allergie[]>(ServiceEndpoint);
|
||||
}
|
||||
|
||||
public partial class Allergie
|
||||
{
|
||||
public int Idallergie { get; set; }
|
||||
|
||||
public string? Beschreibung { get; set; }
|
||||
}
|
||||
}
|
@ -1,5 +1,37 @@
|
||||
@page "/yummypoints"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%";'>
|
||||
<div class="d-flex justify-content-center">
|
||||
|
||||
|
@ -1,36 +1,341 @@
|
||||
@page "/Bestellabschluss"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
<body>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<p>Sie haben derzeit <b>1 Yummy-Punkt(e)</b></p>
|
||||
<p class="text">Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt.
|
||||
Ab der 10ten Bestellung gibt es einen Rabatt zu Ihrer nächsten Bestellung.</p>
|
||||
|
||||
<div class="img" >
|
||||
@for(int i = 0; i < 10; i++)
|
||||
{
|
||||
<img src="assets/White-Circle.png ">
|
||||
}
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<p class="text">Achtung: Bitte beachten Sie, dass keine online Bezahlung zur Verfügung steht.
|
||||
Diese dient nur zur Vorbestellung und muss selbst abgeholt werden.</p>
|
||||
|
||||
<div class="button">
|
||||
<form id="button1" action="Warenkorb">
|
||||
<input type="submit" value="Zurück" class="btn">
|
||||
</form>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<p>Sie haben derzeit <b>@kunde.Treuepunkte Yummy-Punkt(e)</b></p>
|
||||
<p class="text">
|
||||
Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt.
|
||||
Ab der 10ten Bestellung gibt es einen Rabatt (@rabatt.Prozent%) zu Ihrer nächsten Bestellung.
|
||||
</p>
|
||||
|
||||
<form id="button2" action="Confirm">
|
||||
<input type="submit" value="Vorbestellen" class="btn">
|
||||
</form>
|
||||
</div>
|
||||
<div class="img">
|
||||
@for (int i = 0; i < 10; i++)
|
||||
{
|
||||
@*if kunde hat treuepunkte*@
|
||||
@if (kunde.Treuepunkte > i)
|
||||
{
|
||||
<img src="assets/Point-Circle.png ">
|
||||
}
|
||||
else
|
||||
{
|
||||
<img src="assets/White-Circle.png ">
|
||||
}
|
||||
}
|
||||
<br>
|
||||
</div>
|
||||
<p class="text">
|
||||
Achtung: Bitte beachten Sie, dass keine online Bezahlung zur Verfügung steht.
|
||||
Diese dient nur zur Vorbestellung und muss selbst abgeholt werden.
|
||||
</p>
|
||||
<p>
|
||||
Ihr gesamt bestellter Betrag beträgt: <strong>@summe €</strong>
|
||||
</p>
|
||||
@*if treuepunkte 10 dann angebot bieten*@
|
||||
@if (kunde.Treuepunkte == 10)
|
||||
{
|
||||
<p class=""><strong>Sie haben 10 Yummy-Punkte erreicht</strong>. Sie können diese jetzt einlösen und erhalten einen Rabatt von <strong>@rabatt.Prozent%</strong>.</p>
|
||||
<p><strong>Wollen Sie diese einlösen?</strong> <InputCheckbox @bind-Value="rabattEinloesen" /></p>
|
||||
|
||||
</div>
|
||||
@if (rabattEinloesen == true)
|
||||
{
|
||||
<p>Betrag beträgt abzüglich des Rabattes: <strong>@Math.Round(summe - (summe * rabatt.Prozent / 100), 2) €</strong></p>
|
||||
}
|
||||
|
||||
}
|
||||
<div class="button">
|
||||
<form id="button1" action="Warenkorb">
|
||||
<a href="/shopping_cart" class="btn">Zurück</a>
|
||||
</form>
|
||||
<form id="button2" action="Confirm">
|
||||
<input value="Vorbestellen" class="btn" @onclick="Vorbestellen" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||
private Rabatt rabatt = new Rabatt();
|
||||
private bool rabattEinloesen;
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
public List<Bestellungsposition> bestellungspositionen = new List<Bestellungsposition>();
|
||||
public int hour;
|
||||
public int minute;
|
||||
|
||||
public decimal summe;
|
||||
|
||||
public void Vorbestellen()
|
||||
{
|
||||
// set rabattEinloesen
|
||||
if (rabattEinloesen)
|
||||
{
|
||||
kunde.Treuepunkte = 0;
|
||||
// delete treuepunkte API
|
||||
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
||||
summe = Math.Round(summe - (summe * rabatt.Prozent / 100), 2);
|
||||
localStorage.SetItem("Summe", summe);
|
||||
localStorage.SetItem("RabattEinloesen", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
localStorage.SetItem("RabattEinloesen", false);
|
||||
localStorage.SetItem("Summe", summe);
|
||||
if (summe >= 8)
|
||||
{
|
||||
if (kunde.Treuepunkte < 10)
|
||||
{
|
||||
kunde.Treuepunkte++;
|
||||
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add bestellung to API
|
||||
// add all bestellungspositionen to API
|
||||
// get latest bestellungsposition id wenn nix da dann 0
|
||||
int bestellungspositionId = 0;
|
||||
if (bestellungspositions != null)
|
||||
{
|
||||
// get the highest id from bestellungspositions
|
||||
int highestId;
|
||||
foreach (var item in bestellungspositions)
|
||||
{
|
||||
highestId = item.Idbestellung;
|
||||
if (highestId > bestellungspositionId)
|
||||
{
|
||||
bestellungspositionId = highestId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in menuitemIds)
|
||||
{
|
||||
bestellungspositionId++;
|
||||
Bestellungsposition bestellungsposition = new Bestellungsposition();
|
||||
bestellungsposition.Idbestellung = bestellungspositionId;
|
||||
bestellungsposition.Menge = item.Value;
|
||||
// make a new date with hour and minute
|
||||
DateTime abholzeit = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, hour, minute, 0);
|
||||
bestellungsposition.Datum = abholzeit;
|
||||
// latest possible rabatt
|
||||
if (rabattEinloesen)
|
||||
{
|
||||
bestellungsposition.RabattIdrabatt = rabatt.Idrabatt;
|
||||
}
|
||||
else
|
||||
{
|
||||
bestellungsposition.RabattIdrabatt = null;
|
||||
}
|
||||
bestellungsposition.KundeIdkunde = kunde.Idkunde;
|
||||
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
||||
|
||||
////Add menuitems to bestellungspositionHasMenuItem
|
||||
//BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
||||
//bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
||||
//bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
||||
|
||||
//Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", bestellungspositionHasMenuItem);
|
||||
|
||||
var newBestellungsposition = new BestellungspositionHasMenuitem()
|
||||
{
|
||||
Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung,
|
||||
MenuItem_IDMenuItem = item.Key
|
||||
};
|
||||
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", newBestellungsposition);
|
||||
}
|
||||
|
||||
|
||||
// delete all localStorage
|
||||
localStorage.SetItem("MenuItemIds", new Dictionary<int, int>());
|
||||
localStorage.SetItem("Summe", 0);
|
||||
localStorage.SetItem("RabattEinloesen", false);
|
||||
|
||||
_navigationManager.NavigateTo("/Bestellbestätigung");
|
||||
}
|
||||
|
||||
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
private List<BestellungspositionHasMenuitem> bestellungspositionHasMenuitems = new List<BestellungspositionHasMenuitem>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
// get data from api
|
||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
|
||||
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
if (rabatte.Count == 0)
|
||||
{
|
||||
rabatt = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < rabatte.Count; i++)
|
||||
{
|
||||
if (rabatte[i].GueltigkeitBis > DateTime.Now)
|
||||
{
|
||||
rabatt = rabatte[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get data from localstorage
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
}
|
||||
|
||||
// calculate the sum of all menuitems
|
||||
summe = 0;
|
||||
foreach (var item in menuitemIds)
|
||||
{
|
||||
foreach (var item2 in menuitems)
|
||||
{
|
||||
if (item.Key == item2.IdmenuItem)
|
||||
{
|
||||
summe += item2.Preis * item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if hour/minute is set, set the values
|
||||
if (localStorage.GetItem<int>("Hour") != 0)
|
||||
{
|
||||
hour = localStorage.GetItem<int>("Hour");
|
||||
}
|
||||
if (localStorage.GetItem<int>("Minute") != 0)
|
||||
{
|
||||
minute = localStorage.GetItem<int>("Minute");
|
||||
}
|
||||
}
|
||||
|
||||
public class Allergie
|
||||
{
|
||||
public int Idallergie { get; set; }
|
||||
|
||||
public string? Beschreibung { get; set; }
|
||||
|
||||
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
public class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int? Menge { get; set; }
|
||||
|
||||
public DateTime? Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public int? Treuepunkte { get; set; }
|
||||
|
||||
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
|
||||
public class Menuitem
|
||||
{
|
||||
public int IdmenuItem { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public string? Zusatzinformation { get; set; }
|
||||
|
||||
public decimal Preis { get; set; }
|
||||
|
||||
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
|
||||
|
||||
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
|
||||
|
||||
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
public class Menuitemkategorie
|
||||
{
|
||||
public int IdmenuItemKategorie { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
|
||||
|
||||
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
|
||||
public class Menuitemueberkategorie
|
||||
{
|
||||
public int IdmenuItemUeberkategorie { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
|
||||
}
|
||||
|
||||
public class Rabatt
|
||||
{
|
||||
public int Idrabatt { get; set; }
|
||||
|
||||
public decimal Prozent { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitVon { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitBis { get; set; }
|
||||
|
||||
public bool Einloesen { get; set; }
|
||||
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
|
||||
|
||||
public class BestellungspositionHasMenuitem
|
||||
{
|
||||
public int Bestellungsposition_IDBestellung { get; set; }
|
||||
public int MenuItem_IDMenuItem { get; set; }
|
||||
}
|
||||
}
|
@ -1,38 +1,241 @@
|
||||
@page "/Bestellbestätigung"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<body>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h5>Vielen Dank für Ihre Bestellung</h5><br>
|
||||
<p class="text">
|
||||
Ihr Essen ist in <b>30 Minuten</b> abholbereit.
|
||||
Sie erhalten eine Benachrichtigung sobald das Essen fertig ist. Wir würden uns freuen, wenn Sie uns ein <a href="Feedback">Feedback</a> geben.
|
||||
<br><br><br><br>
|
||||
</p>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h5>Vielen Dank für Ihre Bestellung</h5><br>
|
||||
<p class="text">
|
||||
<strong>Ihr Essen ist heute um @hour:@minute abholbereit.</strong>
|
||||
Sie erhalten eine Benachrichtigung sobald das Essen fertig ist. Wir würden uns freuen, wenn Sie uns ein <a href="Feedback">Feedback</a> geben.
|
||||
<br><br><br><br>
|
||||
</p>
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress-bar bg-warning progress-bar-striped progress-bar-animated" style="width:50%"></div>
|
||||
</div>
|
||||
<div class="progress">
|
||||
<div class="progress-bar bg-warning progress-bar-striped progress-bar-animated" style="width:10%"></div>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<table>
|
||||
|
||||
<tr class="loadtext">
|
||||
<td>Bestellung eingegangen</td>
|
||||
<td class="load2">Bestellung wird zubereitet</td>
|
||||
<td class="load3">Essen abholbereit</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="button">
|
||||
<br><br><br><br>
|
||||
<form id="button1" action="/">
|
||||
<input type="submit" value="Zur Startseite" class="btn">
|
||||
</form>
|
||||
</div>
|
||||
<tr class="loadtext">
|
||||
<td>Bestellung eingegangen</td>
|
||||
<td class="load2">Bestellung wird zubereitet</td>
|
||||
<td class="load3">Essen abholbereit</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="button">
|
||||
<br><br><br><br>
|
||||
<form id="button1" action="/">
|
||||
<input type="submit" value="Bestellungsübersicht" class="btn" @onclick="BestellungsUuebersicht"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
@code {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||
private Rabatt rabatt = new Rabatt();
|
||||
private bool rabattEinloesen;
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
public int hour;
|
||||
public int minute;
|
||||
|
||||
public decimal summe;
|
||||
|
||||
|
||||
|
||||
public void BestellungsUuebersicht()
|
||||
{
|
||||
_navigationManager.NavigateTo("/Kontoverwaltung");
|
||||
}
|
||||
|
||||
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
|
||||
private List<Allergie> allergien = new List<Allergie>();
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
// get data from api
|
||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
if (rabatte.Count == 0)
|
||||
{
|
||||
rabatt = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < rabatte.Count; i++)
|
||||
{
|
||||
if (rabatte[i].GueltigkeitBis > DateTime.Now)
|
||||
{
|
||||
rabatt = rabatte[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// get data from localstorage
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
}
|
||||
|
||||
// calculate the sum of all menuitems
|
||||
summe = 0;
|
||||
foreach (var item in menuitemIds)
|
||||
{
|
||||
foreach (var item2 in menuitems)
|
||||
{
|
||||
if (item.Key == item2.IdmenuItem)
|
||||
{
|
||||
summe += item2.Preis * item.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if hour/minute is set, set the values
|
||||
if (localStorage.GetItem<int>("Hour") != 0)
|
||||
{
|
||||
hour = localStorage.GetItem<int>("Hour");
|
||||
}
|
||||
if (localStorage.GetItem<int>("Minute") != 0)
|
||||
{
|
||||
minute = localStorage.GetItem<int>("Minute");
|
||||
}
|
||||
|
||||
//
|
||||
}
|
||||
|
||||
public class Allergie
|
||||
{
|
||||
public int Idallergie { get; set; }
|
||||
|
||||
public string? Beschreibung { get; set; }
|
||||
|
||||
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
public class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int? Menge { get; set; }
|
||||
|
||||
public DateTime? Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
|
||||
|
||||
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public int? Treuepunkte { get; set; }
|
||||
|
||||
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
|
||||
public class Menuitem
|
||||
{
|
||||
public int IdmenuItem { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public string? Zusatzinformation { get; set; }
|
||||
|
||||
public decimal Preis { get; set; }
|
||||
|
||||
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
|
||||
|
||||
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
|
||||
|
||||
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
public class Menuitemkategorie
|
||||
{
|
||||
public int IdmenuItemKategorie { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
|
||||
|
||||
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
|
||||
}
|
||||
|
||||
public class Menuitemueberkategorie
|
||||
{
|
||||
public int IdmenuItemUeberkategorie { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
|
||||
}
|
||||
|
||||
public class Rabatt
|
||||
{
|
||||
public int Idrabatt { get; set; }
|
||||
|
||||
public decimal? Prozent { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitVon { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitBis { get; set; }
|
||||
|
||||
public bool Einloesen { get; set; }
|
||||
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
|
||||
}
|
||||
}
|
||||
|
@ -1,82 +1,173 @@
|
||||
@page "/Bestelluebersicht"
|
||||
@layout ChefinLayout
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
@*// logout button*@
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<button type="button" class="btn" @onclick="@Logout">Logout</button>
|
||||
</div>
|
||||
<div class="container d-flex flex-column">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<br /><br />
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Aktive Bestellungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="BDetail">#1234 12:30</a></td>
|
||||
<td><a href="BDetail">#2345 18:45</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#3456 13:00</a></td>
|
||||
<td><a href="BDetail">#4567 19:00</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#5678 14:30</a></td>
|
||||
<td><a href="BDetail">#6789 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#4321 15:15</a></td>
|
||||
<td><a href="BDetail">#5432 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#6543 15:30</a></td>
|
||||
<td><a href="BDetail">#7654 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#7654 15:30</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#8765 16:00</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#9876 17:30</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<br /><br />
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Aktive Bestellungen @day.@month.@year</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@*iterate all kunden*@
|
||||
@foreach (var kunde in kunden)
|
||||
{
|
||||
bool firstTime = true;
|
||||
|
||||
@*if kunde has made a recent bestellungsposiotn from today and higher value than now, print it*@
|
||||
@foreach (var bestellungsposition in bestellungspositions)
|
||||
{
|
||||
if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
|
||||
{
|
||||
@*get the last highes datum from Datum*@
|
||||
if (firstTime)
|
||||
{
|
||||
@*if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))*@
|
||||
@*{*@
|
||||
@*get hour and minute from datetime of last bestellungsposition*@
|
||||
hour = bestellungsposition.Datum.Hour;
|
||||
minute = bestellungsposition.Datum.Minute;
|
||||
day = bestellungsposition.Datum.Day;
|
||||
month = bestellungsposition.Datum.Month;
|
||||
year = bestellungsposition.Datum.Year;
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<p id="text" readonly >Abholzeit</p>
|
||||
<br />
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="30 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="45 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="1 Std" class="btn">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@*print only if date is higher than now datum, all expired hh:mm unvisible *@
|
||||
@*if (bestellungsposition.Datum > DateTime.Now)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<p @onclick="@(()=>BDetail(@kunde.Idkunde))" class="mb-0 pb-0">
|
||||
#@kunde.Code
|
||||
@hour:@minute
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
}*@
|
||||
@*print only if date is in current day month year *@
|
||||
if (bestellungsposition.Datum.Day == DateTime.Now.Day && bestellungsposition.Datum.Month == DateTime.Now.Month && bestellungsposition.Datum.Year == DateTime.Now.Year)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<p @onclick="@(()=>BDetail(@kunde.Idkunde))" class="mb-0 pb-0">
|
||||
#@kunde.Code
|
||||
@hour:@minute
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@* <p id="text" readonly>Abholzeit</p>
|
||||
<br />
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="30 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="45 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="1 Std" class="btn">
|
||||
</form>*@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
public int hour;
|
||||
public int minute;
|
||||
public int day;
|
||||
public int month;
|
||||
public int year;
|
||||
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
localStorage.Clear();
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
public void BDetail(int id)
|
||||
{
|
||||
localStorage.SetItem<int>("KundeId", id);
|
||||
_navigationManager.NavigateTo("/BestelluebersichtD-Chefin");
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// get data from api
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
// set hour, minute, day , month, year to now date
|
||||
hour = DateTime.Now.Hour;
|
||||
minute = DateTime.Now.Minute;
|
||||
day = DateTime.Now.Day;
|
||||
month = DateTime.Now.Month;
|
||||
year = DateTime.Now.Year;
|
||||
|
||||
//sort bestellungspositions by datum
|
||||
bestellungspositions = bestellungspositions.OrderByDescending(x => x.Datum).ToList();
|
||||
//sort kunden by the order of bestellungspositions
|
||||
List<Kunde> kundenSorted = new List<Kunde>();
|
||||
foreach (var bestellungsposition in bestellungspositions)
|
||||
{
|
||||
foreach (var kunde in kunden)
|
||||
{
|
||||
if (bestellungsposition.KundeIdkunde == kunde.Idkunde && !kundenSorted.Contains(kunde))
|
||||
{
|
||||
kundenSorted.Add(kunde);
|
||||
}
|
||||
}
|
||||
}
|
||||
kunden = kundenSorted;
|
||||
|
||||
}
|
||||
|
||||
public class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int Menge { get; set; }
|
||||
|
||||
public DateTime Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
}
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,131 +1,117 @@
|
||||
@page "/BestelluebersichtD-Chefin"
|
||||
@layout ChefinLayout
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@*// logout button*@
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<button type="button" class="btn" @onclick="@Logout">Logout</button>
|
||||
</div>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
@*Tabelle Ihre Bestellung*@
|
||||
<div class="tbl-container">
|
||||
<table class="table bdr">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td>Ihre Bestellung</td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg_lightgreen" style="background-color:white;">
|
||||
<tr>
|
||||
<td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;">
|
||||
1 Nudel mit Hühnerfleisch (groß)
|
||||
<div style="font-size:0.7rem;padding-left:15px;">mit Knoblauchsoße</div>
|
||||
</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:20px; padding-bottom:0px; border-style:hidden;">9,10€</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;">1 Coca Cola</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; border-style:hidden;">2,50€</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot class="bg_lightgreen">
|
||||
<tr style="border-top:solid 1px black; background-color:white;">
|
||||
<th class="" style="text-align:right;">Summe</th>
|
||||
<td class="d-flex justify-content-center align-items-center">11,60€</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
|
||||
<div class="d-flex flex-column align-items-center ">
|
||||
<div class="tbl-container w-100">
|
||||
<!-- <== overflow: hidden applied to parent -->
|
||||
<table class="table table-bordered bdr " style=" border-radius: 50px; margin-left: 50px;">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
||||
<p>Abholzeit</p>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; background-color:white;">
|
||||
<div style="margin:20px;">
|
||||
<div class="d-flex justify-content-center align-items-center" >
|
||||
<p>12:30 Uhr</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
@*Tabelle Ihre Bestellung*@
|
||||
<div class="tbl-container">
|
||||
<table class="table bdr">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td>Ihre Bestellung (@day.@month.@year)</td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg_lightgreen" style="background-color:white;">
|
||||
@if (menuitemIds.Count == 0)
|
||||
{
|
||||
<div class="card-body">
|
||||
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in menuitemIds)
|
||||
{
|
||||
@foreach (var item2 in menuitems)
|
||||
{
|
||||
@if (item.Key == item2.IdmenuItem)
|
||||
{
|
||||
<tr>
|
||||
|
||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
||||
<button class="btn_back w-75">Zurück</button>
|
||||
<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;">Bestellung auflösen</button>
|
||||
<button class="btn_forward w-75">Bestellung abschließen</button>
|
||||
</div>
|
||||
<td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;">
|
||||
@item.Value x
|
||||
@item2.Bezeichnung
|
||||
<div style="font-size:0.7rem;padding-left:15px;">@item2.Zusatzinformation</div>
|
||||
</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:20px; border-bottom-width:0px;">@(item2.Preis * item.Value)€</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
<tfoot class="bg_lightgreen">
|
||||
<tr style="border-top:solid 1px black; background-color:white;">
|
||||
<th class="" style="text-align:right;">Summe</th>
|
||||
<td class="d-flex justify-content-center align-items-center">
|
||||
@summe€
|
||||
@if (rabattEinloesen)
|
||||
{
|
||||
<span style="color:green;">(- @rabatt.Prozent%)</span>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
|
||||
<div class="d-flex flex-column align-items-center ">
|
||||
<div class="tbl-container w-100">
|
||||
<!-- <== overflow: hidden applied to parent -->
|
||||
<table class="table table-bordered bdr " style=" border-radius: 50px; ">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
||||
<p>Abholzeit</p>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; background-color:white;">
|
||||
<div style="margin:20px;">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<p>@hour:@minute Uhr (@day.@month.@year)</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
||||
@*<button class="btn_back w-75">Zurück</button>*@
|
||||
@*<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;" @onclick="Aufloesen">Bestellung auflösen</button>*@
|
||||
@*<button class="btn_forward w-75">Bestellung abschließen</button>*@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*Buttons*@
|
||||
|
||||
</div>
|
||||
|
||||
@*Buttons*@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@*<div class="h-100">
|
||||
@*Essen Abholen?
|
||||
@ -134,6 +120,177 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
@code {
|
||||
|
||||
public int hour;
|
||||
public int minute;
|
||||
public int day;
|
||||
public int month;
|
||||
public int year;
|
||||
|
||||
|
||||
public decimal summe;
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
private Rabatt rabatt = new Rabatt();
|
||||
private bool rabattEinloesen;
|
||||
|
||||
public decimal rabattGutschrift;
|
||||
|
||||
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||
private List<BestellungspositionHasMenuitem> bestellungspositionHasMenuitems = new List<BestellungspositionHasMenuitem>();
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
localStorage.Clear();
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
//public void Aufloesen()
|
||||
//{
|
||||
// foreach (var bestellungsposition in bestellungspositions)
|
||||
// {
|
||||
// foreach (var bestellungspositionHasMenuitem in bestellungspositionHasMenuitems)
|
||||
// {
|
||||
// if (bestellungsposition.Idbestellung == bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung)
|
||||
// {
|
||||
// Http.DeleteAsync("https://localhost:7076/api/BestellungspositionHasMenuitems/" + bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung + "/" + bestellungspositionHasMenuitem.MenuItem_IDMenuItem);
|
||||
// }
|
||||
// }
|
||||
// if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
|
||||
// {
|
||||
// Http.DeleteAsync("https://localhost:7076/api/Bestellungspositionen/" + bestellungsposition.Idbestellung);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// get data from api
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
|
||||
|
||||
|
||||
// get kunde from localstorage
|
||||
int kundeId = localStorage.GetItem<int>("KundeId");
|
||||
kunde = kunden.Where(x => x.Idkunde == kundeId).FirstOrDefault();
|
||||
|
||||
// get all menuitemIds from bestellungspositions with the last date
|
||||
foreach (var bestellungsposition in bestellungspositions)
|
||||
{
|
||||
if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
|
||||
{
|
||||
//if (bestellungsposition.Datum == bestellungspositions.Max(x => x.Datum))
|
||||
//{
|
||||
|
||||
// get hour and minute from datetime of last bestellungsposition
|
||||
hour = bestellungsposition.Datum.Hour;
|
||||
minute = bestellungsposition.Datum.Minute;
|
||||
day = bestellungsposition.Datum.Day;
|
||||
month = bestellungsposition.Datum.Month;
|
||||
year = bestellungsposition.Datum.Year;
|
||||
|
||||
//if rabatt is used
|
||||
if (bestellungsposition.RabattIdrabatt != null)
|
||||
{
|
||||
rabattEinloesen = true;
|
||||
foreach (var rabatt in rabatte)
|
||||
{
|
||||
if (rabatt.Idrabatt == bestellungsposition.RabattIdrabatt)
|
||||
{
|
||||
this.rabatt = rabatt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var bestellungspositionHasMenuitem in bestellungspositionHasMenuitems)
|
||||
{
|
||||
if (bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung == bestellungsposition.Idbestellung)
|
||||
{
|
||||
menuitemIds.Add(bestellungspositionHasMenuitem.MenuItem_IDMenuItem, bestellungsposition.Menge);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
// get summe
|
||||
foreach (var menuitem in menuitems)
|
||||
{
|
||||
foreach (var menuitemId in menuitemIds)
|
||||
{
|
||||
if (menuitem.IdmenuItem == menuitemId.Key)
|
||||
{
|
||||
summe += menuitem.Preis * menuitemId.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if rabatt is used calculate new summe
|
||||
if (rabattEinloesen)
|
||||
{
|
||||
rabattGutschrift = (summe * rabatt.Prozent / 100);
|
||||
summe = summe - rabattGutschrift;
|
||||
summe = Math.Round(summe, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int Menge { get; set; }
|
||||
|
||||
public DateTime Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
}
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public int? Treuepunkte { get; set; }
|
||||
}
|
||||
|
||||
public class Menuitem
|
||||
{
|
||||
public int IdmenuItem { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public string? Zusatzinformation { get; set; }
|
||||
|
||||
public decimal Preis { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Rabatt
|
||||
{
|
||||
public int Idrabatt { get; set; }
|
||||
|
||||
public decimal Prozent { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitVon { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitBis { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class BestellungspositionHasMenuitem
|
||||
{
|
||||
public int Bestellungsposition_IDBestellung { get; set; }
|
||||
public int MenuItem_IDMenuItem { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,36 @@
|
||||
@page "/FBestätigung"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h4>Vielen Dank für Ihr Feedback. Durch Feedbacks können wir uns stets verbessern.<br></h4>
|
||||
|
||||
@ -7,9 +38,3 @@
|
||||
<input type="submit" value="Zur Startseite" class="btn">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,37 @@
|
||||
@page "/Feedback"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
<body>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h4 for="feedback">Ihr Feedback: </h4>
|
||||
@ -14,8 +46,4 @@
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
</body>
|
@ -1,30 +1,304 @@
|
||||
@page "/Kontoverwaltung"
|
||||
|
||||
<h3>Wichtige Informationen</h3> <br>
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h3>Wichtige Informationen</h3>
|
||||
<br>
|
||||
|
||||
|
||||
@*log out Button *@
|
||||
<div class="container mt-auto">
|
||||
<button class="btn" type="button" onclick="@Logout" id="button1">Abmelden</button>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<div class="container mt-auto">
|
||||
<h4>AccountID: @RegistrierungA.userName</h4>
|
||||
<h4>Ihr QR-Code: </h4>
|
||||
<img src="assets/K-QR.png" class="img" title="logo image">
|
||||
<h4>AccountID: @kunde.Code</h4>
|
||||
<h4>Ihr QR-Code: </h4>
|
||||
<img src="assets/K-QR.png" class="img" title="logo image">
|
||||
|
||||
<p><br>Ihr Konto wird 30 Tage nach der Deaktivierung unwiderruflich gelöscht.</p>
|
||||
<button class="btn" type="button" onclick="@ChangeButton" id="button1">@button1</button>
|
||||
|
||||
<p><br>Ihr Konto wird 30 Tage nach der Deaktivierung unwiderruflich gelöscht.</p>
|
||||
<button class="btn" type="button" onclick="@ChangeButton" id="button1">@button1</button>
|
||||
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
<div class="container mt-auto">
|
||||
<h1>Bestellübersicht</h1>
|
||||
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
@*Tabelle Ihre Bestellung*@
|
||||
<div class="tbl-container">
|
||||
<table class="table bdr">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td>Ihre Bestellung (@day.@month.@year)</td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg_lightgreen" style="background-color:white;">
|
||||
@if (menuitemIds.Count == 0)
|
||||
{
|
||||
<div class="card-body">
|
||||
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in menuitemIds)
|
||||
{
|
||||
@foreach (var item2 in menuitems)
|
||||
{
|
||||
@if (item.Key == item2.IdmenuItem)
|
||||
{
|
||||
<tr>
|
||||
|
||||
<td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;">
|
||||
@item.Value x
|
||||
@item2.Bezeichnung
|
||||
<div style="font-size:0.7rem;padding-left:15px;">@item2.Zusatzinformation</div>
|
||||
</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:20px; border-bottom-width:0px;">@(item2.Preis * item.Value)€</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
<tfoot class="bg_lightgreen">
|
||||
<tr style="border-top:solid 1px black; background-color:white;">
|
||||
<th class="" style="text-align:right;">Summe</th>
|
||||
<td class="d-flex justify-content-center align-items-center">
|
||||
@summe€
|
||||
@if (rabattEinloesen)
|
||||
{
|
||||
<span style="color:green;">(- @rabatt.Prozent%)</span>
|
||||
}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
|
||||
<div class="d-flex flex-column align-items-center ">
|
||||
<div class="tbl-container w-100">
|
||||
<!-- <== overflow: hidden applied to parent -->
|
||||
<table class="table table-bordered bdr " style=" border-radius: 50px; margin-left: 50px;">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
||||
<p>Abholzeit</p>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; background-color:white;">
|
||||
<div style="margin:20px;">
|
||||
<div class="d-flex justify-content-center align-items-center">
|
||||
<p>@hour:@minute Uhr (@day.@month.@year)</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
||||
@*<button class="btn_back w-75">Zurück</button>*@
|
||||
@*<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;">Bestellung auflösen</button>*@
|
||||
@*<button class="btn_forward w-75">Bestellung abschließen</button>*@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
bool changeButtonBool { get; set; } = true;
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
string button1 => changeButtonBool ? "Konto deaktivieren" : "Konto aktivieren";
|
||||
bool changeButtonBool { get; set; } = true;
|
||||
|
||||
void ChangeButton()
|
||||
{
|
||||
//TODO Datenbankaktualisierung
|
||||
changeButtonBool = !changeButtonBool;
|
||||
}
|
||||
string button1 => changeButtonBool ? "Konto deaktivieren" : "Konto aktivieren";
|
||||
|
||||
void ChangeButton()
|
||||
{
|
||||
//TODO Datenbankaktualisierung
|
||||
changeButtonBool = !changeButtonBool;
|
||||
}
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
localStorage.Clear();
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
|
||||
public int hour;
|
||||
public int minute;
|
||||
public int day;
|
||||
public int month;
|
||||
public int year;
|
||||
|
||||
|
||||
public decimal summe;
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
private Rabatt rabatt = new Rabatt();
|
||||
private bool rabattEinloesen;
|
||||
|
||||
public decimal rabattGutschrift;
|
||||
|
||||
|
||||
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
|
||||
private List<Menuitem> menuitems = new List<Menuitem>();
|
||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||
private List<BestellungspositionHasMenuitem> bestellungspositionHasMenuitems = new List<BestellungspositionHasMenuitem>();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
// get data from api
|
||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
|
||||
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
|
||||
// get all menuitemIds from bestellungspositions with the last date
|
||||
foreach (Bestellungsposition bestellungsposition in bestellungspositions)
|
||||
{
|
||||
if (bestellungsposition.KundeIdkunde == kunde.Idkunde)
|
||||
{
|
||||
|
||||
// get hour and minute from datetime of last bestellungsposition
|
||||
hour = bestellungsposition.Datum.Hour;
|
||||
minute = bestellungsposition.Datum.Minute;
|
||||
day = bestellungsposition.Datum.Day;
|
||||
month = bestellungsposition.Datum.Month;
|
||||
year = bestellungsposition.Datum.Year;
|
||||
|
||||
//if rabatt is used
|
||||
if (bestellungsposition.RabattIdrabatt != null)
|
||||
{
|
||||
rabattEinloesen = true;
|
||||
foreach (var rabatt in rabatte)
|
||||
{
|
||||
if (rabatt.Idrabatt == bestellungsposition.RabattIdrabatt)
|
||||
{
|
||||
this.rabatt = rabatt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var bestellungspositionHasMenuitem in bestellungspositionHasMenuitems)
|
||||
{
|
||||
if (bestellungspositionHasMenuitem.Bestellungsposition_IDBestellung == bestellungsposition.Idbestellung)
|
||||
{
|
||||
menuitemIds.Add(bestellungspositionHasMenuitem.MenuItem_IDMenuItem, bestellungsposition.Menge);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// get summe
|
||||
foreach (var menuitem in menuitems)
|
||||
{
|
||||
foreach (var menuitemId in menuitemIds)
|
||||
{
|
||||
if (menuitem.IdmenuItem == menuitemId.Key)
|
||||
{
|
||||
summe += menuitem.Preis * menuitemId.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
//if rabatt is used calculate new summe
|
||||
if (rabattEinloesen)
|
||||
{
|
||||
rabattGutschrift = (summe * rabatt.Prozent / 100);
|
||||
summe = summe - rabattGutschrift;
|
||||
summe = Math.Round(summe, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public class Bestellungsposition
|
||||
{
|
||||
public int Idbestellung { get; set; }
|
||||
|
||||
public int Menge { get; set; }
|
||||
|
||||
public DateTime Datum { get; set; }
|
||||
|
||||
public int KundeIdkunde { get; set; }
|
||||
|
||||
public int? RabattIdrabatt { get; set; }
|
||||
|
||||
}
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public int? Treuepunkte { get; set; }
|
||||
}
|
||||
|
||||
public class Menuitem
|
||||
{
|
||||
public int IdmenuItem { get; set; }
|
||||
|
||||
public string? Bezeichnung { get; set; }
|
||||
|
||||
public string? Zusatzinformation { get; set; }
|
||||
|
||||
public decimal Preis { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class Rabatt
|
||||
{
|
||||
public int Idrabatt { get; set; }
|
||||
|
||||
public decimal Prozent { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitVon { get; set; }
|
||||
|
||||
public DateTime? GueltigkeitBis { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class BestellungspositionHasMenuitem
|
||||
{
|
||||
public int Bestellungsposition_IDBestellung { get; set; }
|
||||
public int MenuItem_IDMenuItem { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,61 +1,93 @@
|
||||
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
||||
<div class="container-fluid">
|
||||
@*<a class="navbar-brand" href="">Yummy4Friends</a>*@
|
||||
<a class="navbar-brand" href="">
|
||||
<img src="assets/Logo_new.png" alt="Yummy4Friends" width="60px" height="auto">
|
||||
</a>
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<button class="navbar-toggler @NavButtonCssClass" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
|
||||
aria-controls="navbarCollapse" aria-label="Toggle navigation" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end @NavBarCssClass" id="navbarCollapse" @onclick="ToggleNavMenu">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="allergene">
|
||||
Allergene
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="speisekarte">
|
||||
Speisekarte
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="yummy-punkte">
|
||||
Yummy-Punkte
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="shopping_cart">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-cart3" viewBox="0 0 16 16">
|
||||
<path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .49.598l-1 5a.5.5 0 0 1-.465.401l-9.397.472L4.415 11H13a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l.84 4.479 9.144-.459L13.89 4H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" />
|
||||
</svg>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Kontoverwaltung">
|
||||
#12345
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
||||
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" />
|
||||
</svg>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
||||
<div class="container-fluid">
|
||||
@*<a class="navbar-brand" href="">Yummy4Friends</a>*@
|
||||
<a class="navbar-brand" href="">
|
||||
<img src="assets/Logo_new.png" alt="Yummy4Friends" width="60px" height="auto">
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler @NavButtonCssClass" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
|
||||
aria-controls="navbarCollapse" aria-label="Toggle navigation" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end @NavBarCssClass" id="navbarCollapse" @onclick="ToggleNavMenu">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="allergene">
|
||||
Allergene
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="speisekarte">
|
||||
Speisekarte
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="yummy-punkte">
|
||||
Yummy-Punkte
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="shopping_cart">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-cart3" viewBox="0 0 16 16">
|
||||
<path d="M0 1.5A.5.5 0 0 1 .5 1H2a.5.5 0 0 1 .485.379L2.89 3H14.5a.5.5 0 0 1 .49.598l-1 5a.5.5 0 0 1-.465.401l-9.397.472L4.415 11H13a.5.5 0 0 1 0 1H4a.5.5 0 0 1-.491-.408L2.01 3.607 1.61 2H.5a.5.5 0 0 1-.5-.5zM3.102 4l.84 4.479 9.144-.459L13.89 4H3.102zM5 12a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm7 0a2 2 0 1 0 0 4 2 2 0 0 0 0-4zm-7 1a1 1 0 1 1 0 2 1 1 0 0 1 0-2zm7 0a1 1 0 1 1 0 2 1 1 0 0 1 0-2z" />
|
||||
</svg>
|
||||
</NavLink>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Kontoverwaltung">
|
||||
#@kunde.Code
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
||||
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" />
|
||||
</svg>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@code {
|
||||
private bool collapseNavMenu = true;
|
||||
private string? NavBarCssClass => collapseNavMenu ? null : "show";
|
||||
private string? NavButtonCssClass => collapseNavMenu ? "collapsed" : null;
|
||||
private bool collapseNavMenu = true;
|
||||
private string? NavBarCssClass => collapseNavMenu ? null : "show";
|
||||
private string? NavButtonCssClass => collapseNavMenu ? "collapsed" : null;
|
||||
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
@ -1,36 +1,78 @@
|
||||
@page "/RegistrierungA"
|
||||
@using System.Text;
|
||||
@using System.Security.Cryptography;
|
||||
@layout Registrierung
|
||||
@inject NavigationManager NavManager
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
@inject IJSRuntime JSRuntime;
|
||||
|
||||
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<p>Benutzername:</p>
|
||||
<p>Benutzername:</p>
|
||||
|
||||
<input type="text" class="form-control" id="name" name="name" @bind="@inputName">
|
||||
<input type="text" class="form-control" id="name" name="name" @bind="@inputName">
|
||||
|
||||
<p>Passwort:</p>
|
||||
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword">
|
||||
|
||||
<button type="button" class="btn" @onclick="@Login">Login</button>
|
||||
<p>Passwort:</p>
|
||||
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword">
|
||||
|
||||
<button type="button" class="btn" @onclick="@Login">Login</button>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
public string inputName { get; set; } = string.Empty;
|
||||
public string inputPassword { get; set; } = string.Empty;
|
||||
public string inputName { get; set; }
|
||||
public string inputPassword { get; set; }
|
||||
public string inputPasswordEnc { get; set; }
|
||||
|
||||
public static string userName { get; set; } = string.Empty;
|
||||
private List<Admin> admins = new List<Admin>();
|
||||
private Admin admin = new Admin();
|
||||
|
||||
public void Login() {
|
||||
if (inputName == userDataName && inputPassword == userDataPassword) {
|
||||
localStorage.SetItem("name", inputName);
|
||||
userName = localStorage.GetItem<string>("name");
|
||||
NavManager.NavigateTo("/Bestelluebersicht");
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Login()
|
||||
{
|
||||
// if inputName and inputPassword is not null
|
||||
if (string.IsNullOrEmpty(inputName) || string.IsNullOrEmpty(inputPassword))
|
||||
{
|
||||
JSRuntime.InvokeVoidAsync("alert", "Benutzernamen oder Passwort ist falsch!");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
//encode inputpassword
|
||||
inputPasswordEnc = Convert.ToHexString(SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(inputPassword)));
|
||||
|
||||
@code {
|
||||
public string userDataName { get; set; } = "";
|
||||
public string userDataPassword { get; set; } = "";
|
||||
// if inputName is in admins with the encrypt SHA512 password
|
||||
if (admins.Any(a => a.Username == inputName && a.Password == inputPasswordEnc))
|
||||
{
|
||||
localStorage.SetItem("admin", admins.First(a => a.Username == inputName && a.Password == inputPasswordEnc));
|
||||
|
||||
_navigationManager.NavigateTo("/Bestelluebersicht");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
admins = await Http.GetFromJsonAsync<List<Admin>>("https://localhost:7076/api/admins");
|
||||
|
||||
// if already logged in navigate to Bestelluebersicht
|
||||
// if localsorage admin object is valid from the api
|
||||
if (localStorage.ContainKey("admin"))
|
||||
{
|
||||
admin = localStorage.GetItem<Admin>("admin");
|
||||
|
||||
if (admin != null && !admins.Any(a => a.Username == admin.Username && a.Password == admin.Password))
|
||||
_navigationManager.NavigateTo("/RegistrierungA");
|
||||
else
|
||||
_navigationManager.NavigateTo("/Bestelluebersicht");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class Admin
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
@page "/Yummy-Punkte"
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<body>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
@ -59,10 +60,23 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// kunde login start
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
|
||||
if (localStorage.ContainKey("kunde"))
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
else
|
||||
_navigationManager.NavigateTo("/");
|
||||
|
||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||
_navigationManager.NavigateTo("/");
|
||||
// kunde login end
|
||||
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
|
||||
kunde = kunden[0];
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
|
Loading…
Reference in New Issue
Block a user