Merge branch 'release/2024-04-12' into release/AIO/2024-04-12

This commit is contained in:
Patrick Fic
2024-04-11 15:15:54 -07:00
5 changed files with 150 additions and 78 deletions

View File

@@ -1,5 +1,5 @@
import { useQuery } from "@apollo/client"; import { useQuery } from "@apollo/client";
import { Col, Divider, Row, Skeleton, Space, Timeline, Typography } from "antd"; import { Col, Row, Skeleton, Timeline, Typography } from "antd";
import React from "react"; import React from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
@@ -43,13 +43,25 @@ export function JobLinesExpander({ jobline, jobid, bodyshop }) {
? data.parts_order_lines.map((line) => ({ ? data.parts_order_lines.map((line) => ({
key: line.id, key: line.id,
children: ( children: (
<Space split={<Divider type="vertical" />} wrap> <Row wrap>
<Link to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}> <Col span={4}>
{line.parts_order.order_number} <Link to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}>
</Link> {line.parts_order.order_number}
<DateFormatter>{line.parts_order.order_date}</DateFormatter> </Link>
{line.parts_order.vendor.name} </Col>
</Space> <Col span={4}>
<DateFormatter>{line.parts_order.order_date}</DateFormatter>
</Col>
<Col span={4}>{line.parts_order.vendor.name}</Col>
{line.backordered_eta ? (
<Col span={4}>
<span>
{`${t("parts_orders.fields.backordered_eta")}: `}
<DateFormatter>{line.backordered_eta}</DateFormatter>
</span>
</Col>
) : null}
</Row>
) )
})) }))
: [ : [
@@ -61,6 +73,31 @@ export function JobLinesExpander({ jobline, jobid, bodyshop }) {
} }
/>{" "} />{" "}
</Col> </Col>
<Col md={24} lg={8}>
<Typography.Title level={4}>{t("parts_dispatch.labels.parts_dispatch")}</Typography.Title>
<Timeline
items={
data.parts_dispatch_lines.length > 0
? data.parts_dispatch_lines.map((line) => ({
key: line.id,
children: (
<Space split={<Divider type="vertical" />} wrap>
<Link to={`/manage/jobs/${jobid}?partsorderid=${line.id}`}>{line.parts_dispatch.number}</Link>
{bodyshop.employees.find((e) => e.id === line.parts_dispatch.employeeid)?.first_name}
<Space>
{t("parts_dispatch_lines.fields.accepted_at")}
<DateFormatter>{line.accepted_at}</DateFormatter>
</Space>
</Space>
)
}))
: {
key: "dispatch-lines",
children: t("parts_orders.labels.notyetordered")
}
}
/>
</Col>
<Col md={24} lg={8}> <Col md={24} lg={8}>
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title> <Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
<Timeline <Timeline
@@ -103,31 +140,6 @@ export function JobLinesExpander({ jobline, jobid, bodyshop }) {
} }
/> />
</Col> </Col>
<Col md={24} lg={8}>
<Typography.Title level={4}>{t("parts_dispatch.labels.parts_dispatch")}</Typography.Title>
<Timeline
items={
data.parts_dispatch_lines.length > 0
? data.parts_dispatch_lines.map((line) => ({
key: line.id,
children: (
<Space split={<Divider type="vertical" />} wrap>
<Link to={`/manage/jobs/${jobid}?partsorderid=${line.id}`}>{line.parts_dispatch.number}</Link>
{bodyshop.employees.find((e) => e.id === line.parts_dispatch.employeeid)?.first_name}
<Space>
{t("parts_dispatch_lines.fields.accepted_at")}
<DateFormatter>{line.accepted_at}</DateFormatter>
</Space>
</Space>
)
}))
: {
key: "dispatch-lines",
children: t("parts_orders.labels.notyetordered")
}
}
/>
</Col>
</Row> </Row>
); );
} }

View File

@@ -182,7 +182,7 @@ export function PartsOrderModalComponent({ bodyshop, vendorList, sendTypeState,
} }
]} ]}
> >
<InputNumber /> <InputNumber min={1} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label={t("parts_orders.fields.act_price")} label={t("parts_orders.fields.act_price")}

View File

@@ -59,25 +59,33 @@ export function ScheduleCalendarHeaderComponent({
{loadData && loadData.allJobsOut ? ( {loadData && loadData.allJobsOut ? (
loadData.allJobsOut.map((j) => ( loadData.allJobsOut.map((j) => (
<tr key={j.id}> <tr key={j.id}>
<td> <td style={{ padding: "2.5px" }}>
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link> <Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link> (
{j.status})
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
<OwnerNameDisplay ownerObject={j} /> <OwnerNameDisplay ownerObject={j} />
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
{`(${(j.labhrs.aggregate.sum.mod_lb_hrs + j.larhrs.aggregate.sum.mod_lb_hrs).toFixed( {`(${j.labhrs.aggregate.sum.mod_lb_hrs.toFixed(
1 1
)} ${t("general.labels.hours")})`} )}/${j.larhrs.aggregate.sum.mod_lb_hrs.toFixed(1)}/${(
j.labhrs.aggregate.sum.mod_lb_hrs +
j.larhrs.aggregate.sum.mod_lb_hrs
).toFixed(1)} ${t("general.labels.hours")})`}
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
<DateTimeFormatter>{j.scheduled_completion}</DateTimeFormatter> <DateTimeFormatter>
{j.scheduled_completion}
</DateTimeFormatter>
</td> </td>
</tr> </tr>
)) ))
) : ( ) : (
<tr> <tr>
<td>{t("appointments.labels.nocompletingjobs")}</td> <td style={{ padding: "2.5px" }}>
{t("appointments.labels.nocompletingjobs")}
</td>
</tr> </tr>
)} )}
</tbody> </tbody>
@@ -92,26 +100,30 @@ export function ScheduleCalendarHeaderComponent({
{loadData && loadData.allJobsIn ? ( {loadData && loadData.allJobsIn ? (
loadData.allJobsIn.map((j) => ( loadData.allJobsIn.map((j) => (
<tr key={j.id}> <tr key={j.id}>
<td> <td style={{ padding: "2.5px" }}>
<Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link> <Link to={`/manage/jobs/${j.id}`}>{j.ro_number}</Link>
{j.status}
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
<OwnerNameDisplay ownerObject={j} /> <OwnerNameDisplay ownerObject={j} />
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
{`(${(j.labhrs.aggregate.sum.mod_lb_hrs + j.larhrs.aggregate.sum.mod_lb_hrs).toFixed( {`(${j.labhrs.aggregate.sum.mod_lb_hrs.toFixed(
1 1
)} ${t("general.labels.hours")})`} )}/${j.larhrs.aggregate.sum.mod_lb_hrs.toFixed(1)}/${(
j.labhrs.aggregate.sum.mod_lb_hrs +
j.larhrs.aggregate.sum.mod_lb_hrs
).toFixed(1)} ${t("general.labels.hours")})`}
</td> </td>
<td> <td style={{ padding: "2.5px" }}>
<DateTimeFormatter>{j.scheduled_in}</DateTimeFormatter> <DateTimeFormatter>{j.scheduled_in}</DateTimeFormatter>
</td> </td>
</tr> </tr>
)) ))
) : ( ) : (
<tr> <tr>
<td>{t("appointments.labels.noarrivingjobs")}</td> <td style={{ padding: "2.5px" }}>
{t("appointments.labels.noarrivingjobs")}
</td>
</tr> </tr>
)} )}
</tbody> </tbody>
@@ -121,27 +133,33 @@ export function ScheduleCalendarHeaderComponent({
const LoadComponent = loadData ? ( const LoadComponent = loadData ? (
<div> <div>
<Space align="center"> <Space align="center">
<Popover <Popover
placement={"bottom"} placement={"bottom"}
content={jobsInPopup} content={jobsInPopup}
trigger="hover" trigger="hover"
title={t("appointments.labels.arrivingjobs")} title={t("appointments.labels.arrivingjobs")}
> >
<Icon component={MdFileDownload} style={{ color: "green" }} /> <Icon component={MdFileDownload} style={{ color: "green" }} />
{(loadData.allHoursIn || 0) && loadData.allHoursIn.toFixed(2)} {(loadData.allHoursInBody || 0) &&
</Popover> loadData.allHoursInBody.toFixed(1)}
<Popover /
placement={"bottom"} {(loadData.allHoursInRefinish || 0) &&
content={jobsOutPopup} loadData.allHoursInRefinish.toFixed(1)}
trigger="hover" /{(loadData.allHoursIn || 0) && loadData.allHoursIn.toFixed(1)}
title={t("appointments.labels.completingjobs")} </Popover>
> <Popover
<Icon component={MdFileUpload} style={{ color: "red" }} /> placement={"bottom"}
{(loadData.allHoursOut || 0) && loadData.allHoursOut.toFixed(2)} content={jobsOutPopup}
</Popover> trigger="hover"
<ScheduleCalendarHeaderGraph loadData={loadData} /> title={t("appointments.labels.completingjobs")}
</Space> >
<Icon component={MdFileUpload} style={{ color: "red" }} />
{(loadData.allHoursOut || 0) && loadData.allHoursOut.toFixed(1)}
</Popover>
<ScheduleCalendarHeaderGraph loadData={loadData} />
</Space>
<div> <div>
<ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}> <ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}>
{Object.keys(ATSToday).map((key, idx) => ( {Object.keys(ATSToday).map((key, idx) => (

View File

@@ -2238,6 +2238,8 @@ export const GET_JOB_LINE_ORDERS = gql`
parts_order_lines(where: { job_line_id: { _eq: $joblineid } }) { parts_order_lines(where: { job_line_id: { _eq: $joblineid } }) {
id id
act_price act_price
backordered_eta
backordered_on
parts_order { parts_order {
id id
order_date order_date

View File

@@ -111,7 +111,12 @@ export function* calculateScheduleLoad({ payload: end }) {
(load[itemDate].allHoursIn || 0) + (load[itemDate].allHoursIn || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs + item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs; item.larhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].allHoursInBody =
(load[itemDate].allHoursInBody || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].allHoursInRefinish =
(load[itemDate].allHoursInRefinish || 0) +
item.larhrs.aggregate.sum.mod_lb_hrs;
//If the job hasn't already arrived, add it to the jobs in list. //If the job hasn't already arrived, add it to the jobs in list.
// Make sure it also hasn't already been completed, or isn't an in and out job. // Make sure it also hasn't already been completed, or isn't an in and out job.
//This prevents the duplicate counting. //This prevents the duplicate counting.
@@ -119,7 +124,15 @@ export function* calculateScheduleLoad({ payload: end }) {
if (AddJobForSchedulingCalc) { if (AddJobForSchedulingCalc) {
load[itemDate].jobsIn.push(item); load[itemDate].jobsIn.push(item);
load[itemDate].hoursIn = load[itemDate].hoursIn =
(load[itemDate].hoursIn || 0) + item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs; (load[itemDate].hoursIn || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].hoursInBody =
(load[itemDate].hoursInBody || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].hoursInRefinish =
(load[itemDate].hoursInRefinish || 0) +
item.larhrs.aggregate.sum.mod_lb_hrs;
} }
} else { } else {
load[itemDate] = { load[itemDate] = {
@@ -127,10 +140,21 @@ export function* calculateScheduleLoad({ payload: end }) {
jobsIn: AddJobForSchedulingCalc ? [item] : [], //Same as above, only add it if it isn't already in production. jobsIn: AddJobForSchedulingCalc ? [item] : [], //Same as above, only add it if it isn't already in production.
jobsOut: [], jobsOut: [],
allJobsOut: [], allJobsOut: [],
allHoursIn: item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs, allHoursIn:
item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs,
allHoursInBody: item.labhrs.aggregate.sum.mod_lb_hrs,
allHoursInRefinish: item.larhrs.aggregate.sum.mod_lb_hrs,
hoursIn: AddJobForSchedulingCalc hoursIn: AddJobForSchedulingCalc
? item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs ? item.labhrs.aggregate.sum.mod_lb_hrs +
: 0 item.larhrs.aggregate.sum.mod_lb_hrs
: 0,
hoursInBody: AddJobForSchedulingCalc
? item.labhrs.aggregate.sum.mod_lb_hrs
: 0,
hoursInRefinish: AddJobForSchedulingCalc
? item.larhrs.aggregate.sum.mod_lb_hrs
: 0,
}; };
} }
}); });
@@ -151,6 +175,12 @@ export function* calculateScheduleLoad({ payload: end }) {
(load[itemDate].allHoursOut || 0) + (load[itemDate].allHoursOut || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs + item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs; item.larhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].allHoursOutBody =
(load[itemDate].allHoursOutBody || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].allHoursOutRefinish =
(load[itemDate].allHoursOutRefinish || 0) +
item.larhrs.aggregate.sum.mod_lb_hrs;
//Add only the jobs that are still in production to get rid of. //Add only the jobs that are still in production to get rid of.
//If it's not in production, we'd subtract unnecessarily. //If it's not in production, we'd subtract unnecessarily.
load[itemDate].allJobsOut.push(item); load[itemDate].allJobsOut.push(item);
@@ -161,6 +191,12 @@ export function* calculateScheduleLoad({ payload: end }) {
(load[itemDate].hoursOut || 0) + (load[itemDate].hoursOut || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs + item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs; item.larhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].hoursOutBody =
(load[itemDate].hoursOutBody || 0) +
item.labhrs.aggregate.sum.mod_lb_hrs;
load[itemDate].hoursOutRefinish =
(load[itemDate].hoursOutRefinish || 0) +
item.larhrs.aggregate.sum.mod_lb_hrs;
} }
} else { } else {
load[itemDate] = { load[itemDate] = {
@@ -169,7 +205,11 @@ export function* calculateScheduleLoad({ payload: end }) {
hoursOut: AddJobForSchedulingCalc hoursOut: AddJobForSchedulingCalc
? item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs ? item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs
: 0, : 0,
allHoursOut: item.labhrs.aggregate.sum.mod_lb_hrs + item.larhrs.aggregate.sum.mod_lb_hrs allHoursOut:
item.labhrs.aggregate.sum.mod_lb_hrs +
item.larhrs.aggregate.sum.mod_lb_hrs,
allHoursOutBody: item.labhrs.aggregate.sum.mod_lb_hrs,
allHoursOutRefinish: item.larhrs.aggregate.sum.mod_lb_hrs,
}; };
} }
}); });