From 06c35a4ff82d202ee13e3fdbe9d6e393ee37bd99 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 18 Sep 2023 16:08:20 -0700 Subject: [PATCH 1/7] Add additonal query limits and restrictors for performance. --- .../job-search-select/job-search-select.component.jsx | 2 +- .../owner-search-select/owner-search-select.component.jsx | 2 +- client/src/components/owners-list/owners-list.component.jsx | 6 +++++- .../vehicle-search-select.component.jsx | 2 +- client/src/graphql/jobs.queries.js | 2 +- client/src/graphql/owners.queries.js | 2 +- client/src/graphql/vehicles.queries.js | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/client/src/components/job-search-select/job-search-select.component.jsx b/client/src/components/job-search-select/job-search-select.component.jsx index 180fb93dc..64ca39e07 100644 --- a/client/src/components/job-search-select/job-search-select.component.jsx +++ b/client/src/components/job-search-select/job-search-select.component.jsx @@ -33,7 +33,7 @@ const JobSearchSelect = ( useLazyQuery(SEARCH_JOBS_BY_ID_FOR_AUTOCOMPLETE); const executeSearch = (v) => { - if (v && v !== "") callSearch(v); + if (v && v !== "" && v.length >= 3) callSearch(v); }; const debouncedExecuteSearch = _.debounce(executeSearch, 500); diff --git a/client/src/components/owner-search-select/owner-search-select.component.jsx b/client/src/components/owner-search-select/owner-search-select.component.jsx index 85e4d9833..c243e313e 100644 --- a/client/src/components/owner-search-select/owner-search-select.component.jsx +++ b/client/src/components/owner-search-select/owner-search-select.component.jsx @@ -21,7 +21,7 @@ const OwnerSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { useLazyQuery(SEARCH_OWNERS_BY_ID_FOR_AUTOCOMPLETE); const executeSearch = (v) => { - callSearch(v); + if (v && v !== "" && v.length >= 3) callSearch(v); }; const debouncedExecuteSearch = _.debounce(executeSearch, 500); diff --git a/client/src/components/owners-list/owners-list.component.jsx b/client/src/components/owners-list/owners-list.component.jsx index 78e2c3cb3..d4c5f7e5c 100644 --- a/client/src/components/owners-list/owners-list.component.jsx +++ b/client/src/components/owners-list/owners-list.component.jsx @@ -106,7 +106,11 @@ export default function OwnersListComponent({ { - search.search = value; + if (value?.length >= 3) { + search.search = value; + } else { + delete search.search; + } history.push({ search: queryString.stringify(search) }); }} enterButton diff --git a/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx b/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx index 4d8d49894..8f187b77b 100644 --- a/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx +++ b/client/src/components/vehicle-search-select/vehicle-search-select.component.jsx @@ -22,7 +22,7 @@ const VehicleSearchSelect = ({ value, onChange, onBlur, disabled }, ref) => { ] = useLazyQuery(SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE); const executeSearch = (v) => { - callSearch(v); + if (v && v !== "" && v.length >= 3) callSearch(v); }; const debouncedExecuteSearch = _.debounce(executeSearch, 500); diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 60846e2fa..ad965bd74 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1242,7 +1242,7 @@ export const SEARCH_JOBS_FOR_AUTOCOMPLETE = gql` ) { search_jobs( args: { search: $search } - limit: 50 + limit: 25 where: { _and: { converted: { _eq: $isConverted } diff --git a/client/src/graphql/owners.queries.js b/client/src/graphql/owners.queries.js index a4e5d1c80..ea0062cd5 100644 --- a/client/src/graphql/owners.queries.js +++ b/client/src/graphql/owners.queries.js @@ -36,7 +36,7 @@ export const SEARCH_OWNERS_FOR_AUTOCOMPLETE = gql` query SEARCH_OWNERS_FOR_AUTOCOMPLETE($search: String) { search_owners( args: { search: $search } - limit: 50 + limit: 25 order_by: { ownr_ln: desc_nulls_last } ) { id diff --git a/client/src/graphql/vehicles.queries.js b/client/src/graphql/vehicles.queries.js index 9df3c4238..619ff8961 100644 --- a/client/src/graphql/vehicles.queries.js +++ b/client/src/graphql/vehicles.queries.js @@ -184,7 +184,7 @@ export const SEARCH_VEHICLES_BY_ID_FOR_AUTOCOMPLETE = gql` `; export const SEARCH_VEHICLES_FOR_AUTOCOMPLETE = gql` query SEARCH_VEHICLES_FOR_AUTOCOMPLETE($search: String) { - search_vehicles(args: { search: $search }, limit: 50) { + search_vehicles(args: { search: $search }, limit: 25) { id v_vin v_model_yr From c998e4901fad5265cc5cb0ce57a7f3e02faf3914 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 18 Sep 2023 18:25:05 -0700 Subject: [PATCH 2/7] IO-2398 Hours Sold by Estimator --- client/src/translations/en_us/common.json | 4 ++ client/src/translations/es/common.json | 4 ++ client/src/translations/fr/common.json | 4 ++ client/src/utils/TemplateConstants.js | 68 +++++++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 43321060f..978bc7ccd 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -2565,18 +2565,22 @@ "gsr_labor_only": "Gross Sales - Labor Only", "hours_sold_detail_closed": "Hours Sold Detail - Closed", "hours_sold_detail_closed_csr": "Hours Sold Detail - Closed by CSR", + "hours_sold_detail_closed_estimator": "Hours Sold Detail - Closed by Estimator", "hours_sold_detail_closed_ins_co": "Hours Sold Detail - Closed by Source", "hours_sold_detail_closed_status": "Hours Sold Detail - Closed by Status", "hours_sold_detail_open": "Hours Sold Detail - Open", "hours_sold_detail_open_csr": "Hours Sold Detail - Open by CSR", + "hours_sold_detail_open_estimator": "Hours Sold Detail - Open by Estimator", "hours_sold_detail_open_ins_co": "Hours Sold Detail - Open by Source", "hours_sold_detail_open_status": "Hours Sold Detail - Open by Status", "hours_sold_summary_closed": "Hours Sold Summary - Closed", "hours_sold_summary_closed_csr": "Hours Sold Summary - Closed by CSR", + "hours_sold_summary_closed_estimator": "Hours Sold Summary - Closed by Estimator", "hours_sold_summary_closed_ins_co": "Hours Sold Summary - Closed by Source", "hours_sold_summary_closed_status": "Hours Sold Summary - Closed by Status", "hours_sold_summary_open": "Hours Sold Summary - Open", "hours_sold_summary_open_csr": "Hours Sold Summary - Open CSR", + "hours_sold_summary_open_estimator": "Hours Sold Summary - Open Estimator", "hours_sold_summary_open_ins_co": "Hours Sold Summary - Open by Source", "hours_sold_summary_open_status": "Hours Sold Summary - Open by Status", "job_costing_ro_csr": "Job Costing by CSR", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 11e00e638..c687b79d5 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -2565,18 +2565,22 @@ "gsr_labor_only": "", "hours_sold_detail_closed": "", "hours_sold_detail_closed_csr": "", + "hours_sold_detail_closed_estimator": "", "hours_sold_detail_closed_ins_co": "", "hours_sold_detail_closed_status": "", "hours_sold_detail_open": "", "hours_sold_detail_open_csr": "", + "hours_sold_detail_open_estimator": "", "hours_sold_detail_open_ins_co": "", "hours_sold_detail_open_status": "", "hours_sold_summary_closed": "", "hours_sold_summary_closed_csr": "", + "hours_sold_summary_closed_estimator": "", "hours_sold_summary_closed_ins_co": "", "hours_sold_summary_closed_status": "", "hours_sold_summary_open": "", "hours_sold_summary_open_csr": "", + "hours_sold_summary_open_estimator": "", "hours_sold_summary_open_ins_co": "", "hours_sold_summary_open_status": "", "job_costing_ro_csr": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index c386076df..d11d96044 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -2565,18 +2565,22 @@ "gsr_labor_only": "", "hours_sold_detail_closed": "", "hours_sold_detail_closed_csr": "", + "hours_sold_detail_closed_estimator": "", "hours_sold_detail_closed_ins_co": "", "hours_sold_detail_closed_status": "", "hours_sold_detail_open": "", "hours_sold_detail_open_csr": "", + "hours_sold_detail_open_estimator": "", "hours_sold_detail_open_ins_co": "", "hours_sold_detail_open_status": "", "hours_sold_summary_closed": "", "hours_sold_summary_closed_csr": "", + "hours_sold_summary_closed_estimator": "", "hours_sold_summary_closed_ins_co": "", "hours_sold_summary_closed_status": "", "hours_sold_summary_open": "", "hours_sold_summary_open_csr": "", + "hours_sold_summary_open_estimator": "", "hours_sold_summary_open_ins_co": "", "hours_sold_summary_open_status": "", "job_costing_ro_csr": "", diff --git a/client/src/utils/TemplateConstants.js b/client/src/utils/TemplateConstants.js index 3467027c6..cc1c4011a 100644 --- a/client/src/utils/TemplateConstants.js +++ b/client/src/utils/TemplateConstants.js @@ -818,6 +818,74 @@ export const TemplateList = (type, context) => { }, group: "sales", }, + hours_sold_detail_closed_estimator: { + title: i18n.t( + "reportcenter.templates.hours_sold_detail_closed_estimator" + ), + description: "", + subject: i18n.t( + "reportcenter.templates.hours_sold_detail_closed_estimator" + ), + key: "hours_sold_detail_closed_estimator", + //idtype: "vendor", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.date_invoiced"), + }, + group: "sales", + }, + hours_sold_detail_open_estimator: { + title: i18n.t( + "reportcenter.templates.hours_sold_detail_open_estimator" + ), + description: "", + subject: i18n.t( + "reportcenter.templates.hours_sold_detail_open_estimator" + ), + key: "hours_sold_detail_open_estimator", + //idtype: "vendor", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.date_open"), + }, + group: "sales", + }, + hours_sold_summary_closed_estimator: { + title: i18n.t( + "reportcenter.templates.hours_sold_summary_closed_estimator" + ), + description: "", + subject: i18n.t( + "reportcenter.templates.hours_sold_summary_closed_estimator" + ), + key: "hours_sold_summary_closed_estimator", + //idtype: "vendor", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.date_invoiced"), + }, + group: "sales", + }, + hours_sold_summary_open_estimator: { + title: i18n.t( + "reportcenter.templates.hours_sold_summary_open_estimator" + ), + description: "", + subject: i18n.t( + "reportcenter.templates.hours_sold_summary_open_estimator" + ), + key: "hours_sold_summary_open_estimator", + //idtype: "vendor", + disabled: false, + rangeFilter: { + object: i18n.t("reportcenter.labels.objects.jobs"), + field: i18n.t("jobs.fields.date_invoiced"), + }, + group: "sales", + }, hours_sold_summary_open_status: { title: i18n.t( "reportcenter.templates.hours_sold_summary_open_status" From 6319fd20fa6887c5e854598b3f42b81a42640f40 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Wed, 20 Sep 2023 12:16:03 -0700 Subject: [PATCH 3/7] IO-2407 In House Invoice Audit Log correction for Invoice Number --- .../bill-enter-modal/bill-enter-modal.container.jsx | 6 +++--- client/src/graphql/bills.queries.js | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index d2d0d928a..d50c17433 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -37,8 +37,8 @@ const mapStateToProps = createStructuredSelector({ }); const mapDispatchToProps = (dispatch) => ({ toggleModalVisible: () => dispatch(toggleModalVisible("billEnter")), - insertAuditTrail: ({ jobid, operation }) => - dispatch(insertAuditTrail({ jobid, operation })), + insertAuditTrail: ({ jobid, billid, operation }) => + dispatch(insertAuditTrail({ jobid, billid, operation })), }); const Templates = TemplateList("job_special"); @@ -316,7 +316,7 @@ function BillEnterModalContainer({ insertAuditTrail({ jobid: values.jobid, billid: billId, - operation: AuditTrailMapping.billposted(remainingValues.invoice_number), + operation: AuditTrailMapping.billposted(r1.data.insert_bills.returning[0].invoice_number), }); if (enterAgain) { diff --git a/client/src/graphql/bills.queries.js b/client/src/graphql/bills.queries.js index 6406edfe1..07e1a3cc9 100644 --- a/client/src/graphql/bills.queries.js +++ b/client/src/graphql/bills.queries.js @@ -5,6 +5,7 @@ export const INSERT_NEW_BILL = gql` insert_bills(objects: $bill) { returning { id + invoice_number } } } From fbc622fa04408cfdd55e2aca946cb7355e84ae71 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Wed, 20 Sep 2023 14:30:53 -0700 Subject: [PATCH 4/7] IO-2363 Make Summary.Difference follow Color logic --- .../labor-allocations-table.component.jsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx index 3c264dafc..83f99d867 100644 --- a/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx +++ b/client/src/components/labor-allocations-table/labor-allocations-table.component.jsx @@ -231,7 +231,14 @@ export function LaborAllocationsTable({ {summary.adjustments.toFixed(1)} - {summary.difference.toFixed(1)} + = 0 ? "green" : "red", + }} + > + {summary.difference.toFixed(1)} + )} From 21c53473d366c37318b0998c0a16a2d21a30ade0 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Wed, 20 Sep 2023 15:58:48 -0700 Subject: [PATCH 5/7] IO-2400 Add Color column to All Courtesy Cars --- .../courtesy-cars-list.component.jsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx index e16875af3..b2e3059f6 100644 --- a/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx +++ b/client/src/components/courtesy-cars-list/courtesy-cars-list.component.jsx @@ -9,15 +9,15 @@ import { Table, Tooltip, } from "antd"; +import moment from "moment"; import React, { useState } from "react"; import { useTranslation } from "react-i18next"; import { Link } from "react-router-dom"; import { DateTimeFormatter } from "../../utils/DateFormatter"; -import { alphaSort } from "../../utils/sorters"; -import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; -import moment from "moment"; import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; +import { alphaSort } from "../../utils/sorters"; +import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; export default function CourtesyCarsList({ loading, courtesycars, refetch }) { const [state, setState] = useState({ sortedInfo: {}, @@ -115,6 +115,14 @@ export default function CourtesyCarsList({ loading, courtesycars, refetch }) { sortOrder: state.sortedInfo.columnKey === "model" && state.sortedInfo.order, }, + { + title: t("courtesycars.fields.color"), + dataIndex: "color", + key: "color", + sorter: (a, b) => alphaSort(a.color, b.color), + sortOrder: + state.sortedInfo.columnKey === "color" && state.sortedInfo.order, + }, { title: t("courtesycars.fields.plate"), dataIndex: "plate", From b29d8e1912aa3b8b356978999ecd5cee056e8ae3 Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 22 Sep 2023 11:34:09 -0700 Subject: [PATCH 6/7] IO-2408 Use bodyshop.timezone instead of UTCOffset in Speedprint --- client/src/utils/RenderTemplate.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index f103111cf..cc58e0b78 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -1,15 +1,15 @@ import { gql } from "@apollo/client"; -import { notification } from "antd"; import jsreport from "@jsreport/browser-client"; +import { notification } from "antd"; +import axios from "axios"; import _ from "lodash"; import moment from "moment"; import { auth } from "../firebase/firebase.utils"; import { setEmailOptions } from "../redux/email/email.actions"; import { store } from "../redux/store"; import client from "../utils/GraphQLClient"; -import { TemplateList } from "./TemplateConstants"; import cleanAxios from "./CleanAxios"; -import axios from "axios"; +import { TemplateList } from "./TemplateConstants"; const server = process.env.REACT_APP_REPORTS_SERVER_URL; jsreport.serverUrl = server; @@ -255,7 +255,7 @@ export async function RenderTemplates( headerpath: `/${bodyshop.imexshopid}/header.html`, footerpath: `/${bodyshop.imexshopid}/footer.html`, bodyshop: bodyshop, - offset: moment().utcOffset(), + offset: bodyshop.timezone, }, }; From c8fb1ce30216e8224983c3ac71a19b6d5374915c Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Fri, 22 Sep 2023 11:51:41 -0700 Subject: [PATCH 7/7] IO-2408 Remove unneeded library --- client/src/utils/RenderTemplate.js | 1 - 1 file changed, 1 deletion(-) diff --git a/client/src/utils/RenderTemplate.js b/client/src/utils/RenderTemplate.js index cc58e0b78..8cb4691fe 100644 --- a/client/src/utils/RenderTemplate.js +++ b/client/src/utils/RenderTemplate.js @@ -3,7 +3,6 @@ import jsreport from "@jsreport/browser-client"; import { notification } from "antd"; import axios from "axios"; import _ from "lodash"; -import moment from "moment"; import { auth } from "../firebase/firebase.utils"; import { setEmailOptions } from "../redux/email/email.actions"; import { store } from "../redux/store";