Skip to content

Commit

Permalink
Updated My Project grid headings and cell formats
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Nov 29, 2023
1 parent 58e8d0d commit 4dca5e0
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 65 deletions.
10 changes: 4 additions & 6 deletions client/src/components/PdfPrint/PdfPrint.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@ import logo from "../../images/ladot.png";

const useStyles = createUseStyles({
Pdf: {
display: "flex",
flexDirection: "column",
flex: "1 1 auto",
minWidth: "85vw",
margin: "50px auto"
margin: "1em !important",
padding: "0 !important",
overflow: "hidden"
},
rule: {
display: "flex",
Expand Down Expand Up @@ -148,7 +146,7 @@ export const PdfPrint = forwardRef((props, ref) => {
);

return (
<div ref={ref} className={clsx("tdm-wizard-review-page", classes.Pdf)}>
<div ref={ref} className={classes.Pdf}>
<h1>
<img
className={classes.logo}
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/ProjectWizard/WizardFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const WizardFooter = ({
}) => {
const classes = useStyles();
const componentRef = useRef();
const projectName = rules
? rules.find(r => r.code === "PROJECT_NAME").value
: "TDM Calculation Summary";

return (
<>
Expand Down Expand Up @@ -83,6 +86,9 @@ const WizardFooter = ({
/>
)}
content={() => componentRef.current}
documentTitle={projectName}
bodyClass="printContainer"
pageStyle=".printContainer {overflow: hidden;}"
/>
<div style={{ display: "none" }}>
<PdfPrint
Expand Down
10 changes: 5 additions & 5 deletions client/src/components/Projects/ProjectContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const ProjectContextMenu = ({
className={classes.listItemIcon}
alt={`Print Project #${project.id} Icon`}
/>
Print
Print Summary
</li>
<li
onClick={() => handleClick(handleDownloadCsv)}
Expand Down Expand Up @@ -138,18 +138,18 @@ const ProjectContextMenu = ({
<FontAwesomeIcon
icon={faTrash}
className={classes.listItemIcon}
alt={`Remove Project #${project.id} from Trash Icon`}
alt={`Restore Project from Trash Icon`}
/>
Remove from Trash
Restore from Trash
</>
) : (
<>
<FontAwesomeIcon
icon={faTrash}
className={classes.listItemIcon}
alt={`Move Project #${project.id} to Trash Icon`}
alt={`Delete Project Icon`}
/>
Move to Trash
Delete
</>
)}
</li>
Expand Down
82 changes: 46 additions & 36 deletions client/src/components/Projects/ProjectTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import Popup from "reactjs-popup";
import "reactjs-popup/dist/index.css";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faCamera,
faTrash,
faEye,
faEyeSlash,
faEllipsisV
} from "@fortawesome/free-solid-svg-icons";
Expand All @@ -29,6 +28,10 @@ const useStyles = createUseStyles({
padding: "0.2em",
textAlign: "right"
},
tdCenterAlign: {
padding: "0.2em",
textAlign: "center"
},
actionIcons: {
display: "flex",
justifyContent: "space-around",
Expand Down Expand Up @@ -118,15 +121,51 @@ const ProjectTableRow = ({
};

const handlePrintPdf = useReactToPrint({
content: () => printRef.current
content: () => printRef.current,
bodyClass: "printContainer",
pageStyle: ".printContainer {overflow: hidden;}"
});

const fallbackToBlank = value => {
return value !== "undefined" ? value : "";
};

// Last Modified Date column should display the Last Modified date, unless the project is
// deleted, in which case it will show the deleted date followed by "-Deleted" in red.
const dateModifiedDisplay = () => {
if (project.dateTrashed) {
return (
<span>
{moment(project.dateTrashed).format("YYYY-MM-DD")}
<span style={{ color: "red" }}>-Deleted</span>
</span>
);
}
return <span>{moment(project.dateModified).format("YYYY-MM-DD")}</span>;
};

return (
<tr key={project.id}>
<td className={classes.tdCenterAlign}>
{project.dateHidden ? (
<FontAwesomeIcon
icon={faEyeSlash}
alt={`Project Is Hidden`}
title={`Project is hidden`}
style={{ width: "2em" }}
/>
) : (
<FontAwesomeIcon
icon={faEye}
alt={`Project Is Visible`}
title={`Project is visible`}
style={{ width: "2em" }}
/>
)}
</td>
<td className={classes.td}>
{project.dateSnapshotted ? "Snapshot" : "Draft"}
</td>
<td className={classes.td}>
<Link to={`/calculation/1/${project.id}`}>{project.name}</Link>
</td>
Expand All @@ -139,40 +178,11 @@ const ProjectTableRow = ({
className={classes.td}
>{`${project.firstName} ${project.lastName}`}</td>
<td className={classes.tdRightAlign}>
{moment(project.dateCreated).format("MM/DD/YYYY")}
</td>
<td className={classes.tdRightAlign}>
{momentModified.isSame(moment(), "day")
? momentModified.format("h:mm A")
: momentModified.format("MM/DD/YYYY")}
</td>
<td className={classes.tdRightAlign}>
{project.dateHidden && (
<FontAwesomeIcon
icon={faEyeSlash}
alt={`Project Is Hidden`}
title={`Project is hidden`}
/>
)}
</td>
<td className={classes.tdRightAlign}>
{project.dateTrashed && (
<FontAwesomeIcon
icon={faTrash}
alt={`Project Is In Trash`}
title={`Project is in trash`}
/>
)}
</td>
<td className={classes.tdRightAlign}>
{project.dateSnapshotted && (
<FontAwesomeIcon
icon={faCamera}
alt={`Project Is A Snapshot`}
title={`Project is a snapshot`}
/>
)}
{moment(project.dateCreated).format("YYYY-MM-DD")}
</td>

<td className={classes.td}>{dateModifiedDisplay()}</td>

<td className={classes.actionIcons}>
{projectData && (
<div>
Expand Down
30 changes: 12 additions & 18 deletions client/src/components/Projects/ProjectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import { useNavigate } from "react-router-dom";
import { createUseStyles } from "react-jss";
import moment from "moment";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faSortUp,
faSortDown,
faCamera,
faTrash,
faEye
} from "@fortawesome/free-solid-svg-icons";
import { faSortUp, faSortDown } from "@fortawesome/free-solid-svg-icons";
import SearchIcon from "../../images/search.png";

import Pagination from "../ProjectWizard/Pagination.js";
Expand Down Expand Up @@ -76,7 +70,7 @@ const useStyles = createUseStyles({
borderBottom: "1px solid #E7EBF0"
},
"& tr td": {
padding: "12px 18px",
padding: "12px",
verticalAlign: "middle"
},
"& tr:hover": {
Expand Down Expand Up @@ -319,6 +313,14 @@ const ProjectsPage = ({ account, contentContainerRef }) => {
};

const headerData = [
{
id: "dateHidden",
label: "Visibility"
},
{
id: "dateSnapshotted",
label: "Status"
},
{ id: "name", label: "Name" },
{ id: "address", label: "Address" },
{ id: "VERSION_NO", label: "Alternative Number" },
Expand All @@ -327,16 +329,8 @@ const ProjectsPage = ({ account, contentContainerRef }) => {
{ id: "dateCreated", label: "Created On" },
{ id: "dateModified", label: "Last Modified" },
{
id: "dateHidden",
label: <FontAwesomeIcon icon={faEye} alt={`Project Is Hidden`} />
},
{
id: "dateTrashed",
label: <FontAwesomeIcon icon={faTrash} alt={`Project Is In Trash`} />
},
{
id: "dateSnapshotted",
label: <FontAwesomeIcon icon={faCamera} alt={`Project Is a Snapshot`} />
id: "contextMenu",
label: ""
}
];

Expand Down

0 comments on commit 4dca5e0

Please sign in to comment.