Merge pull request #114 from apuc/tracker-tasks

Tracker tasks
This commit is contained in:
NikoM1k 2023-07-13 02:04:31 +03:00 committed by GitHub
commit 3551fec8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 63 additions and 9 deletions

View File

@ -10,7 +10,12 @@ import { Link } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { setProjectBoardFetch } from "@redux/projectsTrackerSlice";
import { caseOfNum, getCorrectRequestDate, urlForLocal } from "@utils/helper";
import {
caseOfNum,
getCorrectRequestDate,
getToken,
urlForLocal,
} from "@utils/helper";
import { apiRequest } from "@api/request";
@ -63,6 +68,7 @@ export const ModalTiсket = ({
const [executor, setExecutor] = useState(task.executor);
const [members, setMembers] = useState(task.taskUsers);
const [users, setUsers] = useState([]);
const [selectedFile, setSelectedFile] = useState(null);
const [timerStart, setTimerStart] = useState(false);
const [timerInfo, setTimerInfo] = useState({});
const [currentTimerCount, setCurrentTimerCount] = useState({
@ -302,6 +308,31 @@ export const ModalTiсket = ({
}
}, []);
const handleUpload = async (event) => {
const formData = new FormData();
formData.append("uploadFile ", event.target.files[0]);
// apiRequest('/file/upload', {
// method: 'POST',
// data: {
// formData
// }
// }).then((res) => {
// console.log(res)
// })
// console.log(formData)
const res = await fetch("https://itguild.info/file/upload", {
method: "POST",
body: formData,
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json",
...getToken(),
},
});
console.log(res);
};
function startTimer() {
setTimerId(
setInterval(() => {
@ -447,14 +478,24 @@ export const ModalTiсket = ({
{/* Добавить под задачу*/}
{/* </button>*/}
{/*</p>*/}
<p className="file">
<button className="button-add-file">
<img src={file}></img>
Загрузить файл
</button>
<div className="file">
<div className="input__wrapper">
<input
name="file"
id="input__file"
type="file"
accept="image/*,.png,.jpg,.svg,.jpeg"
className="input__file"
onChange={handleUpload}
/>
<label htmlFor="input__file" className="button-add-file">
<img src={file}></img>
Загрузить файл
</label>
</div>
<span>{0}</span>
{caseOfNum(0, "files")}
</p>
</div>
</div>
<div className="content__input">
<input

View File

@ -342,8 +342,21 @@
justify-content: space-between;
margin-left: 7px;
.input__wrapper {
display: flex;
position: relative;
.input__file {
position: absolute;
opacity: 0;
z-index: -10;
width: 10%;
}
}
.button-add-file {
display: flex;
cursor: pointer;
align-items: center;
justify-content: center;
background: white;

View File

@ -727,7 +727,7 @@
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
@ -755,7 +755,7 @@
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}