BOD-21 Bug fixes for production columns.
This commit is contained in:
@@ -1,44 +1,41 @@
|
||||
import React from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import Board from "react-trello";
|
||||
import { Card } from "antd";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export default function ProductionBoardKanbanComponent({
|
||||
export function ProductionBoardKanbanComponent({
|
||||
loading,
|
||||
data,
|
||||
columnState,
|
||||
bodyshop,
|
||||
}) {
|
||||
console.log("data", data);
|
||||
const data2 = {
|
||||
lanes: [
|
||||
{
|
||||
id: "lane1",
|
||||
title: "Planned Tasks",
|
||||
label: "2/2",
|
||||
cards: [
|
||||
{
|
||||
id: "Card1",
|
||||
title: "Write Blog",
|
||||
description: "Can AI make memes",
|
||||
label: "30 mins",
|
||||
},
|
||||
{
|
||||
id: "Card2",
|
||||
title: "Pay Rent",
|
||||
description: "Transfer via NEFT",
|
||||
label: "5 mins",
|
||||
metadata: { sha: "be312a1" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "lane2",
|
||||
title: "Completed",
|
||||
label: "0/0",
|
||||
|
||||
const [cards, setCards] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const cols = bodyshop.md_ro_statuses.open_statuses.map((s) => {
|
||||
return {
|
||||
id: s,
|
||||
title: s,
|
||||
cards: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
});
|
||||
if (data)
|
||||
data.forEach((d) =>
|
||||
cols
|
||||
.find((c) => c.id === d.status)
|
||||
.cards.push({ id: d.id, title: d.est_number, description: d.ownr_fn })
|
||||
);
|
||||
|
||||
setCards(cols);
|
||||
}, [data, bodyshop.md_ro_statuses.open_statuses, setCards]);
|
||||
|
||||
const kanbanCard = (card) => <Card>{card.title}</Card>;
|
||||
|
||||
@@ -46,7 +43,8 @@ export default function ProductionBoardKanbanComponent({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Board data={data2} components={{ Card: kanbanCard }} />
|
||||
<Board data={{ lanes: cards }} components={{ Card: kanbanCard }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, null)(ProductionBoardKanbanComponent);
|
||||
|
||||
Reference in New Issue
Block a user