Skip to content

Commit

Permalink
marcar produtos selecionados
Browse files Browse the repository at this point in the history
  • Loading branch information
luiz87 committed May 28, 2024
1 parent 36168d6 commit de3d5c0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions site-pizzaria/estilos/estilo.css
Original file line number Diff line number Diff line change
Expand Up @@ -547,4 +547,9 @@ footer {
.content-carrinho{
width: 90%;
margin-top: 10px;
}

.itens-cardapio .info button.selecionado{
color: #ffffff;
background-color: #333333;
}
12 changes: 11 additions & 1 deletion site-pizzaria/scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ let lsPedido = document.querySelectorAll('.pedir');
for (const bt of lsPedido) {
bt.addEventListener('click', () => {
let id = bt.id.replace('id', '');
produtos[id].quantidade = 1;
bt.classList.toggle('selecionado');
if(bt.innerHTML == 'REMOVER'){
produtos[id].quantidade = 0;
bt.innerHTML = 'pedir agora';
}else{
produtos[id].quantidade = 1;
bt.innerHTML = 'REMOVER';
}
atualizarTabela();
});
}
Expand Down Expand Up @@ -82,6 +89,9 @@ function atualizarPlusDash(tipo) {
}
if (tipo == 'dash') {
produtos[id].quantidade--;
if(produtos[id].quantidade < 1){
document.getElementById('id'+id).click();
}
}
atualizarTabela();
});
Expand Down

0 comments on commit de3d5c0

Please sign in to comment.