mirror of
https://github.com/GithubOrgProjectPiza/frontend.git
synced 2026-09-04 08:36:08 +02:00
Merge branch 'routing-betty'
# Conflicts: # package.json # src/App.js # src/Pages/anmeldepage.jsx # src/Pages/listenansicht.jsx # src/Pages/mainpage.jsx # src/Pages/registrierung.jsx
This commit is contained in:
+44
-9
@@ -5,6 +5,7 @@ import restaurant_image from "../restaurant_icon.png";
|
||||
import kassa_image from "../kassa_icon.png";
|
||||
import Liste from "../Components/liste";
|
||||
import ButtonSecondary from "../Components/buttonSecondary";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
function Warenkorb(props) {
|
||||
//Übergabe vom Namen des Restaurants (merken von Cards?!)
|
||||
@@ -15,17 +16,47 @@ function Warenkorb(props) {
|
||||
//Summe der Preise muss noch gebildet werden mit umwandlung in fließkomma wert
|
||||
|
||||
var color_liste = true;
|
||||
var number = 3;
|
||||
let listen = [];
|
||||
var sum = 0;
|
||||
var number = localStorage;
|
||||
console.log(number);
|
||||
|
||||
for (let index = 0; index < number; index++) {
|
||||
listen.push(<Liste gericht="Pizza" price="12,99€" isColor={color_liste} icon_button="-"></Liste>);
|
||||
const [listen, setlisten] = useState(JSON.parse(localStorage.getItem("gerichte")) ?? []);
|
||||
|
||||
var liste = [];
|
||||
console.log(listen);
|
||||
|
||||
/*for (let index = 0; index < number; index++) {
|
||||
var name = listen.at(index).name;
|
||||
console.log(name);
|
||||
listen.push(<Liste gericht="Gericht" price="12,99€" isColor={color_liste} icon_button="-"></Liste>);
|
||||
if (color_liste == true) {
|
||||
color_liste = false;
|
||||
} else {
|
||||
color_liste = true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//console.log(JSON.parse(localStorage.getItem("gerichte")) ?? []);
|
||||
listen.forEach(function (g, i) {
|
||||
console.log(g.preis, g.name, g.index);
|
||||
liste.push(
|
||||
<Liste
|
||||
gericht={g.name}
|
||||
price={g.preis}
|
||||
isColor={color_liste}
|
||||
icon_button="-"
|
||||
index={i}
|
||||
setlisten={setlisten}></Liste>
|
||||
);
|
||||
if (color_liste == true) {
|
||||
color_liste = false;
|
||||
} else {
|
||||
color_liste = true;
|
||||
}
|
||||
var s = Number(g.preis.substring(0, g.preis.length - 1).replace(",", "."));
|
||||
sum += s;
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="mb-5">
|
||||
<Header1></Header1>
|
||||
@@ -43,18 +74,22 @@ function Warenkorb(props) {
|
||||
</div>
|
||||
<br></br>
|
||||
<br></br>
|
||||
{listen}
|
||||
{liste}
|
||||
<br></br>
|
||||
<br></br>
|
||||
<div class="flex justify-between pt-6 pb-6 bg-primary">
|
||||
<img src={kassa_image} alt="Kassa"></img>
|
||||
<label class="font-medium text-2xl text-white items-center">Summe: 25,98€</label>
|
||||
<label class="font-medium text-2xl text-white items-center">Summe: {Math.round(sum * 100) / 100}€ </label>
|
||||
</div>
|
||||
<br></br>
|
||||
<br></br>
|
||||
<div class="flex justify-between">
|
||||
<ButtonSecondary name="Zurück"></ButtonSecondary>
|
||||
<ButtonSecondary name="Bestätigen"></ButtonSecondary>
|
||||
<Link to="/">
|
||||
<ButtonSecondary name="Zurück"></ButtonSecondary>
|
||||
</Link>
|
||||
<Link to="/endpage">
|
||||
<ButtonSecondary name="Bestätigen"></ButtonSecondary>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user