From 73293194175d3a42f91b44f54e33bea39bd31fbc Mon Sep 17 00:00:00 2001 From: "pramod.mahajan" Date: Fri, 31 Oct 2025 00:53:42 +0530 Subject: [PATCH] added demo data --- src/services/pmsGrid/BasicTable.jsx | 262 +++++++++++++++++----------- 1 file changed, 156 insertions(+), 106 deletions(-) diff --git a/src/services/pmsGrid/BasicTable.jsx b/src/services/pmsGrid/BasicTable.jsx index 3ce430a4..ffbfeb03 100644 --- a/src/services/pmsGrid/BasicTable.jsx +++ b/src/services/pmsGrid/BasicTable.jsx @@ -7,8 +7,6 @@ import { initPopover } from "./GridService"; * CIVIL BOQ / INVENTORY DEMO DATA * Each row = BOQ item, grouped by "Category" */ - -// ✅ BOQ data const boqData = [ { id: 1, @@ -72,6 +70,18 @@ const boqData = [ }, { id: 6, + category: "Masonry Works", + itemCode: "M-002", + description: "Block Masonry AAC 200mm wall", + unit: "Sqm", + quantity: 240, + rate: 1100, + site: "Green City", + vendor: "Ambuja Blocks", + status: "Pending", + }, + { + id: 7, category: "Plastering Works", itemCode: "P-001", description: "Internal Plaster 12mm thick", @@ -82,9 +92,47 @@ const boqData = [ vendor: "L&T Finishes", status: "Completed", }, + { + id: 8, + category: "Plastering Works", + itemCode: "P-002", + description: "External Plaster 20mm thick", + unit: "Sqm", + quantity: 800, + rate: 320, + site: "Sunshine Plaza", + vendor: "Hindustan Plaster", + status: "In Progress", + }, + { + id: 9, + category: "Flooring Works", + itemCode: "F-001", + description: "Vitrified Tiles 600x600mm", + unit: "Sqm", + quantity: 600, + rate: 650, + site: "Green City - Clubhouse", + vendor: "Kajaria", + status: "Pending", + }, + { + id: 10, + category: "Flooring Works", + itemCode: "F-002", + description: "Granite Flooring 20mm thick", + unit: "Sqm", + quantity: 300, + rate: 1250, + site: "Skyline Heights - Lobby", + vendor: "Classic Stone", + status: "Completed", + }, ]; -// ✅ BOQ columns +/** + * COLUMN DEFINITIONS + */ const boqColumns = [ { key: "itemCode", title: "Item Code", sortable: true, pinned: "left" }, { key: "description", title: "Description", sortable: true, width: 300 }, @@ -108,6 +156,11 @@ const boqColumns = [ ₹{(r.quantity * r.rate).toLocaleString()} ), + aggregate: (vals) => + "₹" + + vals + .reduce((sum, val) => sum + val, 0) + .toLocaleString(), }, { key: "vendor", title: "Vendor", sortable: true, width: 180 }, { key: "site", title: "Site Location", sortable: true, width: 200 }, @@ -132,122 +185,119 @@ const boqColumns = [ }, ]; -// ✅ Main component +/** + * DEMO COMPONENT + */ export default function DemoBOQGrid() { - const wrapperRef = useRef(null); - - // initialize scrollbar - useEffect(() => { - if (!wrapperRef.current) return; - const ps = new PerfectScrollbar(wrapperRef.current, { - wheelPropagation: false, - suppressScrollX: false, - }); - return () => ps.destroy(); - }, []); - - // initialize bootstrap popover - useEffect(() => { +useEffect(() => { + // 🔥 Initialize Bootstrap popovers after first render initPopover(); }, []); - + const wrapperRef = useRef() + useEffect(() => { + if (!wrapperRef.current) return; + const ps = new PerfectScrollbar(wrapperRef.current, { + wheelPropagation: false, + suppressScrollX: false, + }); + return () => ps.destroy(); +}, []); return (
-
-
📦 BOQ (Bill of Quantities)
- -
+
-
- ({ - ...r, - amount: r.quantity * r.rate, - }))} - columns={boqColumns} - features={{ - search: true, - selection: true, - pagination: true, - export: true, - pinning: true, - resizing: true, - reorder: true, - columnVisibility: true, - expand: true, - aggregation: true, - maxHeight: "60vh", - actions: (row, toggleExpand) => ( + ({ + ...r, + amount: r.quantity * r.rate, + }))} + columns={boqColumns} + features={{ + search: true, + selection: true, + pagination: true, + export: true, + pinning: true, + resizing: true, + reorder: true, + columnVisibility: true, + pageSizeSelector: true, + // groupByKey: "category", + aggregation: true, + expand: true, + maxHeight: "60vh", + actions: (row, toggleExpand) => ( + <> - ), - }} - renderExpanded={(row) => ( -
-
Item Details
-
-
- Item Code: {row.itemCode} -
-
- Category: {row.category} -
-
- Unit: {row.unit} -
-
- Quantity: {row.quantity} -
-
- Rate: ₹{row.rate.toLocaleString()} -
-
- Total Amount:{" "} - - ₹{(row.quantity * row.rate).toLocaleString()} - -
-
- Vendor: {row.vendor} -
-
- Site: {row.site} -
-
- Status:{" "} - - {row.status} - -
+ + ), + }} + renderExpanded={(row) => ( +
+
Item Details
+
+
+ Item Code: {row.itemCode} +
+
+ Category: {row.category} +
+
+ Unit: {row.unit} +
+
+ Quantity: {row.quantity} +
+
+ Rate: ₹{row.rate.toLocaleString()} +
+
+ Total Amount:{" "} + + ₹{(row.quantity * row.rate).toLocaleString()} + +
+
+ Vendor: {row.vendor} +
+
+ Site Location: {row.site} +
+
+ Status:{" "} + + {row.status} +
- )} - /> -
+
+ )} + />
); -} \ No newline at end of file +}