From a225a9ee1f2085d9d13fdcaa638cdf301429c304 Mon Sep 17 00:00:00 2001 From: "MSI\\User" Date: Wed, 28 Aug 2024 14:35:00 +0800 Subject: [PATCH] update --- src/app/api/clientprojects/actions.ts | 4 ++++ .../NavigationContent/NavigationContent.tsx | 16 +++++++++++----- .../ProgressByClient/ProgressByClient.tsx | 8 ++++++++ .../ProjectFinancialSummary.tsx | 2 +- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/app/api/clientprojects/actions.ts b/src/app/api/clientprojects/actions.ts index 3b7af13..b3980df 100644 --- a/src/app/api/clientprojects/actions.ts +++ b/src/app/api/clientprojects/actions.ts @@ -23,6 +23,10 @@ export interface ClientSubsidiaryProjectResult { export const fetchAllClientSubsidiaryProjects = cache(async (customerId: number, tableSorting:string, subsidiaryId?: number) => { if (subsidiaryId === 0){ + return serverFetchJson( + `${BASE_API_URL}/dashboard/searchCustomerSubsidiaryProject?customerId=${customerId}&subsidiaryId=${subsidiaryId}&tableSorting=${tableSorting}` + ); + } else if (subsidiaryId === undefined) { return serverFetchJson( `${BASE_API_URL}/dashboard/searchCustomerSubsidiaryProject?customerId=${customerId}&tableSorting=${tableSorting}` ); diff --git a/src/components/NavigationContent/NavigationContent.tsx b/src/components/NavigationContent/NavigationContent.tsx index 84709f8..72df45d 100644 --- a/src/components/NavigationContent/NavigationContent.tsx +++ b/src/components/NavigationContent/NavigationContent.tsx @@ -117,11 +117,11 @@ const NavigationContent: React.FC = ({ abilities, username }) => { abilities!.includes(ability), ), children: [ - { - icon: , - label: "Financial Summary", - path: "/dashboard/ProjectFinancialSummary", - }, + // { + // icon: , + // label: "Financial Summary", + // path: "/dashboard/ProjectFinancialSummary", + // }, { icon: , label: "Company / Team Cash Flow", @@ -162,6 +162,12 @@ const NavigationContent: React.FC = ({ abilities, username }) => { }, ], }, + { + icon: , + label: "Financial Summary", + path: "/dashboard/ProjectFinancialSummary", + showOnMobile: true, + }, // No Claim function in Breaur, will be implement later // { // icon: , diff --git a/src/components/ProgressByClient/ProgressByClient.tsx b/src/components/ProgressByClient/ProgressByClient.tsx index ed6d118..3c9f3c0 100644 --- a/src/components/ProgressByClient/ProgressByClient.tsx +++ b/src/components/ProgressByClient/ProgressByClient.tsx @@ -110,6 +110,14 @@ const ProgressByClient: React.FC = () => { } + } catch (error) { + console.error('Error fetching client subsidiary projects:', error); + } + } else if (customerId) { + try { + const clickResult = await fetchAllClientSubsidiaryProjects( + Number(customerId),tableSorting) + setClientSubsidiaryProjectResult(clickResult); } catch (error) { console.error('Error fetching client subsidiary projects:', error); } diff --git a/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx b/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx index c529e69..aea6a8c 100644 --- a/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx +++ b/src/components/ProjectFinancialSummary/ProjectFinancialSummary.tsx @@ -118,7 +118,7 @@ const ProjectFinancialSummary: React.FC = () => {
{ - router.push(`/dashboard/ProjectStatusByClient?customerId=${params.row.id}&subsidiaryId=-`); + router.push(`/dashboard/ProjectStatusByClient?customerId=${params.row.id}`); }} > {params.value}