opps, forgot to add logic fuction to notes

This commit is contained in:
chris 2025-08-02 09:37:41 -04:00
parent dc2369ce5e
commit a903e4b3de

View File

@ -352,6 +352,21 @@ app.delete('/api/admin/logs/:id', authenticateToken, requireRole('admin'), async
});
// Admin creates a note for an employee
async function handleAddNote(e) {
e.preventDefault();
const userId = e.target.elements['note-user-select'].value;
const noteText = e.target.elements['note-text'].value;
if (!userId) {
return showMessage('Please select an employee.', 'error');
}
const res = await apiCall('/api/admin/notes', 'POST', { userId, noteText });
if (res.success) {
showMessage(res.data.message, 'success');
e.target.reset();
}
}
app.post('/api/admin/notes', authenticateToken, requireRole('admin'), async (req, res) => {
try {
const { userId, noteText } = req.body;