diff --git a/assets/uploads/vouchers/69e7be6c9dbec-8861.png b/assets/uploads/vouchers/69e7be6c9dbec-8861.png new file mode 100644 index 0000000..fcb6c16 Binary files /dev/null and b/assets/uploads/vouchers/69e7be6c9dbec-8861.png differ diff --git a/assets/uploads/vouchers/69e7c183e90b3-Screenshot_245.png b/assets/uploads/vouchers/69e7c183e90b3-Screenshot_245.png new file mode 100644 index 0000000..715e7aa Binary files /dev/null and b/assets/uploads/vouchers/69e7c183e90b3-Screenshot_245.png differ diff --git a/completados.php b/completados.php index 08f4214..ac01a30 100644 --- a/completados.php +++ b/completados.php @@ -136,6 +136,7 @@ include 'layout_header.php'; ID + Clave Cliente Celular Producto @@ -156,12 +157,19 @@ include 'layout_header.php'; - No hay pedidos completados que coincidan con el filtro. + No hay pedidos completados que coincidan con el filtro. + + + Oculto'; ?> + @@ -289,7 +297,7 @@ document.addEventListener('DOMContentLoaded', function() { if (authorizedRoles.includes(userRole) || userRole.includes('Asesor')) { const table = document.querySelector('.table'); table.addEventListener('dblclick', function(e) { - const cell = e.target.closest('.editable-recojo'); + const cell = e.target.closest('.editable-recojo, .editable'); if (!cell) return; // Evitar doble edición si ya hay un input @@ -299,6 +307,7 @@ document.addEventListener('DOMContentLoaded', function() { const originalText = cell.textContent.trim() === 'N/A' ? '' : cell.textContent.trim(); const pedidoId = cell.dataset.id; + const field = cell.dataset.field; cell.innerHTML = ``; const input = cell.querySelector('input'); @@ -316,30 +325,53 @@ document.addEventListener('DOMContentLoaded', function() { return; } - const formData = new URLSearchParams(); - formData.append('id', pedidoId); - formData.append('fecha_recojo', newValue); + if (cell.classList.contains('editable-recojo')) { + const formData = new URLSearchParams(); + formData.append('id', pedidoId); + formData.append('fecha_recojo', newValue); - fetch('update_recojo.php', { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - body: formData - }) - .then(response => response.json()) - .then(data => { - if (!data.success) { - console.error('Error al guardar:', data.message); + fetch('update_recojo.php', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: formData + }) + .then(response => response.json()) + .then(data => { + if (!data.success) { + console.error('Error al guardar:', data.message); + cell.innerHTML = originalText === '' ? 'N/A' : originalText; // Revertir en caso de error + alert('No se pudo guardar el cambio. Por favor, inténtalo de nuevo.'); + } + }) + .catch(error => { + console.error('Error de red:', error); cell.innerHTML = originalText === '' ? 'N/A' : originalText; // Revertir en caso de error - alert('No se pudo guardar el cambio. Por favor, inténtalo de nuevo.'); - } - }) - .catch(error => { - console.error('Error de red:', error); - cell.innerHTML = originalText === '' ? 'N/A' : originalText; // Revertir en caso de error - alert('Error de conexión. No se pudo guardar el cambio.'); - }); + alert('Error de conexión. No se pudo guardar el cambio.'); + }); + } else if (field === 'clave') { + fetch('update_clave.php', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ id: pedidoId, value: newValue }) + }) + .then(response => response.json()) + .then(data => { + if (data.error) { + console.error('Error al guardar:', data.error); + cell.innerHTML = originalText === '' ? 'N/A' : originalText; + alert('Error: ' + data.error); + } + }) + .catch(error => { + console.error('Error de red:', error); + cell.innerHTML = originalText === '' ? 'N/A' : originalText; + alert('Error de conexión.'); + }); + } }; input.addEventListener('blur', saveChanges); diff --git a/gestiones.php b/gestiones.php index 68b6157..3e22c97 100644 --- a/gestiones.php +++ b/gestiones.php @@ -184,7 +184,13 @@ include 'layout_header.php'; - + + + Oculto'; ?> + diff --git a/listos_para_recojo.php b/listos_para_recojo.php index 581d369..9244fad 100644 --- a/listos_para_recojo.php +++ b/listos_para_recojo.php @@ -187,7 +187,12 @@ include 'layout_header.php'; - + + + Oculto'; ?> + diff --git a/pedidos.php b/pedidos.php index 2974712..b966eb0 100644 --- a/pedidos.php +++ b/pedidos.php @@ -162,7 +162,6 @@ include 'layout_header.php'; Nº De Orden Codigo De Orden - Banco CLAVE Estado Asesor @@ -187,8 +186,13 @@ include 'layout_header.php'; - - + + + Oculto'; ?> + diff --git a/pedidos_en_transito.php b/pedidos_en_transito.php index 475c43b..6a76746 100644 --- a/pedidos_en_transito.php +++ b/pedidos_en_transito.php @@ -273,7 +273,13 @@ include 'layout_header.php'; - + + + Oculto'; ?> + Pendiente