permettre le tri des interaction en cliquant sur l'intitulé de la collonne dans l'historique des interaction - Initial Deployment
Browse filesFiles changed (2)
- README.md+7-5
- index.html+824-19
12345678910---title: Pic2emoji: 🏆colorFrom: purplecolorTo: greensdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112---title: pic2emoji: 🐳colorFrom: redcolorTo: redsdk: staticpinned: falsetags:- deepsite---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824<!DOCTYPE html><html lang="fr"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Suivi PIC Valais</title><script src="https://cdn.tailwindcss.com"></script><script src="https://cdn.jsdelivr.net/npm/chart.js"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>.fade-in {animation: fadeIn 0.3s ease-in-out;}@keyframes fadeIn {from { opacity: 0; transform: translateY(10px); }to { opacity: 1; transform: translateY(0); }}.custom-scrollbar::-webkit-scrollbar {width: 6px;}.custom-scrollbar::-webkit-scrollbar-track {background: #f1f1f1;}.custom-scrollbar::-webkit-scrollbar-thumb {background: #888;border-radius: 3px;}.custom-scrollbar::-webkit-scrollbar-thumb:hover {background: #555;}th[data-sort]::after {content: '↓';margin-left: 4px;opacity: 0;transition: opacity 0.2s;}th[data-sort]:hover::after {opacity: 0.5;}th[data-sort].sorted-asc::after {content: '↑';opacity: 1;}th[data-sort].sorted-desc::after {content: '↓';opacity: 1;}</style></head><body class="bg-gray-50 min-h-screen"><div class="container mx-auto px-4 py-8"><!-- Header --><header class="mb-10 text-center"><div class="flex flex-col items-center space-y-6"><div class="flex items-center space-x-6"><img src="https://www.vs.ch/documents/2055992/2056157/Logo_Valais.png" alt="Logo Valais" class="h-20"><div class="text-center"><h1 class="text-4xl md:text-5xl font-bold text-blue-800 leading-tight">Suivi du Programme d'Intégration Cantonal</h1></div></div><p class="text-xl text-gray-600 font-medium">Canton du Valais - Suivi des interactions avec les bénéficiaires</p></div></header><!-- Main Content --><div class="space-y-6"><!-- Top Section - Form and Charts --><div class="grid grid-cols-1 lg:grid-cols-3 gap-6"><!-- Left Column - Form --><div class="lg:col-span-1 bg-white rounded-xl shadow-md p-6 h-fit sticky top-6"><h2 class="text-xl font-semibold text-gray-800 mb-4">Nouvelle interaction</h2><form id="interactionForm" class="space-y-4"><div><label class="block text-sm font-medium text-gray-700 mb-2">Type d'interaction</label><div class="flex space-x-2"><button type="button" data-type="entretien" class="type-btn flex-1 py-2 px-4 border rounded-lg bg-white hover:bg-gray-50 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 flex items-center justify-center space-x-2"><i class="fas fa-user-tie"></i><span>Entretien</span></button><button type="button" data-type="appel" class="type-btn flex-1 py-2 px-4 border rounded-lg bg-white hover:bg-gray-50 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 flex items-center justify-center space-x-2"><i class="fas fa-phone"></i><span>Appel</span></button><button type="button" data-type="email" class="type-btn flex-1 py-2 px-4 border rounded-lg bg-white hover:bg-gray-50 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 flex items-center justify-center space-x-2"><i class="fas fa-envelope"></i><span>Email</span></button></div><input type="hidden" id="type" name="type" value=""></div><div id="sousCategorieContainer"><label for="sousCategorie" class="block text-sm font-medium text-gray-700 mb-1">Sous-catégorie</label><select id="sousCategorie" name="sousCategorie" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"><!-- Options will be populated by JavaScript --></select><input type="hidden" id="pilier" name="pilier" value=""></div><div><label for="date" class="block text-sm font-medium text-gray-700 mb-1">Date</label><input type="date" id="date" name="date" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"></div><div><label for="beneficiaire" class="block text-sm font-medium text-gray-700 mb-1">Bénéficiaire</label><input type="text" id="beneficiaire" name="beneficiaire" placeholder="Nom du bénéficiaire" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"></div><div><label for="notes" class="block text-sm font-medium text-gray-700 mb-1">Notes</label><textarea id="notes" name="notes" rows="3" placeholder="Détails de l'interaction..." class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"></textarea></div><div class="flex space-x-2"><button type="submit" class="flex-1 bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center justify-center space-x-2"><i class="fas fa-save"></i><span>Enregistrer</span></button></div></form></div><!-- Middle and Right Columns - Dashboard Charts --><div class="lg:col-span-2 space-y-6"><div class="bg-white rounded-xl shadow-md p-6"><h2 class="text-xl font-semibold text-gray-800 mb-4">Tableau de bord</h2><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div><h3 class="text-sm font-medium text-gray-700 mb-2">Répartition par pilier</h3><canvas id="pilierChart" height="200"></canvas></div><div><h3 class="text-sm font-medium text-gray-700 mb-2">Répartition par type</h3><canvas id="typeChart" height="200"></canvas></div><div><h3 class="text-sm font-medium text-gray-700 mb-2">Répartition globale</h3><canvas id="pieChart" height="200"></canvas></div><div><h3 class="text-sm font-medium text-gray-700 mb-2">Historique (7 derniers jours)</h3><canvas id="historyChart" height="200"></canvas></div></div></div></div></div><!-- Bottom Section - Interactions List --><div class="space-y-6"><!-- Stats --><div class="grid grid-cols-1 md:grid-cols-3 gap-4"><div class="bg-blue-50 rounded-xl shadow p-4"><div class="flex items-center justify-between"><div><p class="text-sm text-blue-800 font-medium">Arriver avec</p><p class="text-2xl font-bold text-blue-900" id="arriverCount">0</p></div><div class="p-3 rounded-full bg-blue-100 text-blue-800"><i class="fas fa-sign-in-alt text-xl"></i></div></div></div><div class="bg-green-50 rounded-xl shadow p-4"><div class="flex items-center justify-between"><div><p class="text-sm text-green-800 font-medium">Vivre</p><p class="text-2xl font-bold text-green-900" id="vivreCount">0</p></div><div class="p-3 rounded-full bg-green-100 text-green-800"><i class="fas fa-home text-xl"></i></div></div></div><div class="bg-purple-50 rounded-xl shadow p-4"><div class="flex items-center justify-between"><div><p class="text-sm text-purple-800 font-medium">Rencontrer</p><p class="text-2xl font-bold text-purple-900" id="rencontrerCount">0</p></div><div class="p-3 rounded-full bg-purple-100 text-purple-800"><i class="fas fa-handshake text-xl"></i></div></div></div></div><!-- Interactions List --><div class="bg-white rounded-xl shadow-md overflow-hidden"><div class="p-6 border-b border-gray-200 flex justify-between items-center"><h2 class="text-xl font-semibold text-gray-800">Historique des interactions</h2><button id="exportBtn" class="bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200 flex items-center justify-center space-x-2"><i class="fas fa-file-export"></i><span>Exporter en CSV</span></button></div><div class="overflow-y-auto max-h-[500px] custom-scrollbar"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50 sticky top-0"><tr><th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" data-sort="date">Date</th><th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" data-sort="beneficiaire">Bénéficiaire</th><th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" data-sort="pilier">Pilier</th><th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider cursor-pointer hover:bg-gray-100" data-sort="type">Type</th><th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th></tr></thead><tbody id="interactionsList" class="bg-white divide-y divide-gray-200"><!-- Interactions will be populated by JavaScript --><tr id="noInteractions"><td colspan="5" class="px-6 py-4 text-center text-gray-500">Aucune interaction enregistrée</td></tr></tbody></table></div></div></div></div></div><!-- Success Modal --><div id="successModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden"><div class="bg-white rounded-xl shadow-xl w-full max-w-md fade-in"><div class="p-6 text-center"><div class="flex justify-center mb-4"><div class="w-16 h-16 bg-green-100 rounded-full flex items-center justify-center"><i class="fas fa-check text-green-600 text-3xl"></i></div></div><h3 class="text-xl font-bold text-gray-800 mb-2">Enregistrement réussi</h3><p class="text-gray-600 mb-6">L'interaction a bien été enregistrée.</p><button onclick="closeSuccessModal()" class="w-full bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg transition duration-200">Fermer</button></div></div></div><!-- Interaction Details Modal --><div id="detailsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center p-4 z-50 hidden"><div class="bg-white rounded-xl shadow-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto fade-in"><div class="p-6"><div class="flex justify-between items-center mb-4"><h3 class="text-xl font-bold text-gray-800" id="modalTitle">Détails de l'interaction</h3><button id="closeModal" class="text-gray-500 hover:text-gray-700"><i class="fas fa-times"></i></button></div><div class="space-y-4"><div class="grid grid-cols-1 md:grid-cols-2 gap-4"><div><p class="text-sm text-gray-500">Date</p><p class="font-medium" id="modalDate"></p></div><div><p class="text-sm text-gray-500">Bénéficiaire</p><p class="font-medium" id="modalBeneficiaire"></p></div><div><p class="text-sm text-gray-500">Pilier</p><p class="font-medium" id="modalPilier"></p></div><div><p class="text-sm text-gray-500">Sous-catégorie</p><p class="font-medium" id="modalSousCategorie"></p></div><div><p class="text-sm text-gray-500">Type</p><p class="font-medium" id="modalType"></p></div></div><div><p class="text-sm text-gray-500">Notes</p><p class="font-medium whitespace-pre-line" id="modalNotes"></p></div></div><div class="mt-6 flex justify-end space-x-3"><button id="deleteInteraction" class="px-4 py-2 bg-red-100 text-red-700 rounded-lg hover:bg-red-200 transition"><i class="fas fa-trash mr-2"></i>Supprimer</button><button class="px-4 py-2 bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200 transition" onclick="closeModal()"><i class="fas fa-times mr-2"></i>Fermer</button></div></div></div></div><script>// Toutes les sous-catégories regroupéesconst sousCategories = [{ value: "primo-info", label: "Primo-info (Arriver avec)", pilier: "arriver" },{ value: "conseil", label: "Conseil (Arriver avec)", pilier: "arriver" },{ value: "protection", label: "Protection contre la discrimination (Arriver avec)", pilier: "arriver" },{ value: "langue", label: "Langue (Vivre)", pilier: "vivre" },{ value: "petite-enfance", label: "Petite enfance (Vivre)", pilier: "vivre" },{ value: "employabilite", label: "Employabilité (Vivre)", pilier: "vivre" },{ value: "interpretariat", label: "Interprétariat (Rencontrer)", pilier: "rencontrer" },{ value: "vivre-ensemble", label: "Vivre-ensemble (Rencontrer)", pilier: "rencontrer" }];// Pilier labelsconst pilierLabels = {arriver: "Arriver avec",vivre: "Vivre",rencontrer: "Rencontrer"};// Type labelsconst typeLabels = {entretien: "Entretien",appel: "Appel téléphonique",email: "Email"};// Sous-catégorie labelsconst sousCategorieLabels = {"primo-info": "Primo-info","conseil": "Conseil","protection": "Protection contre la discrimination","langue": "Langue","petite-enfance": "Petite enfance","employabilite": "Employabilité","interpretariat": "Interprétariat","vivre-ensemble": "Vivre-ensemble"};// Initialize interactions array from localStorage or empty arraylet interactions = JSON.parse(localStorage.getItem('interactions')) || [];// DOM elementsconst pilierSelect = document.getElementById('pilier');const sousCategorieContainer = document.getElementById('sousCategorieContainer');const sousCategorieSelect = document.getElementById('sousCategorie');const interactionForm = document.getElementById('interactionForm');const interactionsList = document.getElementById('interactionsList');const noInteractions = document.getElementById('noInteractions');const filterPilier = document.getElementById('filterPilier');const filterType = document.getElementById('filterType');const filterDate = document.getElementById('filterDate');const arriverCount = document.getElementById('arriverCount');const vivreCount = document.getElementById('vivreCount');const rencontrerCount = document.getElementById('rencontrerCount');const detailsModal = document.getElementById('detailsModal');const closeModalBtn = document.getElementById('closeModal');const deleteInteractionBtn = document.getElementById('deleteInteraction');// Current interaction being viewed in modallet currentInteractionId = null;// Chart instanceslet pilierChart, typeChart, historyChart, pieChart;// Sorting statelet currentSort = {field: 'date',direction: 'desc'};// Event listenersdocument.addEventListener('DOMContentLoaded', () => {// Add click handlers to sortable headersdocument.querySelectorAll('th[data-sort]').forEach(header => {header.addEventListener('click', () => {const field = header.dataset.sort;if (currentSort.field === field) {currentSort.direction = currentSort.direction === 'asc' ? 'desc' : 'asc';} else {currentSort.field = field;currentSort.direction = 'asc';}renderInteractions();});});// Set today's date as defaultconst today = new Date().toISOString().split('T')[0];document.getElementById('date').value = today;// Initialize sous-categoriesinitSousCategories();// Update counts, render interactions and chartsupdateCounts();renderInteractions();updateCharts();});// Handle type button selectiondocument.querySelectorAll('.type-btn').forEach(btn => {btn.addEventListener('click', () => {document.querySelectorAll('.type-btn').forEach(b => {b.classList.remove('bg-blue-100', 'border-blue-500');});btn.classList.add('bg-blue-100', 'border-blue-500');document.getElementById('type').value = btn.dataset.type;});});interactionForm.addEventListener('submit', (e) => {e.preventDefault();const formData = new FormData(interactionForm);const interaction = {id: Date.now().toString(),date: formData.get('date'),beneficiaire: formData.get('beneficiaire'),pilier: formData.get('pilier'),sousCategorie: formData.get('sousCategorie'),type: formData.get('type'),notes: formData.get('notes')};interactions.unshift(interaction); // Add to beginning of arraysaveInteractions();renderInteractions();updateCounts();updateCharts();showSuccessModal();// Reset form completelyinteractionForm.reset();document.getElementById('date').value = new Date().toISOString().split('T')[0];document.getElementById('type').value = '';document.getElementById('pilier').value = '';document.querySelectorAll('.type-btn').forEach(btn => {btn.classList.remove('bg-blue-100', 'border-blue-500');});});closeModalBtn.addEventListener('click', closeModal);deleteInteractionBtn.addEventListener('click', deleteCurrentInteraction);// Functionsfunction initSousCategories() {sousCategorieSelect.innerHTML = '<option value="">Sélectionnez une catégorie</option>';sousCategories.forEach(cat => {const option = document.createElement('option');option.value = cat.value;option.textContent = cat.label;option.dataset.pilier = cat.pilier;sousCategorieSelect.appendChild(option);});// Add event listener to update pilier when sous-categorie changessousCategorieSelect.addEventListener('change', () => {const selectedOption = sousCategorieSelect.options[sousCategorieSelect.selectedIndex];document.getElementById('pilier').value = selectedOption.dataset.pilier || '';});}function saveInteractions() {localStorage.setItem('interactions', JSON.stringify(interactions));}function renderInteractions() {let filteredInteractions = [...interactions];// Update sort indicatorsdocument.querySelectorAll('th[data-sort]').forEach(header => {header.classList.remove('sorted-asc', 'sorted-desc');if (header.dataset.sort === currentSort.field) {header.classList.add(currentSort.direction === 'asc' ? 'sorted-asc' : 'sorted-desc');}});// Apply sortingfilteredInteractions.sort((a, b) => {let valueA, valueB;if (currentSort.field === 'date') {valueA = new Date(a.date);valueB = new Date(b.date);} else {valueA = a[currentSort.field] || '';valueB = b[currentSort.field] || '';}if (valueA < valueB) {return currentSort.direction === 'asc' ? -1 : 1;}if (valueA > valueB) {return currentSort.direction === 'asc' ? 1 : -1;}return 0;});if (filteredInteractions.length === 0) {noInteractions.classList.remove('hidden');interactionsList.innerHTML = '';interactionsList.appendChild(noInteractions);} else {noInteractions.classList.add('hidden');interactionsList.innerHTML = '';filteredInteractions.forEach(interaction => {const row = document.createElement('tr');row.className = 'hover:bg-gray-50 cursor-pointer';row.dataset.id = interaction.id;// Format date (DD.MM.YYYY)const dateParts = interaction.date.split('-');const formattedDate = `${dateParts[2]}.${dateParts[1]}.${dateParts[0]}`;// Determine badge color based on pilierlet badgeClass = '';if (interaction.pilier === 'arriver') badgeClass = 'bg-blue-100 text-blue-800';else if (interaction.pilier === 'vivre') badgeClass = 'bg-green-100 text-green-800';else badgeClass = 'bg-purple-100 text-purple-800';// Determine icon based on typelet icon = '';if (interaction.type === 'entretien') icon = '<i class="fas fa-user-tie mr-1"></i>';else if (interaction.type === 'appel') icon = '<i class="fas fa-phone mr-1"></i>';else icon = '<i class="fas fa-envelope mr-1"></i>';row.innerHTML = `<td class="px-6 py-4 whitespace-nowrap">${formattedDate}</td><td class="px-6 py-4 whitespace-nowrap">${interaction.beneficiaire || '-'}</td><td class="px-6 py-4 whitespace-nowrap"><span class="px-2 py-1 text-xs rounded-full ${badgeClass}">${pilierLabels[interaction.pilier]}</span></td><td class="px-6 py-4 whitespace-nowrap"><span class="flex items-center">${icon} ${typeLabels[interaction.type]}</span></td><td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium"><button class="text-blue-600 hover:text-blue-900 mr-3 view-btn" data-id="${interaction.id}"><i class="fas fa-eye"></i></button><button class="text-red-600 hover:text-red-900 delete-btn" data-id="${interaction.id}"><i class="fas fa-trash"></i></button></td>`;interactionsList.appendChild(row);});// Add event listeners to view and delete buttonsdocument.querySelectorAll('.view-btn').forEach(btn => {btn.addEventListener('click', (e) => {e.stopPropagation();showInteractionDetails(btn.dataset.id);});});document.querySelectorAll('.delete-btn').forEach(btn => {btn.addEventListener('click', (e) => {e.stopPropagation();deleteInteraction(btn.dataset.id);});});// Add click event to rowsdocument.querySelectorAll('tr[data-id]').forEach(row => {row.addEventListener('click', () => {showInteractionDetails(row.dataset.id);});});}}function updateCounts() {const arriver = interactions.filter(i => i.pilier === 'arriver').length;const vivre = interactions.filter(i => i.pilier === 'vivre').length;const rencontrer = interactions.filter(i => i.pilier === 'rencontrer').length;arriverCount.textContent = arriver;vivreCount.textContent = vivre;rencontrerCount.textContent = rencontrer;}function showInteractionDetails(id) {const interaction = interactions.find(i => i.id === id);if (!interaction) return;currentInteractionId = id;// Format date (DD.MM.YYYY)const dateParts = interaction.date.split('-');const formattedDate = `${dateParts[2]}.${dateParts[1]}.${dateParts[0]}`;// Update modal contentdocument.getElementById('modalTitle').textContent = `Interaction du ${formattedDate}`;document.getElementById('modalDate').textContent = formattedDate;document.getElementById('modalBeneficiaire').textContent = interaction.beneficiaire || '-';document.getElementById('modalPilier').textContent = pilierLabels[interaction.pilier];document.getElementById('modalSousCategorie').textContent = sousCategorieLabels[interaction.sousCategorie] || '-';document.getElementById('modalType').textContent = typeLabels[interaction.type];document.getElementById('modalNotes').textContent = interaction.notes || 'Aucune note';// Show modaldetailsModal.classList.remove('hidden');}function closeModal() {detailsModal.classList.add('hidden');currentInteractionId = null;}function deleteCurrentInteraction() {if (currentInteractionId) {deleteInteraction(currentInteractionId);closeModal();}}function showSuccessModal() {const modal = document.getElementById('successModal');modal.classList.remove('hidden');// Auto-close after 3 secondssetTimeout(() => {closeSuccessModal();}, 3000);}function closeSuccessModal() {document.getElementById('successModal').classList.add('hidden');}function deleteInteraction(id) {if (confirm('Êtes-vous sûr de vouloir supprimer cette interaction ?')) {interactions = interactions.filter(i => i.id !== id);saveInteractions();renderInteractions();updateCounts();updateCharts();}}function updateCharts() {// Destroy existing charts if they existif (document.getElementById('pilierChart')) {if (pilierChart) pilierChart.destroy();}if (document.getElementById('typeChart')) {if (typeChart) typeChart.destroy();}if (document.getElementById('historyChart')) {if (historyChart) historyChart.destroy();}if (document.getElementById('pieChart')) {if (pieChart) pieChart.destroy();}// Pilier Chartconst pilierData = {'Arriver avec': interactions.filter(i => i.pilier === 'arriver').length,'Vivre': interactions.filter(i => i.pilier === 'vivre').length,'Rencontrer': interactions.filter(i => i.pilier === 'rencontrer').length};const pilierCtx = document.getElementById('pilierChart').getContext('2d');pilierChart = new Chart(pilierCtx, {type: 'doughnut',data: {labels: Object.keys(pilierData),datasets: [{data: Object.values(pilierData),backgroundColor: ['#3b82f6', '#10b981', '#8b5cf6'],borderWidth: 1}]},options: {responsive: true,plugins: {legend: {position: 'bottom'}}}});// Type Chartconst typeData = {entretien: interactions.filter(i => i.type === 'entretien').length,appel: interactions.filter(i => i.type === 'appel').length,email: interactions.filter(i => i.type === 'email').length};const typeCtx = document.getElementById('typeChart').getContext('2d');typeChart = new Chart(typeCtx, {type: 'bar',data: {labels: ['Entretien', 'Appel', 'Email'],datasets: [{label: 'Nombre',data: [typeData.entretien, typeData.appel, typeData.email],backgroundColor: ['#6366f1', '#ec4899', '#f59e0b'],borderWidth: 1}]},options: {responsive: true,scales: {y: {beginAtZero: true}}}});// Global Distribution Chart (Pie)const pieData = {'Arriver avec': interactions.filter(i => i.pilier === 'arriver').length,'Vivre': interactions.filter(i => i.pilier === 'vivre').length,'Rencontrer': interactions.filter(i => i.pilier === 'rencontrer').length};const pieCtx = document.getElementById('pieChart').getContext('2d');pieChart = new Chart(pieCtx, {type: 'pie',data: {labels: Object.keys(pieData),datasets: [{data: Object.values(pieData),backgroundColor: ['#3b82f6', '#10b981', '#8b5cf6'],borderWidth: 1}]},options: {responsive: true,plugins: {legend: {position: 'bottom'}}}});// History Chart (last 7 days)const dates = [];const today = new Date();for (let i = 6; i >= 0; i--) {const date = new Date(today);date.setDate(date.getDate() - i);dates.push(date.toISOString().split('T')[0]);}const historyData = dates.map(date => {return interactions.filter(i => i.date === date).length;});const historyCtx = document.getElementById('historyChart').getContext('2d');historyChart = new Chart(historyCtx, {type: 'line',data: {labels: dates.map(date => {const [year, month, day] = date.split('-');return `${day}/${month}`;}),datasets: [{label: 'Interactions',data: historyData,borderColor: '#3b82f6',backgroundColor: 'rgba(59, 130, 246, 0.1)',borderWidth: 2,tension: 0.1,fill: true}]},options: {responsive: true,scales: {y: {beginAtZero: true}}}});}// Export to CSVdocument.getElementById('exportBtn').addEventListener('click', () => {if (interactions.length === 0) {alert('Aucune donnée à exporter');return;}// Create CSV headerlet csv = 'Date,Bénéficiaire,Pilier,Sous-catégorie,Type,Notes\n';// Add data rowsinteractions.forEach(interaction => {const row = [interaction.date,`"${interaction.beneficiaire || ''}"`,pilierLabels[interaction.pilier],sousCategorieLabels[interaction.sousCategorie] || '',typeLabels[interaction.type],`"${interaction.notes || ''}"`];csv += row.join(',') + '\n';});// Create download linkconst blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });const url = URL.createObjectURL(blob);const link = document.createElement('a');link.setAttribute('href', url);link.setAttribute('download', `interactions_pic_${new Date().toISOString().split('T')[0]}.csv`);link.style.visibility = 'hidden';document.body.appendChild(link);link.click();document.body.removeChild(link);});// Initialize charts on loadupdateCharts();</script><p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=masterseb/pic2" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body></html>
README.md+7-5
index.html+824-19