bep40 commited on
Commit
11134ab
·
verified ·
1 Parent(s): 381b79f

Add big_sale.js with BIG SALE floating promotion module (23 products)

Browse files
Files changed (1) hide show
  1. big_sale.js +237 -188
big_sale.js CHANGED
@@ -1,215 +1,264 @@
1
- // BIG SALE Floating Promotion for V.AI AVATAR2
2
- // Space: bep40/vai-avatar2
 
3
 
4
- // Product data for BIG SALE
5
- // Format: [STT, Mã sản phẩm, Tên sản phẩm, SL, Giá bán lẻ (VNĐ), Chiết khấu (%), Giá Bigsale (VNĐ), Tình trạng]
 
6
  const BIG_SALE_PRODUCTS = [
7
- [1, "MC-7086HS", "MÁY HÚT", 3, 11389000, 55, 5125050, "HÀNG MỚI"],
8
- [2, "MH-70SMC", "MÁY HÚT ECO", 2, 4620000, 60, 1848000, "HÀNG MỚI"],
9
- [3, "MH-90SMC", "MÁY HÚT ECO", 4, 5060000, 60, 2024000, "HÀNG MỚI"],
10
- [4, "MH-600GT", "MÁY HÚT", 5, 8208000, 50, 4104000, "HÀNG MỚI"],
11
- [5, "AS-9602DG", "BẾP 2 GAS", 2, 7815000, 50, 3907500, "HÀNG MỚI"],
12
- [6, "SMART K-450", "CHẬU ĐÁ", 1, 21109000, 55, 9499050, "HÀNG MỚI"],
13
- [7, "MS-1022D", "CHẊU RỦA", 4, 5852000, 50, 2926000, "HÀNG MỚI"],
14
- [8, "MS-2025", "CHẊU RỦA", 1, 5700000, 55, 2565000, "HÀNG MỚI"],
15
- [9, "MS-6070", "CHẊU RỦA", 11, 6464000, 50, 3232000, "HÀNG MỚI"],
16
- [10, "MS-5066W", "CHẊU RỦA", 8, 4385000, 50, 2192500, "HÀNG MỚI"],
17
- [11, "MS-5082W", "CHẊU RỦA", 3, 6350000, 50, 3175000, "HÀNG MỚI"],
18
- [12, "MS-862", "CHẊU RỦA", 3, 12960000, 55, 5832000, "HÀNG MỚI"],
19
- [13, "MPC-5KCB", "BỘ LỌC NƯỚC", 1, 10702000, 50, 5351000, "HÀNG MỚI"],
20
- [14, "K061S", "VÒI", 10, 3056000, 50, 1528000, "HÀNG MỚI"],
21
- [15, "K569SN", "VÒI ECO", 2, 3520000, 55, 1584000, "HÀNG MỚI"],
22
- [16, "K525B", "VÒI", 2, 2916000, 55, 1312200, "HÀNG MỚI"],
23
- [17, "K130S", "VÒI", 4, 4104000, 55, 1846800, "HÀNG MỚI"],
24
- [18, "K136A", "VÒI", 2, 2430000, 55, 1093500, "HÀNG MỚI"],
25
- [19, "K501B", "VÒI", 2, 5076000, 55, 2284200, "HÀNG MỚI"],
26
- [20, "MST-6667", "LÓT NỒI", 25, 255000, 70, 76500, "HÀNG MỚI"],
27
- [21, "MMPM-657A", "XAY TIÊU", 34, 295000, 70, 88500, "HÀNG MỚI"],
28
- [22, "MOVS-10128", "BỘ ĐỰNG DẦU", 2, 491000, 70, 147300, "HÀNG MỚI"],
29
- [23, "BỘ LÀM SẠCH NHÀ BẾP", "BỘ LÀM SẠCH NHÀ BẾP", 8, 720000, 70, 216000, "HÀNG MỚI"]
30
  ];
31
 
32
- (function() {
33
- 'use strict';
 
 
 
 
34
 
35
- // Format currency VND
36
- function formatVND(amount) {
37
- return new Intl.NumberFormat('vi-VN', {
38
- style: 'currency',
39
- currency: 'VND',
40
- minimumFractionDigits: 0
41
- }).format(amount);
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- // Create the BIG SALE floating button
45
- function createFloatingButton() {
46
- var button = document.createElement('button');
47
- button.id = 'bigSaleToggle';
48
- button.className = 'big-sale-floating';
49
- button.setAttribute('aria-label', 'Mở chương trình BIG SALE');
50
- button.setAttribute('title', 'BIG SALE - Khuyến mãi hot');
51
- button.innerHTML =
52
- '<span class="big-sale-badge">BIG SALE</span>' +
53
- '<span class="big-sale-title">BIG SALE</span>' +
54
- '<span class="big-sale-count">' + BIG_SALE_PRODUCTS.length + ' sản phẩm</span>';
55
- return button;
56
- }
57
 
58
- // Create the BIG SALE panel
59
- function createPanel() {
60
- var panel = document.createElement('div');
61
- panel.id = 'bigSalePanel';
62
- panel.className = 'big-sale-panel';
63
- panel.innerHTML =
64
- '<div class="big-sale-header">' +
65
- '<h3><i class="fas fa-bolt" style="margin-right:8px"></i> CHƯƠNG TRÌNH BIG SALE</h3>' +
66
- '<button class="big-sale-close" id="bigSaleClose" aria-label="Đóng">' +
67
- '<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">' +
68
- '<line x1="18" y1="6" x2="6" y2="18"></line>' +
69
- '<line x1="6" y1="6" x2="18" y2="18"></line>' +
70
- '</svg>' +
71
- '</button>' +
72
- '</div>' +
73
- '<div class="big-sale-products" id="bigSaleProducts"></div>';
74
- return panel;
75
- }
76
 
77
- // Render product cards into the panel
78
- function renderProducts() {
79
- var container = document.getElementById('bigSaleProducts');
80
- if (!container) return;
81
-
82
- var html = '';
83
- BIG_SALE_PRODUCTS.forEach(function(product) {
84
- var stt = product[0];
85
- var maSp = product[1];
86
- var tenSp = product[2];
87
- var sl = product[3];
88
- var giaBan = product[4];
89
- var chietKhau = product[5];
90
- var giaBigSale = product[6];
91
- var tinhTrang = product[7];
92
- var originalPrice = formatVND(giaBan);
93
- var bigSalePrice = formatVND(giaBigSale);
94
-
95
- html +=
96
- '<div class="big-sale-product" onclick="window.openBigSaleProduct(' + stt + ')">' +
97
- '<div class="big-sale-product-info">' +
98
- '<div class="big-sale-product-name">' + tenSp + '</div>' +
99
- '<div class="big-sale-product-code">Mã: ' + maSp + '</div>' +
100
- '<div class="big-sale-product-meta">' +
101
- '<span class="big-sale-new-badge">SL: ' + sl + '</span>' +
102
- '<span class="big-sale-new-badge">' + tinhTrang + '</span>' +
103
- '</div>' +
104
- '</div>' +
105
- '<div class="big-sale-product-price-container">' +
106
- '<div class="big-sale-product-bigprice">' + originalPrice + '</div>' +
107
- '<div class="big-sale-product-price">' + bigSalePrice + '</div>' +
108
- '<span class="big-sale-product-discount">' + chietKhau + '% OFF</span>' +
109
- '</div>' +
110
- '</div>';
111
- });
112
 
113
- container.innerHTML = html;
114
- }
115
 
116
- // Open product detail from BIG SALE
117
- window.openBigSaleProduct = function(stt) {
118
- var product = BIG_SALE_PRODUCTS.find(function(p) { return p[0] === stt; });
119
- if (!product) return;
120
-
121
- var maSp = product[1];
122
- var tenSp = product[2];
123
- var sl = product[3];
124
- var giaBan = product[4];
125
- var chietKhau = product[5];
126
- var giaBigSale = product[6];
127
- var tinhTrang = product[7];
128
- var originalPrice = formatVND(giaBan);
129
- var bigSalePrice = formatVND(giaBigSale);
130
-
131
- // Try to use existing vaistudio detail modal
132
- var detailOverlay = document.getElementById('vaistudio-detail-overlay');
133
- if (detailOverlay) {
134
- document.getElementById('detail-title').textContent = tenSp;
135
- document.getElementById('detail-brand').textContent = maSp;
136
- document.getElementById('detail-model').textContent = tinhTrang;
137
- document.getElementById('detail-price').innerHTML =
138
- '<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">' +
139
- '<span style="color:#c2410c;font-size:1.2rem;font-weight:800">' + bigSalePrice + '</span>' +
140
- '<span style="font-size:0.7rem;background:#fee2e2;color:#dc2626;padding:2px 8px;border-radius:8px;font-weight:600">-' + chietKhau + '%</span>' +
141
- '</div>' +
142
- '<div style="font-size:0.7rem;text-decoration:line-through;color:#64748b;margin-top:2px">' + originalPrice + '</div>';
143
- detailOverlay.style.display = 'flex';
144
- return;
145
- }
146
 
147
- alert(
148
- 'Sản phẩm: ' + tenSp + '\n' +
149
- 'Mã: ' + maSp + '\n' +
150
- 'Giá gốc: ' + originalPrice + '\n' +
151
- 'Giá BIG SALE: ' + bigSalePrice + '\n' +
152
- 'Chiết khấu: ' + chietKhau + '%\n' +
153
- 'Số lượng: ' + sl + '\n' +
154
- 'Tình trạng: ' + tinhTrang
155
- );
156
- };
157
 
158
- // Close product detail
159
- window.closeBigSaleDetail = function() {
160
- var overlay = document.getElementById('vaistudio-detail-overlay');
161
- if (overlay) overlay.style.display = 'none';
162
- };
 
163
 
164
- // Initialize BIG SALE
165
- function initBigSale() {
166
- // Check if already initialized
167
- if (document.getElementById('bigSaleToggle')) return;
 
 
 
 
168
 
169
- // Create floating button
170
- var floatingBtn = createFloatingButton();
171
- document.body.appendChild(floatingBtn);
 
 
 
 
 
 
 
 
 
172
 
173
- // Create panel
174
- var panel = createPanel();
175
- document.body.appendChild(panel);
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
- // Wire up events
178
- var toggleBtn = document.getElementById('bigSaleToggle');
179
- var salePanel = document.getElementById('bigSalePanel');
180
- var closeBtn = document.getElementById('bigSaleClose');
 
181
 
182
- if (toggleBtn && salePanel) {
183
- toggleBtn.addEventListener('click', function() {
184
- salePanel.classList.toggle('open');
185
- });
186
- }
187
 
188
- if (closeBtn && salePanel) {
189
- closeBtn.addEventListener('click', function() {
190
- salePanel.classList.remove('open');
191
- });
192
- }
 
 
 
 
 
 
 
 
 
 
 
193
 
194
- // Close panel when clicking outside
195
- if (salePanel) {
196
- salePanel.addEventListener('click', function(e) {
197
- if (e.target === salePanel) {
198
- salePanel.classList.remove('open');
199
- }
200
- });
201
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
 
203
- // Render products
204
- renderProducts();
 
 
 
205
 
206
- console.log('[BIG SALE] Floating promotion initialized with ' + BIG_SALE_PRODUCTS.length + ' products');
 
 
 
 
 
 
 
207
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
- // Initialize when DOM is ready
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
210
  if (document.readyState === 'loading') {
211
- document.addEventListener('DOMContentLoaded', initBigSale);
212
  } else {
213
  initBigSale();
214
  }
215
- })();
 
 
 
1
+ // BIG SALE Floating Promotion Module v1.0
2
+ // Integrates BIG SALE promotion button with product detail modal
3
+ // Compatible with bep40/vai-avatar2 space architecture
4
 
5
+ console.log('[BIG SALE] Module loaded (v1.0)');
6
+
7
+ // BIG SALE Product Data — 23 products with discount info
8
  const BIG_SALE_PRODUCTS = [
9
+ { stt: 1, code: "MC-7086HS", name: "MÁY HÚT", category: "MÁY HÚT", qty: 3, price: "11.389.000", discount: "55%", bigsale: "5.125.050", status: "HÀNG MỚI" },
10
+ { stt: 2, code: "MH-70SMC", name: "MÁY HÚT ECO", category: "MÁY HÚT", qty: 2, price: "4.620.000", discount: "60%", bigsale: "1.848.000", status: "HÀNG MỚI" },
11
+ { stt: 3, code: "MH-90SMC", name: "MÁY HÚT ECO", category: "MÁY HÚT", qty: 4, price: "5.060.000", discount: "60%", bigsale: "2.024.000", status: "HÀNG MỚI" },
12
+ { stt: 4, code: "MH-600GT", name: "MÁY HÚT", category: "MÁY HÚT", qty: 5, price: "8.208.000", discount: "50%", bigsale: "4.104.000", status: "HÀNG MỚI" },
13
+ { stt: 5, code: "AS-9602DG", name: "BẾP 2 GAS", category: "BẾP GAS", qty: 2, price: "7.815.000", discount: "50%", bigsale: "3.907.500", status: "HÀNG MỚI" },
14
+ { stt: 6, code: "SMART K-450",name: "CHẬU ĐÁ", category: "CHẬU ĐÁ", qty: 1, price: "21.109.000", discount: "55%", bigsale: "9.499.050", status: "HÀNG MỚI" },
15
+ { stt: 7, code: "MS-1022D", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 4, price: "5.852.000", discount: "50%", bigsale: "2.926.000", status: "HÀNG MỚI" },
16
+ { stt: 8, code: "MS-2025", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 1, price: "5.700.000", discount: "55%", bigsale: "2.565.000", status: "HÀNG MỚI" },
17
+ { stt: 9, code: "MS-6070", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 11, price: "6.464.000", discount: "50%", bigsale: "3.232.000", status: "HÀNG MỚI" },
18
+ { stt: 10, code: "MS-5066W", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 8, price: "4.385.000", discount: "50%", bigsale: "2.192.500", status: "HÀNG MỚI" },
19
+ { stt: 11, code: "MS-5082W", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 3, price: "6.350.000", discount: "50%", bigsale: "3.175.000", status: "HÀNG MỚI" },
20
+ { stt: 12, code: "MS-862", name: "CHẬU RỰA", category: "CHẬU RỰA", qty: 3, price: "12.960.000", discount: "55%", bigsale: "5.832.000", status: "HÀNG MỚI" },
21
+ { stt: 13, code: "MPC-5KCB", name: "BỘ LỌC NƯỚC", category: "LỌC NƯỚC", qty: 1, price: "10.702.000", discount: "50%", bigsale: "5.351.000", status: "HÀNG MỚI" },
22
+ { stt: 14, code: "K061S", name: "VÒI", category: "VÒI", qty: 10, price: "3.056.000", discount: "50%", bigsale: "1.528.000", status: "HÀNG MỚI" },
23
+ { stt: 15, code: "K569SN", name: "VÒI ECO", category: "VÒI", qty: 2, price: "3.520.000", discount: "55%", bigsale: "1.584.000", status: "HÀNG MỚI" },
24
+ { stt: 16, code: "K525B", name: "VÒI", category: "VÒI", qty: 2, price: "2.916.000", discount: "55%", bigsale: "1.312.200", status: "HÀNG MỚI" },
25
+ { stt: 17, code: "K130S", name: "VÒI", category: "VÒI", qty: 4, price: "4.104.000", discount: "55%", bigsale: "1.846.800", status: "HÀNG MỚI" },
26
+ { stt: 18, code: "K136A", name: "VÒI", category: "VÒI", qty: 2, price: "2.430.000", discount: "55%", bigsale: "1.093.500", status: "HÀNG MỚI" },
27
+ { stt: 19, code: "K501B", name: "VÒI", category: "VÒI", qty: 2, price: "5.076.000", discount: "55%", bigsale: "2.284.200", status: "HÀNG MỚI" },
28
+ { stt: 20, code: "MST-6667", name: "LÓT NỒI", category: "PHỤ KIỆN", qty: 25, price: "255.000", discount: "70%", bigsale: "76.500", status: "HÀNG MỚI" },
29
+ { stt: 21, code: "MMPM-657A", name: "XAY TIÊU", category: "PHỤ KIỆN", qty: 34, price: "295.000", discount: "70%", bigsale: "88.500", status: "HÀNG MỚI" },
30
+ { stt: 22, code: "MOVS-10128",name: "BỘ ĐỰNG DẦU", category: "PHỤ KIỆN", qty: 2, price: "491.000", discount: "70%", bigsale: "147.300", status: "HÀNG MỚI" },
31
+ { stt: 23, code: "BỘ LÀM SẠCH NHÀ BẾP", name: "BỘ LÀM SẠCH NHÀ BẾP", category: "PHỤ KIỆN", qty: 8, price: "720.000", discount: "70%", bigsale: "216.000", status: "HÀNG MỚI" }
32
  ];
33
 
34
+ // Format VND currency
35
+ function formatVND(price) {
36
+ const num = parseInt(price.replace(/\./g, ''));
37
+ if (isNaN(num)) return price;
38
+ return new Intl.NumberFormat('vi-VN', { style: 'currency', currency: 'VND' }).format(num);
39
+ }
40
 
41
+ // Build a product card HTML string
42
+ function buildProductCard(p) {
43
+ const discountClass = p.discount.includes('7') ? 'discount-high' : 'discount-mid';
44
+ return `
45
+ <div class="big-sale-product" data-code="${p.code}" data-stt="${p.stt}">
46
+ <div class="big-sale-product-header">
47
+ <span class="big-sale-stt">S${p.stt}</span>
48
+ <span class="big-sale-discount ${discountClass}">-${p.discount}</span>
49
+ </div>
50
+ <div class="big-sale-product-name">${p.name}</div>
51
+ <div class="big-sale-product-code">${p.code}</div>
52
+ <div class="big-sale-product-meta">
53
+ <span class="big-sale-qty">SL: ${p.qty}</span>
54
+ <span class="big-sale-status">HÀNG MỚI</span>
55
+ </div>
56
+ <div class="big-sale-price-row">
57
+ <span class="big-sale-price-original">${formatVND(p.price)}</span>
58
+ <span class="big-sale-price-new">${formatVND(p.bigsale)}</span>
59
+ </div>
60
+ </div>`;
61
+ }
62
 
63
+ // Create the floating button + panel
64
+ function createBigSaleElements() {
65
+ // Check if already exists
66
+ if (document.getElementById('big-sale-floating')) return;
 
 
 
 
 
 
 
 
 
67
 
68
+ const floating = document.createElement('button');
69
+ floating.id = 'big-sale-floating';
70
+ floating.setAttribute('aria-label', 'Chương trình BIG SALE');
71
+ floating.setAttribute('title', 'Chương trình BIG SALE');
72
+ floating.innerHTML = `
73
+ <div class="big-sale-btn-content">
74
+ <span class="big-sale-badge">BIG SALE</span>
75
+ <span class="big-sale-count">${BIG_SALE_PRODUCTS.length} SP</span>
76
+ </div>
77
+ <div class="big-sale-chevron">▼</div>
78
+ `;
 
 
 
 
 
 
 
79
 
80
+ const panel = document.createElement('div');
81
+ panel.id = 'big-sale-panel';
82
+ panel.setAttribute('role', 'dialog');
83
+ panel.setAttribute('aria-label', 'Chương trình khuyến mãi BIG SALE');
84
+ panel.innerHTML = `
85
+ <div class="big-sale-panel-header">
86
+ <div class="big-sale-panel-title">
87
+ <span class="big-sale-panel-icon">🔥</span>
88
+ <span>CHƯƠNG TRÌNH BIG SALE</span>
89
+ </div>
90
+ <span class="big-sale-product-count">${BIG_SALE_PRODUCTS.length} sản phẩm</span>
91
+ </div>
92
+ <div class="big-sale-product-list">
93
+ ${BIG_SALE_PRODUCTS.map(p => buildProductCard(p)).join('')}
94
+ </div>
95
+ <div class="big-sale-panel-footer">
96
+ <button class="big-sale-view-all-btn">Xem tất cả sản phẩm</button>
97
+ </div>
98
+ `;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
 
100
+ document.body.appendChild(floating);
101
+ document.body.appendChild(panel);
102
 
103
+ attachBigSaleEventListeners(floating, panel);
104
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
+ // Event listeners
107
+ function attachBigSaleEventListeners(floating, panel) {
108
+ let isOpen = false;
 
 
 
 
 
 
 
109
 
110
+ floating.addEventListener('click', function(e) {
111
+ e.stopPropagation();
112
+ isOpen = !isOpen;
113
+ panel.classList.toggle('open', isOpen);
114
+ floating.classList.toggle('open', isOpen);
115
+ });
116
 
117
+ // Close when clicking outside
118
+ document.addEventListener('click', function(e) {
119
+ if (isOpen && !panel.contains(e.target) && !floating.contains(e.target)) {
120
+ panel.classList.remove('open');
121
+ floating.classList.remove('open');
122
+ isOpen = false;
123
+ }
124
+ });
125
 
126
+ // Product click → open detail modal
127
+ const products = panel.querySelectorAll('.big-sale-product');
128
+ products.forEach(card => {
129
+ card.addEventListener('click', function(e) {
130
+ e.stopPropagation();
131
+ const stt = parseInt(this.getAttribute('data-stt'));
132
+ const product = BIG_SALE_PRODUCTS.find(p => p.stt === stt);
133
+ if (product) {
134
+ openBigSaleDetail(product);
135
+ }
136
+ });
137
+ });
138
 
139
+ // "Xem tất cả" button
140
+ const viewAllBtn = panel.querySelector('.big-sale-view-all-btn');
141
+ if (viewAllBtn) {
142
+ viewAllBtn.addEventListener('click', function(e) {
143
+ e.stopPropagation();
144
+ closeBigSalePanel();
145
+ if (window.vaistudioToggle && typeof window.vaistudioToggle === 'function') {
146
+ window.vaistudioToggle();
147
+ } else {
148
+ const toggle = document.getElementById('vaistudio-toggle');
149
+ if (toggle) toggle.click();
150
+ }
151
+ });
152
+ }
153
+ }
154
 
155
+ // Open vaistudio detail modal with BIG SALE product info
156
+ function openBigSaleDetail(product) {
157
+ const overlay = document.getElementById('vaistudio-detail-overlay');
158
+ const modal = document.getElementById('vaistudio-detail-modal');
159
+ if (!overlay || !modal) return;
160
 
161
+ // Set product title and code
162
+ const titleEl = document.getElementById('detail-title');
163
+ const modelEl = document.getElementById('detail-model');
164
+ const brandEl = document.getElementById('detail-brand');
165
+ const priceEl = document.getElementById('detail-price');
166
 
167
+ if (titleEl) titleEl.textContent = product.name;
168
+ if (modelEl) modelEl.textContent = `Mã: ${product.code}`;
169
+ if (brandEl) {
170
+ brandEl.textContent = product.category;
171
+ brandEl.style.background = '#fff1f2';
172
+ brandEl.style.color = '#e11d48';
173
+ }
174
+ if (priceEl) {
175
+ priceEl.innerHTML = `
176
+ <div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
177
+ <span style="color:#c2410c">${formatVND(product.bigsale)}</span>
178
+ <span style="font-size:0.8rem;color:#64748b;text-decoration:line-through">${formatVND(product.price)}</span>
179
+ <span style="font-size:0.85rem;background:#fef3c7;color:#92400e;padding:4px 10px;border-radius:8px;font-weight:700">-${product.discount}</span>
180
+ </div>
181
+ `;
182
+ }
183
 
184
+ // Set images (show placeholder with category emoji)
185
+ const imagesEl = document.getElementById('detail-images');
186
+ if (imagesEl) {
187
+ imagesEl.innerHTML = `
188
+ <div style="flex:1;min-width:120px;height:120px;background:linear-gradient(135deg,#f1f5f9,#e2e8f0);border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:2.5rem">
189
+ ${getCategoryEmoji(product.category)}
190
+ </div>
191
+ <div style="flex:1;min-width:120px;height:120px;background:linear-gradient(135deg,#fef3c7,#fef9c3);border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:2.5rem">
192
+ ${getCategoryEmoji(product.category)}
193
+ </div>
194
+ `;
195
+ }
196
+
197
+ // Show BIG SALE pricing info in summary
198
+ const summaryEl = document.getElementById('detail-summary');
199
+ if (summaryEl) {
200
+ summaryEl.style.display = 'block';
201
+ summaryEl.innerHTML = `
202
+ <div style="margin-bottom:8px"><strong>🔥 Giá BigSale:</strong> ${formatVND(product.bigsale)}</div>
203
+ <div style="margin-bottom:8px"><strong>💰 Giá bán lẻ:</strong> ${formatVND(product.price)} → <span style="color:#c2410d;font-weight:700">${formatVND(product.bigsale)}</span></div>
204
+ <div style="margin-bottom:8px"><strong>🏷️ Chiết khấu:</strong> <span style="color:#dc2626;font-weight:700">-${product.discount}</span></div>
205
+ <div style="margin-bottom:8px"><strong>📦 Tình trạng:</strong> <span style="color:#16a34a;font-weight:600">${product.status}</span></div>
206
+ <div><strong>💡 Danh mục:</strong> ${product.category}</div>
207
+ `;
208
+ }
209
 
210
+ // Hide features and specs sections
211
+ const featuresEl = document.getElementById('detail-features');
212
+ const specsEl = document.getElementById('detail-specs');
213
+ if (featuresEl) featuresEl.style.display = 'none';
214
+ if (specsEl) specsEl.style.display = 'none';
215
 
216
+ overlay.style.display = 'flex';
217
+
218
+ // Close vaistudio panel if open
219
+ const vaistudioPanel = document.getElementById('vaistudio-panel');
220
+ if (vaistudioPanel && vaistudioPanel.classList.contains('open')) {
221
+ vaistudioPanel.classList.remove('open');
222
+ const toggle = document.getElementById('vaistudio-toggle');
223
+ if (toggle) toggle.classList.remove('open');
224
  }
225
+ }
226
+
227
+ // Get emoji for category
228
+ function getCategoryEmoji(category) {
229
+ const map = {
230
+ "MÁY HÚT": "🧹",
231
+ "BẾP GAS": "🔥",
232
+ "CHẬU ĐÁ": "🧊",
233
+ "CHẬU RỰA": "🚰",
234
+ "LỌC NƯỚC": "💧",
235
+ "VÒI": "🚿",
236
+ "PHỤ KIỆN": "🧰"
237
+ };
238
+ return map[category] || "📦";
239
+ }
240
 
241
+ // Close BIG SALE panel
242
+ function closeBigSalePanel() {
243
+ const panel = document.getElementById('big-sale-panel');
244
+ const floating = document.getElementById('big-sale-floating');
245
+ if (panel) panel.classList.remove('open');
246
+ if (floating) floating.classList.remove('open');
247
+ }
248
+
249
+ // Initialize when DOM is ready
250
+ function initBigSale() {
251
+ createBigSaleElements();
252
+ console.log('[BIG SALE] Floating promotion initialized with 23 products');
253
+ }
254
+
255
+ // Handle dynamic DOM changes
256
+ function tryInitBigSale(retries = 20) {
257
  if (document.readyState === 'loading') {
258
+ document.addEventListener('DOMContentLoaded', () => initBigSale());
259
  } else {
260
  initBigSale();
261
  }
262
+ }
263
+
264
+ tryInitBigSale();