From af1a64f2dcd558819197691ec213b044f7fab700 Mon Sep 17 00:00:00 2001 From: Andrea Date: Thu, 4 Dec 2025 09:09:26 +0100 Subject: [PATCH] Aggiunta campo "note" --- script.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 6957bb2..220deb4 100644 --- a/script.js +++ b/script.js @@ -11,7 +11,7 @@ function listPizze(){ .then((response) => response.json()) .then((pizze) => { // Creiamo la tabella - let table = ''; + let table = '
IDNomePrezzoAzioni
'; // Aggiungiamo ogni pizza come riga della tabella pizze.pizze.forEach(pizza => { @@ -19,6 +19,7 @@ function listPizze(){ + `; @@ -84,13 +85,14 @@ function editPizza(id){ } } -function addPizza(nome, prezzo){ +function addPizza(nome, prezzo, note){ const myHeaders = new Headers(); myHeaders.append("Content-Type", "application/json"); const raw = JSON.stringify({ "nome": nome, - "prezzo": prezzo + "prezzo": prezzo, + "note": note }); const requestOptions = { @@ -117,6 +119,7 @@ function handleAddPizza(event){ const nome = document.getElementById("name").value; const prezzo = document.getElementById("price").value; + const note = document.getElementById("notes").value; - addPizza(nome, prezzo); + addPizza(nome, prezzo, note); } \ No newline at end of file
IDNomePrezzoNoteAzioni
${pizza.id} ${pizza.nome} ${pizza.prezzo.toFixed(2)}€${pizza.note}