|
|
|
|
@@ -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 React from "react";
|
|
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
import { useHistory, useLocation } from "react-router-dom";
|
|
|
|
|
import { QUERY_JOB_CARD_DETAILS } from "../../graphql/jobs.queries";
|
|
|
|
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
|
|
|
|
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 ScheduleEventAt from "../schedule-event/schedule-event.at.component";
|
|
|
|
|
|
|
|
|
|
export default function ProductionListDetail({ jobs }) {
|
|
|
|
|
const search = queryString.parse(useLocation().search);
|
|
|
|
|
@@ -20,45 +29,87 @@ export default function ProductionListDetail({ jobs }) {
|
|
|
|
|
delete search.selected;
|
|
|
|
|
history.push({ search: queryString.stringify(search) });
|
|
|
|
|
};
|
|
|
|
|
const { loading, error, data, refetch } = useQuery(QUERY_JOB_CARD_DETAILS, {
|
|
|
|
|
variables: { id: selected },
|
|
|
|
|
skip: !selected,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<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"
|
|
|
|
|
width={"33%"}
|
|
|
|
|
onClose={handleClose}
|
|
|
|
|
visible={!!selected}
|
|
|
|
|
visible={selected}
|
|
|
|
|
>
|
|
|
|
|
<div>
|
|
|
|
|
<Descriptions bordered size="small" column={1}>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.ro_number")}>
|
|
|
|
|
{theJob.ro_number || ""}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.owner")}>
|
|
|
|
|
{`${theJob.ownr_fn || ""} ${theJob.ownr_ln || ""} ${
|
|
|
|
|
theJob.ownr_co_nm || ""
|
|
|
|
|
}`}
|
|
|
|
|
</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.Item label={t("jobs.labels.parts")}>
|
|
|
|
|
<PartsStatusPie joblines_status={theJob.joblines_status} />
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
</Descriptions>
|
|
|
|
|
<ProductionRemoveButton jobId={theJob.id} />
|
|
|
|
|
</div>
|
|
|
|
|
{loading && <LoadingSkeleton />}
|
|
|
|
|
{error && <AlertComponent error={JSON.stringify(error)} />}
|
|
|
|
|
{!loading && data && (
|
|
|
|
|
<div>
|
|
|
|
|
<JobEmployeeAssignments job={data.jobs_by_pk} refetch={refetch} />
|
|
|
|
|
<Descriptions bordered size="small" column={1}>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.ro_number")}>
|
|
|
|
|
{theJob.ro_number || ""}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.alt_transport")}>
|
|
|
|
|
<Space>
|
|
|
|
|
{data.jobs_by_pk.alt_transport || ""}
|
|
|
|
|
<ScheduleEventAt event={{ job: data.jobs_by_pk }} />
|
|
|
|
|
</Space>
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.clm_no")}>
|
|
|
|
|
{theJob.clm_no || ""}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.ins_co_nm")}>
|
|
|
|
|
{theJob.ins_co_nm || ""}
|
|
|
|
|
</Descriptions.Item>
|
|
|
|
|
<Descriptions.Item label={t("jobs.fields.owner")}>
|
|
|
|
|
{`${theJob.ownr_fn || ""} ${theJob.ownr_ln || ""} ${
|
|
|
|
|
theJob.ownr_co_nm || ""
|
|
|
|
|
}`}
|
|
|
|
|
<StartChatButton
|
|
|
|
|
phone={data.jobs_by_pk.ownr_ph1}
|
|
|
|
|
jobid={data.jobs_by_pk.id}
|
|
|
|
|
/>
|
|
|
|
|
</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>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|