mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 21:45:41 +00:00
removeProductBalcao trocado htmx por ajax
This commit is contained in:
@@ -46,8 +46,8 @@
|
||||
<tr>
|
||||
<td>{{item.product.name}}</td>
|
||||
<td>R$ {{item.product.price}}</td>
|
||||
<td><button
|
||||
hx-get="{% url 'removeProductBalcao' item.id %} " hx-trigger="click" hx-target="#list-products-balcao"
|
||||
<td><button onclick="removeProductBalcao({{item.id}})"
|
||||
|
||||
>🗑️ Excluir</button></td>
|
||||
</tr>
|
||||
|
||||
|
||||
Binary file not shown.
@@ -8,7 +8,9 @@
|
||||
<tr>
|
||||
<td>{{item.product.name}}</td>
|
||||
<td>R$ {{item.product.price}}</td>
|
||||
<td><button hx-get="{% url 'removeProductBalcao' item.id %} " hx-trigger="click" hx-target="#list-products-balcao" >🗑️ Excluir</button></td>
|
||||
<td><button onclick="removeProductBalcao({{item.id}})"
|
||||
|
||||
>🗑️ Excluir</button></td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@@ -120,23 +120,32 @@ function addProductBalcao() {
|
||||
var qtd = document.getElementById('qtd-product').value;
|
||||
console.log(productId, comandaId)
|
||||
const url = `/balcao/addProductBalcaoTeclado${productId}/${comandaId}/${qtd}/`;
|
||||
const listProductsBalcao = document.getElementById('list-products-balcao');
|
||||
fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
|
||||
})
|
||||
.then(function(response) {
|
||||
},}).then(function(response) {
|
||||
return response.text();
|
||||
}).then(function(text) {
|
||||
}).then(function(text) {
|
||||
var listProductsBalcaoElement = document.getElementById("list-products-balcao");
|
||||
listProductsBalcaoElement.innerHTML = text;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// reloadPage()
|
||||
function removeProductBalcao(id) {
|
||||
|
||||
const url = `/balcao/removeProductBalcao${id}/`;
|
||||
fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},}).then(function(response) {
|
||||
return response.text();
|
||||
}).then(function(text) {
|
||||
var listProductsBalcaoElement = document.getElementById("list-products-balcao");
|
||||
listProductsBalcaoElement.innerHTML = text;
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user