diff --git a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx index 439879e..efb5cf3 100644 --- a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx +++ b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx @@ -3,6 +3,7 @@ import { ClockThreeIcon, LocationPinIcon, TargetIcon } from '../../../../icons/E import { useSceneContext } from '../../../../../modules/scene/sceneContext'; import RenameInput from '../../../../ui/inputs/RenameInput'; import { useResourceManagementId } from '../../../../../store/builder/store'; +import { getAssetThumbnail } from '../../../../../services/factoryBuilder/asset/assets/getAssetThumbnail'; // import NavigateCatagory from '../NavigateCatagory' const Hrm = () => { @@ -12,174 +13,188 @@ const Hrm = () => { const { assetStore } = useSceneContext(); const { assets: allAssets } = assetStore(); - useEffect(() => { - if (allAssets.length > 0) { - const formattedWorkers = allAssets - .filter((worker: any) => worker.eventData.type === "Human") - .map((worker: any, index: number) => ({ - employee: { - image: "", - name: worker.modelName, - modelId: worker.modelUuid, - 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" + async function getAsset(assetId: string) { + let thumbnail = await getAssetThumbnail(assetId) + if (thumbnail.thumbnail) { + let assetImage = thumbnail.thumbnail + return assetImage; + } + } + + useEffect(() => { + if (allAssets.length > 0) { + const fetchWorkers = async () => { + const humans = allAssets.filter((worker: any) => worker.eventData.type === "Human"); + + const formattedWorkers = await Promise.all( + humans.map(async (worker: any, index: number) => { + const assetImage = await getAsset(worker.assetId); + + return { + employee: { + image: assetImage, + name: worker.modelName, + modelId: worker.modelUuid, + employee_id: `HR-${204 + index}`, + status: "Active", }, - 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 || "-"}` - })); + 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); - } - }, [allAssets]); - - - // 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) { - + }; + fetchWorkers(); } - function handleHumanClick(employee: any) { - if (employee.modelId) { - setResourceManagementId(employee.modelId); - } +}, [allAssets]); + + + +// 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) { + + +} +function handleHumanClick(employee: any) { + if (employee.modelId) { + setResourceManagementId(employee.modelId); } +} - return ( - <> - {/* + {/* */} -
- {workers.map((employee, index) => ( -
setSelectedCard(index)} - key={index} - > -
-
-
- -
-
-
- {/*
{employee.employee.name}
*/} - -
{employee.employee.employee_id}
-
+
+ {workers.map((employee, index) => ( +
setSelectedCard(index)} + key={index} + > +
+
+
+ +
+
+ {/*
{employee.employee.name}
*/} + +
{employee.employee.employee_id}
+
+
-
{ handleHumanClick(employee.employee) }}>View in Scene
-
+
{ handleHumanClick(employee.employee) }}>View in Scene
+
-
- {/*
+
+ {/*
@@ -200,17 +215,17 @@ const Hrm = () => {
*/} -
-
+
+
-
- - Planned time: -
- - {employee.task.planned_time_hours} hr +
+ + Planned time:
- {/*
+ + {employee.task.planned_time_hours} hr +
+ {/*
@@ -228,39 +243,39 @@ const Hrm = () => { {employee.task.time_spent_hours} hr
*/} -
+
-
- - Cost per hr: -
- - {employee.task.completed_tasks} +
+ + Cost per hr:
-
-
-
-
- -
-
Location:
-
-
{employee.location}
-
-
- {/* - */} - - + {employee.task.completed_tasks}
+
+
+
+ +
+
Location:
+
+
{employee.location}
+
+
+ {/* + */} + + +
- ))} -
- - ) + +
+ ))} +
+ +) } export default Hrm diff --git a/app/src/styles/layout/resourceManagement.scss b/app/src/styles/layout/resourceManagement.scss index d62afe8..5b9678b 100644 --- a/app/src/styles/layout/resourceManagement.scss +++ b/app/src/styles/layout/resourceManagement.scss @@ -117,6 +117,12 @@ border-radius: 50%; background-color: #fff; position: relative; + overflow: hidden; + .user-image{ + height: 300%; + width: 300%; + transform: translate(-26px, -12px); + } .status { border-radius: 50%;