From cf9c23723597703723d329b2bd78a9ebc748c81d Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 4 Sep 2025 09:44:21 -0700 Subject: [PATCH] ES Cleanup --- .../estimate-scrubber/estimate-scrubber.js | 21 ++-- package.json | 2 +- .../estimate-scrubber-button.molecule.jsx | 16 ++++ .../estimate-scrubber-results.molecule.jsx | 95 +++++++++++-------- .../jobs-detail-description.molecule.jsx | 12 ++- .../jobs-detail/jobs-detail.organism.jsx | 34 ++----- src/graphql/bodyshop.queries.js | 2 + 7 files changed, 108 insertions(+), 74 deletions(-) diff --git a/electron/estimate-scrubber/estimate-scrubber.js b/electron/estimate-scrubber/estimate-scrubber.js index c1fd566..0eb42fb 100644 --- a/electron/estimate-scrubber/estimate-scrubber.js +++ b/electron/estimate-scrubber/estimate-scrubber.js @@ -86,7 +86,7 @@ async function ScrubEstimate({ job }) { }); } - const fileName = `RPSTest-${job.id}-${Date.now()}`; + const fileName = `RPS-Scrub-${job.id}-${job.clm_no}-${Date.now()}`; // Write job object to logs subfolder try { @@ -110,22 +110,23 @@ async function ScrubEstimate({ job }) { const resultPDFUrl = result?.data?.report_link - log.log("Estimate Scrubber Result:", result.data, resultPDFUrl); + // log.log("Estimate Scrubber Result:", result.data, resultPDFUrl); const b = BrowserWindow.getAllWindows()[0]; b.webContents.send(ipcTypes.app.toRenderer.scrubResults, { jobid: job.id, - items: result.data?.identified_item + items: result.data?.identified_item, + pdfUrl: resultPDFUrl }); - const pdfWindow = new BrowserWindow({ + // const pdfWindow = new BrowserWindow({ - webPreferences: { - plugins: true, // Enable PDF viewing - }, - }); + // webPreferences: { + // plugins: true, // Enable PDF viewing + // }, + // }); - pdfWindow.loadURL(resultPDFUrl); - pdfWindow.focus(); + // pdfWindow.loadURL(resultPDFUrl); + // pdfWindow.focus(); return resultPDFUrl } exports.ScrubEstimate = ScrubEstimate \ No newline at end of file diff --git a/package.json b/package.json index f53cc48..4a4ee3e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "productName": "ImEX RPS", "author": "ImEX Systems Inc. ", "description": "ImEX RPS", - "version": "1.4.2-alpha.10", + "version": "1.4.2-alpha.11", "main": "electron/main.js", "homepage": "./", "dependencies": { diff --git a/src/components/molecules/estimate-scrubber-button/estimate-scrubber-button.molecule.jsx b/src/components/molecules/estimate-scrubber-button/estimate-scrubber-button.molecule.jsx index 5b9eba8..7c7dec7 100644 --- a/src/components/molecules/estimate-scrubber-button/estimate-scrubber-button.molecule.jsx +++ b/src/components/molecules/estimate-scrubber-button/estimate-scrubber-button.molecule.jsx @@ -37,6 +37,22 @@ export function EstimateScrubberButton({ bodyshop, jobid, job }) { const result = await ipcRenderer.invoke(ipcTypes.app.toMain.scrubEstimate, { job: jobData.data.jobs_by_pk }); + + message.success("Estimate scrubbed successfully! "); + // Scroll to the estimate scrubber results section + const scrollToResults = () => { + const element = document.getElementById("es-results-card"); + if (element) { + element.scrollIntoView({ + behavior: "smooth", + block: "start", + inline: "nearest" + }); + } + }; + + // Small delay to ensure DOM is updated before scrolling + setTimeout(scrollToResults, 100); } catch (error) { message.error("Error scrubbing estimate: " + error.message); console.error("Error scrubbing estimate:", error); diff --git a/src/components/molecules/estimate-scruber-results/estimate-scrubber-results.molecule.jsx b/src/components/molecules/estimate-scruber-results/estimate-scrubber-results.molecule.jsx index 8135015..9186f86 100644 --- a/src/components/molecules/estimate-scruber-results/estimate-scrubber-results.molecule.jsx +++ b/src/components/molecules/estimate-scruber-results/estimate-scrubber-results.molecule.jsx @@ -1,11 +1,12 @@ import { InfoCircleOutlined, LinkOutlined, SearchOutlined } from "@ant-design/icons"; -import { Badge, Collapse, Input, Space, Table, Tag, Typography } from "antd"; +import { Badge, Button, Collapse, Input, Result, Space, Table, Tag, Typography } from "antd"; import _ from "lodash"; import { useState } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { selectEsResults } from "../../../redux/application/application.selectors"; import { selectBodyshop } from "../../../redux/user/user.selectors"; +import EstimateScrubberButton from "../estimate-scrubber-button/estimate-scrubber-button.molecule"; const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser @@ -24,8 +25,8 @@ export function EstimateScrubberResults({ bodyshop, jobid, job, esResults }) { const [searchText, setSearchText] = useState(""); // Filter items based on search text - const filteredItems = esResults?.items - ? esResults.items.filter(item => { + const filteredItems = esResults?.items + ? esResults.items.filter((item) => { if (!searchText.trim()) return true; const searchLower = searchText.toLowerCase(); return ( @@ -86,13 +87,21 @@ export function EstimateScrubberResults({ bodyshop, jobid, job, esResults }) { if (!esResults?.items?.length || job?.id !== esResults?.jobid) { return ( -
- - - Estimate not yet scrubbed. - - Run the estimate scrubber to see results here. -
+ } + /> + + //
+ // + // + // Estimate not yet scrubbed. + // + // Run the estimate scrubber to see results here. + // + //
); } @@ -101,7 +110,7 @@ export function EstimateScrubberResults({ bodyshop, jobid, job, esResults }) { return (
} value={searchText} onChange={(e) => setSearchText(e.target.value)} @@ -124,21 +133,43 @@ export function EstimateScrubberResults({ bodyshop, jobid, job, esResults }) { {/* Search Input */}
- } - value={searchText} - onChange={(e) => setSearchText(e.target.value)} - allowClear - style={{ maxWidth: 400 }} - /> - {searchText && ( -
- - Showing {filteredItems.length} of {esResults.items.length} items - -
- )} + + } + value={searchText} + onChange={(e) => setSearchText(e.target.value)} + allowClear + style={{ maxWidth: 400 }} + /> + {searchText && ( +
+ + Showing {filteredItems.length} of {esResults.items.length} items + +
+ )} + + + {Object.entries(groupedItems).map(([category, items]) => { + const config = categoryConfig[category] || { color: "default" }; + return ( + + {category}: {items.length} + + ); + })} + +
+
{/* Grouped Results */} @@ -179,18 +210,6 @@ export function EstimateScrubberResults({ bodyshop, jobid, job, esResults }) { {/* Summary */} - - Summary - - {Object.entries(groupedItems).map(([category, items]) => { - const config = categoryConfig[category] || { color: "default" }; - return ( - - {category}: {items.length} - - ); - })} -
); 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 545e22a..500d52f 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 @@ -13,8 +13,17 @@ import TimeAgoFormatter from "../../atoms/time-ago-formatter/time-ago-formatter. import VehicleGroupAlertAtom from "../../atoms/vehicle-group-alert/vehicle-group-alert.atom"; import CloseDateDisplayMolecule from "../close-date-display/close-date-display.molecule"; import JobGroupMolecule from "../job-group/job-group.molecule"; +import EstimateScrubberButton from "../estimate-scrubber-button/estimate-scrubber-button.molecule.jsx"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../../redux/user/user.selectors.js"; +import { connect } from "react-redux"; -export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailRef }) { +const mapStateToProps = createStructuredSelector({ + bodyshop: selectBodyshop +}); +export default connect(mapStateToProps, null)(JobsDetailDescriptionMolecule); + +export function JobsDetailDescriptionMolecule({ bodyshop, loading, job, jobDetailRef }) { // Store original theme state const originalThemeRef = useRef(null); @@ -88,6 +97,7 @@ export default function JobsDetailDescriptionMolecule({ loading, job, jobDetailR /> ), + bodyshop.phone && , ,