diff --git a/frontend/src/pages/AdminDashboard.jsx b/frontend/src/pages/AdminDashboard.jsx index 4531b80..acbd615 100644 --- a/frontend/src/pages/AdminDashboard.jsx +++ b/frontend/src/pages/AdminDashboard.jsx @@ -331,6 +331,38 @@ function AdminDashboard({ token }) { )} + + {activeTab === 'visitors' && ( +
+

Visitor Approvals

+ + {Object.values(activePeople.filter(p => p.status === 'PENDING').reduce((acc, p) => { + const uId = p.addedById || 0; + if (!acc[uId]) acc[uId] = { user: p.addedBy?.username || 'Unknown', userId: uId, items: [] }; + acc[uId].items.push(p); + return acc; + }, {})).map(group => ( +
+
+

User: {group.user}

+ +
+
+ {group.items.map(p => ( +
+ {p.name} ({p.rut}) + {parseInt((new Date(p.endDate) - new Date(p.startDate)) / (1000 * 60 * 60 * 24))} Days +
+ ))} +
+
+ ))} + + {activePeople.filter(p => p.status === 'PENDING').length === 0 &&

No pending visitors.

} +
+ )} ); diff --git a/frontend/src/pages/UserDashboard.jsx b/frontend/src/pages/UserDashboard.jsx index 0e8a96f..b94d2ae 100644 --- a/frontend/src/pages/UserDashboard.jsx +++ b/frontend/src/pages/UserDashboard.jsx @@ -76,7 +76,7 @@ function UserDashboard({ token, username }) { }); setNewPerson({ name: '', rut: '', durationDays: 1 }); fetchPeople(); - alert('Person registered! Waiting for admin approval.'); + // Alert removed for better UX } catch (err) { alert('Error: ' + (err.response?.data?.error || err.message)); }