mirror of
https://github.com/yummy4friends/y4f.git
synced 2025-07-18 15:15:53 +02:00
Compare commits
15 Commits
3356a91d47
...
dev
Author | SHA1 | Date | |
---|---|---|---|
eeb14ead3c | |||
3c765ff57d | |||
3a4064198d | |||
6c627add92 | |||
901d533cd1 | |||
28327710f8 | |||
b2dc8402f2
|
|||
35345e455c
|
|||
c85415e740
|
|||
7cd20602b6
|
|||
d45fa68fe0 | |||
a9418aea33 | |||
7b8db08d99 | |||
ba6266579d | |||
9781d94d6e |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@
|
|||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
# User-specific files
|
# User-specific files
|
||||||
|
.vscode
|
||||||
.vs
|
.vs
|
||||||
*/.vs
|
*/.vs
|
||||||
*.suo
|
*.suo
|
||||||
|
@ -6,7 +6,7 @@ Yummy4Friends ist eine benutzerfreundliche und visuell ansprechende Webapp zur O
|
|||||||
|
|
||||||
## Description (English)
|
## 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
|
## Tech Stack
|
||||||
|
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
@inject HttpClient Http
|
@inject HttpClient Http
|
||||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||||
@inject NavigationManager _navigationManager
|
@inject NavigationManager _navigationManager
|
||||||
|
@inject IJSRuntime JSRuntime;
|
||||||
|
|
||||||
|
|
||||||
<PageTitle>Yummy4Friends</PageTitle>
|
<PageTitle>Yummy4Friends</PageTitle>
|
||||||
|
|
||||||
@ -32,14 +34,25 @@
|
|||||||
{
|
{
|
||||||
localStorage.SetItem("kunde", kunde);
|
localStorage.SetItem("kunde", kunde);
|
||||||
_navigationManager.NavigateTo("/speisekarte");
|
_navigationManager.NavigateTo("/speisekarte");
|
||||||
break;
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
JSRuntime.InvokeVoidAsync("alert", "Zugangscode ist falsch!");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
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 class Kunde
|
||||||
@ -51,6 +64,3 @@
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,18 +26,39 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="/SpeisekarteChinesich">@item2.Bezeichnung</a></td>
|
<td><a href="/SpeisekarteChinesich">@item2.Bezeichnung</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (@item2.Bezeichnung == "Nachspeise")
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="lowest"><br></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (@item.Bezeichnung == "Japanisch")
|
else if (@item.Bezeichnung == "Japanisch")
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/SpeisekarteJapanisch">@item2.Bezeichnung</a></td>
|
<td><a href="/SpeisekarteJapanisch">@item2.Bezeichnung</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (@item2.Bezeichnung == "Nachspeise")
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="lowest"><br></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (@item.Bezeichnung == "Getränke")
|
else if (@item.Bezeichnung == "Getränke")
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/SpeisekarteGetraenke">@item2.Bezeichnung</a></td>
|
<td><a href="/SpeisekarteGetraenke">@item2.Bezeichnung</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@if (@item2.Bezeichnung == "Bier")
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td class="lowest"><br></td>
|
||||||
|
</tr><tr>
|
||||||
|
<td class="lowest"><br></td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (@item.Bezeichnung == "Sonstiges")
|
else if (@item.Bezeichnung == "Sonstiges")
|
||||||
{
|
{
|
||||||
@ -47,15 +68,9 @@
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<tr>
|
|
||||||
<td><a href="/">@item2.Bezeichnung</a></td>
|
|
||||||
</tr>
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<tr>
|
|
||||||
<td class="lowest"><br></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="lowest"><br></td>
|
<td class="lowest"><br></td>
|
||||||
|
|
||||||
@ -120,3 +135,4 @@
|
|||||||
public int Treuepunkte { get; set; }
|
public int Treuepunkte { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,6 @@
|
|||||||
|
|
||||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
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");
|
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||||
|
@ -143,7 +143,6 @@
|
|||||||
|
|
||||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
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");
|
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||||
|
@ -93,11 +93,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private List<Kunde> kunden = new List<Kunde>();
|
private List<Kunde> kunden = new List<Kunde>();
|
||||||
private Kunde kunde = new Kunde();
|
private Kunde kunde = new Kunde();
|
||||||
@ -142,9 +137,9 @@
|
|||||||
{
|
{
|
||||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||||
}
|
}
|
||||||
|
|
||||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
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");
|
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||||
|
@ -132,14 +132,13 @@
|
|||||||
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
|
||||||
_navigationManager.NavigateTo("/");
|
_navigationManager.NavigateTo("/");
|
||||||
// kunde login end
|
// kunde login end
|
||||||
|
|
||||||
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
|
||||||
{
|
{
|
||||||
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
|
||||||
}
|
}
|
||||||
|
|
||||||
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
|
||||||
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
|
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");
|
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
|
||||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
|
||||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||||
|
@ -89,6 +89,14 @@
|
|||||||
{
|
{
|
||||||
localStorage.SetItem("RabattEinloesen", false);
|
localStorage.SetItem("RabattEinloesen", false);
|
||||||
localStorage.SetItem("Summe", summe);
|
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 bestellung to API
|
||||||
@ -108,6 +116,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var item in menuitemIds)
|
foreach (var item in menuitemIds)
|
||||||
{
|
{
|
||||||
bestellungspositionId++;
|
bestellungspositionId++;
|
||||||
@ -130,18 +139,25 @@
|
|||||||
|
|
||||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionen", bestellungsposition);
|
||||||
|
|
||||||
//Add menuitems to bestellungspositionHasMenuItem
|
////Add menuitems to bestellungspositionHasMenuItem
|
||||||
BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
//BestellungspositionHasMenuitem bestellungspositionHasMenuItem = new BestellungspositionHasMenuitem();
|
||||||
bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
//bestellungspositionHasMenuItem.Bestellungsposition_IDBestellung = bestellungsposition.Idbestellung;
|
||||||
bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
//bestellungspositionHasMenuItem.MenuItem_IDMenuItem = item.Key;
|
||||||
|
|
||||||
Http.PostAsJsonAsync("https://localhost:7076/api/bestellungspositionhasmenuitems", bestellungspositionHasMenuItem);
|
//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
|
// delete all localStorage
|
||||||
localStorage.SetItem("MenuItemIds", new Dictionary<int, int>());
|
localStorage.SetItem("MenuItemIds", new Dictionary<int, int>());
|
||||||
//localStorage.SetItem("Hour", 0);
|
|
||||||
//localStorage.SetItem("Minute", 0);
|
|
||||||
localStorage.SetItem("Summe", 0);
|
localStorage.SetItem("Summe", 0);
|
||||||
localStorage.SetItem("RabattEinloesen", false);
|
localStorage.SetItem("RabattEinloesen", false);
|
||||||
|
|
||||||
@ -319,7 +335,7 @@
|
|||||||
|
|
||||||
public class BestellungspositionHasMenuitem
|
public class BestellungspositionHasMenuitem
|
||||||
{
|
{
|
||||||
public int? Bestellungsposition_IDBestellung { get; set; }
|
public int Bestellungsposition_IDBestellung { get; set; }
|
||||||
public int? MenuItem_IDMenuItem { get; set; }
|
public int MenuItem_IDMenuItem { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -96,7 +96,6 @@
|
|||||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
|
||||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||||
|
|
||||||
// test use the first kunde
|
|
||||||
// get kunde from local storage
|
// get kunde from local storage
|
||||||
kunde = localStorage.GetItem<Kunde>("kunde");
|
kunde = localStorage.GetItem<Kunde>("kunde");
|
||||||
|
|
||||||
|
@ -4,14 +4,19 @@
|
|||||||
@inject HttpClient Http
|
@inject HttpClient Http
|
||||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||||
@inject NavigationManager _navigationManager
|
@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="container d-flex flex-column">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-8">
|
<div class="col-12">
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Aktive Bestellungen @day.@month.@year</th>
|
<th>Aktive Bestellungen @day.@month.@year</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@ -37,9 +42,20 @@
|
|||||||
month = bestellungsposition.Datum.Month;
|
month = bestellungsposition.Datum.Month;
|
||||||
year = bestellungsposition.Datum.Year;
|
year = bestellungsposition.Datum.Year;
|
||||||
|
|
||||||
@*print kunde.code, hour and minute from last bestellungsposition*@
|
@*print only if date is higher than now datum, all expired hh:mm unvisible *@
|
||||||
@*print only if date is higher than now datum *@
|
@*if (bestellungsposition.Datum > DateTime.Now)
|
||||||
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>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
@ -50,7 +66,6 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
@*}*@
|
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,20 +74,20 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@*<div class="col-lg-3">
|
<div class="col-lg-3">
|
||||||
<p id="text" readonly>Abholzeit</p>
|
@* <p id="text" readonly>Abholzeit</p>
|
||||||
<br />
|
<br />
|
||||||
<form id="button" action="Bestelluebersicht">
|
<form id="button" action="Bestelluebersicht">
|
||||||
<input type="submit" value="30 Min" class="btn">
|
<input type="submit" value="30 Min" class="btn">
|
||||||
</form>
|
</form>
|
||||||
<form id="button" action="Bestelluebersicht">
|
<form id="button" action="Bestelluebersicht">
|
||||||
<input type="submit" value="45 Min" class="btn">
|
<input type="submit" value="45 Min" class="btn">
|
||||||
</form>
|
</form>
|
||||||
<form id="button" action="Bestelluebersicht">
|
<form id="button" action="Bestelluebersicht">
|
||||||
<input type="submit" value="1 Std" class="btn">
|
<input type="submit" value="1 Std" class="btn">
|
||||||
</form>
|
</form>*@
|
||||||
|
|
||||||
</div>*@
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -90,6 +105,11 @@
|
|||||||
private Kunde kunde = new Kunde();
|
private Kunde kunde = new Kunde();
|
||||||
|
|
||||||
|
|
||||||
|
public void Logout()
|
||||||
|
{
|
||||||
|
localStorage.Clear();
|
||||||
|
_navigationManager.NavigateTo("/");
|
||||||
|
}
|
||||||
public void BDetail(int id)
|
public void BDetail(int id)
|
||||||
{
|
{
|
||||||
localStorage.SetItem<int>("KundeId", id);
|
localStorage.SetItem<int>("KundeId", id);
|
||||||
@ -108,6 +128,22 @@
|
|||||||
month = DateTime.Now.Month;
|
month = DateTime.Now.Month;
|
||||||
year = DateTime.Now.Year;
|
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 class Bestellungsposition
|
||||||
|
@ -5,8 +5,15 @@
|
|||||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||||
@inject NavigationManager _navigationManager
|
@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="container">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-sm-12 col-lg-6">
|
<div class="col-sm-12 col-lg-6">
|
||||||
@*Tabelle Ihre Bestellung*@
|
@*Tabelle Ihre Bestellung*@
|
||||||
<div class="tbl-container">
|
<div class="tbl-container">
|
||||||
@ -69,7 +76,7 @@
|
|||||||
<div class="d-flex flex-column align-items-center ">
|
<div class="d-flex flex-column align-items-center ">
|
||||||
<div class="tbl-container w-100">
|
<div class="tbl-container w-100">
|
||||||
<!-- <== overflow: hidden applied to parent -->
|
<!-- <== overflow: hidden applied to parent -->
|
||||||
<table class="table table-bordered bdr " style=" border-radius: 50px; margin-left: 50px;">
|
<table class="table table-bordered bdr " style=" border-radius: 50px; ">
|
||||||
<thead class="bg_green">
|
<thead class="bg_green">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
||||||
@ -92,7 +99,7 @@
|
|||||||
|
|
||||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
<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_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 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_forward w-75">Bestellung abschließen</button>*@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -113,6 +120,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>*@
|
</div>*@
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
public int hour;
|
public int hour;
|
||||||
@ -137,6 +145,30 @@
|
|||||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||||
private List<BestellungspositionHasMenuitem> bestellungspositionHasMenuitems = new List<BestellungspositionHasMenuitem>();
|
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()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
// get data from api
|
// get data from api
|
||||||
|
@ -10,8 +10,9 @@
|
|||||||
|
|
||||||
@*log out Button *@
|
@*log out Button *@
|
||||||
<div class="container mt-auto">
|
<div class="container mt-auto">
|
||||||
<button class="btn" type="button" onclick="@Logout" id="button1">@button1</button>
|
<button class="btn" type="button" onclick="@Logout" id="button1">Abmelden</button>
|
||||||
</div>
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
<div class="container mt-auto">
|
<div class="container mt-auto">
|
||||||
<h4>AccountID: @kunde.Code</h4>
|
<h4>AccountID: @kunde.Code</h4>
|
||||||
|
@ -1,61 +1,93 @@
|
|||||||
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
@inject HttpClient Http
|
||||||
<div class="container-fluid">
|
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||||
@*<a class="navbar-brand" href="">Yummy4Friends</a>*@
|
@inject NavigationManager _navigationManager
|
||||||
<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>
|
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
||||||
</button>
|
<div class="container-fluid">
|
||||||
<div class="collapse navbar-collapse justify-content-end @NavBarCssClass" id="navbarCollapse" @onclick="ToggleNavMenu">
|
@*<a class="navbar-brand" href="">Yummy4Friends</a>*@
|
||||||
<ul class="navbar-nav">
|
<a class="navbar-brand" href="">
|
||||||
<li class="nav-item">
|
<img src="assets/Logo_new.png" alt="Yummy4Friends" width="60px" height="auto">
|
||||||
</li>
|
</a>
|
||||||
<li class="nav-item">
|
|
||||||
<NavLink class="nav-link" href="allergene">
|
<button class="navbar-toggler @NavButtonCssClass" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
|
||||||
Allergene
|
aria-controls="navbarCollapse" aria-label="Toggle navigation" @onclick="ToggleNavMenu">
|
||||||
</NavLink>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</li>
|
</button>
|
||||||
<li class="nav-item">
|
<div class="collapse navbar-collapse justify-content-end @NavBarCssClass" id="navbarCollapse" @onclick="ToggleNavMenu">
|
||||||
<NavLink class="nav-link" href="speisekarte">
|
<ul class="navbar-nav">
|
||||||
Speisekarte
|
<li class="nav-item">
|
||||||
</NavLink>
|
</li>
|
||||||
</li>
|
<li class="nav-item">
|
||||||
<li class="nav-item">
|
<NavLink class="nav-link" href="allergene">
|
||||||
<NavLink class="nav-link" href="yummy-punkte">
|
Allergene
|
||||||
Yummy-Punkte
|
</NavLink>
|
||||||
</NavLink>
|
</li>
|
||||||
</li>
|
<li class="nav-item">
|
||||||
<li class="nav-item">
|
<NavLink class="nav-link" href="speisekarte">
|
||||||
<NavLink class="nav-link" href="shopping_cart">
|
Speisekarte
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-cart3" viewBox="0 0 16 16">
|
</NavLink>
|
||||||
<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" />
|
</li>
|
||||||
</svg>
|
<li class="nav-item">
|
||||||
</NavLink>
|
<NavLink class="nav-link" href="yummy-punkte">
|
||||||
</li>
|
Yummy-Punkte
|
||||||
<li class="nav-item">
|
</NavLink>
|
||||||
<NavLink class="nav-link" href="Kontoverwaltung">
|
</li>
|
||||||
#12345
|
<li class="nav-item">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
<NavLink class="nav-link" href="shopping_cart">
|
||||||
<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 xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-cart3" viewBox="0 0 16 16">
|
||||||
</svg>
|
<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" />
|
||||||
</NavLink>
|
</svg>
|
||||||
</li>
|
</NavLink>
|
||||||
</ul>
|
</li>
|
||||||
</div>
|
<li class="nav-item">
|
||||||
</div>
|
<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>
|
</nav>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
private bool collapseNavMenu = true;
|
private bool collapseNavMenu = true;
|
||||||
private string? NavBarCssClass => collapseNavMenu ? null : "show";
|
private string? NavBarCssClass => collapseNavMenu ? null : "show";
|
||||||
private string? NavButtonCssClass => collapseNavMenu ? "collapsed" : null;
|
private string? NavButtonCssClass => collapseNavMenu ? "collapsed" : null;
|
||||||
|
|
||||||
|
|
||||||
private void ToggleNavMenu()
|
private void ToggleNavMenu()
|
||||||
{
|
{
|
||||||
collapseNavMenu = !collapseNavMenu;
|
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"
|
@page "/RegistrierungA"
|
||||||
|
@using System.Text;
|
||||||
|
@using System.Security.Cryptography;
|
||||||
@layout Registrierung
|
@layout Registrierung
|
||||||
@inject NavigationManager NavManager
|
@inject HttpClient Http
|
||||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
@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">
|
<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>
|
<p>Passwort:</p>
|
||||||
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword">
|
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword">
|
||||||
|
|
||||||
<button type="button" class="btn" @onclick="@Login">Login</button>
|
<button type="button" class="btn" @onclick="@Login">Login</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
public string inputName { get; set; } = string.Empty;
|
public string inputName { get; set; }
|
||||||
public string inputPassword { get; set; } = string.Empty;
|
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() {
|
public void Login()
|
||||||
if (inputName == userDataName && inputPassword == userDataPassword) {
|
{
|
||||||
localStorage.SetItem("name", inputName);
|
// if inputName and inputPassword is not null
|
||||||
userName = localStorage.GetItem<string>("name");
|
if (string.IsNullOrEmpty(inputName) || string.IsNullOrEmpty(inputPassword))
|
||||||
NavManager.NavigateTo("/Bestelluebersicht");
|
{
|
||||||
}
|
JSRuntime.InvokeVoidAsync("alert", "Benutzernamen oder Passwort ist falsch!");
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//encode inputpassword
|
||||||
|
inputPasswordEnc = Convert.ToHexString(SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(inputPassword)));
|
||||||
|
|
||||||
@code {
|
// if inputName is in admins with the encrypt SHA512 password
|
||||||
public string userDataName { get; set; } = "";
|
if (admins.Any(a => a.Username == inputName && a.Password == inputPasswordEnc))
|
||||||
public string userDataPassword { get; set; } = "";
|
{
|
||||||
|
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,16 +0,0 @@
|
|||||||
<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; }
|
|
||||||
}
|
|
@ -3,20 +3,29 @@
|
|||||||
html, body {
|
html, body {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content {
|
||||||
background-color: #C7FFD1;
|
background-color: #C7FFD1;
|
||||||
padding: 5%;
|
|
||||||
margin-top: 1%;
|
margin-top: 1%;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
position: center;
|
position: center;
|
||||||
}
|
}
|
||||||
|
#button1 {
|
||||||
|
background-color: #89F9A5;
|
||||||
|
border-radius: 50px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.img {
|
.img {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
margin: 10%;
|
margin: 5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
@ -26,3 +35,17 @@ 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