From d03acba9e03e9e9cc23c0e6baf97aee09c1c6060 Mon Sep 17 00:00:00 2001 From: chris Date: Sat, 2 Aug 2025 09:37:41 -0400 Subject: [PATCH] opps, forgot to add logic fuction to notes --- server.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server.js b/server.js index 059b66e..adf1971 100644 --- a/server.js +++ b/server.js @@ -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;