ACtualizacion en campos de tipo foto blouqeaba por no contestar,

Actualziacion de estados del DOM de las imagenes
This commit is contained in:
2025-11-29 11:55:30 -03:00
parent b6440130ac
commit c76f803871

View File

@@ -4202,7 +4202,14 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
// Validate all questions answered before completing // Validate all questions answered before completing
const validateAllAnswered = () => { const validateAllAnswered = () => {
const visibleQuestions = getVisibleQuestions() const visibleQuestions = getVisibleQuestions()
const unanswered = visibleQuestions.filter(q => !answers[q.id]?.value) const unanswered = visibleQuestions.filter(q => {
// Para preguntas tipo photo_only, solo validar que tenga fotos
if (q.options?.type === 'photo_only') {
return !answers[q.id]?.photos?.length
}
// Para otros tipos, validar que tenga respuesta
return !answers[q.id]?.value
})
return unanswered return unanswered
} }
@@ -4798,10 +4805,14 @@ function InspectionModal({ checklist, existingInspection, user, onClose, onCompl
</label> </label>
<input <input
key={`photo-input-${currentQuestion.id}`}
type="file" type="file"
accept="image/*" accept="image/*"
multiple={currentQuestion.max_photos > 1} multiple={currentQuestion.max_photos > 1}
onChange={(e) => handlePhotoChange(currentQuestion.id, e.target.files)} onChange={(e) => {
handlePhotoChange(currentQuestion.id, e.target.files)
e.target.value = '' // Reset input después de procesar
}}
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
disabled={aiAnalyzing} disabled={aiAnalyzing}
required={!answers[currentQuestion.id]?.photos?.length} required={!answers[currentQuestion.id]?.photos?.length}