feat(dashboard): add day week month filtering for assigned and unassigned classrooms and commissions with clear dates
This commit is contained in:
@@ -71,6 +71,19 @@ router.get('/', async (req, res) => {
|
||||
// Bedelía-specific data
|
||||
const bedeliaData = apiData.bedelia || {};
|
||||
|
||||
// Filter stats (today, week, month) & date labels for classrooms and commissions
|
||||
const filter_stats = apiData.filter_stats || backendStats.filter_stats || bedeliaData.filter_stats || {
|
||||
date_labels: {
|
||||
today: 'Hoy',
|
||||
week: 'Esta Semana',
|
||||
month: 'Este Mes'
|
||||
},
|
||||
today: { label: 'Hoy', classrooms: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 }, commissions: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 } },
|
||||
week: { label: 'Esta Semana', classrooms: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 }, commissions: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 } },
|
||||
month: { label: 'Este Mes', classrooms: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 }, commissions: { assigned: [], unassigned: [], assigned_count: 0, unassigned_count: 0, assigned_pct: 0, unassigned_pct: 0, total: 0 } }
|
||||
};
|
||||
const date_labels = apiData.date_labels || backendStats.date_labels || filter_stats.date_labels || {};
|
||||
|
||||
// Consolidated and role-specific stats
|
||||
const stats = {
|
||||
total_classrooms,
|
||||
@@ -93,13 +106,17 @@ router.get('/', async (req, res) => {
|
||||
my_total_reservations: 8,
|
||||
virtual_rooms_count: virtual_classrooms_count,
|
||||
today_classes_count: apiTodaySchedule ? Math.min(4, apiTodaySchedule.length) : 2,
|
||||
milestones_count: apiMilestones ? apiMilestones.length : 3
|
||||
milestones_count: apiMilestones ? apiMilestones.length : 3,
|
||||
filter_stats,
|
||||
date_labels
|
||||
};
|
||||
|
||||
let role_data = {};
|
||||
|
||||
if (role === 'admin') {
|
||||
role_data = {
|
||||
filter_stats,
|
||||
date_labels,
|
||||
recent_audits: audit_logs.length > 0 ? audit_logs : [
|
||||
{ created_at: '2026-09-18 21:15', action_type: 'UPDATE_PERMISSION', user_email: 'admin@edu-space.com', ip_address: '127.0.0.1' },
|
||||
{ created_at: '2026-09-18 20:30', action_type: 'CREATE_COMMISSION', user_email: 'admin@edu-space.com', ip_address: '127.0.0.1' },
|
||||
@@ -109,6 +126,8 @@ router.get('/', async (req, res) => {
|
||||
} else if (role === 'bedelia') {
|
||||
const apiWeekSchedule = Array.isArray(apiData.week_schedule_list) ? apiData.week_schedule_list : [];
|
||||
role_data = {
|
||||
filter_stats,
|
||||
date_labels,
|
||||
pending_reservations: apiPending || [],
|
||||
today_schedule_list: apiTodaySchedule || [],
|
||||
week_schedule_list: apiWeekSchedule,
|
||||
@@ -173,7 +192,9 @@ router.get('/', async (req, res) => {
|
||||
role_data,
|
||||
monthly_data,
|
||||
audit_logs,
|
||||
upcoming_reservations
|
||||
upcoming_reservations,
|
||||
filter_stats,
|
||||
date_labels
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+689
-243
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user