add checkbox by answer
This commit is contained in:
parent
d469d7d690
commit
5ceaac5e3d
@ -50,6 +50,20 @@
|
|||||||
padding: 0 1%;
|
padding: 0 1%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&__mandatory {
|
||||||
|
margin-top: 5%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
&__title {
|
||||||
|
display: block;
|
||||||
|
font-size: 15px;
|
||||||
|
font-family: "Montserrat", sans-serif
|
||||||
|
}
|
||||||
|
&__choice {
|
||||||
|
display: block;
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
}
|
||||||
&__time {
|
&__time {
|
||||||
margin-top: 5%;
|
margin-top: 5%;
|
||||||
span {
|
span {
|
||||||
|
@ -12,6 +12,8 @@ const MyModal = ({
|
|||||||
listTypeAnswer,
|
listTypeAnswer,
|
||||||
comment,
|
comment,
|
||||||
datetime,
|
datetime,
|
||||||
|
mandatory,
|
||||||
|
setMandatory,
|
||||||
setAnswer,
|
setAnswer,
|
||||||
setComment,
|
setComment,
|
||||||
setDatetime,
|
setDatetime,
|
||||||
@ -49,6 +51,10 @@ const MyModal = ({
|
|||||||
<span className={classes.myModal__dialog__content__body__comment__title}>Комментарий</span>
|
<span className={classes.myModal__dialog__content__body__comment__title}>Комментарий</span>
|
||||||
<textarea className={classes.myModal__dialog__content__body__comment__text} value={comment} onChange={event => setComment(event.target.value)}></textarea>
|
<textarea className={classes.myModal__dialog__content__body__comment__text} value={comment} onChange={event => setComment(event.target.value)}></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div className={classes.myModal__dialog__content__body__mandatory}>
|
||||||
|
<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}>
|
<div className={classes.myModal__dialog__content__body__time}>
|
||||||
<span>Дедлайн выполнения</span>
|
<span>Дедлайн выполнения</span>
|
||||||
<input type="datetime-local" value={datetime} onChange={event => setDatetime(event.target.value)}/>
|
<input type="datetime-local" value={datetime} onChange={event => setDatetime(event.target.value)}/>
|
||||||
|
@ -19,6 +19,7 @@ const NewForm = () => {
|
|||||||
const [answer, setAnswer] = useState("");
|
const [answer, setAnswer] = useState("");
|
||||||
const [comment, setComment] = useState("");
|
const [comment, setComment] = useState("");
|
||||||
const [datetime, setDatetime] = useState("");
|
const [datetime, setDatetime] = useState("");
|
||||||
|
const [mandatory, setMandatory] = useState(false);
|
||||||
const [file, setFile] = useState([]);
|
const [file, setFile] = useState([]);
|
||||||
const [currentTypeAnswer, setCurrentTypeAnswer] = useState("");
|
const [currentTypeAnswer, setCurrentTypeAnswer] = useState("");
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ const NewForm = () => {
|
|||||||
setDatetime("");
|
setDatetime("");
|
||||||
setFile("");
|
setFile("");
|
||||||
setCurrentTypeAnswer("");
|
setCurrentTypeAnswer("");
|
||||||
|
setMandatory(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
function editAnswerByForm(id) {
|
function editAnswerByForm(id) {
|
||||||
@ -57,17 +59,18 @@ const NewForm = () => {
|
|||||||
setDatetime(obj.datetime);
|
setDatetime(obj.datetime);
|
||||||
setFile(obj.file);
|
setFile(obj.file);
|
||||||
setCurrentTypeAnswer(obj.typeAnswer);
|
setCurrentTypeAnswer(obj.typeAnswer);
|
||||||
|
setMandatory(obj.mandatory)
|
||||||
setStateModal(id);
|
setStateModal(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateAnswerByForm() {
|
function updateAnswerByForm() {
|
||||||
console.log(currentTypeAnswer)
|
|
||||||
setNewForm(newForm.map(item => {
|
setNewForm(newForm.map(item => {
|
||||||
if (item.id === stateModal) {
|
if (item.id === stateModal) {
|
||||||
item.answer = answer;
|
item.answer = answer;
|
||||||
item.comment = comment;
|
item.comment = comment;
|
||||||
item.datetime = datetime;
|
item.datetime = datetime;
|
||||||
item.file = file;
|
item.file = file;
|
||||||
|
item.mandatory = mandatory;
|
||||||
item.typeAnswer = currentTypeAnswer;
|
item.typeAnswer = currentTypeAnswer;
|
||||||
}
|
}
|
||||||
return item
|
return item
|
||||||
@ -82,6 +85,7 @@ const NewForm = () => {
|
|||||||
typeAnswer: currentTypeAnswer,
|
typeAnswer: currentTypeAnswer,
|
||||||
comment: comment,
|
comment: comment,
|
||||||
datetime: datetime,
|
datetime: datetime,
|
||||||
|
mandatory: mandatory,
|
||||||
file: file
|
file: file
|
||||||
}]);
|
}]);
|
||||||
cleanStates();
|
cleanStates();
|
||||||
@ -142,6 +146,7 @@ const NewForm = () => {
|
|||||||
currentTypeAnswer={currentTypeAnswer}
|
currentTypeAnswer={currentTypeAnswer}
|
||||||
answer={answer}
|
answer={answer}
|
||||||
comment={comment}
|
comment={comment}
|
||||||
|
mandatory={mandatory}
|
||||||
datetime={datetime}
|
datetime={datetime}
|
||||||
file={file}
|
file={file}
|
||||||
listTypeAnswer={listTypeAnswer}
|
listTypeAnswer={listTypeAnswer}
|
||||||
@ -149,6 +154,7 @@ const NewForm = () => {
|
|||||||
setComment={setComment}
|
setComment={setComment}
|
||||||
setDatetime={setDatetime}
|
setDatetime={setDatetime}
|
||||||
setFile={setFile}
|
setFile={setFile}
|
||||||
|
setMandatory={setMandatory}
|
||||||
cleanStates={cleanStates}
|
cleanStates={cleanStates}
|
||||||
saveStates={saveStates}
|
saveStates={saveStates}
|
||||||
updateAnswerByForm={updateAnswerByForm}
|
updateAnswerByForm={updateAnswerByForm}
|
||||||
|
Loading…
Reference in New Issue
Block a user