Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web API Implementation for Submitting Projects #1753

Merged
merged 7 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions client/src/components/Button/SubmitButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from "react";
import PropTypes from "prop-types";
import Button from "../Button/Button";

const SubmitButton = ({ id, onClick, isDisabled, isDisplayed, color }) => {
return (
<>
<Button
type="input"
color={color}
onClick={onClick}
id={id}
data-testid={id}
disabled={isDisabled}
isDisplayed={isDisplayed}
>
SUBMIT
</Button>
</>
);
};

SubmitButton.propTypes = {
children: PropTypes.object,
onClick: PropTypes.func.isRequired,
id: PropTypes.string.isRequired,
color: PropTypes.string,
isDisabled: PropTypes.bool,
isDisplayed: PropTypes.bool.isRequired
};

export default SubmitButton;
4 changes: 4 additions & 0 deletions client/src/components/Feedback/ProjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const ProjectsList = ({ projects, setSelectedProjects, selectedProjects }) => {
<td className={classes.tableCell}>
{formatDatetime(project.dateModified)}
</td>
<td className={classes.tableCell}>
{formatDatetime(project.dateSubmitted)}
</td>
</tr>
))}
</tbody>
Expand All @@ -102,6 +105,7 @@ ProjectsList.propTypes = {
calculationId: PropTypes.number,
dateCreated: PropTypes.string,
dateModified: PropTypes.string,
dateSubmitted: PropTypes.string,
description: PropTypes.string,
firstName: PropTypes.string,
formInputs: PropTypes.string,
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/ProjectWizard/TdmCalculationWizard.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ const TdmCalculationWizard = props => {
return false;
};

const setDisplaySubmitButton = () => {
if (page === 5) {
return true;
}
return false;
};

const handleValidate = () => {
const { page } = params;
const validations = {
Expand Down Expand Up @@ -329,6 +336,7 @@ const TdmCalculationWizard = props => {
setDisabledSaveButton={setDisabledSaveButton}
setDisplaySaveButton={setDisplaySaveButton}
setDisplayPrintButton={setDisplayPrintButton}
setDisplaySubmitButton={setDisplaySubmitButton}
onSave={onSave}
project={project}
// dateModified={dateModified}
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/ProjectWizard/WizardFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useRef, useContext } from "react";
import PropTypes from "prop-types";
import NavButton from "../Button/NavButton";
import SaveButton from "../Button/SaveButton";
import SubmitButton from "../Button/SubmitButton";
import { createUseStyles } from "react-jss";
import PrintButton from "../Button/PrintButton";
import ReactToPrint from "react-to-print";
Expand Down Expand Up @@ -48,6 +49,7 @@ const WizardFooter = ({
setDisabledSaveButton,
setDisplaySaveButton,
setDisplayPrintButton,
setDisplaySubmitButton,
onSave,
project
}) => {
Expand Down Expand Up @@ -115,6 +117,11 @@ const WizardFooter = ({
isDisplayed={setDisplaySaveButton()}
onClick={onSave}
/>
<SubmitButton
id="submitButton"
color="colorPrimary"
isDisplayed={false && setDisplaySubmitButton()}
/>
</>
) : null}
</div>
Expand Down Expand Up @@ -163,6 +170,7 @@ WizardFooter.propTypes = {
setDisabledSaveButton: PropTypes.any,
setDisplaySaveButton: PropTypes.any,
setDisplayPrintButton: PropTypes.any,
setDisplaySubmitButton: PropTypes.any,
onSave: PropTypes.any,
onDownload: PropTypes.any,
project: PropTypes.shape
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/Projects/ProjectTableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ const ProjectTableRow = ({
return <span>{formatDate(project.dateModified)}</span>;
};

const dateSubmittedDisplay = () => {
if (project.dateSubmitted) {
return <span>{formatDate(project.dateSubmitted)}</span>;
}
return <span>{formatDate(project.dateSubmitted)}</span>;
};

return (
<tr key={project.id}>
<td className={classes.tdCenterAlign}>
Expand Down Expand Up @@ -141,6 +148,7 @@ const ProjectTableRow = ({
</td>

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

<td className={classes.actionIcons}>
{projectRules && (
Expand Down
1 change: 1 addition & 0 deletions client/src/components/Projects/ProjectsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ const ProjectsPage = ({ contentContainerRef }) => {
{ id: "firstName", label: "Created By" },
{ id: "dateCreated", label: "Created On" },
{ id: "dateModified", label: "Last Modified" },
{ id: "dateSubmitted", label: "Submitted" },
{
id: "contextMenu",
label: ""
Expand Down
4 changes: 4 additions & 0 deletions client/src/services/project.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export function del(id) {
return axios.delete(baseUrl + "/" + id);
}

export function submit(id) {
return axios.put(baseUrl + "/submit", id);
}

export function snapshot(id) {
return axios.put(baseUrl + "/snapshot", id);
}
Expand Down
30 changes: 30 additions & 0 deletions next/.next/app-build-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"pages": {
"/projects/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/projects/page.js"
],
"/layout": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/css/app/layout.css",
"static/chunks/app/layout.js"
],
"/calculation/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/calculation/page.js"
],
"/(sidebar)/about/page": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/(sidebar)/about/page.js"
],
"/(sidebar)/layout": [
"static/chunks/webpack.js",
"static/chunks/main-app.js",
"static/chunks/app/(sidebar)/layout.js"
]
}
}
19 changes: 19 additions & 0 deletions next/.next/build-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"polyfillFiles": [
"static/chunks/polyfills.js"
],
"devFiles": [],
"ampDevFiles": [],
"lowPriorityFiles": [
"static/development/_buildManifest.js",
"static/development/_ssgManifest.js"
],
"rootMainFiles": [
"static/chunks/webpack.js",
"static/chunks/main-app.js"
],
"pages": {
"/_app": []
},
"ampFirstPages": []
}
1 change: 1 addition & 0 deletions next/.next/cache/eslint/.cache_1emlz4p
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\cityheader.tsx":"1","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\cityheaderplaceholder.tsx":"2","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\layout.tsx":"3","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\page.tsx":"4","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\test\\page.tsx":"5","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\[client]\\layout.tsx":"6","C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\_about\\page.tsx":"7","C:\\git\\hackforla\\tdm-calculator\\next\\src\\components\\ContentContainer.tsx":"8"},{"size":1028,"mtime":1723347937644,"results":"9","hashOfConfig":"10"},{"size":288,"mtime":1723692814010,"results":"11","hashOfConfig":"10"},{"size":1866,"mtime":1723692405421,"results":"12","hashOfConfig":"10"},{"size":4501,"mtime":1723250821813,"results":"13","hashOfConfig":"10"},{"size":97,"mtime":1723348134222,"results":"14","hashOfConfig":"10"},{"size":325,"mtime":1723347911228,"results":"15","hashOfConfig":"10"},{"size":5529,"mtime":1723400331162,"results":"16","hashOfConfig":"10"},{"size":1165,"mtime":1723397390939,"results":"17","hashOfConfig":"10"},{"filePath":"18","messages":"19","suppressedMessages":"20","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"tx0wgc",{"filePath":"21","messages":"22","suppressedMessages":"23","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"24","messages":"25","suppressedMessages":"26","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"27","messages":"28","suppressedMessages":"29","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"30","messages":"31","suppressedMessages":"32","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"33","messages":"34","suppressedMessages":"35","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"36","messages":"37","suppressedMessages":"38","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"39","messages":"40","suppressedMessages":"41","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\cityheader.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\cityheaderplaceholder.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\layout.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\page.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\test\\page.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\[client]\\layout.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\app\\_about\\page.tsx",[],[],"C:\\git\\hackforla\\tdm-calculator\\next\\src\\components\\ContentContainer.tsx",[],[]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions next/.next/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"type": "commonjs"}
1 change: 1 addition & 0 deletions next/.next/react-loadable-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions next/.next/server/app-paths-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"/(sidebar)/about/page": "app/(sidebar)/about/page.js"
}
311 changes: 311 additions & 0 deletions next/.next/server/app/(sidebar)/about/page.js

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading