diff --git a/src/app/(main)/analytics/EX02ProjectCashFlowReport/page.tsx b/src/app/(main)/analytics/ProjectCashFlowReport/page.tsx similarity index 62% rename from src/app/(main)/analytics/EX02ProjectCashFlowReport/page.tsx rename to src/app/(main)/analytics/ProjectCashFlowReport/page.tsx index d1d54d8..301ef12 100644 --- a/src/app/(main)/analytics/EX02ProjectCashFlowReport/page.tsx +++ b/src/app/(main)/analytics/ProjectCashFlowReport/page.tsx @@ -2,10 +2,10 @@ import { Metadata } from "next"; import { Suspense } from "react"; import { I18nProvider } from "@/i18n"; import { fetchProjects } from "@/app/api/projects"; -import GenerateEX02ProjectCashFlowReport from "@/components/GenerateEX02ProjectCashFlowReport"; +import GenerateProjectCashFlowReport from "@/components/GenerateProjectCashFlowReport"; export const metadata: Metadata = { - title: "EX02 - Project Cash Flow Report", + title: "Project Cash Flow Report", }; const ProjectCashFlowReport: React.FC = async () => { @@ -14,8 +14,8 @@ const ProjectCashFlowReport: React.FC = async () => { return ( <> - }> - + }> + diff --git a/src/app/api/reports/actions.ts b/src/app/api/reports/actions.ts index be74c6f..8f38af3 100644 --- a/src/app/api/reports/actions.ts +++ b/src/app/api/reports/actions.ts @@ -1,7 +1,7 @@ "use server"; import { serverFetchBlob, serverFetchJson } from "@/app/utils/fetchUtil"; -import { EX02ProjectCashFlowReportRequest } from "."; +import { ProjectCashFlowReportRequest } from "."; import { BASE_API_URL } from "@/config/api"; export interface FileResponse { @@ -9,9 +9,9 @@ export interface FileResponse { blobValue: Uint8Array; } -export const fetchEX02ProjectCashFlowReport = async (data: EX02ProjectCashFlowReportRequest) => { +export const fetchProjectCashFlowReport = async (data: ProjectCashFlowReportRequest) => { const reportBlob = await serverFetchBlob( - `${BASE_API_URL}/reports/EX02-ProjectCashFlowReport`, + `${BASE_API_URL}/reports/ProjectCashFlowReport`, { method: "POST", body: JSON.stringify(data), diff --git a/src/app/api/reports/index.ts b/src/app/api/reports/index.ts index 6baa7aa..9ab8f36 100644 --- a/src/app/api/reports/index.ts +++ b/src/app/api/reports/index.ts @@ -1,8 +1,8 @@ -// EX02 - Project Cash Flow Report -export interface EX02ProjectCashFlowReportFilter { +// - Project Cash Flow Report +export interface ProjectCashFlowReportFilter { project: string[]; } -export interface EX02ProjectCashFlowReportRequest { +export interface ProjectCashFlowReportRequest { projectId: number; } \ No newline at end of file diff --git a/src/components/Breadcrumb/Breadcrumb.tsx b/src/components/Breadcrumb/Breadcrumb.tsx index a94670a..72e8b35 100644 --- a/src/components/Breadcrumb/Breadcrumb.tsx +++ b/src/components/Breadcrumb/Breadcrumb.tsx @@ -29,7 +29,7 @@ const pathToLabelMap: { [path: string]: string } = { "/settings/position": "Position", "/settings/position/new": "Create Position", "/settings/salarys": "Salary", - "/analytics/EX02ProjectCashFlowReport": "EX02 - Project Cash Flow Report", + "/analytics/ProjectCashFlowReport": "Project Cash Flow Report", }; const Breadcrumb = () => { diff --git a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportWrapper.tsx b/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportWrapper.tsx deleted file mode 100644 index 5bf1089..0000000 --- a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportWrapper.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import React from "react"; -import GenerateEX02ProjectCashFlowReportLoading from "./GenerateEX02ProjectCashFlowReportLoading"; -import { fetchProjects } from "@/app/api/projects"; -import GenerateEX02ProjectCashFlowReport from "./GenerateEX02ProjectCashFlowReport"; - -interface SubComponents { - Loading: typeof GenerateEX02ProjectCashFlowReportLoading; -} - -const GenerateEX02ProjectCashFlowReportWrapper: React.FC & SubComponents = async () => { - const projects = await fetchProjects(); - - return ; -}; - -GenerateEX02ProjectCashFlowReportWrapper.Loading = GenerateEX02ProjectCashFlowReportLoading; - -export default GenerateEX02ProjectCashFlowReportWrapper; \ No newline at end of file diff --git a/src/components/GenerateEX02ProjectCashFlowReport/index.ts b/src/components/GenerateEX02ProjectCashFlowReport/index.ts deleted file mode 100644 index b547e33..0000000 --- a/src/components/GenerateEX02ProjectCashFlowReport/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from "./GenerateEX02ProjectCashFlowReportWrapper"; \ No newline at end of file diff --git a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReport.tsx b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReport.tsx similarity index 77% rename from src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReport.tsx rename to src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReport.tsx index 7aec1c2..0b7d661 100644 --- a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReport.tsx +++ b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReport.tsx @@ -4,8 +4,8 @@ import React, { useMemo } from "react"; import SearchBox, { Criterion } from "../SearchBox"; import { useTranslation } from "react-i18next"; import { ProjectResult } from "@/app/api/projects"; -import { EX02ProjectCashFlowReportFilter } from "@/app/api/reports"; -import { fetchEX02ProjectCashFlowReport } from "@/app/api/reports/actions"; +import { ProjectCashFlowReportFilter } from "@/app/api/reports"; +import { fetchProjectCashFlowReport } from "@/app/api/reports/actions"; import { downloadFile } from "@/app/utils/commonUtil"; import { BASE_API_URL } from "@/config/api"; @@ -13,10 +13,10 @@ interface Props { projects: ProjectResult[]; } -type SearchQuery = Partial>; +type SearchQuery = Partial>; type SearchParamNames = keyof SearchQuery; -const GenerateEX02ProjectCashFlowReport: React.FC = ({ projects }) => { +const GenerateProjectCashFlowReport: React.FC = ({ projects }) => { const { t } = useTranslation(); const projectCombo = projects.map(project => `${project.code} - ${project.name}`) @@ -35,7 +35,7 @@ const GenerateEX02ProjectCashFlowReport: React.FC = ({ projects }) => { if (query.project.length > 0 && query.project.toLocaleLowerCase() !== "all") { const projectIndex = projectCombo.findIndex(project => project === query.project) - const response = await fetchEX02ProjectCashFlowReport({ projectId: projects[projectIndex].id }) + const response = await fetchProjectCashFlowReport({ projectId: projects[projectIndex].id }) if (response) { downloadFile(new Uint8Array(response.blobValue), response.filename!!) } @@ -46,4 +46,4 @@ const GenerateEX02ProjectCashFlowReport: React.FC = ({ projects }) => { ); }; -export default GenerateEX02ProjectCashFlowReport; \ No newline at end of file +export default GenerateProjectCashFlowReport; \ No newline at end of file diff --git a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportLoading.tsx b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportLoading.tsx similarity index 90% rename from src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportLoading.tsx rename to src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportLoading.tsx index 1792221..98514e0 100644 --- a/src/components/GenerateEX02ProjectCashFlowReport/GenerateEX02ProjectCashFlowReportLoading.tsx +++ b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportLoading.tsx @@ -5,7 +5,7 @@ import Stack from "@mui/material/Stack"; import React from "react"; // Can make this nicer -export const GenerateEX02ProjectCashFlowReportLoading: React.FC = () => { +export const GenerateProjectCashFlowReportLoading: React.FC = () => { return ( <> @@ -35,4 +35,4 @@ export const GenerateEX02ProjectCashFlowReportLoading: React.FC = () => { ); }; -export default GenerateEX02ProjectCashFlowReportLoading; \ No newline at end of file +export default GenerateProjectCashFlowReportLoading; \ No newline at end of file diff --git a/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportWrapper.tsx b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportWrapper.tsx new file mode 100644 index 0000000..218f43e --- /dev/null +++ b/src/components/GenerateProjectCashFlowReport/GenerateProjectCashFlowReportWrapper.tsx @@ -0,0 +1,18 @@ +import React from "react"; +import GenerateProjectCashFlowReportLoading from "./GenerateProjectCashFlowReportLoading"; +import { fetchProjects } from "@/app/api/projects"; +import GenerateProjectCashFlowReport from "./GenerateProjectCashFlowReport"; + +interface SubComponents { + Loading: typeof GenerateProjectCashFlowReportLoading; +} + +const GenerateProjectCashFlowReportWrapper: React.FC & SubComponents = async () => { + const projects = await fetchProjects(); + + return ; +}; + +GenerateProjectCashFlowReportWrapper.Loading = GenerateProjectCashFlowReportLoading; + +export default GenerateProjectCashFlowReportWrapper; \ No newline at end of file diff --git a/src/components/GenerateProjectCashFlowReport/index.ts b/src/components/GenerateProjectCashFlowReport/index.ts new file mode 100644 index 0000000..5adef20 --- /dev/null +++ b/src/components/GenerateProjectCashFlowReport/index.ts @@ -0,0 +1 @@ +export { default } from "./GenerateProjectCashFlowReportWrapper"; \ No newline at end of file diff --git a/src/components/NavigationContent/NavigationContent.tsx b/src/components/NavigationContent/NavigationContent.tsx index 9f0c3d7..5d79f0f 100644 --- a/src/components/NavigationContent/NavigationContent.tsx +++ b/src/components/NavigationContent/NavigationContent.tsx @@ -118,7 +118,7 @@ const navigationItems: NavigationItem[] = [ {icon: , label:"Project Claims Report", path: "/analytics/ProjectClaimsReport"}, {icon: , label:"Project P&L Report", path: "/analytics/ProjectPLReport"}, {icon: , label:"Financial Status Report", path: "/analytics/FinancialStatusReport"}, - {icon: , label:"EX02 - Project Cash Flow Report", path: "/analytics/EX02ProjectCashFlowReport"}, + {icon: , label:"Project Cash Flow Report", path: "/analytics/ProjectCashFlowReport"}, ], }, {