Merge branch 'Issues_April_5W' of https://git.marcoaiot.com/admin/marco.pms.web into Issues_April_5W
This commit is contained in:
commit
02f37be504
@ -171,3 +171,7 @@
|
||||
inset-block-start: 1.5rem;
|
||||
inset-inline-end: 1.5rem;
|
||||
}
|
||||
|
||||
.text-darkgreen {
|
||||
color: #16a085;
|
||||
}
|
||||
|
@ -20,8 +20,12 @@ const Floor = ({ floor, workAreas, forBuilding }) => {
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
{" "}
|
||||
<span className="fw-semibold">Floor: </span>{" "}
|
||||
<span class="fw-normal">{floor.floorName}</span>
|
||||
<span className="fw-semibold text-primary">
|
||||
Floor:
|
||||
</span>{" "}
|
||||
<span class="fw-normal text-darkgreen">
|
||||
{floor.floorName}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,22 +1,21 @@
|
||||
import React, { useEffect,useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import WorkItem from "./WorkItem";
|
||||
import {useProjectDetails} from "../../../hooks/useProjects";
|
||||
import {getCachedData} from "../../../slices/apiDataManager";
|
||||
import { useProjectDetails } from "../../../hooks/useProjects";
|
||||
import { getCachedData } from "../../../slices/apiDataManager";
|
||||
|
||||
const WorkArea = ( {workArea, floor, forBuilding} ) =>{
|
||||
const [workItems,setWorkItems] =useState([])
|
||||
const WorkArea = ({ workArea, floor, forBuilding }) => {
|
||||
const [workItems, setWorkItems] = useState([]);
|
||||
|
||||
useEffect( () =>
|
||||
{
|
||||
const project = getCachedData( "projectInfo" )
|
||||
useEffect(() => {
|
||||
const project = getCachedData("projectInfo");
|
||||
if (!project || !forBuilding?.id || !floor?.id || !workArea?.id) return;
|
||||
|
||||
const building = project.buildings?.find((b) => b.id === forBuilding.id);
|
||||
const floors = building?.floors?.find((f) => f.id === floor.id);
|
||||
const workAreas = floor?.workAreas?.find((wa) => wa.id === workArea.id);
|
||||
const building = project.buildings?.find((b) => b.id === forBuilding.id);
|
||||
const floors = building?.floors?.find((f) => f.id === floor.id);
|
||||
const workAreas = floor?.workAreas?.find((wa) => wa.id === workArea.id);
|
||||
|
||||
setWorkItems(workAreas?.workItems || []);
|
||||
}, [ workArea ,floor,floor] );
|
||||
setWorkItems(workAreas?.workItems || []);
|
||||
}, [workArea, floor, floor]);
|
||||
|
||||
return (
|
||||
<React.Fragment key={workArea.id}>
|
||||
@ -27,12 +26,20 @@ const WorkArea = ( {workArea, floor, forBuilding} ) =>{
|
||||
<div className="row">
|
||||
<div className="col">
|
||||
{" "}
|
||||
<span className="fw-semibold">Floor: </span>{" "}
|
||||
<span class="fw-normal">{floor.floorName}</span>
|
||||
<span className="fw-semibold text-primary">
|
||||
Floor:
|
||||
</span>{" "}
|
||||
<span class="fw-normal text-darkgreen">
|
||||
{floor.floorName}
|
||||
</span>
|
||||
</div>
|
||||
<div className="col">
|
||||
<span className="ms-10 fw-semibold">Work Area: </span>{" "}
|
||||
<span class=" fw-normal">{workArea.areaName}</span>
|
||||
<span className="ms-10 fw-semibold text-primary">
|
||||
Work Area:
|
||||
</span>{" "}
|
||||
<span class=" fw-normal text-darkgreen">
|
||||
{workArea.areaName}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,7 +47,7 @@ const WorkArea = ( {workArea, floor, forBuilding} ) =>{
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{(workItems && workItems.length > 0) && (
|
||||
{workItems && workItems.length > 0 && (
|
||||
<tr className="overflow-auto">
|
||||
<td colSpan={4}>
|
||||
<table className="table mx-1">
|
||||
@ -88,7 +95,7 @@ const WorkArea = ( {workArea, floor, forBuilding} ) =>{
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{!workItems && <p>No item</p>}
|
||||
{!workItems && <p>No item</p>}
|
||||
</React.Fragment>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user