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