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:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "checklist-frontend",
|
||||
"private": true,
|
||||
"version": "1.0.81",
|
||||
"version": "1.0.82",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -4737,44 +4737,48 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
{/* Answer input based on type */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Respuesta *
|
||||
</label>
|
||||
{/* Answer input based on type - NO mostrar para photo_only */}
|
||||
{currentQuestion.options?.type !== 'photo_only' && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Respuesta *
|
||||
</label>
|
||||
|
||||
<QuestionAnswerInput
|
||||
question={currentQuestion}
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(newValue) => {
|
||||
setAnswers(prev => ({
|
||||
<QuestionAnswerInput
|
||||
question={currentQuestion}
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(newValue) => {
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
|
||||
}))
|
||||
}}
|
||||
onSave={() => setTimeout(() => saveAnswer(currentQuestion.id), 500)}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Observations - NO mostrar para photo_only */}
|
||||
{currentQuestion.options?.type !== 'photo_only' && (
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Observaciones (opcional)
|
||||
</label>
|
||||
<textarea
|
||||
value={answers[currentQuestion.id]?.observations || ''}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
|
||||
}))
|
||||
}}
|
||||
onSave={() => setTimeout(() => saveAnswer(currentQuestion.id), 500)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Observations */}
|
||||
<div>
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Observaciones (opcional)
|
||||
</label>
|
||||
<textarea
|
||||
value={answers[currentQuestion.id]?.observations || ''}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: {
|
||||
...(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"
|
||||
placeholder="Notas adicionales..."
|
||||
/>
|
||||
</div>
|
||||
[currentQuestion.id]: {
|
||||
...(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"
|
||||
placeholder="Notas adicionales..."
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Photos */}
|
||||
{currentQuestion.allow_photos && (
|
||||
@@ -4864,13 +4868,6 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
|
||||
</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>
|
||||
|
||||
@@ -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
|
||||
return (
|
||||
<div className="p-4 bg-yellow-50 border border-yellow-200 rounded-lg">
|
||||
|
||||
@@ -22,7 +22,8 @@ const QUESTION_TYPES = [
|
||||
{ value: 'text', label: '📝 Texto Libre', icon: '✏️' },
|
||||
{ value: 'number', label: '🔢 Número', 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 = [
|
||||
|
||||
Reference in New Issue
Block a user