Changeset 79fff4f for interfejs/store-employee.html
- Timestamp:
- 02/22/26 22:32:07 (7 months ago)
- Branches:
- finki-main, main
- Children:
- 6fea37e, 81bc7da
- Parents:
- 4dff800
- File:
-
- 1 edited
-
interfejs/store-employee.html (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
interfejs/store-employee.html
r4dff800 r79fff4f 18 18 <li><a href="products.html">Products</a></li> 19 19 <li><a href="#" id="dashboard-link" class="active">Employee</a></li> 20 <li><a href="change-password.html" class="change-password-btn">🔑 Change Password</a></li> 21 <li><a href="#" id="logout-link">Logout</a></li> 20 22 </ul> 21 23 </nav> … … 170 172 </main> 171 173 174 <!-- Respond to Request Modal --> 172 175 <div id="respond-request-modal" class="modal" style="display: none;"> 173 176 <div class="modal-content"> … … 176 179 <form id="respond-request-form" class="form"> 177 180 <input type="hidden" id="respond-request-num"> 178 179 181 <div class="form-group"> 180 182 <label for="request-response">Your Response</label> 181 183 <textarea id="request-response" rows="4" required></textarea> 182 184 </div> 183 184 185 <div class="form-group"> 185 186 <label for="request-status">Update Status</label> … … 190 191 </select> 191 192 </div> 192 193 193 <button type="submit" class="btn-primary">Submit Response</button> 194 194 </form> … … 196 196 </div> 197 197 198 <!-- Process Refund Modal --> 198 199 <div id="process-refund-modal" class="modal" style="display: none;"> 199 200 <div class="modal-content"> … … 202 203 <form id="process-refund-form" class="form"> 203 204 <input type="hidden" id="process-refund-id"> 204 205 205 <div class="form-group"> 206 206 <label for="refund-action">Action</label> … … 210 210 </select> 211 211 </div> 212 213 212 <div class="form-group"> 214 213 <label for="refund-notes">Notes</label> 215 214 <textarea id="refund-notes" rows="3"></textarea> 216 215 </div> 217 218 216 <button type="submit" class="btn-primary">Process Refund</button> 219 217 </form> … … 244 242 document.addEventListener('DOMContentLoaded', async () => { 245 243 const user = await loadUserData(); 244 246 245 if (!user || user.userType !== 'store_employee') { 247 246 window.location.href = 'index.html'; … … 250 249 251 250 document.getElementById('employee-name').textContent = `${user.firstName} ${user.lastName || ''}`; 251 252 // Logout functionality 253 document.getElementById('logout-link').addEventListener('click', async (e) => { 254 e.preventDefault(); 255 await logout(); 256 }); 252 257 253 258 // Load stores … … 277 282 document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active')); 278 283 document.querySelectorAll('.tab-content').forEach(c => c.classList.remove('active')); 284 279 285 btn.classList.add('active'); 280 286 document.getElementById(`${btn.dataset.tab}-tab`).classList.add('active'); … … 316 322 // Display tasks 317 323 const tasksList = document.getElementById('tasks-list'); 324 318 325 if (data.tasks.pending_orders.length > 0 || data.tasks.pending_requests.length > 0 || data.tasks.pending_refunds.length > 0) { 319 326 let tasksHtml = '<div class="task-items">'; … … 323 330 data.tasks.pending_orders.forEach(order => { 324 331 tasksHtml += ` 325 <div class="task-item">326 <p><strong>Order #${order.order_num}</strong> - ${order.first_name} ${order.last_name}</p>327 <button class="btn-small" onclick="updateOrderStatus('${order.order_num}')">Update Status</button>328 </div>329 `;332 <div class="task-item"> 333 <p><strong>Order #${order.order_num}</strong> - ${order.first_name} ${order.last_name}</p> 334 <button class="btn-small" onclick="updateOrderStatus('${order.order_num}')">Update Status</button> 335 </div> 336 `; 330 337 }); 331 338 } … … 335 342 data.tasks.pending_requests.forEach(request => { 336 343 tasksHtml += ` 337 <div class="task-item">338 <p><strong>Request #${request.request_num}</strong> - ${request.first_name} ${request.last_name}</p>339 <p>${request.problem.substring(0, 50)}${request.problem.length > 50 ? '...' : ''}</p>340 <button class="btn-small" onclick="respondToRequest('${request.request_num}')">Respond</button>341 </div>342 `;344 <div class="task-item"> 345 <p><strong>Request #${request.request_num}</strong> - ${request.first_name} ${request.last_name}</p> 346 <p>${request.problem.substring(0, 50)}${request.problem.length > 50 ? '...' : ''}</p> 347 <button class="btn-small" onclick="respondToRequest('${request.request_num}')">Respond</button> 348 </div> 349 `; 343 350 }); 344 351 } … … 348 355 data.tasks.pending_refunds.forEach(refund => { 349 356 tasksHtml += ` 350 <div class="task-item">351 <p><strong>Refund #${refund.refund_id}</strong> - Order #${refund.order_num}</p>352 <p>Amount: $${parseFloat(refund.amount).toFixed(2)}</p>353 <button class="btn-small" onclick="processRefund('${refund.refund_id}')">Process</button>354 </div>355 `;357 <div class="task-item"> 358 <p><strong>Refund #${refund.refund_id}</strong> - Order #${refund.order_num}</p> 359 <p>Amount: $${parseFloat(refund.amount).toFixed(2)}</p> 360 <button class="btn-small" onclick="processRefund('${refund.refund_id}')">Process</button> 361 </div> 362 `; 356 363 }); 357 364 } … … 374 381 375 382 const tbody = document.getElementById('orders-list'); 383 376 384 if (data.success && data.orders.length > 0) { 377 385 tbody.innerHTML = data.orders.map(order => { 378 386 const total = order.items ? order.items.reduce((sum, item) => 379 387 sum + (item.price * item.quantity), 0) : 0; 388 380 389 return ` 381 <tr>382 <td>${order.order_num}</td>383 <td>${order.first_name} ${order.last_name}</td>384 <td>${new Date(order.order_date).toLocaleDateString()}</td>385 <td><span class="status-badge status-${order.status}">${order.status}</span></td>386 <td>$${total.toFixed(2)}</td>387 <td>388 <button class="btn-small" onclick="updateOrderStatus('${order.order_num}')">Update</button>389 <button class="btn-small" onclick="viewOrderDetails('${order.order_num}')">View</button>390 </td>391 </tr>392 `;390 <tr> 391 <td>${order.order_num}</td> 392 <td>${order.first_name} ${order.last_name}</td> 393 <td>${new Date(order.order_date).toLocaleDateString()}</td> 394 <td><span class="status-badge status-${order.status}">${order.status}</span></td> 395 <td>$${total.toFixed(2)}</td> 396 <td> 397 <button class="btn-small" onclick="updateOrderStatus('${order.order_num}')">Update</button> 398 <button class="btn-small" onclick="viewOrderDetails('${order.order_num}')">View</button> 399 </td> 400 </tr> 401 `; 393 402 }).join(''); 394 403 } else { … … 417 426 418 427 const tbody = document.getElementById('products-list'); 428 419 429 if (data.success && data.products.length > 0) { 420 430 tbody.innerHTML = data.products.map(product => ` 421 <tr>422 <td>${product.code}</td>423 <td>${product.description.substring(0, 30)}${product.description.length > 30 ? '...' : ''}</td>424 <td>$${parseFloat(product.price).toFixed(2)}</td>425 <td>${product.availability}</td>426 <td>427 <button class="btn-small" onclick="viewProduct('${product.code}')">View</button>428 </td>429 </tr>430 `).join('');431 <tr> 432 <td>${product.code}</td> 433 <td>${product.description.substring(0, 30)}${product.description.length > 30 ? '...' : ''}</td> 434 <td>$${parseFloat(product.price).toFixed(2)}</td> 435 <td>${product.availability}</td> 436 <td> 437 <button class="btn-small" onclick="viewProduct('${product.code}')">View</button> 438 </td> 439 </tr> 440 `).join(''); 431 441 } else { 432 442 tbody.innerHTML = '<tr><td colspan="5">No products found</td></tr>';
Note:
See TracChangeset
for help on using the changeset viewer.
