mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: edit product
This commit is contained in:
@@ -6,7 +6,45 @@ function closeModal() {
|
||||
document.getElementById('Modal-create-product').style.display = 'none';
|
||||
}
|
||||
|
||||
document.getElementById('openModal').addEventListener('click', openModal);
|
||||
function editProduct(id) {
|
||||
|
||||
var productId = document.getElementById('productId');
|
||||
var productName = document.getElementById('productName');
|
||||
var productPrice = document.getElementById('productPrice');
|
||||
var productDescription = document.getElementById('productDescription');
|
||||
var productqtd = document.getElementById('productqtd');
|
||||
var categorie = document.getElementById('select-categorie');
|
||||
openModal();
|
||||
// productId.innerHTML = id;
|
||||
productName.value = document.getElementById('name-'+id).innerHTML;
|
||||
var preco = document.getElementById('price-'+id).innerHTML;
|
||||
preco = preco.replace('R$ ', '');
|
||||
preco = preco.replace(',', '.');
|
||||
productPrice.value = preco;
|
||||
// productDescription.value = document.getElementById('description-'+id).innerHTML;
|
||||
productqtd.value = document.getElementById('quantity-'+id).innerHTML;
|
||||
categorie.value = 2;
|
||||
|
||||
// const url = `/products/editProduct/${id}/`;
|
||||
// // window.location.href = url;
|
||||
// fetch(url, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json'
|
||||
// },}).then(function(response) {
|
||||
// return response.text();
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
// .then(function(text) {
|
||||
// var listProductsBalcaoElement = document.getElementById("list-products-balcao");
|
||||
// listProductsBalcaoElement.innerHTML = text;
|
||||
// })
|
||||
}
|
||||
|
||||
// document.getElementById('openModal').addEventListener('click', openModal);
|
||||
|
||||
// document.getElementById('productForm').addEventListener('submit', function(event) {
|
||||
// event.preventDefault();
|
||||
|
||||
Reference in New Issue
Block a user