add checkbox by answer
This commit is contained in:
parent
d469d7d690
commit
5ceaac5e3d
@ -50,6 +50,20 @@
|
||||
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 {
|
||||
margin-top: 5%;
|
||||
span {
|
||||
|
@ -12,6 +12,8 @@ const MyModal = ({
|
||||
listTypeAnswer,
|
||||
comment,
|
||||
datetime,
|
||||
mandatory,
|
||||
setMandatory,
|
||||
setAnswer,
|
||||
setComment,
|
||||
setDatetime,
|
||||
@ -49,6 +51,10 @@ const MyModal = ({
|
||||
<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>
|
||||
</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}>
|
||||
<span>Дедлайн выполнения</span>
|
||||
<input type="datetime-local" value={datetime} onChange={event => setDatetime(event.target.value)}/>
|
||||
|
@ -19,6 +19,7 @@ const NewForm = () => {
|
||||
const [answer, setAnswer] = useState("");
|
||||
const [comment, setComment] = useState("");
|
||||
const [datetime, setDatetime] = useState("");
|
||||
const [mandatory, setMandatory] = useState(false);
|
||||
const [file, setFile] = useState([]);
|
||||
const [currentTypeAnswer, setCurrentTypeAnswer] = useState("");
|
||||
|
||||
@ -48,6 +49,7 @@ const NewForm = () => {
|
||||
setDatetime("");
|
||||
setFile("");
|
||||
setCurrentTypeAnswer("");
|
||||
setMandatory(false);
|
||||
}
|
||||
|
||||
function editAnswerByForm(id) {
|
||||
@ -57,17 +59,18 @@ const NewForm = () => {
|
||||
setDatetime(obj.datetime);
|
||||
setFile(obj.file);
|
||||
setCurrentTypeAnswer(obj.typeAnswer);
|
||||
setMandatory(obj.mandatory)
|
||||
setStateModal(id);
|
||||
}
|
||||
|
||||
function updateAnswerByForm() {
|
||||
console.log(currentTypeAnswer)
|
||||
setNewForm(newForm.map(item => {
|
||||
if (item.id === stateModal) {
|
||||
item.answer = answer;
|
||||
item.comment = comment;
|
||||
item.datetime = datetime;
|
||||
item.file = file;
|
||||
item.mandatory = mandatory;
|
||||
item.typeAnswer = currentTypeAnswer;
|
||||
}
|
||||
return item
|
||||
@ -82,6 +85,7 @@ const NewForm = () => {
|
||||
typeAnswer: currentTypeAnswer,
|
||||
comment: comment,
|
||||
datetime: datetime,
|
||||
mandatory: mandatory,
|
||||
file: file
|
||||
}]);
|
||||
cleanStates();
|
||||
@ -142,6 +146,7 @@ const NewForm = () => {
|
||||
currentTypeAnswer={currentTypeAnswer}
|
||||
answer={answer}
|
||||
comment={comment}
|
||||
mandatory={mandatory}
|
||||
datetime={datetime}
|
||||
file={file}
|
||||
listTypeAnswer={listTypeAnswer}
|
||||
@ -149,6 +154,7 @@ const NewForm = () => {
|
||||
setComment={setComment}
|
||||
setDatetime={setDatetime}
|
||||
setFile={setFile}
|
||||
setMandatory={setMandatory}
|
||||
cleanStates={cleanStates}
|
||||
saveStates={saveStates}
|
||||
updateAnswerByForm={updateAnswerByForm}
|
||||
|
Loading…
Reference in New Issue
Block a user