Compare commits
16 Commits
94f6f099bb
...
workflow/T
Author | SHA1 | Date | |
---|---|---|---|
59ff664ffe | |||
fced97beb0 | |||
bf32b6999b | |||
b7719ca4b6 | |||
6f8dabbd3f | |||
fe765064de | |||
ece3af8316 | |||
4180c3c61e | |||
fe4a58e4ea | |||
688315441e | |||
6c1b7bd336 | |||
e317144914 | |||
f41229cd71
|
|||
4b5f0c2b96 | |||
cc4ffab409 | |||
51a7751337 |
23
.github/workflows/dotnet.yml
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
name: Test if program still runs
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev" ]
|
||||
pull_request:
|
||||
branches: [ "dev" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0.107
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
29
.github/workflows/main.yml
vendored
@ -1,29 +0,0 @@
|
||||
name: Deploy blazor to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "dev" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 7.0
|
||||
- name: Publish
|
||||
run: dotnet publish --configuration Release -o release --nologo --runtime linux-x64 --self-contained src/y4f/y4f.csproj
|
||||
- name: Commit wwwroot to GitHub Pages
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BRANCH: gh-pages
|
||||
FOLDER: release/wwwroot
|
||||
- name: Change base-tag in index.html from / to y4f
|
||||
run: sed -i 's/<base href="\/" \/>/<base href="\/y4f\/" \/>/g' release/wwwroot/index.html
|
||||
- name: Add .nojekyll file
|
||||
run: touch release/wwwroot/.nojekyll
|
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0
|
||||
WORKDIR /App
|
||||
COPY . ./
|
||||
RUN dotnet restore
|
||||
EXPOSE 5248
|
||||
CMD /usr/bin/dotnet run --project /App/src/y4f/y4f.csproj
|
46
README.md
@ -1,3 +1,47 @@
|
||||
# y4f
|
||||
|
||||
[](https://github.com/yummy4friends/y4f/actions/workflows/main.yml)
|
||||
## Description (German)
|
||||
|
||||
Yummy4Friends ist eine benutzerfreundliche und visuell ansprechende Webapp zur Onlinebestellung von Speisen mit der dynamischen Einbindung einer Kunden- und Speisendatenbank unter Berücksichtigung von Sonderwünschen. Zur Kundenbindung wird auch die Verwaltung von Kundenrabatten, Vorbestellmöglichkeiten sowie konfigurierbare Abholtermine realisiert.
|
||||
|
||||
## 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.
|
||||
|
||||
## Tech Stack
|
||||
|
||||
[Blazor WebAssembly](https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor)
|
||||
|
||||
## Dependecies
|
||||
|
||||
On Ubuntu our dependencies are:
|
||||
|
||||
```bash
|
||||
nala install dotnet-sdk-7.0 docker-ce docker-ce-cli docker-buildx-plugin docker-compose-plugin
|
||||
```
|
||||
|
||||
Dependency names will depend on your linux distribution.
|
||||
|
||||
For this this project you also need Traefik. Or you can use your own reverse proxy and edit the docker-compose files to reflect that.
|
||||
|
||||
## Running it
|
||||
|
||||
Clone the repo.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yummy4friends/y4f.git && cd y4f
|
||||
```
|
||||
|
||||
Start the website with docker-compose.
|
||||
|
||||
```bash
|
||||
docker-compose up --build -d
|
||||
```
|
||||
|
||||
Also start up the API.
|
||||
|
||||
```bash
|
||||
cd src/WebApi/ && docker-compose up --build -d
|
||||
```
|
||||
|
||||
This setup is for showcasing the project and is therefore not intended for production.
|
||||
|
22
docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
||||
version: "3.4"
|
||||
services:
|
||||
y4f:
|
||||
build: .
|
||||
ports:
|
||||
- "5248:5248"
|
||||
labels:
|
||||
- traefik.docker.network=traefik
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.y4f.entrypoints=web-secure
|
||||
- traefik.http.routers.y4f.rule=Host(`y4f.hopeless-cloud.xyz`)
|
||||
- traefik.http.routers.y4f.tls=true
|
||||
- traefik.http.routers.y4f.tls.certResolver=default
|
||||
networks:
|
||||
- default
|
||||
- traefik
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
default:
|
||||
name: y4f-default
|
||||
traefik:
|
||||
external: true
|
124
src/WebApi/Controllers/AdminsController.cs
Normal file
@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApi.Data;
|
||||
using WebApi.Models;
|
||||
|
||||
namespace WebApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AdminsController : ControllerBase
|
||||
{
|
||||
private readonly WebApiContext _context;
|
||||
|
||||
public AdminsController(WebApiContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: api/Admins
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<IEnumerable<Admin>>> GetAdmins()
|
||||
{
|
||||
if (_context.Admins == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return await _context.Admins.ToListAsync();
|
||||
}
|
||||
|
||||
// GET: api/Admins/5
|
||||
[HttpGet("{id}")]
|
||||
public async Task<ActionResult<Admin>> GetAdmin(int id)
|
||||
{
|
||||
if (_context.Admins == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var admin = await _context.Admins.FindAsync(id);
|
||||
|
||||
if (admin == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return admin;
|
||||
}
|
||||
|
||||
// PUT: api/Admins/5
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutAdmin(int id, Admin admin)
|
||||
{
|
||||
if (id != admin.Id)
|
||||
{
|
||||
return BadRequest();
|
||||
}
|
||||
|
||||
_context.Entry(admin).State = EntityState.Modified;
|
||||
|
||||
try
|
||||
{
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!AdminExists(id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// POST: api/Admins
|
||||
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<Admin>> PostAdmin(Admin admin)
|
||||
{
|
||||
if (_context.Admins == null)
|
||||
{
|
||||
return Problem("Entity set 'WebApiContext.Admins' is null.");
|
||||
}
|
||||
_context.Admins.Add(admin);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return CreatedAtAction("GetAdmin", new { id = admin.Id }, admin);
|
||||
}
|
||||
|
||||
// DELETE: api/Admins/5
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAdmin(int id)
|
||||
{
|
||||
if (_context.Admins == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
var admin = await _context.Admins.FindAsync(id);
|
||||
if (admin == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
_context.Admins.Remove(admin);
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
private bool AdminExists(int id)
|
||||
{
|
||||
return (_context.Admins?.Any(e => e.Id == id)).GetValueOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,8 +25,9 @@ public partial class WebApiContext : DbContext
|
||||
public virtual DbSet<Menuitemueberkategorie> Menuitemueberkategories { get; set; }
|
||||
|
||||
public virtual DbSet<Rabatt> Rabatts { get; set; }
|
||||
public virtual DbSet<Admin> Admins{ get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.UseCollation("utf8_general_ci")
|
||||
@ -223,6 +224,12 @@ public partial class WebApiContext : DbContext
|
||||
entity.Property(e => e.Prozent).HasPrecision(8, 2);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Admin>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
entity.ToTable("admin");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
|
6
src/WebApi/Dockerfile
Normal file
@ -0,0 +1,6 @@
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0
|
||||
WORKDIR /App
|
||||
COPY . ./
|
||||
RUN dotnet restore
|
||||
EXPOSE 5226
|
||||
CMD /usr/bin/dotnet run --project /App/WebApi.csproj
|
7
src/WebApi/Models/Admin.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace WebApi.Models;
|
||||
public partial class Admin
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:5226",
|
||||
"applicationUrl": "http://0.0.0.0:5226",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
@ -7,18 +7,19 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.6" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.7" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
22
src/WebApi/docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
||||
version: "3.4"
|
||||
services:
|
||||
y4f-webapi:
|
||||
build: .
|
||||
ports:
|
||||
- "5226:5226"
|
||||
labels:
|
||||
- traefik.docker.network=traefik
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.y4f-webapi.entrypoints=web-secure
|
||||
- traefik.http.routers.y4f-webapi.rule=Host(`api.y4f.hopeless-cloud.xyz`)
|
||||
- traefik.http.routers.y4f-webapi.tls=true
|
||||
- traefik.http.routers.y4f-webapi.tls.certResolver=default
|
||||
networks:
|
||||
- y4f-default
|
||||
- traefik
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
y4f-default:
|
||||
external: true
|
||||
traefik:
|
||||
external: true
|
@ -13,9 +13,9 @@
|
||||
<p>
|
||||
<strong>Yummy Kitchen</strong>
|
||||
<br />
|
||||
Musterstraße 15
|
||||
Meidlinger Hauptstraße 49
|
||||
<br />
|
||||
1010 Wien
|
||||
1120 Wien
|
||||
</p>
|
||||
|
||||
@code {
|
||||
|
@ -1,3 +1,4 @@
|
||||
using Blazored.LocalStorage;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using y4f;
|
||||
@ -6,7 +7,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
|
||||
builder.Services.AddBlazoredLocalStorage();
|
||||
|
||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
|
||||
"applicationUrl": "http://localhost:5248",
|
||||
"applicationUrl": "http://0.0.0.0:5248",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
</div>
|
||||
|
||||
<table>
|
||||
|
||||
<tr class="loadtext">
|
||||
<td>Bestellung eingegangen</td>
|
||||
<td class="load2">Bestellung wird zubereitet</td>
|
||||
|
82
src/y4f/Shared/Chefin/Bestelluebersicht-Chefin.razor
Normal file
@ -0,0 +1,82 @@
|
||||
@page "/Bestelluebersicht"
|
||||
@layout ChefinLayout
|
||||
|
||||
<div class="container d-flex flex-column">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<br /><br />
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">Aktive Bestellungen</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="BDetail">#1234 12:30</a></td>
|
||||
<td><a href="BDetail">#2345 18:45</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#3456 13:00</a></td>
|
||||
<td><a href="BDetail">#4567 19:00</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#5678 14:30</a></td>
|
||||
<td><a href="BDetail">#6789 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#4321 15:15</a></td>
|
||||
<td><a href="BDetail">#5432 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#6543 15:30</a></td>
|
||||
<td><a href="BDetail">#7654 19:15</a></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#7654 15:30</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#8765 16:00</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a href="BDetail">#9876 17:30</a></td>
|
||||
<td> </td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<p id="text" readonly >Abholzeit</p>
|
||||
<br />
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="30 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="45 Min" class="btn">
|
||||
</form>
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="1 Std" class="btn">
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
}
|
37
src/y4f/Shared/Chefin/Bestelluebersicht-Chefin.razor.css
Normal file
@ -0,0 +1,37 @@
|
||||
tbody {
|
||||
border-color: black;
|
||||
}
|
||||
td {
|
||||
text-align:center;
|
||||
text-decoration: none;
|
||||
}
|
||||
table {
|
||||
border-radius: 50px !important;
|
||||
margin-left: 50px;
|
||||
}
|
||||
td > a {
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
}
|
||||
#button {
|
||||
margin-bottom: 35px;
|
||||
border-radius: 50px;
|
||||
margin-left: 100px;
|
||||
}
|
||||
#text {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 45px;
|
||||
margin-left: 100px;
|
||||
width: 69%;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
padding: 8px;
|
||||
color: black;
|
||||
background-color: #89F9A5;
|
||||
border-style:none;
|
||||
text-align: center;
|
||||
}
|
||||
thead {
|
||||
background-color: #89F9A5;
|
||||
border-color: #89F9A5;
|
||||
}
|
139
src/y4f/Shared/Chefin/BestelluebersichtD-Chefin.razor
Normal file
@ -0,0 +1,139 @@
|
||||
@page "/BestelluebersichtD-Chefin"
|
||||
@layout ChefinLayout
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
@*Tabelle Ihre Bestellung*@
|
||||
<div class="tbl-container">
|
||||
<table class="table bdr">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td>Ihre Bestellung</td>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg_lightgreen" style="background-color:white;">
|
||||
<tr>
|
||||
<td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;">
|
||||
1 Nudel mit Hühnerfleisch (groß)
|
||||
<div style="font-size:0.7rem;padding-left:15px;">mit Knoblauchsoße</div>
|
||||
</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:20px; padding-bottom:0px; border-style:hidden;">9,10€</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;">1 Coca Cola</td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; border-style:hidden;">2,50€</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px; border-style:hidden;"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot class="bg_lightgreen">
|
||||
<tr style="border-top:solid 1px black; background-color:white;">
|
||||
<th class="" style="text-align:right;">Summe</th>
|
||||
<td class="d-flex justify-content-center align-items-center">11,60€</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-12 col-lg-6">
|
||||
|
||||
<div class="d-flex flex-column align-items-center ">
|
||||
<div class="tbl-container w-100">
|
||||
<!-- <== overflow: hidden applied to parent -->
|
||||
<table class="table table-bordered bdr " style=" border-radius: 50px; margin-left: 50px;">
|
||||
<thead class="bg_green">
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
|
||||
<p>Abholzeit</p>
|
||||
</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody >
|
||||
<tr>
|
||||
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px; background-color:white;">
|
||||
<div style="margin:20px;">
|
||||
<div class="d-flex justify-content-center align-items-center" >
|
||||
<p>12:30 Uhr</p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="d-flex flex-column" style="align-items: center; margin-left: 100px;">
|
||||
<button class="btn_back w-75">Zurück</button>
|
||||
<button class="btn btn-danger w-75" style="border-radius: 50px; padding-top:12px; padding-bottom:12px; color:black;">Bestellung auflösen</button>
|
||||
<button class="btn_forward w-75">Bestellung abschließen</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@*Buttons*@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@*<div class="h-100">
|
||||
@*Essen Abholen?
|
||||
<div class="row h-25 w-100">
|
||||
<div class="col">
|
||||
</div>
|
||||
</div>
|
||||
</div>*@
|
||||
@code {
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
button {
|
||||
margin: 10px;
|
||||
}
|
25
src/y4f/Shared/Chefin/NavChefin.razor
Normal file
@ -0,0 +1,25 @@
|
||||
<nav class="navbar navbar-expand-md navbar-light mb-4 me-5 ms-5 ">
|
||||
<div class="container-fluid">
|
||||
@*<a class="navbar-brand" href="">Yummy4Friends</a>*@
|
||||
<a class="navbar-brand" href="">
|
||||
<img src="assets/Logo_new.png" alt="Yummy4Friends" width="60px" height="auto">
|
||||
</a>
|
||||
|
||||
<ul class="navbar-nav">
|
||||
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="RegistrierungA">
|
||||
#1
|
||||
<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>
|
||||
</nav>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
14
src/y4f/Shared/ChefinLayout.razor
Normal file
@ -0,0 +1,14 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
|
||||
<div >
|
||||
<y4f.Shared.Chefin.NavChefin />
|
||||
|
||||
<main class="container">
|
||||
|
||||
|
||||
@Body
|
||||
|
||||
</main>
|
||||
|
||||
</div>
|
5
src/y4f/Shared/ChefinLayout.razor.css
Normal file
@ -0,0 +1,5 @@
|
||||
html, body {
|
||||
/*background-color: #C7FFD5;*/
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
@ -1,20 +1,4 @@
|
||||
@*<footer class="text-center text-lg-start bg-light text-muted">
|
||||
<section class="d-flex justify-content-center justify-content-lg-between p-4 border-bottom"></section>
|
||||
<section class="">
|
||||
<div class="container text-center text-md-start mt-5">
|
||||
<div class="col-md-3 col-lg-6 col-xl-12 mx-auto mb-4">
|
||||
<center>
|
||||
<h6 class="text-uppercase fw-bold mb-4">
|
||||
<a href="">Kontakt</a> | <a href="">Impressum</a> | <a href="">Datenschutzerklärung</a> | <a href="">Cookies</a>
|
||||
</h6>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</footer>*@
|
||||
|
||||
|
||||
<footer>
|
||||
<footer>
|
||||
<div class="container">
|
||||
<a href="Kontakt">Kontakt</a> |
|
||||
<a href="Impressum">Impressum</a> |
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
<div class="container mt-auto">
|
||||
<h4>AccountID: #1234</h4>
|
||||
<h4>AccountID: @RegistrierungA.userName</h4>
|
||||
<h4>Ihr QR-Code: </h4>
|
||||
<img src="assets/K-QR.png" class="img" title="logo image">
|
||||
|
||||
|
35
src/y4f/Shared/NavStartseite.razor
Normal file
@ -0,0 +1,35 @@
|
||||
<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>*@
|
||||
|
||||
<button class="navbar-toggler @NavButtonCssClass" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
|
||||
aria-controls="navbarCollapse" aria-label="Toggle navigation" @onclick="ToggleNavMenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse justify-content-end @NavBarCssClass" id="navbarCollapse" @onclick="ToggleNavMenu">
|
||||
<ul class="navbar-nav">
|
||||
|
||||
<li class="nav-item">
|
||||
<NavLink class="nav-link" href="RegistrierungA">
|
||||
Admin
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-person-fill" viewBox="0 0 16 16">
|
||||
<path d="M3 14s-1 0-1-1 1-4 6-4 6 3 6 4-1 1-1 1H3Zm5-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" />
|
||||
</svg>
|
||||
</NavLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@code {
|
||||
private bool collapseNavMenu = true;
|
||||
private string? NavBarCssClass => collapseNavMenu ? null : "show";
|
||||
private string? NavButtonCssClass => collapseNavMenu ? "collapsed" : null;
|
||||
|
||||
|
||||
private void ToggleNavMenu()
|
||||
{
|
||||
collapseNavMenu = !collapseNavMenu;
|
||||
}
|
||||
}
|
@ -1,18 +1,36 @@
|
||||
@page "/RegistrierungA"
|
||||
@page "/RegistrierungA"
|
||||
@layout Registrierung
|
||||
@inject NavigationManager NavManager
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<p>Benutzername:</p>
|
||||
<input type="text" class="form-control" id="name" name="name">
|
||||
|
||||
<input type="text" class="form-control" id="name" name="name" @bind="@inputName">
|
||||
|
||||
<p>Passwort:</p>
|
||||
<input type="text" class="form-control" id="password" name="password">
|
||||
|
||||
<form id="button" action="Bestelluebersicht">
|
||||
<input type="submit" value="Login" class="btn">
|
||||
</form>
|
||||
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword">
|
||||
|
||||
<button type="button" class="btn" @onclick="@Login">Login</button>
|
||||
|
||||
</div>
|
||||
@code {
|
||||
|
||||
@code {
|
||||
public string inputName { get; set; } = string.Empty;
|
||||
public string inputPassword { get; set; } = string.Empty;
|
||||
|
||||
public static string userName { get; set; } = string.Empty;
|
||||
|
||||
public void Login() {
|
||||
if (inputName == userDataName && inputPassword == userDataPassword) {
|
||||
localStorage.SetItem("name", inputName);
|
||||
userName = localStorage.GetItem<string>("name");
|
||||
NavManager.NavigateTo("/Bestelluebersicht");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
public string userDataName { get; set; } = "";
|
||||
public string userDataPassword { get; set; } = "";
|
||||
}
|
@ -2,12 +2,21 @@
|
||||
color: grey;
|
||||
margin-bottom:0px;
|
||||
margin-top: 15px;
|
||||
margin-left: 61px;
|
||||
}
|
||||
|
||||
form {
|
||||
margin-top: 20px;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
input {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
button {
|
||||
text-align: center;
|
||||
background-color: #89F9A5;
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
<div>
|
||||
|
||||
<NavStartseite />
|
||||
|
||||
<main class="container">
|
||||
|
||||
|
||||
|
@ -1,29 +1,105 @@
|
||||
@page "/Yummy-Punkte"
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
|
||||
<body>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h4><b>Ihre Yummy-Punkte</b></h4>
|
||||
|
||||
<div class="img" >
|
||||
@for(int i = 0; i < 10; i++)
|
||||
{
|
||||
<img src="assets/White-Circle.png ">
|
||||
}
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<p class="text">Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt. Ab der 10ten Bestellung gibt es einen Rabatt zu Ihrer nächsten Bestellung.</p>
|
||||
|
||||
<div class="button">
|
||||
<form id="button1" action="/">
|
||||
<input type="submit" value="Zurück" class="btn">
|
||||
</form>
|
||||
</div>
|
||||
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
|
||||
<h4><b>Ihre Yummy-Punkte</b></h4>
|
||||
|
||||
</div>
|
||||
<div class="img">
|
||||
@for (int i = 0; i < 10; i++)
|
||||
{
|
||||
@*if kunde hat treuepunkte*@
|
||||
@if (kunde.Treuepunkte > i)
|
||||
{
|
||||
<img src="assets/Point-Circle.png ">
|
||||
}
|
||||
else
|
||||
{
|
||||
<img src="assets/White-Circle.png ">
|
||||
}
|
||||
}
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<p class="text">Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt. Ab der 10ten Bestellung gibt es einen Rabatt zu Ihrer nächsten Bestellung.</p>
|
||||
<p class="text">Aktueller Rabatt: @rabatt.Prozent %</p>
|
||||
|
||||
<div class="button">
|
||||
<form id="button1" action="/">
|
||||
<input type="submit" value="Zurück" class="btn">
|
||||
</form>
|
||||
@*reset button to set the treuepunkte to null*@
|
||||
<button class="btn btn-danger" @onclick="@(()=>resetTreuepunkte())">Yummy-Punkte einlösen</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@code {
|
||||
|
||||
|
||||
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
|
||||
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
private Kunde kunde = new Kunde();
|
||||
|
||||
private List<Rabatt> rabatte = new List<Rabatt>();
|
||||
private Rabatt rabatt = new Rabatt();
|
||||
|
||||
|
||||
public void resetTreuepunkte()
|
||||
{
|
||||
if (kunde.Treuepunkte == 10)
|
||||
{
|
||||
kunde.Treuepunkte = 0;
|
||||
// API change treupunkte to 0 if kunde has 10 treuepunkte
|
||||
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
|
||||
|
||||
kunde = kunden[0];
|
||||
|
||||
// get the most recent rabatt, that are still valid (GueltigkeitBis)
|
||||
// if there is no rabatt, set the rabatt to null
|
||||
if (rabatte.Count == 0)
|
||||
{
|
||||
rabatt = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < rabatte.Count; i++)
|
||||
{
|
||||
if (rabatte[i].GueltigkeitBis > DateTime.Now)
|
||||
{
|
||||
rabatt = rabatte[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
//rabatt = rabatte[rabatte.Count - 1];
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { 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; }
|
||||
|
||||
}
|
||||
}
|
||||
|
BIN
src/y4f/wwwroot/assets/Point-Circle.png
Normal file
After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 75 KiB |
@ -12,6 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|