Initial working ATA scrubbing.

This commit is contained in:
Patrick Fic
2025-07-11 16:13:45 -07:00
parent a1dfcf4457
commit dcc59ab2fe
5 changed files with 20 additions and 13 deletions

View File

@@ -6,7 +6,7 @@ import ipcTypes from "../../../ipc.types";
import { selectBodyshop } from "../../../redux/user/user.selectors";
import { useApolloClient } from "@apollo/client";
import { QUERY_JOB_ESTIMATE_SCRUBBER } from "../../../graphql/jobs.queries";
import _ from "lodash";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -17,7 +17,7 @@ const mapDispatchToProps = (dispatch) => ({
});
export default connect(mapStateToProps, mapDispatchToProps)(EstimateScrubberButton);
export function EstimateScrubberButton({ bodyshop, jobid }) {
export function EstimateScrubberButton({ bodyshop, jobid, job }) {
const [loading, setLoading] = useState(false);
const client = useApolloClient();
const handleScrub = async () => {
@@ -45,7 +45,7 @@ export function EstimateScrubberButton({ bodyshop, jobid }) {
};
return (
<Button onClick={handleScrub} loading={loading}>
<Button onClick={handleScrub} disabled={job?.g_bett_amt == null} loading={loading}>
Scrub Estimate with Estimate Scrubber
</Button>
);

View File

@@ -83,7 +83,13 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) {
<Card
title="Estimate Lines"
extra={[<EstimateScrubberButton key="es" jobid={data ? data.jobs_by_pk?.id : null} />]}
extra={[
<EstimateScrubberButton
key="es"
jobid={data ? data.jobs_by_pk?.id : null}
job={data ? data.jobs_by_pk : null}
/>
]}
>
<JobsLinesTableMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
</Card>

View File

@@ -102,6 +102,7 @@ export const QUERY_JOB_BY_PK = gql`
requires_reimport
created_at
v_mileage
g_bett_amt
joblines(order_by: { line_no: asc }) {
id
line_no