Files
Employee_records/public/employees.html
T
2025-12-14 13:31:29 -06:00

330 lines
19 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employee Records - Employees</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/pocketbase/dist/pocketbase.umd.js"></script>
<!-- Quill.js Rich Text Editor -->
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
</head>
<body class="bg-gray-50 min-h-screen">
<!-- Navigation Header -->
<nav class="bg-white shadow-sm border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex flex-col sm:flex-row justify-between items-start sm:items-center h-auto sm:h-16 py-2 sm:py-0 gap-2 sm:gap-0">
<div class="flex items-center space-x-2 sm:space-x-4">
<a href="/dashboard.html" class="text-indigo-600 hover:text-indigo-700 font-medium text-sm sm:text-base">← Dashboard</a>
<h1 class="text-lg sm:text-xl font-bold text-gray-800">Employee Records</h1>
</div>
<div class="flex flex-col sm:flex-row items-start sm:items-center space-y-2 sm:space-y-0 sm:space-x-4 w-full sm:w-auto">
<div class="text-xs sm:text-sm text-gray-600">
<span id="userEmail">Loading...</span>
</div>
<button
id="logoutButton"
class="bg-red-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 transition w-full sm:w-auto"
>
Logout
</button>
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="mb-6 flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4">
<div>
<h2 class="text-xl sm:text-2xl font-bold text-gray-800 mb-2">Employee Records</h2>
<p class="text-sm sm:text-base text-gray-600">Manage employee information</p>
</div>
<button
id="addEmployeeBtn"
class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm sm:text-base font-medium hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition w-full sm:w-auto"
>
+ Add Employee
</button>
</div>
<!-- Error/Success Messages -->
<div id="messageContainer" class="mb-4"></div>
<!-- Search and Filter Section -->
<div class="mb-6 bg-white rounded-lg shadow p-4">
<div class="flex flex-col gap-4">
<!-- Search Bar -->
<div class="w-full">
<input
type="text"
id="searchInput"
placeholder="Search by name or ID..."
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
<!-- Filter Buttons -->
<div class="flex flex-wrap gap-2">
<button
id="filterAll"
class="flex-1 sm:flex-none px-4 py-2 rounded-lg text-sm sm:text-base font-medium transition focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 bg-indigo-600 text-white hover:bg-indigo-700"
>
All
</button>
<button
id="filterEmployee"
class="flex-1 sm:flex-none px-4 py-2 rounded-lg text-sm sm:text-base font-medium transition focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 bg-gray-200 text-gray-700 hover:bg-gray-300"
>
Employee
</button>
<button
id="filterSubContractor"
class="flex-1 sm:flex-none px-4 py-2 rounded-lg text-sm sm:text-base font-medium transition focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 bg-gray-200 text-gray-700 hover:bg-gray-300"
>
Sub-Contractor
</button>
</div>
</div>
</div>
<!-- Employee Records Table -->
<div class="bg-white rounded-lg shadow overflow-hidden">
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-3 sm:px-6 py-2 sm:py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">ID</th>
<th class="px-3 sm:px-6 py-2 sm:py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">First Name</th>
<th class="px-3 sm:px-6 py-2 sm:py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Last Name</th>
<th class="px-3 sm:px-6 py-2 sm:py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
<th class="px-3 sm:px-6 py-2 sm:py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody id="employeesTableBody" class="bg-white divide-y divide-gray-200">
<tr>
<td colspan="5" class="px-6 py-4 text-center text-gray-500">Loading...</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Pagination -->
<div id="pagination" class="mt-4 flex justify-between items-center"></div>
</main>
<!-- Add/Edit Employee Modal -->
<div id="employeeModal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 overflow-y-auto h-full w-full z-50">
<div class="relative top-0 sm:top-10 mx-auto p-4 sm:p-5 border-0 sm:border w-full sm:max-w-4xl shadow-lg rounded-none sm:rounded-md bg-white mb-0 sm:mb-10 min-h-screen sm:min-h-0">
<div class="mt-3">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900" id="modalTitle">Add Employee</h3>
<button id="closeEmployeeModal" class="text-gray-400 hover:text-gray-500">
<svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
</svg>
</button>
</div>
<!-- Tabs -->
<div class="border-b border-gray-200 mb-4">
<nav class="-mb-px flex space-x-8">
<button id="employeeInfoTab" class="border-indigo-500 text-indigo-600 whitespace-nowrap py-2 px-1 border-b-2 font-medium text-sm active-tab">
Employee Info
</button>
<button id="employeeReportsTab" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 whitespace-nowrap py-2 px-1 border-b-2 font-medium text-sm" id="employeeId" style="display: none;">
Reports
</button>
</nav>
</div>
<!-- Employee Info Tab Content -->
<div id="employeeInfoContent">
<form id="employeeForm" class="space-y-4">
<input type="hidden" id="employeeId" name="id">
<!-- First Name and Last Name -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="firstName" class="block text-sm font-medium text-gray-700 mb-1">First Name</label>
<input
type="text"
id="firstName"
name="First_Name"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
<div>
<label for="lastName" class="block text-sm font-medium text-gray-700 mb-1">Last Name</label>
<input
type="text"
id="lastName"
name="Last_Name"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
</div>
<!-- Email and Phone Number -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input
type="email"
id="email"
name="Email"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
<div>
<label for="phoneNumber" class="block text-sm font-medium text-gray-700 mb-1">Phone Number</label>
<input
type="text"
id="phoneNumber"
name="Phone_Number"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
</div>
<!-- Voxer ID and Type -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="voxerId" class="block text-sm font-medium text-gray-700 mb-1">Voxer ID</label>
<input
type="text"
id="voxerId"
name="Voxer_ID"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
/>
</div>
<div>
<label for="type" class="block text-sm font-medium text-gray-700 mb-1">Type</label>
<select
id="type"
name="Type"
class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-transparent outline-none text-base"
>
<option value="">Select a type...</option>
<option value="Employee">Employee</option>
<option value="Sub-Contractor">Sub-Contractor</option>
<option value="Applicant">Applicant</option>
<option value="None-Hire">None-Hire</option>
<option value="Former">Former</option>
<option value="Fired">Fired</option>
<option value="Blacklisted">Blacklisted</option>
</select>
</div>
</div>
<div class="flex flex-col sm:flex-row justify-end space-y-2 sm:space-y-0 sm:space-x-3 pt-4">
<button
type="button"
id="cancelBtn"
class="w-full sm:w-auto px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-gray-500 focus:ring-offset-2 text-base"
>
Cancel
</button>
<button
type="submit"
class="w-full sm:w-auto px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 text-base"
>
Save
</button>
</div>
</form>
</div>
<!-- Employee Reports Tab Content -->
<div id="employeeReportsContent" class="hidden">
<div class="mb-4">
<button
id="addReportBtn"
class="bg-indigo-600 text-white px-4 py-2 rounded-lg text-sm font-medium hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500"
>
+ Add Report
</button>
</div>
<!-- Reports List (Post Board Style) -->
<div id="employeeReportsList" class="space-y-4 max-h-[400px] sm:max-h-[500px] overflow-y-auto">
<div class="text-center text-gray-500 py-8">Loading reports...</div>
</div>
<!-- Add Report Form (Hidden by default) -->
<div id="addReportForm" class="hidden mt-6 p-4 bg-gray-50 rounded-lg border border-gray-200">
<h4 class="text-md font-medium text-gray-900 mb-4">Add New Report</h4>
<form id="quickReportForm" class="space-y-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Report</label>
<div id="quickReportEditor" style="height: 150px;" class="mb-2 bg-white"></div>
<textarea id="quickReport" style="display: none;"></textarea>
<style>
#quickReportEditor .ql-editor {
color: #1f2937 !important;
background-color: #ffffff !important;
}
#quickReportEditor .ql-editor.ql-blank::before {
color: #9ca3af !important;
}
</style>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Sentiment</label>
<select id="quickSentiment" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm">
<option value="">Select...</option>
<option value="Positive">Positive</option>
<option value="Negative">Negative</option>
<option value="Neutral">Neutral</option>
</select>
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Date & Time</label>
<input type="datetime-local" id="quickReportDate" class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Link 1</label>
<input type="url" id="quickLink01" placeholder="https://..." class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Link 2</label>
<input type="url" id="quickLink02" placeholder="https://..." class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Link 3</label>
<input type="url" id="quickLink03" placeholder="https://..." class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Link 4</label>
<input type="url" id="quickLink04" placeholder="https://..." class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Link 5</label>
<input type="url" id="quickLink05" placeholder="https://..." class="w-full px-3 py-2 border border-gray-300 rounded-lg text-sm" />
</div>
</div>
<div class="flex flex-col sm:flex-row justify-end space-y-2 sm:space-y-0 sm:space-x-2">
<button type="button" id="cancelQuickReport" class="w-full sm:w-auto px-3 py-2 text-sm bg-gray-200 text-gray-700 rounded hover:bg-gray-300">
Cancel
</button>
<button type="submit" class="w-full sm:w-auto px-3 py-2 text-sm bg-indigo-600 text-white rounded hover:bg-indigo-700">
Save Report
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="/js/employees.js"></script>
</body>
</html>