Update lab_domicilios.php
This commit is contained in:
+29
-7
@@ -101,10 +101,10 @@ $domIdParam = (int)($_GET['id'] ?? 0);
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover mb-0">
|
||||
<thead class="table-light">
|
||||
<tr><th>Hora</th><th>Paciente</th><th>Enfermera</th><th>Estado</th></tr>
|
||||
<tr><th>Fecha</th><th>Hora</th><th>Paciente</th><th>Enfermera</th><th>Estado</th></tr>
|
||||
</thead>
|
||||
<tbody id="tabla-body">
|
||||
<tr><td colspan="4" class="text-center py-4 text-muted"><i class="fas fa-spinner fa-spin"></i></td></tr>
|
||||
<tr><td colspan="5" class="text-center py-4 text-muted"><i class="fas fa-spinner fa-spin"></i></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -437,14 +437,15 @@ async function cargarLista(pag = 1) {
|
||||
|
||||
const tbody = document.getElementById('tabla-body');
|
||||
if (!d.data?.length) {
|
||||
tbody.innerHTML = '<tr><td colspan="4" class="text-center py-4 text-muted">Sin domicilios</td></tr>';
|
||||
tbody.innerHTML = '<tr><td colspan="5" class="text-center py-4 text-muted">Sin domicilios</td></tr>';
|
||||
document.getElementById('paginacion').innerHTML = '';
|
||||
return;
|
||||
}
|
||||
|
||||
tbody.innerHTML = d.data.map(dom => `
|
||||
<tr class="dom-row ${domSeleccionado===dom.id?'table-active':''}" id="row-${dom.id}" onclick="verDomicilio(${dom.id})">
|
||||
<td>${dom.hora_programada||'—'}</td>
|
||||
<td class="text-nowrap small">${dom.fecha_programada ? dom.fecha_programada.slice(5).replace('-','/') : '—'}</td>
|
||||
<td>${dom.hora_programada ? dom.hora_programada.slice(0,5) : '—'}</td>
|
||||
<td>
|
||||
<div class="fw-semibold">${esc(dom.paciente_nombre)}</div>
|
||||
<small class="text-muted">${esc(dom.barrio||'')}</small>
|
||||
@@ -566,9 +567,30 @@ async function verDomicilio(id) {
|
||||
${dom.orden_id ? `
|
||||
<div class="mb-3">
|
||||
<label class="form-label small text-muted text-uppercase">Orden médica</label>
|
||||
<a href="lab_ordenes.php?id=${dom.orden_id}" class="d-block small">
|
||||
<i class="fas fa-file-medical me-1"></i>Ver orden #${dom.orden_id}
|
||||
</a>
|
||||
${(() => {
|
||||
const lf = dom.orden_local_file || '';
|
||||
const isImg = /\.(jpe?g|png|gif|webp)$/i.test(lf);
|
||||
const url = lf ? 'uploads/media/' + encodeURIComponent(lf) : '';
|
||||
if (lf && isImg) return `
|
||||
<a href="${url}" target="_blank" title="Ver imagen completa">
|
||||
<img src="${url}" alt="Orden médica"
|
||||
style="max-width:100%;max-height:180px;object-fit:contain;border-radius:6px;border:1px solid #dee2e6;display:block;cursor:zoom-in">
|
||||
</a>
|
||||
<a href="lab_ordenes.php?id=${dom.orden_id}" class="d-block small mt-1 text-muted">
|
||||
<i class="fas fa-external-link-alt me-1"></i>Ver ficha orden #${dom.orden_id}
|
||||
</a>`;
|
||||
if (lf) return `
|
||||
<a href="${url}" target="_blank" download
|
||||
class="btn btn-sm btn-outline-secondary w-100 mb-1">
|
||||
<i class="fas fa-file-download me-1"></i>Abrir / Descargar archivo
|
||||
</a>
|
||||
<a href="lab_ordenes.php?id=${dom.orden_id}" class="d-block small text-muted">
|
||||
<i class="fas fa-external-link-alt me-1"></i>Ver ficha orden #${dom.orden_id}
|
||||
</a>`;
|
||||
return `<a href="lab_ordenes.php?id=${dom.orden_id}" class="d-block small">
|
||||
<i class="fas fa-file-medical me-1"></i>Ver orden #${dom.orden_id}
|
||||
</a>`;
|
||||
})()}
|
||||
</div>` : ''}
|
||||
<!-- Botones de flujo -->
|
||||
<div class="d-flex gap-2 flex-wrap">${btns}</div>
|
||||
|
||||
Reference in New Issue
Block a user