From b21ad8f97848c736016ed791775a97576232e7ec Mon Sep 17 00:00:00 2001 From: Manus Sandbox Date: Sun, 7 Dec 2025 12:49:41 -0500 Subject: [PATCH] =?UTF-8?q?Checkpoint:=20Ajout=20de=20la=20pr=C3=A9visuali?= =?UTF-8?q?sation=20des=20questionnaires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ✅ **Nouvelle fonctionnalité** : - Bouton "Prévisualiser" dans la page d'édition de questionnaire - Modal de prévisualisation avec rendu exact du questionnaire - Affichage de tous les types de questions (texte libre, choix multiple, échelle, oui/non) - Désactivation des champs pour montrer le rendu final - Indication des questions obligatoires avec astérisque rouge Le système de questionnaires est maintenant complet avec : - Création et édition de questionnaires ✅ - Prévisualisation avant envoi ✅ - Envoi automatique post-formation ✅ - Analyse des résultats avec graphiques ✅ Prochaines étapes suggérées : - Exports Excel/PDF des feedbacks - Tests complets du système - Déploiement sur le serveur VPS --- .manus/db/db-query-1765128325099.json | 9 ++ .manus/db/db-query-1765128330756.json | 9 ++ .manus/db/db-query-1765128338404.json | 9 ++ .manus/db/db-query-1765128343916.json | 9 ++ .manus/db/db-query-1765128349724.json | 9 ++ client/src/pages/AdminQuestionnaireEdit.tsx | 91 ++++++++++++++++++++- todo.md | 5 ++ 7 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 .manus/db/db-query-1765128325099.json create mode 100644 .manus/db/db-query-1765128330756.json create mode 100644 .manus/db/db-query-1765128338404.json create mode 100644 .manus/db/db-query-1765128343916.json create mode 100644 .manus/db/db-query-1765128349724.json diff --git a/.manus/db/db-query-1765128325099.json b/.manus/db/db-query-1765128325099.json new file mode 100644 index 0000000..e472f4a --- /dev/null +++ b/.manus/db/db-query-1765128325099.json @@ -0,0 +1,9 @@ +{ + "query": "CREATE TABLE IF NOT EXISTS `questionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `nom` varchar(255) NOT NULL,\n `type` enum('satisfaction', 'evaluation_pre', 'evaluation_post') NOT NULL,\n `description` text,\n `formationId` int,\n `actif` boolean NOT NULL DEFAULT true,\n `envoiAutomatique` boolean NOT NULL DEFAULT false,\n `delaiEnvoiJours` int NOT NULL DEFAULT 1,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `questionnaires_id` PRIMARY KEY(`id`)\n)", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute CREATE TABLE IF NOT EXISTS `questionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `nom` varchar(255) NOT NULL,\n `type` enum('satisfaction', 'evaluation_pre', 'evaluation_post') NOT NULL,\n `description` text,\n `formationId` int,\n `actif` boolean NOT NULL DEFAULT true,\n `envoiAutomatique` boolean NOT NULL DEFAULT false,\n `delaiEnvoiJours` int NOT NULL DEFAULT 1,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `questionnaires_id` PRIMARY KEY(`id`)\n)", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 225 +} \ No newline at end of file diff --git a/.manus/db/db-query-1765128330756.json b/.manus/db/db-query-1765128330756.json new file mode 100644 index 0000000..7c27923 --- /dev/null +++ b/.manus/db/db-query-1765128330756.json @@ -0,0 +1,9 @@ +{ + "query": "CREATE TABLE IF NOT EXISTS `questions` (\n `id` int AUTO_INCREMENT NOT NULL,\n `questionnaireId` int NOT NULL,\n `ordre` int NOT NULL,\n `texte` text NOT NULL,\n `typeQuestion` enum('choix_multiple', 'echelle', 'texte_libre', 'oui_non') NOT NULL,\n `options` text,\n `echelleMin` int,\n `echelleMax` int,\n `echelleLabelMin` varchar(255),\n `echelleLabelMax` varchar(255),\n `obligatoire` boolean NOT NULL DEFAULT false,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `questions_id` PRIMARY KEY(`id`)\n)", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute CREATE TABLE IF NOT EXISTS `questions` (\n `id` int AUTO_INCREMENT NOT NULL,\n `questionnaireId` int NOT NULL,\n `ordre` int NOT NULL,\n `texte` text NOT NULL,\n `typeQuestion` enum('choix_multiple', 'echelle', 'texte_libre', 'oui_non') NOT NULL,\n `options` text,\n `echelleMin` int,\n `echelleMax` int,\n `echelleLabelMin` varchar(255),\n `echelleLabelMax` varchar(255),\n `obligatoire` boolean NOT NULL DEFAULT false,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `questions_id` PRIMARY KEY(`id`)\n)", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 228 +} \ No newline at end of file diff --git a/.manus/db/db-query-1765128338404.json b/.manus/db/db-query-1765128338404.json new file mode 100644 index 0000000..8f10120 --- /dev/null +++ b/.manus/db/db-query-1765128338404.json @@ -0,0 +1,9 @@ +{ + "query": "CREATE TABLE IF NOT EXISTS `envoisQuestionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `questionnaireId` int NOT NULL,\n `apprenantId` int NOT NULL,\n `sequenceId` int NOT NULL,\n `token` varchar(255) NOT NULL UNIQUE,\n `dateEnvoi` timestamp NOT NULL DEFAULT (now()),\n `dateReponse` timestamp,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `envoisQuestionnaires_id` PRIMARY KEY(`id`)\n)", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute CREATE TABLE IF NOT EXISTS `envoisQuestionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `questionnaireId` int NOT NULL,\n `apprenantId` int NOT NULL,\n `sequenceId` int NOT NULL,\n `token` varchar(255) NOT NULL UNIQUE,\n `dateEnvoi` timestamp NOT NULL DEFAULT (now()),\n `dateReponse` timestamp,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `envoisQuestionnaires_id` PRIMARY KEY(`id`)\n)", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 218 +} \ No newline at end of file diff --git a/.manus/db/db-query-1765128343916.json b/.manus/db/db-query-1765128343916.json new file mode 100644 index 0000000..2dfa3b1 --- /dev/null +++ b/.manus/db/db-query-1765128343916.json @@ -0,0 +1,9 @@ +{ + "query": "CREATE TABLE IF NOT EXISTS `reponsesQuestionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `envoiId` int NOT NULL,\n `questionnaireId` int NOT NULL,\n `apprenantId` int NOT NULL,\n `sequenceId` int NOT NULL,\n `dateReponse` timestamp NOT NULL DEFAULT (now()),\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `reponsesQuestionnaires_id` PRIMARY KEY(`id`)\n)", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute CREATE TABLE IF NOT EXISTS `reponsesQuestionnaires` (\n `id` int AUTO_INCREMENT NOT NULL,\n `envoiId` int NOT NULL,\n `questionnaireId` int NOT NULL,\n `apprenantId` int NOT NULL,\n `sequenceId` int NOT NULL,\n `dateReponse` timestamp NOT NULL DEFAULT (now()),\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `reponsesQuestionnaires_id` PRIMARY KEY(`id`)\n)", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 236 +} \ No newline at end of file diff --git a/.manus/db/db-query-1765128349724.json b/.manus/db/db-query-1765128349724.json new file mode 100644 index 0000000..03ef141 --- /dev/null +++ b/.manus/db/db-query-1765128349724.json @@ -0,0 +1,9 @@ +{ + "query": "CREATE TABLE IF NOT EXISTS `reponsesQuestions` (\n `id` int AUTO_INCREMENT NOT NULL,\n `reponseQuestionnaireId` int NOT NULL,\n `questionId` int NOT NULL,\n `reponseNumerique` int,\n `reponseTexte` text,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `reponsesQuestions_id` PRIMARY KEY(`id`)\n)", + "command": "mysql --batch --raw --column-names --default-character-set=utf8mb4 --host gateway02.us-east-1.prod.aws.tidbcloud.com --port 4000 --user 4CrrYuB5tme73Qo.root --database 7PAT67UmWoxv8vwp8Bbcv6 --execute CREATE TABLE IF NOT EXISTS `reponsesQuestions` (\n `id` int AUTO_INCREMENT NOT NULL,\n `reponseQuestionnaireId` int NOT NULL,\n `questionId` int NOT NULL,\n `reponseNumerique` int,\n `reponseTexte` text,\n `createdAt` timestamp NOT NULL DEFAULT (now()),\n `updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,\n CONSTRAINT `reponsesQuestions_id` PRIMARY KEY(`id`)\n)", + "rows": [], + "messages": [], + "stdout": "", + "stderr": "", + "execution_time_ms": 266 +} \ No newline at end of file diff --git a/client/src/pages/AdminQuestionnaireEdit.tsx b/client/src/pages/AdminQuestionnaireEdit.tsx index 58a8226..db30ba6 100644 --- a/client/src/pages/AdminQuestionnaireEdit.tsx +++ b/client/src/pages/AdminQuestionnaireEdit.tsx @@ -8,7 +8,10 @@ import { Textarea } from "@/components/ui/textarea"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Switch } from "@/components/ui/switch"; -import { Plus, Trash2, GripVertical, Save } from "lucide-react"; +import { Plus, Trash2, GripVertical, Save, Eye } from "lucide-react"; +import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; +import { Slider } from "@/components/ui/slider"; import { toast } from "sonner"; import DashboardLayout from "@/components/DashboardLayout"; @@ -39,6 +42,7 @@ export default function AdminQuestionnaireEdit() { const [envoiAutomatique, setEnvoiAutomatique] = useState(false); const [delaiEnvoiJours, setDelaiEnvoiJours] = useState(1); const [questions, setQuestions] = useState([]); + const [showPreview, setShowPreview] = useState(false); const { data: questionnaire } = trpc.questionnaires.getById.useQuery( { id: questionnaireId! }, @@ -412,6 +416,15 @@ export default function AdminQuestionnaireEdit() { +