-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dd8cf90
commit a1982aa
Showing
6 changed files
with
147 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,33 +24,34 @@ import InstagramIcon from "@mui/icons-material/Instagram"; | |
|
||
// Material Dashboard 2 React components | ||
import MDBox from "components/MDBox"; | ||
import MDTypography from "components/MDTypography"; | ||
// import MDTypography from "components/MDTypography"; | ||
|
||
// Material Dashboard 2 React example components | ||
import DashboardLayout from "examples/LayoutContainers/DashboardLayout"; | ||
import DashboardNavbar from "examples/Navbars/DashboardNavbar"; | ||
import Footer from "examples/Footer"; | ||
import ProfileInfoCard from "examples/Cards/InfoCards/ProfileInfoCard"; | ||
import ProfilesList from "examples/Lists/ProfilesList"; | ||
import DefaultProjectCard from "examples/Cards/ProjectCards/DefaultProjectCard"; | ||
// import ProfilesList from "examples/Lists/ProfilesList"; | ||
// import DefaultProjectCard from "examples/Cards/ProjectCards/DefaultProjectCard"; | ||
|
||
// Overview page components | ||
import Header from "layouts/profile/components/Header"; | ||
// import PlatformSettings from "layouts/profile/components/PlatformSettings"; | ||
|
||
// Data | ||
import profilesListData from "layouts/profile/data/profilesListData"; | ||
// import profilesListData from "layouts/profile/data/profilesListData"; | ||
|
||
// Images | ||
import homeDecor1 from "assets/images/home-decor-1.jpg"; | ||
import homeDecor2 from "assets/images/home-decor-2.jpg"; | ||
import homeDecor3 from "assets/images/home-decor-3.jpg"; | ||
import homeDecor4 from "assets/images/home-decor-4.jpeg"; | ||
import team1 from "assets/images/team-1.jpg"; | ||
import team2 from "assets/images/team-2.jpg"; | ||
import team3 from "assets/images/team-3.jpg"; | ||
import team4 from "assets/images/team-4.jpg"; | ||
// import homeDecor1 from "assets/images/home-decor-1.jpg"; | ||
// import homeDecor2 from "assets/images/home-decor-2.jpg"; | ||
// import homeDecor3 from "assets/images/home-decor-3.jpg"; | ||
// import homeDecor4 from "assets/images/home-decor-4.jpeg"; | ||
// import team1 from "assets/images/team-1.jpg"; | ||
// import team2 from "assets/images/team-2.jpg"; | ||
// import team3 from "assets/images/team-3.jpg"; | ||
// import team4 from "assets/images/team-4.jpg"; | ||
import { useUser } from "utils/userContext"; | ||
import ReportView from "layouts/reports/reportView"; | ||
|
||
function Overview() { | ||
const { user } = useUser(); | ||
|
@@ -68,14 +69,15 @@ function Overview() { | |
<Divider orientation="vertical" sx={{ ml: -2, mr: 1 }} /> | ||
<ProfileInfoCard | ||
title="profile information" | ||
description="Hi, I’m Alec Thompson, Decisions: If you can’t decide, the answer is no. If two equally difficult paths, choose the one more painful in the short term (pain avoidance is creating an illusion of equality)." | ||
description="Hi, I’m _____________, Decisions: If you can’t decide, the answer is no. If two equally difficult paths, choose the one more painful in the short term (pain avoidance is creating an illusion of equality)." | ||
info={{ | ||
// fullName: "Alec M. Thompson", | ||
fullName: user.full_name, | ||
// mobile: "(44) 123 1234 123", | ||
mobile: user.phone_Number, | ||
// email: "[email protected]", | ||
email: user.email, | ||
profession: user.profession, | ||
location: "Sri Lanka", | ||
}} | ||
social={[ | ||
|
@@ -98,24 +100,25 @@ function Overview() { | |
action={{ route: "", tooltip: "Edit Profile" }} | ||
shadow={false} | ||
/> | ||
<Divider orientation="vertical" sx={{ mx: 0 }} /> | ||
{/* <Divider orientation="vertical" sx={{ mx: 0 }} /> */} | ||
</Grid> | ||
<Grid item xs={12} xl={4}> | ||
{/* <Grid item xs={12} xl={4}> | ||
<ProfilesList title="conversations" profiles={profilesListData} shadow={false} /> | ||
</Grid> | ||
</Grid> */} | ||
</Grid> | ||
</MDBox> | ||
<MDBox pt={2} px={2} lineHeight={1.25}> | ||
{/* <MDBox pt={2} px={2} lineHeight={1.25}> | ||
<MDTypography variant="h6" fontWeight="medium"> | ||
Projects | ||
Reports | ||
</MDTypography> | ||
<MDBox mb={1}> | ||
<MDTypography variant="button" color="text"> | ||
Architects design houses | ||
Generated by me | ||
</MDTypography> | ||
</MDBox> | ||
</MDBox> | ||
<MDBox p={2}> | ||
</MDBox> */} | ||
<ReportView /> | ||
{/* <MDBox p={2}> | ||
<Grid container spacing={6}> | ||
<Grid item xs={12} md={6} xl={3}> | ||
<DefaultProjectCard | ||
|
@@ -198,7 +201,7 @@ function Overview() { | |
/> | ||
</Grid> | ||
</Grid> | ||
</MDBox> | ||
</MDBox> */} | ||
</Header> | ||
<Footer /> | ||
</DashboardLayout> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,102 @@ | ||
import React, { useState } from "react"; | ||
import { getReportPdf } from "api/report/getReports"; // Import the getReportPdf function | ||
import DashboardLayout from "examples/LayoutContainers/DashboardLayout"; | ||
import DashboardNavbar from "examples/Navbars/DashboardNavbar"; | ||
import Footer from "examples/Footer"; | ||
|
||
// Define a component that allows you to enter a report ID and view the report | ||
function ReportViewer() { | ||
const [reportId, setReportId] = useState(""); | ||
const [viewReportError, setViewReportError] = useState(null); | ||
|
||
const handleViewReport = async () => { | ||
try { | ||
if (reportId) { | ||
// Call the getReportPdf function to fetch and display the report | ||
await getReportPdf(reportId); | ||
setViewReportError(null); | ||
} else { | ||
setViewReportError("Please enter a valid report ID."); | ||
} | ||
} catch (error) { | ||
console.error("Error viewing report:", error); | ||
setViewReportError("An error occurred while viewing the report."); | ||
} | ||
}; | ||
// import React, { useState } from "react"; | ||
// import { getReportPdf } from "api/report/getReports"; // Import the getReportPdf function | ||
// import DashboardLayout from "examples/LayoutContainers/DashboardLayout"; | ||
// import DashboardNavbar from "examples/Navbars/DashboardNavbar"; | ||
// import Footer from "examples/Footer"; | ||
|
||
// // Define a component that allows you to enter a report ID and view the report | ||
// function ReportViewer() { | ||
// const [reportId, setReportId] = useState(""); | ||
// const [viewReportError, setViewReportError] = useState(null); | ||
|
||
// const handleViewReport = async () => { | ||
// try { | ||
// if (reportId) { | ||
// // Call the getReportPdf function to fetch and display the report | ||
// await getReportPdf(reportId); | ||
// setViewReportError(null); | ||
// } else { | ||
// setViewReportError("Please enter a valid report ID."); | ||
// } | ||
// } catch (error) { | ||
// console.error("Error viewing report:", error); | ||
// setViewReportError("An error occurred while viewing the report."); | ||
// } | ||
// }; | ||
|
||
// return ( | ||
// <div> | ||
// <DashboardLayout> | ||
// <DashboardNavbar/> | ||
// <h2>View Report by ID</h2> | ||
// <div> | ||
// <label htmlFor="reportId">Report ID:</label> | ||
// <input | ||
// type="text" | ||
// id="reportId" | ||
// value={reportId} | ||
// onChange={(e) => setReportId(e.target.value)} | ||
// /> | ||
// <button onClick={handleViewReport}>View Report</button> | ||
// </div> | ||
// {viewReportError && <p>{viewReportError}</p>} | ||
// <Footer/> | ||
// </DashboardLayout> | ||
// </div> | ||
// ); | ||
// } | ||
|
||
// export default ReportViewer; | ||
import React from "react"; | ||
import Grid from "@mui/material/Grid"; | ||
import Card from "@mui/material/Card"; | ||
|
||
// Material Dashboard 2 React components | ||
import MDBox from "components/MDBox"; | ||
import MDTypography from "components/MDTypography"; | ||
|
||
import DataTable from "examples/Tables/DataTable"; | ||
|
||
import data from "./data/reportsdata"; | ||
// import MDButton from "components/MDButton"; | ||
// import { generateExcel } from "./reports"; | ||
// import { CSVLink } from "react-csv"; | ||
|
||
function ReportView() { | ||
const { columns, rows } = data(); | ||
return ( | ||
<div> | ||
<DashboardLayout> | ||
<DashboardNavbar /> | ||
<h2>View Report by ID</h2> | ||
<div> | ||
<label htmlFor="reportId">Report ID:</label> | ||
<input | ||
type="text" | ||
id="reportId" | ||
value={reportId} | ||
onChange={(e) => setReportId(e.target.value)} | ||
/> | ||
<button onClick={handleViewReport}>View Report</button> | ||
</div> | ||
{viewReportError && <p>{viewReportError}</p>} | ||
<Footer /> | ||
</DashboardLayout> | ||
</div> | ||
<MDBox pt={6} pb={3}> | ||
<Grid container spacing={6}> | ||
<Grid item xs={12}> | ||
<Card> | ||
<MDBox | ||
mx={2} | ||
mt={-3} | ||
py={3} | ||
px={2} | ||
variant="gradient" | ||
bgColor="info" | ||
borderRadius="lg" | ||
coloredShadow="info" | ||
> | ||
<MDTypography variant="h6" color="white"> | ||
Reports History | ||
</MDTypography> | ||
</MDBox> | ||
<MDBox pt={3}> | ||
<DataTable | ||
table={{ columns, rows }} | ||
isSorted={false} | ||
entriesPerPage={false} | ||
showTotalEntries={false} | ||
noEndBorder | ||
/> | ||
</MDBox> | ||
</Card> | ||
</Grid> | ||
</Grid> | ||
</MDBox> | ||
); | ||
} | ||
|
||
export default ReportViewer; | ||
export default ReportView; |