feat(reception): filter virtual buildings, remove camera and add SDD-013 Web Serial COM support (v3.8.50)
This commit is contained in:
+3
-3
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.8.49';
|
||||
const FRONTEND_VERSION = '3.8.49';
|
||||
const BACKEND_VERSION = '3.8.49';
|
||||
const APP_VERSION = '3.8.50';
|
||||
const FRONTEND_VERSION = '3.8.50';
|
||||
const BACKEND_VERSION = '3.8.50';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
|
||||
@@ -26,7 +26,24 @@ router.get('/scanner', async (req, res) => {
|
||||
req.apiClient.get('/buildings'),
|
||||
req.apiClient.get('/reception/recent-logs', { params: { limit: 15 } })
|
||||
]);
|
||||
buildings = respBld.data?.buildings || respBld.data || [];
|
||||
const rawBuildings = respBld.data?.buildings || respBld.data || [];
|
||||
// Filtrar estrictamente solo sedes físicas (excluyendo sedes virtuales)
|
||||
buildings = rawBuildings.filter(b => {
|
||||
const code = (b.code || '').toUpperCase();
|
||||
const name = (b.name || '').toUpperCase();
|
||||
const isVirt = Boolean(b.is_virtual || code.includes('VIRTUAL') || name.includes('VIRTUAL'));
|
||||
return !isVirt;
|
||||
});
|
||||
|
||||
// Predeterminar Edificio Central
|
||||
let defaultBuildingId = null;
|
||||
const central = buildings.find(b => (b.code || '').toUpperCase().includes('CENTRAL') || (b.name || '').toUpperCase().includes('CENTRAL'));
|
||||
if (central) {
|
||||
defaultBuildingId = central.id;
|
||||
} else if (buildings.length > 0) {
|
||||
defaultBuildingId = buildings[0].id;
|
||||
}
|
||||
|
||||
recentLogs = (respLogs.data?.items || []).map(l => {
|
||||
let timeStr = l.scanned_time;
|
||||
if (!timeStr && l.scanned_at) {
|
||||
@@ -45,14 +62,24 @@ router.get('/scanner', async (req, res) => {
|
||||
}
|
||||
return { ...l, scanned_time: timeStr || '--' };
|
||||
});
|
||||
|
||||
res.render('reception/scanner', {
|
||||
title: 'Control de Acceso QR — Recepción & Seguridad',
|
||||
buildings,
|
||||
defaultBuildingId,
|
||||
recentLogs,
|
||||
userRole: role
|
||||
});
|
||||
return;
|
||||
} catch (err) {
|
||||
console.warn('Reception scanner init notice:', err.message);
|
||||
}
|
||||
|
||||
res.render('reception/scanner', {
|
||||
title: 'Control de Acceso QR — Recepción & Seguridad',
|
||||
buildings,
|
||||
recentLogs,
|
||||
buildings: [],
|
||||
defaultBuildingId: null,
|
||||
recentLogs: [],
|
||||
userRole: role
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user