diff --git a/app/package-lock.json b/app/package-lock.json
index 6f14ba4..a1bf231 100644
--- a/app/package-lock.json
+++ b/app/package-lock.json
@@ -2027,7 +2027,7 @@
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"@jridgewell/trace-mapping": "0.3.9"
},
@@ -2039,7 +2039,7 @@
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10"
@@ -4190,6 +4190,26 @@
"url": "https://github.com/sponsors/gregberge"
}
},
+ "node_modules/@testing-library/dom": {
+ "version": "10.4.1",
+ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
+ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/runtime": "^7.12.5",
+ "@types/aria-query": "^5.0.1",
+ "aria-query": "5.3.0",
+ "dom-accessibility-api": "^0.5.9",
+ "lz-string": "^1.5.0",
+ "picocolors": "1.1.1",
+ "pretty-format": "^27.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@testing-library/jest-dom": {
"version": "5.17.0",
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz",
@@ -4301,25 +4321,25 @@
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
- "dev": true
+ "devOptional": true
},
"node_modules/@tsconfig/node12": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
- "dev": true
+ "devOptional": true
},
"node_modules/@tsconfig/node14": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
- "dev": true
+ "devOptional": true
},
"node_modules/@tsconfig/node16": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
- "dev": true
+ "devOptional": true
},
"node_modules/@turf/along": {
"version": "7.2.0",
@@ -9090,7 +9110,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
- "dev": true
+ "devOptional": true
},
"node_modules/cross-env": {
"version": "7.0.3",
@@ -9967,7 +9987,7 @@
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
- "dev": true,
+ "devOptional": true,
"engines": {
"node": ">=0.3.1"
}
@@ -15351,7 +15371,7 @@
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
- "dev": true
+ "devOptional": true
},
"node_modules/makeerror": {
"version": "1.0.12",
@@ -20886,7 +20906,7 @@
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@@ -20929,7 +20949,7 @@
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
- "dev": true,
+ "devOptional": true,
"dependencies": {
"acorn": "^8.11.0"
},
@@ -20941,7 +20961,7 @@
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
- "dev": true
+ "devOptional": true
},
"node_modules/tsconfig-paths": {
"version": "3.15.0",
@@ -21437,7 +21457,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
- "dev": true
+ "devOptional": true
},
"node_modules/v8-to-istanbul": {
"version": "8.1.1",
@@ -22496,7 +22516,7 @@
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
- "dev": true,
+ "devOptional": true,
"engines": {
"node": ">=6"
}
diff --git a/app/src/components/layout/sidebarRight/resourceManagement/ResourceManagement.tsx b/app/src/components/layout/sidebarRight/resourceManagement/ResourceManagement.tsx
index 3b0df8a..e5c0442 100644
--- a/app/src/components/layout/sidebarRight/resourceManagement/ResourceManagement.tsx
+++ b/app/src/components/layout/sidebarRight/resourceManagement/ResourceManagement.tsx
@@ -30,14 +30,6 @@ const ResourceManagement = () => {
{ }} />
-
- { }}
- search={false}
- />
-
{selectType === "assetManagement" ? : }
diff --git a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx
index 2aeacc2..369c04f 100644
--- a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx
+++ b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx
@@ -1,96 +1,156 @@
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
import { ClockThreeIcon, LocationPinIcon, TargetIcon } from '../../../../icons/ExportCommonIcons'
+import { useSceneContext } from '../../../../../modules/scene/sceneContext';
+import { useProductContext } from '../../../../../modules/simulation/products/productContext';
+import RenameInput from '../../../../ui/inputs/RenameInput';
// import NavigateCatagory from '../NavigateCatagory'
const Hrm = () => {
const [selectedCard, setSelectedCard] = useState(0);
+ const [workers, setWorkers] = useState([]);
- const employee_details = [
- {
- "employee": {
- image: "",
- "name": "John Doe",
- "employee_id": "HR-204",
- "status": "Active",
+ const { productStore } = useSceneContext();
+ const { products, getProductById } = productStore();
+ const { selectedProductStore } = useProductContext();
+ const { selectedProduct } = selectedProductStore();
- },
- "task": {
- "status": "Ongoing",
- "title": "Inspecting Machine X",
- "location": {
- "floor": 4,
- "zone": "B"
- },
- "planned_time_hours": 6,
- "time_spent_hours": 2,
- "total_tasks": 12,
- "completed_tasks": 3
- },
- "actions": [
- "Assign Task",
- "Reassign Task",
- "Pause",
- "Emergency Stop"
- ],
- "location": "Floor 4 . Zone B"
- },
- {
- "employee": {
- image: "",
- "name": "Alice Smith",
- "employee_id": "HR-205",
- "status": "Active",
+ useEffect(() => {
+ if (selectedProduct) {
+ const productDetails = getProductById(selectedProduct.productUuid);
+ const workerDetails = productDetails?.eventDatas || [];
- },
- "task": {
- "status": "Ongoing",
- "title": "Calibrating Sensor Y",
- "location": {
- "floor": 2,
- "zone": "A"
- },
- "planned_time_hours": 4,
- "time_spent_hours": 1.5,
- "total_tasks": 10,
- "completed_tasks": 2
- },
- "actions": [
- "Assign Task",
- "Reassign Task",
- "Pause",
- "Emergency Stop"
- ],
- "location": "Floor 4 . Zone B"
- },
- {
- "employee": {
- image: "",
- "name": "Michael Lee",
- "employee_id": "HR-206",
- "status": "Active",
+ const formattedWorkers = workerDetails
+ .filter((worker: any) => worker.type === "human")
+ .map((worker: any, index: number) => ({
+ employee: {
+ image: "",
+ name: worker.modelName,
+ employee_id: `HR-${204 + index}`,
+ status: "Active",
+ },
+ task: {
+ status: "Ongoing",
+ title: worker.taskTitle || "No Task Assigned",
+ location: {
+ floor: worker.floor || 0,
+ zone: worker.zone || "N/A"
+ },
+ planned_time_hours: worker.plannedTime || 0,
+ time_spent_hours: worker.timeSpent || 0,
+ total_tasks: worker.totalTasks || 0,
+ completed_tasks: worker.completedTasks || 0
+ },
+ actions: [
+ "Assign Task",
+ "Reassign Task",
+ "Pause",
+ "Emergency Stop"
+ ],
+ location: `Floor ${worker.floor || "-"} . Zone ${worker.zone || "-"}`
+ }));
+
+ setWorkers(formattedWorkers);
+ }
+ }, [selectedProduct, getProductById]);
+
+ useEffect(() => {
+ // console.log("Workers data updated:", workers);
+ }, [workers]);
+
+
+
+
+ // const employee_details = [
+ // {
+ // "employee": {
+ // image: "",
+ // "name": "John Doe",
+ // "employee_id": "HR-204",
+ // "status": "Active",
+
+ // },
+ // "task": {
+ // "status": "Ongoing",
+ // "title": "Inspecting Machine X",
+ // "location": {
+ // "floor": 4,
+ // "zone": "B"
+ // },
+ // "planned_time_hours": 6,
+ // "time_spent_hours": 2,
+ // "total_tasks": 12,
+ // "completed_tasks": 3
+ // },
+ // "actions": [
+ // "Assign Task",
+ // "Reassign Task",
+ // "Pause",
+ // "Emergency Stop"
+ // ],
+ // "location": "Floor 4 . Zone B"
+ // },
+ // {
+ // "employee": {
+ // image: "",
+ // "name": "Alice Smith",
+ // "employee_id": "HR-205",
+ // "status": "Active",
+
+ // },
+ // "task": {
+ // "status": "Ongoing",
+ // "title": "Calibrating Sensor Y",
+ // "location": {
+ // "floor": 2,
+ // "zone": "A"
+ // },
+ // "planned_time_hours": 4,
+ // "time_spent_hours": 1.5,
+ // "total_tasks": 10,
+ // "completed_tasks": 2
+ // },
+ // "actions": [
+ // "Assign Task",
+ // "Reassign Task",
+ // "Pause",
+ // "Emergency Stop"
+ // ],
+ // "location": "Floor 4 . Zone B"
+ // },
+ // {
+ // "employee": {
+ // image: "",
+ // "name": "Michael Lee",
+ // "employee_id": "HR-206",
+ // "status": "Active",
+
+ // },
+ // "task": {
+ // "status": "Ongoing",
+ // "title": "Testing Conveyor Belt Z",
+ // "location": {
+ // "floor": 5,
+ // "zone": "C"
+ // },
+ // "planned_time_hours": 5,
+ // "time_spent_hours": 3,
+ // "total_tasks": 8,
+ // "completed_tasks": 5
+ // },
+ // "actions": [
+ // "Assign Task",
+ // "Reassign Task",
+ // "Pause",
+ // "Emergency Stop"
+ // ],
+ // "location": "Floor 4 . Zone B"
+ // },
+ // ]
+ function handleRenameWorker(newName: string) {
+ // console.log('newName: ', newName);
+
+ }
- },
- "task": {
- "status": "Ongoing",
- "title": "Testing Conveyor Belt Z",
- "location": {
- "floor": 5,
- "zone": "C"
- },
- "planned_time_hours": 5,
- "time_spent_hours": 3,
- "total_tasks": 8,
- "completed_tasks": 5
- },
- "actions": [
- "Assign Task",
- "Reassign Task",
- "Pause",
- "Emergency Stop"
- ],
- "location": "Floor 4 . Zone B"
- },
- ]
return (
<>
@@ -101,7 +161,7 @@ const Hrm = () => {
/> */}
- {employee_details.map((employee, index) => (
+ {workers.map((employee, index) => (
setSelectedCard(index)}
@@ -114,7 +174,8 @@ const Hrm = () => {
-
{employee.employee.name}
+ {/*
{employee.employee.name}
*/}
+
{employee.employee.employee_id}
diff --git a/app/src/components/layout/sidebarRight/resourceManagement/hrm/assetManagement/AssetManagement.tsx b/app/src/components/layout/sidebarRight/resourceManagement/hrm/assetManagement/AssetManagement.tsx
index 18f5cb0..be015c3 100644
--- a/app/src/components/layout/sidebarRight/resourceManagement/hrm/assetManagement/AssetManagement.tsx
+++ b/app/src/components/layout/sidebarRight/resourceManagement/hrm/assetManagement/AssetManagement.tsx
@@ -1,49 +1,105 @@
-import { useState } from 'react'
+import { useEffect, useState } from 'react'
// import NavigateCatagory from '../../NavigateCatagory'
import { EyeIcon, ForkLiftIcon, KebabIcon, LocationPinIcon, RightHalfFillCircleIcon } from '../../../../../icons/ExportCommonIcons';
import assetImage from "../../../../../../assets/image/asset-image.png"
+import { useSceneContext } from '../../../../../../modules/scene/sceneContext';
+import { useProductContext } from '../../../../../../modules/simulation/products/productContext';
+import RenameInput from '../../../../../ui/inputs/RenameInput';
const AssetManagement = () => {
// const [selectedCategory, setSelectedCategory] = useState("All Assets");
const [expandedAssetId, setExpandedAssetId] = useState(null);
+ const [assets, setAssets] = useState([]);
- const dummyAssets = [
- {
- id: '1',
- name: 'Forklift Model X200',
- model: 'FLK-0025',
- status: 'Online',
- usageRate: 15,
- level: 'Level 1',
- image: assetImage,
- description: 'Electric forklift used for moving goods and materials in warehouse operations.',
- cost: 122000,
- count: 5,
- },
- {
- id: '2',
- name: 'Warehouse Robot WR-300',
- model: 'WRB-3001',
- status: 'Online',
- usageRate: 50,
- level: 'Level 2',
- image: assetImage,
- description: 'Automated robot for handling packages and inventory in the warehouse.',
- cost: 85000,
- count: 3,
- },
- {
- id: '3',
- name: 'Conveyor Belt System CB-150',
- model: 'CBS-150X',
- status: 'Online',
- usageRate: 95,
- level: 'Level 3',
- image: assetImage,
- description: 'High-speed conveyor belt system for efficient material handling.',
- cost: 45000,
- count: 2,
- },
- ];
+ const { productStore } = useSceneContext();
+ const { products, getProductById } = productStore();
+ const { selectedProductStore } = useProductContext();
+ const { selectedProduct } = selectedProductStore();
+
+
+
+ useEffect(() => {
+ if (selectedProduct) {
+ const productDetails = getProductById(selectedProduct.productUuid);
+ const productAssets = productDetails?.eventDatas || [];
+ const grouped: Record = {};
+ productAssets.forEach((asset: any) => {
+ if (asset.type === "storageUnit" || asset.type === "human") return;
+ if (!grouped[asset.modelName]) {
+ grouped[asset.modelName] = {
+ id: asset.assetId,
+ name: asset.modelName,
+ model: asset.modelCode || "N/A",
+ status: asset.status || "Online",
+ usageRate: asset.usageRate || 15,
+ level: asset.level || "Level 1",
+ image: assetImage,
+ description: asset.description || "No description",
+ cost: asset.cost || 0,
+ count: 1,
+ };
+ } else {
+ grouped[asset.modelName].count += 1;
+ }
+ });
+
+ setAssets(Object.values(grouped));
+ }
+ }, [selectedProduct]);
+
+ function handleRenameAsset(newName: string) {
+ // console.log('newName: ', newName);
+ // if (expandedAssetId) {
+ // setAssets(prevAssets =>
+ // prevAssets.map(asset =>
+ // asset.id === expandedAssetId ? { ...asset, name: newName } : asset
+ // )
+ // );
+ // }
+ }
+
+ useEffect(() => {
+
+
+ }, [assets]);
+
+ // const dummyAssets = [
+ // {
+ // id: '1',
+ // name: 'Forklift Model X200',
+ // model: 'FLK-0025',
+ // status: 'Online',
+ // usageRate: 15,
+ // level: 'Level 1',
+ // image: assetImage,
+ // description: 'Electric forklift used for moving goods and materials in warehouse operations.',
+ // cost: 122000,
+ // count: 5,
+ // },
+ // {
+ // id: '2',
+ // name: 'Warehouse Robot WR-300',
+ // model: 'WRB-3001',
+ // status: 'Online',
+ // usageRate: 50,
+ // level: 'Level 2',
+ // image: assetImage,
+ // description: 'Automated robot for handling packages and inventory in the warehouse.',
+ // cost: 85000,
+ // count: 3,
+ // },
+ // {
+ // id: '3',
+ // name: 'Conveyor Belt System CB-150',
+ // model: 'CBS-150X',
+ // status: 'Online',
+ // usageRate: 95,
+ // level: 'Level 3',
+ // image: assetImage,
+ // description: 'High-speed conveyor belt system for efficient material handling.',
+ // cost: 45000,
+ // count: 2,
+ // },
+ // ];
return (
@@ -55,7 +111,7 @@ const AssetManagement = () => {
/> */}
- {dummyAssets.map((asset, index) => (
+ {assets.map((asset, index) => (