Files
crm.clientright.ru/test_simple_history.html

100 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Простой тест истории</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
.button { background: #007bff; color: white; padding: 15px 30px; border: none; border-radius: 5px; cursor: pointer; margin: 10px; font-size: 16px; }
.button:hover { background: #0056b3; }
.log { background: #f8f9fa; padding: 15px; border-radius: 5px; margin: 10px 0; font-family: monospace; max-height: 400px; overflow-y: auto; }
</style>
</head>
<body>
<h1>🧪 Простой тест истории AI Drawer</h1>
<button class="button" onclick="openDrawer()">Открыть AI Drawer</button>
<button class="button" onclick="closeDrawer()">Закрыть AI Drawer</button>
<div id="console-log" class="log"></div>
<!-- Подключаем AI Drawer -->
<link rel="stylesheet" href="layouts/v7/resources/css/ai-drawer.css">
<script src="layouts/v7/resources/js/ai-drawer.js"></script>
<script>
let aiDrawerInstance;
// Перехватываем console.log для отображения на странице
const originalLog = console.log;
const originalError = console.error;
const logDiv = document.getElementById('console-log');
console.log = function(...args) {
originalLog.apply(console, args);
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement('div');
logEntry.style.color = '#007bff';
logEntry.textContent = `[${timestamp}] LOG: ${args.join(' ')}`;
logDiv.appendChild(logEntry);
logDiv.scrollTop = logDiv.scrollHeight;
};
console.error = function(...args) {
originalError.apply(console, args);
const timestamp = new Date().toLocaleTimeString();
const logEntry = document.createElement('div');
logEntry.style.color = '#dc3545';
logEntry.textContent = `[${timestamp}] ERROR: ${args.join(' ')}`;
logDiv.appendChild(logEntry);
logDiv.scrollTop = logDiv.scrollHeight;
};
// Симулируем CRM контекст
window._USERMETA = {
id: '8',
name: '',
email: ''
};
// Симулируем URL параметры для реального проекта
const urlParams = new URLSearchParams('?module=Contacts&view=Detail&record=82823');
Object.defineProperty(window.location, 'search', {
writable: true,
value: '?module=Contacts&view=Detail&record=82823'
});
function openDrawer() {
console.log('Test: Opening AI Drawer');
if (aiDrawerInstance) {
aiDrawerInstance.open();
} else {
console.error('Test: AI Drawer not initialized');
}
}
function closeDrawer() {
console.log('Test: Closing AI Drawer');
if (aiDrawerInstance) {
aiDrawerInstance.close();
} else {
console.error('Test: AI Drawer not initialized');
}
}
// Инициализация
document.addEventListener('DOMContentLoaded', function() {
console.log('Test: Page loaded, initializing AI Drawer');
try {
aiDrawerInstance = new AIDrawer();
console.log('Test: AI Drawer initialized successfully');
} catch (error) {
console.error('Test: AI Drawer initialization failed:', error);
}
});
</script>
</body>
</html>