editor product cuisine

This commit is contained in:
2025-01-13 15:15:42 -03:00
parent c7687f7b9a
commit 956841ef2a
12 changed files with 22 additions and 14 deletions

View File

@@ -24,8 +24,10 @@
onclick="editProduct({{product.id}})" >
</img> <input type="hidden" id="h-category-{{product.id}}" value="{{ product.category.id }}">
<input type="hidden" id="description-{{product.id}}" value="{{ product.description }}">
<input type="hidden" id="cuisine-{{product.id}}" value="{{ product.cuisine }}">
<form action="{% url 'onOffproduct' %}" method="post">
<form hx-post="{% url 'onOffproduct' %}" hx-trigger="click" hx-target="#product-list">
{% csrf_token %}
<input type="hidden" name="id-product" id="id-{{product.id}}" value="{{ product.id }}">

View File

@@ -5,6 +5,8 @@ function openModal() {
var productPrice = document.getElementById('productPrice');
var productDescription = document.getElementById('productDescription');
var productqtd = document.getElementById('productqtd');
var productCuisine = document.getElementById('cuisine');
var categorie = document.getElementById('select-categorie');
var buttonEdit = document.getElementById('edit');
var buttonSave = document.getElementById('save');
@@ -16,6 +18,7 @@ function openModal() {
productPrice.value = '';
productDescription.value ='';
productqtd.value = '';
productCuisine.checked = false
categorie.value = 1;
}
@@ -35,6 +38,7 @@ function editProduct(id) {
var productPrice = document.getElementById('productPrice');
var productDescription = document.getElementById('productDescription');
var productqtd = document.getElementById('productqtd');
var productCuisine = document.getElementById('cuisine');
var categorie = document.getElementById('select-categorie');
productId.value = id;
@@ -45,7 +49,7 @@ function editProduct(id) {
productPrice.value = preco;
productDescription.value = document.getElementById('description-'+id).value;
productqtd.value = document.getElementById('quantity-'+id).innerHTML;
// console.log(document.getElementById('h-category-'+id).value)
productCuisine.checked = document.getElementById('cuisine-'+id).value == 'True' ? true : false;
categorie.value = document.getElementById('h-category-'+id).value;
// const url = `/products/editProduct/${id}/`;