Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zheki4sh05 committed Nov 29, 2024
1 parent 433cb61 commit fc95541
Show file tree
Hide file tree
Showing 28 changed files with 343 additions and 228 deletions.
1 change: 1 addition & 0 deletions src/API/APIPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const api={
upload:base.concat("assignment/addDocsAssignment"),
updateAssignmentWorker:base.concat("assignment/updateAssignmentWorker"),
changeAssignmentStatus:base.concat("assignment/changeAssignmentStatus"),
updateTodos:base.concat("assignment/updateTodos")

},
documents:{
Expand Down
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function App() {
children: [
{
path: PathConstants.HOME,
element: <NewsPage />,
element: <Projects />,
},

{
Expand Down
3 changes: 2 additions & 1 deletion src/Components/AssignmentComponents/AssignmentWorkResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Box, Button, Container, Divider, MenuItem, Select, Typography } from "@
import { useState } from "react";
import { useSelector } from "react-redux";
import { getProjects } from "../../Store/slices/projectSlice";
import { getStages } from "../../Store/slices/appUserSlice";

function AssignmentWorkResult({assignment, assignmentStatus}) {

Expand Down Expand Up @@ -33,7 +34,7 @@ function AssignmentWorkResult({assignment, assignmentStatus}) {

const statuses = assignmentStatus.statusNames.map(item=>getStatusName(item));

const projectStages = useSelector(getProjects).find(pr=>pr.id == assignment.projectId).stages;
const projectStages = useSelector(getStages)



Expand Down
6 changes: 3 additions & 3 deletions src/Components/CreateAssignment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ function CreateAssignment({ reloadHandler }) {
};

if (createdStatus === statusTypes.succeeded) {
//reloadHandler();
//resetDialogContext();
//dispatch(resetCreatedAssignStatus())
reloadHandler();
resetDialogContext();
dispatch(resetCreatedAssignStatus())
}

return (
Expand Down
5 changes: 3 additions & 2 deletions src/Components/DocumentsComponents/UploadDocument.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { getUploadedStatus, resetUploadedStatus, uploadDoc } from "../../Store/slices/documentsSlice";
import { useDispatch, useSelector } from "react-redux";
import { getToken } from "../../Store/slices/appUserSlice";
import { getId, getToken } from "../../Store/slices/appUserSlice";
import statusTypes from "../../API/status";
import DocumentSettings from "./DocumentSettings";
import UploadDocumentPlaceholder from "./UploadDocumentPlaceholder";
Expand All @@ -17,7 +17,7 @@ const UploadDocument = memo(({reloadHandler, company, token})=> {
const createdStatus = useSelector(getUploadedStatus);

const dispatch = useDispatch();

const userId = useSelector(getId)

const handleSaveUploadedDoc=()=>{

Expand All @@ -41,6 +41,7 @@ const UploadDocument = memo(({reloadHandler, company, token})=> {

formData.append("companyName", company)
formData.append("assignmentId", 0)
formData.append("uploadedUser", userId)
dispatch(uploadDoc({
data:formData,
token:token
Expand Down
21 changes: 12 additions & 9 deletions src/Components/MyTasksComponents/MyTaskProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import { getProjects } from "../../Store/slices/projectSlice";
import { getToken } from "../../Store/slices/appUserSlice";
import { changeAssignmentStatus } from "../../Store/slices/assignmentSlice";
import { useDispatch } from "react-redux";
import { getStages } from './../../Store/slices/appUserSlice';

function MyTaskProgress({ task, assignmentStatus }) {

console.log(assignmentStatus)
const token = useSelector(getToken)

const dispatch = useDispatch()
Expand Down Expand Up @@ -46,9 +47,7 @@ function MyTaskProgress({ task, assignmentStatus }) {
getStatusName(item)
);

const projectStages = useSelector(getProjects).find(
(pr) => pr.id == task.projectId
).stages;
const projectStages = useSelector(getStages)



Expand All @@ -63,7 +62,7 @@ function MyTaskProgress({ task, assignmentStatus }) {
}

const [status, setStatus] = useState(getIndex());

console.log(status)
const [stageId, setStageId] = useState(projectStages[0].id);

const handleStatusChange = (event) => {
Expand Down Expand Up @@ -97,6 +96,7 @@ function MyTaskProgress({ task, assignmentStatus }) {
useEffect(()=>{

if(isDone){
console.log("save")
dispatch(changeAssignmentStatus({data:{
assignmentId:task.id,
curStatus:task.status,
Expand Down Expand Up @@ -136,7 +136,7 @@ function MyTaskProgress({ task, assignmentStatus }) {

{}

<Button variant="contained" color="success" disabled={isDone} onCLick={handleDoneTask}>
<Button variant="contained" color="success" disabled={isDone} onClick={handleDoneTask}>
Выполнить поручение
</Button>
</Box>;
Expand All @@ -147,7 +147,7 @@ function MyTaskProgress({ task, assignmentStatus }) {
}
}

function getStages() {
function getStages2() {

if (assignmentStatus.statusNames[status] == "create") {
return (
Expand All @@ -159,12 +159,15 @@ function MyTaskProgress({ task, assignmentStatus }) {
</Box>
);
} else if (assignmentStatus.statusNames[status] == "accepted") {
return (
<Box>
<Typography>

{projectStages.find((item) => item.id == stageId).name}
</Typography>

</Box>;
</Box>
);
} else if (assignmentStatus.statusNames[status] == "done") {
<Box>
<Select
Expand Down Expand Up @@ -208,7 +211,7 @@ function MyTaskProgress({ task, assignmentStatus }) {

<Typography sx={{ mt: 2 }}>Стадия выполнения</Typography>
<Divider />
{getStages()}
{getStages2()}

{/* <Select
labelId="demo-simple-select-helper-label"
Expand Down
2 changes: 1 addition & 1 deletion src/Components/MyTasksComponents/MyTaskTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function MyTaskTable() {
<DialogEntityProvider>
<CustomTable
rows={myTasks}
tableTitle="Таблица документов"
tableTitle="Таблица задач"
tableHeadCells={[
{
id: "id",
Expand Down
59 changes: 42 additions & 17 deletions src/Components/MyTasksComponents/MyTaskWork.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import {
} from "@mui/material";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
import { getId, getToken } from "../../Store/slices/appUserSlice";
import { getEmail, getId, getToken } from "../../Store/slices/appUserSlice";
import { useEffect, useState } from "react";
import { addDocuments, getAddedDocsStatus, resetAddedDocsStatus, updateAssignmentTodos, uploadDocForAssignment } from "../../Store/slices/assignmentSlice";
import { addDocuments, getAddedDocsStatus, getAllUserAssignmnets, getAssignmentsStatuses, resetAddedDocsStatus, updateAssignmentTodos, uploadDocForAssignment } from "../../Store/slices/assignmentSlice";
import IconButton from "@mui/material/IconButton";
import DeleteIcon from "@mui/icons-material/Delete";
import FolderIcon from "@mui/icons-material/Folder";
import { getCompanyName, getCompanyNameValue } from './../../Store/slices/companySlice';
import { getCompanyName, getCompanyNameValue, getRoleInCompany } from './../../Store/slices/companySlice';
import { getDocuments, getUploadedStatus, resetUploadedStatus, uploadDoc } from './../../Store/slices/documentsSlice';
import statusTypes from "../../API/status";

Expand All @@ -32,12 +32,13 @@ function MyTaskWork({ task, assignmentStatus }) {
const uploadedDocsStatus = useSelector(getAddedDocsStatus);

const userId = useSelector(getId)

const useremail = useSelector(getEmail)
const role = useSelector(getRoleInCompany)
const docs = useSelector(getDocuments).filter(item=>item.accessType=="user")

const docsList = useSelector(getAssignmentsStatuses).addedDocuments
const [todos, setTodos] = useState(assignmentStatus.toDoDTOList);
const [idEditedList, setEditedList] = useState(false);

console.log(docsList)
const handleDone = (id) => {

if(task.status=="accepted"){
Expand All @@ -59,18 +60,41 @@ function MyTaskWork({ task, assignmentStatus }) {

};

const handleSaveTodos = () => {
if(task.status=="accepted"){
setEditedList(false);
function makeRequest(){
dispatch(
updateAssignmentTodos({
getAllUserAssignmnets({
data: {
assignmentId: task.id,
todos: todos,
userEmail:useremail,
role:role,
size:""
},
token,
})
);
// dispatch(
// getAllUserAssignmentsStatuses({
// data: {
// useremail,
// },
// token,
// })
// );
}

const handleSaveTodos = () => {
if(task.status=="accepted"){

setEditedList(false);
dispatch(
updateAssignmentTodos({
data: {
assignmentId: task.id,
todos: todos,
},
token,
})
);
makeRequest()
}
};

Expand Down Expand Up @@ -105,6 +129,7 @@ function MyTaskWork({ task, assignmentStatus }) {
token
}))
setFilesEdited(false);
makeRequest()
}

function handleChange(event) {
Expand All @@ -117,11 +142,11 @@ function MyTaskWork({ task, assignmentStatus }) {

}

function handleDelete(index) {
function handleDelete(id) {
if(task.status=="accepted"){
let name = files[index].name;


setFiles(files.filter((f) => f.name != name));
setFiles(files.filter((f) => f.id != id));

setFilesEdited(true);
}
Expand Down Expand Up @@ -175,14 +200,14 @@ function MyTaskWork({ task, assignmentStatus }) {
</Box>

<List>
{files.map((file, index) => (
{[...docsList, ...files].map((file, index) => (
<ListItem
key={index}
secondaryAction={
<IconButton
edge="end"
aria-label="delete"
onClick={() => handleDelete(index)}
onClick={() => handleDelete(file.id)}
>
<DeleteIcon />
</IconButton>
Expand Down
1 change: 1 addition & 0 deletions src/Components/MyTasksComponents/MyTasksProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function MyTasksProfile({task}) {
})
);
}


useEffect(() => {
makeRequest();
Expand Down
1 change: 0 additions & 1 deletion src/Components/ProjectsPage/AllProjectTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ function AllProjectsTable() {


console.log(projects)

// function getRows(data=[]){
// return data.forEach(project => {
// return {
Expand Down
7 changes: 3 additions & 4 deletions src/Components/ProjectsPage/ProjectsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import AsideDrawer from "../AsideBox/AsideDrawer";
import ProjectOverviewWindow from "./ProjectOverviewWindow";

function ProjectsTable({projects=[]}) {
console.log("ProjectsTable")
console.log(projects)


const statuses = useSelector(getProjectsResults) || [];
const statuses = useSelector(getProjectsResults)

console.log(statuses)

Expand Down Expand Up @@ -66,7 +65,7 @@ function ProjectsTable({projects=[]}) {
label: 'Участников',
},
{
id: 'roleName',
id: 'role',
numeric: false,
disablePadding: false,
label: 'Роль',
Expand Down
21 changes: 13 additions & 8 deletions src/Components/SearchBar/SearchBar.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import * as React from "react";
import {useState} from "react";
import Paper from "@mui/material/Paper";
import InputBase from "@mui/material/InputBase";
import Divider from "@mui/material/Divider";

import IconButton from "@mui/material/IconButton";
import MenuIcon from "@mui/icons-material/Menu";

import SearchIcon from "@mui/icons-material/Search";
import DirectionsIcon from "@mui/icons-material/Directions";
import { TextField } from "@mui/material";


export default function SearchBar({
elevation,
placeHolder = "Поиск",
handleSearch,
}) {

const [state,setState]= useState("")
const onClick=()=>{
handleSearch(state)
}

return (
<Paper
Expand All @@ -29,18 +33,19 @@ export default function SearchBar({
boxSizing:"border-box",

}}
onSubmit={handleSearch}
onSubmit={onClick}
>
<InputBase
id="input"

sx={{ ml: 1, flex: 1,fontSize:"16px" }}
placeholder={placeHolder}
inputProps={{ 'aria-label': 'Поиск' }}

value={state}
onChange={(event)=>setState(event.target.value)}
/>

<IconButton type="submit" sx={{ p: "5px" }} aria-label="search">
<IconButton onClick={onClick} sx={{ p: "5px" }} aria-label="search">
<SearchIcon />
</IconButton>
</Paper>
Expand Down
8 changes: 3 additions & 5 deletions src/Components/StaffPage/InviteControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ function InviteControl() {

const dispatch = useDispatch();

function makeRequest(event) {
event.preventDefault();
const data = new FormData(event.currentTarget);
function makeRequest(data) {


console.log(data.get("input"))

dispatch(
findUser({
data: {
email: data.get("input"),
email: data,
},
token,
})
Expand Down
Loading

0 comments on commit fc95541

Please sign in to comment.