Monirbd2025 commited on
Commit
f96bf3b
·
verified ·
1 Parent(s): 410b646

Make a Employee Database Program that can store Name, Father Name, Mother Name, Date of Birth - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +370 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Office Tool
3
- emoji: 🏃
4
- colorFrom: green
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: office-tool
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
  colorTo: pink
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,370 @@
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>Employee Database</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
+ /* Custom scrollbar */
11
+ ::-webkit-scrollbar {
12
+ width: 8px;
13
+ }
14
+ ::-webkit-scrollbar-track {
15
+ background: #f1f1f1;
16
+ }
17
+ ::-webkit-scrollbar-thumb {
18
+ background: #888;
19
+ border-radius: 4px;
20
+ }
21
+ ::-webkit-scrollbar-thumb:hover {
22
+ background: #555;
23
+ }
24
+
25
+ /* Fade-in animation */
26
+ @keyframes fadeIn {
27
+ from { opacity: 0; transform: translateY(10px); }
28
+ to { opacity: 1; transform: translateY(0); }
29
+ }
30
+ .fade-in {
31
+ animation: fadeIn 0.3s ease-in-out;
32
+ }
33
+
34
+ /* Modal styling */
35
+ .modal-overlay {
36
+ background-color: rgba(0, 0, 0, 0.5);
37
+ }
38
+ </style>
39
+ </head>
40
+ <body class="bg-gray-100 min-h-screen">
41
+ <div class="container mx-auto px-4 py-8">
42
+ <!-- Header -->
43
+ <header class="mb-8 text-center">
44
+ <h1 class="text-4xl font-bold text-indigo-700 mb-2">Employee Database</h1>
45
+ <p class="text-gray-600">Manage your employee records with ease</p>
46
+ </header>
47
+
48
+ <!-- Add Employee Form -->
49
+ <div class="bg-white rounded-lg shadow-md p-6 mb-8 fade-in">
50
+ <h2 class="text-2xl font-semibold text-gray-800 mb-4 flex items-center">
51
+ <i class="fas fa-user-plus mr-2 text-indigo-600"></i> Add New Employee
52
+ </h2>
53
+ <form id="employeeForm" class="grid grid-cols-1 md:grid-cols-2 gap-4">
54
+ <div>
55
+ <label for="name" class="block text-sm font-medium text-gray-700 mb-1">Full Name</label>
56
+ <input type="text" id="name" required
57
+ class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
58
+ </div>
59
+ <div>
60
+ <label for="fatherName" class="block text-sm font-medium text-gray-700 mb-1">Father's Name</label>
61
+ <input type="text" id="fatherName" required
62
+ class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
63
+ </div>
64
+ <div>
65
+ <label for="motherName" class="block text-sm font-medium text-gray-700 mb-1">Mother's Name</label>
66
+ <input type="text" id="motherName" required
67
+ class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
68
+ </div>
69
+ <div>
70
+ <label for="dob" class="block text-sm font-medium text-gray-700 mb-1">Date of Birth</label>
71
+ <input type="date" id="dob" required
72
+ class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
73
+ </div>
74
+ <div class="md:col-span-2 flex justify-end">
75
+ <button type="submit"
76
+ class="px-6 py-2 bg-indigo-600 text-white rounded-md hover:bg-indigo-700 transition flex items-center">
77
+ <i class="fas fa-save mr-2"></i> Save Employee
78
+ </button>
79
+ </div>
80
+ </form>
81
+ </div>
82
+
83
+ <!-- Employee List -->
84
+ <div class="bg-white rounded-lg shadow-md p-6 fade-in">
85
+ <div class="flex flex-col md:flex-row md:items-center justify-between mb-6">
86
+ <h2 class="text-2xl font-semibold text-gray-800 mb-2 md:mb-0 flex items-center">
87
+ <i class="fas fa-users mr-2 text-indigo-600"></i> Employee Records
88
+ </h2>
89
+ <div class="relative">
90
+ <input type="text" id="searchInput" placeholder="Search employees..."
91
+ class="w-full md:w-64 px-4 py-2 pl-10 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500">
92
+ <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i>
93
+ </div>
94
+ </div>
95
+
96
+ <!-- Table -->
97
+ <div class="overflow-x-auto">
98
+ <table class="min-w-full divide-y divide-gray-200">
99
+ <thead class="bg-gray-50">
100
+ <tr>
101
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
102
+ #
103
+ </th>
104
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
105
+ Name
106
+ </th>
107
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
108
+ Father's Name
109
+ </th>
110
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
111
+ Mother's Name
112
+ </th>
113
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
114
+ Date of Birth
115
+ </th>
116
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
117
+ Actions
118
+ </th>
119
+ </tr>
120
+ </thead>
121
+ <tbody id="employeeTableBody" class="bg-white divide-y divide-gray-200">
122
+ <!-- Employee data will be inserted here by JavaScript -->
123
+ <tr id="noEmployeesRow" class="text-center">
124
+ <td colspan="6" class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
125
+ No employees found. Please add some employees.
126
+ </td>
127
+ </tr>
128
+ </tbody>
129
+ </table>
130
+ </div>
131
+ </div>
132
+ </div>
133
+
134
+ <!-- Edit Modal -->
135
+ <div id="editModal" class="fixed inset-0 z-50 hidden overflow-y-auto">
136
+ <div class="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center modal-overlay">
137
+ <div class="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-lg sm:w-full fade-in">
138
+ <div class="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
139
+ <h3 class="text-xl font-semibold text-gray-900 mb-4 flex items-center">
140
+ <i class="fas fa-user-edit mr-2 text-indigo-600"></i> Edit Employee
141
+ </h3>
142
+ <form id="editForm" class="space-y-4">
143
+ <input type="hidden" id="editId">
144
+ <div>
145
+ <label for="editName" class="block text-sm font-medium text-gray-700">Full Name</label>
146
+ <input type="text" id="editName" required
147
+ class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
148
+ </div>
149
+ <div>
150
+ <label for="editFatherName" class="block text-sm font-medium text-gray-700">Father's Name</label>
151
+ <input type="text" id="editFatherName" required
152
+ class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
153
+ </div>
154
+ <div>
155
+ <label for="editMotherName" class="block text-sm font-medium text-gray-700">Mother's Name</label>
156
+ <input type="text" id="editMotherName" required
157
+ class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
158
+ </div>
159
+ <div>
160
+ <label for="editDob" class="block text-sm font-medium text-gray-700">Date of Birth</label>
161
+ <input type="date" id="editDob" required
162
+ class="mt-1 block w-full border border-gray-300 rounded-md shadow-sm py-2 px-3 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500">
163
+ </div>
164
+ </form>
165
+ </div>
166
+ <div class="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
167
+ <button type="button" id="saveEditBtn"
168
+ class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm">
169
+ Save Changes
170
+ </button>
171
+ <button type="button" id="cancelEditBtn"
172
+ class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
173
+ Cancel
174
+ </button>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ </div>
179
+
180
+ <script>
181
+ document.addEventListener('DOMContentLoaded', function() {
182
+ // Selectors
183
+ const employeeForm = document.getElementById('employeeForm');
184
+ const employeeTableBody = document.getElementById('employeeTableBody');
185
+ const noEmployeesRow = document.getElementById('noEmployeesRow');
186
+ const searchInput = document.getElementById('searchInput');
187
+ const editModal = document.getElementById('editModal');
188
+ const editForm = document.getElementById('editForm');
189
+ const saveEditBtn = document.getElementById('saveEditBtn');
190
+ const cancelEditBtn = document.getElementById('cancelEditBtn');
191
+
192
+ // State
193
+ let employees = JSON.parse(localStorage.getItem('employees')) || [];
194
+
195
+ // Initialize the app
196
+ renderEmployees();
197
+
198
+ // Event Listeners
199
+ employeeForm.addEventListener('submit', handleSubmit);
200
+ searchInput.addEventListener('input', handleSearch);
201
+ saveEditBtn.addEventListener('click', saveEdit);
202
+ cancelEditBtn.addEventListener('click', closeModal);
203
+
204
+ // Functions
205
+ function handleSubmit(e) {
206
+ e.preventDefault();
207
+
208
+ const name = document.getElementById('name').value;
209
+ const fatherName = document.getElementById('fatherName').value;
210
+ const motherName = document.getElementById('motherName').value;
211
+ const dob = document.getElementById('dob').value;
212
+
213
+ const newEmployee = {
214
+ id: Date.now(),
215
+ name,
216
+ fatherName,
217
+ motherName,
218
+ dob
219
+ };
220
+
221
+ employees.push(newEmployee);
222
+ saveToLocalStorage();
223
+ renderEmployees();
224
+ employeeForm.reset();
225
+
226
+ // Show success toast
227
+ showToast('Employee added successfully!', 'success');
228
+ }
229
+
230
+ function renderEmployees(filteredEmployees = null) {
231
+ const employeesToRender = filteredEmployees || employees;
232
+
233
+ if (employeesToRender.length === 0) {
234
+ noEmployeesRow.style.display = 'table-row';
235
+ employeeTableBody.innerHTML = '';
236
+ employeeTableBody.appendChild(noEmployeesRow);
237
+ return;
238
+ }
239
+
240
+ noEmployeesRow.style.display = 'none';
241
+ employeeTableBody.innerHTML = '';
242
+
243
+ employeesToRender.forEach((employee, index) => {
244
+ const row = document.createElement('tr');
245
+ row.className = 'hover:bg-gray-50';
246
+ row.innerHTML = `
247
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${index + 1}</td>
248
+ <td class="px-6 py-4 whitespace-nowrap">
249
+ <div class="text-sm font-medium text-gray-900">${employee.name}</div>
250
+ </td>
251
+ <td class="px-6 py-4 whitespace-nowrap">
252
+ <div class="text-sm text-gray-500">${employee.fatherName}</div>
253
+ </td>
254
+ <td class="px-6 py-4 whitespace-nowrap">
255
+ <div class="text-sm text-gray-500">${employee.motherName}</div>
256
+ </td>
257
+ <td class="px-6 py-4 whitespace-nowrap">
258
+ <div class="text-sm text-gray-500">${formatDate(employee.dob)}</div>
259
+ </td>
260
+ <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
261
+ <button onclick="editEmployee(${employee.id})" class="text-indigo-600 hover:text-indigo-900 mr-3">
262
+ <i class="fas fa-edit"></i>
263
+ </button>
264
+ <button onclick="deleteEmployee(${employee.id})" class="text-red-600 hover:text-red-900">
265
+ <i class="fas fa-trash-alt"></i>
266
+ </button>
267
+ </td>
268
+ `;
269
+ employeeTableBody.appendChild(row);
270
+ });
271
+ }
272
+
273
+ function formatDate(dateString) {
274
+ const options = { year: 'numeric', month: 'long', day: 'numeric' };
275
+ return new Date(dateString).toLocaleDateString(undefined, options);
276
+ }
277
+
278
+ function saveToLocalStorage() {
279
+ localStorage.setItem('employees', JSON.stringify(employees));
280
+ }
281
+
282
+ function handleSearch(e) {
283
+ const searchTerm = e.target.value.toLowerCase();
284
+
285
+ if (searchTerm.trim() === '') {
286
+ renderEmployees();
287
+ return;
288
+ }
289
+
290
+ const filteredEmployees = employees.filter(employee =>
291
+ employee.name.toLowerCase().includes(searchTerm) ||
292
+ employee.fatherName.toLowerCase().includes(searchTerm) ||
293
+ employee.motherName.toLowerCase().includes(searchTerm)
294
+ );
295
+
296
+ renderEmployees(filteredEmployees);
297
+ }
298
+
299
+ window.deleteEmployee = function(id) {
300
+ if (confirm('Are you sure you want to delete this employee?')) {
301
+ employees = employees.filter(employee => employee.id !== id);
302
+ saveToLocalStorage();
303
+ renderEmployees();
304
+
305
+ // Show success toast
306
+ showToast('Employee deleted successfully!', 'success');
307
+ }
308
+ }
309
+
310
+ window.editEmployee = function(id) {
311
+ const employee = employees.find(emp => emp.id === id);
312
+ if (!employee) return;
313
+
314
+ document.getElementById('editId').value = employee.id;
315
+ document.getElementById('editName').value = employee.name;
316
+ document.getElementById('editFatherName').value = employee.fatherName;
317
+ document.getElementById('editMotherName').value = employee.motherName;
318
+ document.getElementById('editDob').value = employee.dob;
319
+
320
+ editModal.classList.remove('hidden');
321
+ }
322
+
323
+ function saveEdit() {
324
+ const id = parseInt(document.getElementById('editId').value);
325
+ const name = document.getElementById('editName').value;
326
+ const fatherName = document.getElementById('editFatherName').value;
327
+ const motherName = document.getElementById('editMotherName').value;
328
+ const dob = document.getElementById('editDob').value;
329
+
330
+ employees = employees.map(employee => {
331
+ if (employee.id === id) {
332
+ return { id, name, fatherName, motherName, dob };
333
+ }
334
+ return employee;
335
+ });
336
+
337
+ saveToLocalStorage();
338
+ renderEmployees();
339
+ closeModal();
340
+
341
+ // Show success toast
342
+ showToast('Employee updated successfully!', 'success');
343
+ }
344
+
345
+ function closeModal() {
346
+ editModal.classList.add('hidden');
347
+ }
348
+
349
+ function showToast(message, type) {
350
+ const toast = document.createElement('div');
351
+ toast.className = `fixed top-4 right-4 px-4 py-2 rounded-md shadow-lg text-white ${
352
+ type === 'success' ? 'bg-green-500' : 'bg-red-500'
353
+ } flex items-center`;
354
+ toast.innerHTML = `
355
+ <i class="fas ${type === 'success' ? 'fa-check-circle' : 'fa-exclamation-circle'} mr-2"></i>
356
+ ${message}
357
+ `;
358
+ document.body.appendChild(toast);
359
+
360
+ setTimeout(() => {
361
+ toast.classList.add('opacity-0', 'transition-opacity', 'duration-300');
362
+ setTimeout(() => {
363
+ toast.remove();
364
+ }, 300);
365
+ }, 3000);
366
+ }
367
+ });
368
+ </script>
369
+ <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=Monirbd2025/office-tool" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
370
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Make a Employee Database Program that can store Name, Father Name, Mother Name, Date of Birth