File size: 6,511 Bytes
bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c 75ce843 bbed41c | 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 | <!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>
<!-- Libraries for quotation export -->
<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>
<!-- V.AI STUDIO Excel Multi-Download Fix v2.0 -->
<script src="vai-excel-fix-v2.js"></script>
<style>
/* Minimal styles for testing */
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>
// Sample data for testing
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>';
}
}
// Auto test on load
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> |