| @@ -23,6 +23,10 @@ export interface ClientSubsidiaryProjectResult { | |||||
| export const fetchAllClientSubsidiaryProjects = cache(async (customerId: number, tableSorting:string, subsidiaryId?: number) => { | export const fetchAllClientSubsidiaryProjects = cache(async (customerId: number, tableSorting:string, subsidiaryId?: number) => { | ||||
| if (subsidiaryId === 0){ | if (subsidiaryId === 0){ | ||||
| return serverFetchJson<ClientSubsidiaryProjectResult[]>( | |||||
| `${BASE_API_URL}/dashboard/searchCustomerSubsidiaryProject?customerId=${customerId}&subsidiaryId=${subsidiaryId}&tableSorting=${tableSorting}` | |||||
| ); | |||||
| } else if (subsidiaryId === undefined) { | |||||
| return serverFetchJson<ClientSubsidiaryProjectResult[]>( | return serverFetchJson<ClientSubsidiaryProjectResult[]>( | ||||
| `${BASE_API_URL}/dashboard/searchCustomerSubsidiaryProject?customerId=${customerId}&tableSorting=${tableSorting}` | `${BASE_API_URL}/dashboard/searchCustomerSubsidiaryProject?customerId=${customerId}&tableSorting=${tableSorting}` | ||||
| ); | ); | ||||
| @@ -117,11 +117,11 @@ const NavigationContent: React.FC<Props> = ({ abilities, username }) => { | |||||
| abilities!.includes(ability), | abilities!.includes(ability), | ||||
| ), | ), | ||||
| children: [ | children: [ | ||||
| { | |||||
| icon: <SummarizeIcon />, | |||||
| label: "Financial Summary", | |||||
| path: "/dashboard/ProjectFinancialSummary", | |||||
| }, | |||||
| // { | |||||
| // icon: <SummarizeIcon />, | |||||
| // label: "Financial Summary", | |||||
| // path: "/dashboard/ProjectFinancialSummary", | |||||
| // }, | |||||
| { | { | ||||
| icon: <PaymentsIcon />, | icon: <PaymentsIcon />, | ||||
| label: "Company / Team Cash Flow", | label: "Company / Team Cash Flow", | ||||
| @@ -162,6 +162,12 @@ const NavigationContent: React.FC<Props> = ({ abilities, username }) => { | |||||
| }, | }, | ||||
| ], | ], | ||||
| }, | }, | ||||
| { | |||||
| icon: <SummarizeIcon />, | |||||
| label: "Financial Summary", | |||||
| path: "/dashboard/ProjectFinancialSummary", | |||||
| showOnMobile: true, | |||||
| }, | |||||
| // No Claim function in Breaur, will be implement later | // No Claim function in Breaur, will be implement later | ||||
| // { | // { | ||||
| // icon: <RequestQuote />, | // icon: <RequestQuote />, | ||||
| @@ -110,6 +110,14 @@ const ProgressByClient: React.FC<Props> = () => { | |||||
| } | } | ||||
| } 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) { | } catch (error) { | ||||
| console.error('Error fetching client subsidiary projects:', error); | console.error('Error fetching client subsidiary projects:', error); | ||||
| } | } | ||||
| @@ -118,7 +118,7 @@ const ProjectFinancialSummary: React.FC = () => { | |||||
| <div | <div | ||||
| className="text-blue-600 hover:underline cursor-pointer" | className="text-blue-600 hover:underline cursor-pointer" | ||||
| onClick={() => { | onClick={() => { | ||||
| router.push(`/dashboard/ProjectStatusByClient?customerId=${params.row.id}&subsidiaryId=-`); | |||||
| router.push(`/dashboard/ProjectStatusByClient?customerId=${params.row.id}`); | |||||
| }} | }} | ||||
| > | > | ||||
| {params.value} | {params.value} | ||||