diff --git a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx index efb5cf3..ce17d60 100644 --- a/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx +++ b/app/src/components/layout/sidebarRight/resourceManagement/hrm/Hrm.tsx @@ -1,200 +1,225 @@ -import { useEffect, useState } from 'react' -import { ClockThreeIcon, LocationPinIcon, TargetIcon } from '../../../../icons/ExportCommonIcons' -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 { useEffect, useState } from "react"; +import { + ClockThreeIcon, + LocationPinIcon, + TargetIcon, +} from "../../../../icons/ExportCommonIcons"; +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 = () => { - const [selectedCard, setSelectedCard] = useState(0); - const [workers, setWorkers] = useState([]); - const { setResourceManagementId } = useResourceManagementId(); - const { assetStore } = useSceneContext(); - const { assets: allAssets } = assetStore(); + const [selectedCard, setSelectedCard] = useState(0); + const [workers, setWorkers] = useState([]); + const { setResourceManagementId } = useResourceManagementId(); + const { assetStore } = useSceneContext(); + const { assets: allAssets } = assetStore(); - async function getAsset(assetId: string) { - let thumbnail = await getAssetThumbnail(assetId) - if (thumbnail.thumbnail) { - let assetImage = thumbnail.thumbnail - return assetImage; - } + async function getAsset(assetId: string) { + let thumbnail = await getAssetThumbnail(assetId); + if (thumbnail.thumbnail) { + let assetImage = thumbnail.thumbnail; + return assetImage; } + } - useEffect(() => { + useEffect(() => { if (allAssets.length > 0) { - const fetchWorkers = async () => { - const humans = allAssets.filter((worker: any) => worker.eventData.type === "Human"); + 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); + 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", - }, - 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 || "-"}`, - }; - }) - ); + return { + employee: { + image: assetImage, + 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", + }, + 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); - }; + setWorkers(formattedWorkers); + }; - fetchWorkers(); + fetchWorkers(); } -}, [allAssets]); + }, [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", -// const employee_details = [ -// { -// "employee": { -// image: "", -// "name": "John Doe", -// "employee_id": "HR-204", -// "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": "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) { + // }, + // "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); + setResourceManagementId(employee.modelId); } -} + } - -return ( + 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 +
+
-
- {/*
+
+ {/*
@@ -215,17 +240,20 @@ return (
*/} -
-
+
+
+
+ + + + Planned time: +
-
- - Planned time: -
- - {employee.task.planned_time_hours} hr -
- {/*
+ + {employee.task.planned_time_hours} hr + +
+ {/*
@@ -243,39 +271,41 @@ return ( {employee.task.time_spent_hours} hr
*/} -
- -
- - Cost per hr: -
- - {employee.task.completed_tasks} -
-
- -
-
-
- -
-
Location:
-
-
{employee.location}
-
-
- {/* - */} - - -
-
+
+
+ + + + Cost per hr: +
+ + {employee.task.completed_tasks} +
- ))} -
- -) -} +
-export default Hrm +
+
+
+ +
+
Location:
+
+
{employee.location}
+
+ {/*
+ + + + +
*/} +
+
+ ))} +
+ + ); +}; + +export default Hrm; diff --git a/app/src/styles/layout/_resourceManagement.scss b/app/src/styles/layout/_resourceManagement.scss index 9582a24..48d768c 100644 --- a/app/src/styles/layout/_resourceManagement.scss +++ b/app/src/styles/layout/_resourceManagement.scss @@ -114,35 +114,34 @@ .user-image-wrapper { width: 28px; height: 28px; - border-radius: 50%; - background-color: #fff; position: relative; - overflow: hidden; - .user-image{ - height: 300%; - width: 300%; - transform: translate(-26px, -12px); + .user-image { + height: 100%; + width: 100%; + border-radius: 50%; + background-color: #fff; + overflow: hidden; + // transform: translate(-26px, -12px); } .status { border-radius: 50%; width: 6px; height: 6px; - outline: 1px solid #2f2c32; - + outline: 2px solid var(--background-color-solid); position: absolute; bottom: 0; right: 0; &.Active { - background-color: #44e5c6; + background-color: #1d9419; } } } .details { max-width: 144px; - .input-value{ + .input-value { max-width: 120px; } .employee-id {