From 6607c80aca816a8d9361798ba13d2cd5d77ec3c7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 24 Jan 2023 09:31:25 -0800 Subject: [PATCH 01/10] IO-2146 Remove Sublet from jobline status db view. --- .../1674581461316_run_sql_migration/down.sql | 10 ++++++++++ .../migrations/1674581461316_run_sql_migration/up.sql | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 hasura/migrations/1674581461316_run_sql_migration/down.sql create mode 100644 hasura/migrations/1674581461316_run_sql_migration/up.sql diff --git a/hasura/migrations/1674581461316_run_sql_migration/down.sql b/hasura/migrations/1674581461316_run_sql_migration/down.sql new file mode 100644 index 000000000..c8b05ac72 --- /dev/null +++ b/hasura/migrations/1674581461316_run_sql_migration/down.sql @@ -0,0 +1,10 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- CREATE OR REPLACE VIEW "public"."joblines_status" AS +-- SELECT j.jobid, +-- j.status, +-- count(1) AS count, +-- j.part_type +-- FROM joblines j +-- WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.removed IS FALSE)) +-- GROUP BY j.jobid, j.status, j.part_type; diff --git a/hasura/migrations/1674581461316_run_sql_migration/up.sql b/hasura/migrations/1674581461316_run_sql_migration/up.sql new file mode 100644 index 000000000..4300cda23 --- /dev/null +++ b/hasura/migrations/1674581461316_run_sql_migration/up.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE VIEW "public"."joblines_status" AS + SELECT j.jobid, + j.status, + count(1) AS count, + j.part_type + FROM joblines j + WHERE ((j.part_type IS NOT NULL) AND (j.part_type <> 'PAE'::text) AND (j.part_type <> 'PAS'::text) AND (j.part_type <> 'PASL'::text) AND (j.removed IS FALSE)) + GROUP BY j.jobid, j.status, j.part_type; From 423157dfccb3b75ccb3d5e46cc9fbf2e2723e6da Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 26 Jan 2023 08:32:43 -0800 Subject: [PATCH 02/10] Add misc labor cost for autohouse. --- server/data/autohouse.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index 4ed51166f..3bfcdae64 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -895,6 +895,12 @@ const CreateCosts = (job) => { GlassLaborTotalCost: ticketTotalsByCostCenter[defaultCosts.LAG] || Dinero(), DetailLaborTotalCost: Dinero(), // ticketTotalsByCostCenter[defaultCosts.LAD] || Dinero(), + LaborMiscTotalCost: (ticketTotalsByCostCenter[defaultCosts.LA1] || Dinero()) + .add(ticketTotalsByCostCenter[defaultCosts.LA2] || Dinero()) + .add(ticketTotalsByCostCenter[defaultCosts.LA2] || Dinero()) + .add(ticketTotalsByCostCenter[defaultCosts.LA3] || Dinero()) + .add(ticketTotalsByCostCenter[defaultCosts.LA4] || Dinero()) + .add(ticketTotalsByCostCenter[defaultCosts.LAU] || Dinero()), PMTotalCost: billTotalsByCostCenters[defaultCosts.MAPA] || Dinero(), BMTotalCost: billTotalsByCostCenters[defaultCosts.MASH] || Dinero(), MiscTotalCost: billTotalsByCostCenters[defaultCosts.PAO] || Dinero(), From a54862a309de51bc9f06eeb8ddc1cf769a8bd7aa Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 26 Jan 2023 11:07:08 -0800 Subject: [PATCH 03/10] Add cost center to employee time tickets summary. --- .../time-ticket-list/time-ticket-list.component.jsx | 2 +- .../time-tickets-summary-employees.component.jsx | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/components/time-ticket-list/time-ticket-list.component.jsx b/client/src/components/time-ticket-list/time-ticket-list.component.jsx index 40af8ca48..7cebf2672 100644 --- a/client/src/components/time-ticket-list/time-ticket-list.component.jsx +++ b/client/src/components/time-ticket-list/time-ticket-list.component.jsx @@ -85,7 +85,7 @@ export function TimeTicketList({ text: (() => { const emp = bodyshop.employees.find((e) => e.id === s); - return `${emp.first_name} ${emp.last_name}`; + return `${emp?.first_name} ${emp?.last_name}`; })(), // value: [s], }; diff --git a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx index da4e1bbab..f68eadb6d 100644 --- a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx +++ b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx @@ -131,6 +131,7 @@ const JobRelatedTicketsTable = ({ return { id: `${item.jobKey}${costCenter}`, + costCenter, item, actHrs: actHrs.toFixed(1), prodHrs: prodHrs.toFixed(1), @@ -151,7 +152,9 @@ const JobRelatedTicketsTable = ({ sortOrder: state.sortedInfo.columnKey === "empname" && state.sortedInfo.order, render: (text, record) => - `${record.item.employee.first_name} ${record.item.employee.last_name}`, + `${record.item.employee.first_name} ${record.item.employee.last_name} ${ + record.costCenter ? `(${record.costCenter})` : "" + }`.trim(), }, { title: t("timetickets.fields.actualhrs"), @@ -215,7 +218,7 @@ const JobRelatedTicketsTable = ({ const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; - + console.log(data); return ( Date: Thu, 26 Jan 2023 11:12:21 -0800 Subject: [PATCH 04/10] Remove log statement. --- .../time-tickets-summary-employees.component.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx index f68eadb6d..b51d45680 100644 --- a/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx +++ b/client/src/components/time-tickets-summary-employees/time-tickets-summary-employees.component.jsx @@ -218,7 +218,7 @@ const JobRelatedTicketsTable = ({ const handleTableChange = (pagination, filters, sorter) => { setState({ ...state, filteredInfo: filters, sortedInfo: sorter }); }; - console.log(data); + return (
Date: Thu, 26 Jan 2023 11:24:53 -0800 Subject: [PATCH 05/10] IO-2151 Resolve issue removing CSR on conversion. --- .../jobs-convert-button.component.jsx | 11 ++++++-- client/src/graphql/jobs.queries.js | 27 ++----------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx index e20523880..71069e3b2 100644 --- a/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx +++ b/client/src/components/jobs-convert-button/jobs-convert-button.component.jsx @@ -43,14 +43,21 @@ export function JobsConvertButton({ const { t } = useTranslation(); const [form] = Form.useForm(); - const handleConvert = async (values) => { + const handleConvert = async ({ employee_csr, ...values }) => { if (parentFormIsFieldsTouched()) { alert(t("jobs.labels.savebeforeconversion")); return; } setLoading(true); const res = await mutationConvertJob({ - variables: { jobId: job.id, ...values }, + variables: { + jobId: job.id, + job: { + converted: true, + ...(bodyshop.enforce_conversion_csr ? { employee_csr } : {}), + ...values, + }, + }, }); if (values.ca_gst_registrant) { diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index f416ac182..9d89d8ebc 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -1153,31 +1153,8 @@ export const UPDATE_JOBS = gql` `; export const CONVERT_JOB_TO_RO = gql` - mutation CONVERT_JOB_TO_RO( - $jobId: uuid! - $class: String - $ins_co_nm: String! - $ca_gst_registrant: Boolean - $driveable: Boolean - $towin: Boolean - $referral_source: String - $referral_source_extra: String - $employee_csr: uuid - ) { - update_jobs( - where: { id: { _eq: $jobId } } - _set: { - converted: true - ins_co_nm: $ins_co_nm - class: $class - ca_gst_registrant: $ca_gst_registrant - towin: $towin - driveable: $driveable - referral_source: $referral_source - referral_source_extra: $referral_source_extra - employee_csr: $employee_csr - } - ) { + mutation CONVERT_JOB_TO_RO($jobId: uuid!, $job: jobs_set_input!) { + update_jobs(where: { id: { _eq: $jobId } }, _set: $job) { returning { id ro_number From 5cd0527e1606f18be936f9fe1bcaa3f3dffcb71c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 27 Jan 2023 08:00:54 -0800 Subject: [PATCH 06/10] Improved global search. --- .../global-search/global-search.component.jsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/client/src/components/global-search/global-search.component.jsx b/client/src/components/global-search/global-search.component.jsx index 3f3c2c8a2..3b4b0f62c 100644 --- a/client/src/components/global-search/global-search.component.jsx +++ b/client/src/components/global-search/global-search.component.jsx @@ -1,6 +1,5 @@ import { useLazyQuery } from "@apollo/client"; -import { LoadingOutlined } from "@ant-design/icons"; -import { AutoComplete, Divider, Space } from "antd"; +import { AutoComplete, Divider, Input, Space } from "antd"; import _ from "lodash"; import React from "react"; import { useTranslation } from "react-i18next"; @@ -9,7 +8,7 @@ import { GLOBAL_SEARCH_QUERY } from "../../graphql/search.queries"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import AlertComponent from "../alert/alert.component"; import OwnerNameDisplay, { - OwnerNameDisplayFunction, + OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component"; import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component"; export default function GlobalSearch() { @@ -178,13 +177,18 @@ export default function GlobalSearch() { } defaultActiveFirstOption - placeholder={t("general.labels.globalsearch")} - allowClear onSelect={(val, opt) => { history.push(opt.label.props.to); }} - > + > + + ); } From d8ba40979e6de1bd376cd62b60214bd248cebc3b Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 27 Jan 2023 08:35:45 -0800 Subject: [PATCH 07/10] IO-2154 Add expected jobsin production count. --- bodyshop_translations.babel | 23 ++++++++++++++++++- ...chedule-calendar-header-graph.component.js | 14 ++++++++--- .../redux/application/application.sagas.js | 8 +++++++ client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 0358a8c7a..528f344e2 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1,4 +1,4 @@ - +