fix: corregir layout de dashboard, resiliencia en filtros de asignaturas y paginacion de bd (v3.8.12)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "3.8.11",
|
||||
"version": "3.8.12",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
+3
-3
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.8.11';
|
||||
const FRONTEND_VERSION = '3.8.11';
|
||||
const BACKEND_VERSION = '3.8.11';
|
||||
const APP_VERSION = '3.8.12';
|
||||
const FRONTEND_VERSION = '3.8.12';
|
||||
const BACKEND_VERSION = '3.8.12';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
|
||||
+120
-55
@@ -359,26 +359,47 @@ const MOCK_USERS = [
|
||||
{ id: 4, name: 'Laura Martínez', email: 'lmartinez@edu-space.com', role_id: 2, role: { name: 'Bedel' }, is_active: false, created_at: '2025-05-20' }
|
||||
];
|
||||
|
||||
const fetchUsersAndRoles = async (apiClient) => {
|
||||
let users = [...MOCK_USERS];
|
||||
const buildPagination = (page, perPage, total) => {
|
||||
const pages = Math.ceil(total / perPage) || 1;
|
||||
const pages_list = [];
|
||||
const maxPages = 7;
|
||||
let startPage = Math.max(1, page - Math.floor(maxPages / 2));
|
||||
let endPage = Math.min(pages, startPage + maxPages - 1);
|
||||
if (endPage - startPage + 1 < maxPages) {
|
||||
startPage = Math.max(1, endPage - maxPages + 1);
|
||||
}
|
||||
for (let i = startPage; i <= endPage; i++) {
|
||||
pages_list.push(i);
|
||||
}
|
||||
return {
|
||||
page,
|
||||
per_page: perPage,
|
||||
total,
|
||||
pages,
|
||||
has_prev: page > 1,
|
||||
has_next: page < pages,
|
||||
pages_list,
|
||||
iter_pages: () => pages_list
|
||||
};
|
||||
};
|
||||
|
||||
const fetchRolesAndDocs = async (apiClient) => {
|
||||
let roles = [...MOCK_ROLES];
|
||||
let document_types = [];
|
||||
try {
|
||||
const [uRes, rRes] = await Promise.allSettled([
|
||||
apiClient.get('/users'),
|
||||
apiClient.get('/roles')
|
||||
const [rRes, dRes] = await Promise.allSettled([
|
||||
apiClient.get('/roles'),
|
||||
apiClient.get('/admin/users/document-types')
|
||||
]);
|
||||
if (uRes.status === 'fulfilled' && uRes.value.data) {
|
||||
const d = uRes.value.data;
|
||||
users = d.users || (Array.isArray(d) ? d : users);
|
||||
document_types = d.document_types || [];
|
||||
}
|
||||
if (rRes.status === 'fulfilled' && rRes.value.data) {
|
||||
const d = rRes.value.data;
|
||||
roles = (d.roles || d) || roles;
|
||||
}
|
||||
if (dRes.status === 'fulfilled' && dRes.value.data) {
|
||||
document_types = dRes.value.data.document_types || [];
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Using mock users/roles data:', e.message);
|
||||
console.warn('Using mock roles data:', e.message);
|
||||
}
|
||||
if (!document_types || document_types.length === 0) {
|
||||
document_types = [
|
||||
@@ -393,44 +414,60 @@ const fetchUsersAndRoles = async (apiClient) => {
|
||||
{ code: 'LE', name: 'Libreta de Enrolamiento', category: 'Histórico Nacional', placeholder: 'Libreta Enrolamiento' }
|
||||
];
|
||||
}
|
||||
return { users, roles, document_types };
|
||||
return { roles, document_types };
|
||||
};
|
||||
|
||||
const fetchUsersAndRoles = async (apiClient) => {
|
||||
const { roles, document_types } = await fetchRolesAndDocs(apiClient);
|
||||
return { users: [...MOCK_USERS], roles, document_types };
|
||||
};
|
||||
|
||||
const handleUsersList = async (req, res) => {
|
||||
try {
|
||||
const { users, roles, document_types } = await fetchUsersAndRoles(req.apiClient);
|
||||
const search = (req.query.search || '').toLowerCase().trim();
|
||||
const page = parseInt(req.query.page, 10) || 1;
|
||||
const per_page = 25;
|
||||
const search = (req.query.search || '').trim();
|
||||
const role_filter = req.query.role || '';
|
||||
const status_filter = req.query.status || '';
|
||||
const msg = req.query.msg || '';
|
||||
const error = req.query.error || '';
|
||||
|
||||
let filtered = [...users];
|
||||
if (search) {
|
||||
filtered = filtered.filter(u =>
|
||||
(u.name && u.name.toLowerCase().includes(search)) ||
|
||||
(u.first_name && u.first_name.toLowerCase().includes(search)) ||
|
||||
(u.last_name && u.last_name.toLowerCase().includes(search)) ||
|
||||
(u.email && u.email.toLowerCase().includes(search)) ||
|
||||
(u.personal_email && u.personal_email.toLowerCase().includes(search)) ||
|
||||
(u.document_number && u.document_number.toLowerCase().includes(search)) ||
|
||||
(u.phone && u.phone.toLowerCase().includes(search))
|
||||
);
|
||||
let users = [];
|
||||
let roles = [...MOCK_ROLES];
|
||||
let document_types = [];
|
||||
let total = 0;
|
||||
|
||||
try {
|
||||
const resp = await req.apiClient.get('/admin/users', {
|
||||
params: {
|
||||
page,
|
||||
per_page,
|
||||
search: search || undefined,
|
||||
role: role_filter || undefined,
|
||||
status: status_filter || undefined
|
||||
}
|
||||
});
|
||||
if (resp.data) {
|
||||
users = resp.data.users || [];
|
||||
roles = resp.data.roles || roles;
|
||||
document_types = resp.data.document_types || [];
|
||||
total = resp.data.total !== undefined ? resp.data.total : users.length;
|
||||
}
|
||||
} catch (apiErr) {
|
||||
console.warn('Users list API notice:', apiErr.message);
|
||||
}
|
||||
if (role_filter) {
|
||||
filtered = filtered.filter(u => String(u.role_id) === String(role_filter));
|
||||
}
|
||||
if (status_filter === 'active') filtered = filtered.filter(u => u.is_active);
|
||||
if (status_filter === 'inactive') filtered = filtered.filter(u => !u.is_active);
|
||||
|
||||
const pagination = buildPagination(page, per_page, total);
|
||||
|
||||
res.render('admin/users/list', {
|
||||
title: 'Gestión de Usuarios — Edu-Space Admin',
|
||||
users: filtered,
|
||||
users,
|
||||
roles,
|
||||
document_types,
|
||||
search,
|
||||
role_filter,
|
||||
status_filter,
|
||||
pagination,
|
||||
msg,
|
||||
error
|
||||
});
|
||||
@@ -441,14 +478,15 @@ const handleUsersList = async (req, res) => {
|
||||
users: MOCK_USERS,
|
||||
roles: MOCK_ROLES,
|
||||
document_types: [],
|
||||
search: '', role_filter: '', status_filter: '', msg: '', error: ''
|
||||
search: '', role_filter: '', status_filter: '', msg: '', error: '',
|
||||
pagination: buildPagination(1, 25, MOCK_USERS.length)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const handleUserAdd = async (req, res) => {
|
||||
try {
|
||||
const { roles, document_types } = await fetchUsersAndRoles(req.apiClient);
|
||||
const { roles, document_types } = await fetchRolesAndDocs(req.apiClient);
|
||||
res.render('admin/users/form', {
|
||||
title: 'Nuevo Usuario — Edu-Space Admin',
|
||||
user: null,
|
||||
@@ -473,11 +511,10 @@ const handleUserAdd = async (req, res) => {
|
||||
const handleUserEdit = async (req, res) => {
|
||||
try {
|
||||
const userId = req.params.id || req.query.id;
|
||||
const { users, roles, document_types } = await fetchUsersAndRoles(req.apiClient);
|
||||
let targetUser = userId ? users.find(u => String(u.id) === String(userId)) : null;
|
||||
const { roles, document_types } = await fetchRolesAndDocs(req.apiClient);
|
||||
let targetUser = null;
|
||||
|
||||
// Si no se encontró en la lista general y hay userId, intentar fetch individual
|
||||
if (!targetUser && userId && req.apiClient) {
|
||||
if (userId && req.apiClient) {
|
||||
try {
|
||||
const singleRes = await req.apiClient.get(`/users/${userId}`);
|
||||
if (singleRes.data && (singleRes.data.user || singleRes.data.data)) {
|
||||
@@ -488,8 +525,7 @@ const handleUserEdit = async (req, res) => {
|
||||
}
|
||||
}
|
||||
|
||||
targetUser = targetUser || (userId ? null : users[0]) || MOCK_USERS[0];
|
||||
|
||||
targetUser = targetUser || MOCK_USERS[0];
|
||||
const userName = targetUser ? (targetUser.name || `${targetUser.first_name || ''} ${targetUser.last_name || ''}`.trim() || targetUser.email || `Usuario #${targetUser.id}`) : 'Usuario';
|
||||
|
||||
res.render('admin/users/form', {
|
||||
@@ -784,21 +820,30 @@ router.post(['/career_delete', '/career_delete/:id', '/careers/delete/:id'], han
|
||||
|
||||
const handleSubjectsList = async (req, res) => {
|
||||
try {
|
||||
const page = parseInt(req.query.page, 10) || 1;
|
||||
const per_page = 25;
|
||||
const search = (req.query.search || '').trim();
|
||||
const career_id = req.query.career_id || '';
|
||||
const active = req.query.active || '';
|
||||
|
||||
let subjects = [];
|
||||
let careers = [];
|
||||
let total = 0;
|
||||
|
||||
try {
|
||||
const params = { page, per_page };
|
||||
if (search) params.search = search;
|
||||
if (career_id) params.career_id = parseInt(career_id, 10);
|
||||
if (active) params.active = active;
|
||||
|
||||
const [sRes, cRes] = await Promise.allSettled([
|
||||
req.apiClient.get('/subjects', { params: { search, career_id, active } }),
|
||||
req.apiClient.get('/subjects', { params }),
|
||||
req.apiClient.get('/careers')
|
||||
]);
|
||||
if (sRes.status === 'fulfilled' && sRes.value.data) {
|
||||
subjects = sRes.value.data.subjects || [];
|
||||
careers = sRes.value.data.careers || [];
|
||||
total = sRes.value.data.total !== undefined ? sRes.value.data.total : subjects.length;
|
||||
}
|
||||
if (cRes.status === 'fulfilled' && cRes.value.data && (!careers || careers.length === 0)) {
|
||||
careers = cRes.value.data.careers || [];
|
||||
@@ -807,6 +852,8 @@ const handleSubjectsList = async (req, res) => {
|
||||
console.warn('Subjects list API notice:', apiErr.message);
|
||||
}
|
||||
|
||||
const pagination = buildPagination(page, per_page, total);
|
||||
|
||||
res.render('admin/subjects/list', {
|
||||
title: 'Gestión de Asignaturas - Edu-Space Admin',
|
||||
subjects,
|
||||
@@ -817,7 +864,7 @@ const handleSubjectsList = async (req, res) => {
|
||||
can_edit: true,
|
||||
msg: req.query.msg || '',
|
||||
error: req.query.error || '',
|
||||
pagination: { pages: 1, page: 1, total: subjects.length, has_prev: false, has_next: false }
|
||||
pagination
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error in subjects list:', err.message);
|
||||
@@ -899,6 +946,8 @@ router.post(['/subject_delete', '/subject_delete/:id', '/subjects/:id/delete'],
|
||||
|
||||
const handleCommissionsList = async (req, res) => {
|
||||
try {
|
||||
const page = parseInt(req.query.page, 10) || 1;
|
||||
const per_page = 25;
|
||||
const search = (req.query.search || '').trim();
|
||||
const subject_id = req.query.subject_id || '';
|
||||
const career_id = req.query.career_id || '';
|
||||
@@ -912,14 +961,24 @@ const handleCommissionsList = async (req, res) => {
|
||||
let teachers = [];
|
||||
let academic_terms = [];
|
||||
let careers = [];
|
||||
let total = 0;
|
||||
|
||||
try {
|
||||
const params = { page, per_page };
|
||||
if (search) params.search = search;
|
||||
if (subject_id) params.subject_id = parseInt(subject_id, 10);
|
||||
if (career_id) params.career_id = parseInt(career_id, 10);
|
||||
if (shift) params.shift = shift;
|
||||
if (active) params.active = active;
|
||||
if (unassigned_room) params.unassigned_room = unassigned_room;
|
||||
|
||||
const [cRes, uRes] = await Promise.allSettled([
|
||||
req.apiClient.get('/commissions', { params: { search, subject_id, career_id, shift, active, unassigned_room } }),
|
||||
req.apiClient.get('/users')
|
||||
req.apiClient.get('/commissions', { params }),
|
||||
req.apiClient.get('/admin/users/teachers')
|
||||
]);
|
||||
|
||||
if (cRes.status === 'fulfilled' && cRes.value.data) {
|
||||
total = cRes.value.data.total !== undefined ? cRes.value.data.total : (cRes.value.data.commissions || []).length;
|
||||
commissions = (cRes.value.data.commissions || []).map(c => ({
|
||||
...c,
|
||||
get_full_code: () => c.full_code || c.code,
|
||||
@@ -962,16 +1021,20 @@ const handleCommissionsList = async (req, res) => {
|
||||
}
|
||||
|
||||
if (uRes.status === 'fulfilled' && uRes.value.data) {
|
||||
const users = uRes.value.data.users || [];
|
||||
teachers = users.filter(u => {
|
||||
const r = (u.role || '').toLowerCase();
|
||||
return r.includes('docent') || r.includes('prof') || r.includes('admin') || r.includes('bedel');
|
||||
});
|
||||
teachers = uRes.value.data.teachers || uRes.value.data.users || [];
|
||||
if (!uRes.value.data.teachers) {
|
||||
teachers = teachers.filter(u => {
|
||||
const r = (u.role || '').toLowerCase();
|
||||
return r.includes('docent') || r.includes('prof') || r.includes('admin') || r.includes('bedel');
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (apiErr) {
|
||||
console.warn('Commissions list API notice:', apiErr.message);
|
||||
}
|
||||
|
||||
const pagination = buildPagination(page, per_page, total);
|
||||
|
||||
res.render('admin/commissions/list', {
|
||||
title: 'Gestión de Comisiones — Edu-Space',
|
||||
commissions,
|
||||
@@ -989,7 +1052,7 @@ const handleCommissionsList = async (req, res) => {
|
||||
msg: req.query.msg || (created ? 'created' : ''),
|
||||
error: req.query.error || '',
|
||||
can_edit: true,
|
||||
pagination: { pages: 1, page: 1, total: commissions.length, has_prev: false, has_next: false }
|
||||
pagination
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Error in commissions list:', err.message);
|
||||
@@ -1007,7 +1070,7 @@ const handleCommissionDetail = async (req, res) => {
|
||||
try {
|
||||
const [cRes, uRes] = await Promise.allSettled([
|
||||
req.apiClient.get(`/commissions/${id}`),
|
||||
req.apiClient.get('/users')
|
||||
req.apiClient.get('/admin/users/teachers')
|
||||
]);
|
||||
if (cRes.status === 'fulfilled' && cRes.value.data && cRes.value.data.commission) {
|
||||
commission = cRes.value.data.commission;
|
||||
@@ -1017,11 +1080,13 @@ const handleCommissionDetail = async (req, res) => {
|
||||
commission = list.find(c => String(c.id) === String(id)) || list[0];
|
||||
}
|
||||
if (uRes.status === 'fulfilled' && uRes.value.data) {
|
||||
const users = uRes.value.data.users || [];
|
||||
teachers = users.filter(u => {
|
||||
const r = (u.role || '').toLowerCase();
|
||||
return r.includes('docent') || r.includes('prof') || r.includes('admin') || r.includes('bedel');
|
||||
});
|
||||
teachers = uRes.value.data.teachers || uRes.value.data.users || [];
|
||||
if (!uRes.value.data.teachers) {
|
||||
teachers = teachers.filter(u => {
|
||||
const r = (u.role || '').toLowerCase();
|
||||
return r.includes('docent') || r.includes('prof') || r.includes('admin') || r.includes('bedel');
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (apiErr) {
|
||||
console.warn('Commission detail API notice:', apiErr.message);
|
||||
|
||||
@@ -327,35 +327,36 @@
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if pagination.pages > 1 %}
|
||||
<div class="d-flex justify-content-center py-3">
|
||||
<nav>
|
||||
<div class="card-footer bg-body-tertiary border-0 py-3 d-flex flex-column flex-md-row justify-content-between align-items-center gap-2">
|
||||
<small class="text-muted">
|
||||
Mostrando página <strong>{{ pagination.page }}</strong> de <strong>{{ pagination.pages }}</strong> (Total: <strong>{{ pagination.total }}</strong> comisiones)
|
||||
</small>
|
||||
<nav aria-label="Commissions pagination">
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
{% if pagination.has_prev %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="/admin/commissions_list">
|
||||
<i class="bi bi-chevron-left"></i>
|
||||
<li class="page-item {% if not pagination.has_prev %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/commissions_list?page={{ pagination.page - 1 }}{% if search %}&search={{ search }}{% endif %}{% if subject_filter %}&subject_id={{ subject_filter }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if shift_filter %}&shift={{ shift_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
<i class="bi bi-chevron-left me-1"></i>Anterior
|
||||
</a>
|
||||
</li>
|
||||
{% for pg in pagination.pages_list %}
|
||||
<li class="page-item {% if pg == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="/admin/commissions_list?page={{ pg }}{% if search %}&search={{ search }}{% endif %}{% if subject_filter %}&subject_id={{ subject_filter }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if shift_filter %}&shift={{ shift_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
{{ pg }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% for pg in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
||||
{% if pg %}
|
||||
<li class="page-item {% if pg == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="/admin/commissions_list">{{ pg }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled"><span class="page-link">…</span></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if pagination.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="/admin/commissions_list">
|
||||
<i class="bi bi-chevron-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="page-item {% if not pagination.has_next %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/commissions_list?page={{ pagination.page + 1 }}{% if search %}&search={{ search }}{% endif %}{% if subject_filter %}&subject_id={{ subject_filter }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if shift_filter %}&shift={{ shift_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
Siguiente<i class="bi bi-chevron-right ms-1"></i>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
{% elif pagination and pagination.total > 0 %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-2 d-flex justify-content-between align-items-center">
|
||||
<small class="text-muted">Total: <strong>{{ pagination.total }}</strong> comisiones registradas</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
|
||||
@@ -229,33 +229,36 @@
|
||||
|
||||
<!-- Paginación -->
|
||||
{% if pagination.pages > 1 %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-2">
|
||||
<div class="card-footer bg-body-tertiary border-0 py-3 d-flex flex-column flex-md-row justify-content-between align-items-center gap-2">
|
||||
<small class="text-muted">
|
||||
Mostrando página <strong>{{ pagination.page }}</strong> de <strong>{{ pagination.pages }}</strong> (Total: <strong>{{ pagination.total }}</strong> asignaturas)
|
||||
</small>
|
||||
<nav aria-label="Subjects pagination">
|
||||
<ul class="pagination pagination-sm justify-content-center mb-0">
|
||||
{% if pagination.has_prev %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="/admin/subjects_list">Anterior</a>
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item {% if not pagination.has_prev %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/subjects_list?page={{ pagination.page - 1 }}{% if search %}&search={{ search }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
« Anterior
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% for p in pagination.iter_pages(left_edge=2, right_edge=2, left_current=2, right_current=2) %}
|
||||
{% if p %}
|
||||
<li class="page-item {% if p == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="/admin/subjects_list">{{ p }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled"><span class="page-link">…</span></li>
|
||||
{% endif %}
|
||||
{% for p in pagination.pages_list %}
|
||||
<li class="page-item {% if p == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="/admin/subjects_list?page={{ p }}{% if search %}&search={{ search }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
{{ p }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
||||
{% if pagination.has_next %}
|
||||
<li class="page-item">
|
||||
<a class="page-link" href="/admin/subjects_list">Siguiente</a>
|
||||
<li class="page-item {% if not pagination.has_next %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/subjects_list?page={{ pagination.page + 1 }}{% if search %}&search={{ search }}{% endif %}{% if career_filter %}&career_id={{ career_filter }}{% endif %}{% if active_filter %}&active={{ active_filter }}{% endif %}">
|
||||
Siguiente »
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
{% elif pagination and pagination.total > 0 %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-2 d-flex justify-content-between align-items-center">
|
||||
<small class="text-muted">Total: <strong>{{ pagination.total }}</strong> asignaturas registradas</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -231,24 +231,35 @@
|
||||
|
||||
<!-- Pagination -->
|
||||
{% if pagination and pagination.pages > 1 %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-2 d-flex justify-content-center">
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
{% if pagination.has_prev %}
|
||||
<li class="page-item"><a class="page-link" href="/admin/users_list">«</a></li>
|
||||
{% endif %}
|
||||
{% for p in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
||||
{% if p %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-3 d-flex flex-column flex-md-row justify-content-between align-items-center gap-2">
|
||||
<small class="text-muted">
|
||||
Mostrando página <strong>{{ pagination.page }}</strong> de <strong>{{ pagination.pages }}</strong> (Total: <strong>{{ pagination.total }}</strong> usuarios registrados)
|
||||
</small>
|
||||
<nav aria-label="Navegación de usuarios">
|
||||
<ul class="pagination pagination-sm mb-0">
|
||||
<li class="page-item {% if not pagination.has_prev %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/users_list?page={{ pagination.page - 1 }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
|
||||
« Anterior
|
||||
</a>
|
||||
</li>
|
||||
{% for p in pagination.pages_list %}
|
||||
<li class="page-item {% if p == pagination.page %}active{% endif %}">
|
||||
<a class="page-link" href="/admin/users_list">{{ p }}</a>
|
||||
<a class="page-link" href="/admin/users_list?page={{ p }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
|
||||
{{ p }}
|
||||
</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="page-item disabled"><span class="page-link">…</span></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if pagination.has_next %}
|
||||
<li class="page-item"><a class="page-link" href="/admin/users_list">»</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
<li class="page-item {% if not pagination.has_next %}disabled{% endif %}">
|
||||
<a class="page-link" href="/admin/users_list?page={{ pagination.page + 1 }}{% if search %}&search={{ search }}{% endif %}{% if role_filter %}&role={{ role_filter }}{% endif %}{% if status_filter %}&status={{ status_filter }}{% endif %}">
|
||||
Siguiente »
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
{% elif pagination and pagination.total > 0 %}
|
||||
<div class="card-footer bg-body-tertiary border-0 py-2 d-flex justify-content-between align-items-center">
|
||||
<small class="text-muted">Total: <strong>{{ pagination.total }}</strong> usuarios registrados</small>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -207,9 +207,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Admin Visual Menu Launchpad -->
|
||||
<div class="card border-0 shadow-sm mb-4">
|
||||
|
||||
Reference in New Issue
Block a user