|
|
@@ -22,7 +22,7 @@ import { ConstructionOutlined } from "@mui/icons-material"; |
|
|
|
import ReactApexChart from "react-apexcharts"; |
|
|
|
import { ApexOptions } from "apexcharts"; |
|
|
|
import { useSearchParams } from 'next/navigation'; |
|
|
|
import { fetchAllClientSubsidiaryProjects} from "@/app/api/clientprojects/actions"; |
|
|
|
import { fetchAllClientSubsidiaryProjects,fetchAllClientProjects} from "@/app/api/clientprojects/actions"; |
|
|
|
// const ReactApexChart = dynamic(() => import('react-apexcharts'), { ssr: false }); |
|
|
|
|
|
|
|
type SearchProjectQuery = Partial<Omit<ClientSubsidiaryProjectResult, "id">>; |
|
|
@@ -94,8 +94,15 @@ const ProgressByClient: React.FC<Props> = () => { |
|
|
|
"#d1fef0", "#04afff", "#ff859e", "#4bdd15", "#ccfb2b"]; |
|
|
|
const [clientSubsidiaryProjectResult, setClientSubsidiaryProjectResult]:any[] = useState([]); |
|
|
|
const [tableSorting, setTableSorting] = useState('ProjectName'); |
|
|
|
const [customerNameAndCode,setCustomerNameAndCode] = useState(""); |
|
|
|
|
|
|
|
const fetchData = async () => { |
|
|
|
const clientprojects = await fetchAllClientProjects(); |
|
|
|
for (let i = 0; i < clientprojects.length; i++) { |
|
|
|
if (customerId != null && clientprojects[i].customerId == parseInt(customerId)){ |
|
|
|
setCustomerNameAndCode(t("Selected Client") + ": " + clientprojects[i].customerName + " (" + clientprojects[i].customerCode + ")") |
|
|
|
} |
|
|
|
} |
|
|
|
if (customerId && subsidiaryId) { |
|
|
|
try { |
|
|
|
if (subsidiaryId === '-'){ |
|
|
@@ -112,6 +119,7 @@ const ProgressByClient: React.FC<Props> = () => { |
|
|
|
Number(subsidiaryId)) |
|
|
|
console.log(clickResult) |
|
|
|
setClientSubsidiaryProjectResult(clickResult); |
|
|
|
setFilteredClientSubsidiaryProjectResult(clickResult); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -123,6 +131,7 @@ const ProgressByClient: React.FC<Props> = () => { |
|
|
|
const clickResult = await fetchAllClientSubsidiaryProjects( |
|
|
|
Number(customerId),tableSorting) |
|
|
|
setClientSubsidiaryProjectResult(clickResult); |
|
|
|
setFilteredClientSubsidiaryProjectResult(clickResult); |
|
|
|
} catch (error) { |
|
|
|
console.error('Error fetching client subsidiary projects:', error); |
|
|
|
} |
|
|
@@ -594,6 +603,15 @@ const ProgressByClient: React.FC<Props> = () => { |
|
|
|
<Grid item sm> |
|
|
|
{/* <CustomSearchForm applySearch={applySearch} fields={InputFields}/> */} |
|
|
|
{/* <CustomDatagrid rows={rows} columns={columns} columnWidth={200} dataGridHeight={300}/> */} |
|
|
|
{customerNameAndCode !== "" && ( |
|
|
|
<div style={{ display: "inline-block", width: "99%" }}> |
|
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
|
<Card> |
|
|
|
<CardHeader className="text-slate-700" title= {customerNameAndCode} /> |
|
|
|
</Card> |
|
|
|
</Grid> |
|
|
|
</div> |
|
|
|
)} |
|
|
|
<div style={{ display: "inline-block", width: "70%" }}> |
|
|
|
<Grid item xs={12} md={12} lg={12}> |
|
|
|
<Card> |
|
|
|