cyberZag commited on
Commit
d6b64e1
·
verified ·
1 Parent(s): aa29200

select the time rracking to view

Browse files
Files changed (2) hide show
  1. index.html +3 -2
  2. time-tracking.html +97 -16
index.html CHANGED
@@ -373,9 +373,10 @@
373
  if (user.role === 'admin') {
374
  window.location.href = "admin-dashboard.html";
375
  } else {
376
- window.location.href = "time-tracking.html";
 
377
  }
378
- } else {
379
  alert('Invalid email or password');
380
  }
381
  });
 
373
  if (user.role === 'admin') {
374
  window.location.href = "admin-dashboard.html";
375
  } else {
376
+ // Redirect to time tracking page by default
377
+ window.location.href = "time-tracking.html";
378
  }
379
+ } else {
380
  alert('Invalid email or password');
381
  }
382
  });
time-tracking.html CHANGED
@@ -121,8 +121,8 @@
121
  </div>
122
 
123
  <div class="overflow-x-auto">
124
- <table class="min-w-full divide-y divide-gray-200">
125
- <thead class="bg-gray-50">
126
  <tr>
127
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
128
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Clock In</th>
@@ -130,29 +130,110 @@
130
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total Hours</th>
131
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Break Time</th>
132
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
 
133
  </tr>
134
  </thead>
135
- <tbody class="bg-white divide-y divide-gray-200">
136
- <tr>
137
- <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-dark">Mon, Jun 12</td>
138
- <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">9:00 AM</td>
139
- <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5:30 PM</td>
140
- <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">8.5</td>
141
- <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">0:45</td>
142
- <td class="px-6 py-4 whitespace-nowrap">
143
- <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800">Complete</span>
144
- </td>
145
- </tr>
146
- <!-- More rows would go here -->
147
- </tbody>
148
  </table>
149
  </div>
150
  </div>
151
  </div>
152
  </div>
153
-
154
  <script>
155
  feather.replace();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
156
  </script>
157
  </body>
158
  </html>
 
121
  </div>
122
 
123
  <div class="overflow-x-auto">
124
+ <table class="min-w-full divide-y divide-gray-200" id="timeHistoryTable">
125
+ <thead class="bg-gray-50">
126
  <tr>
127
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
128
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Clock In</th>
 
130
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total Hours</th>
131
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Break Time</th>
132
  <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
133
+ <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
134
  </tr>
135
  </thead>
136
+ <tbody class="bg-white divide-y divide-gray-200" id="timeHistoryBody">
137
+ <!-- Sample data rows will be populated by JavaScript -->
138
+ </tbody>
 
 
 
 
 
 
 
 
 
 
139
  </table>
140
  </div>
141
  </div>
142
  </div>
143
  </div>
 
144
  <script>
145
  feather.replace();
146
+
147
+ // Sample time tracking data
148
+ const timeEntries = [
149
+ {
150
+ date: 'Mon, Jun 12',
151
+ clockIn: '9:00 AM',
152
+ clockOut: '5:30 PM',
153
+ totalHours: '8.5',
154
+ breakTime: '0:45',
155
+ status: 'Complete'
156
+ },
157
+ {
158
+ date: 'Tue, Jun 13',
159
+ clockIn: '8:45 AM',
160
+ clockOut: '5:15 PM',
161
+ totalHours: '8.5',
162
+ breakTime: '1:00',
163
+ status: 'Complete'
164
+ },
165
+ {
166
+ date: 'Wed, Jun 14',
167
+ clockIn: '9:15 AM',
168
+ clockOut: '5:45 PM',
169
+ totalHours: '8.5',
170
+ breakTime: '0:45',
171
+ status: 'Complete'
172
+ },
173
+ {
174
+ date: 'Thu, Jun 15',
175
+ clockIn: '9:00 AM',
176
+ clockOut: '-',
177
+ totalHours: '-',
178
+ breakTime: '-',
179
+ status: 'In Progress'
180
+ }
181
+ ];
182
+
183
+ // Populate time history table
184
+ const timeHistoryBody = document.getElementById('timeHistoryBody');
185
+
186
+ timeEntries.forEach(entry => {
187
+ const row = document.createElement('tr');
188
+
189
+ // Status badge color
190
+ let statusClass = '';
191
+ if (entry.status === 'Complete') {
192
+ statusClass = 'bg-green-100 text-green-800';
193
+ } else if (entry.status === 'In Progress') {
194
+ statusClass = 'bg-blue-100 text-blue-800';
195
+ } else if (entry.status === 'Pending') {
196
+ statusClass = 'bg-yellow-100 text-yellow-800';
197
+ }
198
+
199
+ row.innerHTML = `
200
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-dark">${entry.date}</td>
201
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${entry.clockIn}</td>
202
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${entry.clockOut}</td>
203
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${entry.totalHours}</td>
204
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${entry.breakTime}</td>
205
+ <td class="px-6 py-4 whitespace-nowrap">
206
+ <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${statusClass}">${entry.status}</span>
207
+ </td>
208
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium">
209
+ <button class="text-primary hover:text-primary-dark">Edit</button>
210
+ </td>
211
+ `;
212
+
213
+ timeHistoryBody.appendChild(row);
214
+ });
215
+
216
+ // Clock In/Out functionality
217
+ const clockInBtn = document.querySelector('.bg-primary');
218
+ const clockOutBtn = document.querySelector('.bg-gray-200');
219
+ const breakStartBtn = document.querySelector('.bg-secondary');
220
+ const breakEndBtn = document.querySelector('.bg-gray-200 + .bg-gray-200');
221
+
222
+ clockInBtn.addEventListener('click', () => {
223
+ alert('Clocked in at ' + new Date().toLocaleTimeString());
224
+ });
225
+
226
+ clockOutBtn.addEventListener('click', () => {
227
+ alert('Clocked out at ' + new Date().toLocaleTimeString());
228
+ });
229
+
230
+ breakStartBtn.addEventListener('click', () => {
231
+ alert('Break started at ' + new Date().toLocaleTimeString());
232
+ });
233
+
234
+ breakEndBtn.addEventListener('click', () => {
235
+ alert('Break ended at ' + new Date().toLocaleTimeString());
236
+ });
237
  </script>
238
  </body>
239
  </html>