Frontend v1.0.82

1. Eliminado campo duplicado de "Observaciones":

 Antes: Había 2 campos de observaciones (uno general y uno dentro de fotos)
 Ahora: Solo 1 campo de observaciones (el general)
2. Nuevo tipo de pregunta "📸 Solo Fotografía" (photo_only):

Comportamiento: Solo muestra el título de la pregunta y el campo para adjuntar fotos
NO muestra: Campo de respuesta ni campo de observaciones
Ideal para: Documentación fotográfica pura (ej: "Fotografía del VIN", "Estado general del vehículo")
This commit is contained in:
2025-11-29 11:25:14 -03:00
parent 886f0bafbd
commit b6440130ac
4 changed files with 55 additions and 46 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "checklist-frontend", "name": "checklist-frontend",
"private": true, "private": true,
"version": "1.0.81", "version": "1.0.82",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -4737,44 +4737,48 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
</div> </div>
<div className="space-y-4"> <div className="space-y-4">
{/* Answer input based on type */} {/* Answer input based on type - NO mostrar para photo_only */}
<div> {currentQuestion.options?.type !== 'photo_only' && (
<label className="block text-sm font-medium text-gray-700 mb-2"> <div>
Respuesta * <label className="block text-sm font-medium text-gray-700 mb-2">
</label> Respuesta *
</label>
<QuestionAnswerInput
question={currentQuestion} <QuestionAnswerInput
value={answers[currentQuestion.id]?.value} question={currentQuestion}
onChange={(newValue) => { value={answers[currentQuestion.id]?.value}
setAnswers(prev => ({ onChange={(newValue) => {
...prev, setAnswers(prev => ({
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue } ...prev,
})) [currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
}} }))
onSave={() => setTimeout(() => saveAnswer(currentQuestion.id), 500)} }}
/> onSave={() => setTimeout(() => saveAnswer(currentQuestion.id), 500)}
</div> />
</div>
)}
{/* Observations */} {/* Observations - NO mostrar para photo_only */}
<div> {currentQuestion.options?.type !== 'photo_only' && (
<label className="block text-sm font-medium text-gray-700 mb-2"> <div>
Observaciones (opcional) <label className="block text-sm font-medium text-gray-700 mb-2">
</label> Observaciones (opcional)
<textarea </label>
value={answers[currentQuestion.id]?.observations || ''} <textarea
onChange={(e) => setAnswers(prev => ({ value={answers[currentQuestion.id]?.observations || ''}
...prev, onChange={(e) => setAnswers(prev => ({
[currentQuestion.id]: { ...prev,
...(prev[currentQuestion.id] || { value: '', observations: '', photos: [] }), [currentQuestion.id]: {
observations: e.target.value ...(prev[currentQuestion.id] || { value: '', observations: '', photos: [] }),
} observations: e.target.value
}))} }
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" }))}
rows="2" className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
placeholder="Notas adicionales..." rows="2"
/> placeholder="Notas adicionales..."
</div> />
</div>
)}
{/* Photos */} {/* Photos */}
{currentQuestion.allow_photos && ( {currentQuestion.allow_photos && (
@@ -4864,13 +4868,6 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
</div> </div>
</div> </div>
)} )}
{/* Comentarios removidos que revelaban IA */}
{checklist.ai_mode === 'assisted' && answers[currentQuestion.id]?.observations.includes('[IA Sugiere') && (
<span className="text-blue-600"> Sugerencia generada</span>
)}
</div>
)}
</div> </div>
)} )}
</div> </div>

View File

@@ -281,6 +281,17 @@ export function QuestionAnswerInput({ question, value, onChange, onSave }) {
) )
} }
// PHOTO_ONLY (solo foto, sin campo de respuesta)
if (questionType === 'photo_only') {
return (
<div className="p-4 bg-blue-50 border border-blue-200 rounded-lg">
<p className="text-sm text-blue-800">
📸 Esta pregunta solo requiere fotografías. Adjunta las imágenes en la sección de fotos abajo.
</p>
</div>
)
}
// Fallback para tipos desconocidos // Fallback para tipos desconocidos
return ( return (
<div className="p-4 bg-yellow-50 border border-yellow-200 rounded-lg"> <div className="p-4 bg-yellow-50 border border-yellow-200 rounded-lg">

View File

@@ -22,7 +22,8 @@ const QUESTION_TYPES = [
{ value: 'text', label: '📝 Texto Libre', icon: '✏️' }, { value: 'text', label: '📝 Texto Libre', icon: '✏️' },
{ value: 'number', label: '🔢 Número', icon: '#️⃣' }, { value: 'number', label: '🔢 Número', icon: '#️⃣' },
{ value: 'date', label: '📅 Fecha', icon: '📆' }, { value: 'date', label: '📅 Fecha', icon: '📆' },
{ value: 'time', label: '🕐 Hora', icon: '⏰' } { value: 'time', label: '🕐 Hora', icon: '⏰' },
{ value: 'photo_only', label: '📸 Solo Fotografía', icon: '📷' }
] ]
const STATUS_OPTIONS = [ const STATUS_OPTIONS = [