From b59a5303c613f0f5be2614bb4783d0526d2595a9 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Tue, 5 Oct 2021 09:12:44 -0700 Subject: [PATCH] IO-1430 add Last Contacted date to job. --- bodyshop_translations.babel | 21 +++++++++++ .../job-detail-cards.dates.component.jsx | 6 +++ .../jobs-admin-dates.component.jsx | 7 +++- .../jobs-detail-dates.component.jsx | 7 +++- .../production-list-columns.data.js | 13 +++++++ ...production-list-columns.date.component.jsx | 37 +++++++++++++++---- client/src/graphql/jobs.queries.js | 4 ++ 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 + 13 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/down.sql create mode 100644 hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/up.sql diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index a6876f1cf..513fa13f6 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -19569,6 +19569,27 @@ + + date_last_contacted + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + date_open 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 3623f4291..e1e165408 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 @@ -26,6 +26,12 @@ export default function JobDetailCardsDatesComponent({ loading, data }) { ) ? (
{t("jobs.errors.nodates")}
) : null} + {data.date_last_contacted ? ( + + + {data.date_last_contacted} + + ) : null} {data.date_open ? ( 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 9a4c4a398..a72d28473 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 @@ -74,7 +74,12 @@ export default function JobsAdminDatesChange({ job }) { - + + + + + + - { ), }, + { + title: i18n.t("jobs.fields.date_last_contacted"), + dataIndex: "date_last_contacted", + key: "date_last_contacted", + ellipsis: true, + sorter: (a, b) => dateSort(a.date_last_contacted, b.date_last_contacted), + sortOrder: + state.sortedInfo.columnKey === "date_last_contacted" && + state.sortedInfo.order, + render: (text, record) => ( + + ), + }, { title: i18n.t("jobs.fields.scheduled_delivery"), dataIndex: "scheduled_delivery", diff --git a/client/src/components/production-list-columns/production-list-columns.date.component.jsx b/client/src/components/production-list-columns/production-list-columns.date.component.jsx index 46046aba6..51999c288 100644 --- a/client/src/components/production-list-columns/production-list-columns.date.component.jsx +++ b/client/src/components/production-list-columns/production-list-columns.date.component.jsx @@ -1,17 +1,20 @@ import { useMutation } from "@apollo/client"; -import { DatePicker, Dropdown } from "antd"; +import { DatePicker, Dropdown, TimePicker, Button, Card } from "antd"; import moment from "moment"; -import React from "react"; +import React, { useState } from "react"; import { logImEXEvent } from "../../firebase/firebase.utils"; import { UPDATE_JOB } from "../../graphql/jobs.queries"; import { DateFormatter } from "../../utils/DateFormatter"; +import { useTranslation } from "react-i18next"; + const OneCalendarDay = 60 * 60 * 24 * 1000; const Now = new Date(); -export default function ProductionListDate({ record, field }) { +export default function ProductionListDate({ record, field, time }) { const [updateAlert] = useMutation(UPDATE_JOB); - + const [visible, setVisible] = useState(false); + const { t } = useTranslation(); const handleChange = (date) => { logImEXEvent("product_toggle_date", { field }); @@ -25,27 +28,47 @@ export default function ProductionListDate({ record, field }) { }, }).then(() => { if (record.refetch) record.refetch(); + if (!time) { + setVisible(false); + } }); }; return (
e.stopPropagation()}> + e.stopPropagation()} + > e.stopPropagation()} value={(record[field] && moment(record[field])) || null} onChange={handleChange} + format="MM/DD/YYYY" /> -
+ {time && ( + e.stopPropagation()} + value={(record[field] && moment(record[field])) || null} + onChange={handleChange} + format="hh:mm a" + /> + )} + + } >
setVisible(true)} style={{ height: "19px", }} diff --git a/client/src/graphql/jobs.queries.js b/client/src/graphql/jobs.queries.js index 545c6f40a..94a210a98 100644 --- a/client/src/graphql/jobs.queries.js +++ b/client/src/graphql/jobs.queries.js @@ -122,6 +122,7 @@ export const SUBSCRIPTION_JOBS_IN_PRODUCTION = gql` actual_in scheduled_completion scheduled_delivery + date_last_contacted ins_co_nm clm_total ownr_ph1 @@ -509,6 +510,7 @@ export const GET_JOB_BY_PK = gql` date_open date_scheduled date_invoiced + date_last_contacted date_exported status owner_owing @@ -748,6 +750,7 @@ export const QUERY_JOB_CARD_DETAILS = gql` scheduled_in scheduled_delivery date_invoiced + date_last_contacted date_open date_exported @@ -833,6 +836,7 @@ export const QUERY_TECH_JOB_DETAILS = gql` scheduled_in scheduled_delivery date_invoiced + date_last_contacted date_open date_exported voided diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 02b3a4ccf..cf5b1c7d5 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -1197,6 +1197,7 @@ "date_estimated": "Date Estimated", "date_exported": "Exported", "date_invoiced": "Invoiced", + "date_last_contacted": "Last Contacted Date", "date_open": "Open", "date_scheduled": "Scheduled", "ded_amt": "Deductible", diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json index 3a42c4d5e..3254fb148 100644 --- a/client/src/translations/es/common.json +++ b/client/src/translations/es/common.json @@ -1197,6 +1197,7 @@ "date_estimated": "Fecha estimada", "date_exported": "Exportado", "date_invoiced": "Facturado", + "date_last_contacted": "", "date_open": "Abierto", "date_scheduled": "Programado", "ded_amt": "Deducible", diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json index 229ad4761..fdd764d37 100644 --- a/client/src/translations/fr/common.json +++ b/client/src/translations/fr/common.json @@ -1197,6 +1197,7 @@ "date_estimated": "Date estimée", "date_exported": "Exportés", "date_invoiced": "Facturé", + "date_last_contacted": "", "date_open": "Ouvrir", "date_scheduled": "Prévu", "ded_amt": "Déductible", diff --git a/hasura/metadata/tables.yaml b/hasura/metadata/tables.yaml index 53abe7a6b..b78ca5908 100644 --- a/hasura/metadata/tables.yaml +++ b/hasura/metadata/tables.yaml @@ -2581,6 +2581,7 @@ - date_estimated - date_exported - date_invoiced + - date_last_contacted - date_open - date_scheduled - ded_amt @@ -2829,6 +2830,7 @@ - date_estimated - date_exported - date_invoiced + - date_last_contacted - date_open - date_scheduled - ded_amt @@ -3087,6 +3089,7 @@ - date_estimated - date_exported - date_invoiced + - date_last_contacted - date_open - date_scheduled - ded_amt diff --git a/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/down.sql b/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/down.sql new file mode 100644 index 000000000..c62759f35 --- /dev/null +++ b/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/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_last_contacted" timestamptz +-- null; diff --git a/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/up.sql b/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/up.sql new file mode 100644 index 000000000..f8c69c375 --- /dev/null +++ b/hasura/migrations/1633449284867_alter_table_public_jobs_add_column_date_last_contacted/up.sql @@ -0,0 +1,2 @@ +alter table "public"."jobs" add column "date_last_contacted" timestamptz + null;