Repository navigation
Expand file tree
/
Copy pathSales Trend.html
More file actions
265 lines (242 loc) · 16.3 KB
/
Copy pathSales Trend.html
File metadata and controls
265 lines (242 loc) · 16.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sales Leaderboard 2025 - 👑 Crown Edition</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
:root {
--bg-color: #0b1120;
--surface: #1e293b;
--surface-hover: #334155;
--text-primary: #f8fafc;
--text-secondary: #94a3b8;
--accent-1: #38bdf8;
--accent-2: #10b981;
--accent-3: #f59e0b;
--leader-gold: #fbbf24;
--card-border: rgba(255, 255, 255, 0.1);
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Kanit', sans-serif; }
body { background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; }
header { text-align: center; padding: 4rem 1rem; border-bottom: 1px solid var(--card-border); background: linear-gradient(180deg, #0f172a 0%, #0b1120 100%); }
h1 { font-size: 2.5rem; font-weight: 700; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-secondary); font-size: 1.1rem; }
main { max-width: 1400px; margin: 0 auto; padding: 2.5rem; }
.section-title { font-size: 2rem; margin: 3rem 0 2rem; display: flex; align-items: center; gap: 1rem; }
.section-title::before { content: ''; width: 8px; height: 30px; background: var(--accent-1); border-radius: 4px; }
/* Stats Grid */
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1.5rem; }
.data-card { background: var(--surface); border: 1px solid var(--card-border); border-radius: 24px; padding: 1.8rem; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; overflow: hidden; }
.data-card:hover { transform: translateY(-10px); border-color: var(--accent-1); box-shadow: 0 20px 40px rgba(0,0,0,0.4); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 1rem; }
.char-id { font-size: 2rem; font-weight: 800; color: var(--accent-1); }
.sales-val { font-size: 1.4rem; font-weight: 700; color: var(--accent-2); }
.info-row { margin-bottom: 1.2rem; }
.info-label { color: var(--text-secondary); font-size: 0.95rem; display: block; margin-bottom: 0.5rem; }
/* Store Size */
.store-size-box { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); padding: 0.6rem 1.2rem; border-radius: 14px; display: inline-flex; align-items: center; gap: 0.6rem; margin-top: 0.2rem; }
.store-size-label { font-size: 1rem; color: var(--accent-2); font-weight: 600; }
/* Province Styles */
.province-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.province-tag { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); padding: 5px 12px; border-radius: 10px; font-size: 0.9rem; border: 1px solid rgba(255, 255, 255, 0.1); display: flex; align-items: center; gap: 0.3rem; }
.leader-tag { background: rgba(251, 191, 36, 0.1); color: var(--leader-gold); border: 1px solid rgba(251, 191, 36, 0.4); font-weight: 700; box-shadow: 0 0 15px rgba(251, 191, 36, 0.1); }
.crown-icon { font-size: 1.1rem; }
/* Product Progress */
.product-summary { background: rgba(0,0,0,0.25); padding: 1.2rem; border-radius: 18px; margin-top: 1.2rem; }
.product-item { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.5rem; }
.progress-bar { height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); }
.animate { animation: fadeIn 0.6s ease forwards; opacity: 0; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.chart-section { background: var(--surface); padding: 2.5rem; border-radius: 24px; border: 1px solid var(--card-border); margin-bottom: 4rem; height: 450px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
</style>
</head>
<body>
<header>
<h1>รายงานสรุปยอดขายรายภูมิภาค 2025</h1>
<p class="subtitle">จัดลำดับความโดดเด่นตามยอดขาย (Sort by Daily Sales) และจังหวัดผู้นำพื้นที่ 👑</p>
</header>
<main>
<div class="chart-section animate" style="animation-delay: 0.1s;">
<canvas id="salesBarChart"></canvas>
</div>
<h2 class="section-title">ลำดับยอดขายราย Character (สูงไปต่ำ)</h2>
<div class="grid-container" id="mainGrid"></div>
</main>
<script>
const zoneData = [
{
id: "BS", sales: 47, storeSize: "5 คูหา",
provinces: ["(1) กรุงเทพ", "สมุทรปราการ"],
products: [{name: "Fresh Food", pct: 35}, {name: "Beverage", pct: 30}, {name: "Processed", pct: 18.9}]
},
{
id: "BE", sales: 44, storeSize: "5 คูหา",
provinces: ["(1) กรุงเทพ", "มีนบุรี", "ปทุมธานี"],
products: [{name: "Fresh Food", pct: 35}, {name: "Beverage", pct: 25}, {name: "Processed", pct: 19.2}]
},
{
id: "BW", sales: 40, storeSize: "3 คูหา",
provinces: ["(1) กรุงเทพ", "สมุทรสาคร", "นครปฐม", "สมุทรสงคราม"],
products: [{name: "Fresh Food", pct: 30.2}, {name: "Beverage", pct: 30.2}, {name: "Processed", pct: 18.5}]
},
{
id: "BN", sales: 37, storeSize: "5 คูหา",
provinces: ["(1) กรุงเทพ", "ปทุมธานี", "นนทบุรี"],
products: [{name: "Fresh Food", pct: 30.9}, {name: "Beverage", pct: 29}, {name: "Processed", pct: 19.0}]
},
{
id: "RSL", sales: 37, storeSize: "5 และ 4 คูหา",
provinces: ["(1) ภูเก็ต", "นครศรีธรรมราช", "สงขลา", "สตูล", "พัทลุง", "ตรัง", "กระบี่", "ระนอง", "พังงา", "ปัตตานี", "นราธิวาส", "ยะลา"],
products: [{name: "Fresh Food", pct: 31.2}, {name: "Beverage", pct: 22.4}, {name: "Processed", pct: 19.1}]
},
{
id: "RC", sales: 32, storeSize: "5 และ 3 คูหา",
provinces: ["(1) อยุธยา", "สระบุรี", "สิงห์บุรี", "ลพบุรี", "อ่างทอง", "นครสวรรค์", "ชัยนาท", "เพชรบูรณ์", "อุทัยธานี", "สุพรรณบุรี"],
products: [{name: "Fresh Food", pct: 30.5}, {name: "Beverage", pct: 22.0}, {name: "Processed", pct: 18.8}]
},
{
id: "REL", sales: 32, storeSize: "5 และ 3 คูหา",
provinces: ["(1) ชลบุรี", "ระยอง", "จันทบุรี", "ตราด"],
products: [{name: "Fresh Food", pct: 30}, {name: "Beverage", pct: 27}, {name: "Non Food", pct: 18.7}]
},
{
id: "RSU", sales: 32, storeSize: "5 และ 4 คูหา",
provinces: ["(1) สุราษฎร์ธานี", "ราชบุรี", "ประจวบคีรีขันธ์", "กาญจนบุรี", "ชุมพร", "เพชรบุรี"],
products: [{name: "Fresh Food", pct: 30.5}, {name: "Beverage", pct: 22.0}, {name: "Processed", pct: 18.8}]
},
{
id: "REU", sales: 30, storeSize: "5 คูหา",
provinces: ["(1) ชลบุรี", "สระแก้ว", "ปราจีนบุรี", "ฉะเชิงเทรา", "นครนายก"],
products: [{name: "Fresh Food", pct: 31.0}, {name: "Beverage", pct: 21.9}, {name: "Processed", pct: 19.3}]
},
{
id: "NEU", sales: 29, storeSize: "5 และ 4 คูหา",
provinces: ["มหาสารคาม", "(1) ขอนแก่น", "สกลนคร", "มุกดาหาร", "นครพนม", "กาฬสินธุ์", "เลย", "อุดรธานี", "หนองคาย", "หนองบัวลำภู", "บึงกาฬ"],
products: [{name: "Fresh Food", pct: 30.8}, {name: "Beverage", pct: 22.1}, {name: "Processed", pct: 18.9}]
},
{
id: "RN", sales: 29, storeSize: "5 และ 3 คูหา",
provinces: ["(1) เชียงราย", "สุโขทัย", "กำแพงเพชร", "เชียงใหม่", "ตาก", "ลำปาง", "แพร่", "พะเยา", "แม่ฮ่องสอน"],
products: [{name: "Fresh Food", pct: 30.8}, {name: "Beverage", pct: 22.1}, {name: "Processed", pct: 18.9}]
},
{
id: "BG", sales: 29, storeSize: "5 คูหา",
provinces: ["(1) นนทบุรี", "กรุงเทพ", "นครปฐม", "สมุทรสาคร"],
products: [{name: "Fresh Food", pct: 32.8}, {name: "Beverage", pct: 30}, {name: "Processed", pct: 18.9}]
},
{
id: "NEL", sales: 25, storeSize: "5 และ 4 คูหา",
provinces: ["(1) นครราชสีมา", "ชัยภูมิ", "ร้อยเอ็ด", "บุรีรัมย์", "ยโสธร", "ศรีสะเกษ", "สุรินทร์", "อุบลราชธานี", "อำนาจเจริญ"],
products: [{name: "Fresh Food", pct: 30.4}, {name: "Beverage", pct: 22.8}, {name: "Processed", pct: 18.6}]
},
{
id: "CM", sales: 13, storeSize: "3 และ 2 คูหา",
provinces: ["(1) เชียงใหม่", "แม่ฮ่องสอน", "ลำพูน"],
products: [{name: "Fresh Food", pct: 32.5}, {name: "Beverage", pct: 28.0}, {name: "Processed", pct: 20.5}]
},
{
id: "UB", sales: 6, storeSize: "3 และ 4 คูหา",
provinces: ["(1) อุบลราชธานี", "ศรีสะเกษ", "สุรินทร์", "อำนาจเจริญ"],
products: [{name: "Fresh Food", pct: 31.8}, {name: "Beverage", pct: 27.2}, {name: "Processed", pct: 20.7}]
},
{
id: "YL", sales: 3, storeSize: "3 และ 6 คูหา",
provinces: ["(1) ยะลา", "นราธิวาส", "ปัตตานี"],
products: [{name: "Fresh Food", pct: 32.1}, {name: "Processed", pct: 21.5}, {name: "Beverage", pct: 15.5}]
}
];
// 1. Sort Data by Sales High to Low
const sortedData = [...zoneData].sort((a, b) => b.sales - a.sales);
const grid = document.getElementById('mainGrid');
sortedData.forEach((item, index) => {
const card = document.createElement('div');
card.className = 'data-card animate';
card.style.animationDelay = `${0.2 + (index * 0.05)}s`;
card.innerHTML = `
<div class="card-header">
<span class="char-id">${item.id}</span>
<span class="sales-val">${item.sales}M / วัน</span>
</div>
<div class="info-row">
<span class="info-label">ขนาดร้านค้าที่โดดเด่น:</span>
<div class="store-size-box">
<span class="store-size-label">🏢 ${item.storeSize}</span>
</div>
</div>
<div class="info-row">
<span class="info-label">เขตพื้นที่ (👑 คือ Leader):</span>
<div class="province-list">
${item.provinces.map(p => {
const isLeader = p.includes("(1)");
const displayName = p.replace("(1) ", "").replace("(1)", "");
return `<span class="province-tag ${isLeader ? 'leader-tag' : ''}">
${isLeader ? '<span class="crown-icon">👑</span>' : ''} ${displayName}
</span>`;
}).join('')}
</div>
</div>
<div class="product-summary">
<span class="info-label" style="color:var(--text-primary); font-weight:600;">Top 3 กลุ่มสินค้าขายดี</span>
${item.products.map(p => `
<div class="product-item">
<span style="color:var(--text-secondary)">${p.name}</span>
<span style="font-weight:700; color:var(--accent-1)">${p.pct}%</span>
</div>
<div class="progress-bar"><div class="progress-fill" style="width:${p.pct * 2.5}%"></div></div>
`).join('')}
</div>
`;
grid.appendChild(card);
});
// 2. Main Chart (Using Sorted Data)
const ctx = document.getElementById('salesBarChart').getContext('2d');
new Chart(ctx, {
type: 'bar',
data: {
labels: sortedData.map(d => d.id),
datasets: [{
label: 'ยอดขายเฉลี่ย (ล้านบาท)',
data: sortedData.map(d => d.sales),
backgroundColor: 'rgba(56, 189, 248, 0.6)',
borderColor: '#38bdf8',
borderWidth: 2,
borderRadius: 10,
hoverBackgroundColor: 'rgba(16, 185, 129, 0.7)',
hoverBorderColor: '#10b981'
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
y: {
beginAtZero: true,
grid: { color: 'rgba(255,255,255,0.05)' },
ticks: { color: '#94a3b8', font: { family: 'Kanit' } }
},
x: {
grid: { display: false },
ticks: { color: '#f8fafc', font: { family: 'Kanit', size: 13, weight: '600' } }
}
},
plugins: {
legend: { display: false },
tooltip: {
backgroundColor: 'rgba(15, 23, 42, 0.9)',
titleFont: { family: 'Kanit', size: 16 },
bodyFont: { family: 'Kanit', size: 14 },
padding: 12,
displayColors: false
}
}
}
});
</script>
</body>
</html>