amit898/sweetslice-delights
0
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>Cake List - SweetSlice Delights</title>7 <script src="https://cdn.tailwindcss.com"></script>8 <script src="https://unpkg.com/feather-icons"></script>9 <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>10</head>11<body class="bg-gray-100">12 <!-- Admin Navigation -->13 <nav class="bg-gray-900 text-white shadow-lg">14 <div class="max-w-6xl mx-auto px-4">15 <div class="flex justify-between">16 <div class="flex space-x-7">17 <a href="#" class="flex items-center py-4 px-2">18 <span class="font-semibold text-pink-400 text-2xl">SweetSlice</span>19 <i data-feather="pie-chart" class="ml-2 text-pink-400"></i>20 <span class="ml-4 text-white">Admin Panel</span>21 </a>22 </div>23 <div class="hidden md:flex items-center space-x-1">24 <a href="admin.php" class="py-4 px-2 text-gray-300 hover:text-pink-400 transition duration-300">Add Cake</a>25 <a href="#" class="py-4 px-2 text-pink-400 font-semibold">Manage Cakes</a>26 <a href="orders.php" class="py-4 px-2 text-gray-300 hover:text-pink-400 transition duration-300">Orders</a>27 <a href="logout.php" class="py-2 px-4 bg-pink-600 text-white rounded-lg hover:bg-pink-700 transition duration-300">Logout</a>28 </div>29 <div class="md:hidden flex items-center">30 <button class="outline-none mobile-menu-button">31 <i data-feather="menu" class="w-6 h-6 text-gray-300"></i>32 </button>33 </div>34 </div>35 </div>36 </nav>37 38 <!-- Admin Content -->39 <div class="container mx-auto px-4 py-8">40 <div class="bg-white rounded-lg shadow-md p-6">41 <div class="flex justify-between items-center mb-6">42 <h2 class="text-2xl font-bold text-gray-800">All Cakes</h2>43 <a href="admin.php" class="px-4 py-2 bg-pink-600 text-white rounded-md hover:bg-pink-700 transition duration-300">44 <i data-feather="plus" class="mr-2 w-4 h-4 inline"></i> Add New45 </a>46 </div>47 48 <?php if (isset($success)): ?>49 <div class="bg-green-100 border border-green-400 text-green-700 px-4 py-3 rounded relative mb-4" role="alert">50 <span class="block sm:inline"><?php echo $success; ?></span>51 </div>52 <?php endif; ?>53 54 <?php if (isset($error)): ?>55 <div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative mb-4" role="alert">56 <span class="block sm:inline"><?php echo $error; ?></span>57 </div>58 <?php endif; ?>59 60 <div class="overflow-x-auto">61 <table class="min-w-full divide-y divide-gray-200">62 <thead class="bg-gray-50">63 <tr>64 <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Image</th>65 <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Title</th>66 <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th>67 <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Price</th>68 <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>69 </tr>70 </thead>71 <tbody class="bg-white divide-y divide-gray-200">72 <?php73 // Fetch all cakes from database74 $sql = "SELECT * FROM cakes ORDER BY id DESC";75 $result = $db->query($sql);76 77 if ($result->num_rows > 0) {78 while($row = $result->fetch_assoc()) {79 echo '<tr>';80 echo '<td class="px-6 py-4 whitespace-nowrap"><img src="'.$row['image_path'].'" class="h-12 w-12 rounded-full object-cover" alt="Cake"></td>';81 echo '<td class="px-6 py-4 whitespace-nowrap">'.$row['title'].'</td>';82 echo '<td class="px-6 py-4 whitespace-nowrap">'.$row['category'].'</td>';83 echo '<td class="px-6 py-4 whitespace-nowrap">$'.number_format($row['price'], 2).'</td>';84 echo '<td class="px-6 py-4 whitespace-nowrap text-sm font-medium">85 <a href="edit-cake.php?id='.$row['id'].'" class="text-pink-600 hover:text-pink-900 mr-3"><i data-feather="edit" class="w-4 h-4 inline"></i></a>86 <a href="?delete='.$row['id'].'" class="text-red-600 hover:text-red-900" onclick="return confirm(\'Are you sure you want to delete this cake?\')"><i data-feather="trash-2" class="w-4 h-4 inline"></i></a>87 </td>';88 echo '</tr>';89 }90 } else {91 echo '<tr><td colspan="5" class="px-6 py-4 text-center text-gray-500">No cakes found</td></tr>';92 }93 ?>94 </tbody>95 </table>96 </div>97 </div>98 </div>99 100 <script>101 // Mobile menu toggle102 const btn = document.querySelector(".mobile-menu-button");103 const menu = document.querySelector(".mobile-menu");104 105 btn.addEventListener("click", () => {106 menu.classList.toggle("hidden");107 });108 </script>109 <script>feather.replace();</script>110</body>111</html>112<?php113$db->close();114?>115 