diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index 815350435..5169f8147 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -18071,6 +18071,27 @@
+
+ importnote
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
inproduction
false
@@ -18853,6 +18874,27 @@
+
+ supplementnote
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
suspense
false
diff --git a/client/src/components/jobs-available-table/jobs-available-table.container.jsx b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
index dce8d4593..22a9a97c8 100644
--- a/client/src/components/jobs-available-table/jobs-available-table.container.jsx
+++ b/client/src/components/jobs-available-table/jobs-available-table.container.jsx
@@ -2,7 +2,7 @@ import {
useApolloClient,
useLazyQuery,
useMutation,
- useQuery
+ useQuery,
} from "@apollo/react-hooks";
import { notification } from "antd";
import Axios from "axios";
@@ -18,11 +18,14 @@ import { logImEXEvent } from "../../firebase/firebase.utils";
import {
DELETE_AVAILABLE_JOB,
QUERY_AVAILABLE_JOBS,
- QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK
+ QUERY_AVAILABLE_NEW_JOBS_EST_DATA_BY_PK,
} from "../../graphql/available-jobs.queries";
import { INSERT_NEW_JOB, UPDATE_JOB } from "../../graphql/jobs.queries";
import { SEARCH_VEHICLE_BY_VIN } from "../../graphql/vehicles.queries";
-import { selectBodyshop } from "../../redux/user/user.selectors";
+import {
+ selectBodyshop,
+ selectCurrentUser,
+} from "../../redux/user/user.selectors";
import AlertComponent from "../alert/alert.component";
import JobsFindModalContainer from "../jobs-find-modal/jobs-find-modal.container";
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
@@ -30,12 +33,14 @@ import OwnerFindModalContainer from "../owner-find-modal/owner-find-modal.contai
import { GetSupplementDelta } from "./jobs-available-supplement.estlines.util";
import HeaderFields from "./jobs-available-supplement.headerfields";
import JobsAvailableTableComponent from "./jobs-available-table.component";
-
+import moment from "moment";
+import { INSERT_NEW_NOTE } from "../../graphql/notes.queries";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
+ currentUser: selectCurrentUser,
});
-export function JobsAvailableContainer({ bodyshop }) {
+export function JobsAvailableContainer({ bodyshop, currentUser }) {
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_JOBS, {
fetchPolicy: "network-only",
});
@@ -49,6 +54,8 @@ export function JobsAvailableContainer({ bodyshop }) {
const [selectedJob, setSelectedJob] = useState(null);
const [selectedOwner, setSelectedOwner] = useState(null);
const [insertLoading, setInsertLoading] = useState(false);
+
+ const [insertNote] = useMutation(INSERT_NEW_NOTE);
const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB);
const [updateJob] = useMutation(UPDATE_JOB);
@@ -108,6 +115,16 @@ export function JobsAvailableContainer({ bodyshop }) {
clm_total: Dinero(newTotals.totals.total_repairs).toFormat("0.00"),
owner_owing: Dinero(newTotals.totals.custPayable.total).toFormat("0.00"),
job_totals: newTotals,
+ date_open: moment(),
+ notes: {
+ data: {
+ created_by: currentUser.email,
+ text: t("jobs.labels.importnote", {
+ date: moment().format("MM/DD/yyy"),
+ time: moment().format("hh:mm a"),
+ }),
+ },
+ },
queued_for_parts: true,
...(existingVehicles && existingVehicles.data.vehicles.length > 0
? { vehicleid: existingVehicles.data.vehicles[0].id, vehicle: null }
@@ -225,6 +242,7 @@ export function JobsAvailableContainer({ bodyshop }) {
},
});
//Job has been inserted. Clean up the available jobs record.
+
deleteJob({
variables: { id: estData.data.available_jobs_by_pk.id },
}).then((r) => {
@@ -240,6 +258,21 @@ export function JobsAvailableContainer({ bodyshop }) {
refetch();
setInsertLoading(false);
});
+
+ await insertNote({
+ variables: {
+ noteInput: [
+ {
+ jobid: selectedJob,
+ created_by: currentUser.email,
+ text: t("jobs.labels.supplementnote", {
+ date: moment().format("MM/DD/yyy"),
+ time: moment().format("hh:mm a"),
+ }),
+ },
+ ],
+ },
+ });
}
};
diff --git a/client/src/components/jobs-detail-dates/jobs-detail-dates.component.jsx b/client/src/components/jobs-detail-dates/jobs-detail-dates.component.jsx
index 187f61bf5..4ceefe853 100644
--- a/client/src/components/jobs-detail-dates/jobs-detail-dates.component.jsx
+++ b/client/src/components/jobs-detail-dates/jobs-detail-dates.component.jsx
@@ -1,4 +1,4 @@
-import { Form } from "antd";
+import { DatePicker, Form } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
@@ -22,7 +22,7 @@ export function JobsDetailDatesComponent({ jobRO, job }) {
label={t("jobs.fields.date_estimated")}
name="date_estimated"
>
-
+
diff --git a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx
index 4e87de5b9..553d18a71 100644
--- a/client/src/pages/jobs-detail/jobs-detail.page.component.jsx
+++ b/client/src/pages/jobs-detail/jobs-detail.page.component.jsx
@@ -144,6 +144,9 @@ export function JobsDetailPage({
initialValues={{
...job,
loss_date: job.loss_date ? moment(job.loss_date) : null,
+ date_estimated: job.date_estimated
+ ? moment(job.date_estimated)
+ : null,
}}
>
diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json
index 115522111..8862b058b 100644
--- a/client/src/translations/en_us/common.json
+++ b/client/src/translations/en_us/common.json
@@ -1101,6 +1101,7 @@
"gppercent": "% G.P.",
"hrs_claimed": "Hours Claimed",
"hrs_total": "Hours Total",
+ "importnote": "The job was initially imported on {{date}} at {{time}}.",
"inproduction": "In Production",
"job": "Job Details",
"jobcosting": "Job Costing",
@@ -1140,6 +1141,7 @@
"state_tax_amt": "State/Provincial Taxes",
"subletstotal": "Sublets Total",
"subtotal": "Subtotal",
+ "supplementnote": "The job had a supplement imported on {{date}} at {{time}}.",
"suspense": "Suspense",
"total_cost": "Total Cost",
"total_cust_payable": "Total Customer Amount Payable",
diff --git a/client/src/translations/es/common.json b/client/src/translations/es/common.json
index 1c6ef45df..983522933 100644
--- a/client/src/translations/es/common.json
+++ b/client/src/translations/es/common.json
@@ -1101,6 +1101,7 @@
"gppercent": "",
"hrs_claimed": "",
"hrs_total": "",
+ "importnote": "",
"inproduction": "",
"job": "",
"jobcosting": "",
@@ -1140,6 +1141,7 @@
"state_tax_amt": "",
"subletstotal": "",
"subtotal": "",
+ "supplementnote": "",
"suspense": "",
"total_cost": "",
"total_cust_payable": "",
diff --git a/client/src/translations/fr/common.json b/client/src/translations/fr/common.json
index 245d3a340..d45dbbbae 100644
--- a/client/src/translations/fr/common.json
+++ b/client/src/translations/fr/common.json
@@ -1101,6 +1101,7 @@
"gppercent": "",
"hrs_claimed": "",
"hrs_total": "",
+ "importnote": "",
"inproduction": "",
"job": "",
"jobcosting": "",
@@ -1140,6 +1141,7 @@
"state_tax_amt": "",
"subletstotal": "",
"subtotal": "",
+ "supplementnote": "",
"suspense": "",
"total_cost": "",
"total_cust_payable": "",
diff --git a/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/down.yaml b/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/down.yaml
new file mode 100644
index 000000000..35c68f05c
--- /dev/null
+++ b/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/down.yaml
@@ -0,0 +1,6 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE "public"."jobs" ALTER COLUMN "date_estimated" TYPE timestamp
+ with time zone;
+ type: run_sql
diff --git a/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/up.yaml b/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/up.yaml
new file mode 100644
index 000000000..2b2679c86
--- /dev/null
+++ b/hasura/migrations/1612219431186_alter_table_public_jobs_alter_column_date_estimated/up.yaml
@@ -0,0 +1,5 @@
+- args:
+ cascade: false
+ read_only: false
+ sql: ALTER TABLE "public"."jobs" ALTER COLUMN "date_estimated" TYPE date;
+ type: run_sql