diff --git a/view/src/pages/Finance/Finance.css b/view/src/pages/Finance/Finance.css index 1b05ed8..fb8d554 100644 --- a/view/src/pages/Finance/Finance.css +++ b/view/src/pages/Finance/Finance.css @@ -148,3 +148,29 @@ body { .popup label { color: black; /* Ensure labels inside popup are black */ } + + +.financeCorpo li { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 0.5rem; +} + +.financeCorpo li img { + cursor: pointer; + height: 20px; + width: 20px; + margin-right: 25px; + margin-top: 15px; + margin-left: 150px; +} + + +.entrada { + color: green; +} + +.saida { + color: red; +} diff --git a/view/src/pages/Finance/index.jsx b/view/src/pages/Finance/index.jsx index 17fb75e..2ec88b1 100644 --- a/view/src/pages/Finance/index.jsx +++ b/view/src/pages/Finance/index.jsx @@ -71,6 +71,22 @@ function Finance() { setSaldo(total); }; + const handleDelete = (index) => { + const novaListaAcoes = [...acoes]; + const acaoRemovida = novaListaAcoes.splice(index, 1)[0]; + + setAcoes(novaListaAcoes); + + // Atualizar o saldo após a remoção do registro + let novoSaldo = saldo; + if (acaoRemovida.tipo === 'Entrada') { + novoSaldo -= acaoRemovida.valor; + } else if (acaoRemovida.tipo === 'Saída') { + novoSaldo += acaoRemovida.valor; + } + setSaldo(novoSaldo); + }; + return ( <> @@ -100,8 +116,9 @@ function Finance() {

{mes} - Ações:

@@ -141,3 +158,4 @@ function Finance() { } export default Finance; +