Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
ForthA committed Dec 15, 2024
2 parents f07a5dc + ef55fbc commit 82b024a
Show file tree
Hide file tree
Showing 21 changed files with 1,117 additions and 135 deletions.
4 changes: 2 additions & 2 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
spring.application.name=forms


spring.data.mongodb.uri=${DB_URL}
#spring.data.mongodb.uri=mongodb://localhost:27017/test
#spring.data.mongodb.uri=${DB_URL}
spring.data.mongodb.uri=mongodb://localhost:27017/test

spring.jpa.hibernate.ddl-auto=update

Expand Down
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"react-dom": "^18.3.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.28.0",
"redux-thunk": "^3.1.0",
"xlsx": "^0.18.5"
},
"devDependencies": {
Expand Down
30 changes: 30 additions & 0 deletions frontend/public/addRedactor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/public/close.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions frontend/public/edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function App() {
<Routes>
<Route path={"/"} element={<SignIn />}/>
<Route path={"/tables"} element={<Tables />}/>
<Route path={"/xlsx"} element={<TablesXlsx />}/>
<Route path="/xlsx/:id" element={<TablesXlsx />} />
</Routes>
</div>
);
Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/SignIn/SignIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useState } from "react";
import axios from "axios";
import { useDispatch } from "react-redux";
import { setBrokers } from "../store/broker-slice.jsx";
import { setUsers } from "../store/user-slice.jsx";

export default function SignIn() {
const dispatch = useDispatch();
Expand All @@ -19,7 +20,12 @@ export default function SignIn() {

await axios.get(`http://localhost:8080/forms/${input}`).then((res) => {
dispatch(setBrokers(res.data));
});
dispatch(setUsers({
"[email protected]": false,
"[email protected]": false,
"[email protected]": false
}))
})

navigate("/tables");
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/Tables/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import './Button.css'

export default function Button(props){
return <button className='button' onClick={props.getTable}>{props.text}</button>
return <button name={props.name} type={props.type} className='button' onClick={props.click}>{props.text}</button>
}
21 changes: 18 additions & 3 deletions frontend/src/components/Tables/MainHeader.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ input[type="text"] {
/* 1 */
line-height: inherit;
/* 1 */
margin: 0;
margin: 10px;
/* 2 */
}

Expand Down Expand Up @@ -86,11 +86,26 @@ input[type="text"] {
display: flex;
align-items: center;
justify-content:space-around;
}
.inputs input + input {
margin: 20px;
}
.inputs input {
margin-left: 20px;
margin-right: 20px;
}

.import-export-buttons{
float: right;
}
.date-inputs{
width: 400px;
}

.dateTitle{
display: flex;
justify-content: center;
margin: 0%;
}

#date-input__before, #date-input__after{
width: 150px;
}
52 changes: 35 additions & 17 deletions frontend/src/components/Tables/MainHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "./MainHeader.css";
import searchIcon from "/search.svg";

import { useState } from "react";
import { useDispatch, useSelector} from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import { setBrokers } from "../store/broker-slice.jsx"

export default function MainHeader() {
Expand Down Expand Up @@ -34,22 +34,32 @@ export default function MainHeader() {
let url = new URL('http://localhost:8080/forms/table');
const params = new URLSearchParams(filteredInitialValues);
url.search = params.toString();

try {
const response = await fetch(url.href, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Ответ от сервера:', data);
dispatch(setBrokers(data));
const response = await fetch(url.href, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log('Ответ от сервера:', data);
dispatch(setBrokers(data));

} catch (error) {
console.error('Ошибка при выполнении запроса:', error);
console.error('Ошибка при выполнении запроса:', error);
}
};
};

let initialDates = {
"before": "",
"after": ""
}

const [selectedDate, setSelectedDate] = useState(initialDates);
const handleDateChange = async (event) => {
setSelectedDate({...selectedDate, [event.target.dataset.name]: event.target.value });
};

return (
<div className="main_header">
Expand All @@ -65,7 +75,7 @@ export default function MainHeader() {
onChange={handleChange}
type="text"
className="text-field__input"
placeholder="Название таблицы"
placeholder="Название формы"
></input>
<input
id="owner_mail"
Expand All @@ -76,29 +86,37 @@ export default function MainHeader() {
className="text-field__input"
placeholder="Владелец"
></input>
<input
{/* <input
id="creation_date"
name="creation_date"
value={values.creation_date}
onChange={handleChange}
type="text"
className="text-field__input"
placeholder="Дата созданиия"
></input>
></input> */}
<input
id="redactor"
name="redactor"
value={values.redactor}
onChange={handleChange}
type="text"
className="text-field__input"
placeholder="Реадакторы"
placeholder="Редакторы"
></input>
<div className="date-inputs">
<div className="dateTitle"><p>Дата создания</p></div>
<input type="date" id="date-input__before" data-name="before" className="text-field__input" placeholder="С" onChange={handleDateChange}></input>

<strong>-</strong>
<input type="date" id="date-input__after" data-name="after" className="text-field__input" placeholder="По" onChange={handleDateChange}></input>
</div>
<button type="submit" className="search_button">
<img src={searchIcon}></img>
<strong>Поиск</strong>
</button>
</form>

</div>
);
}
Loading

0 comments on commit 82b024a

Please sign in to comment.