Skip to content

Commit

Permalink
update dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Chanuka-ChandraYapa committed Sep 12, 2023
1 parent dd8cf90 commit a1982aa
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 90 deletions.
17 changes: 14 additions & 3 deletions src/examples/Navbars/DashboardNavbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ function DashboardNavbar({ absolute, light, isMini }) {
return colorValue;
},
});
const [isVisible, setIsVisible] = useState(true);

useEffect(() => {
const timeout = setTimeout(() => {
setIsVisible(false);
}, 10000);

return () => clearTimeout(timeout);
}, []);

return (
<AppBar
Expand All @@ -135,9 +144,11 @@ function DashboardNavbar({ absolute, light, isMini }) {
<Toolbar sx={(theme) => navbarContainer(theme)}>
<MDBox color="inherit" mb={{ xs: 1, md: 0 }} sx={(theme) => navbarRow(theme, { isMini })}>
<Breadcrumbs icon="home" title={route[route.length - 1]} route={route} light={light} />
<MDTypography variant="h6" fontWeight="medium">
Welcome {user?.name}
</MDTypography>
{isVisible && (
<MDTypography variant="h6" fontWeight="medium">
Welcome {user?.name}
</MDTypography>
)}
</MDBox>
{isMini ? null : (
<MDBox sx={(theme) => navbarRow(theme, { isMini })}>
Expand Down
14 changes: 2 additions & 12 deletions src/layouts/authentication/sign-in/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,23 +199,13 @@ function Basic() {
textAlign="center"
>
<MDTypography variant="h4" fontWeight="medium" color="white" mt={1}>
Join us today
Welcome Back
</MDTypography>
<MDTypography display="block" variant="button" color="white" my={1}>
Enter your email and password to register
Enter your email and password to log in
</MDTypography>
</MDBox>
<MDBox pt={4} pb={3} px={3}>
<MDTypography
textAlign="center"
variant="h4"
fontWeight="medium"
color="black"
mt={1}
mb={5}
>
Hi Welcome Back!
</MDTypography>
<MDBox component="form" role="form">
<MDBox mb={2}>
<MDInput
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/authentication/sign-up/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import MDButton from "components/MDButton";
import MDAlert from "components/MDAlert";

// Authentication layout components
import CoverLayout from "layouts/authentication/components/CoverLayout";
import BasicLayout from "../components/BasicLayout";

// Images
import bgImage from "assets/images/bg-sign-up-cover.jpeg";
Expand Down Expand Up @@ -93,7 +93,7 @@ function Cover() {
};

return (
<CoverLayout image={bgImage}>
<BasicLayout image={bgImage}>
{showSuccessAlert && (
<MDAlert color="success" dismissible>
Registration Successful!
Expand All @@ -115,7 +115,7 @@ function Cover() {
Join us today
</MDTypography>
<MDTypography display="block" variant="button" color="white" my={1}>
Enter your email and password to register
Enter your credentials to register
</MDTypography>
</MDBox>
<MDBox pt={4} pb={3} px={3}>
Expand Down Expand Up @@ -210,7 +210,7 @@ function Cover() {
}}
/>
)}
</CoverLayout>
</BasicLayout>
);
}

Expand Down
10 changes: 5 additions & 5 deletions src/layouts/landing/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import React from "react";
import Hero from "./Page/Hero";
import Snippets from "./Page/Snippets";
import Access from "./Page/Access";
import Supercharge from "./Page/Supercharge";
import Agents from "./Page/Agents";
import Action from "./Page/Action";
// import Supercharge from "./Page/Supercharge";
// import Agents from "./Page/Agents";
// import Action from "./Page/Action";
// import Footer from "./Page/Footer";
import "./index.css";
// import DashboardLayout from "examples/LayoutContainers/DashboardLayout";
Expand All @@ -17,9 +17,9 @@ function App() {
<Hero />
<Snippets />
<Access />
<Supercharge />
{/* <Supercharge />
<Agents />
<Action />
<Action /> */}
</main>

{/* <Footer className="footer" /> */}
Expand Down
47 changes: 25 additions & 22 deletions src/layouts/profile/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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={[
Expand All @@ -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
Expand Down Expand Up @@ -198,7 +201,7 @@ function Overview() {
/>
</Grid>
</Grid>
</MDBox>
</MDBox> */}
</Header>
<Footer />
</DashboardLayout>
Expand Down
141 changes: 97 additions & 44 deletions src/layouts/reports/reportView.js
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;

0 comments on commit a1982aa

Please sign in to comment.