|
@@ -0,0 +1,1230 @@
|
|
|
|
|
+/* Audit Express Self — Livinweb */
|
|
|
|
|
+
|
|
|
|
|
+const appEl = document.getElementById('app');
|
|
|
|
|
+const API_BASE = appEl?.dataset?.apiBase || '/api';
|
|
|
|
|
+const BOOKING_URL = appEl?.dataset?.bookingUrl || '';
|
|
|
|
|
+const DEVIS_URL = appEl?.dataset?.devisUrl || '';
|
|
|
|
|
+
|
|
|
|
|
+/* ── Catalogue packs ── */
|
|
|
|
|
+const PACK_CATALOGUE = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'onboarding-v1',
|
|
|
|
|
+ title: 'Onboarding collaborateur',
|
|
|
|
|
+ desc: "Fiabilisez l'intégration de vos nouveaux collaborateurs : clarté du flux, traçabilité, continuité.",
|
|
|
|
|
+ tag: 'Pré-configuré',
|
|
|
|
|
+ tagStyle: 'tag--pre',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'validation-facture',
|
|
|
|
|
+ title: 'Validation de facture',
|
|
|
|
|
+ desc: 'Contrôles, séparation des tâches, preuve : évaluez la robustesse de votre circuit factures.',
|
|
|
|
|
+ tag: 'Pré-configuré',
|
|
|
|
|
+ tagStyle: 'tag--pre',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-generique',
|
|
|
|
|
+ title: 'Process générique',
|
|
|
|
|
+ desc: 'Applicable à tout process opérationnel : achat, production, relation client, support, projet…',
|
|
|
|
|
+ tag: 'Universel',
|
|
|
|
|
+ tagStyle: 'tag--new',
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-generique-v2',
|
|
|
|
|
+ title: 'Diagnostic d\'opportunité',
|
|
|
|
|
+ desc: 'Évaluez sur 8 axes si ce process est prioritaire à automatiser : friction, volume, risque, données, outils, variabilité, collaboration, déploiement.',
|
|
|
|
|
+ tag: 'V2 — 25 questions',
|
|
|
|
|
+ tagStyle: 'tag--v2',
|
|
|
|
|
+ },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+/* ── Outils à venir ── */
|
|
|
|
|
+const COMING_SOON_TOOLS = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-mapper',
|
|
|
|
|
+ title: 'Process Mapper',
|
|
|
|
|
+ desc: 'Cartographiez visuellement votre process étape par étape, identifiez les goulots d\'étranglement et générez une documentation structurée prête à partager.',
|
|
|
|
|
+ },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+const state = {
|
|
|
|
|
+ view: 'landing',
|
|
|
|
|
+ packId: null,
|
|
|
|
|
+ pack: null,
|
|
|
|
|
+ idx: 0,
|
|
|
|
|
+ answers: {},
|
|
|
|
|
+ optional: {},
|
|
|
|
|
+ result: null,
|
|
|
|
|
+ emailUnlocked: false,
|
|
|
|
|
+ captureEmail: '',
|
|
|
|
|
+ notifyTool: '',
|
|
|
|
|
+ roiInputs: { volume: '', tempsActuel: '', tempsCible: '', coutHoraire: '', tauxErreurs: '', tempsErreur: '', delaiActuel: '', delaiCible: '' },
|
|
|
|
|
+ roiResult: null,
|
|
|
|
|
+ qwfSignals: {},
|
|
|
|
|
+ qwfResult: null,
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+let autoAdvanceTimer = null;
|
|
|
|
|
+
|
|
|
|
|
+/* ── DOM helpers ── */
|
|
|
|
|
+function h(tag, attrs = {}, children = []) {
|
|
|
|
|
+ const el = document.createElement(tag);
|
|
|
|
|
+ for (const [k, v] of Object.entries(attrs || {})) {
|
|
|
|
|
+ if (k === 'class') el.className = v;
|
|
|
|
|
+ else if (k.startsWith('on') && typeof v === 'function') el.addEventListener(k.slice(2).toLowerCase(), v);
|
|
|
|
|
+ else if (v !== undefined && v !== null && v !== false) el.setAttribute(k, String(v));
|
|
|
|
|
+ }
|
|
|
|
|
+ for (const child of (Array.isArray(children) ? children : [children])) {
|
|
|
|
|
+ if (child == null) continue;
|
|
|
|
|
+ el.appendChild(typeof child === 'string' ? document.createTextNode(child) : child);
|
|
|
|
|
+ }
|
|
|
|
|
+ return el;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function storageKey(packId) { return `aes_${packId}_v1`; }
|
|
|
|
|
+
|
|
|
|
|
+function saveProgress() {
|
|
|
|
|
+ if (!state.packId) return;
|
|
|
|
|
+ localStorage.setItem(storageKey(state.packId), JSON.stringify({ answers: state.answers, optional: state.optional }));
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function loadProgress(packId) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const obj = JSON.parse(localStorage.getItem(storageKey(packId)) || '{}');
|
|
|
|
|
+ return {
|
|
|
|
|
+ answers: typeof obj?.answers === 'object' ? obj.answers : {},
|
|
|
|
|
+ optional: typeof obj?.optional === 'object' ? obj.optional : {},
|
|
|
|
|
+ };
|
|
|
|
|
+ } catch { return { answers: {}, optional: {} }; }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function apiJson(path, { method = 'GET', body } = {}) {
|
|
|
|
|
+ const res = await fetch(`${API_BASE}${path}`, {
|
|
|
|
|
+ method,
|
|
|
|
|
+ headers: body ? { 'Content-Type': 'application/json' } : undefined,
|
|
|
|
|
+ body: body ? JSON.stringify(body) : undefined,
|
|
|
|
|
+ });
|
|
|
|
|
+ const data = await res.json().catch(() => ({}));
|
|
|
|
|
+ if (!res.ok) throw new Error(data?.error || 'Erreur API');
|
|
|
|
|
+ return data;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function setView(v) { state.view = v; render(); }
|
|
|
|
|
+
|
|
|
|
|
+function goStart() {
|
|
|
|
|
+ Object.assign(state, { packId: null, pack: null, idx: 0, answers: {}, optional: {}, result: null, emailUnlocked: false, captureEmail: '' });
|
|
|
|
|
+ setView('select');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function selectPack(packId) {
|
|
|
|
|
+ state.packId = packId;
|
|
|
|
|
+ const saved = loadProgress(packId);
|
|
|
|
|
+ state.answers = saved.answers;
|
|
|
|
|
+ state.optional = saved.optional;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await apiJson(`/pack.php?pack=${encodeURIComponent(packId)}`);
|
|
|
|
|
+ state.pack = data.pack;
|
|
|
|
|
+ state.idx = 0;
|
|
|
|
|
+ setView('intro');
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ alert('Impossible de charger le pack : ' + (e.message || ''));
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function levelColor(level) {
|
|
|
|
|
+ return { A: '#1e8a5e', B: '#1e8a5e', C: '#c07c10', D: '#b83040' }[level] || '#2F506D';
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── LANDING ── */
|
|
|
|
|
+function renderLanding() {
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { style: 'margin-bottom:14px' }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--pre', style: 'font-size:12px' }, ['Diagnostic self-serve']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Contrôle technique de votre process opérationnel']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [
|
|
|
|
|
+ 'En 7 minutes, obtenez une note sur 100, vos risques probables et 5 actions prioritaires pour fiabiliser votre process.'
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('ul', { class: 'bullets' }, [
|
|
|
|
|
+ h('li', {}, ['20 questions, 1 écran à la fois, langage simple']),
|
|
|
|
|
+ h('li', {}, ['Résultats immédiats — PDF 1 page partageable']),
|
|
|
|
|
+ h('li', {}, ['Données minimales, suppression sur demande']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', onClick: goStart }, ['Lancer le contrôle technique →']),
|
|
|
|
|
+ BOOKING_URL
|
|
|
|
|
+ ? h('a', { class: 'btn btn--outline', href: '#exemple', onClick: (e) => { e.preventDefault(); showExemple(); } }, ['Voir un exemple de résultat'])
|
|
|
|
|
+ : null,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint' }, ['Aucun jargon. Aucun discours "outil". Juste un diagnostic actionnable.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'grid--2 grid', style: 'margin-top:0' }, [
|
|
|
|
|
+ ...PACK_CATALOGUE.map(p =>
|
|
|
|
|
+ h('div', { class: 'pack-card', style: 'cursor:default; opacity:.75' }, [
|
|
|
|
|
+ h('span', { class: `tag ${p.tagStyle}` }, [p.tag]),
|
|
|
|
|
+ h('div', { class: 'title', style: 'margin-top:8px' }, [p.title]),
|
|
|
|
|
+ h('div', { class: 'desc' }, [p.desc]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ ),
|
|
|
|
|
+ ...COMING_SOON_TOOLS.map(makeComingSoonCard),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ renderNotifyDialog(),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function showExemple() {
|
|
|
|
|
+ alert(
|
|
|
|
|
+ 'Exemple de résultat :\n\n' +
|
|
|
|
|
+ 'Score : 67/100 — Niveau C (Fragile)\n' +
|
|
|
|
|
+ '• Clarté du flux : 14/20\n• Fiabilité : 11/20\n• Traçabilité : 10/20\n' +
|
|
|
|
|
+ '• Résilience : 15/20\n• Coût caché : 17/20\n\n' +
|
|
|
|
|
+ 'Risques : Statut flou → relances permanentes / Documents dispersés / Dépendance personne clé\n\n' +
|
|
|
|
|
+ 'Quick wins : Checklist jour 1 prêt · Pré-check 48h · Tableau statut unique · Centraliser docs · Escalade simple'
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── COMING-SOON card helper ── */
|
|
|
|
|
+function makeComingSoonCard(tool) {
|
|
|
|
|
+ return h('div', {
|
|
|
|
|
+ class: 'pack-card pack-card--soon',
|
|
|
|
|
+ onClick: () => {
|
|
|
|
|
+ state.notifyTool = tool.id;
|
|
|
|
|
+ document.getElementById('notifyDialog')?.showModal();
|
|
|
|
|
+ },
|
|
|
|
|
+ }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--soon' }, ['Bientôt disponible']),
|
|
|
|
|
+ h('div', { class: 'title', style: 'margin-top:8px' }, [tool.title]),
|
|
|
|
|
+ h('div', { class: 'desc' }, [tool.desc]),
|
|
|
|
|
+ h('div', { class: 'soon-overlay' }, [
|
|
|
|
|
+ h('div', { class: 'soon-overlay__label' }, ['Bientôt disponible']),
|
|
|
|
|
+ h('div', { class: 'soon-overlay__text' }, ['Me notifier du lancement →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── NOTIFY DIALOG (Coming soon) ── */
|
|
|
|
|
+function renderNotifyDialog() {
|
|
|
|
|
+ const toolMeta = COMING_SOON_TOOLS.find(t => t.id === state.notifyTool);
|
|
|
|
|
+ const toolName = toolMeta?.title || 'cet outil';
|
|
|
|
|
+
|
|
|
|
|
+ const onSubmit = async (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ const email = e.target.querySelector('input[type="email"]').value.trim();
|
|
|
|
|
+ if (!email) return;
|
|
|
|
|
+ const btn = e.target.querySelector('button[type="submit"]');
|
|
|
|
|
+ btn.disabled = true;
|
|
|
|
|
+ btn.textContent = 'Envoi…';
|
|
|
|
|
+ try {
|
|
|
|
|
+ await apiJson('/notify.php', { method: 'POST', body: { email, tool: state.notifyTool } });
|
|
|
|
|
+ const body = document.querySelector('#notifyDialog .dialog__body');
|
|
|
|
|
+ if (body) {
|
|
|
|
|
+ body.innerHTML = '';
|
|
|
|
|
+ body.appendChild(h('div', { style: 'text-align:center;padding:20px 0' }, [
|
|
|
|
|
+ h('div', { style: 'font-size:36px;margin-bottom:12px;color:var(--good)' }, ['✓']),
|
|
|
|
|
+ h('div', { class: 'h2', style: 'color:var(--good);margin-bottom:8px' }, ['C\'est noté !']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [`Vous serez parmi les premiers informés du lancement de ${toolName}.`]),
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ class: 'btn btn--primary', style: 'margin-top:16px',
|
|
|
|
|
+ onClick: () => document.getElementById('notifyDialog')?.close(),
|
|
|
|
|
+ }, ['Fermer']),
|
|
|
|
|
+ ]));
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (err) {
|
|
|
|
|
+ btn.disabled = false;
|
|
|
|
|
+ btn.textContent = 'Me prévenir au lancement →';
|
|
|
|
|
+ alert('Erreur : ' + (err.message || 'Réessayez.'));
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return h('dialog', { id: 'notifyDialog', class: 'dialog' }, [
|
|
|
|
|
+ h('div', { class: 'dialog__inner' }, [
|
|
|
|
|
+ h('div', { class: 'dialog__head' }, [
|
|
|
|
|
+ h('strong', {}, [`Soyez informé : ${toolName}`]),
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ class: 'btn btn--outline', style: 'padding:6px 12px;font-size:13px', type: 'button',
|
|
|
|
|
+ onClick: () => document.getElementById('notifyDialog')?.close(),
|
|
|
|
|
+ }, ['Fermer']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'dialog__body' }, [
|
|
|
|
|
+ h('p', { class: 'lead', style: 'margin-bottom:16px' }, [
|
|
|
|
|
+ `${toolName} est en cours de développement. Laissez votre email et on vous prévient en priorité au lancement.`,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('form', { onSubmit }, [
|
|
|
|
|
+ h('div', { class: 'field' }, [
|
|
|
|
|
+ h('label', { for: 'notifyEmail' }, ['Email professionnel']),
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ id: 'notifyEmail', type: 'email', required: 'required',
|
|
|
|
|
+ placeholder: 'vous@entreprise.com', autocomplete: 'email',
|
|
|
|
|
+ }),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:14px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', type: 'submit' }, ['Me prévenir au lancement →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint' }, ['Aucun spam. Désabonnement en 1 clic.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── SELECT ── */
|
|
|
|
|
+function renderSelect() {
|
|
|
|
|
+ const makeCard = (p) =>
|
|
|
|
|
+ h('div', { class: 'pack-card', onClick: () => selectPack(p.id) }, [
|
|
|
|
|
+ h('span', { class: `tag ${p.tagStyle}` }, [p.tag]),
|
|
|
|
|
+ h('div', { class: 'title' }, [p.title, h('span', { class: 'arrow' }, [' →'])]),
|
|
|
|
|
+ h('div', { class: 'desc' }, [p.desc]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ const preConfigured = PACK_CATALOGUE.filter(p => p.id !== 'process-generique' && p.id !== 'process-generique-v2');
|
|
|
|
|
+ const generic = PACK_CATALOGUE.find(p => p.id === 'process-generique');
|
|
|
|
|
+ const genericV2 = PACK_CATALOGUE.find(p => p.id === 'process-generique-v2');
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Choisissez le process à diagnostiquer']),
|
|
|
|
|
+ h('p', { class: 'lead' }, ['Sélectionnez un pack pré-configuré ou utilisez le questionnaire universel.']),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:18px' }, ['Packs pré-configurés']),
|
|
|
|
|
+ h('div', { class: 'grid grid--2' }, preConfigured.map(makeCard)),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:18px' }, ['Process universel']),
|
|
|
|
|
+ h('div', { class: 'grid grid--2' }, [
|
|
|
|
|
+ generic ? makeCard(generic) : null,
|
|
|
|
|
+ genericV2 ? makeCard(genericV2) : null,
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:18px' }, ['Outils complémentaires']),
|
|
|
|
|
+ h('div', { class: 'grid grid--2' }, [
|
|
|
|
|
+ h('div', { class: 'pack-card', onClick: () => setView('roi') }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--roi' }, ['ROI Calculator']),
|
|
|
|
|
+ h('div', { class: 'title' }, ['ROI Calculator', h('span', { class: 'arrow' }, [' →'])]),
|
|
|
|
|
+ h('div', { class: 'desc' }, ['Transformez "ça nous coûte" en "ça vaut X €". 10 questions pour chiffrer le gain mensuel, le ROI annuel et les 2 leviers qui pèsent le plus.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'pack-card', onClick: () => setView('qwf') }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--qwf' }, ['Quick Wins Finder']),
|
|
|
|
|
+ h('div', { class: 'title' }, ['Quick Wins Finder', h('span', { class: 'arrow' }, [' →'])]),
|
|
|
|
|
+ h('div', { class: 'desc' }, ['3 actions concrètes et personnalisées basées sur vos signaux — résultat attendu, effort estimé et délai typique pour chaque recommandation.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:18px' }, ['Bientôt disponible']),
|
|
|
|
|
+ h('div', { class: 'grid grid--2' }, COMING_SOON_TOOLS.map(makeComingSoonCard)),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:18px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', onClick: () => setView('landing') }, ['← Retour']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ renderNotifyDialog(),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── INTRO ── */
|
|
|
|
|
+function renderIntro() {
|
|
|
|
|
+ const meta = PACK_CATALOGUE.find(p => p.id === state.packId);
|
|
|
|
|
+ const answeredCount = Object.keys(state.answers).length;
|
|
|
|
|
+ const total = state.pack?.questions?.length || 20;
|
|
|
|
|
+ const hasSaved = answeredCount > 0;
|
|
|
|
|
+
|
|
|
|
|
+ const startFresh = () => {
|
|
|
|
|
+ state.answers = {};
|
|
|
|
|
+ state.optional = {};
|
|
|
|
|
+ state.idx = 0;
|
|
|
|
|
+ state.emailUnlocked = false;
|
|
|
|
|
+ state.captureEmail = '';
|
|
|
|
|
+ saveProgress();
|
|
|
|
|
+ setView('quiz');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const resume = () => {
|
|
|
|
|
+ const qs = state.pack?.questions || [];
|
|
|
|
|
+ let resumeIdx = 0;
|
|
|
|
|
+ for (let i = 0; i < qs.length; i++) {
|
|
|
|
|
+ if (state.answers[qs[i].id]) resumeIdx = i;
|
|
|
|
|
+ }
|
|
|
|
|
+ state.idx = Math.min(resumeIdx + 1, qs.length - 1);
|
|
|
|
|
+ setView('quiz');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('span', { class: `tag ${meta?.tagStyle || ''}`, style: 'margin-bottom:12px;display:inline-block' }, [
|
|
|
|
|
+ state.pack?.pack_title || '',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Avant de commencer']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [
|
|
|
|
|
+ 'Répondez franchement. Le score sert à prioriser, pas à juger. ',
|
|
|
|
|
+ 'Temps estimé : 7 minutes. Questions : 20.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ state.pack?.pack_description
|
|
|
|
|
+ ? h('p', { style: 'color:var(--muted);font-size:14px;margin-top:0' }, [state.pack.pack_description])
|
|
|
|
|
+ : null,
|
|
|
|
|
+ hasSaved
|
|
|
|
|
+ ? h('div', { class: 'resume-notice' }, [
|
|
|
|
|
+ h('span', {}, [`Progression sauvegardée : ${answeredCount} / ${total} questions`]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ : null,
|
|
|
|
|
+ h('div', { class: 'btnrow' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', onClick: () => setView('select') }, ['← Choisir un autre pack']),
|
|
|
|
|
+ hasSaved
|
|
|
|
|
+ ? h('button', { class: 'btn btn--outline', onClick: startFresh }, ['Recommencer à zéro'])
|
|
|
|
|
+ : null,
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', onClick: hasSaved ? resume : startFresh }, [
|
|
|
|
|
+ hasSaved ? `Reprendre (Q${Math.min(Object.keys(state.answers).length + 1, total)}) →` : 'Commencer →',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── QUIZ ── */
|
|
|
|
|
+function renderQuiz() {
|
|
|
|
|
+ const q = state.pack?.questions?.[state.idx];
|
|
|
|
|
+ if (!q) return h('div', { class: 'card' }, ['Chargement…']);
|
|
|
|
|
+
|
|
|
|
|
+ const total = state.pack.questions.length;
|
|
|
|
|
+ const pos = state.idx + 1;
|
|
|
|
|
+ const pct = Math.round(((pos - 1) / total) * 100);
|
|
|
|
|
+ const selected = state.answers[q.id] || '';
|
|
|
|
|
+
|
|
|
|
|
+ const opts = (q.options || []).map(opt => {
|
|
|
|
|
+ const id = `opt_${q.id}_${opt.id}`;
|
|
|
|
|
+ const isSelected = selected === opt.id;
|
|
|
|
|
+ const isNa = opt.id === 'NA' || opt.id.toLowerCase().endsWith('_na');
|
|
|
|
|
+ return h('label', { class: `opt${isSelected ? ' opt--selected' : ''}${isNa ? ' opt--na' : ''}`, for: id }, [
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ id, type: 'radio', name: q.id, value: opt.id,
|
|
|
|
|
+ checked: isSelected ? 'checked' : null,
|
|
|
|
|
+ onChange: (e) => {
|
|
|
|
|
+ state.answers[q.id] = e.target.value;
|
|
|
|
|
+ saveProgress();
|
|
|
|
|
+ render();
|
|
|
|
|
+ if (autoAdvanceTimer) clearTimeout(autoAdvanceTimer);
|
|
|
|
|
+ autoAdvanceTimer = setTimeout(() => {
|
|
|
|
|
+ autoAdvanceTimer = null;
|
|
|
|
|
+ const t = state.pack?.questions?.length || 0;
|
|
|
|
|
+ if (state.idx < t - 1) { state.idx++; saveProgress(); render(); }
|
|
|
|
|
+ else setView('optional');
|
|
|
|
|
+ }, 380);
|
|
|
|
|
+ },
|
|
|
|
|
+ }),
|
|
|
|
|
+ h('div', {}, [h('strong', {}, [opt.label])]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const canPrev = state.idx > 0;
|
|
|
|
|
+ const canNext = !!selected;
|
|
|
|
|
+ const isLast = state.idx === total - 1;
|
|
|
|
|
+
|
|
|
|
|
+ const next = async () => {
|
|
|
|
|
+ if (!canNext) return;
|
|
|
|
|
+ if (!isLast) { state.idx++; saveProgress(); render(); return; }
|
|
|
|
|
+ setView('optional');
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'quizHead' }, [
|
|
|
|
|
+ h('span', { class: 'tag', style: 'font-size:11px' }, [state.pack.pack_title]),
|
|
|
|
|
+ h('div', { class: 'quizStep' }, [
|
|
|
|
|
+ h('strong', {}, [`${pos}`]),
|
|
|
|
|
+ h('span', {}, [` / ${total}`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'progressWrap' }, [
|
|
|
|
|
+ h('div', { class: 'progress' }, [h('div', { style: `width:${pct}%` })]),
|
|
|
|
|
+ h('div', { class: 'progressMeta' }, [
|
|
|
|
|
+ h('span', { class: 'progressPct' }, [`${pct}\u00a0%`]),
|
|
|
|
|
+ h('span', { class: 'progressRemain' }, [
|
|
|
|
|
+ isLast ? 'Dernière question' : `encore ${total - pos} question${total - pos > 1 ? 's' : ''}`,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'qTitle' }, [q.label]),
|
|
|
|
|
+ q.help ? h('p', { class: 'qHelp' }, [q.help]) : null,
|
|
|
|
|
+ h('div', { class: 'options' }, opts),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:18px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', disabled: canPrev ? null : 'disabled', onClick: () => { state.idx--; saveProgress(); render(); } }, ['← Précédent']),
|
|
|
|
|
+ h('button', { class: `btn ${canNext ? 'btn--primary' : 'btn--outline'}`, disabled: canNext ? null : 'disabled', onClick: next }, [
|
|
|
|
|
+ isLast ? 'Voir mon résultat →' : 'Suivant →',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin-top:10px' }, ['Vous pouvez modifier vos réponses avant la fin.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── OPTIONAL ── */
|
|
|
|
|
+function renderOptional() {
|
|
|
|
|
+ const opt = state.pack?.optional_questions || {};
|
|
|
|
|
+ const volumeKey = Object.keys(opt).find(k => opt[k]?.required_for_cost);
|
|
|
|
|
+ const volumeQ = volumeKey ? opt[volumeKey] : null;
|
|
|
|
|
+ const hourlyQ = opt.hourly_cost || null;
|
|
|
|
|
+
|
|
|
|
|
+ const makeRadioGroup = (q, stateKey) => {
|
|
|
|
|
+ const cur = state.optional[stateKey];
|
|
|
|
|
+ return h('div', { class: 'field' }, [
|
|
|
|
|
+ h('label', {}, [q.label]),
|
|
|
|
|
+ h('div', { class: 'options', style: 'margin-top:6px' }, q.options.map(o => {
|
|
|
|
|
+ const id = `opt_${stateKey}_${o.id}`;
|
|
|
|
|
+ const val = String(o.value ?? o.id);
|
|
|
|
|
+ return h('label', { class: 'opt', for: id }, [
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ id, type: 'radio', name: stateKey, value: val,
|
|
|
|
|
+ checked: String(cur) === val ? 'checked' : null,
|
|
|
|
|
+ onChange: (e) => { state.optional[stateKey] = Number(e.target.value); saveProgress(); },
|
|
|
|
|
+ }),
|
|
|
|
|
+ h('div', {}, [h('strong', {}, [o.label])]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ })),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const compute = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const data = await apiJson('/score.php', {
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ body: { pack_id: state.packId, answers: state.answers, optional: state.optional },
|
|
|
|
|
+ });
|
|
|
|
|
+ state.result = data.result;
|
|
|
|
|
+ saveProgress();
|
|
|
|
|
+ setView('results');
|
|
|
|
|
+ } catch (e) { alert(e.message || 'Erreur'); }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--new', style: 'margin-bottom:12px;display:inline-block' }, ['Optionnel']),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Quelques infos pour le coût caché']),
|
|
|
|
|
+ h('p', { class: 'lead' }, ['Ces données servent uniquement à estimer le coût caché en heures/mois (indicatif). Vous pouvez passer.']),
|
|
|
|
|
+ volumeQ ? makeRadioGroup(volumeQ, volumeKey) : null,
|
|
|
|
|
+ hourlyQ ? makeRadioGroup(hourlyQ, 'hourly_cost') : null,
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:20px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', onClick: () => setView('quiz') }, ['← Retour']),
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', onClick: compute }, ['Voir mes résultats →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── RESULTS ── */
|
|
|
|
|
+function renderResults() {
|
|
|
|
|
+ const r = state.result;
|
|
|
|
|
+ if (!r) return h('div', { class: 'card' }, ['Calcul en cours…']);
|
|
|
|
|
+
|
|
|
|
|
+ const dotColor = levelColor(r.level);
|
|
|
|
|
+ const cost = r.cost_hidden;
|
|
|
|
|
+ const unlocked = state.emailUnlocked;
|
|
|
|
|
+
|
|
|
|
|
+ const pillarRows = (r.pillars || []).map(p => {
|
|
|
|
|
+ const pct = p.max ? Math.round((p.score / p.max) * 100) : 0;
|
|
|
|
|
+ return h('div', { class: 'pRow' }, [
|
|
|
|
|
+ h('div', { class: 'name' }, [p.label]),
|
|
|
|
|
+ h('div', { class: 'val' }, [`${p.score}/${p.max}`]),
|
|
|
|
|
+ h('div', { class: 'bar' }, [h('div', { style: `width:${pct}%` })]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const riskItems = (r.risks_top3 || []).map(x =>
|
|
|
|
|
+ h('li', {}, [
|
|
|
|
|
+ h('strong', {}, [x.title]),
|
|
|
|
|
+ h('div', { class: 'hint' }, [x.what_happens]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const winItems = (r.quick_wins_preview || []).map(x =>
|
|
|
|
|
+ h('li', {}, [
|
|
|
|
|
+ h('strong', {}, [x.title]),
|
|
|
|
|
+ h('div', { class: 'hint' }, [`${x.effect} · Effort : ${x.effort}`]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ /* ── V2 Diagnostic ── */
|
|
|
|
|
+ const v2 = r.v2_diagnostic || null;
|
|
|
|
|
+
|
|
|
|
|
+ const renderV2Diagnostic = () => {
|
|
|
|
|
+ if (!v2) return null;
|
|
|
|
|
+ const potColor = v2.potentiel >= 70 ? '#1e8a5e' : v2.potentiel >= 40 ? '#c07c10' : '#b83040';
|
|
|
|
|
+ const cplxColor = v2.complexite <= 35 ? '#1e8a5e' : v2.complexite <= 65 ? '#c07c10' : '#b83040';
|
|
|
|
|
+ const verdictColor = { prioritaire: '#1e8a5e', candidat: '#c07c10', attente: '#5e789a' }[v2.verdict.code] || '#2F506D';
|
|
|
|
|
+
|
|
|
|
|
+ const meter = (score, label, color) =>
|
|
|
|
|
+ h('div', { class: 'v2-meter' }, [
|
|
|
|
|
+ h('div', { class: 'v2-meter__num', style: `color:${color}` }, [String(score)]),
|
|
|
|
|
+ h('div', { class: 'v2-meter__sub' }, ['/100']),
|
|
|
|
|
+ h('div', { class: 'v2-meter__lbl' }, [label]),
|
|
|
|
|
+ h('div', { class: 'v2-meter__track' }, [
|
|
|
|
|
+ h('div', { class: 'v2-meter__fill', style: `width:${score}%;background:${color}` }),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'card v2-diagnostic' }, [
|
|
|
|
|
+ h('div', { class: 'v2-meters' }, [
|
|
|
|
|
+ meter(v2.potentiel, 'Potentiel d\'automatisation', potColor),
|
|
|
|
|
+ meter(v2.complexite, 'Complexité de mise en œuvre', cplxColor),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'v2-badges' }, [
|
|
|
|
|
+ h('span', { class: 'v2-verdict-badge', style: `border-color:${verdictColor};color:${verdictColor}` }, [
|
|
|
|
|
+ `${v2.verdict.label} — ${v2.verdict.desc}`,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('span', { class: `v2-tag-badge${v2.tag === 'quick_win' ? ' v2-tag-badge--qw' : ' v2-tag-badge--proj'}` }, [
|
|
|
|
|
+ v2.tag_label,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const renderMiniPlan = () => {
|
|
|
|
|
+ if (!v2 || !unlocked) return null;
|
|
|
|
|
+ const actionList = (items, startNum) =>
|
|
|
|
|
+ h('ol', { class: 'v2-plan-list', start: String(startNum) },
|
|
|
|
|
+ (items || []).map(a => h('li', {}, [
|
|
|
|
|
+ h('strong', {}, [a.title]),
|
|
|
|
|
+ h('span', { class: 'hint' }, [` — ${a.effect} · Effort : ${a.effort}`]),
|
|
|
|
|
+ ]))
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'v2-mini-plan' }, [
|
|
|
|
|
+ h('div', { class: 'v2-plan-cols' }, [
|
|
|
|
|
+ h('div', { class: 'card v2-plan-section' }, [
|
|
|
|
|
+ h('div', { class: 'v2-plan-title' }, ['3 actions immédiates']),
|
|
|
|
|
+ actionList(v2.actions, 1),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'card v2-plan-section v2-plan-section--qw' }, [
|
|
|
|
|
+ h('div', { class: 'v2-plan-title' }, ['2 quick wins possibles']),
|
|
|
|
|
+ actionList(v2.quick_wins, 4),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ v2.risque_majeur ? h('div', { class: 'v2-plan-risk-block' }, [
|
|
|
|
|
+ h('div', { class: 'v2-plan-title v2-plan-title--risk' }, ['1 risque majeur à adresser en parallèle']),
|
|
|
|
|
+ h('div', { class: 'v2-plan-risk-card' }, [
|
|
|
|
|
+ h('strong', {}, [v2.risque_majeur.title]),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin-top:4px' }, [v2.risque_majeur.what_happens]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]) : null,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /* ── Unlock gate ── */
|
|
|
|
|
+ const renderUnlockGate = () => {
|
|
|
|
|
+ const onUnlock = (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ const email = e.target.querySelector('input[type="email"]').value.trim();
|
|
|
|
|
+ if (!email.includes('@') || email.length < 5) return;
|
|
|
|
|
+ state.captureEmail = email;
|
|
|
|
|
+ state.emailUnlocked = true;
|
|
|
|
|
+ saveProgress();
|
|
|
|
|
+ render();
|
|
|
|
|
+ setTimeout(() => document.getElementById('pdfDialog')?.showModal(), 80);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /* Teaser basé sur les vrais risques calculés */
|
|
|
|
|
+ const teaser = (r.risks_top3 || []).slice(0, 3).map(x => ({
|
|
|
|
|
+ title: x.title,
|
|
|
|
|
+ desc: x.what_happens,
|
|
|
|
|
+ }));
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'unlock-gate' }, [
|
|
|
|
|
+ h('div', { class: 'unlock-gate__inner' }, [
|
|
|
|
|
+ h('div', { class: 'unlock-gate__icon' }, ['↓']),
|
|
|
|
|
+ h('div', { class: 'h2', style: 'margin-bottom:6px' }, ['Débloquez vos axes d\'amélioration']),
|
|
|
|
|
+ h('p', { class: 'lead', style: 'margin-bottom:20px' }, [
|
|
|
|
|
+ 'Entrez votre email professionnel pour accéder aux 5 actions prioritaires et télécharger votre PDF synthèse.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ teaser.length ? h('div', { class: 'unlock-risks' }, teaser.map((t, i) =>
|
|
|
|
|
+ h('div', { class: 'unlock-risk' }, [
|
|
|
|
|
+ h('div', { class: 'unlock-risk__num' }, [String(i + 1)]),
|
|
|
|
|
+ h('div', { class: 'unlock-risk__body' }, [
|
|
|
|
|
+ h('strong', {}, [t.title]),
|
|
|
|
|
+ h('span', {}, [t.desc]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ )) : null,
|
|
|
|
|
+
|
|
|
|
|
+ h('form', { class: 'unlock-form', onSubmit: onUnlock }, [
|
|
|
|
|
+ h('div', { class: 'unlock-row' }, [
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ type: 'email', required: 'required',
|
|
|
|
|
+ placeholder: 'vous@entreprise.com',
|
|
|
|
|
+ autocomplete: 'email',
|
|
|
|
|
+ }),
|
|
|
|
|
+ h('button', { class: 'btn btn--primary btn--unlock', type: 'submit' }, ['Débloquer →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin-top:8px;text-align:center' }, [
|
|
|
|
|
+ 'Aucun spam. Désinscription en 1 clic.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ /* ── CTAs débloqués ── */
|
|
|
|
|
+ const renderUnlockedCtas = () =>
|
|
|
|
|
+ h('div', { class: 'unlocked-ctas' }, [
|
|
|
|
|
+ h('div', { class: 'unlocked-ctas__inner' }, [
|
|
|
|
|
+
|
|
|
|
|
+ /* En-tête */
|
|
|
|
|
+ h('div', { class: 'h2', style: 'margin-bottom:6px' }, ['Et maintenant ?']),
|
|
|
|
|
+ h('p', { class: 'lead', style: 'margin-bottom:24px' }, [
|
|
|
|
|
+ 'Votre diagnostic révèle des opportunités concrètes. Nous pouvons vous aider à les transformer en plan d\'action avec les bons outils digitaux.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ /* CTAs commerciaux */
|
|
|
|
|
+ h('div', { class: 'cta-block' }, [
|
|
|
|
|
+ BOOKING_URL ? h('a', {
|
|
|
|
|
+ class: 'btn btn--primary btn--cta-main',
|
|
|
|
|
+ href: BOOKING_URL, target: '_blank', rel: 'noreferrer',
|
|
|
|
|
+ }, ['📅\u00a0 Réserver un appel découverte gratuit — 30 min']) : null,
|
|
|
|
|
+
|
|
|
|
|
+ DEVIS_URL ? h('a', {
|
|
|
|
|
+ class: 'btn btn--outline btn--cta-secondary',
|
|
|
|
|
+ href: DEVIS_URL,
|
|
|
|
|
+ }, ['✉\u00a0 Demander un devis']) : null,
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('p', { class: 'hint', style: 'text-align:center;margin-top:10px' }, [
|
|
|
|
|
+ 'Pas d\'engagement. On analyse vos résultats ensemble et on vous propose une solution adaptée.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ /* Séparateur */
|
|
|
|
|
+ h('hr', { style: 'border:none;border-top:1px solid var(--border,#e2e8f0);margin:24px 0' }),
|
|
|
|
|
+
|
|
|
|
|
+ /* Actions secondaires */
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'justify-content:center;gap:10px' }, [
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ class: 'btn btn--outline',
|
|
|
|
|
+ onClick: () => document.getElementById('pdfDialog')?.showModal(),
|
|
|
|
|
+ }, ['⬇\u00a0 Télécharger mon PDF']),
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ class: 'btn btn--outline',
|
|
|
|
|
+ style: 'font-size:13px',
|
|
|
|
|
+ onClick: goStart,
|
|
|
|
|
+ }, ['Diagnostiquer un autre process']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+
|
|
|
|
|
+ /* Score header */
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { style: 'display:flex;align-items:center;gap:10px;margin-bottom:16px' }, [
|
|
|
|
|
+ h('span', { class: 'tag' }, [state.pack?.pack_title || '']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'scoreBox' }, [
|
|
|
|
|
+ h('div', {}, [
|
|
|
|
|
+ h('div', { class: 'scoreLabel' }, ['Score global']),
|
|
|
|
|
+ h('div', { class: 'scoreBig' }, [`${r.score_total}/100`]),
|
|
|
|
|
+ h('div', { class: 'level-badge', style: 'margin-top:10px' }, [
|
|
|
|
|
+ h('span', { class: 'level-dot', style: `background:${dotColor}` }),
|
|
|
|
|
+ h('span', {}, [`${r.level} — ${r.level_label}`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'confidence' }, [`Confiance du diagnostic : ${r.confidence?.label || ''}`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'pillars' }, pillarRows),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ /* V2 : carte diagnostic (toujours visible) */
|
|
|
|
|
+ v2 ? renderV2Diagnostic() : null,
|
|
|
|
|
+
|
|
|
|
|
+ /* Non-V2 : risques (toujours visibles) */
|
|
|
|
|
+ !v2 ? h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['3 risques probables']),
|
|
|
|
|
+ riskItems.length
|
|
|
|
|
+ ? h('ol', { class: 'list' }, riskItems)
|
|
|
|
|
+ : h('p', { class: 'muted small' }, ['Aucun risque majeur détecté.']),
|
|
|
|
|
+ ]) : null,
|
|
|
|
|
+
|
|
|
|
|
+ /* Non-V2 : coût caché */
|
|
|
|
|
+ !v2 && cost ? h('div', { class: 'cost-block' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['Coût caché estimé']),
|
|
|
|
|
+ h('div', { class: 'cost-figures' }, [
|
|
|
|
|
+ h('div', { class: 'cost-fig' }, [
|
|
|
|
|
+ h('span', { class: 'val' }, [`${cost.hours_per_month} h`]),
|
|
|
|
|
+ h('span', { class: 'lbl' }, ['par mois (estimé)']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'cost-fig' }, [
|
|
|
|
|
+ h('span', { class: 'val' }, [`~${cost.eur_per_month} €`]),
|
|
|
|
|
+ h('span', { class: 'lbl' }, ['par mois (indicatif)']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint' }, ['Estimation indicative, à valider par mesure réelle.']),
|
|
|
|
|
+ ]) : null,
|
|
|
|
|
+
|
|
|
|
|
+ /* Gate ou contenu débloqué */
|
|
|
|
|
+ unlocked ? null : renderUnlockGate(),
|
|
|
|
|
+
|
|
|
|
|
+ /* V2 : mini plan (débloqué) */
|
|
|
|
|
+ v2 ? renderMiniPlan() : null,
|
|
|
|
|
+
|
|
|
|
|
+ /* Non-V2 : quick wins (débloqués) */
|
|
|
|
|
+ !v2 && unlocked ? h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['5 quick wins prioritaires']),
|
|
|
|
|
+ winItems.length
|
|
|
|
|
+ ? h('ol', { class: 'list' }, winItems)
|
|
|
|
|
+ : h('p', { class: 'muted small' }, ['—']),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin-top:8px' }, ['Le PDF contient les 5 actions avec détail effort/impact.']),
|
|
|
|
|
+ ]) : null,
|
|
|
|
|
+
|
|
|
|
|
+ /* CTA débloqué */
|
|
|
|
|
+ unlocked ? renderUnlockedCtas() : null,
|
|
|
|
|
+
|
|
|
|
|
+ renderPdfDialog(),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── PDF DIALOG ── */
|
|
|
|
|
+function renderPdfDialog() {
|
|
|
|
|
+ const onSubmit = async (e) => {
|
|
|
|
|
+ e.preventDefault();
|
|
|
|
|
+ const email = e.target.email.value.trim();
|
|
|
|
|
+ if (!email) return;
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await fetch(`${API_BASE}/pdf.php`, {
|
|
|
|
|
+ method: 'POST',
|
|
|
|
|
+ headers: { 'Content-Type': 'application/json' },
|
|
|
|
|
+ body: JSON.stringify({
|
|
|
|
|
+ pack_id: state.packId, answers: state.answers,
|
|
|
|
|
+ optional: state.optional, booking_url: BOOKING_URL, email,
|
|
|
|
|
+ }),
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!res.ok) { const j = await res.json().catch(() => ({})); throw new Error(j?.error || 'Erreur PDF'); }
|
|
|
|
|
+ const blob = await res.blob();
|
|
|
|
|
+ const url = URL.createObjectURL(blob);
|
|
|
|
|
+ const a = document.createElement('a');
|
|
|
|
|
+ a.href = url; a.download = `controle-technique-${state.packId}.pdf`;
|
|
|
|
|
+ document.body.appendChild(a); a.click(); a.remove(); URL.revokeObjectURL(url);
|
|
|
|
|
+ document.getElementById('pdfDialog')?.close();
|
|
|
|
|
+ } catch (err) { alert(err.message || 'Erreur'); }
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ return h('dialog', { id: 'pdfDialog', class: 'dialog' }, [
|
|
|
|
|
+ h('form', { class: 'dialog__inner', onSubmit }, [
|
|
|
|
|
+ h('div', { class: 'dialog__head' }, [
|
|
|
|
|
+ h('strong', {}, ['Télécharger votre synthèse PDF']),
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', style: 'padding:6px 12px;font-size:13px', type: 'button',
|
|
|
|
|
+ onClick: () => document.getElementById('pdfDialog')?.close() }, ['Fermer']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'dialog__body' }, [
|
|
|
|
|
+ h('div', { class: 'field' }, [
|
|
|
|
|
+ h('label', { for: 'pdfEmail' }, ['Email professionnel']),
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ id: 'pdfEmail', name: 'email', type: 'email', required: 'required',
|
|
|
|
|
+ placeholder: 'vous@entreprise.com',
|
|
|
|
|
+ value: state.captureEmail || '',
|
|
|
|
|
+ }),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('label', { class: 'check' }, [
|
|
|
|
|
+ h('input', { type: 'checkbox', required: 'required' }),
|
|
|
|
|
+ h('span', {}, ['J\'accepte de recevoir mon PDF et un email de suivi éventuel.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:14px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', type: 'submit' }, ['Télécharger mon PDF →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint' }, ['Désinscription en 1 clic. Suppression des données sur demande.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ════════════════════════════════════════════════════
|
|
|
|
|
+ ROI CALCULATOR — données & calcul
|
|
|
|
|
+════════════════════════════════════════════════════ */
|
|
|
|
|
+
|
|
|
|
|
+const ROI_DEFAULTS = { coutHoraire: 60, tauxErreurs: 10, tempsErreur: 15 };
|
|
|
|
|
+
|
|
|
|
|
+function computeRoi(inp) {
|
|
|
|
|
+ const v = Math.max(0, parseFloat(inp.volume) || 0);
|
|
|
|
|
+ const tA = Math.max(0, parseFloat(inp.tempsActuel) || 0);
|
|
|
|
|
+ const tC = Math.max(0, parseFloat(inp.tempsCible) || 0);
|
|
|
|
|
+ const ch = inp.coutHoraire !== '' ? (parseFloat(inp.coutHoraire) || 0) : ROI_DEFAULTS.coutHoraire;
|
|
|
|
|
+ const te = inp.tauxErreurs !== '' ? (parseFloat(inp.tauxErreurs) || 0) : ROI_DEFAULTS.tauxErreurs;
|
|
|
|
|
+ const tpe = inp.tempsErreur !== '' ? (parseFloat(inp.tempsErreur) || 0) : ROI_DEFAULTS.tempsErreur;
|
|
|
|
|
+
|
|
|
|
|
+ const usedDefaults = [inp.coutHoraire, inp.tauxErreurs, inp.tempsErreur].filter(x => x === '').length;
|
|
|
|
|
+ const confidence = usedDefaults === 0 ? 'Fort' : usedDefaults <= 1 ? 'Moyen' : 'Faible';
|
|
|
|
|
+
|
|
|
|
|
+ const gainTempsMin = v * Math.max(0, tA - tC);
|
|
|
|
|
+ const gainTempsH = gainTempsMin / 60;
|
|
|
|
|
+ const gainTraitement = gainTempsH * ch;
|
|
|
|
|
+
|
|
|
|
|
+ const nbErreurs = v * (te / 100);
|
|
|
|
|
+ const gainErreursMin = nbErreurs * tpe;
|
|
|
|
|
+ const gainErreursH = gainErreursMin / 60;
|
|
|
|
|
+ const gainErreurs = gainErreursH * ch;
|
|
|
|
|
+
|
|
|
|
|
+ const roiMensuel = gainTraitement + gainErreurs;
|
|
|
|
|
+ const roiAnnuel = roiMensuel * 12;
|
|
|
|
|
+
|
|
|
|
|
+ const levers = [
|
|
|
|
|
+ { label: 'Gain de traitement', euros: gainTraitement, heures: gainTempsH, detail: `${v} cas × ${Math.max(0, tA - tC)} min gagnées` },
|
|
|
|
|
+ { label: 'Réduction des erreurs', euros: gainErreurs, heures: gainErreursH, detail: `~${Math.round(nbErreurs * 10) / 10} erreurs évitées × ${tpe} min` },
|
|
|
|
|
+ ].sort((a, b) => b.euros - a.euros);
|
|
|
|
|
+
|
|
|
|
|
+ const conclusion =
|
|
|
|
|
+ roiAnnuel >= 50000 ? 'À ce niveau, l\'investissement se rentabilise en quelques semaines — difficile de ne pas le faire.' :
|
|
|
|
|
+ roiAnnuel >= 20000 ? 'À ce niveau, ça se rentabilise en moins de 3 mois sur la plupart des projets.' :
|
|
|
|
|
+ roiAnnuel >= 5000 ? 'Des gains concrets et mesurables — suffisant pour déclencher une discussion interne.' :
|
|
|
|
|
+ 'Des gains modestes en valeur absolue, mais chaque heure récupérée libère du temps à forte valeur.';
|
|
|
|
|
+
|
|
|
|
|
+ return { gainTempsH, gainTraitement, gainErreursH, gainErreurs, roiMensuel, roiAnnuel, levers, conclusion, confidence, usedDefaults };
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function renderRoi() {
|
|
|
|
|
+ const inp = state.roiInputs;
|
|
|
|
|
+
|
|
|
|
|
+ const roiField = (key, label, unit, required, placeholder, defHint) =>
|
|
|
|
|
+ h('div', { class: 'roi-field' }, [
|
|
|
|
|
+ h('label', { for: `roi_${key}` }, [
|
|
|
|
|
+ label,
|
|
|
|
|
+ h('span', { class: 'roi-unit' }, [` (${unit})`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('input', {
|
|
|
|
|
+ id: `roi_${key}`, type: 'number', min: '0', step: 'any',
|
|
|
|
|
+ required: required ? 'required' : null,
|
|
|
|
|
+ placeholder: placeholder != null ? String(placeholder) : undefined,
|
|
|
|
|
+ value: inp[key] !== undefined ? String(inp[key]) : '',
|
|
|
|
|
+ onInput: (e) => { state.roiInputs[key] = e.target.value; },
|
|
|
|
|
+ }),
|
|
|
|
|
+ defHint ? h('div', { class: 'field-hint' }, [defHint]) : null,
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('form', { class: 'card', onSubmit: (e) => { e.preventDefault(); state.roiResult = computeRoi(state.roiInputs); setView('roi-results'); } }, [
|
|
|
|
|
+ h('div', { style: 'margin-bottom:14px' }, [h('span', { class: 'tag tag--roi' }, ['ROI Calculator'])]),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Calculez le gain potentiel de votre optimisation']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [
|
|
|
|
|
+ 'Renseignez vos données — les valeurs par défaut permettent d\'avancer sans avoir tous les chiffres.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:18px' }, ['Données de base']),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin:0 0 10px' }, ['Ces 3 champs sont nécessaires au calcul.']),
|
|
|
|
|
+ h('div', { class: 'roi-grid' }, [
|
|
|
|
|
+ roiField('volume', 'Volume mensuel', 'cas/mois', true, 80),
|
|
|
|
|
+ roiField('tempsActuel', 'Temps actuel par cas', 'min', true, 45),
|
|
|
|
|
+ roiField('tempsCible', 'Temps cible après opt.', 'min', true, 20),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'section-label', style: 'margin-top:20px' }, ['Paramètres de coût']),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin:0 0 10px' }, ['Pré-remplis avec des valeurs types — modifiez si vous les connaissez.']),
|
|
|
|
|
+ h('div', { class: 'roi-grid' }, [
|
|
|
|
|
+ roiField('coutHoraire', 'Coût horaire chargé', '€/h', false, null, 'Par défaut : 60 €/h'),
|
|
|
|
|
+ roiField('tauxErreurs', 'Taux erreurs / retours', '%', false, null, 'Par défaut : 10 %'),
|
|
|
|
|
+ roiField('tempsErreur', 'Temps perdu par erreur', 'min', false, null, 'Par défaut : 15 min'),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:24px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', type: 'button', onClick: () => setView('select') }, ['← Retour']),
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', type: 'submit' }, ['Calculer mon ROI →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function renderRoiResults() {
|
|
|
|
|
+ const r = state.roiResult;
|
|
|
|
|
+ if (!r) { setView('roi'); return h('div', {}); }
|
|
|
|
|
+
|
|
|
|
|
+ const fmt = (n) => Math.round(n).toLocaleString('fr-FR');
|
|
|
|
|
+ const fmtH = (n) => n < 1 ? `${Math.round(n * 60)} min` : `${(Math.round(n * 10) / 10).toLocaleString('fr-FR')} h`;
|
|
|
|
|
+
|
|
|
|
|
+ const confClass = { Fort: 'confidence-pill--fort', Moyen: 'confidence-pill--moyen', Faible: 'confidence-pill--faible' }[r.confidence] || '';
|
|
|
|
|
+ const confLabel = {
|
|
|
|
|
+ Fort: '● Confiance forte — vos propres chiffres',
|
|
|
|
|
+ Moyen: '◐ Confiance moyenne — mix données + défauts',
|
|
|
|
|
+ Faible: '○ Confiance faible — majorité de valeurs par défaut',
|
|
|
|
|
+ }[r.confidence] || '';
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { style: 'display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:12px' }, [
|
|
|
|
|
+ h('span', { class: 'tag tag--roi' }, ['ROI Calculator — Résultats']),
|
|
|
|
|
+ h('span', { class: `confidence-pill ${confClass}` }, [confLabel]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'roi-hero' }, [
|
|
|
|
|
+ h('div', { class: 'roi-hero__item' }, [
|
|
|
|
|
+ h('div', { class: 'roi-hero__val' }, [`${fmt(r.roiMensuel)} €`]),
|
|
|
|
|
+ h('div', { class: 'roi-hero__lbl' }, ['ROI mensuel estimé']),
|
|
|
|
|
+ h('div', { class: 'roi-hero__sub' }, [`≈ ${fmt(r.roiAnnuel)} €/an`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'roi-hero__sep' }),
|
|
|
|
|
+ h('div', { class: 'roi-hero__item' }, [
|
|
|
|
|
+ h('div', { class: 'roi-hero__val' }, [fmtH(r.gainTempsH + r.gainErreursH)]),
|
|
|
|
|
+ h('div', { class: 'roi-hero__lbl' }, ['Heures récupérées / mois']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['Les 2 leviers qui pèsent le plus']),
|
|
|
|
|
+ h('div', { class: 'lever-cards' }, r.levers.map((l, i) =>
|
|
|
|
|
+ h('div', { class: `lever-card${i === 0 ? ' lever-card--top' : ''}` }, [
|
|
|
|
|
+ h('div', { class: 'lever-card__lbl' }, [i === 0 ? '🏆 Levier principal' : 'Levier secondaire']),
|
|
|
|
|
+ h('div', { style: 'font-weight:700;font-size:15px;color:var(--navy);margin:4px 0 2px' }, [l.label]),
|
|
|
|
|
+ h('div', { class: 'lever-card__amt' }, [`${fmt(l.euros)} €/mois`]),
|
|
|
|
|
+ h('div', { class: 'lever-card__det' }, [`${fmtH(l.heures)} récupérées · ${l.detail}`]),
|
|
|
|
|
+ ])
|
|
|
|
|
+ )),
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'conclusion-box' }, [
|
|
|
|
|
+ h('p', {}, [r.conclusion]),
|
|
|
|
|
+ r.usedDefaults > 0
|
|
|
|
|
+ ? h('p', { class: 'hint' }, [
|
|
|
|
|
+ `${r.usedDefaults} valeur${r.usedDefaults > 1 ? 's' : ''} par défaut utilisée${r.usedDefaults > 1 ? 's' : ''} — affinez avec vos chiffres réels pour plus de précision.`,
|
|
|
|
|
+ ])
|
|
|
|
|
+ : null,
|
|
|
|
|
+ ]),
|
|
|
|
|
+
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['Et maintenant ?']),
|
|
|
|
|
+ h('p', { class: 'lead', style: 'margin-bottom:16px' }, [
|
|
|
|
|
+ 'Utilisez ces chiffres pour déclencher une décision. La prochaine étape : identifier les 3 actions concrètes à mettre en œuvre.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--primary', onClick: () => setView('qwf') }, ['Trouver mes 3 quick wins →']),
|
|
|
|
|
+ BOOKING_URL ? h('a', { class: 'btn btn--outline', href: BOOKING_URL, target: '_blank', rel: 'noreferrer' }, ['Réserver un appel découverte']) : null,
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:6px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', style: 'font-size:13px', onClick: () => setView('roi') }, ['← Modifier mes données']),
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', style: 'font-size:13px', onClick: () => setView('select') }, ['Autres outils']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ════════════════════════════════════════════════════
|
|
|
|
|
+ QUICK WINS FINDER — données & calcul
|
|
|
|
|
+════════════════════════════════════════════════════ */
|
|
|
|
|
+
|
|
|
|
|
+const QW_LIBRARY = [
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'statuts-notifications',
|
|
|
|
|
+ title: 'Statuts uniques + notifications ciblées',
|
|
|
|
|
+ result: 'Fin des relances et visibilité instantanée sur l\'avancement',
|
|
|
|
|
+ setup: 'Statut central (ex : "à valider", "en cours IT", "bloqué", "terminé") + notifications automatiques aux bons rôles',
|
|
|
|
|
+ prereqs: 'Définir un owner, les statuts métier, accès boîtes mail ou Teams',
|
|
|
|
|
+ effort: 'S à M', delay: '2 à 4 semaines',
|
|
|
|
|
+ impact: ['Baisse du délai global', 'Moins d\'interruptions', 'Moins de relances'],
|
|
|
|
|
+ triggers: { relancesFrequentes: 3, validationsMultiples: 1 },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'formulaire-intelligent',
|
|
|
|
|
+ title: 'Formulaire intelligent de collecte',
|
|
|
|
|
+ result: 'Moins de retours arrière, dossiers complets dès le départ',
|
|
|
|
|
+ setup: 'Champs conditionnels + contrôles à la saisie + pièces demandées au bon moment + validation de cohérence',
|
|
|
|
|
+ prereqs: 'Liste des champs obligatoires, règles simples, rôles définis',
|
|
|
|
|
+ effort: 'M', delay: '3 à 6 semaines',
|
|
|
|
|
+ impact: ['Baisse des erreurs', 'Baisse du temps de traitement', 'Moins de rejets'],
|
|
|
|
|
+ triggers: { erreursFréquentes: 3, validationsMultiples: 2 },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'suppression-double-saisie',
|
|
|
|
|
+ title: 'Suppression de la double saisie entre outils',
|
|
|
|
|
+ result: 'Arrêt du copier-coller Excel/email vers outil final',
|
|
|
|
|
+ setup: 'Synchronisation des champs clés (push) ou import structuré automatique entre les outils',
|
|
|
|
|
+ prereqs: 'Accès API ou export/import structuré, mapping des champs clés',
|
|
|
|
|
+ effort: 'M', delay: '4 à 8 semaines',
|
|
|
|
|
+ impact: ['Gain de temps direct', 'Moins d\'erreurs de saisie', 'Données fiables partout'],
|
|
|
|
|
+ triggers: { doubleSaisie: 3, nbOutilsEleve: 2 },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'dossier-unique',
|
|
|
|
|
+ title: 'Dossier unique par dossier',
|
|
|
|
|
+ result: 'Fin du chaos documentaire — tout au même endroit',
|
|
|
|
|
+ setup: 'Convention de nommage + dépôt structuré des pièces + lien unique accessible depuis le process',
|
|
|
|
|
+ prereqs: 'Choix d\'un espace de stockage partagé, définition des règles de nommage',
|
|
|
|
|
+ effort: 'S', delay: '1 à 3 semaines',
|
|
|
|
|
+ impact: ['Moins de temps perdu à chercher', 'Moins d\'erreurs', 'Meilleure traçabilité'],
|
|
|
|
|
+ triggers: { docsEparpilles: 3, erreursFréquentes: 1 },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'workflow-validation',
|
|
|
|
|
+ title: 'Workflow de validation simplifié',
|
|
|
|
|
+ result: 'Validation en un clic, délais réduits, zéro perte en route',
|
|
|
|
|
+ setup: 'Règles de validation claires + SLA définis + tableau de bord de suivi des en-cours',
|
|
|
|
|
+ prereqs: 'Matrice de validation, SLA définis, accès configuré pour les validateurs',
|
|
|
|
|
+ effort: 'M', delay: '3 à 5 semaines',
|
|
|
|
|
+ impact: ['Baisse du délai global', 'Moins de blocages', 'Meilleure traçabilité'],
|
|
|
|
|
+ triggers: { validationsMultiples: 3, relancesFrequentes: 1 },
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'exports-automatiques',
|
|
|
|
|
+ title: 'Exports propres automatiques',
|
|
|
|
|
+ result: 'Fin du reporting manuel — données toujours à jour',
|
|
|
|
|
+ setup: 'Export planifié + format standard + envoi automatique aux destinataires',
|
|
|
|
|
+ prereqs: 'Accès aux sources de données, liste des destinataires, fréquence définie',
|
|
|
|
|
+ effort: 'S à M', delay: '2 à 5 semaines',
|
|
|
|
|
+ impact: ['Temps récupéré sur le reporting', 'Fiabilité des données', 'Partage facilité'],
|
|
|
|
|
+ triggers: { reportingManuel: 3, nbOutilsEleve: 1 },
|
|
|
|
|
+ },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+const QWF_QUESTIONS = [
|
|
|
|
|
+ { id: 'doubleSaisie', label: 'Des données sont saisies manuellement dans plusieurs outils différents (copier-coller, ressaisie…)' },
|
|
|
|
|
+ { id: 'validationsMultiples', label: 'Plusieurs personnes ou étapes distinctes doivent valider chaque dossier' },
|
|
|
|
|
+ { id: 'relancesFrequentes', label: 'Des relances sont nécessaires pour savoir où en est un dossier' },
|
|
|
|
|
+ { id: 'docsEparpilles', label: 'Les documents d\'un dossier sont éparpillés (email, drive, bureau local…)' },
|
|
|
|
|
+ { id: 'reportingManuel', label: 'Du reporting est préparé manuellement (copier-coller, recomposition de données)' },
|
|
|
|
|
+ { id: 'erreursFréquentes', label: 'Des dossiers reviennent en arrière à cause d\'informations manquantes ou incorrectes' },
|
|
|
|
|
+ { id: 'nbOutilsEleve', label: 'Ce process fait intervenir 3 outils ou plus (ERP, email, tableur, outil métier…)' },
|
|
|
|
|
+];
|
|
|
|
|
+
|
|
|
|
|
+function computeQuickWins(signals) {
|
|
|
|
|
+ return QW_LIBRARY
|
|
|
|
|
+ .map(qw => {
|
|
|
|
|
+ let score = 0;
|
|
|
|
|
+ for (const [trigger, weight] of Object.entries(qw.triggers)) {
|
|
|
|
|
+ if (signals[trigger]) score += weight;
|
|
|
|
|
+ }
|
|
|
|
|
+ return { ...qw, score };
|
|
|
|
|
+ })
|
|
|
|
|
+ .sort((a, b) => b.score - a.score)
|
|
|
|
|
+ .slice(0, 3);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function renderQwf() {
|
|
|
|
|
+ const sig = state.qwfSignals;
|
|
|
|
|
+
|
|
|
|
|
+ const makeSignalRow = (q) => {
|
|
|
|
|
+ const isOui = sig[q.id] === true;
|
|
|
|
|
+ const isNon = sig[q.id] === false;
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'signal-row' }, [
|
|
|
|
|
+ h('span', { class: 'signal-row__lbl' }, [q.label]),
|
|
|
|
|
+ h('div', { class: 'signal-row__btns' }, [
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ type: 'button',
|
|
|
|
|
+ class: `signal-btn signal-btn--oui${isOui ? ' active' : ''}`,
|
|
|
|
|
+ onClick: () => { state.qwfSignals[q.id] = isOui ? undefined : true; render(); },
|
|
|
|
|
+ }, ['Oui']),
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ type: 'button',
|
|
|
|
|
+ class: `signal-btn signal-btn--non${isNon ? ' active' : ''}`,
|
|
|
|
|
+ onClick: () => { state.qwfSignals[q.id] = isNon ? undefined : false; render(); },
|
|
|
|
|
+ }, ['Non']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ const answeredCount = QWF_QUESTIONS.filter(q => sig[q.id] !== undefined).length;
|
|
|
|
|
+ const canSubmit = answeredCount >= 3;
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { style: 'margin-bottom:14px' }, [h('span', { class: 'tag tag--qwf' }, ['Quick Wins Finder'])]),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Identifiez vos 3 actions prioritaires']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [
|
|
|
|
|
+ 'Répondez à ces 7 signaux pour recevoir 3 recommandations concrètes adaptées à votre process.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'signal-list' }, QWF_QUESTIONS.map(makeSignalRow)),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:22px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', onClick: () => setView('select') }, ['← Retour']),
|
|
|
|
|
+ h('button', {
|
|
|
|
|
+ class: 'btn btn--primary',
|
|
|
|
|
+ disabled: canSubmit ? null : 'disabled',
|
|
|
|
|
+ onClick: () => { if (canSubmit) { state.qwfResult = computeQuickWins(state.qwfSignals); setView('qwf-results'); } },
|
|
|
|
|
+ }, [canSubmit ? 'Voir mes 3 quick wins →' : `Répondre à encore ${3 - answeredCount} signal${3 - answeredCount > 1 ? 's' : ''}`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('p', { class: 'hint', style: 'margin-top:8px' }, ['Répondez à au moins 3 signaux pour déverrouiller le résultat.']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function renderQwfResults() {
|
|
|
|
|
+ const qws = state.qwfResult;
|
|
|
|
|
+ if (!qws || qws.length === 0) { setView('qwf'); return h('div', {}); }
|
|
|
|
|
+
|
|
|
|
|
+ const makeQwCard = (qw, idx) =>
|
|
|
|
|
+ h('div', { class: 'qw-card' }, [
|
|
|
|
|
+ h('div', { class: 'qw-card__head' }, [
|
|
|
|
|
+ h('div', { class: 'qw-card__num' }, [String(idx + 1)]),
|
|
|
|
|
+ h('div', { class: 'qw-card__head-title' }, [qw.title]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'qw-card__body' }, [
|
|
|
|
|
+ h('div', { class: 'qw-card__result' }, [`✓ ${qw.result}`]),
|
|
|
|
|
+ h('div', { class: 'qw-section' }, [
|
|
|
|
|
+ h('div', { class: 'qw-section__lbl' }, ['Ce qu\'on met en place']),
|
|
|
|
|
+ h('div', { class: 'qw-section__val' }, [qw.setup]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'qw-section' }, [
|
|
|
|
|
+ h('div', { class: 'qw-section__lbl' }, ['Pré-requis']),
|
|
|
|
|
+ h('div', { class: 'qw-section__val' }, [qw.prereqs]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'qw-meta' }, [
|
|
|
|
|
+ h('span', { class: 'badge-effort' }, [`Effort : ${qw.effort}`]),
|
|
|
|
|
+ h('span', { class: 'badge-delay' }, [`Délai : ${qw.delay}`]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'impact-chips' }, qw.impact.map(i =>
|
|
|
|
|
+ h('span', { class: 'impact-chip' }, [i])
|
|
|
|
|
+ )),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ return h('div', { class: 'grid' }, [
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { style: 'margin-bottom:12px' }, [h('span', { class: 'tag tag--qwf' }, ['Quick Wins Finder — Résultats'])]),
|
|
|
|
|
+ h('h1', { class: 'h1' }, ['Vos 3 actions prioritaires']),
|
|
|
|
|
+ h('p', { class: 'lead' }, [
|
|
|
|
|
+ 'Commencez par la première — elle a le plus fort impact selon vos signaux. Chaque fiche contient tout ce qu\'il faut pour démarrer.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'qw-cards' }, qws.map(makeQwCard)),
|
|
|
|
|
+ h('div', { class: 'card' }, [
|
|
|
|
|
+ h('div', { class: 'h2' }, ['Et maintenant ?']),
|
|
|
|
|
+ h('p', { class: 'lead', style: 'margin-bottom:16px' }, [
|
|
|
|
|
+ 'Ces 3 quick wins sont un point de départ solide. Un appel découverte permet de valider les priorités et de cadrer le quick win n°1 en plan d\'action.',
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow' }, [
|
|
|
|
|
+ BOOKING_URL ? h('a', {
|
|
|
|
|
+ class: 'btn btn--primary', href: BOOKING_URL, target: '_blank', rel: 'noreferrer',
|
|
|
|
|
+ }, ['📅\u00a0 Réserver un appel découverte — 30 min']) : null,
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', onClick: () => setView('roi') }, ['Calculer le ROI →']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ h('div', { class: 'btnrow', style: 'margin-top:6px' }, [
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', style: 'font-size:13px', onClick: () => setView('qwf') }, ['← Modifier mes signaux']),
|
|
|
|
|
+ h('button', { class: 'btn btn--outline', style: 'font-size:13px', onClick: () => setView('select') }, ['Autres outils']),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]),
|
|
|
|
|
+ ]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── RENDER ── */
|
|
|
|
|
+function render() {
|
|
|
|
|
+ if (!appEl) return;
|
|
|
|
|
+ appEl.innerHTML = '';
|
|
|
|
|
+ const views = {
|
|
|
|
|
+ landing: renderLanding,
|
|
|
|
|
+ select: renderSelect,
|
|
|
|
|
+ intro: renderIntro,
|
|
|
|
|
+ quiz: renderQuiz,
|
|
|
|
|
+ optional: renderOptional,
|
|
|
|
|
+ results: renderResults,
|
|
|
|
|
+ 'roi': renderRoi,
|
|
|
|
|
+ 'roi-results': renderRoiResults,
|
|
|
|
|
+ 'qwf': renderQwf,
|
|
|
|
|
+ 'qwf-results': renderQwfResults,
|
|
|
|
|
+ };
|
|
|
|
|
+ appEl.appendChild((views[state.view] || renderLanding)());
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/* ── HEADER update ── */
|
|
|
|
|
+function initHeader() {
|
|
|
|
|
+ const header = document.querySelector('.header');
|
|
|
|
|
+ if (!header) return;
|
|
|
|
|
+ header.innerHTML = '';
|
|
|
|
|
+ const brand = document.createElement('div');
|
|
|
|
|
+ brand.innerHTML =
|
|
|
|
|
+ '<div class="brand__logo">Contrôle technique process</div>' +
|
|
|
|
|
+ '<div class="brand__sub">Diagnostic self-serve · Livinweb</div>';
|
|
|
|
|
+ const badge = document.createElement('span');
|
|
|
|
|
+ badge.className = 'brand__badge';
|
|
|
|
|
+ badge.textContent = 'V1';
|
|
|
|
|
+ header.appendChild(brand);
|
|
|
|
|
+ header.appendChild(badge);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+initHeader();
|
|
|
|
|
+render();
|