IO-1430 add Last Contacted date to job.

This commit is contained in:
Patrick Fic
2021-10-05 09:12:44 -07:00
parent 9a72abbed0
commit b59a5303c6
13 changed files with 98 additions and 9 deletions

View File

@@ -19569,6 +19569,27 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>date_last_contacted</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-MX</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-CA</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>date_open</name>
<definition_loaded>false</definition_loaded>

View File

@@ -26,6 +26,12 @@ export default function JobDetailCardsDatesComponent({ loading, data }) {
) ? (
<div>{t("jobs.errors.nodates")}</div>
) : null}
{data.date_last_contacted ? (
<Timeline.Item>
<label>{t("jobs.fields.date_last_contacted")}: </label>
<DateTimeFormatter>{data.date_last_contacted}</DateTimeFormatter>
</Timeline.Item>
) : null}
{data.date_open ? (
<Timeline.Item>
<label>{t("jobs.fields.date_open")}: </label>

View File

@@ -74,7 +74,12 @@ export default function JobsAdminDatesChange({ job }) {
<Form.Item label={t("jobs.fields.actual_in")} name="actual_in">
<DateTimePicker />
</Form.Item>
<Form.Item
label={t("jobs.fields.date_last_contacted")}
name="date_last_contacted"
>
<DateTimePicker />
</Form.Item>
<Form.Item
label={t("jobs.fields.scheduled_completion")}
name="scheduled_completion"

View File

@@ -69,6 +69,12 @@ export function JobsDetailDatesComponent({ jobRO, job, bodyshop }) {
</Tooltip>
</FormRow>
<FormRow header={t("jobs.forms.repairdates")}>
<Form.Item
label={t("jobs.fields.date_last_contacted")}
name="date_last_contacted"
>
<DateTimePicker />
</Form.Item>
<Form.Item
label={t("jobs.fields.scheduled_completion")}
name="scheduled_completion"
@@ -93,7 +99,6 @@ export function JobsDetailDatesComponent({ jobRO, job, bodyshop }) {
);
}}
</Form.Item>
<Form.Item
label={t("jobs.fields.scheduled_delivery")}
name="scheduled_delivery"

View File

@@ -97,6 +97,19 @@ const r = ({ technician, state }) => {
<ProductionListDate record={record} field="scheduled_completion" />
),
},
{
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) => (
<ProductionListDate time record={record} field="date_last_contacted" />
),
},
{
title: i18n.t("jobs.fields.scheduled_delivery"),
dataIndex: "scheduled_delivery",

View File

@@ -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 (
<div>
<Dropdown
trigger={["click"]}
//trigger={["click"]}
visible={visible}
style={{
height: "19px",
}}
overlay={
<div onClick={(e) => e.stopPropagation()}>
<Card
style={{ padding: "1rem" }}
onClick={(e) => e.stopPropagation()}
>
<DatePicker
onClick={(e) => e.stopPropagation()}
value={(record[field] && moment(record[field])) || null}
onChange={handleChange}
format="MM/DD/YYYY"
/>
</div>
{time && (
<TimePicker
onClick={(e) => e.stopPropagation()}
value={(record[field] && moment(record[field])) || null}
onChange={handleChange}
format="hh:mm a"
/>
)}
<Button onClick={() => setVisible(false)}>
{t("general.actions.close")}
</Button>
</Card>
}
>
<div
onClick={() => setVisible(true)}
style={{
height: "19px",
}}

View File

@@ -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

View File

@@ -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",

View File

@@ -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",

View File

@@ -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",

View File

@@ -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

View File

@@ -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;

View File

@@ -0,0 +1,2 @@
alter table "public"."jobs" add column "date_last_contacted" timestamptz
null;