task priority

This commit is contained in:
Mikola 2023-11-21 16:41:18 +03:00
parent 5b60001013
commit 8c440ce7c7
4 changed files with 202 additions and 170 deletions

View File

@ -75,7 +75,7 @@ export const ModalTiсket = ({
const [dropListOpen, setDropListOpen] = useState(false);
const [dropListMembersOpen, setDropListMembersOpen] = useState(false);
const [executor, setExecutor] = useState(task.executor);
const [taskPriority, setTaskPriority] = useState(task.execution_priority)
const [taskPriority, setTaskPriority] = useState(task.execution_priority);
const [members, setMembers] = useState(task.taskUsers);
const [taskTags, setTaskTags] = useState(task.mark);
const [users, setUsers] = useState([]);
@ -95,7 +95,7 @@ export const ModalTiсket = ({
const profileInfo = useSelector(getProfileInfo);
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
const [selectPriorityOpen, setSelectPriorityOpen] = useState(false)
const [selectPriorityOpen, setSelectPriorityOpen] = useState(false);
const { showNotification } = useNotification();
const [commentSendDisable, setCommentSendDisable] = useState(false);
@ -117,27 +117,26 @@ export const ModalTiсket = ({
});
}
const priority =
{
2: 'Высокий',
1: 'Средний',
0: 'Низкий'
}
const priority = {
2: "Высокий",
1: "Средний",
0: "Низкий",
};
const priorityTypes = [
{
name: 'Высокий',
key: 2
name: "Высокий",
key: 2,
},
{
name: 'Средний',
key: 1
name: "Средний",
key: 1,
},
{
name: 'Низкий',
key: 0
name: "Низкий",
key: 0,
},
]
];
function archiveTask() {
setAcceptModalOpen(true);
@ -287,12 +286,12 @@ export const ModalTiсket = ({
}
function updateTaskPriority(key) {
setSelectPriorityOpen(false)
setSelectPriorityOpen(false);
apiRequest("/task/update-task", {
method: "PUT",
data: {
task_id: task.id,
execution_priority: key
execution_priority: key,
},
}).then(() => {
dispatch(setProjectBoardFetch(projectId));
@ -1006,29 +1005,40 @@ export const ModalTiсket = ({
)}
</div>
</div>
<div className='workers_box-priority'>
<div className='priority__name' onClick={() => setSelectPriorityOpen(!selectPriorityOpen)}>
<span>{typeof taskPriority === "number" ? priority[taskPriority] : 'Выберете приоритет'}</span>
<div className="workers_box-priority">
<div
className="priority__name"
onClick={() => setSelectPriorityOpen(!selectPriorityOpen)}
>
<span>
{typeof taskPriority === "number"
? priority[taskPriority]
: "Выберете приоритет"}
</span>
<img
className={selectPriorityOpen ? "open" : ""}
src={arrowDown}
alt="arrow"
/>
</div>
{selectPriorityOpen &&
<div className='priority__dropDown'>
{selectPriorityOpen && (
<div className="priority__dropDown">
{priorityTypes.map((item) => {
return <div
className='priority__dropDown__item'
return (
<div
className="priority__dropDown__item"
key={item.key}
onClick={() => {
setTaskPriority(item.key)
updateTaskPriority(item.key)
setTaskPriority(item.key);
updateTaskPriority(item.key);
}}
>{item.name}</div>
>
{item.name}
</div>
);
})}
</div>
}
)}
</div>
<div className="workers_box-bottom">
<div

View File

@ -10,7 +10,8 @@ import { getProfileInfo } from "@redux/outstaffingSlice";
import {
deletePersonOnProject,
getBoarderLoader,
modalToggle, setProjectBoardFetch,
modalToggle,
setProjectBoardFetch,
setToggleTab,
} from "@redux/projectsTrackerSlice";
@ -89,35 +90,35 @@ export const TicketFullScreen = () => {
const [startDate, setStartDate] = useState(null);
const [uploadedFile, setUploadedFile] = useState(null);
const [taskFiles, setTaskFiles] = useState([]);
const [taskPriority, setTaskPriority] = useState("")
const [taskPriority, setTaskPriority] = useState("");
const [acceptModalOpen, setAcceptModalOpen] = useState(false);
const [taskTags, setTaskTags] = useState([]);
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
const [selectPriorityOpen, setSelectPriorityOpen] = useState(false)
const [selectPriorityOpen, setSelectPriorityOpen] = useState(false);
const [correctProjectTags, setCorrectProjectTags] = useState([]);
const { showNotification } = useNotification();
const [commentSendDisable, setCommentSendDisable] = useState(false);
const priority = {
2: 'Высокий',
1: 'Средний',
0: 'Низкий'
}
2: "Высокий",
1: "Средний",
0: "Низкий",
};
const priorityTypes = [
{
name: 'Высокий',
key: 2
name: "Высокий",
key: 2,
},
{
name: 'Средний',
key: 1
name: "Средний",
key: 1,
},
{
name: 'Низкий',
key: 0
name: "Низкий",
key: 0,
},
]
];
useEffect(() => {
initListeners();
@ -125,7 +126,7 @@ export const TicketFullScreen = () => {
(taskInfo) => {
setTaskInfo(taskInfo);
setDeadLine(taskInfo.dead_line);
setTaskPriority(taskInfo.execution_priority)
setTaskPriority(taskInfo.execution_priority);
setStartDate(
taskInfo.dead_line ? new Date(taskInfo.dead_line) : new Date()
);
@ -509,15 +510,14 @@ export const TicketFullScreen = () => {
}
function updateTaskPriority(key) {
setSelectPriorityOpen(false)
setSelectPriorityOpen(false);
apiRequest("/task/update-task", {
method: "PUT",
data: {
task_id: taskInfo.id,
execution_priority: key
execution_priority: key,
},
}).then(() => {
});
}).then(() => {});
}
// function deleteFile(file) {
@ -1199,29 +1199,40 @@ export const TicketFullScreen = () => {
</div>
</div>
<div className='workers_box-priority'>
<div className='priority__name' onClick={() => setSelectPriorityOpen(!selectPriorityOpen)}>
<span>{typeof taskPriority === "number" ? priority[taskPriority] : 'Выберете приоритет'}</span>
<div className="workers_box-priority">
<div
className="priority__name"
onClick={() => setSelectPriorityOpen(!selectPriorityOpen)}
>
<span>
{typeof taskPriority === "number"
? priority[taskPriority]
: "Выберете приоритет"}
</span>
<img
className={selectPriorityOpen ? "open" : ""}
src={arrowDown}
alt="arrow"
/>
</div>
{selectPriorityOpen &&
<div className='priority__dropDown'>
{selectPriorityOpen && (
<div className="priority__dropDown">
{priorityTypes.map((item) => {
return <div
className='priority__dropDown__item'
return (
<div
className="priority__dropDown__item"
key={item.key}
onClick={() => {
setTaskPriority(item.key)
updateTaskPriority(item.key)
setTaskPriority(item.key);
updateTaskPriority(item.key);
}}
>{item.name}</div>
>
{item.name}
</div>
);
})}
</div>
}
)}
</div>
<div className="workers_box-bottom">
<div

View File

@ -81,8 +81,8 @@ export const TrackerModal = ({
const [correctProjectTags, setCorrectProjectTags] = useState([]);
const [taskTags, setTaskTags] = useState([]);
const [selectTagsOpen, setSelectTagsOpen] = useState(false);
const [selectedPriority, setSelectedPriority] = useState(null)
const [selectPriority, setSelectPriority] = useState(false)
const [selectedPriority, setSelectedPriority] = useState(null);
const [selectPriority, setSelectPriority] = useState(false);
const [selectColumnPriorityOpen, setSelectColumnPriorityOpen] =
useState(false);
const { showNotification } = useNotification();
@ -92,18 +92,18 @@ export const TrackerModal = ({
const priority = [
{
name: 'Высокий',
key: 2
name: "Высокий",
key: 2,
},
{
name: 'Средний',
key: 1
name: "Средний",
key: 1,
},
{
name: 'Низкий',
key: 0
name: "Низкий",
key: 0,
},
]
];
function createTab() {
if (!valueColumn) {
@ -146,7 +146,7 @@ export const TrackerModal = ({
status: 1,
user_id: localStorage.getItem("id"),
column_id: selectedTab,
execution_priority: selectedPriority ? selectedPriority.key : '',
execution_priority: selectedPriority ? selectedPriority.key : "",
priority: priorityTask,
dead_line: deadLineDate ? getCorrectRequestDate(deadLineDate) : "",
},
@ -183,7 +183,7 @@ export const TrackerModal = ({
setValueTiket("");
setDescriptionTicket("");
setSelectedExecutorTask("Выберите исполнителя задачи");
setSelectedPriority(null)
setSelectedPriority(null);
});
} else {
setActive(false);
@ -605,33 +605,38 @@ export const TrackerModal = ({
</div>
)}
</div>
<div className='select__priority'>
<div className='select__priority__name'
<div className="select__priority">
<div
className="select__priority__name"
onClick={() => setSelectPriority(!selectPriority)}
>
{selectedPriority ? `Приоритет: ${selectedPriority.name}` : 'Выберети приоритет'}
{selectedPriority
? `Приоритет: ${selectedPriority.name}`
: "Выберети приоритет"}
<img
className={
selectPriority ? "arrow arrow--open" : "arrow"
}
className={selectPriority ? "arrow arrow--open" : "arrow"}
src={arrowDown}
alt="arrow"
/>
</div>
{selectPriority &&
<div className='select__priority__dropDown'>
{selectPriority && (
<div className="select__priority__dropDown">
{priority.map((item) => {
return <div
className='dropdown__item'
return (
<div
className="dropdown__item"
key={item.key}
onClick={() => {
setSelectPriority(false)
setSelectedPriority(item)
setSelectPriority(false);
setSelectedPriority(item);
}}
>{item.name}</div>
>
{item.name}
</div>
);
})}
</div>
}
)}
</div>
<div
onClick={() =>

View File

@ -90,18 +90,17 @@ export const ProjectTracker = () => {
const loader = useSelector(getBoarderLoader);
const { showNotification } = useNotification();
const priority =
{
2: 'Высокий',
1: 'Средний',
0: 'Низкий'
}
const priority = {
2: "Высокий",
1: "Средний",
0: "Низкий",
};
const priorityClass = {
2: 'high',
1: 'middle',
0: 'low'
}
2: "high",
1: "middle",
0: "low",
};
useEffect(() => {
dispatch(activeLoader());
@ -1011,12 +1010,19 @@ export const ProjectTracker = () => {
})}
</div>
)}
{typeof task.execution_priority === "number" &&
<div className='tasks__board__item__priority'>
{typeof task.execution_priority ===
"number" && (
<div className="tasks__board__item__priority">
<p>Приоритет:</p>
<span className={priorityClass[task.execution_priority]}>{priority[task.execution_priority]}</span>
</div>
<span
className={
priorityClass[task.execution_priority]
}
>
{priority[task.execution_priority]}
</span>
</div>
)}
{task.dead_line && (
<div className="tasks__board__item__deadLine">
<p>Срок исполнения:</p>