This commit is contained in:
Welton Silva
2026-02-25 17:32:27 -03:00
parent 4141650e2a
commit 82d25eb68f
2 changed files with 6 additions and 8 deletions

View File

@@ -97,7 +97,6 @@ function renderClientesTable(data) {
<div style="display:flex;gap:6px"> <div style="display:flex;gap:6px">
<button class="btn btn-info btn-sm btn-hist-cli" data-id="${c.id}" title="Ver Fiados">📜</button> <button class="btn btn-info btn-sm btn-hist-cli" data-id="${c.id}" title="Ver Fiados">📜</button>
<button class="btn btn-secondary btn-sm btn-edit-cli" data-id="${c.id}">Editar</button> <button class="btn btn-secondary btn-sm btn-edit-cli" data-id="${c.id}">Editar</button>
<button class="btn btn-danger btn-sm btn-del-cli" data-id="${c.id}">Excluir</button>
</div> </div>
</td> </td>
</tr>`; </tr>`;
@@ -119,13 +118,7 @@ function renderClientesTable(data) {
}); });
}); });
wrap.querySelectorAll('.btn-del-cli').forEach(btn =>
btn.addEventListener('click', async () => {
const r = await window.electronAPI.delete(`/clients/${btn.dataset.id}/`);
if (r.ok) { showToast('Cliente excluído!', 'success'); loadClientes(); }
else showToast(r.error, 'error');
})
);
} }
function filtrarClientes() { function filtrarClientes() {

View File

@@ -174,6 +174,10 @@ function abrirModalProduto(produto, categorias) {
<label>Descrição</label> <label>Descrição</label>
<input type="text" id="prod-desc" class="form-control" value="${produto?.description || ''}" placeholder="Descrição opcional" /> <input type="text" id="prod-desc" class="form-control" value="${produto?.description || ''}" placeholder="Descrição opcional" />
</div> </div>
<div class="form-group" style="grid-column:1/-1">
<label>Imagem</label>
<input type="file" id="prod-img" accept="image/*" class="form-control" />
</div>
</div>`, </div>`,
footer: ` footer: `
<button class="btn btn-secondary btn-md" onclick="closeModal()">Cancelar</button> <button class="btn btn-secondary btn-md" onclick="closeModal()">Cancelar</button>
@@ -185,6 +189,7 @@ function abrirModalProduto(produto, categorias) {
const data = { const data = {
name: document.getElementById('prod-nome').value, name: document.getElementById('prod-nome').value,
description: document.getElementById('prod-desc').value, description: document.getElementById('prod-desc').value,
//image: document.getElementById('prod-img').value,
price: parseFloat(document.getElementById('prod-preco').value) || 0, price: parseFloat(document.getElementById('prod-preco').value) || 0,
quantity: parseInt(document.getElementById('prod-qty').value) || 0, quantity: parseInt(document.getElementById('prod-qty').value) || 0,
category: catVal, category: catVal,