prepare($countSql); $countStmt->execute($params); $totalClientes = $countStmt->fetchColumn(); $totalPages = max(1, (int)ceil($totalClientes / $perPage)); // Fetch clients with tramites count $sql = "SELECT c.*, COUNT(t.id) AS total_tramites FROM clientes c LEFT JOIN tramites t ON c.id = t.cliente_id $where GROUP BY c.id ORDER BY c.created_at DESC LIMIT $perPage OFFSET $offset"; $stmt = $db->prepare($sql); $stmt->execute($params); $clientes = $stmt->fetchAll(); ?>
Gestión de clientes registrados
= $q !== '' ? 'No se encontraron clientes con esa búsqueda.' : 'No hay clientes registrados aún.' ?>
Ver todos| Nombre | Teléfono | Trámites | Fecha Registro | Acción | |
|---|---|---|---|---|---|
| = htmlspecialchars($c['nombre']) ?> | = htmlspecialchars($c['telefono'] ?: '-') ?> | = htmlspecialchars($c['email'] ?: '-') ?> | = (int)$c['total_tramites'] ?> | = date('d/m/Y', strtotime($c['created_at'])) ?> | Ver |