diff --git a/electron/main.js b/electron/main.js index 06e3178..1b8fd64 100644 --- a/electron/main.js +++ b/electron/main.js @@ -23,11 +23,11 @@ log.info("App starting..."); // Conditionally include the dev tools installer to load React Dev Tools let installExtension, REACT_DEVELOPER_TOOLS; -// if (isDev) { -// const devTools = require("electron-devtools-installer"); -// installExtension = devTools.default; -// REACT_DEVELOPER_TOOLS = devTools.REACT_DEVELOPER_TOOLS; -// } +if (isDev) { + const devTools = require("electron-devtools-installer"); + installExtension = devTools.default; + REACT_DEVELOPER_TOOLS = devTools.REACT_DEVELOPER_TOOLS; +} var menu = Menu.buildFromTemplate([ { diff --git a/src/components/atoms/reporting-title/reporting-title.atom.jsx b/src/components/atoms/reporting-title/reporting-title.atom.jsx new file mode 100644 index 0000000..7f9cfce --- /dev/null +++ b/src/components/atoms/reporting-title/reporting-title.atom.jsx @@ -0,0 +1,22 @@ +import { Typography } from "antd"; +import React from "react"; + +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectDates } from "../../../redux/reporting/reporting.selectors"; +import moment from "moment"; +import { DateFormat } from "../../../util/constants"; +const mapStateToProps = createStructuredSelector({ + dates: selectDates, +}); + +export function ReportingTitleAtom({ dates }) { + return ( + + {`RPS Report for Period from ${moment(dates.startDate).format( + DateFormat + )} to ${moment(dates.endDate).format(DateFormat)}`} + + ); +} +export default connect(mapStateToProps, null)(ReportingTitleAtom); diff --git a/src/components/molecules/close-date-display/close-date-display.molecule.jsx b/src/components/molecules/close-date-display/close-date-display.molecule.jsx index 1f54701..df83547 100644 --- a/src/components/molecules/close-date-display/close-date-display.molecule.jsx +++ b/src/components/molecules/close-date-display/close-date-display.molecule.jsx @@ -3,6 +3,7 @@ import { DatePicker, message, Spin } from "antd"; import moment from "moment"; import React, { useState } from "react"; import { UPDATE_JOB } from "../../../graphql/jobs.queries"; +import { DateFormat } from "../../../util/constants"; export default function CloseDateDisplayMolecule({ jobId, close_date }) { const [editMode, setEditMode] = useState(false); @@ -38,7 +39,7 @@ export default function CloseDateDisplayMolecule({ jobId, close_date }) { return (
setEditMode(true)}> - {value && value.isValid() ? value.format("MM/DD/yyyy") : "No date set"} + {value && value.isValid() ? value.format(DateFormat) : "No date set"}
); } diff --git a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx index 911584d..fc9e4cb 100644 --- a/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx +++ b/src/components/molecules/jobs-detail-description/jobs-detail-description.molecule.jsx @@ -3,6 +3,7 @@ import React from "react"; import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom"; import ErrorResultAtom from "../../atoms/error-result/error-result.atom"; import CloseDateDisplayMolecule from "../close-date-display/close-date-display.molecule"; +import TimeAgoFormatter from "../../atoms/time-ago-formatter/time-ago-formatter.atom"; export default function JobsDetailDescriptionMolecule({ loading, job }) { if (loading) return ; @@ -26,6 +27,9 @@ export default function JobsDetailDescriptionMolecule({ loading, job }) { close_date={job.close_date} /> + + {job.updated_at} + diff --git a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx index 829ed73..9e3fa8c 100644 --- a/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx +++ b/src/components/molecules/reporting-jobs-list/reporting-jobs-list.molecule.jsx @@ -1,29 +1,26 @@ import { Input, Table } from "antd"; import React, { useState } from "react"; -import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-formatter.atom"; -import IgnoreJobLine from "../../atoms/ignore-job-line/ignore-job-line.atom"; -import partTypeConverterAtom from "../../atoms/part-type-converter/part-type-converter.atom"; -import PriceDiffPcFormatterAtom from "../../atoms/price-diff-pc-formatter/price-diff-pc-formatter.atom"; - import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectReportData, selectReportLoading, } from "../../../redux/reporting/reporting.selectors"; +import { setSelectedJobId } from "../../../redux/application/application.actions"; +import { Link } from "react-router-dom"; const mapStateToProps = createStructuredSelector({ reportingLoading: selectReportLoading, reportData: selectReportData, }); const mapDispatchToProps = (dispatch) => ({ - //setUserLanguage: language => dispatch(setUserLanguage(language)) + setSelectedJobId: (id) => dispatch(setSelectedJobId(id)), }); -export default connect( - mapStateToProps, - mapDispatchToProps -)(ReportingJobsListMolecule); -export function ReportingJobsListMolecule({ reportingLoading, reportData }) { +export function ReportingJobsListMolecule({ + reportingLoading, + reportData, + setSelectedJobId, +}) { const [searchText, setSearchText] = useState(""); const columns = [ @@ -31,6 +28,11 @@ export function ReportingJobsListMolecule({ reportingLoading, reportData }) { title: "Claim No.", dataIndex: "clm_no", key: "clm_no", + render: (text, record) => ( + setSelectedJobId(record.id)} to={"/"}> + {text} + + ), }, { title: "Ins Co.", @@ -138,3 +140,8 @@ export function ReportingJobsListMolecule({ reportingLoading, reportData }) { ); } + +export default connect( + mapStateToProps, + mapDispatchToProps +)(ReportingJobsListMolecule); diff --git a/src/components/molecules/reporting-totals-stats/reporting-totals-stats.molecule.jsx b/src/components/molecules/reporting-totals-stats/reporting-totals-stats.molecule.jsx index 63adb2c..c17b519 100644 --- a/src/components/molecules/reporting-totals-stats/reporting-totals-stats.molecule.jsx +++ b/src/components/molecules/reporting-totals-stats/reporting-totals-stats.molecule.jsx @@ -1,8 +1,7 @@ import { Skeleton, Statistic } from "antd"; -import React, { useCallback } from "react"; +import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; -import { selectSelectedJobTargetPc } from "../../../redux/application/application.selectors"; import { selectReportLoading, selectScorecard, diff --git a/src/components/pages/jobs/jobs.page.jsx b/src/components/pages/jobs/jobs.page.jsx index 160ae86..e6eef89 100644 --- a/src/components/pages/jobs/jobs.page.jsx +++ b/src/components/pages/jobs/jobs.page.jsx @@ -1,15 +1,11 @@ -import { Col, Row, Tabs, Grid } from "antd"; +import { Col, Grid, Row, Tabs } from "antd"; import React from "react"; -import { connect } from "react-redux"; -import { createStructuredSelector } from "reselect"; import JobsDetailOrganism from "../../organisms/jobs-detail/jobs-detail.organism"; import JobsListOrganism from "../../organisms/jobs-list-latest/jobs-list-latest.organism"; import JobsListSearchOrganism from "../../organisms/jobs-list-search/jobs-list-search.organism"; -const mapStateToProps = createStructuredSelector({}); -const mapDispatchToProps = (dispatch) => ({}); - -export function JobsPage() { +export default function JobsPage() { + console.log("Jobs Page Rerender"); const selectedBreakpoint = Object.entries(Grid.useBreakpoint()) .filter((screen) => !!screen[1]) .slice(-1)[0]; @@ -47,4 +43,3 @@ export function JobsPage() { ); } -export default connect(mapStateToProps, mapDispatchToProps)(JobsPage); diff --git a/src/components/pages/reporting/reporting.page.jsx b/src/components/pages/reporting/reporting.page.jsx index f6e6949..6b78822 100644 --- a/src/components/pages/reporting/reporting.page.jsx +++ b/src/components/pages/reporting/reporting.page.jsx @@ -2,6 +2,7 @@ import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectDates } from "../../../redux/reporting/reporting.selectors"; +import ReportingTitleAtom from "../../atoms/reporting-title/reporting-title.atom"; import ReportingDatesMolecule from "../../molecules/reporting-dates/reporting-dates.molecule"; import ReportingJobsListMolecule from "../../molecules/reporting-jobs-list/reporting-jobs-list.molecule"; import ReportingTotalsStatsMolecule from "../../molecules/reporting-totals-stats/reporting-totals-stats.molecule"; @@ -20,6 +21,7 @@ export function ReportingPage({ dates }) { {dates && dates.startDate && dates.endDate && (
+
diff --git a/src/components/pages/routes/routes.page.jsx b/src/components/pages/routes/routes.page.jsx index 4709e39..1f523b6 100644 --- a/src/components/pages/routes/routes.page.jsx +++ b/src/components/pages/routes/routes.page.jsx @@ -1,12 +1,12 @@ import { Layout } from "antd"; import React from "react"; import { connect } from "react-redux"; -import { Route, Switch } from "react-router-dom"; +import { Route } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../../redux/user/user.selectors"; import ErrorResultAtom from "../../atoms/error-result/error-result.atom"; import SiderMenuOrganism from "../../organisms/sider-menu/sider-menu.organism"; -import Jobs from "../jobs/jobs.page"; +import JobsPage from "../jobs/jobs.page"; import ReportingPage from "../reporting/reporting.page"; import SettingsPage from "../settings/settings.page"; @@ -21,6 +21,7 @@ export function RoutesPage({ bodyshop }) { errorMessage="You do not currently have access to any shop. Please reach out to technical support." /> ); + console.log("routes render"); return ( - - - - - + + + diff --git a/src/graphql/jobs.queries.js b/src/graphql/jobs.queries.js index 73be1ad..fb87aa6 100644 --- a/src/graphql/jobs.queries.js +++ b/src/graphql/jobs.queries.js @@ -89,6 +89,7 @@ export const QUERY_JOB_BY_PK = gql` v_age loss_date close_date + updated_at joblines(order_by: { line_no: asc }) { id line_no diff --git a/src/index.js b/src/index.js index 2d5ab9d..3e272e9 100644 --- a/src/index.js +++ b/src/index.js @@ -2,7 +2,7 @@ import "antd/dist/antd.css"; import React from "react"; import ReactDOM from "react-dom"; import { Provider } from "react-redux"; -import { BrowserRouter } from "react-router-dom"; +import { MemoryRouter } from "react-router-dom"; import { PersistGate } from "redux-persist/integration/react"; import App from "./App/App"; import "./index.css"; @@ -11,11 +11,11 @@ require("dotenv").config(); ReactDOM.render( - + - + , document.getElementById("root") ); diff --git a/src/redux/reporting/reporting.reducer.js b/src/redux/reporting/reporting.reducer.js index f77390c..64076cb 100644 --- a/src/redux/reporting/reporting.reducer.js +++ b/src/redux/reporting/reporting.reducer.js @@ -10,7 +10,14 @@ const INITIAL_STATE = { const applicationReducer = (state = INITIAL_STATE, action) => { switch (action.type) { case ReportingActionTypes.QUERY_REPORTING_DATA: - return { ...state, loading: true, dates: action.payload }; + return { + ...state, + loading: true, + dates: { + startDate: action.payload.startDate.toISOString(), + endDate: action.payload.endDate.toISOString(), + }, + }; case ReportingActionTypes.SET_REPORTING_DATA: return { ...state, data: action.payload }; case ReportingActionTypes.SET_SCORE_CARD: diff --git a/src/util/constants.js b/src/util/constants.js new file mode 100644 index 0000000..f8d19ea --- /dev/null +++ b/src/util/constants.js @@ -0,0 +1 @@ +export const DateFormat = "MM/DD/yyyy";