develop #1
@@ -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.19
|
||||
image: dymai/syntria-frontend:1.0.20
|
||||
container_name: syntria-frontend-prod
|
||||
restart: always
|
||||
depends_on:
|
||||
|
||||
@@ -2015,11 +2015,11 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
console.log('Questions loaded:', questionsData.length, 'questions')
|
||||
setQuestions(questionsData)
|
||||
|
||||
// Initialize answers object
|
||||
// Initialize answers object - empty values to force user interaction
|
||||
const initialAnswers = {}
|
||||
questionsData.forEach(q => {
|
||||
initialAnswers[q.id] = {
|
||||
value: q.type === 'pass_fail' ? 'pass' : '',
|
||||
value: '', // No default value - user must choose
|
||||
observations: '',
|
||||
photos: []
|
||||
}
|
||||
@@ -2102,7 +2102,7 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
const question = questions.find(q => q.id === questionId)
|
||||
const answer = answers[questionId]
|
||||
|
||||
if (!answer?.value) return // Don't save empty answers
|
||||
if (!answer?.value && answer?.value !== '') return // Don't save if no value
|
||||
|
||||
try {
|
||||
const token = localStorage.getItem('token')
|
||||
@@ -2155,10 +2155,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
}
|
||||
|
||||
// Mark as saved
|
||||
setAnswers({
|
||||
...answers,
|
||||
[questionId]: { ...answers[questionId], saved: true }
|
||||
})
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[questionId]: { ...prev[questionId], saved: true }
|
||||
}))
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error saving answer:', error)
|
||||
@@ -2415,7 +2415,9 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
}
|
||||
}
|
||||
|
||||
const currentQuestion = questions[currentQuestionIndex]
|
||||
// Get visible questions based on conditional logic
|
||||
const visibleQuestions = getVisibleQuestions()
|
||||
const currentQuestion = visibleQuestions[currentQuestionIndex]
|
||||
|
||||
return (
|
||||
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">
|
||||
@@ -2641,10 +2643,11 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
value="pass"
|
||||
checked={answers[currentQuestion.id]?.value === 'pass'}
|
||||
onChange={(e) => {
|
||||
setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})
|
||||
const newValue = e.target.value
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
|
||||
}))
|
||||
setTimeout(() => saveAnswer(currentQuestion.id), 500)
|
||||
}}
|
||||
className="mr-2"
|
||||
@@ -2657,10 +2660,11 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
value="fail"
|
||||
checked={answers[currentQuestion.id]?.value === 'fail'}
|
||||
onChange={(e) => {
|
||||
setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})
|
||||
const newValue = e.target.value
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
|
||||
}))
|
||||
setTimeout(() => saveAnswer(currentQuestion.id), 500)
|
||||
}}
|
||||
className="mr-2"
|
||||
@@ -2674,10 +2678,11 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
<select
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(e) => {
|
||||
setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})
|
||||
const newValue = e.target.value
|
||||
setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: newValue }
|
||||
}))
|
||||
setTimeout(() => saveAnswer(currentQuestion.id), 500)
|
||||
}}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
||||
@@ -2694,10 +2699,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
type="number"
|
||||
step="0.01"
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(e) => setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: e.target.value }
|
||||
}))}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
||||
placeholder="Ingrese un valor numérico"
|
||||
/>
|
||||
@@ -2706,10 +2711,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
{currentQuestion.type === 'status' && (
|
||||
<select
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(e) => setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: e.target.value }
|
||||
}))}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Seleccionar...</option>
|
||||
@@ -2722,10 +2727,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
{currentQuestion.type === 'text' && (
|
||||
<textarea
|
||||
value={answers[currentQuestion.id]?.value}
|
||||
onChange={(e) => setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], value: e.target.value }
|
||||
})}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], value: e.target.value }
|
||||
}))}
|
||||
className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500"
|
||||
rows="3"
|
||||
placeholder="Ingrese su respuesta"
|
||||
@@ -2740,10 +2745,10 @@ function InspectionModal({ checklist, user, onClose, onComplete }) {
|
||||
</label>
|
||||
<textarea
|
||||
value={answers[currentQuestion.id]?.observations}
|
||||
onChange={(e) => setAnswers({
|
||||
...answers,
|
||||
[currentQuestion.id]: { ...answers[currentQuestion.id], observations: e.target.value }
|
||||
})}
|
||||
onChange={(e) => setAnswers(prev => ({
|
||||
...prev,
|
||||
[currentQuestion.id]: { ...prev[currentQuestion.id], 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..."
|
||||
|
||||
Reference in New Issue
Block a user