Updates to production list drawer. IO-221

This commit is contained in:
Patrick Fic
2021-03-03 11:46:45 -08:00
parent 598741372a
commit 7b35403981
9 changed files with 144 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
<babeledit_project be_version="2.7.1" version="1.2"> <babeledit_project version="1.2" be_version="2.7.1">
<!-- <!--
BabelEdit project file BabelEdit project file
@@ -26546,27 +26546,6 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>cycletime</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> <concept_node>
<name>detailpriority</name> <name>detailpriority</name>
<definition_loaded>false</definition_loaded> <definition_loaded>false</definition_loaded>
@@ -26714,6 +26693,27 @@
</translation> </translation>
</translations> </translations>
</concept_node> </concept_node>
<concept_node>
<name>touchtime</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>
</children> </children>
</folder_node> </folder_node>
<folder_node> <folder_node>

View File

@@ -6,7 +6,7 @@ import { UPDATE_JOB } from "../../graphql/jobs.queries";
import JobEmployeeAssignmentsComponent from "./job-employee-assignments.component"; import JobEmployeeAssignmentsComponent from "./job-employee-assignments.component";
import { logImEXEvent } from "../../firebase/firebase.utils"; import { logImEXEvent } from "../../firebase/firebase.utils";
export default function JobEmployeeAssignmentsContainer({ job }) { export default function JobEmployeeAssignmentsContainer({ job, refetch }) {
const { t } = useTranslation(); const { t } = useTranslation();
const [updateJob] = useMutation(UPDATE_JOB); const [updateJob] = useMutation(UPDATE_JOB);
@@ -21,6 +21,7 @@ export default function JobEmployeeAssignmentsContainer({ job }) {
refetchQueries: ["GET_JOB_BY_PK"], refetchQueries: ["GET_JOB_BY_PK"],
awaitRefetchQueries: true, awaitRefetchQueries: true,
}); });
if (refetch) refetch();
if (!!result.errors) { if (!!result.errors) {
notification["error"]({ notification["error"]({

View File

@@ -105,6 +105,15 @@ export function JobsDetailGeneral({ bodyshop, jobRO, job, form }) {
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label={t("jobs.fields.alt_transport")} name="alt_transport">
<Select disabled={jobRO}>
{bodyshop.appt_alt_transport.map((s) => (
<Select.Option key={s} value={s}>
{s}
</Select.Option>
))}
</Select>
</Form.Item>
</FormRow> </FormRow>
<Row gutter={[16, 16]}> <Row gutter={[16, 16]}>
<Col {...lossColFields}> <Col {...lossColFields}>

View File

@@ -191,9 +191,9 @@ const r = [
render: (text, record) => <ProductionListColumnNote record={record} />, render: (text, record) => <ProductionListColumnNote record={record} />,
}, },
{ {
title: i18n.t("production.labels.cycletime"), title: i18n.t("production.labels.touchtime"),
dataIndex: "ct", dataIndex: "tt",
key: "ct", key: "tt",
render: (text, record) => { render: (text, record) => {
return <ProductionlistColumnTouchTime job={record} />; return <ProductionlistColumnTouchTime job={record} />;
}, },

View File

@@ -1,12 +1,21 @@
import { Descriptions, Drawer } from "antd"; import { useQuery } from "@apollo/client";
import { Descriptions, Drawer, Space } from "antd";
import queryString from "query-string"; import queryString from "query-string";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useHistory, useLocation } from "react-router-dom"; import { useHistory, useLocation } from "react-router-dom";
import { QUERY_JOB_CARD_DETAILS } from "../../graphql/jobs.queries";
import CurrencyFormatter from "../../utils/CurrencyFormatter"; import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter"; import { DateFormatter } from "../../utils/DateFormatter";
import PartsStatusPie from "../parts-status-pie/parts-status-pie.component"; import AlertComponent from "../alert/alert.component";
import StartChatButton from "../chat-open-button/chat-open-button.component";
import JobDetailCardsDocumentsComponent from "../job-detail-cards/job-detail-cards.documents.component";
import JobDetailCardsNotesComponent from "../job-detail-cards/job-detail-cards.notes.component";
import JobDetailCardsPartsComponent from "../job-detail-cards/job-detail-cards.parts.component";
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
import ProductionRemoveButton from "../production-remove-button/production-remove-button.component"; import ProductionRemoveButton from "../production-remove-button/production-remove-button.component";
import ScheduleEventAt from "../schedule-event/schedule-event.at.component";
export default function ProductionListDetail({ jobs }) { export default function ProductionListDetail({ jobs }) {
const search = queryString.parse(useLocation().search); const search = queryString.parse(useLocation().search);
@@ -20,45 +29,87 @@ export default function ProductionListDetail({ jobs }) {
delete search.selected; delete search.selected;
history.push({ search: queryString.stringify(search) }); history.push({ search: queryString.stringify(search) });
}; };
const { loading, error, data, refetch } = useQuery(QUERY_JOB_CARD_DETAILS, {
variables: { id: selected },
skip: !selected,
});
return ( return (
<Drawer <Drawer
title={t("production.labels.jobdetail")} title={
<Space>
<span>{t("production.labels.jobdetail")}</span>
<span>{theJob.ro_number}</span>
<ProductionRemoveButton jobId={theJob.id} />
</Space>
}
placement="right" placement="right"
width={"33%"} width={"33%"}
onClose={handleClose} onClose={handleClose}
visible={!!selected} visible={selected}
> >
<div> {loading && <LoadingSkeleton />}
<Descriptions bordered size="small" column={1}> {error && <AlertComponent error={JSON.stringify(error)} />}
<Descriptions.Item label={t("jobs.fields.ro_number")}> {!loading && data && (
{theJob.ro_number || ""} <div>
</Descriptions.Item> <JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
<Descriptions.Item label={t("jobs.fields.owner")}> <Descriptions bordered size="small" column={1}>
{`${theJob.ownr_fn || ""} ${theJob.ownr_ln || ""} ${ <Descriptions.Item label={t("jobs.fields.ro_number")}>
theJob.ownr_co_nm || "" {theJob.ro_number || ""}
}`} </Descriptions.Item>
</Descriptions.Item> <Descriptions.Item label={t("jobs.fields.alt_transport")}>
<Descriptions.Item label={t("jobs.fields.vehicle")}> <Space>
{`${theJob.v_model_yr || ""} ${theJob.v_color || ""} ${ {data.jobs_by_pk.alt_transport || ""}
theJob.v_make_desc || "" <ScheduleEventAt event={{ job: data.jobs_by_pk }} />
} ${theJob.v_model_desc || ""}`} </Space>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.clm_total")}> <Descriptions.Item label={t("jobs.fields.clm_no")}>
<CurrencyFormatter>{theJob.clm_total}</CurrencyFormatter> {theJob.clm_no || ""}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.actual_in")}> <Descriptions.Item label={t("jobs.fields.ins_co_nm")}>
<DateFormatter>{theJob.actual_in}</DateFormatter> {theJob.ins_co_nm || ""}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.scheduled_completion")}> <Descriptions.Item label={t("jobs.fields.owner")}>
<DateFormatter>{theJob.scheduled_completion}</DateFormatter> {`${theJob.ownr_fn || ""} ${theJob.ownr_ln || ""} ${
</Descriptions.Item> theJob.ownr_co_nm || ""
<Descriptions.Item label={t("jobs.labels.parts")}> }`}
<PartsStatusPie joblines_status={theJob.joblines_status} /> <StartChatButton
</Descriptions.Item> phone={data.jobs_by_pk.ownr_ph1}
</Descriptions> jobid={data.jobs_by_pk.id}
<ProductionRemoveButton jobId={theJob.id} /> />
</div> </Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.vehicle")}>
{`${theJob.v_model_yr || ""} ${theJob.v_color || ""} ${
theJob.v_make_desc || ""
} ${theJob.v_model_desc || ""}`}
</Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.clm_total")}>
<CurrencyFormatter>{theJob.clm_total}</CurrencyFormatter>
</Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.actual_in")}>
<DateFormatter>{theJob.actual_in}</DateFormatter>
</Descriptions.Item>
<Descriptions.Item label={t("jobs.fields.scheduled_completion")}>
<DateFormatter>{theJob.scheduled_completion}</DateFormatter>
</Descriptions.Item>
</Descriptions>
<JobDetailCardsPartsComponent
loading={loading}
data={data ? data.jobs_by_pk : null}
/>
<JobDetailCardsNotesComponent
loading={loading}
data={data ? data.jobs_by_pk : null}
/>
<JobDetailCardsDocumentsComponent
loading={loading}
data={data ? data.jobs_by_pk : null}
/>
</div>
)}
</Drawer> </Drawer>
); );
} }

View File

@@ -327,6 +327,7 @@ export const GET_JOB_BY_PK = gql`
first_name first_name
last_name last_name
} }
alt_transport
intakechecklist intakechecklist
csr csr
loss_desc loss_desc
@@ -554,6 +555,7 @@ export const QUERY_JOB_CARD_DETAILS = gql`
ownr_fn ownr_fn
employee_body employee_body
employee_refinish employee_refinish
alt_transport
ownr_ln ownr_ln
ownr_ph1 ownr_ph1
ownr_ea ownr_ea
@@ -610,7 +612,21 @@ export const QUERY_JOB_CARD_DETAILS = gql`
date_scheduled date_scheduled
date_estimated date_estimated
employee_body_rel {
id
first_name
last_name
}
employee_refinish_rel {
id
first_name
last_name
}
employee_prep_rel {
id
first_name
last_name
}
notes { notes {
id id
text text

View File

@@ -1605,14 +1605,14 @@
"alerton": "Add alert to job", "alerton": "Add alert to job",
"bodyhours": "B", "bodyhours": "B",
"bodypriority": "B/P", "bodypriority": "B/P",
"cycletime": "C/T",
"detailpriority": "D/P", "detailpriority": "D/P",
"employeesearch": "Employee Search", "employeesearch": "Employee Search",
"jobdetail": "Job Details", "jobdetail": "Job Details",
"note": "Production Note", "note": "Production Note",
"paintpriority": "P/P", "paintpriority": "P/P",
"refinishhours": "R", "refinishhours": "R",
"sublets": "Sublets" "sublets": "Sublets",
"touchtime": "T/T"
}, },
"successes": { "successes": {
"removed": "Job removed from production." "removed": "Job removed from production."

View File

@@ -1605,14 +1605,14 @@
"alerton": "", "alerton": "",
"bodyhours": "", "bodyhours": "",
"bodypriority": "", "bodypriority": "",
"cycletime": "",
"detailpriority": "", "detailpriority": "",
"employeesearch": "", "employeesearch": "",
"jobdetail": "", "jobdetail": "",
"note": "", "note": "",
"paintpriority": "", "paintpriority": "",
"refinishhours": "", "refinishhours": "",
"sublets": "" "sublets": "",
"touchtime": ""
}, },
"successes": { "successes": {
"removed": "" "removed": ""

View File

@@ -1605,14 +1605,14 @@
"alerton": "", "alerton": "",
"bodyhours": "", "bodyhours": "",
"bodypriority": "", "bodypriority": "",
"cycletime": "",
"detailpriority": "", "detailpriority": "",
"employeesearch": "", "employeesearch": "",
"jobdetail": "", "jobdetail": "",
"note": "", "note": "",
"paintpriority": "", "paintpriority": "",
"refinishhours": "", "refinishhours": "",
"sublets": "" "sublets": "",
"touchtime": ""
}, },
"successes": { "successes": {
"removed": "" "removed": ""