Autosave: 20260421-184252
This commit is contained in:
parent
0a1f6ad1d2
commit
5de02535d2
BIN
assets/uploads/vouchers/69e7be6c9dbec-8861.png
Normal file
BIN
assets/uploads/vouchers/69e7be6c9dbec-8861.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 404 KiB |
BIN
assets/uploads/vouchers/69e7c183e90b3-Screenshot_245.png
Normal file
BIN
assets/uploads/vouchers/69e7c183e90b3-Screenshot_245.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 329 KiB |
@ -136,6 +136,7 @@ include 'layout_header.php';
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Clave</th>
|
||||
<th>Cliente</th>
|
||||
<th>Celular</th>
|
||||
<th>Producto</th>
|
||||
@ -156,12 +157,19 @@ include 'layout_header.php';
|
||||
<tbody>
|
||||
<?php if (empty($pedidos)): ?>
|
||||
<tr>
|
||||
<td colspan="15" class="text-center">No hay pedidos completados que coincidan con el filtro.</td>
|
||||
<td colspan="17" class="text-center">No hay pedidos completados que coincidan con el filtro.</td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($pedidos as $pedido): ?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($pedido['id']); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$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>
|
||||
<td><?php echo htmlspecialchars($pedido['nombre_completo']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['celular']); ?></td>
|
||||
<td><?php echo htmlspecialchars($pedido['producto']); ?></td>
|
||||
@ -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 = `<input type="text" class="form-control form-control-sm" value="${originalText}">`;
|
||||
const input = cell.querySelector('input');
|
||||
@ -316,6 +325,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cell.classList.contains('editable-recojo')) {
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('id', pedidoId);
|
||||
formData.append('fecha_recojo', newValue);
|
||||
@ -340,6 +350,28 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
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);
|
||||
cell.innerHTML = originalText === '' ? 'N/A' : originalText;
|
||||
alert('Error de conexión.');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
input.addEventListener('blur', saveChanges);
|
||||
|
||||
@ -184,7 +184,13 @@ include 'layout_header.php';
|
||||
<td><?php echo htmlspecialchars($pedido['monto_debe']); ?></td>
|
||||
<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>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="clave"><?php echo htmlspecialchars($pedido['clave'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$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>
|
||||
<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'] ?? ''); ?>">
|
||||
<?php echo htmlspecialchars(!empty($pedido['pendientes']) ? $pedido['pendientes'] : 'Seleccionar'); ?>
|
||||
|
||||
@ -187,7 +187,12 @@ include 'layout_header.php';
|
||||
<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><?php echo htmlspecialchars($pedido['clave'] ?? '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>
|
||||
<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'] ?? ''); ?>">
|
||||
|
||||
10
pedidos.php
10
pedidos.php
@ -162,7 +162,6 @@ include 'layout_header.php';
|
||||
<?php endif; ?>
|
||||
<th>Nº De Orden</th>
|
||||
<th>Codigo De Orden</th>
|
||||
<th>Banco</th>
|
||||
<th>CLAVE</th>
|
||||
<th>Estado</th>
|
||||
<?php if ($user_role !== 'Asesor'): ?><th>Asesor</th><?php endif; ?>
|
||||
@ -187,8 +186,13 @@ include 'layout_header.php';
|
||||
<?php endif; ?>
|
||||
<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>
|
||||
<td><?php echo htmlspecialchars($pedido['banco'] ?? 'N/A'); ?></td>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="clave"><?php echo htmlspecialchars($pedido['clave'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$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>
|
||||
<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; ?>
|
||||
<td><?php echo htmlspecialchars($pedido['created_at']); ?></td>
|
||||
|
||||
@ -273,7 +273,13 @@ include 'layout_header.php';
|
||||
<td><?php echo htmlspecialchars($pedido['monto_debe']); ?></td>
|
||||
<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>
|
||||
<td class="editable" data-id="<?php echo $pedido['id']; ?>" data-field="clave"><?php echo htmlspecialchars($pedido['clave'] ?? 'N/A'); ?></td>
|
||||
<?php
|
||||
$canSeeClave = ($user_role !== 'Asesor' || !empty($pedido['numero_operacion']));
|
||||
$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>
|
||||
<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>
|
||||
<?php if ($user_role !== 'Asesor'): ?><td><?php echo htmlspecialchars($pedido['asesor_nombre'] ?? 'N/A'); ?></td><?php endif; ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user