Introduce React-Trello in place of React-Kanban

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-05-09 13:22:58 -04:00
parent f77a16648f
commit f647e1ff11
49 changed files with 2632 additions and 119 deletions

View File

@@ -18,8 +18,8 @@ const sortByParentId = (arr) => {
//console.log("sortByParentId -> byParentsIdsList", byParentsIdsList);
while (byParentsIdsList[parentId]) {
sortedList.push(...byParentsIdsList[parentId]); //Spread in the whole list in case several items have the same parents.
parentId = byParentsIdsList[parentId][byParentsIdsList[parentId].length -1].id; //Grab the ID from the last one.
sortedList.push(...byParentsIdsList[parentId]); //Spread in the whole list in case several items have the same parents.
parentId = byParentsIdsList[parentId][byParentsIdsList[parentId].length - 1].id; //Grab the ID from the last one.
}
if (byParentsIdsList["null"]) byParentsIdsList["null"].map((i) => sortedList.push(i));
@@ -40,15 +40,13 @@ const sortByParentId = (arr) => {
export const createBoardData = (AllStatuses, Jobs, filter) => {
const { search, employeeId } = filter;
const boardLanes = {
columns: AllStatuses.map((s) => {
return {
id: s,
title: s,
cards: []
};
})
};
const lanes = AllStatuses.map((s) => {
return {
id: s,
title: s,
cards: []
};
});
const filteredJobs =
(search === "" || !search) && !employeeId
@@ -75,16 +73,25 @@ export const createBoardData = (AllStatuses, Jobs, filter) => {
Object.keys(DataGroupedByStatus).map((statusGroupKey) => {
try {
const needle = boardLanes.columns.find((l) => l.id === statusGroupKey);
if (!needle?.cards) return null;
needle.cards = sortByParentId(DataGroupedByStatus[statusGroupKey]);
const lane = lanes.find((l) => l.id === statusGroupKey);
if (!lane?.cards) return null;
lane.cards = sortByParentId(DataGroupedByStatus[statusGroupKey]).map((job) => {
const { id, title, description, due_date, ...metadata } = job;
return {
id,
title,
description,
label: job.due_date || "",
metadata
};
});
} catch (error) {
console.log("Error while creating board card", error);
}
return null;
});
return boardLanes;
return { lanes };
};
const CheckSearch = (search, job) => {