poluser commited on
Commit
13ead48
·
verified ·
1 Parent(s): 2a40403

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +657 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Hr Test
3
- emoji: 🏆
4
- colorFrom: pink
5
- colorTo: pink
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: hr-test
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,657 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>SteelCraft Payroll System - Employee Management</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .sidebar {
11
+ transition: all 0.3s;
12
+ }
13
+ .sidebar.collapsed {
14
+ width: 70px;
15
+ }
16
+ .sidebar.collapsed .nav-text {
17
+ display: none;
18
+ }
19
+ .sidebar.collapsed ~ .main-content {
20
+ margin-left: 70px;
21
+ }
22
+ .main-content {
23
+ transition: all 0.3s;
24
+ margin-left: 250px;
25
+ }
26
+ .highlight-row {
27
+ background-color: #f0f9ff;
28
+ }
29
+ .custom-scrollbar::-webkit-scrollbar {
30
+ width: 6px;
31
+ height: 6px;
32
+ }
33
+ .custom-scrollbar::-webkit-scrollbar-track {
34
+ background: #f1f1f1;
35
+ }
36
+ .custom-scrollbar::-webkit-scrollbar-thumb {
37
+ background: #888;
38
+ border-radius: 3px;
39
+ }
40
+ .custom-scrollbar::-webkit-scrollbar-thumb:hover {
41
+ background: #555;
42
+ }
43
+ [x-cloak] { display: none !important; }
44
+ </style>
45
+ </head>
46
+ <body class="bg-gray-100">
47
+ <div class="flex h-screen overflow-hidden">
48
+ <!-- Sidebar -->
49
+ <div class="sidebar bg-blue-900 text-white w-64 h-full fixed overflow-y-auto">
50
+ <div class="p-4 flex items-center justify-between border-b border-blue-800">
51
+ <div class="flex items-center">
52
+ <i class="fas fa-industry text-2xl mr-3"></i>
53
+ <span class="nav-text font-bold text-xl">SteelCraft Payroll</span>
54
+ </div>
55
+ </div>
56
+ <nav class="mt-4">
57
+ <div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold nav-text">Main</div>
58
+ <a href="#" class="flex items-center px-4 py-3 text-white hover:bg-blue-800 transition">
59
+ <i class="fas fa-tachometer-alt mr-3"></i>
60
+ <span class="nav-text">Dashboard</span>
61
+ </a>
62
+ <div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold nav-text">Employees</div>
63
+ <a href="#" class="flex items-center px-4 py-3 bg-blue-800 text-white transition">
64
+ <i class="fas fa-users mr-3"></i>
65
+ <span class="nav-text">Employee Management</span>
66
+ </a>
67
+ <a href="#" class="flex items-center px-4 py-3 text-white hover:bg-blue-800 transition">
68
+ <i class="fas fa-calendar-check mr-3"></i>
69
+ <span class="nav-text">Attendance</span>
70
+ </a>
71
+ <div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold nav-text">Payroll</div>
72
+ <a href="#" class="flex items-center px-4 py-3 text-white hover:bg-blue-800 transition">
73
+ <i class="fas fa-calculator mr-3"></i>
74
+ <span class="nav-text">Process Payroll</span>
75
+ </a>
76
+ <a href="#" class="flex items-center px-4 py-3 text-white hover:bg-blue-800 transition">
77
+ <i class="fas fa-file-alt mr-3"></i>
78
+ <span class="nav-text">Reports</span>
79
+ </a>
80
+ <div class="px-4 py-2 text-blue-200 uppercase text-xs font-semibold nav-text">Settings</div>
81
+ <a href="#" class="flex items-center px-4 py-3 text-white hover:bg-blue-800 transition">
82
+ <i class="fas fa-cog mr-3"></i>
83
+ <span class="nav-text">System Settings</span>
84
+ </a>
85
+ </nav>
86
+ <div class="absolute bottom-0 w-full p-4 border-t border-blue-800">
87
+ <div class="flex items-center">
88
+ <div class="w-8 h-8 rounded-full bg-blue-700 flex items-center justify-center">
89
+ <i class="fas fa-user text-sm"></i>
90
+ </div>
91
+ <div class="ml-3 nav-text">
92
+ <div class="text-sm font-medium">Admin User</div>
93
+ <div class="text-xs text-blue-200">Administrator</div>
94
+ </div>
95
+ </div>
96
+ </div>
97
+ </div>
98
+
99
+ <!-- Main Content -->
100
+ <div class="main-content flex-1 overflow-auto custom-scrollbar">
101
+ <!-- Employee Management Section -->
102
+ <div class="p-6">
103
+ <div class="flex justify-between items-center mb-6">
104
+ <h1 class="text-2xl font-bold text-gray-800">Employee Management</h1>
105
+ <div class="flex items-center space-x-4">
106
+ <button id="addEmployeeBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center">
107
+ <i class="fas fa-plus mr-2"></i>
108
+ <span>Add Employee</span>
109
+ </button>
110
+ <div class="relative">
111
+ <input type="text" id="employeeSearch" placeholder="Search employees..." class="pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
112
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
113
+ </div>
114
+ </div>
115
+ </div>
116
+
117
+ <!-- Employee Modal -->
118
+ <div id="employeeModal" class="fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50 hidden">
119
+ <div class="bg-white rounded-lg shadow-xl w-full max-w-2xl">
120
+ <div class="flex justify-between items-center border-b px-6 py-4">
121
+ <h3 class="text-lg font-semibold" id="modalTitle">Add New Employee</h3>
122
+ <button id="closeModal" class="text-gray-500 hover:text-gray-700">
123
+ <i class="fas fa-times"></i>
124
+ </button>
125
+ </div>
126
+ <div class="p-6">
127
+ <form id="employeeForm">
128
+ <input type="hidden" id="employeeId">
129
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
130
+ <div>
131
+ <label for="firstName" class="block text-sm font-medium text-gray-700 mb-1">First Name*</label>
132
+ <input type="text" id="firstName" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
133
+ </div>
134
+ <div>
135
+ <label for="lastName" class="block text-sm font-medium text-gray-700 mb-1">Last Name*</label>
136
+ <input type="text" id="lastName" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
137
+ </div>
138
+ </div>
139
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
140
+ <div>
141
+ <label for="email" class="block text-sm font-medium text-gray-700 mb-1">Email*</label>
142
+ <input type="email" id="email" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
143
+ </div>
144
+ <div>
145
+ <label for="phone" class="block text-sm font-medium text-gray-700 mb-1">Phone</label>
146
+ <input type="tel" id="phone" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500">
147
+ </div>
148
+ </div>
149
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
150
+ <div>
151
+ <label for="department" class="block text-sm font-medium text-gray-700 mb-1">Department*</label>
152
+ <select id="department" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
153
+ <option value="">Select Department</option>
154
+ <option value="Fabrication">Fabrication</option>
155
+ <option value="Erection">Erection</option>
156
+ <option value="Quality Control">Quality Control</option>
157
+ <option value="Maintenance">Maintenance</option>
158
+ <option value="Administration">Administration</option>
159
+ </select>
160
+ </div>
161
+ <div>
162
+ <label for="position" class="block text-sm font-medium text-gray-700 mb-1">Position*</label>
163
+ <input type="text" id="position" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
164
+ </div>
165
+ </div>
166
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
167
+ <div>
168
+ <label for="hireDate" class="block text-sm font-medium text-gray-700 mb-1">Hire Date*</label>
169
+ <input type="date" id="hireDate" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
170
+ </div>
171
+ <div>
172
+ <label for="salary" class="block text-sm font-medium text-gray-700 mb-1">Salary*</label>
173
+ <input type="number" id="salary" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
174
+ </div>
175
+ </div>
176
+ <div class="mb-4">
177
+ <label for="status" class="block text-sm font-medium text-gray-700 mb-1">Status*</label>
178
+ <select id="status" class="w-full border rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500" required>
179
+ <option value="Active">Active</option>
180
+ <option value="Inactive">Inactive</option>
181
+ <option value="On Leave">On Leave</option>
182
+ </select>
183
+ </div>
184
+ <div class="flex justify-end space-x-3 pt-4 border-t">
185
+ <button type="button" id="cancelEmployee" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">
186
+ Cancel
187
+ </button>
188
+ <button type="submit" id="saveEmployee" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">
189
+ Save Employee
190
+ </button>
191
+ </div>
192
+ </form>
193
+ </div>
194
+ </div>
195
+ </div>
196
+
197
+ <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-200 mb-6">
198
+ <div class="flex justify-between items-center mb-4">
199
+ <h2 class="text-lg font-semibold">All Employees</h2>
200
+ <div class="flex items-center space-x-2">
201
+ <select id="departmentFilter" class="border rounded-lg px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
202
+ <option value="">All Departments</option>
203
+ <option value="Fabrication">Fabrication</option>
204
+ <option value="Erection">Erection</option>
205
+ <option value="Quality Control">Quality Control</option>
206
+ <option value="Maintenance">Maintenance</option>
207
+ <option value="Administration">Administration</option>
208
+ </select>
209
+ <select id="statusFilter" class="border rounded-lg px-3 py-1 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
210
+ <option value="">All Statuses</option>
211
+ <option value="Active">Active</option>
212
+ <option value="Inactive">Inactive</option>
213
+ <option value="On Leave">On Leave</option>
214
+ </select>
215
+ </div>
216
+ </div>
217
+ <div class="overflow-x-auto">
218
+ <table class="min-w-full divide-y divide-gray-200">
219
+ <thead class="bg-gray-50">
220
+ <tr>
221
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Employee ID</th>
222
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
223
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Department</th>
224
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Position</th>
225
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Hire Date</th>
226
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
227
+ <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
228
+ </tr>
229
+ </thead>
230
+ <tbody class="bg-white divide-y divide-gray-200" id="employeeTableBody">
231
+ <!-- Employee rows will be added here by JavaScript -->
232
+ </tbody>
233
+ </table>
234
+ </div>
235
+ <div class="mt-4 flex items-center justify-between">
236
+ <div class="text-sm text-gray-500">
237
+ Showing <span id="startEmployee">1</span> to <span id="endEmployee">10</span> of <span id="totalEmployees">0</span> employees
238
+ </div>
239
+ <div class="flex space-x-2">
240
+ <button id="prevEmployeePage" class="px-3 py-1 border rounded-lg text-sm hover:bg-gray-50 disabled:opacity-50" disabled>
241
+ Previous
242
+ </button>
243
+ <button id="nextEmployeePage" class="px-3 py-1 border rounded-lg text-sm hover:bg-gray-50 disabled:opacity-50">
244
+ Next
245
+ </button>
246
+ </div>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </div>
251
+ </div>
252
+
253
+ <script>
254
+ // Employee data storage (simulating a database)
255
+ let employees = [
256
+ {
257
+ id: 1,
258
+ employeeId: "EMP-1001",
259
+ firstName: "John",
260
+ lastName: "Smith",
261
+ email: "john.smith@steelcraft.com",
262
+ phone: "555-123-4567",
263
+ department: "Fabrication",
264
+ position: "Welder",
265
+ hireDate: "2020-05-15",
266
+ salary: 45000,
267
+ status: "Active"
268
+ },
269
+ {
270
+ id: 2,
271
+ employeeId: "EMP-1002",
272
+ firstName: "Maria",
273
+ lastName: "Garcia",
274
+ email: "maria.garcia@steelcraft.com",
275
+ phone: "555-234-5678",
276
+ department: "Erection",
277
+ position: "Crane Operator",
278
+ hireDate: "2019-08-22",
279
+ salary: 52000,
280
+ status: "Active"
281
+ },
282
+ {
283
+ id: 3,
284
+ employeeId: "EMP-1003",
285
+ firstName: "Robert",
286
+ lastName: "Johnson",
287
+ email: "robert.johnson@steelcraft.com",
288
+ phone: "555-345-6789",
289
+ department: "Quality Control",
290
+ position: "Inspector",
291
+ hireDate: "2021-02-10",
292
+ salary: 48000,
293
+ status: "Active"
294
+ },
295
+ {
296
+ id: 4,
297
+ employeeId: "EMP-1004",
298
+ firstName: "Sarah",
299
+ lastName: "Williams",
300
+ email: "sarah.williams@steelcraft.com",
301
+ phone: "555-456-7890",
302
+ department: "Maintenance",
303
+ position: "Technician",
304
+ hireDate: "2018-11-05",
305
+ salary: 42000,
306
+ status: "Active"
307
+ },
308
+ {
309
+ id: 5,
310
+ employeeId: "EMP-1005",
311
+ firstName: "David",
312
+ lastName: "Brown",
313
+ email: "david.brown@steelcraft.com",
314
+ phone: "555-567-8901",
315
+ department: "Administration",
316
+ position: "HR Manager",
317
+ hireDate: "2017-06-18",
318
+ salary: 58000,
319
+ status: "Active"
320
+ },
321
+ {
322
+ id: 6,
323
+ employeeId: "EMP-1006",
324
+ firstName: "Jennifer",
325
+ lastName: "Davis",
326
+ email: "jennifer.davis@steelcraft.com",
327
+ phone: "555-678-9012",
328
+ department: "Fabrication",
329
+ position: "Fitter",
330
+ hireDate: "2022-01-30",
331
+ salary: 46000,
332
+ status: "Active"
333
+ },
334
+ {
335
+ id: 7,
336
+ employeeId: "EMP-1007",
337
+ firstName: "Michael",
338
+ lastName: "Miller",
339
+ email: "michael.miller@steelcraft.com",
340
+ phone: "555-789-0123",
341
+ department: "Erection",
342
+ position: "Foreman",
343
+ hireDate: "2019-03-12",
344
+ salary: 55000,
345
+ status: "Active"
346
+ },
347
+ {
348
+ id: 8,
349
+ employeeId: "EMP-1008",
350
+ firstName: "Lisa",
351
+ lastName: "Wilson",
352
+ email: "lisa.wilson@steelcraft.com",
353
+ phone: "555-890-1234",
354
+ department: "Quality Control",
355
+ position: "Supervisor",
356
+ hireDate: "2020-07-25",
357
+ salary: 50000,
358
+ status: "On Leave"
359
+ },
360
+ {
361
+ id: 9,
362
+ employeeId: "EMP-1009",
363
+ firstName: "James",
364
+ lastName: "Taylor",
365
+ email: "james.taylor@steelcraft.com",
366
+ phone: "555-901-2345",
367
+ department: "Maintenance",
368
+ position: "Lead Technician",
369
+ hireDate: "2018-09-14",
370
+ salary: 47000,
371
+ status: "Active"
372
+ },
373
+ {
374
+ id: 10,
375
+ employeeId: "EMP-1010",
376
+ firstName: "Emily",
377
+ lastName: "Anderson",
378
+ email: "emily.anderson@steelcraft.com",
379
+ phone: "555-012-3456",
380
+ department: "Administration",
381
+ position: "Accountant",
382
+ hireDate: "2021-04-07",
383
+ salary: 51000,
384
+ status: "Active"
385
+ }
386
+ ];
387
+
388
+ // Pagination variables
389
+ let currentPage = 1;
390
+ const rowsPerPage = 10;
391
+ let filteredEmployees = [...employees];
392
+
393
+ // DOM elements
394
+ const employeeTableBody = document.getElementById('employeeTableBody');
395
+ const prevEmployeePage = document.getElementById('prevEmployeePage');
396
+ const nextEmployeePage = document.getElementById('nextEmployeePage');
397
+ const startEmployee = document.getElementById('startEmployee');
398
+ const endEmployee = document.getElementById('endEmployee');
399
+ const totalEmployees = document.getElementById('totalEmployees');
400
+ const employeeSearch = document.getElementById('employeeSearch');
401
+ const departmentFilter = document.getElementById('departmentFilter');
402
+ const statusFilter = document.getElementById('statusFilter');
403
+ const addEmployeeBtn = document.getElementById('addEmployeeBtn');
404
+ const employeeModal = document.getElementById('employeeModal');
405
+ const closeModal = document.getElementById('closeModal');
406
+ const cancelEmployee = document.getElementById('cancelEmployee');
407
+ const employeeForm = document.getElementById('employeeForm');
408
+ const modalTitle = document.getElementById('modalTitle');
409
+ const employeeIdInput = document.getElementById('employeeId');
410
+
411
+ // Initialize the page
412
+ document.addEventListener('DOMContentLoaded', () => {
413
+ renderEmployeeTable();
414
+ setupEventListeners();
415
+ });
416
+
417
+ // Set up event listeners
418
+ function setupEventListeners() {
419
+ // Pagination
420
+ prevEmployeePage.addEventListener('click', () => {
421
+ if (currentPage > 1) {
422
+ currentPage--;
423
+ renderEmployeeTable();
424
+ }
425
+ });
426
+
427
+ nextEmployeePage.addEventListener('click', () => {
428
+ if (currentPage * rowsPerPage < filteredEmployees.length) {
429
+ currentPage++;
430
+ renderEmployeeTable();
431
+ }
432
+ });
433
+
434
+ // Search and filters
435
+ employeeSearch.addEventListener('input', filterEmployees);
436
+ departmentFilter.addEventListener('change', filterEmployees);
437
+ statusFilter.addEventListener('change', filterEmployees);
438
+
439
+ // Modal controls
440
+ addEmployeeBtn.addEventListener('click', () => openEmployeeModal());
441
+ closeModal.addEventListener('click', () => closeEmployeeModal());
442
+ cancelEmployee.addEventListener('click', () => closeEmployeeModal());
443
+
444
+ // Form submission
445
+ employeeForm.addEventListener('submit', (e) => {
446
+ e.preventDefault();
447
+ saveEmployee();
448
+ });
449
+ }
450
+
451
+ // Filter employees based on search and filters
452
+ function filterEmployees() {
453
+ const searchTerm = employeeSearch.value.toLowerCase();
454
+ const department = departmentFilter.value;
455
+ const status = statusFilter.value;
456
+
457
+ filteredEmployees = employees.filter(employee => {
458
+ const fullName = `${employee.firstName} ${employee.lastName}`.toLowerCase();
459
+ const matchesSearch = fullName.includes(searchTerm) ||
460
+ employee.employeeId.toLowerCase().includes(searchTerm) ||
461
+ employee.email.toLowerCase().includes(searchTerm);
462
+
463
+ const matchesDepartment = department ? employee.department === department : true;
464
+ const matchesStatus = status ? employee.status === status : true;
465
+
466
+ return matchesSearch && matchesDepartment && matchesStatus;
467
+ });
468
+
469
+ currentPage = 1;
470
+ renderEmployeeTable();
471
+ }
472
+
473
+ // Render the employee table
474
+ function renderEmployeeTable() {
475
+ const start = (currentPage - 1) * rowsPerPage;
476
+ const end = start + rowsPerPage;
477
+ const paginatedEmployees = filteredEmployees.slice(start, end);
478
+
479
+ employeeTableBody.innerHTML = '';
480
+
481
+ if (paginatedEmployees.length === 0) {
482
+ employeeTableBody.innerHTML = `
483
+ <tr>
484
+ <td colspan="7" class="px-6 py-4 text-center text-gray-500">No employees found</td>
485
+ </tr>
486
+ `;
487
+ } else {
488
+ paginatedEmployees.forEach(employee => {
489
+ const row = document.createElement('tr');
490
+ row.className = 'hover:bg-gray-50';
491
+ row.innerHTML = `
492
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${employee.employeeId}</td>
493
+ <td class="px-6 py-4 whitespace-nowrap">
494
+ <div class="flex items-center">
495
+ <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center">
496
+ <i class="fas fa-user text-blue-600"></i>
497
+ </div>
498
+ <div class="ml-4">
499
+ <div class="text-sm font-medium text-gray-900">${employee.firstName} ${employee.lastName}</div>
500
+ <div class="text-sm text-gray-500">${employee.email}</div>
501
+ </div>
502
+ </div>
503
+ </td>
504
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${employee.department}</td>
505
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${employee.position}</td>
506
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${formatDate(employee.hireDate)}</td>
507
+ <td class="px-6 py-4 whitespace-nowrap">
508
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusClass(employee.status)}">
509
+ ${employee.status}
510
+ </span>
511
+ </td>
512
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
513
+ <button class="text-blue-600 hover:text-blue-900 mr-3 edit-btn" data-id="${employee.id}">Edit</button>
514
+ <button class="text-red-600 hover:text-red-900 delete-btn" data-id="${employee.id}">Delete</button>
515
+ </td>
516
+ `;
517
+ employeeTableBody.appendChild(row);
518
+ });
519
+
520
+ // Add event listeners to edit and delete buttons
521
+ document.querySelectorAll('.edit-btn').forEach(btn => {
522
+ btn.addEventListener('click', (e) => {
523
+ const id = parseInt(e.target.getAttribute('data-id'));
524
+ openEmployeeModal(id);
525
+ });
526
+ });
527
+
528
+ document.querySelectorAll('.delete-btn').forEach(btn => {
529
+ btn.addEventListener('click', (e) => {
530
+ const id = parseInt(e.target.getAttribute('data-id'));
531
+ deleteEmployee(id);
532
+ });
533
+ });
534
+ }
535
+
536
+ // Update pagination info
537
+ startEmployee.textContent = start + 1;
538
+ endEmployee.textContent = Math.min(end, filteredEmployees.length);
539
+ totalEmployees.textContent = filteredEmployees.length;
540
+
541
+ // Update pagination buttons
542
+ prevEmployeePage.disabled = currentPage === 1;
543
+ nextEmployeePage.disabled = end >= filteredEmployees.length;
544
+ }
545
+
546
+ // Format date for display
547
+ function formatDate(dateString) {
548
+ const options = { year: 'numeric', month: 'short', day: 'numeric' };
549
+ return new Date(dateString).toLocaleDateString('en-US', options);
550
+ }
551
+
552
+ // Get status class for styling
553
+ function getStatusClass(status) {
554
+ switch(status) {
555
+ case 'Active': return 'bg-green-100 text-green-800';
556
+ case 'Inactive': return 'bg-red-100 text-red-800';
557
+ case 'On Leave': return 'bg-yellow-100 text-yellow-800';
558
+ default: return 'bg-gray-100 text-gray-800';
559
+ }
560
+ }
561
+
562
+ // Open employee modal for adding or editing
563
+ function openEmployeeModal(id = null) {
564
+ if (id) {
565
+ // Edit mode
566
+ const employee = employees.find(e => e.id === id);
567
+ if (employee) {
568
+ modalTitle.textContent = 'Edit Employee';
569
+ employeeIdInput.value = employee.id;
570
+ document.getElementById('firstName').value = employee.firstName;
571
+ document.getElementById('lastName').value = employee.lastName;
572
+ document.getElementById('email').value = employee.email;
573
+ document.getElementById('phone').value = employee.phone;
574
+ document.getElementById('department').value = employee.department;
575
+ document.getElementById('position').value = employee.position;
576
+ document.getElementById('hireDate').value = employee.hireDate;
577
+ document.getElementById('salary').value = employee.salary;
578
+ document.getElementById('status').value = employee.status;
579
+ }
580
+ } else {
581
+ // Add mode
582
+ modalTitle.textContent = 'Add New Employee';
583
+ employeeForm.reset();
584
+ employeeIdInput.value = '';
585
+ }
586
+ employeeModal.classList.remove('hidden');
587
+ }
588
+
589
+ // Close employee modal
590
+ function closeEmployeeModal() {
591
+ employeeModal.classList.add('hidden');
592
+ }
593
+
594
+ // Save employee (add or update)
595
+ function saveEmployee() {
596
+ const id = employeeIdInput.value ? parseInt(employeeIdInput.value) : null;
597
+ const firstName = document.getElementById('firstName').value;
598
+ const lastName = document.getElementById('lastName').value;
599
+ const email = document.getElementById('email').value;
600
+ const phone = document.getElementById('phone').value;
601
+ const department = document.getElementById('department').value;
602
+ const position = document.getElementById('position').value;
603
+ const hireDate = document.getElementById('hireDate').value;
604
+ const salary = parseFloat(document.getElementById('salary').value);
605
+ const status = document.getElementById('status').value;
606
+
607
+ if (id) {
608
+ // Update existing employee
609
+ const index = employees.findIndex(e => e.id === id);
610
+ if (index !== -1) {
611
+ employees[index] = {
612
+ ...employees[index],
613
+ firstName,
614
+ lastName,
615
+ email,
616
+ phone,
617
+ department,
618
+ position,
619
+ hireDate,
620
+ salary,
621
+ status
622
+ };
623
+ }
624
+ } else {
625
+ // Add new employee
626
+ const newId = employees.length > 0 ? Math.max(...employees.map(e => e.id)) + 1 : 1;
627
+ const newEmployeeId = `EMP-${1000 + newId}`;
628
+
629
+ employees.push({
630
+ id: newId,
631
+ employeeId: newEmployeeId,
632
+ firstName,
633
+ lastName,
634
+ email,
635
+ phone,
636
+ department,
637
+ position,
638
+ hireDate,
639
+ salary,
640
+ status
641
+ });
642
+ }
643
+
644
+ closeEmployeeModal();
645
+ filterEmployees(); // This will also trigger renderEmployeeTable
646
+ }
647
+
648
+ // Delete employee
649
+ function deleteEmployee(id) {
650
+ if (confirm('Are you sure you want to delete this employee?')) {
651
+ employees = employees.filter(employee => employee.id !== id);
652
+ filterEmployees(); // This will also trigger renderEmployeeTable
653
+ }
654
+ }
655
+ </script>
656
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=poluser/hr-test" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
657
+ </html>
prompts.txt ADDED
File without changes