This commit is contained in:
kuwsh1n
2024-04-07 00:38:07 +03:00
parent 6817f5bf9b
commit 33f27d2efc
23 changed files with 570 additions and 241 deletions

View File

@ -5,9 +5,9 @@ import MyButton from "./MyButton.jsx"
const AnswerModal = ({
cleanStates,
currentTypeAnswer,
updateAnswerByForm,
updateBlock,
stateModal,
saveStates,
addFormBlock,
question,
file,
listTypeAnswer,
@ -16,17 +16,14 @@ const AnswerModal = ({
currentOptionAnswer,
setCurrentOptionAnswer,
comment,
datetime,
mandatory,
setMandatory,
addOptionAnswer,
setQuestion,
setComment,
setDatetime,
setCurrentTypeAnswer,
setFile
}) => {
return (
<div class="modal fade myModal" className={classes.myModal} id="answerModal" tabIndex="-1" aria-labelledby="exampleModalLabel" data-bs-backdrop="static" aria-hidden="true">
@ -79,14 +76,10 @@ const AnswerModal = ({
<span className={classes.myModal__dialog__content__body__mandatory__title}>Обязательный вопрос</span>
<input className={classes.myModal__dialog__content__body__mandatory__choice} type="checkbox" checked={mandatory} onChange={() => setMandatory(!mandatory)}/>
</div>
<div className={classes.myModal__dialog__content__body__time}>
<span>Дедлайн выполнения</span>
<input type="datetime-local" value={datetime} onChange={event => setDatetime(event.target.value)}/>
</div>
</div>
<div class="modal-footer myModal__dialog__content__footer" className={classes.myModal__dialog__content__footer}>
<button type="button" class="btn btn-light" data-bs-dismiss="modal" onClick={cleanStates}>Отмена</button>
<button type="button" class="btn" style={{color: 'white', backgroundColor: 'rgb(150, 209, 158)'}} data-bs-dismiss="modal" onClick={stateModal ? updateAnswerByForm : saveStates}>Сохранить</button>
<button type="button" class="btn" style={{color: 'white', backgroundColor: 'rgb(150, 209, 158)'}} data-bs-dismiss="modal" onClick={stateModal ? updateBlock : addFormBlock}>Сохранить</button>
</div>
</div>
</div>

View File

@ -1,9 +1,9 @@
import React, { useState } from "react";
import classes from "../assets/styles/generatingFormFields.module.scss";
const GeneratingFormFields = ({newForm, listTypeAnswer, answers, updateAnswersForm}) => {
const GeneratingFormFields = ({listBlock, listTypeAnswer, answers, updateAnswersForm}) => {
return (
newForm.map((item, i) =>
listBlock.map((item, i) =>
<div className={classes.item} key={i}>
<div className={classes.item__question}>
<p className={classes.item__question__text}>{i + 1}) {item.question}</p>

View File

@ -16,7 +16,7 @@ const NavBar = ({navigate, auth, setAuth}) => {
<div className={classes.profile}>
{auth ?
<div className={classes.profile__authorized}>
<span onClick={() => navigate("/profile")}>Профиль ({auth.name})</span>
<span onClick={() => navigate("/profile")}>Профиль ({auth.login})</span>
</div> :
<div className={classes.profile__nonAuthorized}>
<span onClick={() => navigate("/enter")}>Вход <i class="fa-solid fa-arrow-right-to-bracket"></i></span>

View File

@ -2,7 +2,7 @@ import React from "react";
import classes from "../assets/styles/components/previewModal.module.scss";
import GeneratingFormFields from "./GeneratingFormFields.jsx";
const PreviewModal = ({newForm, listTypeAnswer}) => {
const PreviewModal = ({listBlock, listTypeAnswer}) => {
return (
<div class="modal fade modal-lg" className={classes.myModal} id="previewModal" tabIndex="-1" aria-labelledby="exampleModalLabel" data-bs-backdrop="static" aria-hidden="true">
<div class="modal-dialog" className={classes.myModal__dialog}>
@ -12,7 +12,7 @@ const PreviewModal = ({newForm, listTypeAnswer}) => {
<i class="fa-solid fa-xmark" data-bs-dismiss="modal" aria-label="Close"></i>
</div>
<div class="modal-body" className={classes.myModal__dialog__content__body}>
<GeneratingFormFields newForm={newForm} listTypeAnswer={listTypeAnswer}/>
<GeneratingFormFields listBlock={listBlock} listTypeAnswer={listTypeAnswer}/>
</div>
<div class="modal-footer" className={classes.myModal__dialog__content__footer}>

View File

@ -2,6 +2,7 @@ import React, { useState } from "react";
import classes from "../../assets/styles/components/typeAnswer/dropDownList.module.scss"
const DropDownList = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
console.log(optionAnswer)
return (
<div className={classes.main}>
<select
@ -9,6 +10,7 @@ const DropDownList = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
onChange={updateAnswersForm ? (e) => updateAnswersForm(Number(e.target.value), postfix) : () => {}}
>
{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>
)}
</select>

View File

@ -34,6 +34,7 @@ const InputMultipleRadio = ({postfix, optionAnswer, answers, updateAnswersForm})
checked={answers ? checkRadio(i) : false}
onChange={() => updateStateCheckbox(i)}
/>
{/* <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>
</div>
)}

View File

@ -11,10 +11,11 @@ const InputRadio = ({postfix, optionAnswer, answers, updateAnswersForm}) => {
type="radio"
name={`inputRadio_${postfix}`}
id={`choice_${item.id}`}
value={i}
value={i}
checked={answers ? answers[postfix].answer === i : false}
onChange={updateAnswersForm ? (e) => updateAnswersForm(Number(e.target.value), 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>
</div>
)}