From 69f2b66e56f95f08c58643dd7fa73f3852941bf9 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 25 Aug 2020 16:59:09 -0700 Subject: [PATCH 01/79] Added copyright notice. --- client/src/pages/manage/manage.page.component.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index 5f32406d1..bb9d75cea 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -349,9 +349,10 @@ export function Manage({ match, conflict }) { -
{`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`}
+
+ {`ImEX Online V.${process.env.NODE_ENV}-${process.env.REACT_APP_GIT_SHA}`} + © 2019 - {new Date().getFullYear} Snapt Software Inc. +
); From 721c938e8a60d54b52bd3f657c68f8582d62a1bb Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 26 Aug 2020 16:15:17 -0700 Subject: [PATCH 02/79] Changed RO Search Select to use RO searching and possible provided job value for options IMEX-129 IMEX-327 --- .../invoice-enter-modal.container.jsx | 14 ++- .../invoice-form/invoice-form.component.jsx | 2 - .../invoice-form/invoice-form.container.jsx | 6 - .../job-search-select.component.jsx | 114 ++++++++++++------ ...jobs-close-allocation-button.component.jsx | 8 +- ...jobs-close-labmat-allocation.component.jsx | 16 +-- .../jobs-close-parts-allocation.component.jsx | 14 +-- .../payment-form/payment-form.component.jsx | 9 +- .../payment-form/payment-form.container.jsx | 20 +-- .../tech-job-clock-in-form.component.jsx | 9 +- .../time-ticket-modal.container.jsx | 10 +- client/src/graphql/invoices.queries.js | 3 + client/src/graphql/jobs.queries.js | 35 ++++++ .../pages/manage/manage.page.component.jsx | 6 +- .../1598482210998_run_sql_migration/down.yaml | 1 + .../1598482210998_run_sql_migration/up.yaml | 11 ++ .../1598482371598_run_sql_migration/down.yaml | 1 + .../1598482371598_run_sql_migration/up.yaml | 11 ++ .../1598482569425_run_sql_migration/down.yaml | 1 + .../1598482569425_run_sql_migration/up.yaml | 11 ++ 20 files changed, 193 insertions(+), 109 deletions(-) create mode 100644 hasura/migrations/1598482210998_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1598482210998_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1598482371598_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1598482371598_run_sql_migration/up.yaml create mode 100644 hasura/migrations/1598482569425_run_sql_migration/down.yaml create mode 100644 hasura/migrations/1598482569425_run_sql_migration/up.yaml diff --git a/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx b/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx index 5078a0029..56f30fbc0 100644 --- a/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx +++ b/client/src/components/invoice-enter-modal/invoice-enter-modal.container.jsx @@ -45,12 +45,14 @@ function InvoiceEnterModalContainer({ invoice: [ Object.assign({}, remainingValues, { invoicelines: { - data: remainingValues.invoicelines.map((i) => { - return { - ...i, - joblineid: i.joblineid === "noline" ? null : i.joblineid, - }; - }), + data: + remainingValues.invoicelines && + remainingValues.invoicelines.map((i) => { + return { + ...i, + joblineid: i.joblineid === "noline" ? null : i.joblineid, + }; + }), }, }), ], diff --git a/client/src/components/invoice-form/invoice-form.component.jsx b/client/src/components/invoice-form/invoice-form.component.jsx index b57764fda..02bf469fb 100644 --- a/client/src/components/invoice-form/invoice-form.component.jsx +++ b/client/src/components/invoice-form/invoice-form.component.jsx @@ -12,7 +12,6 @@ import { CalculateInvoiceTotal } from "./invoice-form.totals.utility"; export default function InvoiceFormComponent({ form, - roAutoCompleteOptions, vendorAutoCompleteOptions, lineData, responsibilityCenters, @@ -57,7 +56,6 @@ export default function InvoiceFormComponent({ ]} > { if (form.getFieldValue("jobid") !== null) { diff --git a/client/src/components/invoice-form/invoice-form.container.jsx b/client/src/components/invoice-form/invoice-form.container.jsx index 0743ed8d0..e13a22caf 100644 --- a/client/src/components/invoice-form/invoice-form.container.jsx +++ b/client/src/components/invoice-form/invoice-form.container.jsx @@ -3,7 +3,6 @@ import React from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; import { GET_JOB_LINES_TO_ENTER_INVOICE } from "../../graphql/jobs-lines.queries"; -import { ACTIVE_JOBS_FOR_AUTOCOMPLETE } from "../../graphql/jobs.queries"; import { SEARCH_VENDOR_AUTOCOMPLETE } from "../../graphql/vendors.queries"; import { selectBodyshop } from "../../redux/user/user.selectors"; import InvoiceFormComponent from "./invoice-form.component"; @@ -13,10 +12,6 @@ const mapStateToProps = createStructuredSelector({ }); export function InvoiceFormContainer({ bodyshop, form, invoiceEdit }) { - const { data: RoAutoCompleteData } = useQuery(ACTIVE_JOBS_FOR_AUTOCOMPLETE, { - variables: { statuses: bodyshop.md_ro_statuses.open_statuses || ["Open"] }, - }); - const { data: VendorAutoCompleteData } = useQuery(SEARCH_VENDOR_AUTOCOMPLETE); const [loadLines, { data: lineData }] = useLazyQuery( @@ -28,7 +23,6 @@ export function InvoiceFormContainer({ bodyshop, form, invoiceEdit }) { { + const [callSearch, { loading, error, data }] = useLazyQuery( + SEARCH_JOBS_FOR_AUTOCOMPLETE + ); + const [ + callIdSearch, + { loading: idLoading, error: idError, data: idData }, + ] = useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE); + + const executeSearch = (v) => { + callSearch(v); + }; + const debouncedExecuteSearch = _.debounce(executeSearch, 800); + + const handleSearch = (value) => { + debouncedExecuteSearch({ variables: { search: value } }); + }; -const JobSearchSelect = ( - { value, onChange, options, onBlur, disabled, loading }, - ref -) => { const [option, setOption] = useState(value); useEffect(() => { + if (value === option) { + console.log("Job ID Provided, searching..."); + callIdSearch({ variables: { id: value } }); + } + }, [value, option, callIdSearch]); + + // useEffect(() => { + // if (value !== option && onChange) { + // onChange(option); + // } + // }, [value, option, onChange]); + + const handleSelect = (value) => { + setOption(value); if (value !== option && onChange) { onChange(option); } - }, [value, option, onChange]); + }; + + const theOptions = [ + ...(idData && idData.jobs_by_pk ? [idData.jobs_by_pk] : []), + ...(data && data.search_jobs ? data.search_jobs : []), + ]; return ( - +
+ + {idLoading || loading ? : null} +
); }; export default forwardRef(JobSearchSelect); diff --git a/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx b/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx index d43fa84ef..d1cbe1280 100644 --- a/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx +++ b/client/src/components/jobs-close-allocation-button/jobs-close-allocation-button.component.jsx @@ -61,7 +61,7 @@ export function JobsCloseLabmatAllocationButton({ setState({ center: "", amount: 0 }); }; - const showAllocation = allocation.total.getAmount() > 0; + const showAllocation = Dinero(allocation.total).getAmount() > 0; useEffect(() => { if (remainingAmount === 0) setVisible(false); }, [remainingAmount, setVisible]); @@ -73,7 +73,8 @@ export function JobsCloseLabmatAllocationButton({