Download index.html from masterseb/pic: direct link, hf CLI and curl.
- Browser
- Download file 35.9 kB
-
https://huggingface.co/spaces/masterseb/pic/resolve/main/index.html
- Command line
-
hf download hf://spaces/masterseb/pic/index.html
-
curl -L -o index.html https://huggingface.co/spaces/masterseb/pic/resolve/main/index.html
35.9 kB
| <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> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .pillar-color-1 { background-color: #E3F2FD; } | |
| .pillar-color-2 { background-color: #E8F5E9; } | |
| .pillar-color-3 { background-color: #FFF8E1; } | |
| .pillar-color-4 { background-color: #F3E5F5; } | |
| .chart-container { | |
| position: relative; | |
| height: 300px; | |
| width: 100%; | |
| } | |
| .fade-in { | |
| animation: fadeIn 0.5s ease-in-out; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-50 min-h-screen"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="mb-8"> | |
| <div class="flex flex-col md:flex-row justify-between items-center"> | |
| <div> | |
| <h1 class="text-3xl font-bold text-gray-800">Suivi PIC Valais</h1> | |
| <p class="text-gray-600">Programme d'Intégration Cantonal</p> | |
| </div> | |
| <img src="https://www.vs.ch/documents/267648/0/logo_etat_du_valais.png" alt="Logo Valais" class="h-16 mt-4 md:mt-0"> | |
| </div> | |
| </header> | |
| <!-- Navigation Tabs --> | |
| <div class="mb-8"> | |
| <div class="flex flex-wrap border-b border-gray-200"> | |
| <button id="dashboard-tab" class="px-4 py-2 font-medium text-blue-600 border-b-2 border-blue-600">Tableau de bord</button> | |
| <button id="add-tab" class="px-4 py-2 font-medium text-gray-500 hover:text-gray-700">Ajouter un suivi</button> | |
| <button id="stats-tab" class="px-4 py-2 font-medium text-gray-500 hover:text-gray-700">Statistiques</button> | |
| <button id="export-btn" class="px-4 py-2 font-medium text-gray-500 hover:text-gray-700 ml-auto"> | |
| <i class="fas fa-download mr-2"></i>Exporter CSV | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Dashboard Content --> | |
| <div id="dashboard-content" class="fade-in"> | |
| <!-- Search and Filter --> | |
| <div class="mb-6 flex flex-col md:flex-row gap-4"> | |
| <div class="relative flex-grow"> | |
| <input type="text" placeholder="Rechercher..." class="w-full pl-10 pr-4 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <i class="fas fa-search absolute left-3 top-3 text-gray-400"></i> | |
| </div> | |
| <select class="border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option>Tous les piliers</option> | |
| <option>Primo-info</option> | |
| <option>Conseils</option> | |
| <option>Protection contre la discrimination</option> | |
| <option>Langue et formation</option> | |
| <option>Petite enfance</option> | |
| <option>Employabilité</option> | |
| <option>Interprétariat</option> | |
| <option>Vivre-ensemble</option> | |
| </select> | |
| <select class="border rounded-lg px-4 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option>Tous les types</option> | |
| <option>Appel</option> | |
| <option>Entretien</option> | |
| <option>Email</option> | |
| </select> | |
| </div> | |
| <!-- Stats Cards --> | |
| <div class="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8"> | |
| <div class="bg-white p-4 rounded-lg shadow"> | |
| <div class="flex items-center"> | |
| <div class="p-3 rounded-full bg-blue-100 text-blue-600 mr-4"> | |
| <i class="fas fa-phone-alt text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-gray-500">Appels</p> | |
| <h3 class="text-2xl font-bold" id="calls-count">0</h3> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow"> | |
| <div class="flex items-center"> | |
| <div class="p-3 rounded-full bg-green-100 text-green-600 mr-4"> | |
| <i class="fas fa-handshake text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-gray-500">Entretiens</p> | |
| <h3 class="text-2xl font-bold" id="meetings-count">0</h3> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow"> | |
| <div class="flex items-center"> | |
| <div class="p-3 rounded-full bg-yellow-100 text-yellow-600 mr-4"> | |
| <i class="fas fa-envelope text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-gray-500">Emails</p> | |
| <h3 class="text-2xl font-bold" id="emails-count">0</h3> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-white p-4 rounded-lg shadow"> | |
| <div class="flex items-center"> | |
| <div class="p-3 rounded-full bg-purple-100 text-purple-600 mr-4"> | |
| <i class="fas fa-users text-xl"></i> | |
| </div> | |
| <div> | |
| <p class="text-gray-500">Bénéficiaires</p> | |
| <h3 class="text-2xl font-bold" id="beneficiaries-count">0</h3> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Recent Activities --> | |
| <div class="bg-white rounded-lg shadow overflow-hidden mb-8"> | |
| <div class="px-6 py-4 border-b"> | |
| <h2 class="text-xl font-semibold text-gray-800">Activités récentes</h2> | |
| </div> | |
| <div class="divide-y divide-gray-200" id="activities-list"> | |
| <!-- Activities will be added here by JavaScript --> | |
| </div> | |
| </div> | |
| <!-- Pillar Distribution --> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-8"> | |
| <div class="bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-lg font-semibold mb-4">Répartition par pilier</h3> | |
| <div class="chart-container"> | |
| <canvas id="pillarChart"></canvas> | |
| </div> | |
| </div> | |
| <div class="bg-white p-6 rounded-lg shadow"> | |
| <h3 class="text-lg font-semibold mb-4">Types de contact</h3> | |
| <div class="chart-container"> | |
| <canvas id="typeChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Add Content (hidden by default) --> | |
| <div id="add-content" class="hidden fade-in"> | |
| <div class="bg-white rounded-lg shadow overflow-hidden max-w-2xl mx-auto"> | |
| <div class="px-6 py-4 border-b"> | |
| <h2 class="text-xl font-semibold text-gray-800">Nouveau suivi</h2> | |
| </div> | |
| <div class="p-6"> | |
| <form id="tracking-form"> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="contact-type">Type de contact</label> | |
| <div class="flex space-x-4"> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="contact-type" value="call" class="form-radio text-blue-600" checked> | |
| <span class="ml-2">Appel</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="contact-type" value="meeting" class="form-radio text-green-600"> | |
| <span class="ml-2">Entretien</span> | |
| </label> | |
| <label class="inline-flex items-center"> | |
| <input type="radio" name="contact-type" value="email" class="form-radio text-yellow-600"> | |
| <span class="ml-2">Email</span> | |
| </label> | |
| </div> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="date">Date</label> | |
| <input type="date" id="date" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="beneficiary">Bénéficiaire</label> | |
| <input type="text" id="beneficiary" placeholder="Nom du bénéficiaire" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="pillar">Pilier PIC</label> | |
| <select id="pillar" class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| <option value="">Sélectionner un pilier</option> | |
| <option value="1">Primo-info</option> | |
| <option value="2">Conseils</option> | |
| <option value="3">Protection contre la discrimination</option> | |
| <option value="4">Langue et formation</option> | |
| <option value="5">Petite enfance</option> | |
| <option value="6">Employabilité</option> | |
| <option value="7">Interprétariat</option> | |
| <option value="8">Vivre-ensemble</option> | |
| </select> | |
| </div> | |
| <div class="mb-4"> | |
| <label class="block text-gray-700 mb-2" for="details">Détails</label> | |
| <textarea id="details" rows="4" placeholder="Notes sur le contact..." class="w-full px-3 py-2 border rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea> | |
| </div> | |
| <div class="flex justify-end"> | |
| <button type="button" id="cancel-btn" class="px-4 py-2 mr-2 text-gray-700 border rounded-lg hover:bg-gray-100">Annuler</button> | |
| <button type="submit" class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"> | |
| Enregistrer | |
| </button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Stats Content (hidden by default) --> | |
| <div id="stats-content" class="hidden fade-in"> | |
| <div class="bg-white rounded-lg shadow overflow-hidden mb-8"> | |
| <div class="px-6 py-4 border-b"> | |
| <h2 class="text-xl font-semibold text-gray-800">Statistiques globales</h2> | |
| </div> | |
| <div class="p-6"> | |
| <div class="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8"> | |
| <div> | |
| <h3 class="text-lg font-semibold mb-4">Activités par mois</h3> | |
| <div class="chart-container"> | |
| <canvas id="monthlyChart"></canvas> | |
| </div> | |
| </div> | |
| <div> | |
| <h3 class="text-lg font-semibold mb-4">Répartition par bénéficiaire</h3> | |
| <div class="chart-container"> | |
| <canvas id="beneficiaryChart"></canvas> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="overflow-x-auto"> | |
| <table class="min-w-full divide-y divide-gray-200"> | |
| <thead class="bg-gray-50"> | |
| <tr> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Bénéficiaire</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Appels</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Entretiens</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Emails</th> | |
| <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total</th> | |
| </tr> | |
| </thead> | |
| <tbody class="bg-white divide-y divide-gray-200" id="stats-table-body"> | |
| <!-- Stats rows will be added here by JavaScript --> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> | |
| <script> | |
| // Sample data | |
| let trackings = [ | |
| { id: 1, type: 'call', date: '2023-06-15', beneficiary: 'Jean Dupont', pillar: '1', details: 'Appel pour information sur cours de français' }, | |
| { id: 2, type: 'meeting', date: '2023-06-10', beneficiary: 'Maria Garcia', pillar: '3', details: 'Entretien orientation professionnelle' }, | |
| { id: 3, type: 'email', date: '2023-06-05', beneficiary: 'Ahmed Khan', pillar: '4', details: 'Email concernant accès aux soins' }, | |
| { id: 4, type: 'call', date: '2023-05-28', beneficiary: 'Sophie Martin', pillar: '2', details: 'Appel pour questions sur droits et devoirs' }, | |
| { id: 5, type: 'meeting', date: '2023-05-20', beneficiary: 'Jean Dupont', pillar: '1', details: 'Évaluation niveau de langue' } | |
| ]; | |
| // DOM Elements | |
| const dashboardTab = document.getElementById('dashboard-tab'); | |
| const addTab = document.getElementById('add-tab'); | |
| const statsTab = document.getElementById('stats-tab'); | |
| const exportBtn = document.getElementById('export-btn'); | |
| const dashboardContent = document.getElementById('dashboard-content'); | |
| const addContent = document.getElementById('add-content'); | |
| const statsContent = document.getElementById('stats-content'); | |
| const trackingForm = document.getElementById('tracking-form'); | |
| const cancelBtn = document.getElementById('cancel-btn'); | |
| const activitiesList = document.getElementById('activities-list'); | |
| const statsTableBody = document.getElementById('stats-table-body'); | |
| // Count elements | |
| const callsCount = document.getElementById('calls-count'); | |
| const meetingsCount = document.getElementById('meetings-count'); | |
| const emailsCount = document.getElementById('emails-count'); | |
| const beneficiariesCount = document.getElementById('beneficiaries-count'); | |
| // Charts | |
| let pillarChart, typeChart, monthlyChart, beneficiaryChart; | |
| // Export to CSV | |
| function exportToCSV() { | |
| const headers = ['Type', 'Date', 'Bénéficiaire', 'Pilier', 'Détails']; | |
| const csvContent = [ | |
| headers.join(','), | |
| ...trackings.map(t => [ | |
| t.type === 'call' ? 'Appel' : t.type === 'meeting' ? 'Entretien' : 'Email', | |
| formatDate(t.date), | |
| `"${t.beneficiary}"`, | |
| `Pilier ${t.pillar}`, | |
| `"${t.details}"` | |
| ].join(',')) | |
| ].join('\n'); | |
| const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); | |
| const url = URL.createObjectURL(blob); | |
| const link = document.createElement('a'); | |
| link.setAttribute('href', url); | |
| link.setAttribute('download', `suivi_pic_${new Date().toISOString().slice(0,10)}.csv`); | |
| link.style.visibility = 'hidden'; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| } | |
| // Export to CSV | |
| function exportToCSV() { | |
| const headers = ['Type', 'Date', 'Bénéficiaire', 'Pilier', 'Détails']; | |
| const csvContent = [ | |
| headers.join(','), | |
| ...trackings.map(t => [ | |
| t.type === 'call' ? 'Appel' : t.type === 'meeting' ? 'Entretien' : 'Email', | |
| formatDate(t.date), | |
| `"${t.beneficiary}"`, | |
| `Pilier ${t.pillar}`, | |
| `"${t.details}"` | |
| ].join(',')) | |
| ].join('\n'); | |
| const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' }); | |
| const url = URL.createObjectURL(blob); | |
| const link = document.createElement('a'); | |
| link.setAttribute('href', url); | |
| link.setAttribute('download', `suivi_pic_${new Date().toISOString().slice(0,10)}.csv`); | |
| link.style.visibility = 'hidden'; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| } | |
| // Initialize the app | |
| function initApp() { | |
| updateCounts(); | |
| renderActivities(); | |
| renderStatsTable(); | |
| initCharts(); | |
| setupEventListeners(); | |
| } | |
| // Update counts | |
| function updateCounts() { | |
| const calls = trackings.filter(t => t.type === 'call').length; | |
| const meetings = trackings.filter(t => t.type === 'meeting').length; | |
| const emails = trackings.filter(t => t.type === 'email').length; | |
| const beneficiaries = [...new Set(trackings.map(t => t.beneficiary))].length; | |
| callsCount.textContent = calls; | |
| meetingsCount.textContent = meetings; | |
| emailsCount.textContent = emails; | |
| beneficiariesCount.textContent = beneficiaries; | |
| } | |
| // Render activities | |
| function renderActivities() { | |
| activitiesList.innerHTML = ''; | |
| // Sort by date (newest first) | |
| const sortedTrackings = [...trackings].sort((a, b) => new Date(b.date) - new Date(a.date)); | |
| sortedTrackings.slice(0, 5).forEach(tracking => { | |
| const activityItem = document.createElement('div'); | |
| activityItem.className = 'px-6 py-4 flex items-start'; | |
| let iconClass, iconColor, typeText; | |
| switch(tracking.type) { | |
| case 'call': | |
| iconClass = 'fa-phone-alt'; | |
| iconColor = 'text-blue-500'; | |
| typeText = 'Appel'; | |
| break; | |
| case 'meeting': | |
| iconClass = 'fa-handshake'; | |
| iconColor = 'text-green-500'; | |
| typeText = 'Entretien'; | |
| break; | |
| case 'email': | |
| iconClass = 'fa-envelope'; | |
| iconColor = 'text-yellow-500'; | |
| typeText = 'Email'; | |
| break; | |
| } | |
| const pillarClass = `pillar-color-${tracking.pillar}`; | |
| activityItem.innerHTML = ` | |
| <div class="flex-shrink-0 pt-1"> | |
| <div class="h-10 w-10 rounded-full ${iconColor} flex items-center justify-center"> | |
| <i class="fas ${iconClass} text-lg"></i> | |
| </div> | |
| </div> | |
| <div class="ml-4 flex-1"> | |
| <div class="flex items-center justify-between"> | |
| <h4 class="text-sm font-medium text-gray-900">${tracking.beneficiary}</h4> | |
| <span class="text-xs text-gray-500">${formatDate(tracking.date)}</span> | |
| </div> | |
| <div class="mt-1 flex items-center"> | |
| <span class="text-xs px-2 py-1 rounded-full ${pillarClass} mr-2">${getPillarName(tracking.pillar)}</span> | |
| <span class="text-xs text-gray-500">${typeText}</span> | |
| </div> | |
| <p class="mt-1 text-sm text-gray-600">${tracking.details}</p> | |
| </div> | |
| `; | |
| activitiesList.appendChild(activityItem); | |
| }); | |
| } | |
| // Render stats table | |
| function renderStatsTable() { | |
| statsTableBody.innerHTML = ''; | |
| const beneficiaries = [...new Set(trackings.map(t => t.beneficiary))]; | |
| const stats = beneficiaries.map(beneficiary => { | |
| const beneficiaryTrackings = trackings.filter(t => t.beneficiary === beneficiary); | |
| return { | |
| beneficiary, | |
| calls: beneficiaryTrackings.filter(t => t.type === 'call').length, | |
| meetings: beneficiaryTrackings.filter(t => t.type === 'meeting').length, | |
| emails: beneficiaryTrackings.filter(t => t.type === 'email').length, | |
| total: beneficiaryTrackings.length | |
| }; | |
| }); | |
| stats.sort((a, b) => b.total - a.total).forEach(stat => { | |
| const row = document.createElement('tr'); | |
| row.innerHTML = ` | |
| <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${stat.beneficiary}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${stat.calls}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${stat.meetings}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${stat.emails}</td> | |
| <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 font-semibold">${stat.total}</td> | |
| `; | |
| statsTableBody.appendChild(row); | |
| }); | |
| } | |
| // Initialize charts | |
| function initCharts() { | |
| // Pillar distribution chart | |
| const pillarCtx = document.getElementById('pillarChart').getContext('2d'); | |
| const pillarData = { | |
| labels: ['Primo-info', 'Conseils', 'Protection contre la discrimination', 'Langue et formation', 'Petite enfance', 'Employabilité', 'Interprétariat', 'Vivre-ensemble'], | |
| datasets: [{ | |
| data: [ | |
| trackings.filter(t => t.pillar === '1').length, | |
| trackings.filter(t => t.pillar === '2').length, | |
| trackings.filter(t => t.pillar === '3').length, | |
| trackings.filter(t => t.pillar === '4').length | |
| ], | |
| backgroundColor: [ | |
| '#E3F2FD', | |
| '#E8F5E9', | |
| '#FFF8E1', | |
| '#F3E5F5' | |
| ], | |
| borderWidth: 1 | |
| }] | |
| }; | |
| pillarChart = new Chart(pillarCtx, { | |
| type: 'doughnut', | |
| data: pillarData, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| position: 'right' | |
| } | |
| } | |
| } | |
| }); | |
| // Type distribution chart | |
| const typeCtx = document.getElementById('typeChart').getContext('2d'); | |
| const typeData = { | |
| labels: ['Appels', 'Entretiens', 'Emails'], | |
| datasets: [{ | |
| data: [ | |
| trackings.filter(t => t.type === 'call').length, | |
| trackings.filter(t => t.type === 'meeting').length, | |
| trackings.filter(t => t.type === 'email').length | |
| ], | |
| backgroundColor: [ | |
| '#93C5FD', | |
| '#86EFAC', | |
| '#FDE047' | |
| ], | |
| borderWidth: 1 | |
| }] | |
| }; | |
| typeChart = new Chart(typeCtx, { | |
| type: 'pie', | |
| data: typeData, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { | |
| position: 'right' | |
| } | |
| } | |
| } | |
| }); | |
| // Monthly chart | |
| const monthlyCtx = document.getElementById('monthlyChart').getContext('2d'); | |
| const monthlyData = { | |
| labels: ['Jan', 'Fév', 'Mar', 'Avr', 'Mai', 'Juin'], | |
| datasets: [ | |
| { | |
| label: 'Appels', | |
| data: [3, 5, 4, 6, 7, 4], | |
| backgroundColor: '#3B82F6', | |
| borderColor: '#3B82F6', | |
| borderWidth: 1 | |
| }, | |
| { | |
| label: 'Entretiens', | |
| data: [2, 3, 2, 4, 5, 3], | |
| backgroundColor: '#10B981', | |
| borderColor: '#10B981', | |
| borderWidth: 1 | |
| }, | |
| { | |
| label: 'Emails', | |
| data: [4, 3, 5, 4, 3, 2], | |
| backgroundColor: '#F59E0B', | |
| borderColor: '#F59E0B', | |
| borderWidth: 1 | |
| } | |
| ] | |
| }; | |
| monthlyChart = new Chart(monthlyCtx, { | |
| type: 'bar', | |
| data: monthlyData, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| scales: { | |
| x: { | |
| stacked: false, | |
| }, | |
| y: { | |
| stacked: false, | |
| beginAtZero: true | |
| } | |
| } | |
| } | |
| }); | |
| // Beneficiary chart | |
| const beneficiaryCtx = document.getElementById('beneficiaryChart').getContext('2d'); | |
| const beneficiaries = [...new Set(trackings.map(t => t.beneficiary))]; | |
| const beneficiaryData = { | |
| labels: beneficiaries, | |
| datasets: [{ | |
| label: 'Contacts', | |
| data: beneficiaries.map(b => trackings.filter(t => t.beneficiary === b).length), | |
| backgroundColor: '#8B5CF6', | |
| borderColor: '#8B5CF6', | |
| borderWidth: 1 | |
| }] | |
| }; | |
| beneficiaryChart = new Chart(beneficiaryCtx, { | |
| type: 'bar', | |
| data: beneficiaryData, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| scales: { | |
| y: { | |
| beginAtZero: true | |
| } | |
| } | |
| } | |
| }); | |
| } | |
| // Get pillar name from number | |
| function getPillarName(pillarNumber) { | |
| const pillars = { | |
| '1': 'Primo-info', | |
| '2': 'Conseils', | |
| '3': 'Protection contre la discrimination', | |
| '4': 'Langue et formation', | |
| '5': 'Petite enfance', | |
| '6': 'Employabilité', | |
| '7': 'Interprétariat', | |
| '8': 'Vivre-ensemble' | |
| }; | |
| return pillars[pillarNumber] || `Pilier ${pillarNumber}`; | |
| } | |
| // Format date | |
| function formatDate(dateString) { | |
| const options = { day: 'numeric', month: 'short', year: 'numeric' }; | |
| return new Date(dateString).toLocaleDateString('fr-CH', options); | |
| } | |
| // Setup event listeners | |
| function setupEventListeners() { | |
| // Tab switching | |
| dashboardTab.addEventListener('click', () => { | |
| dashboardTab.classList.add('text-blue-600', 'border-blue-600'); | |
| dashboardTab.classList.remove('text-gray-500'); | |
| addTab.classList.add('text-gray-500'); | |
| addTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| statsTab.classList.add('text-gray-500'); | |
| statsTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| dashboardContent.classList.remove('hidden'); | |
| addContent.classList.add('hidden'); | |
| statsContent.classList.add('hidden'); | |
| }); | |
| addTab.addEventListener('click', () => { | |
| addTab.classList.add('text-blue-600', 'border-blue-600'); | |
| addTab.classList.remove('text-gray-500'); | |
| dashboardTab.classList.add('text-gray-500'); | |
| dashboardTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| statsTab.classList.add('text-gray-500'); | |
| statsTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| addContent.classList.remove('hidden'); | |
| dashboardContent.classList.add('hidden'); | |
| statsContent.classList.add('hidden'); | |
| // Set today's date as default | |
| const today = new Date().toISOString().split('T')[0]; | |
| document.getElementById('date').value = today; | |
| }); | |
| statsTab.addEventListener('click', () => { | |
| statsTab.classList.add('text-blue-600', 'border-blue-600'); | |
| statsTab.classList.remove('text-gray-500'); | |
| dashboardTab.classList.add('text-gray-500'); | |
| dashboardTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| addTab.classList.add('text-gray-500'); | |
| addTab.classList.remove('text-blue-600', 'border-blue-600'); | |
| statsContent.classList.remove('hidden'); | |
| dashboardContent.classList.add('hidden'); | |
| addContent.classList.add('hidden'); | |
| }); | |
| // Form submission | |
| trackingForm.addEventListener('submit', (e) => { | |
| e.preventDefault(); | |
| const type = document.querySelector('input[name="contact-type"]:checked').value; | |
| const date = document.getElementById('date').value; | |
| const beneficiary = document.getElementById('beneficiary').value; | |
| const pillar = document.getElementById('pillar').value; | |
| const details = document.getElementById('details').value; | |
| if (!beneficiary || !pillar) { | |
| alert('Veuillez remplir tous les champs obligatoires'); | |
| return; | |
| } | |
| const newTracking = { | |
| id: trackings.length + 1, | |
| type, | |
| date, | |
| beneficiary, | |
| pillar, | |
| details | |
| }; | |
| trackings.unshift(newTracking); | |
| // Reset form | |
| trackingForm.reset(); | |
| // Update UI | |
| updateCounts(); | |
| renderActivities(); | |
| renderStatsTable(); | |
| updateCharts(); | |
| // Switch to dashboard | |
| dashboardTab.click(); | |
| }); | |
| // Cancel button | |
| cancelBtn.addEventListener('click', () => { | |
| trackingForm.reset(); | |
| dashboardTab.click(); | |
| }); | |
| // Export button | |
| document.getElementById('export-btn').addEventListener('click', exportToCSV); | |
| } | |
| // Update charts with new data | |
| function updateCharts() { | |
| // Update pillar chart | |
| pillarChart.data.datasets[0].data = [ | |
| trackings.filter(t => t.pillar === '1').length, | |
| trackings.filter(t => t.pillar === '2').length, | |
| trackings.filter(t => t.pillar === '3').length, | |
| trackings.filter(t => t.pillar === '4').length | |
| ]; | |
| pillarChart.update(); | |
| // Update type chart | |
| typeChart.data.datasets[0].data = [ | |
| trackings.filter(t => t.type === 'call').length, | |
| trackings.filter(t => t.type === 'meeting').length, | |
| trackings.filter(t => t.type === 'email').length | |
| ]; | |
| typeChart.update(); | |
| // Update beneficiary chart | |
| const beneficiaries = [...new Set(trackings.map(t => t.beneficiary))]; | |
| beneficiaryChart.data.labels = beneficiaries; | |
| beneficiaryChart.data.datasets[0].data = beneficiaries.map(b => | |
| trackings.filter(t => t.beneficiary === b).length | |
| ); | |
| beneficiaryChart.update(); | |
| } | |
| // Initialize the app when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', initApp); | |
| </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/pic" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |