From 54006d575686df2c849a014539b46c69c8afc30b Mon Sep 17 00:00:00 2001 From: ronalds Date: Sun, 30 Nov 2025 23:51:04 -0300 Subject: [PATCH] =?UTF-8?q?Campo=20de=20Observaciones=20Opcional=20?= =?UTF-8?q?=E2=9C=85=20Agregado=20checkbox=20"Agregar=20campo=20observacio?= =?UTF-8?q?nes"=20en=20QuestionTypeEditor.jsx=20(secci=C3=B3n=20"Opciones?= =?UTF-8?q?=20Generales")=20=E2=9C=85=20Por=20defecto=20est=C3=A1=20marcad?= =?UTF-8?q?o=20(compatibilidad=20con=20preguntas=20existentes)=20=E2=9C=85?= =?UTF-8?q?=20El=20campo=20de=20observaciones=20solo=20se=20muestra=20si?= =?UTF-8?q?=20show=5Fobservations=20!=3D=3D=20false=20=E2=9C=85=20El=20adm?= =?UTF-8?q?in=20ahora=20tiene=20control=20total=20sobre=20si=20mostrar=20o?= =?UTF-8?q?=20no=20las=20observaciones=202.=20Bot=C3=B3n=20"Consultar=20As?= =?UTF-8?q?istente=20IA"=20Siempre=20Visible=20=E2=9C=85=20El=20bot=C3=B3n?= =?UTF-8?q?=20ahora=20aparece=20siempre=20para=20preguntas=20tipo=20ai=5Fa?= =?UTF-8?q?ssistant=20=E2=9C=85=20No=20depende=20de=20que=20la=20pregunta?= =?UTF-8?q?=20tenga=20fotos=20habilitadas=20=E2=9C=85=20Movido=20a=20una?= =?UTF-8?q?=20secci=C3=B3n=20independiente=20(fuera=20del=20bloque=20de=20?= =?UTF-8?q?fotos)=20=E2=9C=85=20Removido=20el=20bot=C3=B3n=20duplicado=20q?= =?UTF-8?q?ue=20estaba=20dentro=20de=20la=20secci=C3=B3n=20de=20fotos=203.?= =?UTF-8?q?=20Versiones=20Actualizadas=20Frontend:=201.0.89=20=E2=86=92=20?= =?UTF-8?q?1.0.90=20Service=20Worker:=20ayutec-v1.0.89=20=E2=86=92=20ayute?= =?UTF-8?q?c-v1.0.90=20Backend:=20Sin=20cambios=20(no=20fue=20necesario)?= =?UTF-8?q?=20=F0=9F=93=8B=20Detalles=20T=C3=A9cnicos=20App.jsx:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Campo de respuesta oculto para photo_only y ai_assistant Botón de Asistente IA en sección dedicada (siempre visible para ai_assistant) Observaciones solo si show_observations !== false y no es photo_only ni ai_assistant QuestionTypeEditor.jsx: Nueva sección "⚙️ Opciones Generales" con checkbox azul Texto de ayuda: "Si está marcado, el mecánico podrá agregar notas adicionales" --- frontend/package.json | 2 +- frontend/public/service-worker.js | 2 +- frontend/src/App.jsx | 75 ++++++++++++++++++----------- frontend/src/QuestionTypeEditor.jsx | 22 +++++++++ 4 files changed, 70 insertions(+), 31 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 788682b..f684c10 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "checklist-frontend", "private": true, - "version": "1.0.89", + "version": "1.0.90", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/public/service-worker.js b/frontend/public/service-worker.js index 8886a97..778ea53 100644 --- a/frontend/public/service-worker.js +++ b/frontend/public/service-worker.js @@ -1,6 +1,6 @@ // Service Worker para PWA con detección de actualizaciones // IMPORTANTE: Actualizar esta versión cada vez que se despliegue una nueva versión -const CACHE_NAME = 'ayutec-v1.0.89'; +const CACHE_NAME = 'ayutec-v1.0.90'; const urlsToCache = [ '/', '/index.html' diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 3ccc4b9..2aa95c1 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -4921,8 +4921,8 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
- {/* Answer input based on type - NO mostrar para photo_only */} - {currentQuestion.options?.type !== 'photo_only' && ( + {/* Answer input based on type - NO mostrar para photo_only ni ai_assistant */} + {currentQuestion.options?.type !== 'photo_only' && currentQuestion.options?.type !== 'ai_assistant' && (
)} - {/* Observations - NO mostrar para photo_only */} - {currentQuestion.options?.type !== 'photo_only' && ( + {/* Botón de Chat IA - Mostrar SIEMPRE si es tipo ai_assistant */} + {currentQuestion.options?.type === 'ai_assistant' && ( +
+ { + setAnswers(prev => ({ + ...prev, + [currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue } + })) + }} + onSave={() => setTimeout(() => saveAnswer(currentQuestion.id), 500)} + /> + + +
+ )} + + {/* Observations - Mostrar solo si show_observations !== false */} + {currentQuestion.options?.type !== 'photo_only' && + currentQuestion.options?.type !== 'ai_assistant' && + currentQuestion.options?.show_observations !== false && (
- {/* Analyze Button */} - {(checklist.ai_mode === 'assisted' || checklist.ai_mode === 'full') && ( + {/* Analyze Button - Solo para ai_mode assisted/full y NO para ai_assistant */} + {(checklist.ai_mode === 'assisted' || checklist.ai_mode === 'full') && + currentQuestion.options?.type !== 'ai_assistant' && ( )} - - {/* Botón para abrir chat IA (si es tipo ai_assistant) */} - {currentQuestion.options?.type === 'ai_assistant' && ( - - )}
)} diff --git a/frontend/src/QuestionTypeEditor.jsx b/frontend/src/QuestionTypeEditor.jsx index a4370ad..6f8dbb1 100644 --- a/frontend/src/QuestionTypeEditor.jsx +++ b/frontend/src/QuestionTypeEditor.jsx @@ -197,6 +197,28 @@ export function QuestionTypeEditor({ value, onChange, maxPoints = 1 }) { + {/* Opciones Globales */} +
+

⚙️ Opciones Generales

+
+ {/* Checkbox para campo de observaciones */} + +

+ Si está marcado, el mecánico podrá agregar notas adicionales en esta pregunta +

+
+
+ {/* Configuración específica según tipo */}
{/* BOOLEAN */}