| <!DOCTYPE html> |
| <html lang="fr"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>Formulateur de Projet d'Application</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.4.1/html2canvas.min.js"></script> |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> |
| <style> |
| .section { |
| transition: all 0.3s ease; |
| } |
| .section:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 10px 20px rgba(0,0,0,0.1); |
| } |
| .progress-bar { |
| transition: width 0.5s ease; |
| } |
| textarea { |
| min-height: 100px; |
| } |
| @media print { |
| .no-print { |
| display: none !important; |
| } |
| } |
| </style> |
| </head> |
| <body class="bg-gray-50"> |
| <div class="container mx-auto px-4 py-8 max-w-5xl"> |
| |
| <header class="mb-10 text-center"> |
| <h1 class="text-4xl font-bold text-indigo-700 mb-2">Formulateur de Projet d'Application</h1> |
| <p class="text-gray-600">Définissez les bases de votre projet et générez une synthèse professionnelle</p> |
| |
| |
| <div class="mt-8 mb-6 w-full bg-gray-200 rounded-full h-4"> |
| <div id="progress" class="progress-bar h-4 rounded-full bg-indigo-600" style="width: 0%"></div> |
| </div> |
| </header> |
|
|
| |
| <form id="projectForm" class="space-y-8"> |
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-info-circle mr-3"></i> Informations de Base |
| </h2> |
| |
| <div class="grid md:grid-cols-2 gap-6"> |
| <div> |
| <label for="projectName" class="block text-sm font-medium text-gray-700 mb-1">Nom du Projet*</label> |
| <input type="text" id="projectName" name="projectName" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div> |
| <label for="projectType" class="block text-sm font-medium text-gray-700 mb-1">Type d'Application*</label> |
| <select id="projectType" name="projectType" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| <option value="">Sélectionnez...</option> |
| <option value="Mobile">Mobile (iOS/Android)</option> |
| <option value="Web">Application Web</option> |
| <option value="Desktop">Application Desktop</option> |
| <option value="Hybride">Application Hybride</option> |
| <option value="Autre">Autre</option> |
| </select> |
| </div> |
| |
| <div> |
| <label for="clientName" class="block text-sm font-medium text-gray-700 mb-1">Client/Porteur du Projet*</label> |
| <input type="text" id="clientName" name="clientName" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div> |
| <label for="projectManager" class="block text-sm font-medium text-gray-700 mb-1">Chef de Projet*</label> |
| <input type="text" id="projectManager" name="projectManager" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div class="md:col-span-2"> |
| <label for="projectDescription" class="block text-sm font-medium text-gray-700 mb-1">Description du Projet*</label> |
| <textarea id="projectDescription" name="projectDescription" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-bullseye mr-3"></i> Objectifs |
| </h2> |
| |
| <div class="space-y-6"> |
| <div> |
| <label for="businessGoals" class="block text-sm font-medium text-gray-700 mb-1">Objectifs Business*</label> |
| <textarea id="businessGoals" name="businessGoals" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Ex: Augmenter les ventes de 20%, réduire les coûts opérationnels, etc.</p> |
| </div> |
| |
| <div> |
| <label for="userGoals" class="block text-sm font-medium text-gray-700 mb-1">Objectifs Utilisateurs*</label> |
| <textarea id="userGoals" name="userGoals" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Ex: Simplifier le processus de commande, améliorer l'expérience utilisateur, etc.</p> |
| </div> |
| |
| <div> |
| <label for="successMetrics" class="block text-sm font-medium text-gray-700 mb-1">Indicateurs de Succès*</label> |
| <textarea id="successMetrics" name="successMetrics" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Ex: Taux de conversion, nombre d'utilisateurs actifs, satisfaction client, etc.</p> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-users mr-3"></i> Public Cible |
| </h2> |
| |
| <div class="space-y-6"> |
| <div> |
| <label for="targetAudience" class="block text-sm font-medium text-gray-700 mb-1">Description du Public Cible*</label> |
| <textarea id="targetAudience" name="targetAudience" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Démographie, comportements, besoins spécifiques, etc.</p> |
| </div> |
| |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-3">Personas (Ajoutez jusqu'à 3 personas)</label> |
| <div id="personasContainer" class="space-y-4"> |
| |
| </div> |
| <button type="button" id="addPersona" class="mt-3 px-4 py-2 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition flex items-center"> |
| <i class="fas fa-plus mr-2"></i> Ajouter un Persona |
| </button> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-list-check mr-3"></i> Fonctionnalités Principales |
| </h2> |
| |
| <div class="space-y-6"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-3">Liste des Fonctionnalités (Priorisez avec ☆)</label> |
| <div id="featuresContainer" class="space-y-4"> |
| |
| </div> |
| <button type="button" id="addFeature" class="mt-3 px-4 py-2 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition flex items-center"> |
| <i class="fas fa-plus mr-2"></i> Ajouter une Fonctionnalité |
| </button> |
| </div> |
| |
| <div> |
| <label for="technicalConstraints" class="block text-sm font-medium text-gray-700 mb-1">Contraintes Techniques</label> |
| <textarea id="technicalConstraints" name="technicalConstraints" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Ex: Technologies imposées, intégrations avec des systèmes existants, etc.</p> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-calendar-alt mr-3"></i> Planning & Budget |
| </h2> |
| |
| <div class="grid md:grid-cols-2 gap-6"> |
| <div> |
| <label for="startDate" class="block text-sm font-medium text-gray-700 mb-1">Date de Début Prévisionnelle</label> |
| <input type="date" id="startDate" name="startDate" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div> |
| <label for="endDate" class="block text-sm font-medium text-gray-700 mb-1">Date de Fin Prévisionnelle</label> |
| <input type="date" id="endDate" name="endDate" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div> |
| <label for="budget" class="block text-sm font-medium text-gray-700 mb-1">Budget Estimé (€)</label> |
| <input type="number" id="budget" name="budget" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div> |
| <label for="teamSize" class="block text-sm font-medium text-gray-700 mb-1">Taille de l'Équipe</label> |
| <input type="number" id="teamSize" name="teamSize" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"> |
| </div> |
| |
| <div class="md:col-span-2"> |
| <label for="milestones" class="block text-sm font-medium text-gray-700 mb-1">Jalons Principaux (Milestones)</label> |
| <textarea id="milestones" name="milestones" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Listez les étapes clés du projet avec des dates si possible</p> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="section bg-white p-6 rounded-xl shadow-md"> |
| <h2 class="text-2xl font-semibold text-indigo-600 mb-4 flex items-center"> |
| <i class="fas fa-exclamation-triangle mr-3"></i> Risques & Dépendances |
| </h2> |
| |
| <div class="space-y-6"> |
| <div> |
| <label class="block text-sm font-medium text-gray-700 mb-3">Risques Identifiés</label> |
| <div id="risksContainer" class="space-y-4"> |
| |
| </div> |
| <button type="button" id="addRisk" class="mt-3 px-4 py-2 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition flex items-center"> |
| <i class="fas fa-plus mr-2"></i> Ajouter un Risque |
| </button> |
| </div> |
| |
| <div> |
| <label for="dependencies" class="block text-sm font-medium text-gray-700 mb-1">Dépendances Externes</label> |
| <textarea id="dependencies" name="dependencies" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"></textarea> |
| <p class="text-xs text-gray-500 mt-1">Ex: Fournisseurs tiers, approbations réglementaires, etc.</p> |
| </div> |
| </div> |
| </div> |
|
|
| |
| <div class="flex flex-col sm:flex-row justify-between gap-4 mt-10 no-print"> |
| <button type="reset" class="px-6 py-3 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition flex-1 flex items-center justify-center"> |
| <i class="fas fa-eraser mr-2"></i> Réinitialiser |
| </button> |
| <button type="button" id="previewBtn" class="px-6 py-3 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition flex-1 flex items-center justify-center"> |
| <i class="fas fa-eye mr-2"></i> Prévisualiser |
| </button> |
| <button type="button" id="generatePdfBtn" class="px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition flex-1 flex items-center justify-center"> |
| <i class="fas fa-file-pdf mr-2"></i> Générer PDF |
| </button> |
| </div> |
| </form> |
|
|
| |
| <div id="previewModal" 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 max-w-4xl w-full max-h-[90vh] overflow-auto"> |
| <div class="sticky top-0 bg-white p-4 border-b flex justify-between items-center"> |
| <h3 class="text-xl font-semibold text-indigo-700">Synthèse du Projet</h3> |
| <button id="closePreview" class="text-gray-500 hover:text-gray-700"> |
| <i class="fas fa-times"></i> |
| </button> |
| </div> |
| |
| <div id="previewContent" class="p-6"> |
| |
| </div> |
| |
| <div class="sticky bottom-0 bg-white p-4 border-t flex justify-end gap-4"> |
| <button id="printPreview" class="px-4 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300"> |
| <i class="fas fa-print mr-2"></i> Imprimer |
| </button> |
| <button id="exportFromPreview" class="px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700"> |
| <i class="fas fa-file-pdf mr-2"></i> Exporter en PDF |
| </button> |
| </div> |
| </div> |
| </div> |
| </div> |
|
|
| <script> |
| // Initialize jsPDF |
| const { jsPDF } = window.jspdf; |
| |
| // Templates for dynamic fields |
| const personaTemplate = (index) => ` |
| <div class="persona-item bg-gray-50 p-4 rounded-lg border border-gray-200"> |
| <div class="flex justify-between items-start mb-2"> |
| <h3 class="font-medium">Persona #${index + 1}</h3> |
| <button type="button" class="remove-persona text-red-500 hover:text-red-700"> |
| <i class="fas fa-times"></i> |
| </button> |
| </div> |
| <div class="grid md:grid-cols-2 gap-4"> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Nom</label> |
| <input type="text" name="personaName[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| </div> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Rôle</label> |
| <input type="text" name="personaRole[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| </div> |
| <div class="md:col-span-2"> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Description</label> |
| <textarea name="personaDescription[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"></textarea> |
| </div> |
| <div class="md:col-span-2"> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Besoins/Objectifs</label> |
| <textarea name="personaNeeds[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"></textarea> |
| </div> |
| </div> |
| </div> |
| `; |
| |
| const featureTemplate = (index) => ` |
| <div class="feature-item bg-gray-50 p-4 rounded-lg border border-gray-200"> |
| <div class="flex justify-between items-start mb-2"> |
| <h3 class="font-medium">Fonctionnalité #${index + 1}</h3> |
| <div class="flex items-center"> |
| <div class="priority-stars mr-3"> |
| ${[1, 2, 3].map(i => ` |
| <button type="button" class="star text-gray-400 hover:text-yellow-500 ${i === 1 ? 'selected' : ''}" data-value="${i}"> |
| <i class="fas fa-star"></i> |
| </button> |
| `).join('')} |
| </div> |
| <button type="button" class="remove-feature text-red-500 hover:text-red-700"> |
| <i class="fas fa-times"></i> |
| </button> |
| </div> |
| </div> |
| <div class="grid md:grid-cols-2 gap-4"> |
| <div class="md:col-span-2"> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Description</label> |
| <input type="text" name="featureDescription[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| </div> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Complexité</label> |
| <select name="featureComplexity[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| <option value="low">Faible</option> |
| <option value="medium">Moyenne</option> |
| <option value="high">Élevée</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Phase</label> |
| <select name="featurePhase[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| <option value="v1">Version 1.0</option> |
| <option value="v2">Version 2.0</option> |
| <option value="future">Future Version</option> |
| </select> |
| </div> |
| </div> |
| </div> |
| `; |
| |
| const riskTemplate = (index) => ` |
| <div class="risk-item bg-gray-50 p-4 rounded-lg border border-gray-200"> |
| <div class="flex justify-between items-start mb-2"> |
| <h3 class="font-medium">Risque #${index + 1}</h3> |
| <div class="flex items-center"> |
| <div class="severity-level mr-3"> |
| <select name="riskSeverity[]" class="px-2 py-1 text-xs border border-gray-300 rounded"> |
| <option value="low">Faible</option> |
| <option value="medium">Moyen</option> |
| <option value="high">Élevé</option> |
| </select> |
| </div> |
| <button type="button" class="remove-risk text-red-500 hover:text-red-700"> |
| <i class="fas fa-times"></i> |
| </button> |
| </div> |
| </div> |
| <div class="grid md:grid-cols-2 gap-4"> |
| <div class="md:col-span-2"> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Description</label> |
| <input type="text" name="riskDescription[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| </div> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Probabilité</label> |
| <select name="riskProbability[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| <option value="low">Faible</option> |
| <option value="medium">Moyenne</option> |
| <option value="high">Élevée</option> |
| </select> |
| </div> |
| <div> |
| <label class="block text-xs font-medium text-gray-500 mb-1">Plan d'Atténuation</label> |
| <input type="text" name="riskMitigation[]" class="w-full px-3 py-1 text-sm border border-gray-300 rounded"> |
| </div> |
| </div> |
| </div> |
| `; |
| |
| // DOM Elements |
| const projectForm = document.getElementById('projectForm'); |
| const personasContainer = document.getElementById('personasContainer'); |
| const featuresContainer = document.getElementById('featuresContainer'); |
| const risksContainer = document.getElementById('risksContainer'); |
| const addPersonaBtn = document.getElementById('addPersona'); |
| const addFeatureBtn = document.getElementById('addFeature'); |
| const addRiskBtn = document.getElementById('addRisk'); |
| const previewBtn = document.getElementById('previewBtn'); |
| const generatePdfBtn = document.getElementById('generatePdfBtn'); |
| const previewModal = document.getElementById('previewModal'); |
| const closePreviewBtn = document.getElementById('closePreview'); |
| const previewContent = document.getElementById('previewContent'); |
| const printPreviewBtn = document.getElementById('printPreview'); |
| const exportFromPreviewBtn = document.getElementById('exportFromPreview'); |
| const progressBar = document.getElementById('progress'); |
| |
| // Counters |
| let personaCount = 0; |
| let featureCount = 0; |
| let riskCount = 0; |
| |
| // Initialize form with one of each dynamic field |
| document.addEventListener('DOMContentLoaded', () => { |
| addPersona(); |
| addFeature(); |
| addRisk(); |
| updateProgress(); |
| |
| // Add event listeners to all form fields to update progress |
| const formInputs = projectForm.querySelectorAll('input, textarea, select'); |
| formInputs.forEach(input => { |
| input.addEventListener('input', updateProgress); |
| }); |
| }); |
| |
| // Add persona |
| addPersonaBtn.addEventListener('click', addPersona); |
| |
| function addPersona() { |
| if (personaCount < 3) { |
| personasContainer.insertAdjacentHTML('beforeend', personaTemplate(personaCount)); |
| personaCount++; |
| |
| // Add event listener to remove button |
| const lastPersona = personasContainer.lastElementChild; |
| const removeBtn = lastPersona.querySelector('.remove-persona'); |
| removeBtn.addEventListener('click', () => { |
| lastPersona.remove(); |
| personaCount--; |
| updateProgress(); |
| }); |
| |
| updateProgress(); |
| } else { |
| alert('Maximum 3 personas autorisés'); |
| } |
| } |
| |
| // Add feature |
| addFeatureBtn.addEventListener('click', addFeature); |
| |
| function addFeature() { |
| featuresContainer.insertAdjacentHTML('beforeend', featureTemplate(featureCount)); |
| featureCount++; |
| |
| // Add event listeners |
| const lastFeature = featuresContainer.lastElementChild; |
| const removeBtn = lastFeature.querySelector('.remove-feature'); |
| const stars = lastFeature.querySelectorAll('.star'); |
| |
| removeBtn.addEventListener('click', () => { |
| lastFeature.remove(); |
| featureCount--; |
| updateProgress(); |
| }); |
| |
| stars.forEach(star => { |
| star.addEventListener('click', function() { |
| const value = parseInt(this.getAttribute('data-value')); |
| const starsContainer = this.parentElement; |
| |
| // Update selected star |
| starsContainer.querySelectorAll('.star').forEach((s, i) => { |
| if (i < value) { |
| s.classList.add('selected'); |
| s.classList.remove('text-gray-400'); |
| s.classList.add('text-yellow-500'); |
| } else { |
| s.classList.remove('selected'); |
| s.classList.add('text-gray-400'); |
| s.classList.remove('text-yellow-500'); |
| } |
| }); |
| |
| // Update hidden input |
| const hiddenInput = document.createElement('input'); |
| hiddenInput.type = 'hidden'; |
| hiddenInput.name = 'featurePriority[]'; |
| hiddenInput.value = value; |
| |
| const existingInput = lastFeature.querySelector('input[name="featurePriority[]"]'); |
| if (existingInput) { |
| existingInput.value = value; |
| } else { |
| lastFeature.appendChild(hiddenInput); |
| } |
| |
| updateProgress(); |
| }); |
| }); |
| |
| updateProgress(); |
| } |
| |
| // Add risk |
| addRiskBtn.addEventListener('click', addRisk); |
| |
| function addRisk() { |
| risksContainer.insertAdjacentHTML('beforeend', riskTemplate(riskCount)); |
| riskCount++; |
| |
| // Add event listener to remove button |
| const lastRisk = risksContainer.lastElementChild; |
| const removeBtn = lastRisk.querySelector('.remove-risk'); |
| |
| removeBtn.addEventListener('click', () => { |
| lastRisk.remove(); |
| riskCount--; |
| updateProgress(); |
| }); |
| |
| updateProgress(); |
| } |
| |
| // Update progress bar based on form completion |
| function updateProgress() { |
| const formData = new FormData(projectForm); |
| let filledFields = 0; |
| let totalFields = 0; |
| |
| // Count required fields |
| const requiredInputs = projectForm.querySelectorAll('[required]'); |
| totalFields += requiredInputs.length; |
| |
| requiredInputs.forEach(input => { |
| if (input.type === 'checkbox' || input.type === 'radio') { |
| if (input.checked) filledFields++; |
| } else if (input.value.trim() !== '') { |
| filledFields++; |
| } |
| }); |
| |
| // Count dynamic fields |
| const dynamicFields = [ |
| { container: personasContainer, name: 'personaName[]', min: 1 }, |
| { container: featuresContainer, name: 'featureDescription[]', min: 1 }, |
| { container: risksContainer, name: 'riskDescription[]', min: 1 } |
| ]; |
| |
| dynamicFields.forEach(field => { |
| const inputs = field.container.querySelectorAll(`[name="${field.name}"]`); |
| totalFields += field.min; |
| |
| if (inputs.length >= field.min) { |
| let hasContent = false; |
| inputs.forEach(input => { |
| if (input.value.trim() !== '') { |
| hasContent = true; |
| } |
| }); |
| |
| if (hasContent) filledFields += field.min; |
| } |
| }); |
| |
| // Calculate percentage |
| const percentage = totalFields > 0 ? Math.min(100, Math.round((filledFields / totalFields) * 100)) : 0; |
| progressBar.style.width = `${percentage}%`; |
| |
| return percentage; |
| } |
| |
| // Preview button |
| previewBtn.addEventListener('click', generatePreview); |
| |
| function generatePreview() { |
| const formData = new FormData(projectForm); |
| const completion = updateProgress(); |
| |
| if (completion < 50) { |
| if (!confirm('Le formulaire est moins de 50% complet. Voulez-vous continuer quand même?')) { |
| return; |
| } |
| } |
| |
| // Generate preview HTML |
| let previewHTML = ` |
| <div class="space-y-8"> |
| |
| <div class="text-center mb-8"> |
| <h1 class="text-3xl font-bold text-indigo-700 mb-2">${formData.get('projectName') || 'Nom du Projet'}</h1> |
| <p class="text-gray-600">Synthèse du projet - Généré le ${new Date().toLocaleDateString('fr-FR')}</p> |
| <div class="mt-4 p-2 bg-indigo-50 rounded-lg inline-block"> |
| <span class="text-indigo-700 font-medium">${formData.get('projectType') || 'Type non spécifié'}</span> |
| </div> |
| </div> |
| |
| |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Informations Générales</h2> |
| <div class="grid md:grid-cols-2 gap-4"> |
| <div> |
| <p class="text-sm text-gray-500">Client/Porteur</p> |
| <p class="font-medium">${formData.get('clientName') || 'Non spécifié'}</p> |
| </div> |
| <div> |
| <p class="text-sm text-gray-500">Chef de Projet</p> |
| <p class="font-medium">${formData.get('projectManager') || 'Non spécifié'}</p> |
| </div> |
| <div class="md:col-span-2"> |
| <p class="text-sm text-gray-500">Description</p> |
| <p class="whitespace-pre-line">${formData.get('projectDescription') || 'Non spécifié'}</p> |
| </div> |
| </div> |
| </div> |
| |
| |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Objectifs</h2> |
| <div class="grid md:grid-cols-2 gap-6"> |
| <div> |
| <h3 class="font-medium text-gray-700 mb-2">Business</h3> |
| <p class="whitespace-pre-line text-sm">${formData.get('businessGoals') || 'Non spécifié'}</p> |
| </div> |
| <div> |
| <h3 class="font-medium text-gray-700 mb-2">Utilisateurs</h3> |
| <p class="whitespace-pre-line text-sm">${formData.get('userGoals') || 'Non spécifié'}</p> |
| </div> |
| <div class="md:col-span-2"> |
| <h3 class="font-medium text-gray-700 mb-2">Indicateurs de Succès</h3> |
| <p class="whitespace-pre-line text-sm">${formData.get('successMetrics') || 'Non spécifié'}</p> |
| </div> |
| </div> |
| </div> |
| `; |
| |
| // Target Audience |
| previewHTML += ` |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Public Cible</h2> |
| <div class="mb-4"> |
| <p class="whitespace-pre-line">${formData.get('targetAudience') || 'Non spécifié'}</p> |
| </div> |
| `; |
| |
| // Personas |
| const personaNames = formData.getAll('personaName[]'); |
| if (personaNames.length > 0) { |
| previewHTML += '<h3 class="font-medium text-gray-700 mb-3">Personas</h3><div class="grid md:grid-cols-2 gap-4">'; |
| |
| for (let i = 0; i < personaNames.length; i++) { |
| if (personaNames[i]) { |
| previewHTML += ` |
| <div class="bg-gray-50 p-4 rounded border border-gray-200"> |
| <h4 class="font-medium">${personaNames[i]}</h4> |
| <p class="text-sm text-gray-600">${formData.getAll('personaRole[]')[i] || ''}</p> |
| <div class="mt-2"> |
| <p class="text-xs text-gray-500">Description:</p> |
| <p class="text-sm whitespace-pre-line">${formData.getAll('personaDescription[]')[i] || ''}</p> |
| </div> |
| <div class="mt-2"> |
| <p class="text-xs text-gray-500">Besoins:</p> |
| <p class="text-sm whitespace-pre-line">${formData.getAll('personaNeeds[]')[i] || ''}</p> |
| </div> |
| </div> |
| `; |
| } |
| } |
| |
| previewHTML += '</div>'; |
| } |
| |
| previewHTML += '</div>'; |
| |
| // Features |
| const featureDescriptions = formData.getAll('featureDescription[]'); |
| if (featureDescriptions.length > 0) { |
| previewHTML += ` |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Fonctionnalités Principales</h2> |
| <div class="space-y-3"> |
| `; |
| |
| for (let i = 0; i < featureDescriptions.length; i++) { |
| if (featureDescriptions[i]) { |
| const priority = formData.getAll('featurePriority[]')[i] || '1'; |
| const complexity = formData.getAll('featureComplexity[]')[i] || 'medium'; |
| const phase = formData.getAll('featurePhase[]')[i] || 'v1'; |
| |
| previewHTML += ` |
| <div class="border-l-4 border-indigo-200 pl-3 py-1"> |
| <div class="flex justify-between items-start"> |
| <h3 class="font-medium">${featureDescriptions[i]}</h3> |
| <div class="flex items-center space-x-2"> |
| <span class="text-xs px-2 py-1 rounded ${getComplexityClass(complexity)}"> |
| ${getComplexityText(complexity)} |
| </span> |
| <span class="text-xs px-2 py-1 bg-gray-100 rounded"> |
| ${getPhaseText(phase)} |
| </span> |
| </div> |
| </div> |
| <div class="flex mt-1"> |
| ${Array.from({length: 3}, (_, j) => ` |
| <i class="fas fa-star text-xs ${j < priority ? 'text-yellow-500' : 'text-gray-300'}"></i> |
| `).join('')} |
| </div> |
| </div> |
| `; |
| } |
| } |
| |
| previewHTML += '</div>'; |
| |
| // Technical Constraints |
| if (formData.get('technicalConstraints')) { |
| previewHTML += ` |
| <div class="mt-6"> |
| <h3 class="font-medium text-gray-700 mb-2">Contraintes Techniques</h3> |
| <p class="whitespace-pre-line text-sm">${formData.get('technicalConstraints')}</p> |
| </div> |
| `; |
| } |
| |
| previewHTML += '</div>'; |
| } |
| |
| // Planning & Budget |
| previewHTML += ` |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Planning & Budget</h2> |
| <div class="grid md:grid-cols-2 gap-4"> |
| <div> |
| <p class="text-sm text-gray-500">Période</p> |
| <p class="font-medium"> |
| ${formData.get('startDate') ? new Date(formData.get('startDate')).toLocaleDateString('fr-FR') : 'Non spécifié'} |
| → |
| ${formData.get('endDate') ? new Date(formData.get('endDate')).toLocaleDateString('fr-FR') : 'Non spécifié'} |
| </p> |
| </div> |
| <div> |
| <p class="text-sm text-gray-500">Budget Estimé</p> |
| <p class="font-medium">${formData.get('budget') ? `${formData.get('budget')} €` : 'Non spécifié'}</p> |
| </div> |
| <div> |
| <p class="text-sm text-gray-500">Taille de l'Équipe</p> |
| <p class="font-medium">${formData.get('teamSize') || 'Non spécifié'}</p> |
| </div> |
| `; |
| |
| // Milestones |
| if (formData.get('milestones')) { |
| previewHTML += ` |
| <div class="md:col-span-2"> |
| <p class="text-sm text-gray-500">Jalons Principaux</p> |
| <p class="whitespace-pre-line">${formData.get('milestones')}</p> |
| </div> |
| `; |
| } |
| |
| previewHTML += '</div></div>'; |
| |
| // Risks |
| const riskDescriptions = formData.getAll('riskDescription[]'); |
| if (riskDescriptions.length > 0) { |
| previewHTML += ` |
| <div class="bg-white p-6 rounded-lg shadow-sm border border-gray-200"> |
| <h2 class="text-xl font-semibold text-indigo-600 mb-4 border-b pb-2">Risques Identifiés</h2> |
| <div class="space-y-4"> |
| `; |
| |
| for (let i = 0; i < riskDescriptions.length; i++) { |
| if (riskDescriptions[i]) { |
| const severity = formData.getAll('riskSeverity[]')[i] || 'medium'; |
| const probability = formData.getAll('riskProbability[]')[i] || 'medium'; |
| const mitigation = formData.getAll('riskMitigation[]')[i] || ''; |
| |
| previewHTML += ` |
| <div class="border-l-4 ${getRiskBorderClass(severity)} pl-3 py-2"> |
| <div class="flex justify-between items-start"> |
| <h3 class="font-medium">${riskDescriptions[i]}</h3> |
| <div class="flex items-center space-x-2"> |
| <span class="text-xs px-2 py-1 rounded ${getSeverityClass(severity)}"> |
| ${getSeverityText(severity)} |
| </span> |
| <span class="text-xs px-2 py-1 rounded ${getProbabilityClass(probability)}"> |
| ${getProbabilityText(probability)} |
| </span> |
| </div> |
| </div> |
| ${mitigation ? ` |
| <div class="mt-1"> |
| <p class="text-xs text-gray-500">Plan d'Atténuation:</p> |
| <p class="text-sm">${mitigation}</p> |
| </div> |
| ` : ''} |
| </div> |
| `; |
| } |
| } |
| |
| previewHTML += '</div>'; |
| |
| // Dependencies |
| if (formData.get('dependencies')) { |
| previewHTML += ` |
| <div class="mt-6"> |
| <h3 class="font-medium text-gray-700 mb-2">Dépendances Externes</h3> |
| <p class="whitespace-pre-line text-sm">${formData.get('dependencies')}</p> |
| </div> |
| `; |
| } |
| |
| previewHTML += '</div>'; |
| } |
| |
| // Summary |
| previewHTML += ` |
| <div class="bg-indigo-50 p-6 rounded-lg border border-indigo-100"> |
| <h2 class="text-xl font-semibold text-indigo-700 mb-3">Synthèse</h2> |
| <p class="mb-3">Ce document résume les bases du projet <strong>${formData.get('projectName') || ''}</strong>, une application de type <strong>${formData.get('projectType') || ''}</strong> destinée à <strong>${formData.get('targetAudience') ? formData.get('targetAudience').substring(0, 50) + (formData.get('targetAudience').length > 50 ? '...' : '') : ''}</strong>.</p> |
| <p>Le projet compte <strong>${featureDescriptions.length}</strong> fonctionnalités principales et <strong>${riskDescriptions.length}</strong> risques identifiés. Le budget estimé est de <strong>${formData.get('budget') ? `${formData.get('budget')} €` : 'non spécifié'}</strong> pour une durée de <strong>${formData.get('startDate') && formData.get('endDate') ? 'environ ' + calculateDuration(formData.get('startDate'), formData.get('endDate')) + ' mois' : 'non spécifiée'}</strong>.</p> |
| </div> |
| `; |
| |
| previewHTML += '</div>'; // Close space-y-8 |
| |
| // Insert into preview modal |
| previewContent.innerHTML = previewHTML; |
| previewModal.classList.remove('hidden'); |
| } |
| |
| // Helper functions for preview |
| function getComplexityClass(complexity) { |
| switch (complexity) { |
| case 'low': return 'bg-green-100 text-green-800'; |
| case 'high': return 'bg-red-100 text-red-800'; |
| default: return 'bg-yellow-100 text-yellow-800'; |
| } |
| } |
| |
| function getComplexityText(complexity) { |
| switch (complexity) { |
| case 'low': return 'Simple'; |
| case 'high': return 'Complexe'; |
| default: return 'Moyenne'; |
| } |
| } |
| |
| function getPhaseText(phase) { |
| switch (phase) { |
| case 'v1': return 'V1.0'; |
| case 'v2': return 'V2.0'; |
| default: return 'Future'; |
| } |
| } |
| |
| function getSeverityClass(severity) { |
| switch (severity) { |
| case 'low': return 'bg-green-100 text-green-800'; |
| case 'high': return 'bg-red-100 text-red-800'; |
| default: return 'bg-yellow-100 text-yellow-800'; |
| } |
| } |
| |
| function getSeverityText(severity) { |
| switch (severity) { |
| case 'low': return 'Faible'; |
| case 'high': return 'Élevé'; |
| default: return 'Moyen'; |
| } |
| } |
| |
| function getProbabilityClass(probability) { |
| switch (probability) { |
| case 'low': return 'bg-blue-100 text-blue-800'; |
| case 'high': return 'bg-purple-100 text-purple-800'; |
| default: return 'bg-indigo-100 text-indigo-800'; |
| } |
| } |
| |
| function getProbabilityText(probability) { |
| switch (probability) { |
| case 'low': return 'Peu probable'; |
| case 'high': return 'Très probable'; |
| default: return 'Probable'; |
| } |
| } |
| |
| function getRiskBorderClass(severity) { |
| switch (severity) { |
| case 'low': return 'border-green-200'; |
| case 'high': return 'border-red-200'; |
| default: return 'border-yellow-200'; |
| } |
| } |
| |
| function calculateDuration(startDate, endDate) { |
| const start = new Date(startDate); |
| const end = new Date(endDate); |
| const diffTime = Math.abs(end - start); |
| return Math.ceil(diffTime / (1000 * 60 * 60 * 24 * 30)); |
| } |
| |
| // Close preview modal |
| closePreviewBtn.addEventListener('click', () => { |
| previewModal.classList.add('hidden'); |
| }); |
| |
| // Print preview |
| printPreviewBtn.addEventListener('click', () => { |
| window.print(); |
| }); |
| |
| // Generate PDF |
| generatePdfBtn.addEventListener('click', generatePdf); |
| exportFromPreviewBtn.addEventListener('click', generatePdf); |
| |
| function generatePdf() { |
| const completion = updateProgress(); |
| |
| if (completion < 30) { |
| if (!confirm('Le formulaire est très incomplet. Voulez-vous vraiment générer un PDF?')) { |
| return; |
| } |
| } |
| |
| // Generate preview first to have the content |
| generatePreview(); |
| |
| // Use html2canvas to capture the preview content |
| html2canvas(previewContent, { |
| scale: 2, |
| logging: false, |
| useCORS: true, |
| allowTaint: true |
| }).then(canvas => { |
| const imgData = canvas.toDataURL('image/png'); |
| const pdf = new jsPDF('p', 'mm', 'a4'); |
| const imgWidth = 210; // A4 width in mm |
| const pageHeight = 295; // A4 height in mm |
| const imgHeight = canvas.height * imgWidth / canvas.width; |
| let heightLeft = imgHeight; |
| let position = 0; |
| |
| pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight); |
| heightLeft -= pageHeight; |
| |
| // Add new pages if content is longer than one page |
| while (heightLeft >= 0) { |
| position = heightLeft - imgHeight; |
| pdf.addPage(); |
| pdf.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight); |
| heightLeft -= pageHeight; |
| } |
| |
| // Save the PDF |
| const projectName = document.getElementById('projectName').value || 'projet'; |
| pdf.save(`Synthèse_${projectName.replace(/\s+/g, '_')}.pdf`); |
| }); |
| } |
| </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=olinux/formulateur-projet" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> |
| </html> |