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 = '
| ID | Nome | Prezzo | Azioni |
';
+ let table = '| ID | Nome | Prezzo | Note | Azioni |
';
// Aggiungiamo ogni pizza come riga della tabella
pizze.pizze.forEach(pizza => {
@@ -19,6 +19,7 @@ function listPizze(){
${pizza.id} |
${pizza.nome} |
${pizza.prezzo.toFixed(2)}€ |
+ ${pizza.note} |
|
`;
@@ -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