diff --git a/api/search.php b/api/search.php new file mode 100644 index 0000000..c966953 --- /dev/null +++ b/api/search.php @@ -0,0 +1,45 @@ +prepare("SELECT id, name, code FROM projects WHERE name LIKE ? OR code LIKE ? LIMIT 5"); + $stmt->execute(['%' . $q . '%', '%' . $q . '%']); + foreach ($stmt->fetchAll() as $row) { + $results[] = [ + 'type' => 'Project', + 'id' => $row['id'], + 'label' => $row['name'] . ' (' . $row['code'] . ')', + 'url' => 'project_detail.php?id=' . $row['id'] + ]; + } + + // Search Employees + $stmt = $db->prepare("SELECT id, name, position FROM employees WHERE name LIKE ? OR first_name LIKE ? OR last_name LIKE ? LIMIT 5"); + $stmt->execute(['%' . $q . '%', '%' . $q . '%', '%' . $q . '%']); + foreach ($stmt->fetchAll() as $row) { + $results[] = [ + 'type' => 'Employee', + 'id' => $row['id'], + 'label' => $row['name'] . ' - ' . ($row['position'] ?? 'Staff'), + 'url' => 'employee_detail.php?id=' . $row['id'] + ]; + } + +} catch (Exception $e) { + // Silence error for now +} + +echo json_encode($results); diff --git a/assets/pasted-20260215-020503-9ea6b62b.png b/assets/pasted-20260215-020503-9ea6b62b.png new file mode 100644 index 0000000..b1cff74 Binary files /dev/null and b/assets/pasted-20260215-020503-9ea6b62b.png differ diff --git a/employee_detail.php b/employee_detail.php new file mode 100644 index 0000000..c4fa2a1 --- /dev/null +++ b/employee_detail.php @@ -0,0 +1,121 @@ +prepare("SELECT * FROM employees WHERE id = ?"); +$employee->execute([$id]); +$employee = $employee->fetch(); + +if (!$employee) { + die("Employee not found."); +} + +$pageTitle = "Employee Detail: " . htmlspecialchars($employee['name']); +include __DIR__ . '/includes/header.php'; + +// Fetch recent labour entries +$stmt = $db->prepare(" + SELECT l.*, p.name as project_name, lt.name as labour_type + FROM labour_entries l + JOIN projects p ON l.project_id = p.id + JOIN labour_types lt ON l.labour_type_id = lt.id + WHERE l.employee_id = ? + ORDER BY l.entry_date DESC + LIMIT 20 +"); +$stmt->execute([$id]); +$entries = $stmt->fetchAll(); + +// Fetch summary stats +$stats = $db->prepare("SELECT SUM(hours) as total_hours, COUNT(*) as entry_count FROM labour_entries WHERE employee_id = ?"); +$stats->execute([$id]); +$stats = $stats->fetch(); +?> + +
+
+
+ +

+

+
+
+ +
+
+ +
+
+
+
Information
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
+
+
+ Recent Labour Entries + View All +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
DateProjectTypeHoursNotes
No entries found for this employee.
50 ? '...' : '' ?>
+
+
+
+
+
+
+ + diff --git a/includes/header.php b/includes/header.php index 8c9c0d4..5129896 100644 --- a/includes/header.php +++ b/includes/header.php @@ -75,10 +75,67 @@ $currentPage = basename($_SERVER['PHP_SELF']); Settings -
- Tenant: Acme Research - Global Admin +
+
+
+ + +
+ +
+
+ Tenant: Acme Research + Global Admin +
+ + diff --git a/uploads/69912b6e657db.pdf b/uploads/69912b6e657db.pdf new file mode 100644 index 0000000..35aec19 Binary files /dev/null and b/uploads/69912b6e657db.pdf differ