mirror of
https://github.com/yummy4friends/y4f.git
synced 2025-07-18 04:53:18 +02:00
Compare commits
5 Commits
dev
...
72cffa664e
Author | SHA1 | Date | |
---|---|---|---|
72cffa664e | |||
8d4d8338aa | |||
9add5ac628 | |||
32bedc209c | |||
c9f10887ee |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,7 +2,6 @@
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
.vscode
|
||||
.vs
|
||||
*/.vs
|
||||
*.suo
|
||||
|
@ -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 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.
|
||||
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.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
|
@ -1,36 +1,5 @@
|
||||
@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">
|
||||
@ -118,8 +87,4 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<br><br><br><br>
|
@ -1,33 +1,5 @@
|
||||
@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,33 +1,5 @@
|
||||
@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>
|
||||
|
57
src/y4f/Pages/FetchData.razor
Normal file
57
src/y4f/Pages/FetchData.razor
Normal file
@ -0,0 +1,57 @@
|
||||
@page "/fetchdata"
|
||||
@inject HttpClient Http
|
||||
|
||||
<PageTitle>Weather forecast</PageTitle>
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from the server.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
|
||||
}
|
||||
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public string? Summary { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
}
|
||||
}
|
@ -1,66 +1,20 @@
|
||||
@page "/"
|
||||
@layout Startseite
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
@inject IJSRuntime JSRuntime;
|
||||
@page "/"
|
||||
@layout Startseite
|
||||
|
||||
|
||||
<PageTitle>Yummy4Friends</PageTitle>
|
||||
|
||||
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%"; background-color:#C7FFD5;'>
|
||||
|
||||
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content" style=" padding-left:10%; padding-right:10%;">
|
||||
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%"; background-color:#C7FFD5;'>
|
||||
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<center><h1>Herzlich Willkommen!</h1></center>
|
||||
|
||||
<img src="assets/Logo_new.png" class="img" title="logo image">
|
||||
|
||||
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode" @bind-value="@qrcodeValue">
|
||||
|
||||
<button type="submit" id="button1" class="btn" @onclick="@(() => CheckCode())">Bestätigen</button>
|
||||
<form action="Speisekarte">
|
||||
<input type="submit" value="Zur Speisekarte" class="btn" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
@code {
|
||||
private string qrcodeValue;
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
|
||||
public void CheckCode()
|
||||
{
|
||||
foreach (var kunde in kunden)
|
||||
{
|
||||
if (kunde.Code == qrcodeValue)
|
||||
{
|
||||
localStorage.SetItem("kunde", kunde);
|
||||
_navigationManager.NavigateTo("/speisekarte");
|
||||
|
||||
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
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,37 +1,5 @@
|
||||
@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>
|
||||
|
@ -122,9 +122,6 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public int hour;
|
||||
public int minute;
|
||||
private void UpdateTime()
|
||||
@ -185,6 +182,7 @@
|
||||
// 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>();
|
||||
@ -192,17 +190,6 @@
|
||||
|
||||
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)
|
||||
{
|
||||
@ -212,6 +199,7 @@
|
||||
// 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");
|
||||
|
@ -1,9 +1,6 @@
|
||||
@page "/Speisekarte"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
<h1>Speisekarte</h1>
|
||||
<div class="row justify-content-center">
|
||||
@ -26,39 +23,18 @@
|
||||
<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")
|
||||
{
|
||||
@ -68,9 +44,15 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<tr>
|
||||
<td><a href="/">@item2.Bezeichnung</a></td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
}
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="lowest"><br></td>
|
||||
|
||||
@ -88,24 +70,11 @@
|
||||
|
||||
|
||||
@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>();
|
||||
|
||||
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("/");
|
||||
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/MenuItemKategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/MenuItemUeberkategories");
|
||||
}
|
||||
@ -128,11 +97,4 @@
|
||||
}
|
||||
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h1>Speisekarte Chinesisch</h1>
|
||||
<div class="container">
|
||||
@ -90,9 +89,6 @@
|
||||
|
||||
|
||||
@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)
|
||||
@ -111,6 +107,7 @@
|
||||
|
||||
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>();
|
||||
@ -118,18 +115,6 @@
|
||||
|
||||
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
|
||||
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
@ -137,6 +122,7 @@
|
||||
|
||||
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");
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h1>Speisekarte Getränke</h1>
|
||||
@* create an container bootstrap 5*@
|
||||
@ -94,8 +93,6 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -117,6 +114,7 @@
|
||||
|
||||
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,18 +122,6 @@
|
||||
|
||||
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
|
||||
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
@ -143,6 +129,7 @@
|
||||
|
||||
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");
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h1>Speisekarte Sonstiges</h1>
|
||||
@* create an container bootstrap 5*@
|
||||
@ -93,9 +92,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -115,6 +117,7 @@
|
||||
|
||||
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,24 +125,13 @@
|
||||
|
||||
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
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
}
|
||||
|
||||
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");
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h1>Speisekarte Japanisch</h1>
|
||||
@* create an container bootstrap 5*@
|
||||
@ -93,8 +92,6 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
|
||||
|
||||
@ -114,6 +111,7 @@
|
||||
|
||||
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,24 +119,13 @@
|
||||
|
||||
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
|
||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||
{
|
||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||
}
|
||||
|
||||
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");
|
||||
|
51
src/y4f/Pages/TestFetchAllergienData.razor
Normal file
51
src/y4f/Pages/TestFetchAllergienData.razor
Normal file
@ -0,0 +1,51 @@
|
||||
@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,37 +1,5 @@
|
||||
@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">
|
||||
|
||||
|
@ -83,20 +83,10 @@
|
||||
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
|
||||
@ -116,7 +106,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in menuitemIds)
|
||||
{
|
||||
bestellungspositionId++;
|
||||
@ -139,25 +128,18 @@
|
||||
|
||||
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;
|
||||
//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);
|
||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", bestellungspositionHasMenuItem);
|
||||
}
|
||||
|
||||
|
||||
// delete all localStorage
|
||||
localStorage.SetItem("MenuItemIds", new Dictionary<int, int>());
|
||||
//localStorage.SetItem("Hour", 0);
|
||||
//localStorage.SetItem("Minute", 0);
|
||||
localStorage.SetItem("Summe", 0);
|
||||
localStorage.SetItem("RabattEinloesen", false);
|
||||
|
||||
@ -174,29 +156,18 @@
|
||||
|
||||
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");
|
||||
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
|
||||
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
// test use the first kunde
|
||||
kunde = kunden[0];
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
@ -335,7 +306,7 @@
|
||||
|
||||
public class BestellungspositionHasMenuitem
|
||||
{
|
||||
public int Bestellungsposition_IDBestellung { get; set; }
|
||||
public int MenuItem_IDMenuItem { get; set; }
|
||||
public int? Bestellungsposition_IDBestellung { get; set; }
|
||||
public int? MenuItem_IDMenuItem { get; set; }
|
||||
}
|
||||
}
|
@ -75,18 +75,6 @@
|
||||
|
||||
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");
|
||||
@ -96,8 +84,8 @@
|
||||
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");
|
||||
// test use the first kunde
|
||||
kunde = kunden[0];
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
|
@ -1,81 +1,65 @@
|
||||
@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-12">
|
||||
<div class="col-lg-8">
|
||||
<br /><br />
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Aktive Bestellungen @day.@month.@year</th>
|
||||
<th colspan="2">Aktive Bestellungen</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;
|
||||
|
||||
@*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>
|
||||
<td><a href="BDetail">#1234 12:30</a></td>
|
||||
<td><a href="BDetail">#2345 18:45</a></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>
|
||||
<td><a href="BDetail">#3456 13:00</a></td>
|
||||
<td><a href="BDetail">#4567 19:00</a></td>
|
||||
|
||||
</tr>
|
||||
}
|
||||
firstTime = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@* <p id="text" readonly>Abholzeit</p>
|
||||
<p id="text" readonly >Abholzeit</p>
|
||||
<br />
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="30 Min" class="btn">
|
||||
@ -85,7 +69,7 @@
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="1 Std" class="btn">
|
||||
</form>*@
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@ -94,80 +78,5 @@
|
||||
|
||||
|
||||
@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,69 +1,83 @@
|
||||
@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 (@day.@month.@year)</td>
|
||||
<td>Ihre Bestellung</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>
|
||||
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; border-bottom-width:0px;">@(item2.Preis * item.Value)€</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">
|
||||
@summe€
|
||||
@if (rabattEinloesen)
|
||||
{
|
||||
<span style="color:green;">(- @rabatt.Prozent%)</span>
|
||||
}
|
||||
</td>
|
||||
<td class="d-flex justify-content-center align-items-center">11,60€</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
@ -76,7 +90,7 @@
|
||||
<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; ">
|
||||
<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;">
|
||||
@ -84,12 +98,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<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 class="d-flex justify-content-center align-items-center" >
|
||||
<p>12:30 Uhr</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -98,9 +112,9 @@
|
||||
</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>*@
|
||||
<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>
|
||||
@ -110,7 +124,7 @@
|
||||
|
||||
@*Buttons*@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@*<div class="h-100">
|
||||
@ -120,177 +134,6 @@
|
||||
</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,36 +1,5 @@
|
||||
@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>
|
||||
|
||||
@ -38,3 +7,9 @@
|
||||
<input type="submit" value="Zur Startseite" class="btn">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
@ -1,37 +1,5 @@
|
||||
@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>
|
||||
@ -47,3 +15,7 @@
|
||||
</div>
|
||||
|
||||
</body>
|
||||
@code {
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,6 @@
|
||||
<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: @kunde.Code</h4>
|
||||
@ -69,6 +64,7 @@
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
@ -131,9 +127,6 @@
|
||||
|
||||
|
||||
@code {
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
bool changeButtonBool { get; set; } = true;
|
||||
|
||||
string button1 => changeButtonBool ? "Konto deaktivieren" : "Konto aktivieren";
|
||||
@ -144,12 +137,11 @@
|
||||
changeButtonBool = !changeButtonBool;
|
||||
}
|
||||
|
||||
public void Logout()
|
||||
{
|
||||
localStorage.Clear();
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
public int hour;
|
||||
public int minute;
|
||||
public int day;
|
||||
@ -166,24 +158,14 @@
|
||||
|
||||
|
||||
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>();
|
||||
|
||||
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");
|
||||
@ -191,13 +173,15 @@
|
||||
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");
|
||||
|
||||
// use kudnde with id 1
|
||||
kunde = kunden[0];
|
||||
// get all menuitemIds from bestellungspositions with the last date
|
||||
foreach (Bestellungsposition bestellungsposition in bestellungspositions)
|
||||
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
|
||||
@ -229,6 +213,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// get summe
|
||||
foreach (var menuitem in menuitems)
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
|
||||
|
||||
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
||||
<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="">
|
||||
@ -43,7 +37,7 @@
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="Kontoverwaltung">
|
||||
#@kunde.Code
|
||||
#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>
|
||||
@ -64,30 +58,4 @@
|
||||
{
|
||||
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,12 +1,7 @@
|
||||
@page "/RegistrierungA"
|
||||
@using System.Text;
|
||||
@using System.Security.Cryptography;
|
||||
@layout Registrierung
|
||||
@inject HttpClient Http
|
||||
@inject NavigationManager NavManager
|
||||
@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>
|
||||
@ -21,58 +16,21 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
public string inputName { get; set; }
|
||||
public string inputPassword { get; set; }
|
||||
public string inputPasswordEnc { get; set; }
|
||||
public string inputName { get; set; } = string.Empty;
|
||||
public string inputPassword { get; set; } = string.Empty;
|
||||
|
||||
private List<Admin> admins = new List<Admin>();
|
||||
private Admin admin = new Admin();
|
||||
public static string userName { get; set; } = string.Empty;
|
||||
|
||||
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;
|
||||
public void Login() {
|
||||
if (inputName == userDataName && inputPassword == userDataPassword) {
|
||||
localStorage.SetItem("name", inputName);
|
||||
userName = localStorage.GetItem<string>("name");
|
||||
NavManager.NavigateTo("/Bestelluebersicht");
|
||||
}
|
||||
else
|
||||
{
|
||||
//encode inputpassword
|
||||
inputPasswordEnc = Convert.ToHexString(SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(inputPassword)));
|
||||
|
||||
// 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; }
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
public string userDataName { get; set; } = "";
|
||||
public string userDataPassword { get; set; } = "";
|
||||
}
|
16
src/y4f/Shared/SurveyPrompt.razor
Normal file
16
src/y4f/Shared/SurveyPrompt.razor
Normal file
@ -0,0 +1,16 @@
|
||||
<div class="alert alert-secondary mt-4">
|
||||
<span class="oi oi-pencil me-2" aria-hidden="true"></span>
|
||||
<strong>@Title</strong>
|
||||
|
||||
<span class="text-nowrap">
|
||||
Please take our
|
||||
<a target="_blank" class="font-weight-bold link-dark" href="https://go.microsoft.com/fwlink/?linkid=2186157">brief survey</a>
|
||||
</span>
|
||||
and tell us what you think.
|
||||
</div>
|
||||
|
||||
@code {
|
||||
// Demonstrates how a parent component can supply parameters
|
||||
[Parameter]
|
||||
public string? Title { get; set; }
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
@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">
|
||||
@ -60,23 +59,10 @@
|
||||
|
||||
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");
|
||||
|
||||
// get kunde from local storage
|
||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
kunde = kunden[0];
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
|
@ -3,29 +3,20 @@
|
||||
html, body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#content {
|
||||
background-color: #C7FFD1;
|
||||
padding: 5%;
|
||||
margin-top: 1%;
|
||||
border-radius: 10px;
|
||||
position: center;
|
||||
}
|
||||
#button1 {
|
||||
background-color: #89F9A5;
|
||||
border-radius: 50px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
h1 {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.img {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
margin: 5%;
|
||||
margin: 10%;
|
||||
}
|
||||
|
||||
form {
|
||||
@ -35,17 +26,3 @@ form {
|
||||
|
||||
}
|
||||
|
||||
p {
|
||||
color: grey;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-bottom: 20px;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
border-radius: 50px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user