From 8f9f80e8ee140552f72c62392ce67543dd976d9e Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 5 Dec 2022 14:38:36 -0800 Subject: [PATCH 1/6] IO-2084 Add actualr epair start date. --- bodyshop_translations.babel | 21 ++++++++++++++++ .../job-detail-cards.dates.component.jsx | 8 +++++-- .../jobs-admin-dates.component.jsx | 3 +++ .../jobs-detail-dates.component.jsx | 11 ++++++++- .../production-list-columns.data.js | 24 +++++++++++++++++++ client/src/graphql/jobs.queries.js | 6 ++++- client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + hasura/metadata/tables.yaml | 3 +++ .../down.sql | 4 ++++ .../up.sql | 2 ++ 12 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/down.sql create mode 100644 hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/up.sql diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 130470e31..b70cd7802 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -22285,6 +22285,27 @@ + + date_repairstarted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + date_scheduled false diff --git a/client/src/components/job-detail-cards/job-detail-cards.dates.component.jsx b/client/src/components/job-detail-cards/job-detail-cards.dates.component.jsx index e1e165408..0dcc620ef 100644 --- a/client/src/components/job-detail-cards/job-detail-cards.dates.component.jsx +++ b/client/src/components/job-detail-cards/job-detail-cards.dates.component.jsx @@ -59,14 +59,18 @@ export default function JobDetailCardsDatesComponent({ loading, data }) { {data.scheduled_in} ) : null} - {data.actual_in ? ( {data.actual_in} ) : null} - + {data.date_repairstarted ? ( + + + {data.date_repairstarted} + + ) : null} {data.scheduled_completion ? ( diff --git a/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx b/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx index b0fc2f05c..d497c9618 100644 --- a/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx +++ b/client/src/components/jobs-admin-dates/jobs-admin-dates.component.jsx @@ -126,6 +126,9 @@ export function JobsAdminDatesChange({ insertAuditTrail, job }) { + + + - + @@ -73,6 +76,12 @@ export function JobsDetailDatesComponent({ jobRO, job, bodyshop }) { title={t("jobs.labels.calc_repair_days")} /> + + + { ), }, + //Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client. // { // title: i18n.t("vehicles.fields.v_paint_codes", { number: "" }), @@ -555,6 +556,29 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => { // // ) : null, // }, + { + title: i18n.t("jobs.fields.date_repairstarted"), + dataIndex: "date_repairstarted", + key: "date_repairstarted", + ellipsis: true, + sorter: (a, b) => dateSort(a.date_repairstarted, b.date_repairstarted), + sortOrder: + state.sortedInfo.columnKey === "date_repairstarted" && + state.sortedInfo.order, + render: (text, record) => ( + + ), + }, + { + title: i18n.t("jobs.fields.date_repairstarted") + " (HH:MM)", + dataIndex: "date_repairstarted_time", + key: "date_repairstarted_time", + ellipsis: true, + + render: (text, record) => ( + {record.date_repairstarted} + ), + }, ]; }; export default r; diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 33363a5d3..2dd12f5cd 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -142,6 +142,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql` employee_refinish employee_prep employee_csr + date_repairstarted joblines_status { part_type status @@ -221,6 +222,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql` employee_refinish employee_prep employee_csr + date_repairstarted joblines_status { part_type status @@ -302,6 +304,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql` employee_prep employee_csr suspended + date_repairstarted joblines_status { part_type status @@ -672,6 +675,7 @@ export const GET_JOB_BY_PK = gql` date_towin date_rentalresp date_exported + date_repairstarted status owner_owing tax_registration_number @@ -917,7 +921,7 @@ export const QUERY_JOB_CARD_DETAILS = gql` date_next_contact date_open date_exported - + date_repairstarted date_scheduled date_estimated employee_body_rel { diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 247263894..facde8e6a 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1351,6 +1351,7 @@ "date_next_contact": "Next Contact Date", "date_open": "Open", "date_rentalresp": "Shop Rental Responsibility Start", + "date_repairstarted": "Repairs Started", "date_scheduled": "Scheduled", "date_towin": "Towed In", "ded_amt": "Deductible", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 7aee1ce3e..7f38468c3 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1351,6 +1351,7 @@ "date_next_contact": "", "date_open": "Abierto", "date_rentalresp": "", + "date_repairstarted": "", "date_scheduled": "Programado", "date_towin": "", "ded_amt": "Deducible", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index fc95cb71d..8082b4bf0 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1351,6 +1351,7 @@ "date_next_contact": "", "date_open": "Ouvrir", "date_rentalresp": "", + "date_repairstarted": "", "date_scheduled": "Prévu", "date_towin": "", "ded_amt": "Déductible", diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index f1678c62e..3f600c70a 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -3025,6 +3025,7 @@ - date_next_contact - date_open - date_rentalresp + - date_repairstarted - date_scheduled - date_towin - ded_amt @@ -3288,6 +3289,7 @@ - date_next_contact - date_open - date_rentalresp + - date_repairstarted - date_scheduled - date_towin - ded_amt @@ -3561,6 +3563,7 @@ - date_next_contact - date_open - date_rentalresp + - date_repairstarted - date_scheduled - date_towin - ded_amt diff --git a/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/down.sql b/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/down.sql new file mode 100644 index 000000000..3728685cb --- /dev/null +++ b/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/down.sql @@ -0,0 +1,4 @@ +-- Could not auto-generate a down migration. +-- Please write an appropriate down migration for the SQL below: +-- alter table "public"."jobs" add column "date_repairstarted" timestamptz +-- null; diff --git a/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/up.sql b/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/up.sql new file mode 100644 index 000000000..dfe98e45b --- /dev/null +++ b/hasura/migrations/1670278883764_alter_table_public_jobs_add_column_date_repairstarted/up.sql @@ -0,0 +1,2 @@ +alter table "public"."jobs" add column "date_repairstarted" timestamptz + null; From b2b754bee0a09fee57748af519686d566802d8c7 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 5 Dec 2022 15:20:37 -0800 Subject: [PATCH 2/6] IO-2118 Add expected production hours to scheduling. --- bodyshop_translations.babel | 21 +++++++++++++++++++ ...chedule-calendar-header-graph.component.js | 11 +++++++--- .../redux/application/application.sagas.js | 17 +++++++++++++++ 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, 49 insertions(+), 3 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index b70cd7802..5be02b5ad 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -736,6 +736,27 @@ + + expectedprodhrs + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + history false diff --git a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js index 7dfb88012..5916ca583 100644 --- a/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js +++ b/client/src/components/schedule-calendar-wrapper/schedule-calendar-header-graph.component.js @@ -1,4 +1,4 @@ -import { Popover } from "antd"; +import { Popover, Space } from "antd"; import React, { useMemo } from "react"; import { connect } from "react-redux"; import { @@ -13,7 +13,8 @@ import { import { createStructuredSelector } from "reselect"; import { selectBodyshop } from "../../redux/user/user.selectors"; import { RadarChartOutlined } from "@ant-design/icons"; - +import { useTranslation } from "react-i18next"; +import { load } from "@fingerprintjs/fingerprintjs"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop, }); @@ -23,7 +24,7 @@ const mapDispatchToProps = (dispatch) => ({ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) { const { ssbuckets } = bodyshop; - + const { t } = useTranslation(); const data = useMemo(() => { return ( (loadData && @@ -43,6 +44,10 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) { const popContent = (
+ + {t("appointments.labels.expectedprodhrs")} + {loadData.expectedHours.toFixed(1)} + { //Add all of the jobs currently in production to the buckets so that we have a starting point. const bucketId = CheckJobBucket(buckets, item); + load.productionHours = + load.productionHours + + item.labhrs.aggregate.sum.mod_lb_hrs + + item.larhrs.aggregate.sum.mod_lb_hrs; if (bucketId) { load.productionTotal[bucketId].count = load.productionTotal[bucketId].count + 1; @@ -131,6 +136,10 @@ export function* calculateScheduleLoad({ payload: end }) { } }); + console.log( + "🚀 ~ file: application.sagas.js:160 ~ function*calculateScheduleLoad ~ load.productionTotal", + load.productionTotal + ); //Propagate the expected load to each day. const range = Math.round(moment.duration(end.diff(today)).asDays()); for (var day = 0; day < range; day++) { @@ -149,6 +158,10 @@ export function* calculateScheduleLoad({ payload: end }) { load[current].jobsIn || [], load[current].jobsOut || [] ); + load[current].expectedHours = + load.productionHours + + (load[current].hoursIn || 0) - + (load[current].hoursOut || 0); } else { load[current].expectedLoad = CalculateLoad( load[prev].expectedLoad, @@ -156,6 +169,10 @@ export function* calculateScheduleLoad({ payload: end }) { load[current].jobsIn || [], load[current].jobsOut || [] ); + load[current].expectedHours = + load[prev].expectedHours + + (load[current].hoursIn || 0) - + (load[current].hoursOut || 0); } } yield put(setProblemJobs(problemJobs)); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index facde8e6a..d7559d54e 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Canceled appointment for: ", "completingjobs": "Completing Jobs", "dataconsistency": "{{ro_number}} has a data consistency issue. It has been excluded for scheduling purposes. CODE: {{code}}.", + "expectedprodhrs": "Expected Production Hours:", "history": "History", "inproduction": "Jobs In Production", "manualevent": "Add Manual Appointment", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 7f38468c3..ce0b8a000 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Cita cancelada para:", "completingjobs": "", "dataconsistency": "", + "expectedprodhrs": "", "history": "", "inproduction": "", "manualevent": "", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 8082b4bf0..712b3fcfb 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -50,6 +50,7 @@ "cancelledappointment": "Rendez-vous annulé pour:", "completingjobs": "", "dataconsistency": "", + "expectedprodhrs": "", "history": "", "inproduction": "", "manualevent": "", From dad3dc9e421480becac613d4740719a9cd61756c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Thu, 8 Dec 2022 14:47:51 -0800 Subject: [PATCH 3/6] Autohouse based updates. --- server/data/autohouse.js | 32 ++++++++++++++++++++++++-------- server/graphql-client/queries.js | 2 ++ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/server/data/autohouse.js b/server/data/autohouse.js index 679a455b9..b30196153 100644 --- a/server/data/autohouse.js +++ b/server/data/autohouse.js @@ -334,12 +334,17 @@ const CreateRepairOrderTag = (job, errorCallback) => { .format(AhDateFormat)) || "", InsInspDate: null, - StartDate: - (job.actual_in && - moment(job.actual_in) - .tz(job.bodyshop.timezone) - .format(AhDateFormat)) || - "", + StartDate: job.date_repairstarted + ? (job.date_repairstarted && + moment(job.date_repairstarted) + .tz(job.bodyshop.timezone) + .format(AhDateFormat)) || + "" + : (job.date_repairstarted && + moment(job.actual_in) + .tz(job.bodyshop.timezone) + .format(AhDateFormat)) || + "", PartsOrder: null, TeardownHold: null, SupplementSubmittedDate: null, @@ -496,7 +501,13 @@ const CreateRepairOrderTag = (job, errorCallback) => { FrameHours: job.job_totals.rates.laf.hours.toFixed(2), GlassHours: job.job_totals.rates.lag.hours.toFixed(2), DetailHours: job.job_totals.rates.lad.hours.toFixed(2), - LaborMiscHours: 0, + LaborMiscHours: ( + job.job_totals.rates.la1.hours + + job.job_totals.rates.la2.hours + + job.job_totals.rates.la3.hours + + job.job_totals.rates.la4.hours + + job.job_totals.rates.lau.hours + ).toFixed(2), PartsTotal: Dinero(job.job_totals.parts.parts.total).toFormat( AHDineroFormat @@ -579,7 +590,12 @@ const CreateRepairOrderTag = (job, errorCallback) => { ), DetailLaborTotalCost: repairCosts.DetailLaborTotalCost.toFormat(AHDineroFormat), - LaborMiscTotal: 0, + LaborMiscTotal: Dinero(job.job_totals.rates.la1.total) + .add(Dinero(job.job_totals.rates.la2.total)) + .add(Dinero(job.job_totals.rates.la3.total)) + .add(Dinero(job.job_totals.rates.la4.total)) + .add(Dinero(job.job_totals.rates.lau.total)) + .toFormat(AHDineroFormat), LaborMiscTotalCost: 0, MiscellaneousChargeTotal: 0, MiscellaneousChargeTotalCost: 0, diff --git a/server/graphql-client/queries.js b/server/graphql-client/queries.js index cc03153dd..e0c1509c7 100644 --- a/server/graphql-client/queries.js +++ b/server/graphql-client/queries.js @@ -695,6 +695,7 @@ exports.AUTOHOUSE_QUERY = `query AUTOHOUSE_EXPORT($start: timestamptz, $bodyshop driveable parts_tax_rates ded_amt + date_repairstarted joblines(where: {removed: {_eq: false}}) { id line_no @@ -1010,6 +1011,7 @@ vehicle{ date_scheduled date_invoiced date_exported + date_repairstarted status owner_owing tax_registration_number From 4c42522f3a4964ef6349bab985c09d43c15d3da6 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Fri, 9 Dec 2022 08:09:53 -0800 Subject: [PATCH 4/6] IO-2122 Add time ticket report. --- bodyshop_translations.babel | 23 ++++++++++++++++++- ...chedule-calendar-header-graph.component.js | 13 ++++------- client/src/translations/en_us/common.json | 1 + client/src/translations/es/common.json | 1 + client/src/translations/fr/common.json | 1 + client/src/utils/TemplateConstants.js | 8 +++++++ 6 files changed, 38 insertions(+), 9 deletions(-) diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 5be02b5ad..5e7495299 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -1,4 +1,4 @@ - +