Initial commit
This commit is contained in:
66
test_interface.html
Normal file
66
test_interface.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Test Interface TIM</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; padding: 20px; }
|
||||
.success { color: green; }
|
||||
.error { color: red; }
|
||||
pre { background: #f5f5f5; padding: 10px; overflow-x: auto; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test Interface TIM - Diagnostic</h1>
|
||||
|
||||
<div id="status"></div>
|
||||
<div id="result"></div>
|
||||
|
||||
<script>
|
||||
const API_BASE = 'http://localhost:8001';
|
||||
const STAY_ID = '15_23096332';
|
||||
|
||||
async function testAPI() {
|
||||
const statusDiv = document.getElementById('status');
|
||||
const resultDiv = document.getElementById('result');
|
||||
|
||||
statusDiv.innerHTML = '<p>🔄 Test de connexion à l\'API...</p>';
|
||||
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/stays/${STAY_ID}/coding-proposal`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
statusDiv.innerHTML = '<p class="success">✅ API fonctionne correctement!</p>';
|
||||
|
||||
resultDiv.innerHTML = `
|
||||
<h2>Données reçues:</h2>
|
||||
<ul>
|
||||
<li><strong>Stay ID:</strong> ${data.stay_id}</li>
|
||||
<li><strong>DP:</strong> ${data.dp ? data.dp.code + ' - ' + data.dp.label : 'Non disponible'}</li>
|
||||
<li><strong>DR:</strong> ${data.dr ? data.dr.code + ' - ' + data.dr.label : 'Non disponible'}</li>
|
||||
<li><strong>DAS:</strong> ${data.das ? data.das.length : 0} codes</li>
|
||||
<li><strong>CCAM:</strong> ${data.ccam ? data.ccam.length : 0} actes</li>
|
||||
</ul>
|
||||
<h3>JSON complet:</h3>
|
||||
<pre>${JSON.stringify(data, null, 2)}</pre>
|
||||
`;
|
||||
|
||||
} catch (error) {
|
||||
statusDiv.innerHTML = `<p class="error">❌ Erreur: ${error.message}</p>`;
|
||||
resultDiv.innerHTML = `
|
||||
<h3>Détails de l'erreur:</h3>
|
||||
<pre>${error.stack}</pre>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
// Lancer le test au chargement
|
||||
testAPI();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user