Merge pull request #126 from apuc/tracker-tasks

Tracker tasks
This commit is contained in:
NikoM1k 2023-08-31 02:02:58 +03:00 committed by GitHub
commit e7a1273d17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 440 additions and 176 deletions

View File

@ -4,6 +4,10 @@
align-self: center; align-self: center;
margin-bottom: 194px; margin-bottom: 194px;
@media (max-width: 1200px) {
margin-bottom: 100px;
}
&__header { &__header {
font-family: "GT Eesti Pro Display"; font-family: "GT Eesti Pro Display";
font-size: 5.3em; font-size: 5.3em;
@ -19,6 +23,15 @@
letter-spacing: 0.56px; letter-spacing: 0.56px;
line-height: normal; line-height: normal;
} }
@media (max-width: 1024px) {
margin-top: 25px;
}
@media (max-width: 450px) {
font-size: 4em;
text-align: center;
}
} }
&__sign-in { &__sign-in {
@ -63,6 +76,14 @@
width: 6px; width: 6px;
height: 6px; height: 6px;
margin-left: 120px; margin-left: 120px;
@media (max-width: 700px) {
margin-left: 0;
}
}
@media (max-width: 1024px) {
margin-bottom: 25px;
} }
} }
@ -175,7 +196,6 @@
margin-bottom: 0px; margin-bottom: 0px;
&__header { &__header {
margin-top: 120px;
line-height: 20px; line-height: 20px;
} }
@ -196,6 +216,7 @@
height: 45px; height: 45px;
border-radius: 22.5px; border-radius: 22.5px;
padding-left: 22px; padding-left: 22px;
max-width: none;
} }
&-btn { &-btn {

View File

@ -0,0 +1,50 @@
import React, { useState } from "react";
import { backendImg } from "@utils/helper";
import { apiRequest } from "@api/request";
import close from "assets/icons/closeProjectPersons.svg";
const FileTracker = ({ file, setDeletedTask, taskId }) => {
const [openImg, setOpenImg] = useState(false);
function deleteFile(file) {
apiRequest("/file/detach", {
method: "DELETE",
data: {
file_id: file.id,
entity_type: 2,
entity_id: taskId,
status: 0,
},
}).then(() => {
setDeletedTask(file);
});
}
return (
<div
className={openImg ? "taskFile ImgOpened" : "taskFile"}
key={file.id}
onClick={() => {
if (openImg) setOpenImg(!openImg);
}}
>
<img
className="imgFile"
src={backendImg(file.file?.url)}
alt="img"
onClick={() => {
if (!openImg) setOpenImg(!openImg);
}}
/>
{!openImg && (
<div className="deleteFile" onClick={() => deleteFile(file)}>
<img src={close} alt="delete" />
</div>
)}
</div>
);
};
export default FileTracker;

View File

@ -22,6 +22,7 @@ import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification"; import { useNotification } from "@hooks/useNotification";
import FileTracker from "@components/FileTracker/FileTracker";
import AcceptModal from "@components/Modal/AcceptModal/AcceptModal"; import AcceptModal from "@components/Modal/AcceptModal/AcceptModal";
import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal"; import TrackerModal from "@components/Modal/Tracker/TrackerModal/TrackerModal";
import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskComment"; import TrackerTaskComment from "@components/TrackerTaskComment/TrackerTaskComment";
@ -52,6 +53,7 @@ export const ModalTiсket = ({
projectId, projectId,
projectName, projectName,
projectUsers, projectUsers,
projectOwnerId,
}) => { }) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const [addSubtask, setAddSubtask] = useState(false); const [addSubtask, setAddSubtask] = useState(false);
@ -120,6 +122,11 @@ export const ModalTiсket = ({
}, },
}).then((res) => { }).then((res) => {
dispatch(setProjectBoardFetch(projectId)); dispatch(setProjectBoardFetch(projectId));
showNotification({
show: true,
text: "Изменения сохранены",
type: "success",
});
}); });
} }
@ -366,19 +373,9 @@ export const ModalTiсket = ({
} }
function deleteFile(file) { function deleteFile(file) {
apiRequest("/file/detach", {
method: "DELETE",
data: {
file_id: file.id,
entity_type: 2,
entity_id: task.id,
status: 0,
},
}).then(() => {
setTaskFiles((prevValue) => setTaskFiles((prevValue) =>
prevValue.filter((item) => item.id !== file.id) prevValue.filter((item) => item.id !== file.id)
); );
});
} }
function startTimer() { function startTimer() {
@ -528,19 +525,12 @@ export const ModalTiсket = ({
<div className="task__files"> <div className="task__files">
{taskFiles.map((file) => { {taskFiles.map((file) => {
return ( return (
<div className="taskFile" key={file.id}> <FileTracker
<img key={file.id}
className="imgFile" file={file}
src={backendImg(file.file?.url)} setDeletedTask={deleteFile}
alt="img" taskId={task.id}
/> />
<div
className="deleteFile"
onClick={() => deleteFile(file)}
>
<img src={close} alt="delete" />
</div>
</div>
); );
})} })}
</div> </div>
@ -833,11 +823,27 @@ export const ModalTiсket = ({
<img src={link}></img> <img src={link}></img>
<p onClick={copyTicketLink}>ссылка на задачу</p> <p onClick={copyTicketLink}>ссылка на задачу</p>
</div> </div>
<div onClick={archiveTask}> <div
onClick={archiveTask}
className={
profileInfo.id_user === projectOwnerId ||
profileInfo.id_user === task.user_id
? ""
: "disable"
}
>
<img src={archive}></img> <img src={archive}></img>
<p>в архив</p> <p>в архив</p>
</div> </div>
<div onClick={deleteTask}> <div
onClick={deleteTask}
className={
profileInfo.id_user === projectOwnerId ||
profileInfo.id_user === task.user_id
? ""
: "disable"
}
>
<img src={del}></img> <img src={del}></img>
<p>удалить</p> <p>удалить</p>
</div> </div>

View File

@ -20,6 +20,7 @@
border-radius: 8px; border-radius: 8px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
max-height: 750px;
.content { .content {
position: relative; position: relative;
@ -116,45 +117,35 @@
} }
.taskName { .taskName {
display: -webkit-box;
max-width: 550px; max-width: 550px;
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
-webkit-line-clamp: 5; -webkit-line-clamp: 2;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.taskDescription { .taskDescription {
display: -webkit-box;
max-width: 550px; max-width: 550px;
overflow: hidden; overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
-webkit-line-clamp: 5; -webkit-line-clamp: 4;
-webkit-box-orient: vertical; -webkit-box-orient: vertical;
} }
.fullName { .fullName {
max-width: 800px; max-width: 800px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
} }
.fullDescription { .fullDescription {
max-width: 800px; max-width: 800px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
} }
.comments__list { .comments__list {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
max-height: 300px; max-height: 215px;
overflow: auto; overflow: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {
@ -357,7 +348,7 @@
column-gap: 25px; column-gap: 25px;
row-gap: 20px; row-gap: 20px;
margin-top: 33px; margin-top: 33px;
max-height: 350px; max-height: 170px;
overflow-y: auto; overflow-y: auto;
&::-webkit-scrollbar { &::-webkit-scrollbar {
@ -376,6 +367,7 @@
} }
.taskFile { .taskFile {
cursor: pointer;
position: relative; position: relative;
.imgFile { .imgFile {
max-width: 170px; max-width: 170px;
@ -409,6 +401,26 @@
} }
} }
} }
.ImgOpened {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
z-index: 100;
background-color: rgba(0, 0, 0, 0.2);
.imgFile {
width: 90vw;
height: 90vh;
max-width: none;
max-height: none;
}
}
} }
.fileLoaded { .fileLoaded {

View File

@ -6,6 +6,7 @@ import DatePicker, { registerLocale } from "react-datepicker";
import { useDispatch, useSelector } from "react-redux"; import { useDispatch, useSelector } from "react-redux";
import { Link, useNavigate, useParams } from "react-router-dom"; import { Link, useNavigate, useParams } from "react-router-dom";
import { getProfileInfo } from "@redux/outstaffingSlice";
import { import {
deletePersonOnProject, deletePersonOnProject,
getBoarderLoader, getBoarderLoader,
@ -23,6 +24,8 @@ import {
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
import { useNotification } from "@hooks/useNotification";
import { getCorrectDate } from "@components/Calendar/calendarHelper"; import { getCorrectDate } from "@components/Calendar/calendarHelper";
import { Footer } from "@components/Common/Footer/Footer"; import { Footer } from "@components/Common/Footer/Footer";
import { Loader } from "@components/Common/Loader/Loader"; import { Loader } from "@components/Common/Loader/Loader";
@ -73,6 +76,7 @@ export const TicketFullScreen = () => {
minute: 0, minute: 0,
seconds: 0, seconds: 0,
}); });
const profileInfo = useSelector(getProfileInfo);
const [timerId, setTimerId] = useState(null); const [timerId, setTimerId] = useState(null);
const [dropListOpen, setDropListOpen] = useState(false); const [dropListOpen, setDropListOpen] = useState(false);
const [correctProjectUsers, setCorrectProjectUsers] = useState([]); const [correctProjectUsers, setCorrectProjectUsers] = useState([]);
@ -84,6 +88,7 @@ export const TicketFullScreen = () => {
const [uploadedFile, setUploadedFile] = useState(null); const [uploadedFile, setUploadedFile] = useState(null);
const [taskFiles, setTaskFiles] = useState([]); const [taskFiles, setTaskFiles] = useState([]);
const [acceptModalOpen, setAcceptModalOpen] = useState(false); const [acceptModalOpen, setAcceptModalOpen] = useState(false);
const { showNotification } = useNotification();
useEffect(() => { useEffect(() => {
apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => { apiRequest(`/task/get-task?task_id=${ticketId.id}`).then((taskInfo) => {
@ -175,7 +180,13 @@ export const TicketFullScreen = () => {
title: inputsValue.title, title: inputsValue.title,
description: inputsValue.description, description: inputsValue.description,
}, },
}).then(() => {}); }).then(() => {
showNotification({
show: true,
text: "Изменения сохранены",
type: "success",
});
});
} }
function createComment() { function createComment() {
@ -988,11 +999,27 @@ export const TicketFullScreen = () => {
<img src={link} alt="link"></img> <img src={link} alt="link"></img>
<p onClick={copyTicketLink}>ссылка на задачу</p> <p onClick={copyTicketLink}>ссылка на задачу</p>
</div> </div>
<div onClick={archiveTask}> <div
onClick={archiveTask}
className={
profileInfo.id_user === projectInfo.owner_id ||
profileInfo.id_user === taskInfo.user_id
? ""
: "disable"
}
>
<img src={archive} alt="arch"></img> <img src={archive} alt="arch"></img>
<p>в архив</p> <p>в архив</p>
</div> </div>
<div onClick={deleteTask}> <div
onClick={deleteTask}
className={
profileInfo.id_user === projectInfo.owner_id ||
profileInfo.id_user === taskInfo.user_id
? ""
: "disable"
}
>
<img src={del} alt="delete"></img> <img src={del} alt="delete"></img>
<p>удалить</p> <p>удалить</p>
</div> </div>

View File

@ -17,6 +17,7 @@ export const Navigation = () => {
const [user] = useState( const [user] = useState(
localStorage.getItem("role_status") === "18" ? "partner" : "developer" localStorage.getItem("role_status") === "18" ? "partner" : "developer"
); );
const [navInfo] = useState({ const [navInfo] = useState({
developer: [ developer: [
{ {

View File

@ -11,7 +11,6 @@
position: fixed; position: fixed;
width: 100% !important; width: 100% !important;
height: 80px; height: 80px;
margin-bottom: 50px;
} }
@media (max-width: 1440px) { @media (max-width: 1440px) {

View File

@ -32,6 +32,15 @@
line-height: 22px; line-height: 22px;
color: #000000; color: #000000;
} }
@media (max-width: 1024px) {
text-align: center;
margin-top: 20px;
p {
margin-top: 15px;
}
}
} }
.slick-list { .slick-list {

View File

@ -21,11 +21,23 @@
&__vector-black { &__vector-black {
top: 460px; top: 460px;
right: -224px; right: -224px;
@media (max-width: 1200px) {
top: 370px;
}
@media (max-width: 1024px) {
top: 180px;
}
} }
&__arrow { &__arrow {
margin-top: 360px; margin-top: 360px;
z-index: 99; z-index: 99;
@media (max-width: 1200px) {
display: none;
}
} }
@media (max-width: 575.98px) { @media (max-width: 575.98px) {
@ -42,6 +54,10 @@
padding-top: 30px; padding-top: 30px;
position: relative; position: relative;
padding-bottom: 310px; padding-bottom: 310px;
@media (max-width: 1200px) {
display: none;
}
} }
&__info-box { &__info-box {

View File

@ -21,11 +21,23 @@
&__vector-black { &__vector-black {
top: 460px; top: 460px;
right: -224px; right: -224px;
@media (max-width: 1200px) {
top: 370px;
}
@media (max-width: 1024px) {
top: 180px;
}
} }
&__arrow { &__arrow {
margin-top: 360px; margin-top: 360px;
cursor: pointer; cursor: pointer;
@media (max-width: 1200px) {
display: none;
}
} }
@media (max-width: 575.98px) { @media (max-width: 575.98px) {
@ -43,6 +55,10 @@
padding-top: 30px; padding-top: 30px;
position: relative; position: relative;
padding-bottom: 310px; padding-bottom: 310px;
@media (max-width: 1200px) {
display: none;
}
} }
@media (max-width: 575.98px) { @media (max-width: 575.98px) {
@ -305,7 +321,7 @@
transform: rotate(90deg); transform: rotate(90deg);
} }
@media (max-width: 660px) { @media (max-width: 1024px) {
margin: 15px 0; margin: 15px 0;
} }
} }

View File

@ -3,6 +3,10 @@
font-family: "LabGrotesque", sans-serif; font-family: "LabGrotesque", sans-serif;
background-color: #F1F1F1; background-color: #F1F1F1;
padding-top: 60px; padding-top: 60px;
@media (max-width: 1375px) {
padding-top: 120px;
}
} }
&__title { &__title {
@ -17,6 +21,10 @@
color: #52B709; color: #52B709;
font-weight: 700; font-weight: 700;
} }
@media (max-width: 500px) {
font-size: 35px;
}
} }
&__subTitle { &__subTitle {
@ -25,6 +33,10 @@
text-align: center; text-align: center;
font-size: 22px; font-size: 22px;
line-height: 32px; line-height: 32px;
@media (max-width: 500px) {
font-size: 18px;
}
} }
.arrowElement { .arrowElement {
@ -35,6 +47,10 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@media (max-width: 850px) {
display: none;
}
} }
.arrowDown { .arrowDown {
@ -42,6 +58,10 @@
img { img {
transform: rotate(90deg); transform: rotate(90deg);
} }
@media (max-width: 500px) {
margin: 15px auto;
}
} }
&__info { &__info {
@ -68,6 +88,19 @@
ul { ul {
padding-left: 18px; padding-left: 18px;
} }
@media (max-width: 700px) {
width: 100%;
}
@media (max-width: 600px) {
padding: 15px;
}
}
@media (max-width: 700px) {
flex-direction: column;
row-gap: 10px;
} }
} }
@ -78,6 +111,12 @@
margin: 20px auto 70px; margin: 20px auto 70px;
max-width: 1000px; max-width: 1000px;
@media (max-width: 700px) {
margin: 10px auto 30px;
text-align: center;
row-gap: 5px;
}
span { span {
color: #52B709; color: #52B709;
font-weight: 700; font-weight: 700;
@ -94,10 +133,18 @@
font-size: 18px; font-size: 18px;
line-height: 22px; line-height: 22px;
row-gap: 20px; row-gap: 20px;
@media (max-width: 700px) {
row-gap: 8px;
} }
} }
} }
@media (max-width: 500px) {
padding-top: 30px;
}
}
&__countingBlock { &__countingBlock {
padding: 27px 185px 26px 45px; padding: 27px 185px 26px 45px;
border-radius: 12px; border-radius: 12px;
@ -108,10 +155,34 @@
row-gap: 16px; row-gap: 16px;
position: relative; position: relative;
@media (max-width: 1125px) {
padding-right: 45px;
}
@media (max-width: 850px) {
padding: 20px 25px;
}
@media (max-width: 780px) {
row-gap: 5px;
padding: 15px;
}
&__head { &__head {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
@media (max-width: 850px) {
justify-content: space-evenly;
}
@media (max-width: 750px) {
text-align: center;
img {
display: none;
}
}
} }
&__bottom { &__bottom {
@ -135,12 +206,21 @@
span { span {
color: #52B709; color: #52B709;
} }
@media (max-width: 780px) {
text-align: center;
row-gap: 5px;
}
} }
.countingBlock__info { .countingBlock__info {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
row-gap: 12px; row-gap: 12px;
@media (max-width: 850px) {
row-gap: 5px;
}
} }
.countingBlock { .countingBlock {
@ -162,6 +242,18 @@
position: absolute; position: absolute;
right: -140px; right: -140px;
top: -55px; top: -55px;
@media (max-width: 1440px) {
right: -25px;
}
@media (max-width: 1210px) {
right: 25px;
}
@media (max-width: 1125px) {
display: none;
}
} }
} }
} }

View File

@ -546,6 +546,7 @@ export const ProjectTracker = () => {
projectId={projectBoard.id} projectId={projectBoard.id}
projectName={projectBoard.name} projectName={projectBoard.name}
projectUsers={projectBoard.projectUsers} projectUsers={projectBoard.projectUsers}
projectOwnerId={projectBoard.owner_id}
/> />
)} )}
@ -621,6 +622,7 @@ export const ProjectTracker = () => {
</div> </div>
</div> </div>
)} )}
<div className="tasksContainer">
{column.tasks.map((task) => { {column.tasks.map((task) => {
return ( return (
<div <div
@ -677,20 +679,26 @@ export const ProjectTracker = () => {
/> />
)} )}
</div> </div>
{task.dead_line && (
<div className="tasks__board__item__deadLine"> <div className="tasks__board__item__deadLine">
<p>Срок исполнения:</p> <p>Срок исполнения:</p>
<span> <span>
{task.dead_line {getCorrectDate(task.dead_line)}
? getCorrectDate(task.dead_line)
: "Не выбран"}
</span> </span>
</div> </div>
)}
<div className="tasks__board__item__info"> <div className="tasks__board__item__info">
<div className="tasks__board__item__info__more"> <div className="tasks__board__item__info__more">
<img src={commentsBoard} alt="commentsImg" /> <img
src={commentsBoard}
alt="commentsImg"
/>
<span> <span>
{task.comment_count}{" "} {task.comment_count}{" "}
{caseOfNum(task.comment_count, "comments")} {caseOfNum(
task.comment_count,
"comments"
)}
</span> </span>
</div> </div>
<div className="tasks__board__item__info__more"> <div className="tasks__board__item__info__more">
@ -712,6 +720,7 @@ export const ProjectTracker = () => {
); );
})} })}
</div> </div>
</div>
); );
})} })}
{Boolean(projectBoard?.columns) && {Boolean(projectBoard?.columns) &&

View File

@ -9,7 +9,7 @@ import {
setToggleTab, setToggleTab,
} from "@redux/projectsTrackerSlice"; } from "@redux/projectsTrackerSlice";
import { urlForLocal } from "@utils/helper"; import { caseOfNum, urlForLocal } from "@utils/helper";
import { apiRequest } from "@api/request"; import { apiRequest } from "@api/request";
@ -295,7 +295,10 @@ export const Tracker = () => {
<div className="archive__tasks"> <div className="archive__tasks">
<div className="archive__title"> <div className="archive__title">
<h3>Архив задач:</h3> <h3>Архив задач:</h3>
<p>{filterCompleteTasks.length} задач(а)</p> <p>
{`${filterCompleteTasks.length}
${caseOfNum(filterCompleteTasks.length, "tasks")}`}
</p>
<div className="archive__tasks__search"> <div className="archive__tasks__search">
<img src={search} alt="search" /> <img src={search} alt="search" />
<input <input
@ -354,8 +357,14 @@ export const Tracker = () => {
<div className="archive__title"> <div className="archive__title">
<h3>Архив проектов:</h3> <h3>Архив проектов:</h3>
<p> <p>
{projects.filter((project) => project.status === 10).length}{" "} {`${
проект(ов) projects.filter((project) => project.status === 10).length
}
${caseOfNum(
projects.filter((project) => project.status === 10)
.length,
"projects"
)}`}
</p> </p>
</div> </div>
<div className="archive__tasksWrapper"> <div className="archive__tasksWrapper">

View File

@ -801,16 +801,17 @@
0px 0px 0px 1px rgba(60, 66, 87, 0.08), 0px 0px 0px 1px rgba(60, 66, 87, 0.08),
0px 1px 1px rgba(0, 0, 0, 0.06); 0px 1px 1px rgba(0, 0, 0, 0.06);
border-radius: 8px; border-radius: 8px;
padding: 16px 14px 16px 8px; padding: 12px 10px 12px 8px;
min-width: 353px; min-width: 365px;
max-width: 353px; max-width: 380px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
row-gap: 16px; row-gap: 10px;
height: fit-content; height: fit-content;
position: relative; position: relative;
transition: all 0.3s ease; transition: all 0.3s ease;
transform: scaleY(-1); transform: scaleY(-1);
min-height: 815px;
@media (max-width: 900px) { @media (max-width: 900px) {
min-width: auto; min-width: auto;
@ -819,6 +820,14 @@
transform: scaleX(1); transform: scaleX(1);
} }
.tasksContainer {
display: flex;
flex-direction: column;
row-gap: 16px;
max-height: 750px;
overflow: auto;
padding: 8px;
&::-webkit-scrollbar { &::-webkit-scrollbar {
width: 3px; width: 3px;
border-radius: 10px; border-radius: 10px;
@ -833,6 +842,7 @@
background: #c5c0c6; background: #c5c0c6;
border-radius: 20px; border-radius: 20px;
} }
}
&__hover { &__hover {
box-shadow: 0px 2px 10px #9cc480, box-shadow: 0px 2px 10px #9cc480,

View File

@ -65,30 +65,17 @@ export function getCorrectRequestDate(date) {
} }
export function caseOfNum(number, type) { export function caseOfNum(number, type) {
const comments = ["коментарий", "комментария", " коментариев"]; const allTypes = {
const files = ["файл", "файла", "файлов"]; comments: ["коментарий", "комментария", " коментариев"],
const persons = ["участник", "участника", "участников"]; files: ["файл", "файла", "файлов"],
persons: ["участник", "участника", "участников"],
tasks: ["задача", "задачи", "задач"],
projects: ["проект", "проекта", "проектов"],
};
const cases = [2, 0, 1, 1, 1, 2]; const cases = [2, 0, 1, 1, 1, 2];
if (type === "comments") { return allTypes[type][
return comments[
number % 100 > 4 && number % 100 < 20 number % 100 > 4 && number % 100 < 20
? 2 ? 2
: cases[number % 10 < 5 ? number % 10 : 5] : cases[number % 10 < 5 ? number % 10 : 5]
]; ];
} }
if (type === "files") {
return files[
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
}
if (type === "persons") {
return persons[
number % 100 > 4 && number % 100 < 20
? 2
: cases[number % 10 < 5 ? number % 10 : 5]
];
}
}