initially setup poject infra in PmsGrid
This commit is contained in:
parent
7b0659e820
commit
d96a1a88ec
35
src/components/Project/pmsInfrastructure/BuildingTable.jsx
Normal file
35
src/components/Project/pmsInfrastructure/BuildingTable.jsx
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
import FloorTable from "./FloorTable";
|
||||||
|
import { useSelectedProject } from "../../../slices/apiDataManager";
|
||||||
|
import { useProjectInfra } from "../../../hooks/useProjects";
|
||||||
|
import { PmsGrid } from "../../../services/pmsGrid";
|
||||||
|
|
||||||
|
export default function BuildingTable() {
|
||||||
|
const project = useSelectedProject()
|
||||||
|
|
||||||
|
const {projectInfra} = useProjectInfra(project,null)
|
||||||
|
const columns = [
|
||||||
|
{ key: "buildingName", title: "Building", sortable: true,},
|
||||||
|
{ key: "plannedWork", title: "Planned Work" },
|
||||||
|
{ key: "completedWork", title: "Completed Work" },
|
||||||
|
{ key: "percentage", title: "Completion %" },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PmsGrid
|
||||||
|
columns={columns}
|
||||||
|
data={projectInfra}
|
||||||
|
rowKey="id"
|
||||||
|
features={{
|
||||||
|
expand: true,
|
||||||
|
pinning: true,
|
||||||
|
resizing: true,
|
||||||
|
selection: true,
|
||||||
|
}}
|
||||||
|
renderExpanded={(building) => (
|
||||||
|
<FloorTable floors={building.floors} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
28
src/components/Project/pmsInfrastructure/FloorTable.jsx
Normal file
28
src/components/Project/pmsInfrastructure/FloorTable.jsx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import React from "react";
|
||||||
|
import WorkAreaTable from "./WorkAreaTable";
|
||||||
|
import { PmsGrid } from "../../../services/pmsGrid";
|
||||||
|
|
||||||
|
export default function FloorTable({ floors }) {
|
||||||
|
const columns = [
|
||||||
|
{ key: "floorName", title: "Floor", sortable: true, },
|
||||||
|
{ key: "plannedWork", title: "Planned Work" },
|
||||||
|
{ key: "completedWork", title: "Completed Work" },
|
||||||
|
{ key: "percentage", title: "Completion %" },
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PmsGrid
|
||||||
|
columns={columns}
|
||||||
|
data={floors}
|
||||||
|
rowKey="id"
|
||||||
|
features={{
|
||||||
|
expand: true,
|
||||||
|
pinning: true,
|
||||||
|
resizing: true,
|
||||||
|
}}
|
||||||
|
renderExpanded={(floor) => (
|
||||||
|
<WorkAreaTable workAreas={floor.workAreas} />
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
39
src/components/Project/pmsInfrastructure/WorkAreaTable.jsx
Normal file
39
src/components/Project/pmsInfrastructure/WorkAreaTable.jsx
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import React, { useState, useEffect } from "react";
|
||||||
|
import { PmsGrid } from "../../../services/pmsGrid";
|
||||||
|
// import { GridService } from "./gridService";
|
||||||
|
// import TaskTable from "./TaskTable";
|
||||||
|
|
||||||
|
export default function WorkAreaTable({ workAreas }) {
|
||||||
|
const [taskData, setTaskData] = useState({}); // workAreaId → tasks
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{ key: "areaName", title: "Work Area", },
|
||||||
|
{ key: "plannedWork", title: "Planned Work" },
|
||||||
|
{ key: "completedWork", title: "Completed Work" },
|
||||||
|
{ key: "percentage", title: "Completion %" },
|
||||||
|
];
|
||||||
|
|
||||||
|
// const loadTasks = async (workAreaId) => {
|
||||||
|
// if (!taskData[workAreaId]) {
|
||||||
|
// const res = await GridService.getTasksByWorkArea(workAreaId);
|
||||||
|
// setTaskData((prev) => ({ ...prev, [workAreaId]: res }));
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PmsGrid
|
||||||
|
columns={columns}
|
||||||
|
data={workAreas}
|
||||||
|
rowKey="id"
|
||||||
|
features={{
|
||||||
|
expand: true,
|
||||||
|
pinning: true,
|
||||||
|
resizing: true,
|
||||||
|
}}
|
||||||
|
// renderExpanded={(area) => {
|
||||||
|
// loadTasks(area.id);
|
||||||
|
// return <TaskTable tasks={taskData[area.id]} />;
|
||||||
|
// }}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -24,6 +24,7 @@ import { useProjectAccess } from "../../hooks/useProjectAccess";
|
|||||||
|
|
||||||
import "./ProjectDetails.css";
|
import "./ProjectDetails.css";
|
||||||
import ProjectOrganizations from "../../components/Project/ProjectOrganizations";
|
import ProjectOrganizations from "../../components/Project/ProjectOrganizations";
|
||||||
|
import BuildingTable from "../../components/Project/pmsInfrastructure/BuildingTable";
|
||||||
|
|
||||||
const ProjectDetails = () => {
|
const ProjectDetails = () => {
|
||||||
const projectId = useSelectedProject();
|
const projectId = useSelectedProject();
|
||||||
@ -88,7 +89,7 @@ const ProjectDetails = () => {
|
|||||||
case "teams":
|
case "teams":
|
||||||
return <Teams />;
|
return <Teams />;
|
||||||
case "infra":
|
case "infra":
|
||||||
return <ProjectInfra data={projects_Details} onDataChange={refetch} />;
|
return <BuildingTable/>
|
||||||
case "workplan":
|
case "workplan":
|
||||||
return <WorkPlan data={projects_Details} onDataChange={refetch} />;
|
return <WorkPlan data={projects_Details} onDataChange={refetch} />;
|
||||||
case "directory":
|
case "directory":
|
||||||
|
|||||||
@ -738,7 +738,7 @@ export default function DemoBOQGrid() {
|
|||||||
reorder: true,
|
reorder: true,
|
||||||
columnVisibility: true,
|
columnVisibility: true,
|
||||||
pageSizeSelector: true,
|
pageSizeSelector: true,
|
||||||
// groupByKey: "category",
|
// groupByKey: "status",
|
||||||
aggregation: true,
|
aggregation: true,
|
||||||
expand: true,
|
expand: true,
|
||||||
maxHeight: "70vh",
|
maxHeight: "70vh",
|
||||||
@ -753,11 +753,7 @@ export default function DemoBOQGrid() {
|
|||||||
icon: "bx-trash text-danger",
|
icon: "bx-trash text-danger",
|
||||||
onClick: (row) => console.log("Delete", row),
|
onClick: (row) => console.log("Delete", row),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "View",
|
|
||||||
icon: "bx-show text-info",
|
|
||||||
onClick: (row) => console.log("View ", row),
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
}}
|
}}
|
||||||
renderExpanded={(row) => (
|
renderExpanded={(row) => (
|
||||||
|
|||||||
@ -170,6 +170,7 @@ export default function PmsGrid({
|
|||||||
Export CSV
|
Export CSV
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="col-4 ">
|
<div className="col-4 ">
|
||||||
@ -236,9 +237,7 @@ export default function PmsGrid({
|
|||||||
</th>
|
</th>
|
||||||
)}
|
)}
|
||||||
{features.expand && (
|
{features.expand && (
|
||||||
<th
|
<th className="text-center ticky-action-column">
|
||||||
className="text-center ticky-action-column"
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="form-check-input mx-3"
|
className="form-check-input mx-3"
|
||||||
@ -270,7 +269,7 @@ export default function PmsGrid({
|
|||||||
key={col.key}
|
key={col.key}
|
||||||
draggable={features.reorder}
|
draggable={features.reorder}
|
||||||
onDragStart={(e) => onDragStart(e, col.key)}
|
onDragStart={(e) => onDragStart(e, col.key)}
|
||||||
onDragOver={(e)=> e.preventDefault()}
|
onDragOver={(e) => e.preventDefault()}
|
||||||
onDrop={(e) => onDrop(e, col.key)}
|
onDrop={(e) => onDrop(e, col.key)}
|
||||||
className={`pms-col-header vs-th ${
|
className={`pms-col-header vs-th ${
|
||||||
col.pinned ? `pinned pinned-${col.pinned}` : ""
|
col.pinned ? `pinned pinned-${col.pinned}` : ""
|
||||||
@ -356,6 +355,7 @@ export default function PmsGrid({
|
|||||||
(features.selection ? 1 : 0) +
|
(features.selection ? 1 : 0) +
|
||||||
(features.actions ? 1 : 0)
|
(features.actions ? 1 : 0)
|
||||||
}
|
}
|
||||||
|
className="text-start"
|
||||||
>
|
>
|
||||||
<strong>{g.key}</strong>
|
<strong>{g.key}</strong>
|
||||||
{features.aggregation &&
|
{features.aggregation &&
|
||||||
@ -526,8 +526,7 @@ export default function PmsGrid({
|
|||||||
)}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// small helpers to compute sticky offsets
|
// small helpers to compute sticky offsets
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user