This commit is contained in:
parent
8f2ae99f76
commit
e3455e3e6d
@ -1,5 +1,6 @@
|
||||
.main {
|
||||
height: 100%;
|
||||
// height: 100%;
|
||||
max-height: 40px;
|
||||
button {
|
||||
font-size: 15px;
|
||||
height: 100%;
|
||||
|
@ -1,11 +1,11 @@
|
||||
.main {
|
||||
height: 100%;
|
||||
max-height: 40px;
|
||||
input {
|
||||
border: 1px solid rgb(180, 180, 180);
|
||||
height: 100%;
|
||||
border-radius: 5px;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
padding: 0 3px;
|
||||
padding: .40em 3px;
|
||||
color: rgb(40, 40, 40);
|
||||
font-size: 15px;
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
height: 10%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
align-items: end;
|
||||
padding: 0 5%;
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
}
|
||||
|
||||
.header {
|
||||
// text-align: right;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
@ -26,55 +25,34 @@
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
span {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
font-size: 8px;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
top: -40%;
|
||||
left: 2%;
|
||||
}
|
||||
input {
|
||||
display: block;
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
border: 1px solid rgb(200, 200, 200);
|
||||
padding: 1%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
&__title {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
span {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
font-size: 8px;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
top: -40%;
|
||||
left: 2%;
|
||||
}
|
||||
input {
|
||||
display: block;
|
||||
height: 100%;
|
||||
font-size: 15px;
|
||||
font-family: "Montserrat", sans-serif;
|
||||
border: 1px solid rgb(200, 200, 200);
|
||||
padding: 1%;
|
||||
border-radius: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
&__listBtn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
width: 30%;
|
||||
}
|
||||
}
|
||||
|
@ -33,11 +33,11 @@ async function addFormBlockApi(token, formId, data) {
|
||||
}
|
||||
};
|
||||
|
||||
async function updateBlockApi(token, blockId, data) {
|
||||
async function updateBlockApi(token, formId, data) {
|
||||
try {
|
||||
const response = await axios.post(`https://api.minerva.krbl.ru/formBuilder/edit/${blockId}/set`,
|
||||
const response = await axios.post(`https://api.minerva.krbl.ru/formBuilder/edit/${formId}/set`,
|
||||
{
|
||||
"data": data
|
||||
data: data
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
|
@ -13,7 +13,7 @@ const Forms = () => {
|
||||
const {forms, setForms} = useContext(FormsData);
|
||||
const {user, setUser} = useContext(UserData);
|
||||
const [stateLoading, setStateLoading] = useState(false);
|
||||
const [removeIdForm, setRemoveIdForm] = useState(false);
|
||||
const [currentRemoveForm, setCurrentRemoveForm] = useState(false);
|
||||
const [searchForm, setSearchForm] = useState("");
|
||||
|
||||
const [cookies, _, __] = useCookies(["user"]);
|
||||
@ -120,14 +120,15 @@ const Forms = () => {
|
||||
<li><a class="dropdown-item" onClick={() => openFormView(item.id)}>Открыть</a></li>
|
||||
<li><a class="dropdown-item" onClick={() => navigate(`/forms/${item.id}/answers`)}>Ответы</a></li>
|
||||
<li><a class="dropdown-item" onClick={() => copyLinkToFormView(item.id)}>Скопировать ссылку</a></li>
|
||||
<li><a class="dropdown-item" data-bs-toggle="modal" data-bs-target="#checkModal" onClick={() => setRemoveIdForm(item.id)}>Удалить</a></li>
|
||||
<li><a class="dropdown-item" data-bs-toggle="modal" data-bs-target="#checkModal" onClick={() => setCurrentRemoveForm({id: item.id, title: item.title})}>Удалить</a></li>
|
||||
</ul>
|
||||
|
||||
<CheckModal
|
||||
message={`Вы хотетите удалить форму <${item.title}>?`}
|
||||
message={`Вы хотетите удалить форму <${currentRemoveForm.title}>?`}
|
||||
action={{
|
||||
execute: () => removeForm(removeIdForm),
|
||||
cancel: () => setRemoveIdForm(false)
|
||||
execute: () => removeForm(currentRemoveForm.id),
|
||||
// cancel: () => setCurrentRemoveForm(false)
|
||||
cancel: () => {}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -9,7 +9,7 @@ import { FormsData, TypeAnswerData } from "../context";
|
||||
import { listFormsApi, updateTitleFormApi } from "../hooks/api/listFormsApi.js";
|
||||
import { saveFormApi, addFormBlockApi, listFormBlockApi, updateBlockApi, updateOrderBlockApi } from "../hooks/api/formApi.js";
|
||||
import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js";
|
||||
import { parseVKlinkVideo } from "../hooks/sundry/parseLinkVideo.js";
|
||||
import MyInput from "../components/MyInput.jsx";
|
||||
|
||||
const NewForm = () => {
|
||||
const navigate = useNavigate();
|
||||
@ -65,6 +65,7 @@ const NewForm = () => {
|
||||
const responseBlock = await listFormBlockApi(cookies.token, formId);
|
||||
|
||||
if (responseBlock.status === 200 && responseBlock.data && responseForms.status === 200) {
|
||||
console.log(responseDataToListBlock(responseBlock.data))
|
||||
setListBlock(responseDataToListBlock(responseBlock.data));
|
||||
const title = responseForms.data.find(item => item.id === formId).title
|
||||
setNewTitleForm(title);
|
||||
@ -102,7 +103,6 @@ const NewForm = () => {
|
||||
|
||||
async function updateBlock() {
|
||||
const data = {
|
||||
id: stateModal,
|
||||
question: question,
|
||||
comment: comment,
|
||||
file: file,
|
||||
@ -112,7 +112,8 @@ const NewForm = () => {
|
||||
typeAnswer: currentTypeAnswer,
|
||||
}
|
||||
|
||||
const response = await updateBlockApi(cookies.token, stateModal, data);
|
||||
const response = await updateBlockApi(cookies.token, formId, data);
|
||||
console.log(response)
|
||||
|
||||
if (response.status === 200) {
|
||||
setListBlock(listBlock.map(item => {
|
||||
@ -219,11 +220,11 @@ const NewForm = () => {
|
||||
<div className={classes.header__listInput}>
|
||||
<div className={classes.header__listInput__date}>
|
||||
<span>Дедлайн выполнения</span>
|
||||
<input type="datetime-local" value={datetime} onChange={event => setDatetime(event.target.value)}/>
|
||||
<MyInput type={"datetime-local"} value={datetime} change={setDatetime}/>
|
||||
</div>
|
||||
<div className={classes.header__listInput__title}>
|
||||
<span>Название формы</span>
|
||||
<input type="text" value={newTitleForm} onChange={event => setNewTitleForm(event.target.value)}/>
|
||||
<MyInput type={"text"} value={newTitleForm} change={setNewTitleForm}/>
|
||||
</div>
|
||||
</div>
|
||||
<div className={classes.header__listBtn}>
|
||||
|
Loading…
Reference in New Issue
Block a user