undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +946 -19
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 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: catalog
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 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,946 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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>ElectroCatalog - Electrical & Electronics Inventory</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 CSS for gradients and animations */
|
| 11 |
+
.product-card {
|
| 12 |
+
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
| 13 |
+
}
|
| 14 |
+
.product-card:hover {
|
| 15 |
+
transform: translateY(-5px);
|
| 16 |
+
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
|
| 17 |
+
}
|
| 18 |
+
.gradient-bg {
|
| 19 |
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 20 |
+
}
|
| 21 |
+
.gradient-text {
|
| 22 |
+
background-clip: text;
|
| 23 |
+
-webkit-background-clip: text;
|
| 24 |
+
color: transparent;
|
| 25 |
+
background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 26 |
+
}
|
| 27 |
+
/* Custom scrollbar */
|
| 28 |
+
::-webkit-scrollbar {
|
| 29 |
+
width: 8px;
|
| 30 |
+
}
|
| 31 |
+
::-webkit-scrollbar-track {
|
| 32 |
+
background: #f1f1f1;
|
| 33 |
+
}
|
| 34 |
+
::-webkit-scrollbar-thumb {
|
| 35 |
+
background: #888;
|
| 36 |
+
border-radius: 4px;
|
| 37 |
+
}
|
| 38 |
+
::-webkit-scrollbar-thumb:hover {
|
| 39 |
+
background: #555;
|
| 40 |
+
}
|
| 41 |
+
</style>
|
| 42 |
+
</head>
|
| 43 |
+
<body class="bg-gray-50 min-h-screen">
|
| 44 |
+
<!-- Header/Navigation -->
|
| 45 |
+
<header class="gradient-bg text-white shadow-lg">
|
| 46 |
+
<div class="container mx-auto px-4 py-6">
|
| 47 |
+
<div class="flex justify-between items-center">
|
| 48 |
+
<div class="flex items-center space-x-2">
|
| 49 |
+
<i class="fas fa-bolt text-2xl"></i>
|
| 50 |
+
<h1 class="text-2xl font-bold">ElectroCatalog</h1>
|
| 51 |
+
</div>
|
| 52 |
+
<nav class="hidden md:flex space-x-6">
|
| 53 |
+
<a href="#" class="hover:text-gray-200 transition" onclick="showView('dashboard')">Dashboard</a>
|
| 54 |
+
<a href="#" class="hover:text-gray-200 transition" onclick="showView('all-products')">All Products</a>
|
| 55 |
+
<a href="#" class="hover:text-gray-200 transition" onclick="showView('add-product')">Add Product</a>
|
| 56 |
+
<a href="#" class="hover:text-gray-200 transition" onclick="showView('boxes')">Boxes</a>
|
| 57 |
+
</nav>
|
| 58 |
+
<button class="md:hidden text-xl" onclick="toggleMobileMenu()">
|
| 59 |
+
<i class="fas fa-bars"></i>
|
| 60 |
+
</button>
|
| 61 |
+
</div>
|
| 62 |
+
</div>
|
| 63 |
+
|
| 64 |
+
<!-- Mobile Menu -->
|
| 65 |
+
<div id="mobileMenu" class="hidden md:hidden bg-indigo-800 px-4 py-2">
|
| 66 |
+
<div class="flex flex-col space-y-3">
|
| 67 |
+
<a href="#" class="text-white hover:text-gray-200 transition" onclick="showView('dashboard')">Dashboard</a>
|
| 68 |
+
<a href="#" class="text-white hover:text-gray-200 transition" onclick="showView('all-products')">All Products</a>
|
| 69 |
+
<a href="#" class="text-white hover:text-gray-200 transition" onclick="showView('add-product')">Add Product</a>
|
| 70 |
+
<a href="#" class="text-white hover:text-gray-200 transition" onclick="showView('boxes')">Boxes</a>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</header>
|
| 74 |
+
|
| 75 |
+
<!-- Main Content -->
|
| 76 |
+
<main class="container mx-auto px-4 py-8">
|
| 77 |
+
<!-- Dashboard View (Default) -->
|
| 78 |
+
<div id="dashboard" class="view">
|
| 79 |
+
<div class="flex justify-between items-center mb-8">
|
| 80 |
+
<h2 class="text-2xl font-bold gradient-text">Dashboard</h2>
|
| 81 |
+
<div class="relative">
|
| 82 |
+
<input type="text" placeholder="Quick search..." class="px-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" id="quickSearch">
|
| 83 |
+
<button class="absolute right-3 top-2 text-gray-500 hover:text-indigo-600">
|
| 84 |
+
<i class="fas fa-search"></i>
|
| 85 |
+
</button>
|
| 86 |
+
</div>
|
| 87 |
+
</div>
|
| 88 |
+
|
| 89 |
+
<!-- Stats Cards -->
|
| 90 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-8">
|
| 91 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 92 |
+
<div class="flex items-center justify-between">
|
| 93 |
+
<div>
|
| 94 |
+
<p class="text-gray-500">Total Products</p>
|
| 95 |
+
<h3 class="text-3xl font-bold" id="totalProducts">0</h3>
|
| 96 |
+
</div>
|
| 97 |
+
<div class="p-3 rounded-full bg-indigo-100 text-indigo-600">
|
| 98 |
+
<i class="fas fa-boxes text-xl"></i>
|
| 99 |
+
</div>
|
| 100 |
+
</div>
|
| 101 |
+
</div>
|
| 102 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 103 |
+
<div class="flex items-center justify-between">
|
| 104 |
+
<div>
|
| 105 |
+
<p class="text-gray-500">Categories</p>
|
| 106 |
+
<h3 class="text-3xl font-bold" id="totalCategories">0</h3>
|
| 107 |
+
</div>
|
| 108 |
+
<div class="p-3 rounded-full bg-green-100 text-green-600">
|
| 109 |
+
<i class="fas fa-tags text-xl"></i>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
<div class="bg-white rounded-lg shadow p-6">
|
| 114 |
+
<div class="flex items-center justify-between">
|
| 115 |
+
<div>
|
| 116 |
+
<p class="text-gray-500">Boxes Used</p>
|
| 117 |
+
<h3 class="text-3xl font-bold" id="totalBoxes">0</h3>
|
| 118 |
+
</div>
|
| 119 |
+
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
|
| 120 |
+
<i class="fas fa-archive text-xl"></i>
|
| 121 |
+
</div>
|
| 122 |
+
</div>
|
| 123 |
+
</div>
|
| 124 |
+
</div>
|
| 125 |
+
|
| 126 |
+
<!-- Categories -->
|
| 127 |
+
<h3 class="text-xl font-semibold mb-4">Browse Categories</h3>
|
| 128 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8">
|
| 129 |
+
<div class="category-card bg-white rounded-lg shadow overflow-hidden cursor-pointer transition hover:shadow-lg" onclick="filterByCategory('cables')">
|
| 130 |
+
<div class="h-2 bg-blue-500"></div>
|
| 131 |
+
<div class="p-4">
|
| 132 |
+
<div class="flex items-center space-x-3">
|
| 133 |
+
<div class="p-2 rounded-full bg-blue-100 text-blue-600">
|
| 134 |
+
<i class="fas fa-plug"></i>
|
| 135 |
+
</div>
|
| 136 |
+
<h4 class="font-semibold">Cables</h4>
|
| 137 |
+
</div>
|
| 138 |
+
<p class="text-gray-500 text-sm mt-2">Power cables, data cables, connectors</p>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
<div class="category-card bg-white rounded-lg shadow overflow-hidden cursor-pointer transition hover:shadow-lg" onclick="filterByCategory('components')">
|
| 142 |
+
<div class="h-2 bg-green-500"></div>
|
| 143 |
+
<div class="p-4">
|
| 144 |
+
<div class="flex items-center space-x-3">
|
| 145 |
+
<div class="p-2 rounded-full bg-green-100 text-green-600">
|
| 146 |
+
<i class="fas fa-microchip"></i>
|
| 147 |
+
</div>
|
| 148 |
+
<h4 class="font-semibold">Components</h4>
|
| 149 |
+
</div>
|
| 150 |
+
<p class="text-gray-500 text-sm mt-2">Resistors, capacitors, ICs, transistors</p>
|
| 151 |
+
</div>
|
| 152 |
+
</div>
|
| 153 |
+
<div class="category-card bg-white rounded-lg shadow overflow-hidden cursor-pointer transition hover:shadow-lg" onclick="filterByCategory('sensors')">
|
| 154 |
+
<div class="h-2 bg-purple-500"></div>
|
| 155 |
+
<div class="p-4">
|
| 156 |
+
<div class="flex items-center space-x-3">
|
| 157 |
+
<div class="p-2 rounded-full bg-purple-100 text-purple-600">
|
| 158 |
+
<i class="fas fa-sensor"></i>
|
| 159 |
+
</div>
|
| 160 |
+
<h4 class="font-semibold">Sensors</h4>
|
| 161 |
+
</div>
|
| 162 |
+
<p class="text-gray-500 text-sm mt-2">Temperature, motion, light, pressure sensors</p>
|
| 163 |
+
</div>
|
| 164 |
+
</div>
|
| 165 |
+
</div>
|
| 166 |
+
|
| 167 |
+
<!-- Recent Products -->
|
| 168 |
+
<h3 class="text-xl font-semibold mb-4">Recently Added Products</h3>
|
| 169 |
+
<div class="bg-white rounded-lg shadow overflow-hidden">
|
| 170 |
+
<div class="overflow-x-auto">
|
| 171 |
+
<table class="min-w-full divide-y divide-gray-200">
|
| 172 |
+
<thead class="bg-gray-50">
|
| 173 |
+
<tr>
|
| 174 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Product</th>
|
| 175 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Category</th>
|
| 176 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Quantity</th>
|
| 177 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Box #</th>
|
| 178 |
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
| 179 |
+
</tr>
|
| 180 |
+
</thead>
|
| 181 |
+
<tbody class="bg-white divide-y divide-gray-200" id="recentProductsTable">
|
| 182 |
+
<!-- Recent products will be inserted here by JavaScript -->
|
| 183 |
+
</tbody>
|
| 184 |
+
</table>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<!-- All Products View -->
|
| 190 |
+
<div id="all-products" class="view hidden">
|
| 191 |
+
<div class="flex justify-between items-center mb-8">
|
| 192 |
+
<h2 class="text-2xl font-bold gradient-text">All Products</h2>
|
| 193 |
+
<div class="flex space-x-2">
|
| 194 |
+
<div class="relative">
|
| 195 |
+
<input type="text" placeholder="Search products..." class="px-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" id="productSearch">
|
| 196 |
+
<button class="absolute right-3 top-2 text-gray-500 hover:text-indigo-600">
|
| 197 |
+
<i class="fas fa-search"></i>
|
| 198 |
+
</button>
|
| 199 |
+
</div>
|
| 200 |
+
<select id="productFilter" class="px-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
|
| 201 |
+
<option value="all">All Categories</option>
|
| 202 |
+
<option value="cables">Cables</option>
|
| 203 |
+
<option value="components">Components</option>
|
| 204 |
+
<option value="sensors">Sensors</option>
|
| 205 |
+
</select>
|
| 206 |
+
<select id="boxFilter" class="px-4 py-2 rounded-full border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
|
| 207 |
+
<option value="all">All Boxes</option>
|
| 208 |
+
<!-- Box options will be added by JavaScript -->
|
| 209 |
+
</select>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
+
|
| 213 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6" id="allProductsGrid">
|
| 214 |
+
<!-- All products will be inserted here by JavaScript -->
|
| 215 |
+
</div>
|
| 216 |
+
</div>
|
| 217 |
+
|
| 218 |
+
<!-- Add Product View -->
|
| 219 |
+
<div id="add-product" class="view hidden">
|
| 220 |
+
<h2 class="text-2xl font-bold gradient-text mb-8">Add New Product</h2>
|
| 221 |
+
|
| 222 |
+
<div class="bg-white rounded-lg shadow p-6 max-w-3xl mx-auto">
|
| 223 |
+
<form id="addProductForm">
|
| 224 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 225 |
+
<div>
|
| 226 |
+
<label for="productName" class="block text-sm font-medium text-gray-700 mb-1">Product Name*</label>
|
| 227 |
+
<input type="text" id="productName" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" required>
|
| 228 |
+
</div>
|
| 229 |
+
<div>
|
| 230 |
+
<label for="productCategory" class="block text-sm font-medium text-gray-700 mb-1">Category*</label>
|
| 231 |
+
<select id="productCategory" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" required>
|
| 232 |
+
<option value="">Select a category</option>
|
| 233 |
+
<option value="cables">Cables</option>
|
| 234 |
+
<option value="components">Components</option>
|
| 235 |
+
<option value="sensors">Sensors</option>
|
| 236 |
+
</select>
|
| 237 |
+
</div>
|
| 238 |
+
<div>
|
| 239 |
+
<label for="productQuantity" class="block text-sm font-medium text-gray-700 mb-1">Quantity*</label>
|
| 240 |
+
<input type="number" id="productQuantity" min="1" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" required>
|
| 241 |
+
</div>
|
| 242 |
+
<div>
|
| 243 |
+
<label for="productBox" class="block text-sm font-medium text-gray-700 mb-1">Box Number*</label>
|
| 244 |
+
<input type="text" id="productBox" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent" required>
|
| 245 |
+
</div>
|
| 246 |
+
<div class="md:col-span-2">
|
| 247 |
+
<label for="productDescription" class="block text-sm font-medium text-gray-700 mb-1">Description</label>
|
| 248 |
+
<textarea id="productDescription" rows="3" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></textarea>
|
| 249 |
+
</div>
|
| 250 |
+
<div>
|
| 251 |
+
<label for="productSupplier" class="block text-sm font-medium text-gray-700 mb-1">Supplier</label>
|
| 252 |
+
<input type="text" id="productSupplier" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
|
| 253 |
+
</div>
|
| 254 |
+
<div>
|
| 255 |
+
<label for="productPrice" class="block text-sm font-medium text-gray-700 mb-1">Unit Price ($)</label>
|
| 256 |
+
<input type="number" step="0.01" id="productPrice" class="w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-transparent">
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
|
| 260 |
+
<div class="mt-8 flex justify-end space-x-4">
|
| 261 |
+
<button type="reset" class="px-6 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-100 transition">Reset</button>
|
| 262 |
+
<button type="submit" class="px-6 py-2 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition">Add Product</button>
|
| 263 |
+
</div>
|
| 264 |
+
</form>
|
| 265 |
+
</div>
|
| 266 |
+
</div>
|
| 267 |
+
|
| 268 |
+
<!-- Boxes View -->
|
| 269 |
+
<div id="boxes" class="view hidden">
|
| 270 |
+
<h2 class="text-2xl font-bold gradient-text mb-8">Box Inventory</h2>
|
| 271 |
+
|
| 272 |
+
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6" id="boxesGrid">
|
| 273 |
+
<!-- Boxes will be inserted here by JavaScript -->
|
| 274 |
+
</div>
|
| 275 |
+
</div>
|
| 276 |
+
|
| 277 |
+
<!-- Product Detail Modal -->
|
| 278 |
+
<div id="productModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
|
| 279 |
+
<div class="bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-y-auto">
|
| 280 |
+
<div class="p-6">
|
| 281 |
+
<div class="flex justify-between items-start">
|
| 282 |
+
<h3 class="text-xl font-bold" id="modalProductName">Product Name</h3>
|
| 283 |
+
<button onclick="closeModal()" class="text-gray-500 hover:text-gray-700">
|
| 284 |
+
<i class="fas fa-times"></i>
|
| 285 |
+
</button>
|
| 286 |
+
</div>
|
| 287 |
+
|
| 288 |
+
<div class="mt-6 grid grid-cols-1 md:grid-cols-2 gap-6">
|
| 289 |
+
<div>
|
| 290 |
+
<div class="h-48 rounded-lg mb-4" id="modalProductGradient"></div>
|
| 291 |
+
<div class="flex space-x-4">
|
| 292 |
+
<div>
|
| 293 |
+
<p class="text-sm text-gray-500">Category</p>
|
| 294 |
+
<p class="font-medium" id="modalProductCategory">Cables</p>
|
| 295 |
+
</div>
|
| 296 |
+
<div>
|
| 297 |
+
<p class="text-sm text-gray-500">Box #</p>
|
| 298 |
+
<p class="font-medium" id="modalProductBox">B-12</p>
|
| 299 |
+
</div>
|
| 300 |
+
<div>
|
| 301 |
+
<p class="text-sm text-gray-500">Quantity</p>
|
| 302 |
+
<p class="font-medium" id="modalProductQuantity">25</p>
|
| 303 |
+
</div>
|
| 304 |
+
</div>
|
| 305 |
+
</div>
|
| 306 |
+
<div>
|
| 307 |
+
<h4 class="font-semibold mb-2">Description</h4>
|
| 308 |
+
<p class="text-gray-700 mb-4" id="modalProductDescription">No description provided.</p>
|
| 309 |
+
|
| 310 |
+
<div class="grid grid-cols-2 gap-4 mb-4">
|
| 311 |
+
<div>
|
| 312 |
+
<p class="text-sm text-gray-500">Supplier</p>
|
| 313 |
+
<p class="font-medium" id="modalProductSupplier">-</p>
|
| 314 |
+
</div>
|
| 315 |
+
<div>
|
| 316 |
+
<p class="text-sm text-gray-500">Unit Price</p>
|
| 317 |
+
<p class="font-medium" id="modalProductPrice">-</p>
|
| 318 |
+
</div>
|
| 319 |
+
<div>
|
| 320 |
+
<p class="text-sm text-gray-500">Added On</p>
|
| 321 |
+
<p class="font-medium" id="modalProductDate">-</p>
|
| 322 |
+
</div>
|
| 323 |
+
</div>
|
| 324 |
+
</div>
|
| 325 |
+
</div>
|
| 326 |
+
|
| 327 |
+
<div class="mt-6 pt-6 border-t border-gray-200 flex justify-between">
|
| 328 |
+
<div class="flex space-x-2">
|
| 329 |
+
<button onclick="decrementQuantity()" class="px-4 py-2 bg-red-100 text-red-600 rounded-lg hover:bg-red-200 transition">
|
| 330 |
+
<i class="fas fa-minus"></i> Decrease
|
| 331 |
+
</button>
|
| 332 |
+
<button onclick="incrementQuantity()" class="px-4 py-2 bg-green-100 text-green-600 rounded-lg hover:bg-green-200 transition">
|
| 333 |
+
<i class="fas fa-plus"></i> Increase
|
| 334 |
+
</button>
|
| 335 |
+
</div>
|
| 336 |
+
<div class="flex space-x-2">
|
| 337 |
+
<button onclick="showEditForm()" class="px-4 py-2 bg-blue-100 text-blue-600 rounded-lg hover:bg-blue-200 transition">
|
| 338 |
+
<i class="fas fa-edit"></i> Edit
|
| 339 |
+
</button>
|
| 340 |
+
<button onclick="deleteProduct()" class="px-4 py-2 bg-red-100 text-red-600 rounded-lg hover:bg-red-200 transition">
|
| 341 |
+
<i class="fas fa-trash"></i> Delete
|
| 342 |
+
</button>
|
| 343 |
+
</div>
|
| 344 |
+
</div>
|
| 345 |
+
|
| 346 |
+
<!-- Edit Form (hidden by default) -->
|
| 347 |
+
<div id="editForm" class="mt-6 pt-6 border-t border-gray-200 hidden">
|
| 348 |
+
<h4 class="font-semibold mb-4">Edit Product</h4>
|
| 349 |
+
<form id="editProductForm">
|
| 350 |
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
| 351 |
+
<div>
|
| 352 |
+
<label class="block text-sm text-gray-500 mb-1">Product Name</label>
|
| 353 |
+
<input type="text" id="editProductName" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 354 |
+
</div>
|
| 355 |
+
<div>
|
| 356 |
+
<label class="block text-sm text-gray-500 mb-1">Category</label>
|
| 357 |
+
<select id="editProductCategory" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 358 |
+
<option value="cables">Cables</option>
|
| 359 |
+
<option value="components">Components</option>
|
| 360 |
+
<option value="sensors">Sensors</option>
|
| 361 |
+
</select>
|
| 362 |
+
</div>
|
| 363 |
+
<div>
|
| 364 |
+
<label class="block text-sm text-gray-500 mb-1">Quantity</label>
|
| 365 |
+
<input type="number" id="editProductQuantity" min="1" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 366 |
+
</div>
|
| 367 |
+
<div>
|
| 368 |
+
<label class="block text-sm text-gray-500 mb-1">Box Number</label>
|
| 369 |
+
<input type="text" id="editProductBox" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 370 |
+
</div>
|
| 371 |
+
<div class="md:col-span-2">
|
| 372 |
+
<label class="block text-sm text-gray-500 mb-1">Description</label>
|
| 373 |
+
<textarea id="editProductDescription" rows="2" class="w-full px-3 py-2 rounded-lg border border-gray-300"></textarea>
|
| 374 |
+
</div>
|
| 375 |
+
<div>
|
| 376 |
+
<label class="block text-sm text-gray-500 mb-1">Supplier</label>
|
| 377 |
+
<input type="text" id="editProductSupplier" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 378 |
+
</div>
|
| 379 |
+
<div>
|
| 380 |
+
<label class="block text-sm text-gray-500 mb-1">Unit Price ($)</label>
|
| 381 |
+
<input type="number" step="0.01" id="editProductPrice" class="w-full px-3 py-2 rounded-lg border border-gray-300">
|
| 382 |
+
</div>
|
| 383 |
+
</div>
|
| 384 |
+
<div class="mt-4 flex justify-end space-x-2">
|
| 385 |
+
<button type="button" onclick="hideEditForm()" class="px-4 py-2 rounded-lg border border-gray-300 text-gray-700 hover:bg-gray-100 transition">Cancel</button>
|
| 386 |
+
<button type="submit" class="px-4 py-2 rounded-lg bg-indigo-600 text-white hover:bg-indigo-700 transition">Save Changes</button>
|
| 387 |
+
</div>
|
| 388 |
+
</form>
|
| 389 |
+
</div>
|
| 390 |
+
</div>
|
| 391 |
+
</div>
|
| 392 |
+
</div>
|
| 393 |
+
</main>
|
| 394 |
+
|
| 395 |
+
<!-- Footer -->
|
| 396 |
+
<footer class="bg-gray-800 text-white py-8">
|
| 397 |
+
<div class="container mx-auto px-4">
|
| 398 |
+
<div class="flex flex-col md:flex-row justify-between items-center">
|
| 399 |
+
<div class="mb-4 md:mb-0">
|
| 400 |
+
<div class="flex items-center space-x-2">
|
| 401 |
+
<i class="fas fa-bolt text-xl"></i>
|
| 402 |
+
<h2 class="text-xl font-bold">ElectroCatalog</h2>
|
| 403 |
+
</div>
|
| 404 |
+
<p class="text-gray-400 mt-2">Your electrical and electronics inventory solution</p>
|
| 405 |
+
</div>
|
| 406 |
+
<div class="flex space-x-6">
|
| 407 |
+
<a href="#" class="hover:text-indigo-400 transition">About</a>
|
| 408 |
+
<a href="#" class="hover:text-indigo-400 transition">Contact</a>
|
| 409 |
+
<a href="#" class="hover:text-indigo-400 transition">Privacy</a>
|
| 410 |
+
<a href="#" class="hover:text-indigo-400 transition">Terms</a>
|
| 411 |
+
</div>
|
| 412 |
+
</div>
|
| 413 |
+
<div class="mt-8 pt-6 border-t border-gray-700 text-center text-gray-400 text-sm">
|
| 414 |
+
<p>© 2023 ElectroCatalog. All rights reserved.</p>
|
| 415 |
+
</div>
|
| 416 |
+
</div>
|
| 417 |
+
</footer>
|
| 418 |
+
|
| 419 |
+
<script>
|
| 420 |
+
// Database simulation using localStorage
|
| 421 |
+
const dbName = 'electroCatalogDB';
|
| 422 |
+
let currentProductId = null;
|
| 423 |
+
|
| 424 |
+
// Initialize database if not exists
|
| 425 |
+
function initDB() {
|
| 426 |
+
if (!localStorage.getItem(dbName)) {
|
| 427 |
+
const initialData = {
|
| 428 |
+
products: [
|
| 429 |
+
{
|
| 430 |
+
id: 1,
|
| 431 |
+
name: "HDMI Cable 2.0",
|
| 432 |
+
category: "cables",
|
| 433 |
+
quantity: 15,
|
| 434 |
+
box: "B-12",
|
| 435 |
+
description: "High speed HDMI cable with Ethernet, 4K@60Hz support",
|
| 436 |
+
supplier: "CableTech Inc.",
|
| 437 |
+
price: 8.99,
|
| 438 |
+
date: "2023-05-15",
|
| 439 |
+
gradient: "linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
id: 2,
|
| 443 |
+
name: "Arduino Uno R3",
|
| 444 |
+
category: "components",
|
| 445 |
+
quantity: 8,
|
| 446 |
+
box: "B-05",
|
| 447 |
+
description: "Microcontroller board based on the ATmega328P",
|
| 448 |
+
supplier: "Arduino LLC",
|
| 449 |
+
price: 22.50,
|
| 450 |
+
date: "2023-06-02",
|
| 451 |
+
gradient: "linear-gradient(135deg, #f093fb 0%, #f5576c 100%)"
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
id: 3,
|
| 455 |
+
name: "DHT22 Sensor",
|
| 456 |
+
category: "sensors",
|
| 457 |
+
quantity: 12,
|
| 458 |
+
box: "B-08",
|
| 459 |
+
description: "Digital temperature and humidity sensor",
|
| 460 |
+
supplier: "SensorWorld",
|
| 461 |
+
price: 9.95,
|
| 462 |
+
date: "2023-06-10",
|
| 463 |
+
gradient: "linear-gradient(135deg, #5ee7df 0%, #b490ca 100%)"
|
| 464 |
+
}
|
| 465 |
+
],
|
| 466 |
+
nextId: 4
|
| 467 |
+
};
|
| 468 |
+
localStorage.setItem(dbName, JSON.stringify(initialData));
|
| 469 |
+
}
|
| 470 |
+
}
|
| 471 |
+
|
| 472 |
+
// Get all products
|
| 473 |
+
function getAllProducts() {
|
| 474 |
+
const db = JSON.parse(localStorage.getItem(dbName));
|
| 475 |
+
return db.products;
|
| 476 |
+
}
|
| 477 |
+
|
| 478 |
+
// Get product by ID
|
| 479 |
+
function getProductById(id) {
|
| 480 |
+
const db = JSON.parse(localStorage.getItem(dbName));
|
| 481 |
+
return db.products.find(product => product.id === id);
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
// Add new product
|
| 485 |
+
function addProduct(product) {
|
| 486 |
+
const db = JSON.parse(localStorage.getItem(dbName));
|
| 487 |
+
const newProduct = {
|
| 488 |
+
id: db.nextId++,
|
| 489 |
+
...product,
|
| 490 |
+
date: new Date().toISOString().split('T')[0],
|
| 491 |
+
gradient: generateGradient()
|
| 492 |
+
};
|
| 493 |
+
db.products.push(newProduct);
|
| 494 |
+
localStorage.setItem(dbName, JSON.stringify(db));
|
| 495 |
+
return newProduct;
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
// Update product
|
| 499 |
+
function updateProduct(id, updatedData) {
|
| 500 |
+
const db = JSON.parse(localStorage.getItem(dbName));
|
| 501 |
+
const index = db.products.findIndex(product => product.id === id);
|
| 502 |
+
if (index !== -1) {
|
| 503 |
+
db.products[index] = { ...db.products[index], ...updatedData };
|
| 504 |
+
localStorage.setItem(dbName, JSON.stringify(db));
|
| 505 |
+
return true;
|
| 506 |
+
}
|
| 507 |
+
return false;
|
| 508 |
+
}
|
| 509 |
+
|
| 510 |
+
// Delete product
|
| 511 |
+
function deleteProductById(id) {
|
| 512 |
+
const db = JSON.parse(localStorage.getItem(dbName));
|
| 513 |
+
const index = db.products.findIndex(product => product.id === id);
|
| 514 |
+
if (index !== -1) {
|
| 515 |
+
db.products.splice(index, 1);
|
| 516 |
+
localStorage.setItem(dbName, JSON.stringify(db));
|
| 517 |
+
return true;
|
| 518 |
+
}
|
| 519 |
+
return false;
|
| 520 |
+
}
|
| 521 |
+
|
| 522 |
+
// Generate random gradient for product card
|
| 523 |
+
function generateGradient() {
|
| 524 |
+
const gradients = [
|
| 525 |
+
"linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
|
| 526 |
+
"linear-gradient(135deg, #f093fb 0%, #f5576c 100%)",
|
| 527 |
+
"linear-gradient(135deg, #5ee7df 0%, #b490ca 100%)",
|
| 528 |
+
"linear-gradient(135deg, #f6d365 0%, #fda085 100%)",
|
| 529 |
+
"linear-gradient(135deg, #c471f5 0%, #fa71cd 100%)",
|
| 530 |
+
"linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)"
|
| 531 |
+
];
|
| 532 |
+
return gradients[Math.floor(Math.random() * gradients.length)];
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
// Get unique box numbers
|
| 536 |
+
function getUniqueBoxes() {
|
| 537 |
+
const products = getAllProducts();
|
| 538 |
+
const boxes = [...new Set(products.map(product => product.box))];
|
| 539 |
+
return boxes.sort();
|
| 540 |
+
}
|
| 541 |
+
|
| 542 |
+
// Filter products by category
|
| 543 |
+
function filterByCategory(category) {
|
| 544 |
+
showView('all-products');
|
| 545 |
+
document.getElementById('productFilter').value = category;
|
| 546 |
+
renderAllProducts();
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
// Show view and hide others
|
| 550 |
+
function showView(viewId) {
|
| 551 |
+
document.querySelectorAll('.view').forEach(view => {
|
| 552 |
+
view.classList.add('hidden');
|
| 553 |
+
});
|
| 554 |
+
document.getElementById(viewId).classList.remove('hidden');
|
| 555 |
+
hideMobileMenu();
|
| 556 |
+
|
| 557 |
+
// Update active link in navigation
|
| 558 |
+
document.querySelectorAll('nav a').forEach(link => {
|
| 559 |
+
link.classList.remove('font-semibold', 'border-b-2', 'border-white');
|
| 560 |
+
});
|
| 561 |
+
|
| 562 |
+
// Update UI based on view
|
| 563 |
+
switch(viewId) {
|
| 564 |
+
case 'dashboard':
|
| 565 |
+
document.querySelector('nav a:nth-child(1)').classList.add('font-semibold', 'border-b-2', 'border-white');
|
| 566 |
+
updateDashboardStats();
|
| 567 |
+
renderRecentProducts();
|
| 568 |
+
break;
|
| 569 |
+
case 'all-products':
|
| 570 |
+
document.querySelector('nav a:nth-child(2)').classList.add('font-semibold', 'border-b-2', 'border-white');
|
| 571 |
+
renderAllProducts();
|
| 572 |
+
updateBoxFilterOptions();
|
| 573 |
+
break;
|
| 574 |
+
case 'add-product':
|
| 575 |
+
document.querySelector('nav a:nth-child(3)').classList.add('font-semibold', 'border-b-2', 'border-white');
|
| 576 |
+
break;
|
| 577 |
+
case 'boxes':
|
| 578 |
+
document.querySelector('nav a:nth-child(4)').classList.add('font-semibold', 'border-b-2', 'border-white');
|
| 579 |
+
renderBoxesView();
|
| 580 |
+
break;
|
| 581 |
+
}
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
// Toggle mobile menu
|
| 585 |
+
function toggleMobileMenu() {
|
| 586 |
+
const menu = document.getElementById('mobileMenu');
|
| 587 |
+
menu.classList.toggle('hidden');
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
// Hide mobile menu
|
| 591 |
+
function hideMobileMenu() {
|
| 592 |
+
document.getElementById('mobileMenu').classList.add('hidden');
|
| 593 |
+
}
|
| 594 |
+
|
| 595 |
+
// Update dashboard statistics
|
| 596 |
+
function updateDashboardStats() {
|
| 597 |
+
const products = getAllProducts();
|
| 598 |
+
const categories = new Set(products.map(product => product.category));
|
| 599 |
+
const boxes = new Set(products.map(product => product.box));
|
| 600 |
+
|
| 601 |
+
document.getElementById('totalProducts').textContent = products.length;
|
| 602 |
+
document.getElementById('totalCategories').textContent = categories.size;
|
| 603 |
+
document.getElementById('totalBoxes').textContent = boxes.size;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
// Render recent products table
|
| 607 |
+
function renderRecentProducts() {
|
| 608 |
+
const products = getAllProducts().slice(-5).reverse();
|
| 609 |
+
const tableBody = document.getElementById('recentProductsTable');
|
| 610 |
+
tableBody.innerHTML = '';
|
| 611 |
+
|
| 612 |
+
if (products.length === 0) {
|
| 613 |
+
tableBody.innerHTML = '<tr><td colspan="5" class="px-6 py-4 text-center text-gray-500">No products found</td></tr>';
|
| 614 |
+
return;
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
products.forEach(product => {
|
| 618 |
+
const row = document.createElement('tr');
|
| 619 |
+
row.className = 'hover:bg-gray-50';
|
| 620 |
+
row.innerHTML = `
|
| 621 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 622 |
+
<div class="flex items-center">
|
| 623 |
+
<div class="flex-shrink-0 h-10 w-10 rounded" style="background: ${product.gradient}"></div>
|
| 624 |
+
<div class="ml-4">
|
| 625 |
+
<div class="text-sm font-medium text-gray-900">${product.name}</div>
|
| 626 |
+
</div>
|
| 627 |
+
</div>
|
| 628 |
+
</td>
|
| 629 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
| 630 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-${getCategoryColor(product.category)}-100 text-${getCategoryColor(product.category)}-800 capitalize">
|
| 631 |
+
${product.category}
|
| 632 |
+
</span>
|
| 633 |
+
</td>
|
| 634 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${product.quantity}</td>
|
| 635 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${product.box}</td>
|
| 636 |
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
| 637 |
+
<button onclick="openProductModal(${product.id})" class="text-indigo-600 hover:text-indigo-900 mr-3">View</button>
|
| 638 |
+
<button onclick="editProduct(${product.id})" class="text-blue-600 hover:text-blue-900">Edit</button>
|
| 639 |
+
</td>
|
| 640 |
+
`;
|
| 641 |
+
tableBody.appendChild(row);
|
| 642 |
+
});
|
| 643 |
+
}
|
| 644 |
+
|
| 645 |
+
// Render all products grid
|
| 646 |
+
function renderAllProducts() {
|
| 647 |
+
const searchTerm = document.getElementById('productSearch').value.toLowerCase();
|
| 648 |
+
const categoryFilter = document.getElementById('productFilter').value;
|
| 649 |
+
const boxFilter = document.getElementById('boxFilter').value;
|
| 650 |
+
|
| 651 |
+
const products = getAllProducts().filter(product => {
|
| 652 |
+
const matchesSearch = product.name.toLowerCase().includes(searchTerm) ||
|
| 653 |
+
(product.description && product.description.toLowerCase().includes(searchTerm));
|
| 654 |
+
const matchesCategory = categoryFilter === 'all' || product.category === categoryFilter;
|
| 655 |
+
const matchesBox = boxFilter === 'all' || product.box === boxFilter;
|
| 656 |
+
|
| 657 |
+
return matchesSearch && matchesCategory && matchesBox;
|
| 658 |
+
});
|
| 659 |
+
|
| 660 |
+
const productsGrid = document.getElementById('allProductsGrid');
|
| 661 |
+
productsGrid.innerHTML = '';
|
| 662 |
+
|
| 663 |
+
if (products.length === 0) {
|
| 664 |
+
productsGrid.innerHTML = '<div class="col-span-full text-center py-10 text-gray-500">No products match your criteria</div>';
|
| 665 |
+
return;
|
| 666 |
+
}
|
| 667 |
+
|
| 668 |
+
products.forEach(product => {
|
| 669 |
+
const card = document.createElement('div');
|
| 670 |
+
card.className = 'product-card bg-white rounded-lg shadow overflow-hidden';
|
| 671 |
+
card.innerHTML = `
|
| 672 |
+
<div class="h-32" style="background: ${product.gradient}"></div>
|
| 673 |
+
<div class="p-4">
|
| 674 |
+
<h3 class="font-semibold text-lg mb-1 truncate">${product.name}</h3>
|
| 675 |
+
<div class="flex justify-between items-center mb-2">
|
| 676 |
+
<span class="text-xs px-2 py-1 rounded-full bg-${getCategoryColor(product.category)}-100 text-${getCategoryColor(product.category)}-800 capitalize">${product.category}</span>
|
| 677 |
+
<span class="text-sm font-medium">Qty: ${product.quantity}</span>
|
| 678 |
+
</div>
|
| 679 |
+
<div class="flex justify-between items-center text-sm text-gray-600">
|
| 680 |
+
<span>Box: ${product.box}</span>
|
| 681 |
+
<button onclick="openProductModal(${product.id})" class="text-indigo-600 hover:text-indigo-800 font-medium">Details</button>
|
| 682 |
+
</div>
|
| 683 |
+
</div>
|
| 684 |
+
`;
|
| 685 |
+
productsGrid.appendChild(card);
|
| 686 |
+
});
|
| 687 |
+
}
|
| 688 |
+
|
| 689 |
+
// Render boxes view
|
| 690 |
+
function renderBoxesView() {
|
| 691 |
+
const boxes = getUniqueBoxes();
|
| 692 |
+
const products = getAllProducts();
|
| 693 |
+
const boxesGrid = document.getElementById('boxesGrid');
|
| 694 |
+
boxesGrid.innerHTML = '';
|
| 695 |
+
|
| 696 |
+
if (boxes.length === 0) {
|
| 697 |
+
boxesGrid.innerHTML = '<div class="col-span-full text-center py-10 text-gray-500">No boxes found</div>';
|
| 698 |
+
return;
|
| 699 |
+
}
|
| 700 |
+
|
| 701 |
+
boxes.forEach(box => {
|
| 702 |
+
const boxProducts = products.filter(product => product.box === box);
|
| 703 |
+
const boxTotalItems = boxProducts.reduce((sum, product) => sum + product.quantity, 0);
|
| 704 |
+
const boxCategories = [...new Set(boxProducts.map(product => product.category))];
|
| 705 |
+
|
| 706 |
+
const boxCard = document.createElement('div');
|
| 707 |
+
boxCard.className = 'product-card bg-white rounded-lg shadow overflow-hidden';
|
| 708 |
+
boxCard.innerHTML = `
|
| 709 |
+
<div class="h-32" style="background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"></div>
|
| 710 |
+
<div class="p-4">
|
| 711 |
+
<h3 class="font-semibold text-lg mb-1">Box ${box}</h3>
|
| 712 |
+
<div class="flex justify-between items-center mb-2">
|
| 713 |
+
<span class="text-sm text-gray-600">${boxTotalItems} items</span>
|
| 714 |
+
<span class="text-sm text-gray-600">${boxProducts.length} products</span>
|
| 715 |
+
</div>
|
| 716 |
+
<div class="mb-3">
|
| 717 |
+
<p class="text-sm text-gray-600 mb-1">Categories:</p>
|
| 718 |
+
<div class="flex flex-wrap gap-1">
|
| 719 |
+
${boxCategories.map(cat => `<span class="text-xs px-2 py-1 rounded-full bg-${getCategoryColor(cat)}-100 text-${getCategoryColor(cat)}-800 capitalize">${cat}</span>`).join('')}
|
| 720 |
+
</div>
|
| 721 |
+
</div>
|
| 722 |
+
<button onclick="showBoxContents('${box}')" class="w-full py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition">View Contents</button>
|
| 723 |
+
</div>
|
| 724 |
+
`;
|
| 725 |
+
boxesGrid.appendChild(boxCard);
|
| 726 |
+
});
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
// Show box contents
|
| 730 |
+
function showBoxContents(boxNumber) {
|
| 731 |
+
const products = getAllProducts().filter(product => product.box === boxNumber);
|
| 732 |
+
showView('all-products');
|
| 733 |
+
document.getElementById('boxFilter').value = boxNumber;
|
| 734 |
+
renderAllProducts();
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
// Update box filter options
|
| 738 |
+
function updateBoxFilterOptions() {
|
| 739 |
+
const boxFilter = document.getElementById('boxFilter');
|
| 740 |
+
const currentValue = boxFilter.value;
|
| 741 |
+
|
| 742 |
+
boxFilter.innerHTML = '<option value="all">All Boxes</option>';
|
| 743 |
+
const boxes = getUniqueBoxes();
|
| 744 |
+
|
| 745 |
+
boxes.forEach(box => {
|
| 746 |
+
const option = document.createElement('option');
|
| 747 |
+
option.value = box;
|
| 748 |
+
option.textContent = box;
|
| 749 |
+
boxFilter.appendChild(option);
|
| 750 |
+
});
|
| 751 |
+
|
| 752 |
+
// Restore previous selection if still valid
|
| 753 |
+
if (boxes.includes(currentValue)) {
|
| 754 |
+
boxFilter.value = currentValue;
|
| 755 |
+
}
|
| 756 |
+
}
|
| 757 |
+
|
| 758 |
+
// Get category color for styling
|
| 759 |
+
function getCategoryColor(category) {
|
| 760 |
+
switch(category) {
|
| 761 |
+
case 'cables': return 'blue';
|
| 762 |
+
case 'components': return 'green';
|
| 763 |
+
case 'sensors': return 'purple';
|
| 764 |
+
default: return 'gray';
|
| 765 |
+
}
|
| 766 |
+
}
|
| 767 |
+
|
| 768 |
+
// Open product modal
|
| 769 |
+
function openProductModal(id) {
|
| 770 |
+
const product = getProductById(id);
|
| 771 |
+
if (!product) return;
|
| 772 |
+
|
| 773 |
+
currentProductId = id;
|
| 774 |
+
|
| 775 |
+
document.getElementById('modalProductName').textContent = product.name;
|
| 776 |
+
document.getElementById('modalProductCategory').textContent = product.category;
|
| 777 |
+
document.getElementById('modalProductBox').textContent = product.box;
|
| 778 |
+
document.getElementById('modalProductQuantity').textContent = product.quantity;
|
| 779 |
+
document.getElementById('modalProductDescription').textContent = product.description || 'No description provided.';
|
| 780 |
+
document.getElementById('modalProductSupplier').textContent = product.supplier || '-';
|
| 781 |
+
document.getElementById('modalProductPrice').textContent = product.price ? `$${product.price.toFixed(2)}` : '-';
|
| 782 |
+
document.getElementById('modalProductDate').textContent = product.date;
|
| 783 |
+
|
| 784 |
+
const gradientElement = document.getElementById('modalProductGradient');
|
| 785 |
+
gradientElement.style.background = product.gradient;
|
| 786 |
+
|
| 787 |
+
// Hide edit form if visible
|
| 788 |
+
document.getElementById('editForm').classList.add('hidden');
|
| 789 |
+
|
| 790 |
+
// Show modal
|
| 791 |
+
document.getElementById('productModal').classList.remove('hidden');
|
| 792 |
+
}
|
| 793 |
+
|
| 794 |
+
// Close modal
|
| 795 |
+
function closeModal() {
|
| 796 |
+
document.getElementById('productModal').classList.add('hidden');
|
| 797 |
+
currentProductId = null;
|
| 798 |
+
}
|
| 799 |
+
|
| 800 |
+
// Show edit form in modal
|
| 801 |
+
function showEditForm() {
|
| 802 |
+
const product = getProductById(currentProductId);
|
| 803 |
+
if (!product) return;
|
| 804 |
+
|
| 805 |
+
document.getElementById('editProductName').value = product.name;
|
| 806 |
+
document.getElementById('editProductCategory').value = product.category;
|
| 807 |
+
document.getElementById('editProductQuantity').value = product.quantity;
|
| 808 |
+
document.getElementById('editProductBox').value = product.box;
|
| 809 |
+
document.getElementById('editProductDescription').value = product.description || '';
|
| 810 |
+
document.getElementById('editProductSupplier').value = product.supplier || '';
|
| 811 |
+
document.getElementById('editProductPrice').value = product.price || '';
|
| 812 |
+
|
| 813 |
+
document.getElementById('editForm').classList.remove('hidden');
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
// Hide edit form in modal
|
| 817 |
+
function hideEditForm() {
|
| 818 |
+
document.getElementById('editForm').classList.add('hidden');
|
| 819 |
+
}
|
| 820 |
+
|
| 821 |
+
// Increment product quantity
|
| 822 |
+
function incrementQuantity() {
|
| 823 |
+
const product = getProductById(currentProductId);
|
| 824 |
+
if (!product) return;
|
| 825 |
+
|
| 826 |
+
const newQuantity = product.quantity + 1;
|
| 827 |
+
updateProduct(currentProductId, { quantity: newQuantity });
|
| 828 |
+
document.getElementById('modalProductQuantity').textContent = newQuantity;
|
| 829 |
+
|
| 830 |
+
// Update UI
|
| 831 |
+
renderRecentProducts();
|
| 832 |
+
renderAllProducts();
|
| 833 |
+
updateDashboardStats();
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
// Decrement product quantity
|
| 837 |
+
function decrementQuantity() {
|
| 838 |
+
const product = getProductById(currentProductId);
|
| 839 |
+
if (!product) return;
|
| 840 |
+
|
| 841 |
+
const newQuantity = Math.max(0, product.quantity - 1);
|
| 842 |
+
updateProduct(currentProductId, { quantity: newQuantity });
|
| 843 |
+
document.getElementById('modalProductQuantity').textContent = newQuantity;
|
| 844 |
+
|
| 845 |
+
// Update UI
|
| 846 |
+
renderRecentProducts();
|
| 847 |
+
renderAllProducts();
|
| 848 |
+
updateDashboardStats();
|
| 849 |
+
}
|
| 850 |
+
|
| 851 |
+
// Delete current product
|
| 852 |
+
function deleteProduct() {
|
| 853 |
+
if (!confirm('Are you sure you want to delete this product?')) return;
|
| 854 |
+
|
| 855 |
+
if (deleteProductById(currentProductId)) {
|
| 856 |
+
closeModal();
|
| 857 |
+
|
| 858 |
+
// Update UI
|
| 859 |
+
renderRecentProducts();
|
| 860 |
+
renderAllProducts();
|
| 861 |
+
updateDashboardStats();
|
| 862 |
+
|
| 863 |
+
// Show success message
|
| 864 |
+
alert('Product deleted successfully!');
|
| 865 |
+
}
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
// Initialize the app
|
| 869 |
+
function initApp() {
|
| 870 |
+
initDB();
|
| 871 |
+
showView('dashboard');
|
| 872 |
+
|
| 873 |
+
// Event listeners
|
| 874 |
+
document.getElementById('addProductForm').addEventListener('submit', function(e) {
|
| 875 |
+
e.preventDefault();
|
| 876 |
+
|
| 877 |
+
const product = {
|
| 878 |
+
name: document.getElementById('productName').value,
|
| 879 |
+
category: document.getElementById('productCategory').value,
|
| 880 |
+
quantity: parseInt(document.getElementById('productQuantity').value),
|
| 881 |
+
box: document.getElementById('productBox').value,
|
| 882 |
+
description: document.getElementById('productDescription').value,
|
| 883 |
+
supplier: document.getElementById('productSupplier').value,
|
| 884 |
+
price: parseFloat(document.getElementById('productPrice').value) || null
|
| 885 |
+
};
|
| 886 |
+
|
| 887 |
+
addProduct(product);
|
| 888 |
+
this.reset();
|
| 889 |
+
|
| 890 |
+
// Update UI
|
| 891 |
+
renderRecentProducts();
|
| 892 |
+
renderAllProducts();
|
| 893 |
+
updateDashboardStats();
|
| 894 |
+
|
| 895 |
+
// Show success message
|
| 896 |
+
alert('Product added successfully!');
|
| 897 |
+
});
|
| 898 |
+
|
| 899 |
+
document.getElementById('editProductForm').addEventListener('submit', function(e) {
|
| 900 |
+
e.preventDefault();
|
| 901 |
+
|
| 902 |
+
const updatedData = {
|
| 903 |
+
name: document.getElementById('editProductName').value,
|
| 904 |
+
category: document.getElementById('editProductCategory').value,
|
| 905 |
+
quantity: parseInt(document.getElementById('editProductQuantity').value),
|
| 906 |
+
box: document.getElementById('editProductBox').value,
|
| 907 |
+
description: document.getElementById('editProductDescription').value,
|
| 908 |
+
supplier: document.getElementById('editProductSupplier').value,
|
| 909 |
+
price: parseFloat(document.getElementById('editProductPrice').value) || null
|
| 910 |
+
};
|
| 911 |
+
|
| 912 |
+
if (updateProduct(currentProductId, updatedData)) {
|
| 913 |
+
// Update modal with new data
|
| 914 |
+
openProductModal(currentProductId);
|
| 915 |
+
|
| 916 |
+
// Update UI
|
| 917 |
+
renderRecentProducts();
|
| 918 |
+
renderAllProducts();
|
| 919 |
+
updateDashboardStats();
|
| 920 |
+
|
| 921 |
+
// Show success message
|
| 922 |
+
alert('Product updated successfully!');
|
| 923 |
+
}
|
| 924 |
+
});
|
| 925 |
+
|
| 926 |
+
// Search and filter event listeners
|
| 927 |
+
document.getElementById('productSearch').addEventListener('input', renderAllProducts);
|
| 928 |
+
document.getElementById('productFilter').addEventListener('change', renderAllProducts);
|
| 929 |
+
document.getElementById('boxFilter').addEventListener('change', renderAllProducts);
|
| 930 |
+
|
| 931 |
+
// Quick search from dashboard
|
| 932 |
+
document.getElementById('quickSearch').addEventListener('keyup', function(e) {
|
| 933 |
+
if (e.key === 'Enter') {
|
| 934 |
+
showView('all-products');
|
| 935 |
+
document.getElementById('productSearch').value = this.value;
|
| 936 |
+
renderAllProducts();
|
| 937 |
+
this.value = '';
|
| 938 |
+
}
|
| 939 |
+
});
|
| 940 |
+
}
|
| 941 |
+
|
| 942 |
+
// Initialize the app when DOM is loaded
|
| 943 |
+
document.addEventListener('DOMContentLoaded', initApp);
|
| 944 |
+
</script>
|
| 945 |
+
<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=mukoshi/catalog" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 946 |
+
</html>
|