-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
230 lines (201 loc) · 12.3 KB
/
index.html
File metadata and controls
230 lines (201 loc) · 12.3 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Smart Inventory</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/html5-qrcode"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/signature_pad.umd.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&family=Inter:wght@400;900&display=swap" rel="stylesheet">
<style>
:root { --accent: #6366f1; --bg: #020617; }
body { background-color: var(--bg); color: white; font-family: 'Inter', sans-serif; }
.font-mono { font-family: 'Fira Code', monospace; }
.glass { background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,0.1); }
.terminal-scroll::-webkit-scrollbar { width: 4px; }
.terminal-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }
#signature-pad { background: #0f172a; border: 1px dashed #334155; border-radius: 1rem; cursor: crosshair; }
.animate-slide { animation: slideIn 0.3s ease-out forwards; }
@keyframes slideIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
</style>
</head>
<body class="p-4 lg:p-10 min-h-screen">
<div class="max-w-7xl mx-auto">
<header class="flex flex-col lg:flex-row justify-between items-start lg:items-center mb-8 gap-6">
<div>
<h1 class="text-4xl font-black tracking-tighter uppercase italic">Wayne <span class="text-indigo-500">Core</span></h1>
<p class="text-slate-500 font-mono text-[9px] tracking-[0.5em]">SMART_INVENTORY // WayneOS</p>
</div>
<div class="flex flex-wrap gap-4 items-center">
<div class="glass px-6 py-3 rounded-2xl border-indigo-500/30">
<p class="text-[8px] font-black text-indigo-400 uppercase tracking-widest">Global Asset Valuation</p>
<p id="total-val" class="text-2xl font-black">$0.00</p>
</div>
<button onclick="exportData()" class="bg-white text-black px-6 py-3 rounded-xl font-black text-[10px] uppercase tracking-widest hover:bg-indigo-400 transition-all">DATA Export</button>
</div>
</header>
<div class="grid grid-cols-1 lg:grid-cols-12 gap-8">
<div class="lg:col-span-4 space-y-6">
<div class="glass p-6 rounded-[2.5rem]">
<h3 class="text-[10px] font-black uppercase tracking-widest text-slate-500 mb-4">Stock Distribution</h3>
<canvas id="stockChart" height="200"></canvas>
</div>
<div class="glass p-6 rounded-[2.5rem] overflow-hidden">
<div id="reader" class="rounded-2xl"></div>
</div>
</div>
<div class="lg:col-span-4 space-y-6">
<div class="glass p-8 rounded-[2.5rem]">
<h3 class="text-[10px] font-black text-indigo-400 uppercase tracking-widest mb-6 italic">Manual Data Entry</h3>
<div class="space-y-4">
<input type="text" id="in-name" placeholder="ITEM NAME" class="w-full bg-slate-900 border border-slate-800 p-4 rounded-xl text-xs font-bold uppercase outline-none focus:border-indigo-500 transition-all">
<input type="text" id="in-code" placeholder="SCANNED CODE" class="w-full bg-slate-900 border border-slate-800 p-4 rounded-xl text-xs font-mono outline-none focus:border-indigo-500 transition-all">
<div class="grid grid-cols-2 gap-4">
<input type="number" id="in-qty" placeholder="QUANTITY*" class="bg-slate-900 border border-slate-800 p-4 rounded-xl text-xs font-bold outline-none focus:border-indigo-500">
<input type="number" id="in-price" placeholder="UNIT PRICE*" class="bg-slate-900 border border-slate-800 p-4 rounded-xl text-xs font-bold outline-none focus:border-indigo-500">
</div>
<select id="in-loc" class="w-full bg-slate-900 border border-slate-800 p-4 rounded-xl text-xs font-bold text-slate-400">
<option value="Warehouse A">Warehouse A</option>
<option value="Warehouse A">Warehouse B</option>
<option value="Warehouse A">Warehouse C</option>
<option value="Main Office">Main Office</option>
<option value="In Transit">In Transit</option>
</select>
<p class="text-[8px] font-black text-slate-500 uppercase tracking-widest mt-2 mb-1">Authorization Signature</p>
<canvas id="signature-pad" class="w-full h-32"></canvas>
<button onclick="addAsset()" class="w-full bg-indigo-600 py-4 rounded-xl font-black text-xs uppercase tracking-widest hover:bg-indigo-500 transition-all mt-4 shadow-lg shadow-indigo-500/20">Execute Transaction</button>
</div>
</div>
</div>
<div class="lg:col-span-4 space-y-4">
<div class="flex justify-between items-center px-2">
<h3 class="text-[10px] font-black text-slate-500 uppercase tracking-widest">Operational Feed</h3>
<input type="text" id="search" oninput="render()" placeholder="SEARCH_DB..." class="bg-slate-900 border border-slate-800 px-4 py-1 rounded text-[10px] w-32 font-mono outline-none">
</div>
<div id="feed" class="terminal-scroll space-y-3 max-h-[800px] overflow-y-auto pr-2">
</div>
</div>
</div>
</div>
<script>
let inventory = JSON.parse(localStorage.getItem('wayne_quantum_db')) || [];
let stockChart = null;
let signaturePad = new SignaturePad(document.getElementById('signature-pad'));
// --- 1. SCANNER ENGINE ---
const qrScanner = new Html5Qrcode("reader");
qrScanner.start({ facingMode: "environment" }, { fps: 15, qrbox: 250 }, (text) => {
document.getElementById('in-code').value = text;
if(window.navigator.vibrate) window.navigator.vibrate(50);
}).catch(err => console.log("Camera access required for scanning."));
// --- 3. OPERATIONS ---
function addAsset() {
const name = document.getElementById('in-name').value.trim();
const code = document.getElementById('in-code').value.trim();
const qty = parseInt(document.getElementById('in-qty').value);
const price = parseFloat(document.getElementById('in-price').value);
const loc = document.getElementById('in-loc').value;
if((!name && !code) || isNaN(qty) || isNaN(price)) {
return alert("INCOMPLETE DATA: Name/Code, Quantity, and Price are required.");
}
const item = {
id: Date.now(),
name: name || "UNNAMED_ASSET",
code: code || "NO_CODE",
qty, price, loc,
sign: signaturePad.toDataURL(),
date: new Date().toLocaleDateString()
};
inventory.unshift(item);
save();
signaturePad.clear();
['in-name', 'in-code', 'in-qty', 'in-price'].forEach(id => document.getElementById(id).value = '');
}
function deleteItem(id) {
if(confirm("Confirm deletion of this asset?")) {
inventory = inventory.filter(item => item.id !== id);
save();
}
}
function save() {
localStorage.setItem('wayne_quantum_db', JSON.stringify(inventory));
render();
updateChart();
}
function exportData() {
let csv = "Item,Code,Qty,Price,Location,Date\n";
inventory.forEach(i => csv += `${i.name},${i.code},${i.qty},${i.price},${i.loc},${i.date}\n`);
const blob = new Blob([csv], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `Wayne_Logistics_${Date.now()}.csv`;
a.click();
}
// --- 4. VISUALIZATION ---
function updateChart() {
const ctx = document.getElementById('stockChart').getContext('2d');
const topItems = inventory.slice(0, 5);
const labels = topItems.map(i => i.name !== "" ? i.name : i.code);
const data = topItems.map(i => i.qty);
if (stockChart) stockChart.destroy();
stockChart = new Chart(ctx, {
type: 'bar',
data: {
labels,
datasets: [{
label: 'Stock Qty',
data,
backgroundColor: '#6366f1',
borderRadius: 8
}]
},
options: {
responsive: true,
plugins: { legend: { display: false } },
scales: {
y: { grid: { color: '#1e293b' }, ticks: { color: '#475569' } },
x: { ticks: { color: '#475569', font: { size: 9 } } }
}
}
});
}
function render() {
const feed = document.getElementById('feed');
const search = document.getElementById('search').value.toLowerCase();
let total = 0;
const filtered = inventory.filter(i =>
i.name.toLowerCase().includes(search) ||
i.code.toLowerCase().includes(search)
);
feed.innerHTML = filtered.map(item => {
total += (item.qty * item.price);
const isLow = item.qty < 5;
return `
<div class="glass p-5 rounded-3xl border-l-4 ${isLow ? 'border-red-500' : 'border-indigo-500'} animate-slide hover:bg-white/5 group relative">
<div class="flex justify-between items-start">
<div>
<h4 class="font-black text-xs uppercase tracking-tight">${item.name}</h4>
<p class="text-[8px] font-mono text-indigo-400 mt-1">CODE: ${item.code}</p>
<p class="text-[8px] font-mono text-slate-500 uppercase">${item.loc} // ${item.date}</p>
</div>
<div class="text-right flex flex-col items-end">
<p class="text-xs font-black text-white">$${(item.qty * item.price).toFixed(2)}</p>
<p class="text-[8px] font-bold text-slate-400">QTY: ${item.qty}</p>
<button onclick="deleteItem(${item.id})" class="mt-2 text-slate-600 hover:text-red-500 transition-colors opacity-0 group-hover:opacity-100">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg>
</button>
</div>
</div>
${item.sign ? `<img src="${item.sign}" class="h-6 opacity-30 mt-2 grayscale invert">` : ''}
</div>
`;
}).join('');
document.getElementById('total-val').innerText = `$${total.toLocaleString(undefined, {minimumFractionDigits: 2})}`;
}
render();
updateChart();
</script>
</body>
</html>