File size: 3,450 Bytes
ab64a12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<title>Test Quote 100% - V.AISTUDIO</title>
<script src="quote-ui.js"></script>
<script src="vai-complete-quote.js"></script>
<script src="export-functions.js"></script>
</head>
<body style="padding:40px;font-family:Arial;">

<h1>✅ Test Quote System - 100% Features</h1>

<div style="background:#f0f0f0;padding:20px;border-radius:10px;margin:20px 0;">
    <h3>📋 Danh sách nút kiểm tra:</h3>
    <ul>
        <li>💾 "Lưu" - LUÔN HIỆN (không cần mã)</li>
        <li>📋 "Đơn hàng" - ẨN đến khi nhập V.AISTUDIO</li>
        <li>📦 "GH Excel" - ẨN đến khi nhập V.AISTUDIO</li>
        <li>📦 "GH PDF" - ẨN đến khi nhập V.AISTUDIO</li>
        <li>📄 Xuất Excel - Sẵn sàng</li>
        <li>📄 Xuất PDF - Sẵn sàng</li>
        <li>🖨️ In báo giá - Sẵn sàng</li>
        <li>🔗 Chia sẻ - Sẵn sàng</li>
    </ul>
</div>

<button onclick="testAllFunctions()" style="padding:15px 30px;background:#003f62;color:#fff;border:none;border-radius:10px;font-size:16px;cursor:pointer;margin:10px 0;">
    🧪 Test Tất Cả Functions
</button>

<button onclick="openQuoteTest()" style="padding:15px 30px;background:#db9815;color:#fff;border:none;border-radius:10px;font-size:16px;cursor:pointer;margin:10px 0;display:block;">
    📋 Mở Form Báo Giá Test
</button>

<div id="quoteTestResult" style="margin-top:20px;padding:15px;background:#e8f5e9;border-radius:8px;display:none;">
</div>

<script>
function testAllFunctions() {
    let result = '';
    result += '✅ VAI_ORDERS.save() = ' + (typeof VAI_ORDERS !== 'undefined' && typeof VAI_ORDERS.save === 'function') + '\n';
    result += '✅ exportDeliveryExcel() = ' + (typeof exportDeliveryExcel === 'function') + '\n';
    result += '✅ exportDeliveryPDF() = ' + (typeof exportDeliveryPDF === 'function') + '\n';
    result += '✅ exportExcel() = ' + (typeof exportExcel === 'function') + '\n';
    result += '✅ exportPDF() = ' + (typeof exportPDF === 'function') + '\n';
    result += '✅ printQuotation() = ' + (typeof printQuotation === 'function') + '\n';
    result += '✅ applyAiDiscount() = ' + (typeof applyAiDiscount === 'function') + '\n';
    result += '✅ checkQuoteAccess() = ' + (typeof checkQuoteAccess === 'function') + '\n';
    
    document.getElementById('quoteTestResult').style.display = 'block';
    document.getElementById('quoteTestResult').innerHTML = '<pre>' + result + '</pre>';
    
    console.log('=== TEST RESULTS ===');
    console.log('VAI_ORDERS:', window.VAI_ORDERS);
    console.log('All export functions are ready!');
    
    alert('✅ Test hoàn tất! Kiểm tra Console (F12) để xem chi tiết.');
}

function openQuoteTest() {
    alert('📋 Để test form báo giá thực tế:\n\n1. Nhấn F12 mở Console\n2. Gõ: openQuotation()\n3. Hoặc nhấn nút "Báo giá" trên trang chính\n\n(Nếu index.html đã load các file JS này)');
}

// Auto-test on load
window.addEventListener('load', function() {
    console.log('[Test] Page loaded, checking scripts...');
    setTimeout(function() {
        if (typeof VAI_ORDERS !== 'undefined') {
            console.log('✅ VAI_ORDERS loaded successfully!');
        }
        if (typeof exportDeliveryExcel === 'function') {
            console.log('✅ exportDeliveryExcel loaded successfully!');
        }
    }, 1000);
});
</script>

</body>
</html>