Autosave: 20260422-225218
@ -232,6 +232,10 @@ h1, .h1 {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.td-pago-verificado {
|
||||
background-color: #d4edda !important;
|
||||
}
|
||||
|
||||
/* Style for the select element inside the badge */
|
||||
.form-select-pago {
|
||||
background-color: transparent;
|
||||
|
||||
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 44 KiB |
BIN
assets/uploads/vouchers/69e7efd87b04a-Screenshot_247.png
Normal file
|
After Width: | Height: | Size: 305 KiB |
BIN
assets/uploads/vouchers/69e7faefd9668-817.png
Normal file
|
After Width: | Height: | Size: 252 KiB |
BIN
assets/uploads/vouchers/69e7fcc00451f-Screenshot_248.png
Normal file
|
After Width: | Height: | Size: 442 KiB |
BIN
assets/uploads/vouchers/69e8d9539ee73-Screenshot_249.png
Normal file
|
After Width: | Height: | Size: 317 KiB |
BIN
assets/uploads/vouchers/69e8d95ea348c-707.png
Normal file
|
After Width: | Height: | Size: 522 KiB |
BIN
assets/uploads/vouchers/69e8da8e0db2b-Screenshot_250.png
Normal file
|
After Width: | Height: | Size: 303 KiB |
BIN
assets/uploads/vouchers/69e8daadd5b55-406.png
Normal file
|
After Width: | Height: | Size: 241 KiB |
BIN
assets/uploads/vouchers/69e8dac7da65e-280.png
Normal file
|
After Width: | Height: | Size: 418 KiB |
BIN
assets/uploads/vouchers/69e8db6f24f72-2007.png
Normal file
|
After Width: | Height: | Size: 544 KiB |
BIN
assets/uploads/vouchers/69e8dd5131f14-175.png
Normal file
|
After Width: | Height: | Size: 346 KiB |
BIN
assets/uploads/vouchers/69e8de27b5d35-10.png
Normal file
|
After Width: | Height: | Size: 477 KiB |
BIN
assets/uploads/vouchers/69e8de9b56d12-256.png
Normal file
|
After Width: | Height: | Size: 230 KiB |
BIN
assets/uploads/vouchers/69e8e4b923a01-7467.png
Normal file
|
After Width: | Height: | Size: 440 KiB |
BIN
assets/uploads/vouchers/69e8f5d7afa4b-945.png
Normal file
|
After Width: | Height: | Size: 686 KiB |
BIN
assets/uploads/vouchers/69e8f628a42a8-64.png
Normal file
|
After Width: | Height: | Size: 403 KiB |
BIN
assets/uploads/vouchers/69e8f69a457d6-4665.png
Normal file
|
After Width: | Height: | Size: 582 KiB |
BIN
assets/uploads/vouchers/69e8f6f6ecc10-5133.png
Normal file
|
After Width: | Height: | Size: 605 KiB |
BIN
assets/uploads/vouchers/69e8f74c411bd-215.png
Normal file
|
After Width: | Height: | Size: 439 KiB |
BIN
assets/uploads/vouchers/69e8f7a9713bd-494.png
Normal file
|
After Width: | Height: | Size: 377 KiB |
BIN
assets/uploads/vouchers/69e8f8058ac65-551.png
Normal file
|
After Width: | Height: | Size: 435 KiB |
BIN
assets/uploads/vouchers/69e8f851f1206-753.png
Normal file
|
After Width: | Height: | Size: 478 KiB |
BIN
assets/uploads/vouchers/69e8f9951736c-300.png
Normal file
|
After Width: | Height: | Size: 638 KiB |
BIN
assets/uploads/vouchers/69e8f9d073781-844.png
Normal file
|
After Width: | Height: | Size: 480 KiB |
BIN
assets/uploads/vouchers/69e8fa0f89f12-800.png
Normal file
|
After Width: | Height: | Size: 494 KiB |
BIN
assets/uploads/vouchers/69e8fa4d165d1-560.png
Normal file
|
After Width: | Height: | Size: 406 KiB |
BIN
assets/uploads/vouchers/69e8fdb9ca512-47.png
Normal file
|
After Width: | Height: | Size: 485 KiB |
BIN
assets/uploads/vouchers/69e920d527886-475.png
Normal file
|
After Width: | Height: | Size: 483 KiB |
BIN
assets/uploads/vouchers/69e93bd608868-image (10).png
Normal file
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 48 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 42 KiB |
BIN
assets/uploads/vouchers/69e94364e1686-713.png
Normal file
|
After Width: | Height: | Size: 273 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 144 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 44 KiB |
274
completados.php
@ -168,15 +168,19 @@ include 'layout_header.php';
|
||||
<td><?php echo htmlspecialchars($pedido['producto']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['monto_total']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['monto_debe']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['numero_operacion'] ?? 'N/A'); ?></td>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="numero_operacion">
|
||||
<?php echo htmlspecialchars($pedido['numero_operacion'] ?? 'N/A'); ?>
|
||||
</td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$canSeeClave = ($user_role !== 'Asesor' || (!empty($pedido['numero_operacion']) && !empty($pedido['banco'])));
|
||||
$isEditableClave = ($user_role !== 'Asesor') ? 'editable' : '';
|
||||
?>
|
||||
<td class="<?php echo $isEditableClave; ?>" data-id="<?php echo $pedido['id']; ?>" data-field="clave">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
<td class="<?php echo $isEditableClave; ?> clave-cell" data-id="<?php echo $pedido['id']; ?>" data-field="clave" id="clave-<?php echo $pedido['id']; ?>">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
<td class="editable-select" data-id="<?php echo $pedido['id']; ?>" data-field="banco">
|
||||
<?php echo !empty($pedido['banco']) ? htmlspecialchars($pedido['banco']) : 'N/A'; ?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars($pedido['banco'] ?? 'N/A'); ?></td>
|
||||
<td <?php if (in_array($user_role, ['Administrador', 'personal', 'Verificador de Pagos', 'Control Logistico', 'Logistica']) || strpos($user_role, 'Asesor') !== false) { echo 'class="editable-recojo" data-id="'.$pedido['id'].'" title="Doble clic para editar"'; } ?>>
|
||||
<?php echo !empty($pedido['fecha_recojo']) ? htmlspecialchars($pedido['fecha_recojo']) : 'N/A'; ?>
|
||||
</td>
|
||||
@ -205,7 +209,7 @@ include 'layout_header.php';
|
||||
N/A
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<td class="<?php echo (isset($pedido['estado_pago']) && $pedido['estado_pago'] == 'Verificado') ? 'td-pago-verificado' : ''; ?>">
|
||||
<?php
|
||||
$estado_pago_class = '';
|
||||
if (isset($pedido['estado_pago'])) {
|
||||
@ -243,12 +247,50 @@ include 'layout_header.php';
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function updatePedidoField(pedidoId, field, value) {
|
||||
fetch('update_pedido_field.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ id: pedidoId, field: field, value: value })
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log(`${field} actualizado con éxito.`);
|
||||
|
||||
// Si el usuario es Asesor, verificar si ahora puede ver la clave
|
||||
const userRole = "<?php echo $user_role; ?>";
|
||||
if (userRole === 'Asesor') {
|
||||
const pedido = data.pedido;
|
||||
const claveCell = document.getElementById(`clave-${pedidoId}`);
|
||||
if (pedido.numero_operacion && pedido.banco) {
|
||||
claveCell.innerHTML = pedido.clave || 'N/A';
|
||||
} else {
|
||||
claveCell.innerHTML = '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>';
|
||||
}
|
||||
}
|
||||
} else if (data.error) {
|
||||
alert('Error: ' + data.error);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
alert('Hubo un error de conexión.');
|
||||
});
|
||||
}
|
||||
|
||||
function updateEstadoPago(pedidoId, selectElement) {
|
||||
const estado = selectElement.value;
|
||||
const badge = selectElement.closest('.badge');
|
||||
const td = selectElement.closest('td');
|
||||
|
||||
// Guardar el estado original en caso de error
|
||||
const originalState = Array.from(selectElement.options).find(opt => opt.defaultSelected).value;
|
||||
const originalOption = Array.from(selectElement.options).find(opt => opt.defaultSelected);
|
||||
const originalState = originalOption ? originalOption.value : selectElement.value;
|
||||
|
||||
console.log(`Actualizando pedido ${pedidoId} a estado: ${estado}`);
|
||||
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('pedido_id', pedidoId);
|
||||
@ -261,31 +303,41 @@ function updateEstadoPago(pedidoId, selectElement) {
|
||||
},
|
||||
body: formData
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error('Respuesta de red no OK');
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
console.log('Estado de pago actualizado con éxito.');
|
||||
// Actualizar color del badge dinámicamente
|
||||
console.log('Estado de pago actualizado con éxito en el servidor.');
|
||||
|
||||
// Limpiar clases previas
|
||||
badge.classList.remove('estado-pago-pendiente', 'estado-pago-verificado');
|
||||
td.classList.remove('td-pago-verificado');
|
||||
|
||||
// Aplicar nuevas clases según el estado
|
||||
if (estado === 'Pendiente a verificación') {
|
||||
badge.classList.add('estado-pago-pendiente');
|
||||
} else if (estado === 'Verificado') {
|
||||
badge.classList.add('estado-pago-verificado');
|
||||
td.classList.add('td-pago-verificado');
|
||||
}
|
||||
// Actualizar el estado 'selected' del <select>
|
||||
|
||||
// Actualizar el estado 'defaultSelected' para futuras reversiones
|
||||
Array.from(selectElement.options).forEach(opt => {
|
||||
opt.defaultSelected = (opt.value === estado);
|
||||
});
|
||||
} else {
|
||||
console.error('Error del servidor:', data.message);
|
||||
alert('Error: ' + (data.message || 'No se pudo actualizar el estado.'));
|
||||
// Revertir el <select> al estado original
|
||||
selectElement.value = originalState;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error:', error);
|
||||
console.error('Error de conexión:', error);
|
||||
alert('Hubo un error de conexión al intentar actualizar el estado.');
|
||||
// Revertir el <select> al estado original
|
||||
selectElement.value = originalState;
|
||||
});
|
||||
}
|
||||
@ -297,92 +349,140 @@ 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, .editable');
|
||||
const cell = e.target.closest('.editable-recojo, .editable, .editable-select');
|
||||
if (!cell) return;
|
||||
|
||||
// Evitar doble edición si ya hay un input
|
||||
if (cell.querySelector('input')) {
|
||||
// Evitar doble edición si ya hay un input o select
|
||||
if (cell.querySelector('input, select')) {
|
||||
return;
|
||||
}
|
||||
|
||||
const originalText = cell.textContent.trim() === 'N/A' ? '' : cell.textContent.trim();
|
||||
const originalText = cell.textContent.trim() === 'N/A' || cell.textContent.trim() === 'Seleccionar' ? '' : cell.textContent.trim();
|
||||
const pedidoId = cell.dataset.id;
|
||||
const field = cell.dataset.field;
|
||||
|
||||
cell.innerHTML = `<input type="text" class="form-control form-control-sm" value="${originalText}">`;
|
||||
const input = cell.querySelector('input');
|
||||
if (cell.classList.contains('editable-select')) {
|
||||
const bancos = ['YAPE', 'PLIN', 'BCP', 'INTERBANK', 'BANCO DE LA NACION', 'BBVA'];
|
||||
let options = '<option value="">Seleccionar</option>';
|
||||
bancos.forEach(b => {
|
||||
options += `<option value="${b}" ${originalText === b ? 'selected' : ''}>${b}</option>`;
|
||||
});
|
||||
cell.innerHTML = `<select class="form-select form-select-sm">${options}</select>`;
|
||||
const select = cell.querySelector('select');
|
||||
select.focus();
|
||||
|
||||
input.focus();
|
||||
const saveSelectChanges = function() {
|
||||
const newValue = select.value;
|
||||
cell.innerHTML = newValue === '' ? 'N/A' : newValue;
|
||||
if (newValue === originalText) return;
|
||||
updatePedidoField(pedidoId, field, newValue);
|
||||
};
|
||||
|
||||
const saveChanges = function() {
|
||||
const newValue = input.value.trim();
|
||||
select.addEventListener('blur', saveSelectChanges);
|
||||
select.addEventListener('change', function() {
|
||||
select.blur();
|
||||
});
|
||||
|
||||
// Reemplazar el input con el texto
|
||||
cell.innerHTML = newValue === '' ? 'N/A' : newValue;
|
||||
|
||||
// Si el valor no ha cambiado, no hacer nada
|
||||
if (newValue === originalText) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
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.');
|
||||
});
|
||||
} 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);
|
||||
select.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape') {
|
||||
select.removeEventListener('blur', saveSelectChanges);
|
||||
cell.innerHTML = originalText === '' ? 'N/A' : originalText;
|
||||
alert('Error de conexión.');
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
} else {
|
||||
cell.innerHTML = `<input type="text" class="form-control form-control-sm" value="${originalText}">`;
|
||||
const input = cell.querySelector('input');
|
||||
|
||||
input.addEventListener('blur', saveChanges);
|
||||
input.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
input.blur(); // Dispara el evento blur para guardar
|
||||
} else if (e.key === 'Escape') {
|
||||
input.removeEventListener('blur', saveChanges); // Evitar que se guarde
|
||||
cell.innerHTML = originalText === '' ? 'N/A' : originalText;
|
||||
}
|
||||
});
|
||||
input.focus();
|
||||
|
||||
const saveChanges = function() {
|
||||
const newValue = input.value.trim();
|
||||
|
||||
// Reemplazar el input con el texto
|
||||
cell.innerHTML = newValue === '' ? 'N/A' : newValue;
|
||||
|
||||
// Si el valor no ha cambiado, no hacer nada
|
||||
if (newValue === originalText) {
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
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.');
|
||||
});
|
||||
} // Cierre de if (cell.classList.contains('editable-recojo'))
|
||||
|
||||
if (field === 'clave' || field === 'numero_operacion') {
|
||||
if (field === 'numero_operacion' && newValue !== '' && newValue.length < 6) {
|
||||
alert('El número de operación debe tener al menos 6 dígitos.');
|
||||
cell.innerHTML = originalText === '' ? 'N/A' : originalText;
|
||||
return;
|
||||
}
|
||||
fetch('update_pedido_field.php', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({ id: pedidoId, field: field, value: newValue })
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
// Si es numero_operacion y es Asesor, verificar visibilidad de clave
|
||||
if (field === 'numero_operacion' && userRole === 'Asesor') {
|
||||
const pedido = data.pedido;
|
||||
const claveCell = document.getElementById(`clave-${pedidoId}`);
|
||||
if (pedido.numero_operacion && pedido.banco) {
|
||||
claveCell.innerHTML = pedido.clave || 'N/A';
|
||||
} else {
|
||||
claveCell.innerHTML = '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>';
|
||||
}
|
||||
}
|
||||
} else 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);
|
||||
input.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Enter') {
|
||||
input.blur(); // Dispara el evento blur para guardar
|
||||
} else if (e.key === 'Escape') {
|
||||
input.removeEventListener('blur', saveChanges); // Evitar que se guarde
|
||||
cell.innerHTML = originalText === '' ? 'N/A' : originalText;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -0,0 +1,2 @@
|
||||
-- Migration: Add asesor to operaciones_provincia
|
||||
ALTER TABLE operaciones_provincia ADD COLUMN asesor VARCHAR(255) AFTER fecha_completado;
|
||||
@ -185,11 +185,11 @@ include 'layout_header.php';
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="codigo_rastreo"><?php echo htmlspecialchars($pedido['codigo_rastreo'] ?? 'N/A'); ?></td>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="codigo_tracking"><?php echo htmlspecialchars($pedido['codigo_tracking'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$canSeeClave = ($user_role !== 'Asesor' || (!empty($pedido['numero_operacion']) && !empty($pedido['banco'])));
|
||||
$isEditableClave = ($user_role !== 'Asesor') ? 'editable' : '';
|
||||
?>
|
||||
<td class="<?php echo $isEditableClave; ?>" data-id="<?php echo $pedido['id']; ?>" data-field="clave">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
<td class="editable-pendientes" data-id="<?php echo $pedido['id']; ?>" data-value="<?php echo htmlspecialchars($pedido['pendientes'] ?? ''); ?>" style="cursor: pointer;">
|
||||
<span class="badge" style="<?php echo getPendientesStyle($pedido['pendientes'] ?? ''); ?>">
|
||||
|
||||
@ -188,11 +188,12 @@ include 'layout_header.php';
|
||||
<td><?php echo htmlspecialchars($pedido['monto_debe']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['numero_operacion'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
?>
|
||||
<td>
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
$canSeeClave = ($user_role !== 'Asesor' || (!empty($pedido['numero_operacion']) && !empty($pedido['banco'])));
|
||||
$isEditableClave = ($user_role !== 'Asesor') ? 'editable' : '';
|
||||
?>
|
||||
<td class="<?php echo $isEditableClave; ?>" data-id="<?php echo $pedido['id']; ?>" data-field="clave">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
<td class="editable-recojo" data-id="<?php echo $pedido['id']; ?>" style="background-color: #d4edda; font-weight: bold;">
|
||||
<span class="text" title="Doble clic para editar"><?php echo !empty($pedido['fecha_recojo']) ? htmlspecialchars($pedido['fecha_recojo']) : 'N/A'; ?></span>
|
||||
<input type="text" class="form-control edit-input" style="display: none;" value="<?php echo htmlspecialchars($pedido['fecha_recojo'] ?? ''); ?>">
|
||||
|
||||
@ -106,13 +106,14 @@ try {
|
||||
<th>Nro. Operación</th>
|
||||
<th>Banco</th>
|
||||
<th>Fecha Completado</th>
|
||||
<th>Asesor</th>
|
||||
<th>Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($operaciones)): ?>
|
||||
<tr class="no-data">
|
||||
<td colspan="10" class="text-center py-4 text-muted">No hay operaciones registradas para esta fecha.</td>
|
||||
<td colspan="11" class="text-center py-4 text-muted">No hay operaciones registradas para esta fecha.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($operaciones as $op): ?>
|
||||
@ -135,6 +136,7 @@ try {
|
||||
}
|
||||
}
|
||||
?></td>
|
||||
<td contenteditable="true" data-column="asesor"><?php echo htmlspecialchars($op['asesor'] ?? ''); ?></td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-outline-danger btn-sm delete-row">
|
||||
<i class="fas fa-trash"></i>
|
||||
@ -200,6 +202,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
<td contenteditable="true" data-column="nro_operacion"></td>
|
||||
<td contenteditable="true" data-column="banco"></td>
|
||||
<td contenteditable="true" data-column="fecha_completado">${currentDateTime}</td>
|
||||
<td contenteditable="true" data-column="asesor"></td>
|
||||
<td class="text-center">
|
||||
<button class="btn btn-outline-danger btn-sm delete-row">
|
||||
<i class="fas fa-trash"></i>
|
||||
@ -270,7 +273,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
row.remove();
|
||||
updateSummary();
|
||||
if (tbody.children.length === 0) {
|
||||
tbody.innerHTML = '<tr class="no-data"><td colspan="10" class="text-center py-4 text-muted">No hay operaciones registradas para esta fecha.</td></tr>';
|
||||
tbody.innerHTML = '<tr class="no-data"><td colspan="11" class="text-center py-4 text-muted">No hay operaciones registradas para esta fecha.</td></tr>';
|
||||
}
|
||||
} else {
|
||||
alert('Error al eliminar: ' + data.message);
|
||||
|
||||
@ -154,7 +154,7 @@ include 'layout_header.php';
|
||||
<i class="bi bi-eye"></i> 👁️
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">Ingresa un número de operación válido para ver la clave.</small>
|
||||
<small class="text-muted">Ingresa un número de operación válido y selecciona el banco para ver la clave.</small>
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label for="pendientes" class="form-label">Pendientes</label>
|
||||
@ -209,7 +209,7 @@ include 'layout_header.php';
|
||||
<?php endif; ?>
|
||||
<div class="col-md-3 mb-3">
|
||||
<label for="numero_operacion" class="form-label">Número de Operación</label>
|
||||
<input type="text" class="form-control" id="numero_operacion" name="numero_operacion" value="<?php echo htmlspecialchars($pedido['numero_operacion'] ?? ''); ?>">
|
||||
<input type="text" class="form-control" id="numero_operacion" name="numero_operacion" value="<?php echo htmlspecialchars($pedido['numero_operacion'] ?? ''); ?>" minlength="6">
|
||||
<div id="operacion-feedback" class="form-text"></div>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
@ -276,6 +276,7 @@ include 'layout_header.php';
|
||||
<script>
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const numeroOperacionInput = document.getElementById('numero_operacion');
|
||||
const bancoInput = document.getElementById('banco');
|
||||
const operacionFeedback = document.getElementById('operacion-feedback');
|
||||
const claveInput = document.getElementById('clave');
|
||||
const toggleClaveBtn = document.getElementById('toggleClave');
|
||||
@ -284,6 +285,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
function validateOperacion() {
|
||||
const value = numeroOperacionInput.value.trim();
|
||||
const bancoValue = bancoInput.value;
|
||||
|
||||
if (value === '') {
|
||||
operacionFeedback.innerHTML = '';
|
||||
@ -293,6 +295,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.length < 6) {
|
||||
operacionFeedback.innerHTML = '<span class="text-danger">⚠️ El número debe tener al menos 6 dígitos</span>';
|
||||
numeroOperacionInput.classList.add('is-invalid');
|
||||
numeroOperacionInput.classList.remove('is-valid');
|
||||
toggleClaveBtn.disabled = true;
|
||||
claveInput.type = 'password';
|
||||
submitBtn.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`check_duplicate_operation.php?numero_operacion=${encodeURIComponent(value)}&pedido_id=${pedidoId}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
@ -307,7 +319,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
operacionFeedback.innerHTML = '<span class="text-success">✅ Número disponible</span>';
|
||||
numeroOperacionInput.classList.remove('is-invalid');
|
||||
numeroOperacionInput.classList.add('is-valid');
|
||||
toggleClaveBtn.disabled = false;
|
||||
|
||||
// Solo habilitar si también hay banco seleccionado
|
||||
if (bancoValue !== '') {
|
||||
toggleClaveBtn.disabled = false;
|
||||
} else {
|
||||
toggleClaveBtn.disabled = true;
|
||||
claveInput.type = 'password';
|
||||
}
|
||||
submitBtn.disabled = false;
|
||||
}
|
||||
})
|
||||
@ -317,6 +336,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
}
|
||||
|
||||
numeroOperacionInput.addEventListener('input', validateOperacion);
|
||||
bancoInput.addEventListener('change', validateOperacion);
|
||||
|
||||
// Run validation on load if there's a value
|
||||
if (numeroOperacionInput.value.trim() !== '') {
|
||||
|
||||
@ -187,11 +187,11 @@ include 'layout_header.php';
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="codigo_rastreo"><?php echo htmlspecialchars($pedido['codigo_rastreo'] ?? 'N/A'); ?></td>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="codigo_tracking"><?php echo htmlspecialchars($pedido['codigo_tracking'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$canSeeClave = ($user_role !== 'Asesor' || (!empty($pedido['numero_operacion']) && !empty($pedido['banco'])));
|
||||
$isEditableClave = ($user_role !== 'Asesor') ? 'editable' : '';
|
||||
?>
|
||||
<td class="<?php echo $isEditableClave; ?>" data-id="<?php echo $pedido['id']; ?>" data-field="clave">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
<td><span class="badge" style="<?php echo getStatusStyle($pedido['estado']); ?>"><?php echo ($pedido['estado'] == 'Gestion') ? 'GESTIONES ⚙️' : htmlspecialchars($pedido['estado']); ?></span></td>
|
||||
<?php if ($user_role !== 'Asesor'): ?><td><?php echo htmlspecialchars($pedido['asesor_nombre'] ?? 'N/A'); ?></td><?php endif; ?>
|
||||
|
||||
@ -203,7 +203,7 @@ include 'layout_header.php';
|
||||
<?php endif; ?>
|
||||
<div class="col-md-3 mb-3">
|
||||
<label for="numero_operacion" class="form-label">Número de Operación</label>
|
||||
<input type="text" class="form-control" id="numero_operacion" name="numero_operacion" value="<?php echo htmlspecialchars($pedido['numero_operacion'] ?? ''); ?>">
|
||||
<input type="text" class="form-control" id="numero_operacion" name="numero_operacion" value="<?php echo htmlspecialchars($pedido['numero_operacion'] ?? ''); ?>" minlength="6">
|
||||
<div id="operacion-feedback" class="form-text"></div>
|
||||
</div>
|
||||
<div class="col-md-3 mb-3">
|
||||
@ -262,6 +262,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.length < 6) {
|
||||
operacionFeedback.innerHTML = '<span class="text-danger">⚠️ El número debe tener al menos 6 dígitos</span>';
|
||||
numeroOperacionInput.classList.add('is-invalid');
|
||||
numeroOperacionInput.classList.remove('is-valid');
|
||||
submitBtn.disabled = true;
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(`check_duplicate_operation.php?numero_operacion=${encodeURIComponent(value)}&pedido_id=${pedidoId}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
|
||||
@ -274,11 +274,11 @@ include 'layout_header.php';
|
||||
<td><?php echo htmlspecialchars($pedido['codigo_rastreo'] ?? 'N/A'); ?></td>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="codigo_tracking"><?php echo htmlspecialchars($pedido['codigo_tracking'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$canSeeClave = ($user_role !== 'Asesor' || (!empty($pedido['numero_operacion']) && !empty($pedido['banco'])));
|
||||
$isEditableClave = ($user_role !== 'Asesor') ? 'editable' : '';
|
||||
?>
|
||||
<td class="<?php echo $isEditableClave; ?>" data-id="<?php echo $pedido['id']; ?>" data-field="clave">
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
<?php echo $canSeeClave ? htmlspecialchars($pedido['clave'] ?? 'N/A') : '<i class="fas fa-eye-slash text-muted" title="Suba el número de operación y seleccione el banco para ver la clave"></i> <span class="text-muted" style="font-size: 0.8rem;">Oculto</span>'; ?>
|
||||
</td>
|
||||
<td><span class="badge" style="<?php echo getStatusStyle($pedido['estado']); ?>"><?php echo ($pedido['estado'] == 'Gestion') ? 'GESTIONES ⚙️' : htmlspecialchars($pedido['estado']); ?></span></td>
|
||||
<td id="live-status-<?php echo $pedido['id']; ?>"><span class="badge bg-light text-dark">Pendiente</span></td>
|
||||
|
||||
@ -38,7 +38,7 @@ try {
|
||||
|
||||
$allowed_columns = [
|
||||
'cliente', 'celular', 'producto', 'monto_total',
|
||||
'monto_debe', 'nro_operacion', 'banco', 'fecha_completado'
|
||||
'monto_debe', 'nro_operacion', 'banco', 'fecha_completado', 'asesor'
|
||||
];
|
||||
|
||||
if (!in_array($column, $allowed_columns)) {
|
||||
|
||||
@ -96,6 +96,17 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check for minimum length of operation number
|
||||
if (!empty($numero_operacion) && strlen($numero_operacion) < 6) {
|
||||
$error_message = urlencode("El número de operación debe tener al menos 6 dígitos.");
|
||||
$redirect_url = 'pedido_form.php?error=' . $error_message;
|
||||
if ($id) {
|
||||
$redirect_url .= '&id=' . $id;
|
||||
}
|
||||
header('Location: ' . $redirect_url);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check for duplicate operation number
|
||||
if (!empty($numero_operacion)) {
|
||||
$check_sql = "SELECT id FROM pedidos WHERE numero_operacion = ? AND id != ?";
|
||||
@ -180,12 +191,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$sql_parts[] = "fecha_completado = NOW()";
|
||||
|
||||
// --- NEW: Insert into operaciones_provincia ---
|
||||
$stmt_p = $pdo->prepare("SELECT * FROM pedidos WHERE id = ?");
|
||||
$stmt_p = $pdo->prepare("SELECT p.*, u.nombre_asesor FROM pedidos p LEFT JOIN users u ON p.asesor_id = u.id WHERE p.id = ?");
|
||||
$stmt_p->execute([$id]);
|
||||
$p_data = $stmt_p->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if ($p_data) {
|
||||
$stmt_op = $pdo->prepare("INSERT INTO operaciones_provincia (pedido_id, cliente, celular, producto, monto_total, monto_debe, nro_operacion, banco, fecha_completado) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW())");
|
||||
$stmt_op = $pdo->prepare("INSERT INTO operaciones_provincia (pedido_id, cliente, celular, producto, monto_total, monto_debe, nro_operacion, banco, fecha_completado, asesor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)");
|
||||
$stmt_op->execute([
|
||||
$id,
|
||||
$p_data['nombre_completo'],
|
||||
@ -194,7 +205,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$p_data['monto_total'],
|
||||
$p_data['monto_debe'],
|
||||
$numero_operacion,
|
||||
$banco
|
||||
$banco,
|
||||
$p_data['nombre_asesor']
|
||||
]);
|
||||
}
|
||||
// --- End of NEW ---
|
||||
@ -233,7 +245,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
// --- NEW: Insert into operaciones_provincia if completed ---
|
||||
if (in_array($estado, $completed_states)) {
|
||||
$stmt_op = $pdo->prepare("INSERT INTO operaciones_provincia (pedido_id, cliente, celular, producto, monto_total, monto_debe, nro_operacion, banco, fecha_completado) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW())");
|
||||
$stmt_u = $pdo->prepare("SELECT nombre_asesor FROM users WHERE id = ?");
|
||||
$stmt_u->execute([$_SESSION['user_id']]);
|
||||
$nombre_asesor = $stmt_u->fetchColumn();
|
||||
|
||||
$stmt_op = $pdo->prepare("INSERT INTO operaciones_provincia (pedido_id, cliente, celular, producto, monto_total, monto_debe, nro_operacion, banco, fecha_completado, asesor) VALUES (?, ?, ?, ?, ?, ?, ?, ?, NOW(), ?)");
|
||||
$stmt_op->execute([
|
||||
$new_id,
|
||||
$nombre_completo,
|
||||
@ -242,7 +258,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$monto_total,
|
||||
$monto_debe,
|
||||
$numero_operacion,
|
||||
$banco
|
||||
$banco,
|
||||
$nombre_asesor
|
||||
]);
|
||||
}
|
||||
// --- End of NEW ---
|
||||
|
||||
@ -62,6 +62,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check for minimum length of operation number
|
||||
if (!empty($numero_operacion) && strlen($numero_operacion) < 6) {
|
||||
$error_message = urlencode("El número de operación debe tener al menos 6 dígitos.");
|
||||
$id_param = $id ? '&id=' . $id : '';
|
||||
header('Location: pedidos_contraentrega.php?error=' . $error_message . $id_param);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Check for duplicate operation number
|
||||
if (!empty($numero_operacion)) {
|
||||
$check_sql = "SELECT id FROM pedidos WHERE numero_operacion = ? AND id != ?";
|
||||
|
||||
@ -16,17 +16,17 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
|
||||
// Get input data
|
||||
$pedido_id = $_POST['pedido_id'] ?? null;
|
||||
$estado_pago = $_POST['estado_pago'] ?? null;
|
||||
$estado_pago = isset($_POST['estado_pago']) ? trim($_POST['estado_pago']) : null;
|
||||
|
||||
// Validate input
|
||||
if (empty($pedido_id) || empty($estado_pago)) {
|
||||
echo json_encode(['success' => false, 'message' => 'Datos incompletos.']);
|
||||
echo json_encode(['success' => false, 'message' => 'Datos incompletos. ID: ' . $pedido_id . ', Estado: ' . $estado_pago]);
|
||||
exit;
|
||||
}
|
||||
|
||||
$allowed_statuses = ['Pendiente a verificación', 'Verificado'];
|
||||
if (!in_array($estado_pago, $allowed_statuses)) {
|
||||
echo json_encode(['success' => false, 'message' => 'Estado no válido.']);
|
||||
echo json_encode(['success' => false, 'message' => 'Estado no válido: ' . $estado_pago]);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -36,9 +36,9 @@ try {
|
||||
$pdo = db();
|
||||
$sql = "UPDATE pedidos SET estado_pago = ? WHERE id = ?";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$success = $stmt->execute([$estado_pago, $pedido_id]);
|
||||
$stmt->execute([$estado_pago, $pedido_id]);
|
||||
|
||||
if ($success) {
|
||||
if ($stmt->rowCount() >= 0) { // rowCount can be 0 if the value didn't change
|
||||
echo json_encode(['success' => true, 'message' => 'Estado de pago actualizado.']);
|
||||
} else {
|
||||
echo json_encode(['success' => false, 'message' => 'No se pudo actualizar la base de datos.']);
|
||||
|
||||
66
update_pedido_field.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once 'db/config.php';
|
||||
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
http_response_code(403);
|
||||
echo json_encode(['error' => 'Acceso no autorizado.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
if (!$data || !isset($data['id']) || !isset($data['field']) || !isset($data['value'])) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Datos incompletos.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
$pedido_id = $data['id'];
|
||||
$field = $data['field'];
|
||||
$value = $data['value'];
|
||||
|
||||
// Whitelist allowed fields for security
|
||||
$allowed_fields = ['numero_operacion', 'banco', 'clave', 'fecha_recojo'];
|
||||
if (!in_array($field, $allowed_fields)) {
|
||||
http_response_code(400);
|
||||
echo json_encode(['error' => 'Campo no permitido.']);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
|
||||
// If updating numero_operacion, check for duplicates (optional but good)
|
||||
if ($field === 'numero_operacion' && !empty($value)) {
|
||||
if (strlen($value) < 6) {
|
||||
echo json_encode(['error' => 'El número de operación debe tener al menos 6 dígitos.']);
|
||||
exit;
|
||||
}
|
||||
$stmt_check = $pdo->prepare("SELECT id FROM pedidos WHERE numero_operacion = ? AND id != ?");
|
||||
$stmt_check->execute([$value, $pedido_id]);
|
||||
if ($stmt_check->fetch()) {
|
||||
echo json_encode(['error' => 'El número de operación ya existe en otro pedido.']);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "UPDATE pedidos SET $field = ? WHERE id = ?";
|
||||
$stmt = $pdo->prepare($sql);
|
||||
$stmt->execute([$value, $pedido_id]);
|
||||
|
||||
// Fetch the updated pedido to return relevant info (like the clave if it's now visible)
|
||||
$stmt_fetch = $pdo->prepare("SELECT clave, numero_operacion, banco FROM pedidos WHERE id = ?");
|
||||
$stmt_fetch->execute([$pedido_id]);
|
||||
$updated_pedido = $stmt_fetch->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'Campo actualizado correctamente.',
|
||||
'pedido' => $updated_pedido
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error' => 'Error al actualizar la base de datos: ' . $e->getMessage()]);
|
||||
}
|
||||
?>
|
||||