Spaces:
Running
Running
Update index.html
Browse files- index.html +148 -24
index.html
CHANGED
@@ -183,7 +183,7 @@
|
|
183 |
<div class="flex items-center justify-between">
|
184 |
<div>
|
185 |
<p class="text-gray-500">Total Orders</p>
|
186 |
-
<h3 class="text-2xl font-semibold">
|
187 |
</div>
|
188 |
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
|
189 |
<i class="fas fa-shopping-cart"></i>
|
@@ -195,7 +195,7 @@
|
|
195 |
<div class="flex items-center justify-between">
|
196 |
<div>
|
197 |
<p class="text-gray-500">Revenue</p>
|
198 |
-
<h3 class="text-2xl font-semibold">$
|
199 |
</div>
|
200 |
<div class="p-3 rounded-full bg-green-100 text-green-600">
|
201 |
<i class="fas fa-dollar-sign"></i>
|
@@ -207,7 +207,7 @@
|
|
207 |
<div class="flex items-center justify-between">
|
208 |
<div>
|
209 |
<p class="text-gray-500">Customers</p>
|
210 |
-
<h3 class="text-2xl font-semibold">
|
211 |
</div>
|
212 |
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
|
213 |
<i class="fas fa-users"></i>
|
@@ -222,7 +222,7 @@
|
|
222 |
<h3 class="font-medium">Recent Orders</h3>
|
223 |
</div>
|
224 |
<div class="overflow-x-auto">
|
225 |
-
<table class="min-w-full divide-y divide-gray-200">
|
226 |
<thead class="bg-gray-50">
|
227 |
<tr>
|
228 |
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Order ID</th>
|
@@ -233,8 +233,8 @@
|
|
233 |
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
234 |
</tr>
|
235 |
</thead>
|
236 |
-
<tbody class="bg-white divide-y divide-gray-200">
|
237 |
-
<tr>
|
238 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1001</td>
|
239 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">John Smith</td>
|
240 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-15</td>
|
@@ -247,7 +247,7 @@
|
|
247 |
<button class="text-red-600 hover:text-red-900" onclick="deleteOrder('ORD-1001')">Delete</button>
|
248 |
</td>
|
249 |
</tr>
|
250 |
-
<tr>
|
251 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1002</td>
|
252 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Sarah Johnson</td>
|
253 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-14</td>
|
@@ -260,7 +260,7 @@
|
|
260 |
<button class="text-red-600 hover:text-red-900" onclick="deleteOrder('ORD-1002')">Delete</button>
|
261 |
</td>
|
262 |
</tr>
|
263 |
-
<tr>
|
264 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1003</td>
|
265 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Michael Brown</td>
|
266 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-13</td>
|
@@ -319,30 +319,30 @@
|
|
319 |
</div>
|
320 |
|
321 |
<div class="p-4">
|
322 |
-
<form class="space-y-4">
|
323 |
<div>
|
324 |
<label class="block text-sm font-medium text-gray-700 mb-1">Customer</label>
|
325 |
-
<select class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
326 |
-
<option>Select customer</option>
|
327 |
-
<option>John Smith</option>
|
328 |
-
<option>Sarah Johnson</option>
|
329 |
-
<option>Michael Brown</option>
|
330 |
</select>
|
331 |
</div>
|
332 |
|
333 |
<div>
|
334 |
<label class="block text-sm font-medium text-gray-700 mb-1">Product</label>
|
335 |
-
<select class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
336 |
-
<option>Select product</option>
|
337 |
-
<option>Product A</option>
|
338 |
-
<option>Product B</option>
|
339 |
-
<option>Product C</option>
|
340 |
</select>
|
341 |
</div>
|
342 |
|
343 |
<div>
|
344 |
<label class="block text-sm font-medium text-gray-700 mb-1">Quantity</label>
|
345 |
-
<input type="number" min="1" value="1"
|
346 |
class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
347 |
</div>
|
348 |
|
@@ -440,6 +440,81 @@
|
|
440 |
</div>
|
441 |
|
442 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
// Login functionality
|
444 |
function login() {
|
445 |
const email = document.getElementById('email').value;
|
@@ -448,6 +523,7 @@
|
|
448 |
if (email === 'aicool@example.com' && password === '1244!@') {
|
449 |
document.getElementById('login-screen').classList.add('hidden');
|
450 |
document.getElementById('app-screen').classList.remove('hidden');
|
|
|
451 |
} else {
|
452 |
alert('Invalid credentials. Use email: aicool@example.com and password: 1244!@');
|
453 |
}
|
@@ -510,6 +586,7 @@
|
|
510 |
// Order functions
|
511 |
function showCreateOrderModal() {
|
512 |
document.getElementById('create-order-modal').classList.remove('hidden');
|
|
|
513 |
}
|
514 |
|
515 |
function hideCreateOrderModal() {
|
@@ -517,18 +594,65 @@
|
|
517 |
}
|
518 |
|
519 |
function submitOrder() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
hideCreateOrderModal();
|
521 |
-
|
|
|
|
|
522 |
}
|
523 |
|
524 |
function viewOrder(orderId) {
|
525 |
-
|
|
|
|
|
|
|
526 |
}
|
527 |
|
528 |
function deleteOrder(orderId) {
|
529 |
showConfirmationDialog(
|
530 |
`Are you sure you want to delete order ${orderId}?`,
|
531 |
-
() =>
|
|
|
|
|
|
|
|
|
532 |
);
|
533 |
}
|
534 |
|
@@ -602,5 +726,5 @@
|
|
602 |
showDashboard();
|
603 |
});
|
604 |
</script>
|
605 |
-
|
606 |
</html>
|
|
|
183 |
<div class="flex items-center justify-between">
|
184 |
<div>
|
185 |
<p class="text-gray-500">Total Orders</p>
|
186 |
+
<h3 id="total-orders" class="text-2xl font-semibold">3</h3>
|
187 |
</div>
|
188 |
<div class="p-3 rounded-full bg-blue-100 text-blue-600">
|
189 |
<i class="fas fa-shopping-cart"></i>
|
|
|
195 |
<div class="flex items-center justify-between">
|
196 |
<div>
|
197 |
<p class="text-gray-500">Revenue</p>
|
198 |
+
<h3 id="total-revenue" class="text-2xl font-semibold">$2,692.01</h3>
|
199 |
</div>
|
200 |
<div class="p-3 rounded-full bg-green-100 text-green-600">
|
201 |
<i class="fas fa-dollar-sign"></i>
|
|
|
207 |
<div class="flex items-center justify-between">
|
208 |
<div>
|
209 |
<p class="text-gray-500">Customers</p>
|
210 |
+
<h3 class="text-2xl font-semibold">3</h3>
|
211 |
</div>
|
212 |
<div class="p-3 rounded-full bg-purple-100 text-purple-600">
|
213 |
<i class="fas fa-users"></i>
|
|
|
222 |
<h3 class="font-medium">Recent Orders</h3>
|
223 |
</div>
|
224 |
<div class="overflow-x-auto">
|
225 |
+
<table id="orders-table" class="min-w-full divide-y divide-gray-200">
|
226 |
<thead class="bg-gray-50">
|
227 |
<tr>
|
228 |
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Order ID</th>
|
|
|
233 |
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
|
234 |
</tr>
|
235 |
</thead>
|
236 |
+
<tbody id="orders-body" class="bg-white divide-y divide-gray-200">
|
237 |
+
<tr id="order-ORD-1001">
|
238 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1001</td>
|
239 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">John Smith</td>
|
240 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-15</td>
|
|
|
247 |
<button class="text-red-600 hover:text-red-900" onclick="deleteOrder('ORD-1001')">Delete</button>
|
248 |
</td>
|
249 |
</tr>
|
250 |
+
<tr id="order-ORD-1002">
|
251 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1002</td>
|
252 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Sarah Johnson</td>
|
253 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-14</td>
|
|
|
260 |
<button class="text-red-600 hover:text-red-900" onclick="deleteOrder('ORD-1002')">Delete</button>
|
261 |
</td>
|
262 |
</tr>
|
263 |
+
<tr id="order-ORD-1003">
|
264 |
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#ORD-1003</td>
|
265 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Michael Brown</td>
|
266 |
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">2023-06-13</td>
|
|
|
319 |
</div>
|
320 |
|
321 |
<div class="p-4">
|
322 |
+
<form id="new-order-form" class="space-y-4">
|
323 |
<div>
|
324 |
<label class="block text-sm font-medium text-gray-700 mb-1">Customer</label>
|
325 |
+
<select id="order-customer" class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
326 |
+
<option value="">Select customer</option>
|
327 |
+
<option value="John Smith">John Smith</option>
|
328 |
+
<option value="Sarah Johnson">Sarah Johnson</option>
|
329 |
+
<option value="Michael Brown">Michael Brown</option>
|
330 |
</select>
|
331 |
</div>
|
332 |
|
333 |
<div>
|
334 |
<label class="block text-sm font-medium text-gray-700 mb-1">Product</label>
|
335 |
+
<select id="order-product" class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
336 |
+
<option value="">Select product</option>
|
337 |
+
<option value="Product A">Product A</option>
|
338 |
+
<option value="Product B">Product B</option>
|
339 |
+
<option value="Product C">Product C</option>
|
340 |
</select>
|
341 |
</div>
|
342 |
|
343 |
<div>
|
344 |
<label class="block text-sm font-medium text-gray-700 mb-1">Quantity</label>
|
345 |
+
<input type="number" id="order-quantity" min="1" value="1"
|
346 |
class="w-full px-3 py-2 sap-fiori-border rounded focus:outline-none focus:ring-2 focus:ring-blue-200">
|
347 |
</div>
|
348 |
|
|
|
440 |
</div>
|
441 |
|
442 |
<script>
|
443 |
+
// Sample data for orders
|
444 |
+
let orders = [
|
445 |
+
{
|
446 |
+
id: 'ORD-1001',
|
447 |
+
customer: 'John Smith',
|
448 |
+
date: '2023-06-15',
|
449 |
+
status: 'Completed',
|
450 |
+
amount: 1234.00,
|
451 |
+
product: 'Product A',
|
452 |
+
quantity: 2
|
453 |
+
},
|
454 |
+
{
|
455 |
+
id: 'ORD-1002',
|
456 |
+
customer: 'Sarah Johnson',
|
457 |
+
date: '2023-06-14',
|
458 |
+
status: 'Processing',
|
459 |
+
amount: 567.89,
|
460 |
+
product: 'Product B',
|
461 |
+
quantity: 1
|
462 |
+
},
|
463 |
+
{
|
464 |
+
id: 'ORD-1003',
|
465 |
+
customer: 'Michael Brown',
|
466 |
+
date: '2023-06-13',
|
467 |
+
status: 'Shipped',
|
468 |
+
amount: 890.12,
|
469 |
+
product: 'Product C',
|
470 |
+
quantity: 3
|
471 |
+
}
|
472 |
+
];
|
473 |
+
|
474 |
+
// Calculate total revenue
|
475 |
+
function calculateTotalRevenue() {
|
476 |
+
return orders.reduce((total, order) => total + order.amount, 0);
|
477 |
+
}
|
478 |
+
|
479 |
+
// Update dashboard stats
|
480 |
+
function updateDashboardStats() {
|
481 |
+
document.getElementById('total-orders').textContent = orders.length;
|
482 |
+
document.getElementById('total-revenue').textContent = `$${calculateTotalRevenue().toFixed(2)}`;
|
483 |
+
}
|
484 |
+
|
485 |
+
// Render orders table
|
486 |
+
function renderOrdersTable() {
|
487 |
+
const ordersBody = document.getElementById('orders-body');
|
488 |
+
ordersBody.innerHTML = '';
|
489 |
+
|
490 |
+
orders.forEach(order => {
|
491 |
+
const statusClass = {
|
492 |
+
'Completed': 'bg-green-100 text-green-800',
|
493 |
+
'Processing': 'bg-yellow-100 text-yellow-800',
|
494 |
+
'Shipped': 'bg-blue-100 text-blue-800'
|
495 |
+
}[order.status] || 'bg-gray-100 text-gray-800';
|
496 |
+
|
497 |
+
const row = document.createElement('tr');
|
498 |
+
row.id = `order-${order.id}`;
|
499 |
+
row.innerHTML = `
|
500 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">#${order.id}</td>
|
501 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${order.customer}</td>
|
502 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${order.date}</td>
|
503 |
+
<td class="px-6 py-4 whitespace-nowrap">
|
504 |
+
<span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${statusClass}">${order.status}</span>
|
505 |
+
</td>
|
506 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">$${order.amount.toFixed(2)}</td>
|
507 |
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
508 |
+
<button class="text-blue-600 hover:text-blue-900 mr-3" onclick="viewOrder('${order.id}')">View</button>
|
509 |
+
<button class="text-red-600 hover:text-red-900" onclick="deleteOrder('${order.id}')">Delete</button>
|
510 |
+
</td>
|
511 |
+
`;
|
512 |
+
ordersBody.appendChild(row);
|
513 |
+
});
|
514 |
+
|
515 |
+
updateDashboardStats();
|
516 |
+
}
|
517 |
+
|
518 |
// Login functionality
|
519 |
function login() {
|
520 |
const email = document.getElementById('email').value;
|
|
|
523 |
if (email === 'aicool@example.com' && password === '1244!@') {
|
524 |
document.getElementById('login-screen').classList.add('hidden');
|
525 |
document.getElementById('app-screen').classList.remove('hidden');
|
526 |
+
renderOrdersTable();
|
527 |
} else {
|
528 |
alert('Invalid credentials. Use email: aicool@example.com and password: 1244!@');
|
529 |
}
|
|
|
586 |
// Order functions
|
587 |
function showCreateOrderModal() {
|
588 |
document.getElementById('create-order-modal').classList.remove('hidden');
|
589 |
+
document.getElementById('new-order-form').reset();
|
590 |
}
|
591 |
|
592 |
function hideCreateOrderModal() {
|
|
|
594 |
}
|
595 |
|
596 |
function submitOrder() {
|
597 |
+
const customer = document.getElementById('order-customer').value;
|
598 |
+
const product = document.getElementById('order-product').value;
|
599 |
+
const quantity = parseInt(document.getElementById('order-quantity').value);
|
600 |
+
|
601 |
+
if (!customer || !product || !quantity) {
|
602 |
+
alert('Please fill all fields');
|
603 |
+
return;
|
604 |
+
}
|
605 |
+
|
606 |
+
// Calculate amount based on product and quantity (simplified)
|
607 |
+
const productPrices = {
|
608 |
+
'Product A': 500,
|
609 |
+
'Product B': 300,
|
610 |
+
'Product C': 200
|
611 |
+
};
|
612 |
+
|
613 |
+
const amount = productPrices[product] * quantity;
|
614 |
+
|
615 |
+
// Generate new order ID
|
616 |
+
const lastOrderId = orders.length > 0 ? parseInt(orders[0].id.split('-')[1]) : 1000;
|
617 |
+
const newOrderId = `ORD-${lastOrderId + 1}`;
|
618 |
+
|
619 |
+
// Add new order
|
620 |
+
const newOrder = {
|
621 |
+
id: newOrderId,
|
622 |
+
customer: customer,
|
623 |
+
date: new Date().toISOString().split('T')[0],
|
624 |
+
status: 'Processing',
|
625 |
+
amount: amount,
|
626 |
+
product: product,
|
627 |
+
quantity: quantity
|
628 |
+
};
|
629 |
+
|
630 |
+
// Add to beginning of array (to show at top)
|
631 |
+
orders.unshift(newOrder);
|
632 |
+
|
633 |
+
// Update UI
|
634 |
+
renderOrdersTable();
|
635 |
hideCreateOrderModal();
|
636 |
+
|
637 |
+
// Show notification
|
638 |
+
alert(`Order ${newOrderId} created successfully!`);
|
639 |
}
|
640 |
|
641 |
function viewOrder(orderId) {
|
642 |
+
const order = orders.find(o => o.id === orderId);
|
643 |
+
if (order) {
|
644 |
+
alert(`Viewing order ${orderId}\nCustomer: ${order.customer}\nProduct: ${order.product}\nQuantity: ${order.quantity}\nAmount: $${order.amount.toFixed(2)}\nStatus: ${order.status}`);
|
645 |
+
}
|
646 |
}
|
647 |
|
648 |
function deleteOrder(orderId) {
|
649 |
showConfirmationDialog(
|
650 |
`Are you sure you want to delete order ${orderId}?`,
|
651 |
+
() => {
|
652 |
+
orders = orders.filter(order => order.id !== orderId);
|
653 |
+
renderOrdersTable();
|
654 |
+
alert(`Order ${orderId} deleted`);
|
655 |
+
}
|
656 |
);
|
657 |
}
|
658 |
|
|
|
726 |
showDashboard();
|
727 |
});
|
728 |
</script>
|
729 |
+
</body>
|
730 |
</html>
|