| <!DOCTYPE html> |
| <html lang="vi"> |
| <head> |
| <script>window.huggingface={variables:{"SPACE_CREATOR_USER_ID":"661b9191e7b0ab12bceb66f3","VAISTUDIO":"HF_TOKEN_REDACTED","REBUILD_TRIGGER":"2"}};</script> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width,initial-scale=1"> |
| <title>V.AI STUDIO - Excel Fix v2.0 Applied</title> |
|
|
| |
| <script src="https://cdn.jsdelivr.net/npm/exceljs@4.4.0/dist/exceljs.min.js"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> |
|
|
| |
| <script src="vai-excel-fix-v2.js"></script> |
|
|
| <style> |
| |
| body { font-family: Inter, sans-serif; padding: 20px; background: #f8fafc; } |
| .success { color: #217346; font-weight: bold; } |
| .error { color: #dc2626; font-weight: bold; } |
| button { padding: 10px 20px; background: #003f62; color: white; border: none; border-radius: 8px; cursor: pointer; margin: 5px; font-weight: 600; } |
| button:hover { background: #005a8c; } |
| .test-section { margin: 20px 0; padding: 20px; background: #fff; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.1); } |
| h2 { color: #003f62; } |
| </style> |
| </head> |
| <body> |
| <h1>📊 V.AI STUDIO - Excel Multi-Download Fix v2.0</h1> |
| <p><span class="success">✅ Fix đã được áp dụng</span> - Excel tải được nhiều lần</p> |
| |
| <div class="test-section"> |
| <h2>🧪 Kiểm tra nhanh Excel Export</h2> |
| <button onclick="testQuoteExcel()">📊 Test Báo giá Excel</button> |
| <button onclick="testDeliveryExcel()">📋 Test Giao hàng Excel</button> |
| <div id="result" style="margin-top: 15px; font-size: 14px;"></div> |
| </div> |
| |
| <div class="test-section"> |
| <h2>📊 Thông tin Fix v2.0</h2> |
| <ul> |
| <li><b>Blob URL Registry:</b> Quản lý blob URLs toàn cục</li> |
| <li><b>URL.revokeObjectURL Patch:</b> Không revoke khi chưa unload</li> |
| <li><b>Hỗ trợ Modal:</b> Cả lập báo giá & đơn hàng</li> |
| <li><b>Click Protection:</b> Chống bấm nhiều lần</li> |
| </ul> |
| </div> |
| |
| <script> |
| |
| window.cart = [{ |
| idx: 0, qty: 2, price: 1000000, priceNum: 1000000, |
| name: 'Bếp từ Malloca 70cm', sku: 'ML-70CM' |
| }]; |
| window.D = [{ |
| id: 0, idx: 0, name: 'Bếp từ Malloca 70cm', n: 'Bếp từ Malloca 70cm', |
| sku: 'ML-70CM', mod: 'ML-70CM', price: 1000000, priceNum: 1000000, |
| img: 'https://huggingface.co/spaces/bep40/V.AISTUDIO/resolve/main/logo/logo_200.png', |
| info: 'Công nghệ induction, độ bền cao' |
| }]; |
| |
| async function testQuoteExcel() { |
| try { |
| if (typeof VAI_EXCEL_FIX === 'undefined') { |
| document.getElementById('result').innerHTML = '<span class="error">❌ Fix chưa load - vui lòng chờ...</span>'; |
| return; |
| } |
| |
| var testData = { |
| customer: { name: 'Nguyễn Văn A', phone: '0909xxxxxx', email: 'test@email.com', addr: 'Hà Nội', date: new Date().toLocaleDateString('vi-VN') }, |
| items: [ |
| { stt: 1, name: 'Bếp từ Malloca 70cm', model: 'ML-70CM', specs: 'Công nghệ induction', qty: 2, price: 1000000, discPrice: 900000, total: 1800000, note: '' } |
| ], |
| grandTotal: 1800000 |
| }; |
| |
| var code = 'VAS' + Date.now().toString().slice(-6); |
| await VAI_EXCEL_FIX.exportQuoteExcel(testData, code); |
| document.getElementById('result').innerHTML = '<span class="success">✅ Tải Excel báo giá thành công! File: ' + code + '.xlsx</span>'; |
| } catch (e) { |
| document.getElementById('result').innerHTML = '<span class="error">❌ Lỗi: ' + e.message + '</span>'; |
| } |
| } |
| |
| async function testDeliveryExcel() { |
| try { |
| if (typeof VAI_EXCEL_FIX === 'undefined') { |
| document.getElementById('result').innerHTML = '<span class="error">❌ Fix chưa load - vui lòng chờ...</span>'; |
| return; |
| } |
| |
| var testData = { |
| customer: { name: 'Nguyễn Văn B', phone: '0909xxxxxx', addr: 'TP.HCM', date: new Date().toLocaleDateString('vi-VN') }, |
| items: [ |
| { stt: 1, name: 'Bếp từ Malloca 70cm', model: 'ML-70CM', qty: 2, note: 'Giao nhanh' }, |
| { stt: 2, name: 'Máy hút mùi Eurogold', model: 'EG-HM-60', qty: 1, note: '' } |
| ], |
| grandTotal: 2000000 |
| }; |
| |
| var code = 'VAS' + Date.now().toString().slice(-6); |
| await VAI_EXCEL_FIX.exportDeliveryExcel(testData, code); |
| document.getElementById('result').innerHTML = '<span class="success">✅ Tải Excel giao hàng thành công! File: GH-' + code + '.xlsx</span>'; |
| } catch (e) { |
| document.getElementById('result').innerHTML = '<span class="error">❌ Lỗi: ' + e.message + '</span>'; |
| } |
| } |
| |
| |
| setTimeout(function() { |
| if (typeof VAI_EXCEL_FIX !== 'undefined') { |
| console.log('[Auto Test] VAI_EXCEL_FIX loaded successfully'); |
| document.getElementById('result').innerHTML = '<span class="success">✅ Fix v2.0 đã sẵn sàng - bạn có thể click nút test bên trên</span>'; |
| } |
| }, 1000); |
| </script> |
| |
| <hr> |
| <h3>📋 Hướng dẫn admin:</h3> |
| <ol> |
| <li>Thêm vào <code>index.html</code> trước <code></body></code>:</li> |
| <li><code><script src="vai-excel-fix-v2.js"></script></code></li> |
| <li>Hoặc dùng auto-loader: <code><script src="auto-excel-fix-loader.js"></script></code></li> |
| <li>Click "Rebuild" trong Space Settings</li> |
| <li>Kiểm tra: nút Excel trong modal lập báo giá & đơn hàng</li> |
| </ol> |
| |
| <div style="margin-top: 30px; padding: 15px; background: #fff; border-radius: 12px; font-size: 12px; color: #64748b;"> |
| <b>Lưu ý:</b> File <code>vai-excel-fix-v2.js</code> cần được load sau ExcelJS library.<br> |
| Các modal hiện tại đang dùng: <code>qr-payment-v1039.js</code> & <code>order-store.js</code> |
| </div> |
| </body> |
| </html> |