Repository navigation
Expand file tree
/
Copy pathdata.js
More file actions
90 lines (83 loc) · 3.65 KB
/
Copy pathdata.js
File metadata and controls
90 lines (83 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// TechStore – Product & Order Data
const PRODUCTS = [
{
id: 1, name: 'MacBook Air M3', cat: 'Laptops', price: 114999, stock: 12, emoji: '💻',
rating: 4.8, reviews: 234,
desc: 'Apple M3 chip, 8GB RAM, 256GB SSD. Incredibly thin, light and powerful for everyday use.',
specs: { RAM: '8GB', Storage: '256GB SSD', Display: '13.6" Liquid Retina', Battery: 'Up to 18hrs' }
},
{
id: 2, name: 'Sony WH-1000XM5', cat: 'Audio', price: 28990, stock: 35, emoji: '🎧',
rating: 4.7, reviews: 891,
desc: 'Industry-leading noise cancellation with 30-hour battery life and premium sound.',
specs: { Driver: '30mm', BT: 'Bluetooth 5.2', Battery: '30hrs', Weight: '250g' }
},
{
id: 3, name: 'Samsung Galaxy S24', cat: 'Phones', price: 79999, stock: 8, emoji: '📱',
rating: 4.6, reviews: 567,
desc: 'Galaxy AI features, 200MP camera, Snapdragon 8 Gen 3 for Galaxy.',
specs: { Display: '6.7" AMOLED', Camera: '200MP', RAM: '12GB', Battery: '5000mAh' }
},
{
id: 4, name: 'LG 4K OLED TV 55"', cat: 'TVs', price: 129999, stock: 5, emoji: '📺',
rating: 4.9, reviews: 312,
desc: 'Perfect blacks, Dolby Vision IQ, 120Hz refresh for stunning gaming and movies.',
specs: { Size: '55"', Resolution: '4K OLED', Refresh: '120Hz', HDR: 'Dolby Vision' }
},
{
id: 5, name: 'iPad Pro M4', cat: 'Tablets', price: 109900, stock: 20, emoji: '🖥️',
rating: 4.8, reviews: 445,
desc: 'Ultra Retina XDR display, Apple Pencil Pro support and Apple M4 chip.',
specs: { Chip: 'Apple M4', Display: '11" Ultra Retina', RAM: '8GB', Storage: '256GB' }
},
{
id: 6, name: 'Logitech MX Master 3S', cat: 'Accessories', price: 9995, stock: 45, emoji: '🖱️',
rating: 4.7, reviews: 1203,
desc: 'Ultra-fast MagSpeed scroll, Bluetooth + USB-C. The ultimate productivity mouse.',
specs: { DPI: '200-8000', Battery: '70 days', Buttons: '7', Connection: 'BT / Logi Bolt' }
},
{
id: 7, name: 'DJI Mini 4 Pro', cat: 'Cameras', price: 74900, stock: 7, emoji: '🚁',
rating: 4.6, reviews: 189,
desc: '4K/60fps video, omnidirectional obstacle sensing, 34-minute flight time.',
specs: { Camera: '4K/60fps', Flight: '34 min', Weight: '249g', Range: '20km' }
},
{
id: 8, name: 'Apple Watch Ultra 2', cat: 'Wearables', price: 89900, stock: 15, emoji: '⌚',
rating: 4.8, reviews: 678,
desc: 'Titanium case, dual-frequency GPS, up to 60-hour battery in low power mode.',
specs: { Display: '49mm OLED', GPS: 'L1+L5 Dual', Battery: '60hrs', Case: 'Titanium' }
}
];
const CATEGORIES = ['All', ...new Set(PRODUCTS.map(p => p.cat))];
// Default seed orders (stored in localStorage)
const SEED_ORDERS = [
{
id: 'ORD-1001',
items: [{ name: 'Sony WH-1000XM5', qty: 1, price: 28990 }],
total: 29089, status: 'Delivered', date: '2025-03-01', address: '42 MG Road, Chennai'
},
{
id: 'ORD-1002',
items: [{ name: 'MacBook Air M3', qty: 1, price: 114999 }],
total: 115098, status: 'Shipped', date: '2025-03-15', address: '42 MG Road, Chennai'
}
];
// ── Storage helpers ──────────────────────────────────────────────
function getOrders() {
const stored = localStorage.getItem('ts_orders');
return stored ? JSON.parse(stored) : SEED_ORDERS;
}
function saveOrders(orders) {
localStorage.setItem('ts_orders', JSON.stringify(orders));
}
function addOrder(order) {
const orders = getOrders();
orders.unshift(order);
saveOrders(orders);
}
function updateOrderStatus(id, status) {
const orders = getOrders();
const o = orders.find(x => x.id === id);
if (o) { o.status = status; saveOrders(orders); }
}