diff --git a/frontend/src/pages/Admin.jsx b/frontend/src/pages/Admin.jsx index 1396c43..9c59811 100644 --- a/frontend/src/pages/Admin.jsx +++ b/frontend/src/pages/Admin.jsx @@ -517,6 +517,17 @@ function Reports() { }).catch(console.error).finally(() => setLoading(false)); }, []); + async function unlockTimesheet(id) { + if (!confirm('Unlock this timesheet so the employee can edit it?')) return; + try { + await api.put(`/admin/timesheets/${id}/reopen`); + setTimesheets((prev) => prev.map((t) => t.id === id ? { ...t, status: 'draft' } : t)); + if (selectedTs?.id === id) setSelectedTs((prev) => ({ ...prev, status: 'draft' })); + } catch (err) { + alert(err.response?.data?.error || 'Failed to unlock timesheet'); + } + } + async function applyFilters() { setLoading(true); try { @@ -647,9 +658,17 @@ function Reports() { -
+
{fmtDate(selectedTs.weekStart)} — {fmtDate(selectedTs.weekEnd)} + {(selectedTs.status === 'submitted' || selectedTs.status === 'approved') && ( + + )}
{detailLoading ? (