diff --git a/package-lock.json b/package-lock.json index 3fbe5ff0..60cca5b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "react-inlinesvg": "3.0.1", "react-loader-spinner": "^4.0.0", "react-outside-click-handler": "^1.3.0", + "react-paginate": "^8.2.0", "react-phone-input-2": "^2.14.0", "react-redux": "^7.2.4", "react-router": "latest", @@ -21020,6 +21021,17 @@ "react-dom": ">=16.3.0" } }, + "node_modules/react-paginate": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/react-paginate/-/react-paginate-8.2.0.tgz", + "integrity": "sha512-sJCz1PW+9PNIjUSn919nlcRVuleN2YPoFBOvL+6TPgrH/3lwphqiSOgdrLafLdyLDxsgK+oSgviqacF4hxsDIw==", + "dependencies": { + "prop-types": "^15" + }, + "peerDependencies": { + "react": "^16 || ^17 || ^18" + } + }, "node_modules/react-phone-input-2": { "version": "2.15.1", "resolved": "https://registry.npmjs.org/react-phone-input-2/-/react-phone-input-2-2.15.1.tgz", diff --git a/package.json b/package.json index af9978a4..21055908 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "react-inlinesvg": "3.0.1", "react-loader-spinner": "^4.0.0", "react-outside-click-handler": "^1.3.0", + "react-paginate": "^8.2.0", "react-phone-input-2": "^2.14.0", "react-redux": "^7.2.4", "react-router": "latest", diff --git a/src/assets/icons/plus.svg b/src/assets/icons/plus.svg index 64f79cb0..51e86146 100644 --- a/src/assets/icons/plus.svg +++ b/src/assets/icons/plus.svg @@ -1,3 +1 @@ - - - + \ No newline at end of file diff --git a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx new file mode 100644 index 00000000..01d98e38 --- /dev/null +++ b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.jsx @@ -0,0 +1,60 @@ +import React from "react"; + +import plus from "assets/icons/plus.svg"; + +import "./allTaskTableItem.scss"; + +const AllTaskTableItem = ({ task, projects }) => { + function toggleDescTask(e) { + e.target?.classList.toggle("open-desc-item"); + e.target + .closest("td") + ?.querySelector(".taskList__table__name-project") + .classList.toggle("hide-desc"); + } + + return ( + + +
+

{task.title}

+ + # { + toggleDescTask(e); + }} + /> +
+
+

Проект:

+

+ {projects?.map((project) => { + if (project.id == task.project_id) { + return project.name; + } + })} +

+
+ + +
+ {task.status == 1 ? "Active" : "Close"} +
+ + + {task.timers.map((item) => { + let time = new Date(item.deltaSeconds * 1000) + .toISOString() + .slice(11, 19); + return `${time}`; + })} + + {new Date(task.created_at).toLocaleDateString()} + {new Date(task.dead_line).toLocaleDateString()} + + ); +}; + +export default AllTaskTableItem; diff --git a/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.scss b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.scss new file mode 100644 index 00000000..d8482e9f --- /dev/null +++ b/src/components/AllTaskTableTracker/AllTaskTableItem/AllTaskTableItem.scss @@ -0,0 +1,117 @@ +.open-desc-item { + transition: 0.4s !important; + transform: rotate(45deg) !important; +} + +.taskList { + &__table { + margin-top: 20px; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: 32px; + + thead { + height: 65px; + background: #f1f1f1; + color: #5b6871; + + th { + &:first-child { + padding-left: 10px; + border-top-left-radius: 12px; + border-bottom-left-radius: 12px; + } + &:last-child { + border-top-right-radius: 12px; + border-bottom-right-radius: 12px; + } + } + } + + tbody { + color: #000; + tr { + background-color: white; + + &:nth-child(2n) { + background-color: rgba(241, 241, 241, 0.23); + } + } + + td { + height: 65px; + border-bottom: 1px solid rgba(241, 241, 241, 1); + + &:first-child { + max-width: 275px; + padding-left: 10px; + color: #111112; + font-size: 17px; + font-weight: 700; + } + } + + .task-status { + width: 130px; + border: 1px solid #52b709; + border-radius: 15px; + display: flex; + align-items: center; + justify-content: center; + color: #000; + font-size: 14px; + font-weight: 400; + } + } + + &__title-task { + display: flex; + gap: 10px; + align-items: center; + transition: 0.4s; + max-width: 350px; + + p { + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + + img { + cursor: pointer; + width: 22px; + height: 22px; + + transition: 0.4s; + transform: rotate(0deg); + } + } + + &__name-project { + display: flex; + flex-direction: column; + transition: 0.4s; + + h4 { + margin: 0; + color: #807777; + font-size: 10px; + font-weight: 500; + line-height: 24px; + } + + p { + color: #000; + margin-top: -5px; + font-size: 14px; + font-weight: 400; + line-height: 32px; + max-width: 318px; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + } + } + } +} diff --git a/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx new file mode 100644 index 00000000..56e0575b --- /dev/null +++ b/src/components/AllTaskTableTracker/AllTaskTableTracker.jsx @@ -0,0 +1,94 @@ +import React from "react"; +import { useState } from "react"; +import { useEffect } from "react"; +import ReactPaginate from "react-paginate"; + +import AllTaskTableItem from "./AllTaskTableItem/AllTaskTableItem"; +import "./allTaskTableTracker.scss"; + +const AllTaskTableTracker = ({ filteredAllTasks, projects, loader }) => { + const [items, setItems] = useState([]); + const itemsPerPage = 10; + + const [currentItems, setCurrentItems] = useState([]); + const [pageCount, setPageCount] = useState(0); + const [itemOffset, setItemOffset] = useState(0); + + useEffect(() => { + setItems(filteredAllTasks); + const endOffset = itemOffset + itemsPerPage; + setCurrentItems(filteredAllTasks?.slice(itemOffset, endOffset)); + setPageCount(Math.ceil(filteredAllTasks?.length / itemsPerPage)); + }, [filteredAllTasks]); + + useEffect(() => { + const endOffset = itemOffset + itemsPerPage; + setCurrentItems(items.slice(itemOffset, endOffset)); + setPageCount(Math.ceil(items.length / itemsPerPage)); + }, [itemOffset, itemsPerPage]); + + const handlePageClick = (event) => { + const newOffset = (event.selected * itemsPerPage) % items.length; + setItemOffset(newOffset); + }; + + return ( + <> + + + + + + + + + + + + + {!loader && ( + <> + {Boolean(currentItems.length) && + currentItems.map((task, index) => { + return ( + + ); + })} + + )} + +
ЗадачаСтатусПотраченное времяДата началаДедлайн
+ + {currentItems.length < itemsPerPage ? ( + "" + ) : ( + + )} + + ); +}; + +export default AllTaskTableTracker; diff --git a/src/components/AllTaskTableTracker/allTaskTableTracker.scss b/src/components/AllTaskTableTracker/allTaskTableTracker.scss new file mode 100644 index 00000000..1c49db02 --- /dev/null +++ b/src/components/AllTaskTableTracker/allTaskTableTracker.scss @@ -0,0 +1,24 @@ +.pagination { + display: flex; + padding-left: 0; + list-style: none; + justify-content: center; + margin-top: 50px; + font-size: 14px; + + &__item { + } + + &__link { + border-radius: 15px; + color: black; + padding: 6px 10px; + } +} + +.active-btn { + .pagination__link { + color: white; + background-color: #52b709; + } +} diff --git a/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx new file mode 100644 index 00000000..ac500591 --- /dev/null +++ b/src/components/ArchiveTableTracker/ArchiveTableTracker.jsx @@ -0,0 +1,38 @@ +import React from "react"; + +import ArchiveTasksItem from "@components/ArchiveTableTracker/ArchiveTasksItem/ArchiveTasksItem"; + +import "./archiveTableTracker.scss"; + +const ArchiveTableTracker = ({ filterCompleteTasks, loader }) => { + return ( + + + + + + + + + + {!loader && ( + <> + {Boolean(filterCompleteTasks.length) ? ( + filterCompleteTasks?.map((task, index) => { + return ( + + ); + }) + ) : ( +
+

В данном месяце у вас не было задач

+
+ )} + + )} +
+
ЗадачаПотраченное времяДата окончания
+ ); +}; + +export default ArchiveTableTracker; diff --git a/src/components/ArchiveTableTracker/ArchiveTasksItem/ArchiveTasksItem.jsx b/src/components/ArchiveTableTracker/ArchiveTasksItem/ArchiveTasksItem.jsx new file mode 100644 index 00000000..432fe1a2 --- /dev/null +++ b/src/components/ArchiveTableTracker/ArchiveTasksItem/ArchiveTasksItem.jsx @@ -0,0 +1,40 @@ +import React from "react"; + +import { getCorrectDate } from "@components/Calendar/calendarHelper"; + +import "./archiveTasksItem.scss"; + +const ArchiveTasksItem = ({ task, index }) => { + return ( + + +

{task.title}

+

+ + +

+ {task.timers.length == 0 + ? "-" + : task.timers.map((item) => { + let time = new Date(item.deltaSeconds * 1000) + .toISOString() + .slice(11, 19); + return `${time}`; + })} +

+ + +
+

{getCorrectDate(task.updated_at)}

+
+ + + ); +}; + +export default ArchiveTasksItem; diff --git a/src/components/ArchiveTableTracker/ArchiveTasksItem/archiveTasksItem.scss b/src/components/ArchiveTableTracker/ArchiveTasksItem/archiveTasksItem.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/components/ArchiveTableTracker/archiveTableTracker.scss b/src/components/ArchiveTableTracker/archiveTableTracker.scss new file mode 100644 index 00000000..5e12a3a1 --- /dev/null +++ b/src/components/ArchiveTableTracker/archiveTableTracker.scss @@ -0,0 +1,54 @@ +.archive { + &__table { + margin: 29px 0 0 0; + height: 67px; + width: 100%; + font-size: 14px; + font-weight: 400; + + thead { + background: #f1f1f1; + color: #5b6871; + border-radius: 12px; + height: 65px; + background: #f1f1f1; + color: #5b6871; + + th { + &:first-child { + padding-left: 10px; + border-top-left-radius: 12px; + border-bottom-left-radius: 12px; + } + &:last-child { + border-top-right-radius: 12px; + border-bottom-right-radius: 12px; + } + } + } + + tbody { + color: #000; + tr { + background-color: white; + + &:nth-child(2n) { + background-color: rgba(241, 241, 241, 0.23); + } + } + + td { + height: 65px; + border-bottom: 1px solid rgba(241, 241, 241, 1); + + &:first-child { + max-width: 275px; + padding-left: 10px; + color: #111112; + font-size: 17px; + font-weight: 700; + } + } + } + } +} diff --git a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx index d4286bcd..236dc44b 100644 --- a/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx +++ b/src/components/Modal/Tracker/ModalTicket/ModalTicket.jsx @@ -1012,7 +1012,7 @@ export const ModalTiсket = ({ > {typeof taskPriority === "number" - ? priority[taskPriority] + ? `Приоритет: ${priority[taskPriority]}` : "Выберите приоритет"} { > {typeof taskPriority === "number" - ? priority[taskPriority] + ? `Приоритет: ${priority[taskPriority]}` : "Выберите приоритет"} { ); } - function toggleDescTask(e) { - e.target.closest("img").classList.toggle("open-desc-item"); - e.target - .closest("td") - ?.querySelector(".taskList__table__name-project") - .classList.toggle("hide-desc"); - } - return (
@@ -195,7 +187,7 @@ export const Tracker = () => { {projects && Boolean(projects.length) && !loader && - projects.map((project, index) => { + projects?.map((project, index) => { return project.status !== 10 ? ( ) : ( @@ -205,7 +197,7 @@ export const Tracker = () => { {typeof projects === "object" && (!Boolean(projects.length) || !Boolean( - projects.filter((project) => project.status !== 10).length + projects?.filter((project) => project.status !== 10).length )) && !loader && (
@@ -297,73 +289,12 @@ export const Tracker = () => {
{loader && } - - - - - - - - - - - - {!loader && ( - <> - {Boolean(filteredAllTasks.length) && - filteredAllTasks.map((task, index) => { - return ( - - - - - - - - ); - })} - - )} - -
ЗадачаСтатусПотраченное времяДата началаДедлайн
-
-

{task.title}

- -
{ - toggleDescTask(e); - }} - > - # -
-
-
-

Проект:

-

- {projects.map((project) => { - if (project.id == task.project_id) { - return project.name; - } - })} -

-
-
-
- {task.status == 1 ? "Active" : "Close"} -
-
- {task.timers.map((item) => { - let time = new Date(item.deltaSeconds * 1000) - .toISOString() - .slice(11, 19); - return `${time}`; - })} - - {new Date(task.created_at).toLocaleDateString()} - - {new Date(task.dead_line).toLocaleDateString()} -
+
@@ -438,74 +369,21 @@ export const Tracker = () => {
{loader && } - - - - - - - - - - {!loader && ( - <> - {Boolean(filterCompleteTasks.length) ? ( - filterCompleteTasks.map((task, index) => { - return ( - - - - - - ); - }) - ) : ( -
-

В данном месяце у вас не было задач

-
- )} - - )} - -
ЗадачаПотраченное времяДата окончания
-

- {task.title} -

-

-

-

- {task.timers.length == 0 - ? "-" - : task.timers.map((item) => { - let time = new Date( - item.deltaSeconds * 1000 - ) - .toISOString() - .slice(11, 19); - return `${time}`; - })} -

-
-
-

{getCorrectDate(task.updated_at)}

-
-
+

Архив проектов:

{`${ - projects.filter((project) => project.status === 10).length + projects?.filter((project) => project.status === 10).length } ${caseOfNum( - projects.filter((project) => project.status === 10) + projects?.filter((project) => project.status === 10) .length, "projects" )}`} @@ -513,9 +391,9 @@ export const Tracker = () => {

{Boolean( - projects.filter((project) => project.status === 10).length + projects?.filter((project) => project.status === 10).length ) ? ( - projects.map((project, index) => { + projects?.map((project, index) => { return project.status === 10 ? (