From b730c4f7c25b23f3dd3340705c27655a48202721 Mon Sep 17 00:00:00 2001 From: ronalds Date: Fri, 21 Nov 2025 02:15:45 -0300 Subject: [PATCH] feat: Editor de preguntas condicionales - frontend v1.0.19 --- docker-compose.hub.yml | 2 +- frontend/src/App.jsx | 138 ++++++++++++++++++++++++++++++++++------- 2 files changed, 115 insertions(+), 25 deletions(-) diff --git a/docker-compose.hub.yml b/docker-compose.hub.yml index 14e6e6a..0f79624 100644 --- a/docker-compose.hub.yml +++ b/docker-compose.hub.yml @@ -38,7 +38,7 @@ services: command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 4 frontend: - image: dymai/syntria-frontend:1.0.18 + image: dymai/syntria-frontend:1.0.19 container_name: syntria-frontend-prod restart: always depends_on: diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 9358e4f..c5c9bd2 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -908,7 +908,9 @@ function QuestionsManagerModal({ checklist, onClose }) { points: 1, allow_photos: true, max_photos: 3, - requires_comment_on_fail: false + requires_comment_on_fail: false, + parent_question_id: null, + show_if_answer: '' }) useEffect(() => { @@ -963,7 +965,9 @@ function QuestionsManagerModal({ checklist, onClose }) { points: 1, allow_photos: true, max_photos: 3, - requires_comment_on_fail: false + requires_comment_on_fail: false, + parent_question_id: null, + show_if_answer: '' }) loadQuestions() } else { @@ -1090,6 +1094,70 @@ function QuestionsManagerModal({ checklist, onClose }) { /> + {/* Pregunta Condicional */} +
+

⚡ Pregunta Condicional (opcional)

+
+
+ + +

+ Esta pregunta aparecerá solo si se responde la pregunta padre +

+
+
+ + +

+ La pregunta solo se mostrará con esta respuesta +

+
+
+
+
- {sectionQuestions.map((question) => ( -
-
-
- #{question.id} -
-

{question.text}

-
- - {question.type} - - {question.points} pts - {question.allow_photos && ( - 📷 Máx {question.max_photos} fotos + {sectionQuestions.map((question) => { + const isSubQuestion = question.parent_question_id + const parentQuestion = isSubQuestion ? questions.find(q => q.id === question.parent_question_id) : null + + return ( +
+
+
+ #{question.id} +
+
+ {isSubQuestion && ( + + ⚡ Condicional + + )} +

{question.text}

+
+ {isSubQuestion && parentQuestion && ( +

+ → Aparece si #{question.parent_question_id} es {question.show_if_answer} +

)} +
+ + {question.type} + + {question.points} pts + {question.allow_photos && ( + 📷 Máx {question.max_photos} fotos + )} +
+
- -
- ))} + ) + })}
))}