From b18585127e8d9db3801d20b5a19358f67710fc9e Mon Sep 17 00:00:00 2001 From: Lescano713 <131562199+Lescano713@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:42:53 -0500 Subject: [PATCH 1/3] buttonAddRemove function --- script.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/script.js b/script.js index f778bc2..0061e63 100644 --- a/script.js +++ b/script.js @@ -147,11 +147,11 @@ function findId(id){ function buttonAddRemove(button,name,cost,id){ // orderTotal(2) button.innerHTML = ""; - // let amount = 0; + let amount = 0; - // if(findId(id)){ - // amount = findId(id).pQuantity; - // } + if(findId(id)){ + amount = findId(id).pQuantity; + } button.classList.add('buttonAdd'); const iconPlus = document.createElement('img'); iconPlus.src = icons.incrementQuantity; @@ -159,7 +159,7 @@ function buttonAddRemove(button,name,cost,id){ iconMinus.src = icons.decrementQuantity; const p = document.createElement('p'); - p.textContent = 0; + p.textContent = amount; iconPlus.addEventListener('click', () =>{ getObjects(name,cost,id); From 6233655e334fb4814179d8d2aeb2350fad9a823a Mon Sep 17 00:00:00 2001 From: Lescano713 <131562199+Lescano713@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:51:11 -0500 Subject: [PATCH 2/3] capturing confirmed order button --- script.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/script.js b/script.js index 0061e63..beaf8ff 100644 --- a/script.js +++ b/script.js @@ -132,6 +132,7 @@ function orderTotal(totalAmount){ const h4 = document.createElement('h4'); h4.textContent = `$${totalAmount}` const button = document.createElement('button'); + button.addEventListener('click', e => showMessage()) button.textContent = "Confirm Order"; divDelivery.append(imgDelivery,pDelivery); @@ -183,10 +184,18 @@ function removeProduct(id){ if (findId(id) && !productsInCart.length < 1) { productsInCart.splice(findId(id), 1); uploadingCart(productsInCart); + // takeOffProducts(id) orderTotal(2) } else { console.log("no") document.querySelector('section.order-section').style.background = "flex"; } +} + +function showMessage(){ + const sectionMessage = document.querySelector('.order-confirmed-section'); + + sectionMessage.style.display = "block" + console.log("non") } \ No newline at end of file From c5ee7de4e8205968484bcaaa334f9da9a19ea703 Mon Sep 17 00:00:00 2001 From: Lescano713 <131562199+Lescano713@users.noreply.github.com> Date: Sat, 17 Aug 2024 23:52:09 -0500 Subject: [PATCH 3/3] adding id to buttons --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index f1697a8..38d6136 100644 --- a/index.html +++ b/index.html @@ -30,7 +30,7 @@