fix one
This commit is contained in:
@ -4,10 +4,6 @@ import classes from "../assets/styles/components/navbar.module.scss";
|
||||
import { verifyUserApi } from "../hooks/api/enterAccountApi";
|
||||
|
||||
const NavBar = ({navigate, auth, setAuth}) => {
|
||||
useEffect(() => {
|
||||
console.log("nav", auth)
|
||||
})
|
||||
|
||||
return (
|
||||
<div className={classes.main}>
|
||||
<div className={classes.wrapper}>
|
||||
|
@ -7,11 +7,11 @@ const DropDownList = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
|
||||
<div className={classes.main}>
|
||||
<select
|
||||
value={answers ? answers[postfix].answer : ""}
|
||||
onChange={updateAnswersForm ? (e) => updateAnswersForm(Number(e.target.value), postfix) : () => {}}
|
||||
onChange={updateAnswersForm ? (e) => updateAnswersForm(e.target.value, postfix) : () => {}}
|
||||
>
|
||||
<option selected disabled></option>
|
||||
{optionAnswer.map((item, i) =>
|
||||
// <option value={item.id ? item.id : item[0].Value} key={i}>{item.text ? item.text : item[1].Value}</option>
|
||||
<option value={item.id} key={i}>{item.text}</option>
|
||||
<option value={item.text} key={i}>{item.text}</option>
|
||||
)}
|
||||
</select>
|
||||
</div>
|
||||
|
@ -2,20 +2,20 @@ import React from "react";
|
||||
import classes from "../../assets/styles/components/typeAnswer/inputMultiple.module.scss"
|
||||
|
||||
const InputMultipleRadio = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
|
||||
function checkRadio(i) {
|
||||
function checkRadio(value) {
|
||||
if (answers[postfix].answer) {
|
||||
return answers[postfix].answer.some(item => item === Number(i))
|
||||
return answers[postfix].answer.some(item => item === value)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function updateStateCheckbox(i) {
|
||||
function updateStateCheckbox(value) {
|
||||
if (updateAnswersForm) {
|
||||
if (answers[postfix].answer.some((item) => item === Number(i))) {
|
||||
answers[postfix].answer.splice(answers[postfix].answer.indexOf(i), 1)
|
||||
if (answers[postfix].answer.some((item) => item === value)) {
|
||||
answers[postfix].answer.splice(answers[postfix].answer.indexOf(value), 1)
|
||||
}
|
||||
else {
|
||||
answers[postfix].answer.push(i)
|
||||
answers[postfix].answer.push(value)
|
||||
}
|
||||
updateAnswersForm(answers[postfix].answer, postfix)
|
||||
}
|
||||
@ -30,9 +30,9 @@ const InputMultipleRadio = ({postfix, optionAnswer, answers, updateAnswersForm})
|
||||
type="checkbox"
|
||||
name={`inputMultiple_${postfix}`}
|
||||
id={`inputMultiple_${postfix}`}
|
||||
value={i}
|
||||
checked={answers ? checkRadio(i) : false}
|
||||
onChange={() => updateStateCheckbox(i)}
|
||||
value={item.text}
|
||||
checked={answers ? checkRadio(item.text) : false}
|
||||
onChange={() => updateStateCheckbox(item.text)}
|
||||
/>
|
||||
{/* <label class="form-check-label" for={`inputMultiple_${postfix}`}>{item.text ? item.text : item[1].Value}</label> */}
|
||||
<label class="form-check-label" for={`inputMultiple_${postfix}`}>{item.text}</label>
|
||||
|
@ -11,9 +11,9 @@ const InputRadio = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
|
||||
type="radio"
|
||||
name={`inputRadio_${postfix}`}
|
||||
id={`choice_${item.id}`}
|
||||
value={i}
|
||||
checked={answers ? answers[postfix].answer === i : false}
|
||||
onChange={updateAnswersForm ? (e) => updateAnswersForm(Number(e.target.value), postfix) : () => {}}
|
||||
value={item.text}
|
||||
checked={answers ? answers[postfix].answer === item.text : false}
|
||||
onChange={updateAnswersForm ? (e) => updateAnswersForm(item.text, postfix) : () => {}}
|
||||
/>
|
||||
{/* <label class="form-check-label" for={`inputRadio_${postfix}`}>{item.text ? item.text : item[1].Value}</label> */}
|
||||
<label class="form-check-label" for={`inputRadio_${postfix}`}>{item.text}</label>
|
||||
|
@ -11,8 +11,8 @@ const YesNo = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
|
||||
name={`YesOrNo_${postfix}`}
|
||||
id="choiceYes"
|
||||
value="1"
|
||||
checked={answers ? answers[postfix].answer === "1" : false}
|
||||
onChange={updateAnswersForm ? () => updateAnswersForm("1", postfix) : () => {}}
|
||||
checked={answers ? answers[postfix].answer === "Да" : false}
|
||||
onChange={updateAnswersForm ? () => updateAnswersForm("Да", postfix) : () => {}}
|
||||
/>
|
||||
<label class="form-check-label" for="choiceYes">Да</label>
|
||||
</div>
|
||||
@ -23,8 +23,8 @@ const YesNo = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
|
||||
name={`YesOrNo_${postfix}`}
|
||||
id="choiceNo"
|
||||
value="2"
|
||||
checked={answers ? answers[postfix].answer === "2" : false}
|
||||
onChange={updateAnswersForm ? () => updateAnswersForm("2", postfix) : () => {}}
|
||||
checked={answers ? answers[postfix].answer === "Нет" : false}
|
||||
onChange={updateAnswersForm ? () => updateAnswersForm("Нет", postfix) : () => {}}
|
||||
/>
|
||||
<label class="form-check-label" for="choiceNo">Нет</label>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user