diff --git a/img/Asado.jpg b/img/Asado.jpg new file mode 100644 index 0000000..420c58f Binary files /dev/null and b/img/Asado.jpg differ diff --git a/img/Medialunas dulces.jpg b/img/Medialunas dulces.jpg new file mode 100644 index 0000000..0ca432b Binary files /dev/null and b/img/Medialunas dulces.jpg differ diff --git a/img/Papas fritas congeladas.jpg b/img/Papas fritas congeladas.jpg new file mode 100644 index 0000000..b551fb2 Binary files /dev/null and b/img/Papas fritas congeladas.jpg differ diff --git a/scripts/script.js b/scripts/script.js index 6257c23..0d34c32 100644 --- a/scripts/script.js +++ b/scripts/script.js @@ -103,6 +103,8 @@ childrenNavbar.forEach(children => { children.addEventListener('click', () => { + globalProductos = [] + activeCategory = children.innerText makeThisCategoryActive() definirProductos() @@ -214,7 +216,6 @@ const enviarProductoAlCheckout = (nombreProducto) => { const plusButton = buttons.children[1] plusButton.addEventListener('click', () => { - checkout[`${nombreProducto}`].quantity++ @@ -265,6 +266,9 @@ const enviarProductoAlCheckout = (nombreProducto) => { delete checkout[`${nombreProducto}`] console.log(checkout) + + registrarCambiosEnElTotal() + checkearCantidadDeElementos() }) console.log(recentlyDocumentAdded) } @@ -298,17 +302,25 @@ const registrarCambiosEnElTotal = () => { const checkearCantidadDeElementos = () => { + const checkout = document.getElementsByClassName('checkout')[0] + const table = document.getElementById('products-display-checkout') + const tableContainer = table.parentElement + if (document.querySelector('#products-display-checkout tbody').children.length > 5) { - const checkout = document.getElementsByClassName('checkout')[0] - const table = document.getElementById('products-display-checkout') - const tableContainer = table.parentElement - checkout.style.height = 'auto' table.style.height = 'auto' tableContainer.style.height = 'auto' } + + else { + + checkout.style.height = '62vh' + table.style.height = 'auto' + tableContainer.style.height = '50vh' + + } } //! Pagar Logica diff --git a/scripts/traerProductosDeAPI.js b/scripts/traerProductosDeAPI.js index b9da025..db54efa 100644 --- a/scripts/traerProductosDeAPI.js +++ b/scripts/traerProductosDeAPI.js @@ -49,6 +49,29 @@ const traerProductosDeAPI = async () => { price: 3.5, img: './img/postobon-pina.jpg', category: 'bebidas' + }, + + product8: { + name: 'Asado', + price: 15, + img: './img/Asado.jpg', + category: 'comidas' + + }, + + product9: { + name: "Medialunas Dulces", + price: 2, + img: './img/Medialunas dulces.jpg', + category: 'REPOSTERÍA Y PANADERÍA' + }, + + product10: { + + name: 'Papas fritas congeladas', + price: 5, + img: './img/Papas fritas congeladas.jpg', + category: 'refrigerados' } } }