220 lines
12 KiB
PHP
220 lines
12 KiB
PHP
<?php
|
|
session_start();
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: login.php');
|
|
exit;
|
|
}
|
|
require_once 'db/config.php';
|
|
|
|
$cases = [
|
|
[
|
|
'id' => 'HR-2024-1847',
|
|
'title' => 'Manager Conflict Resolution',
|
|
'status' => 'in-review',
|
|
'severity' => 'high',
|
|
'department' => 'Engineering',
|
|
'assignedTo' => 'Jennifer Smith',
|
|
'lastUpdate' => '2 hours ago',
|
|
'comments' => 8
|
|
],
|
|
[
|
|
'id' => 'HR-2024-1852',
|
|
'title' => 'Benefits Inquiry - Health Insurance',
|
|
'status' => 'open',
|
|
'severity' => 'low',
|
|
'department' => 'Sales',
|
|
'assignedTo' => 'Michael Torres',
|
|
'lastUpdate' => '4 hours ago',
|
|
'comments' => 3
|
|
],
|
|
[
|
|
'id' => 'HR-2024-1855',
|
|
'title' => 'Remote Work Policy Question',
|
|
'status' => 'open',
|
|
'severity' => 'medium',
|
|
'department' => 'Product',
|
|
'assignedTo' => 'Sarah Anderson',
|
|
'lastUpdate' => '1 day ago',
|
|
'comments' => 5
|
|
],
|
|
[
|
|
'id' => 'HR-2024-1860',
|
|
'title' => 'Performance Review Discussion',
|
|
'status' => 'in-review',
|
|
'severity' => 'medium',
|
|
'department' => 'Marketing',
|
|
'assignedTo' => 'Jennifer Smith',
|
|
'lastUpdate' => '1 day ago',
|
|
'comments' => 12
|
|
],
|
|
[
|
|
'id' => 'HR-2024-1863',
|
|
'title' => 'Workplace Accommodation Request',
|
|
'status' => 'open',
|
|
'severity' => 'high',
|
|
'department' => 'Engineering',
|
|
'assignedTo' => 'Michael Torres',
|
|
'lastUpdate' => '2 days ago',
|
|
'comments' => 6
|
|
]
|
|
];
|
|
|
|
function get_severity_badge($severity) {
|
|
switch (strtolower($severity)) {
|
|
case 'high':
|
|
return 'bg-red-100 text-red-800';
|
|
case 'medium':
|
|
return 'bg-yellow-100 text-yellow-800';
|
|
case 'low':
|
|
return 'bg-green-100 text-green-800';
|
|
default:
|
|
return 'bg-gray-100 text-gray-800';
|
|
}
|
|
}
|
|
|
|
function get_status_badge($status) {
|
|
switch (strtolower($status)) {
|
|
case 'in-review':
|
|
return 'bg-blue-100 text-blue-800';
|
|
case 'open':
|
|
return 'bg-gray-200 text-gray-800';
|
|
default:
|
|
return 'bg-gray-100 text-gray-800';
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>HR Cases - FinMox</title>
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
</head>
|
|
<body class="bg-gray-100">
|
|
<div class="flex h-screen bg-gray-200">
|
|
<?php include '_sidebar.php'; ?>
|
|
|
|
<div class="flex-1 flex flex-col overflow-hidden">
|
|
<main class="flex-1 overflow-x-hidden overflow-y-auto bg-gray-100">
|
|
<div class="container mx-auto px-6 py-8">
|
|
<div class="flex flex-col md:flex-row gap-6">
|
|
|
|
<!-- Left Column: Case Details -->
|
|
<div id="case-details-container" class="w-full md:w-1/2 lg:w-3/5">
|
|
<div class="bg-white rounded-2xl shadow-sm p-6">
|
|
<div class="flex justify-between items-start mb-4">
|
|
<div>
|
|
<h2 id="case-details-title" class="text-2xl font-bold text-gray-800">Case Details</h2>
|
|
<p id="case-details-id" class="text-sm text-gray-500"></p>
|
|
</div>
|
|
</div>
|
|
<div class="flex flex-col md:flex-row h-full bg-[#fafafa] overflow-hidden">
|
|
<div class="hidden md:block w-80 flex-shrink-0 overflow-y-auto p-6 border-r border-gray-200">
|
|
<div class="placeholder bg-gray-200 animate-pulse rounded-lg p-6 h-full">
|
|
<h3 class="font-bold text-lg text-gray-700 mb-4">Case Sidebar</h3>
|
|
</div>
|
|
</div>
|
|
<div class="flex-1 overflow-y-auto">
|
|
<div class="max-w-5xl mx-auto px-4 md:px-6 py-4 md:py-8">
|
|
<div class="placeholder bg-gray-200 animate-pulse rounded-lg p-6 h-48 mb-6">
|
|
<h3 class="font-bold text-lg text-gray-700 mb-4">Case Header</h3>
|
|
</div>
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-6">
|
|
<div class="placeholder bg-gray-200 animate-pulse rounded-lg p-6 h-96">
|
|
<h3 class="font-bold text-lg text-gray-700 mb-4">Timeline Section</h3>
|
|
</div>
|
|
<div class="placeholder bg-gray-200 animate-pulse rounded-lg p-6 h-96">
|
|
<h3 class="font-bold text-lg text-gray-700 mb-4">Comments Section</h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Right Column: Cases List -->
|
|
<div class="w-full md:w-1/2 lg:w-2/5">
|
|
<div class="bg-white rounded-2xl shadow-sm border-gray-200 p-6">
|
|
<div class="flex items-center justify-between mb-4">
|
|
<h3 class="flex items-center gap-2 font-bold text-xl text-gray-800">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6 text-[#3A66FF]"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>
|
|
HR Cases This Week
|
|
</h3>
|
|
<span class="bg-[#3A66FF]/10 text-[#3A66FF] hover:bg-[#3A66FF]/20 font-semibold text-sm px-2 py-1 rounded-md">
|
|
<?php echo count($cases); ?> active
|
|
</span>
|
|
</div>
|
|
<div class="space-y-3">
|
|
<?php foreach ($cases as $case): ?>
|
|
<a href="#" class="case-link block p-4 bg-gray-50 rounded-xl border border-gray-200 hover:border-[#3A66FF]/30 transition-colors cursor-pointer" data-case-id="<?php echo htmlspecialchars($case['id']); ?>">
|
|
<div class="flex items-start justify-between mb-3">
|
|
<div class="flex-1">
|
|
<div class="flex items-center gap-2 mb-1">
|
|
<p class="font-bold text-gray-900 hover:text-[#3A66FF] transition-colors"><?php echo htmlspecialchars($case['title']); ?></p>
|
|
</div>
|
|
<p class="text-xs text-gray-500"><?php echo htmlspecialchars($case['id']); ?></p>
|
|
</div>
|
|
<div class="flex items-center gap-2">
|
|
<span class="text-xs font-semibold px-2 py-1 rounded-full <?php echo get_severity_badge($case['severity']); ?>"><?php echo htmlspecialchars(ucfirst($case['severity'])); ?></span>
|
|
<span class="text-xs font-semibold px-2 py-1 rounded-md <?php echo get_status_badge($case['status']); ?>"><?php echo htmlspecialchars(str_replace('-', ' ', ucfirst($case['status']))); ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center justify-between text-sm text-gray-600">
|
|
<p>Assigned to: <span class="font-semibold text-gray-800"><?php echo htmlspecialchars($case['assignedTo']); ?></span></p>
|
|
<div class="flex items-center gap-4">
|
|
<div class="flex items-center gap-1 text-gray-500">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-4 h-4"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg>
|
|
<span><?php echo htmlspecialchars($case['lastUpdate']); ?></span>
|
|
</div>
|
|
<div class="flex items-center gap-1 text-gray-500">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-4 h-4"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>
|
|
<span><?php echo htmlspecialchars($case['comments']); ?></span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const caseLinks = document.querySelectorAll('.case-link');
|
|
const detailsContainer = document.getElementById('case-details-container');
|
|
const detailsId = document.getElementById('case-details-id');
|
|
|
|
const casesData = <?php echo json_encode($cases); ?>;
|
|
const casesMap = new Map(casesData.map(c => [c.id, c]));
|
|
|
|
// Show first case by default
|
|
const firstCaseId = casesData[0].id;
|
|
const firstCaseData = casesMap.get(firstCaseId);
|
|
document.getElementById('case-details-title').textContent = firstCaseData.title;
|
|
detailsId.textContent = firstCaseData.id;
|
|
|
|
|
|
caseLinks.forEach(link => {
|
|
link.addEventListener('click', function (e) {
|
|
e.preventDefault();
|
|
const caseId = this.dataset.caseId;
|
|
const caseData = casesMap.get(caseId);
|
|
|
|
if (caseData) {
|
|
document.getElementById('case-details-title').textContent = caseData.title;
|
|
detailsId.textContent = caseData.id;
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|