Reformat all project files to use the prettier config file.
This commit is contained in:
@@ -1,138 +1,133 @@
|
||||
import {useQuery} from "@apollo/client";
|
||||
import {Col, Divider, Row, Skeleton, Space, Timeline, Typography} from "antd";
|
||||
import { useQuery } from "@apollo/client";
|
||||
import { Col, Divider, Row, Skeleton, Space, Timeline, Typography } from "antd";
|
||||
import React from "react";
|
||||
import {useTranslation} from "react-i18next";
|
||||
import {Link} from "react-router-dom";
|
||||
import {GET_JOB_LINE_ORDERS} from "../../graphql/jobs.queries";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { GET_JOB_LINE_ORDERS } from "../../graphql/jobs.queries";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import {DateFormatter} from "../../utils/DateFormatter";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
|
||||
import {connect} from "react-redux";
|
||||
import {createStructuredSelector} from "reselect";
|
||||
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobLinesExpander);
|
||||
|
||||
export function JobLinesExpander({jobline, jobid, bodyshop}) {
|
||||
const {t} = useTranslation();
|
||||
const {loading, error, data} = useQuery(GET_JOB_LINE_ORDERS, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
variables: {
|
||||
joblineid: jobline.id,
|
||||
},
|
||||
});
|
||||
export function JobLinesExpander({ jobline, jobid, bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const { loading, error, data } = useQuery(GET_JOB_LINE_ORDERS, {
|
||||
fetchPolicy: "network-only",
|
||||
nextFetchPolicy: "network-only",
|
||||
variables: {
|
||||
joblineid: jobline.id
|
||||
}
|
||||
});
|
||||
|
||||
if (loading) return <Skeleton/>;
|
||||
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||
if (loading) return <Skeleton />;
|
||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
||||
|
||||
return (
|
||||
<Row>
|
||||
<Col md={24} lg={8}>
|
||||
<Typography.Title level={4}>
|
||||
{t("parts_orders.labels.parts_orders")}
|
||||
</Typography.Title>
|
||||
<Timeline
|
||||
items={
|
||||
data.parts_order_lines.length > 0
|
||||
? data.parts_order_lines.map((line) => ({
|
||||
key: line.id,
|
||||
children: (
|
||||
<Space split={<Divider type="vertical"/>} wrap>
|
||||
<Link
|
||||
to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}
|
||||
>
|
||||
{line.parts_order.order_number}
|
||||
</Link>
|
||||
<DateFormatter>{line.parts_order.order_date}</DateFormatter>
|
||||
{line.parts_order.vendor.name}
|
||||
</Space>
|
||||
),
|
||||
}))
|
||||
: [
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("parts_orders.labels.notyetordered"),
|
||||
},
|
||||
]
|
||||
}
|
||||
/> </Col>
|
||||
<Col md={24} lg={8}>
|
||||
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
||||
<Timeline
|
||||
items={
|
||||
data.billlines.length > 0
|
||||
? data.billlines.map((line) => ({
|
||||
key: line.id,
|
||||
children: (
|
||||
<Row wrap>
|
||||
<Col span={4}>
|
||||
<Link
|
||||
to={`/manage/jobs/${jobid}?tab=partssublet&billid=${line.bill.id}`}
|
||||
>
|
||||
{line.bill.invoice_number}
|
||||
</Link>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<span>{`${t("billlines.fields.actual_price")}: `}<CurrencyFormatter>{line.actual_price}</CurrencyFormatter></span>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<span>{`${t("billlines.fields.actual_cost")}: `}<CurrencyFormatter>{line.actual_cost}</CurrencyFormatter></span>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<DateFormatter>{line.bill.date}</DateFormatter>
|
||||
</Col>
|
||||
<Col span={4}> {line.bill.vendor.name}</Col>
|
||||
</Row>
|
||||
),
|
||||
}))
|
||||
: [
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("parts_orders.labels.notyetordered"),
|
||||
},
|
||||
]
|
||||
}
|
||||
/>
|
||||
</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>
|
||||
);
|
||||
return (
|
||||
<Row>
|
||||
<Col md={24} lg={8}>
|
||||
<Typography.Title level={4}>{t("parts_orders.labels.parts_orders")}</Typography.Title>
|
||||
<Timeline
|
||||
items={
|
||||
data.parts_order_lines.length > 0
|
||||
? data.parts_order_lines.map((line) => ({
|
||||
key: line.id,
|
||||
children: (
|
||||
<Space split={<Divider type="vertical" />} wrap>
|
||||
<Link to={`/manage/jobs/${jobid}?partsorderid=${line.parts_order.id}`}>
|
||||
{line.parts_order.order_number}
|
||||
</Link>
|
||||
<DateFormatter>{line.parts_order.order_date}</DateFormatter>
|
||||
{line.parts_order.vendor.name}
|
||||
</Space>
|
||||
)
|
||||
}))
|
||||
: [
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("parts_orders.labels.notyetordered")
|
||||
}
|
||||
]
|
||||
}
|
||||
/>{" "}
|
||||
</Col>
|
||||
<Col md={24} lg={8}>
|
||||
<Typography.Title level={4}>{t("bills.labels.bills")}</Typography.Title>
|
||||
<Timeline
|
||||
items={
|
||||
data.billlines.length > 0
|
||||
? data.billlines.map((line) => ({
|
||||
key: line.id,
|
||||
children: (
|
||||
<Row wrap>
|
||||
<Col span={4}>
|
||||
<Link to={`/manage/jobs/${jobid}?tab=partssublet&billid=${line.bill.id}`}>
|
||||
{line.bill.invoice_number}
|
||||
</Link>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<span>
|
||||
{`${t("billlines.fields.actual_price")}: `}
|
||||
<CurrencyFormatter>{line.actual_price}</CurrencyFormatter>
|
||||
</span>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<span>
|
||||
{`${t("billlines.fields.actual_cost")}: `}
|
||||
<CurrencyFormatter>{line.actual_cost}</CurrencyFormatter>
|
||||
</span>
|
||||
</Col>
|
||||
<Col span={4}>
|
||||
<DateFormatter>{line.bill.date}</DateFormatter>
|
||||
</Col>
|
||||
<Col span={4}> {line.bill.vendor.name}</Col>
|
||||
</Row>
|
||||
)
|
||||
}))
|
||||
: [
|
||||
{
|
||||
key: "no-orders",
|
||||
children: t("parts_orders.labels.notyetordered")
|
||||
}
|
||||
]
|
||||
}
|
||||
/>
|
||||
</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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -9,96 +9,89 @@ import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import CurrencyFormItemComponent from "../form-items-formatted/currency-form-item.component";
|
||||
import JobLineConvertToLabor from "../job-line-convert-to-labor/job-line-convert-to-labor.component";
|
||||
|
||||
export default function JobLinesPartPriceChange({job, line, refetch}) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updatePartPrice] = useMutation(UPDATE_LINE_PPC);
|
||||
export default function JobLinesPartPriceChange({ job, line, refetch }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updatePartPrice] = useMutation(UPDATE_LINE_PPC);
|
||||
|
||||
const handleFinish = async (values) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const result = await updatePartPrice({
|
||||
variables: {
|
||||
id: line.id,
|
||||
jobline: {
|
||||
act_price_before_ppc: line.act_price_before_ppc
|
||||
? line.act_price_before_ppc
|
||||
: line.act_price,
|
||||
act_price: values.act_price,
|
||||
},
|
||||
},
|
||||
});
|
||||
await axios.post("/job/totalsssu", {
|
||||
id: job.id,
|
||||
});
|
||||
if (result.errors) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("joblines.errors.saving", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
if (refetch) refetch();
|
||||
} else {
|
||||
notification.open({
|
||||
type: "success",
|
||||
message: t("joblines.successes.saved"),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("joblines.errors.saving", {error: JSON.stringify(error)}),
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
const handleFinish = async (values) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const result = await updatePartPrice({
|
||||
variables: {
|
||||
id: line.id,
|
||||
jobline: {
|
||||
act_price_before_ppc: line.act_price_before_ppc ? line.act_price_before_ppc : line.act_price,
|
||||
act_price: values.act_price
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
await axios.post("/job/totalsssu", {
|
||||
id: job.id
|
||||
});
|
||||
if (result.errors) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("joblines.errors.saving", {
|
||||
error: JSON.stringify(result.errors)
|
||||
})
|
||||
});
|
||||
if (refetch) refetch();
|
||||
} else {
|
||||
notification.open({
|
||||
type: "success",
|
||||
message: t("joblines.successes.saved")
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
notification.open({
|
||||
type: "error",
|
||||
message: t("joblines.errors.saving", { error: JSON.stringify(error) })
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const popcontent = InstanceRenderManager({
|
||||
imex: null,
|
||||
rome: (
|
||||
<Form layout="vertical" onFinish={handleFinish} initialValues={{act_price: line.act_price}}>
|
||||
<Form.Item
|
||||
name="act_price"
|
||||
label={t("jobs.labels.act_price_ppc")}
|
||||
rules={[{required: true}]}
|
||||
>
|
||||
<CurrencyFormItemComponent/>
|
||||
</Form.Item>
|
||||
<Button disabled={InstanceRenderManager({imex:true, rome: false, promanager: true})} loading={loading} htmlType="primary">
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
</Form>
|
||||
const popcontent = InstanceRenderManager({
|
||||
imex: null,
|
||||
rome: (
|
||||
<Form layout="vertical" onFinish={handleFinish} initialValues={{ act_price: line.act_price }}>
|
||||
<Form.Item name="act_price" label={t("jobs.labels.act_price_ppc")} rules={[{ required: true }]}>
|
||||
<CurrencyFormItemComponent />
|
||||
</Form.Item>
|
||||
<Button
|
||||
disabled={InstanceRenderManager({ imex: true, rome: false, promanager: true })}
|
||||
loading={loading}
|
||||
htmlType="primary"
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
</Form>
|
||||
),
|
||||
promanager: null
|
||||
}) ;
|
||||
promanager: null
|
||||
});
|
||||
|
||||
return (
|
||||
<JobLineConvertToLabor jobline={line} job={job}>
|
||||
<Popover trigger="click"
|
||||
disabled={true || line.manual_line} content={popcontent}>
|
||||
<CurrencyFormatter>
|
||||
{line.db_ref === "900510" || line.db_ref === "900511"
|
||||
? line.prt_dsmk_m
|
||||
: line.act_price}
|
||||
</CurrencyFormatter>
|
||||
{line.prt_dsmk_p && line.prt_dsmk_p !== 0 ? (
|
||||
<span style={{marginLeft: ".2rem"}}>{`(${line.prt_dsmk_p}%)`}</span>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{line.act_price_before_ppc && line.act_price_before_ppc !== 0 ? (
|
||||
<Tooltip title={t("jobs.labels.ppc")}>
|
||||
<span style={{marginLeft: ".2rem", color: "tomato"}}>
|
||||
(
|
||||
<CurrencyFormatter>{line.act_price_before_ppc}</CurrencyFormatter>
|
||||
)
|
||||
return (
|
||||
<JobLineConvertToLabor jobline={line} job={job}>
|
||||
<Popover trigger="click" disabled={true || line.manual_line} content={popcontent}>
|
||||
<CurrencyFormatter>
|
||||
{line.db_ref === "900510" || line.db_ref === "900511" ? line.prt_dsmk_m : line.act_price}
|
||||
</CurrencyFormatter>
|
||||
{line.prt_dsmk_p && line.prt_dsmk_p !== 0 ? (
|
||||
<span style={{ marginLeft: ".2rem" }}>{`(${line.prt_dsmk_p}%)`}</span>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{line.act_price_before_ppc && line.act_price_before_ppc !== 0 ? (
|
||||
<Tooltip title={t("jobs.labels.ppc")}>
|
||||
<span style={{ marginLeft: ".2rem", color: "tomato" }}>
|
||||
(<CurrencyFormatter>{line.act_price_before_ppc}</CurrencyFormatter>)
|
||||
</span>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Popover>
|
||||
</JobLineConvertToLabor>
|
||||
);
|
||||
</Tooltip>
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</Popover>
|
||||
</JobLineConvertToLabor>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,56 +6,53 @@ import {
|
||||
MinusCircleTwoTone,
|
||||
PlusCircleTwoTone,
|
||||
SyncOutlined,
|
||||
WarningFilled,
|
||||
} from '@ant-design/icons';
|
||||
import { PageHeader } from '@ant-design/pro-layout';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import { Button, Dropdown, Input, Space, Table, Tag } from 'antd';
|
||||
import axios from 'axios';
|
||||
import React, { useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { connect } from 'react-redux';
|
||||
import { createStructuredSelector } from 'reselect';
|
||||
import { DELETE_JOB_LINE_BY_PK } from '../../graphql/jobs-lines.queries';
|
||||
import { selectJobReadOnly } from '../../redux/application/application.selectors';
|
||||
import { setModalContext } from '../../redux/modals/modals.actions';
|
||||
import { selectTechnician } from '../../redux/tech/tech.selectors';
|
||||
import { onlyUnique } from '../../utils/arrayHelper';
|
||||
import { alphaSort } from '../../utils/sorters';
|
||||
import JobLineLocationPopup from '../job-line-location-popup/job-line-location-popup.component';
|
||||
import JobLineNotePopup from '../job-line-note-popup/job-line-note-popup.component';
|
||||
import JobLineStatusPopup from '../job-line-status-popup/job-line-status-popup.component';
|
||||
import JobLinesBillRefernece from '../job-lines-bill-reference/job-lines-bill-reference.component';
|
||||
WarningFilled
|
||||
} from "@ant-design/icons";
|
||||
import { PageHeader } from "@ant-design/pro-layout";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button, Dropdown, Input, Space, Table, Tag } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import JobLineLocationPopup from "../job-line-location-popup/job-line-location-popup.component";
|
||||
import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.component";
|
||||
import JobLineStatusPopup from "../job-line-status-popup/job-line-status-popup.component";
|
||||
import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-reference.component";
|
||||
// import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
||||
// import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
||||
// import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
||||
import { useSplitTreatments } from '@splitsoftware/splitio-react';
|
||||
import _ from 'lodash';
|
||||
import { selectBodyshop } from '../../redux/user/user.selectors';
|
||||
import dayjs from '../../utils/day';
|
||||
import { HasFeatureAccess } from '../feature-wrapper/feature-wrapper.component';
|
||||
import JobCreateIOU from '../job-create-iou/job-create-iou.component';
|
||||
import JobLineBulkAssignComponent from '../job-line-bulk-assign/job-line-bulk-assign.component';
|
||||
import JobLineDispatchButton from '../job-line-dispatch-button/job-line-dispatch-button.component';
|
||||
import JoblineTeamAssignment from '../job-line-team-assignment/job-line-team-assignmnent.component';
|
||||
import JobSendPartPriceChangeComponent from '../job-send-parts-price-change/job-send-parts-price-change.component';
|
||||
import PartsOrderModalContainer from '../parts-order-modal/parts-order-modal.container';
|
||||
import JobLinesExpander from './job-lines-expander.component';
|
||||
import JobLinesPartPriceChange from './job-lines-part-price-change.component';
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import _ from "lodash";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import dayjs from "../../utils/day";
|
||||
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
||||
import JobCreateIOU from "../job-create-iou/job-create-iou.component";
|
||||
import JobLineBulkAssignComponent from "../job-line-bulk-assign/job-line-bulk-assign.component";
|
||||
import JobLineDispatchButton from "../job-line-dispatch-button/job-line-dispatch-button.component";
|
||||
import JoblineTeamAssignment from "../job-line-team-assignment/job-line-team-assignmnent.component";
|
||||
import JobSendPartPriceChangeComponent from "../job-send-parts-price-change/job-send-parts-price-change.component";
|
||||
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||
import JobLinesExpander from "./job-lines-expander.component";
|
||||
import JobLinesPartPriceChange from "./job-lines-part-price-change.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
technician: selectTechnician,
|
||||
technician: selectTechnician
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setJobLineEditContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: 'jobLineEdit' })),
|
||||
setPartsOrderContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: 'partsOrder' })),
|
||||
setBillEnterContext: (context) =>
|
||||
dispatch(setModalContext({ context: context, modal: 'billEnter' })),
|
||||
setJobLineEditContext: (context) => dispatch(setModalContext({ context: context, modal: "jobLineEdit" })),
|
||||
setPartsOrderContext: (context) => dispatch(setModalContext({ context: context, modal: "partsOrder" })),
|
||||
setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" }))
|
||||
});
|
||||
|
||||
export function JobLinesComponent({
|
||||
@@ -70,153 +67,147 @@ export function JobLinesComponent({
|
||||
job,
|
||||
setJobLineEditContext,
|
||||
form,
|
||||
setBillEnterContext,
|
||||
setBillEnterContext
|
||||
}) {
|
||||
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
||||
const {
|
||||
treatments: { Enhanced_Payroll },
|
||||
treatments: { Enhanced_Payroll }
|
||||
} = useSplitTreatments({
|
||||
attributes: {},
|
||||
names: ['Enhanced_Payroll'],
|
||||
splitKey: bodyshop.imexshopid,
|
||||
names: ["Enhanced_Payroll"],
|
||||
splitKey: bodyshop.imexshopid
|
||||
});
|
||||
|
||||
const [selectedLines, setSelectedLines] = useState([]);
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: {},
|
||||
filteredInfo: {}
|
||||
});
|
||||
const { t } = useTranslation();
|
||||
const jobIsPrivate = bodyshop.md_ins_cos.find((c) => c.name === job.ins_co_nm)?.private;
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: '#',
|
||||
dataIndex: 'line_no',
|
||||
key: 'line_no',
|
||||
title: "#",
|
||||
dataIndex: "line_no",
|
||||
key: "line_no",
|
||||
sorter: (a, b) => a.line_no - b.line_no,
|
||||
fixed: 'left',
|
||||
sortOrder: state.sortedInfo.columnKey === 'line_no' && state.sortedInfo.order,
|
||||
fixed: "left",
|
||||
sortOrder: state.sortedInfo.columnKey === "line_no" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.line_desc'),
|
||||
dataIndex: 'line_desc',
|
||||
fixed: 'left',
|
||||
key: 'line_desc',
|
||||
title: t("joblines.fields.line_desc"),
|
||||
dataIndex: "line_desc",
|
||||
fixed: "left",
|
||||
key: "line_desc",
|
||||
sorter: (a, b) => alphaSort(a.line_desc, b.line_desc),
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && 'job-line-manual',
|
||||
className: record.manual_line && "job-line-manual",
|
||||
style: {
|
||||
...(record.critical ? { boxShadow: ' -.5em 0 0 #FFC107' } : {}),
|
||||
},
|
||||
...(record.critical ? { boxShadow: " -.5em 0 0 #FFC107" } : {})
|
||||
}
|
||||
}),
|
||||
sortOrder: state.sortedInfo.columnKey === 'line_desc' && state.sortedInfo.order,
|
||||
ellipsis: true,
|
||||
sortOrder: state.sortedInfo.columnKey === "line_desc" && state.sortedInfo.order,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.oem_partno'),
|
||||
dataIndex: 'oem_partno',
|
||||
key: 'oem_partno',
|
||||
title: t("joblines.fields.oem_partno"),
|
||||
dataIndex: "oem_partno",
|
||||
key: "oem_partno",
|
||||
sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno),
|
||||
sortOrder: state.sortedInfo.columnKey === 'oem_partno' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "oem_partno" && state.sortedInfo.order,
|
||||
ellipsis: true,
|
||||
onCell: (record) => ({
|
||||
className: record.manual_line && 'job-line-manual',
|
||||
className: record.manual_line && "job-line-manual",
|
||||
style: {
|
||||
...(record.parts_dispatch_lines[0]?.accepted_at
|
||||
? { boxShadow: ' -.5em 0 0 #FFC107' }
|
||||
: {}),
|
||||
},
|
||||
...(record.parts_dispatch_lines[0]?.accepted_at ? { boxShadow: " -.5em 0 0 #FFC107" } : {})
|
||||
}
|
||||
}),
|
||||
render: (text, record) => (
|
||||
<span className="ant-table-cell-content">
|
||||
{`${record.oem_partno || ''} ${record.alt_partno ? `(${record.alt_partno})` : ''}`.trim()}
|
||||
{`${record.oem_partno || ""} ${record.alt_partno ? `(${record.alt_partno})` : ""}`.trim()}
|
||||
</span>
|
||||
),
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.op_code_desc'),
|
||||
dataIndex: 'op_code_desc',
|
||||
key: 'op_code_desc',
|
||||
title: t("joblines.fields.op_code_desc"),
|
||||
dataIndex: "op_code_desc",
|
||||
key: "op_code_desc",
|
||||
sorter: (a, b) => alphaSort(a.op_code_desc, b.op_code_desc),
|
||||
sortOrder: state.sortedInfo.columnKey === 'op_code_desc' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "op_code_desc" && state.sortedInfo.order,
|
||||
ellipsis: true,
|
||||
render: (text, record) =>
|
||||
`${record.op_code_desc || ''}${record.alt_partm ? ` ${record.alt_partm}` : ''}`,
|
||||
render: (text, record) => `${record.op_code_desc || ""}${record.alt_partm ? ` ${record.alt_partm}` : ""}`
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.part_type'),
|
||||
dataIndex: 'part_type',
|
||||
key: 'part_type',
|
||||
title: t("joblines.fields.part_type"),
|
||||
dataIndex: "part_type",
|
||||
key: "part_type",
|
||||
filteredValue: state.filteredInfo.part_type || null,
|
||||
sorter: (a, b) => alphaSort(a.part_type, b.part_type),
|
||||
sortOrder: state.sortedInfo.columnKey === 'part_type' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "part_type" && state.sortedInfo.order,
|
||||
filters: [
|
||||
{
|
||||
text: t('jobs.labels.partsfilter'),
|
||||
value: ['PAN', 'PAC', 'PAR', 'PAL', 'PAA', 'PAM', 'PAP', 'PAS', 'PASL', 'PAG'],
|
||||
text: t("jobs.labels.partsfilter"),
|
||||
value: ["PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAN'),
|
||||
value: ['PAN'],
|
||||
text: t("joblines.fields.part_types.PAN"),
|
||||
value: ["PAN"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAP'),
|
||||
value: ['PAP'],
|
||||
text: t("joblines.fields.part_types.PAP"),
|
||||
value: ["PAP"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAL'),
|
||||
value: ['PAL'],
|
||||
text: t("joblines.fields.part_types.PAL"),
|
||||
value: ["PAL"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAA'),
|
||||
value: ['PAA'],
|
||||
text: t("joblines.fields.part_types.PAA"),
|
||||
value: ["PAA"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAG'),
|
||||
value: ['PAG'],
|
||||
text: t("joblines.fields.part_types.PAG"),
|
||||
value: ["PAG"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAS'),
|
||||
value: ['PAS'],
|
||||
text: t("joblines.fields.part_types.PAS"),
|
||||
value: ["PAS"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PASL'),
|
||||
value: ['PASL'],
|
||||
text: t("joblines.fields.part_types.PASL"),
|
||||
value: ["PASL"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAC'),
|
||||
value: ['PAC'],
|
||||
text: t("joblines.fields.part_types.PAC"),
|
||||
value: ["PAC"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAR'),
|
||||
value: ['PAR'],
|
||||
text: t("joblines.fields.part_types.PAR"),
|
||||
value: ["PAR"]
|
||||
},
|
||||
{
|
||||
text: t('joblines.fields.part_types.PAM'),
|
||||
value: ['PAM'],
|
||||
},
|
||||
text: t("joblines.fields.part_types.PAM"),
|
||||
value: ["PAM"]
|
||||
}
|
||||
],
|
||||
onFilter: (value, record) => value.includes(record.part_type),
|
||||
render: (text, record) =>
|
||||
record.part_type ? t(`joblines.fields.part_types.${record.part_type}`) : null,
|
||||
render: (text, record) => (record.part_type ? t(`joblines.fields.part_types.${record.part_type}`) : null)
|
||||
},
|
||||
|
||||
{
|
||||
title: t('joblines.fields.act_price'),
|
||||
dataIndex: 'act_price',
|
||||
key: 'act_price',
|
||||
title: t("joblines.fields.act_price"),
|
||||
dataIndex: "act_price",
|
||||
key: "act_price",
|
||||
sorter: (a, b) => a.act_price - b.act_price,
|
||||
sortOrder: state.sortedInfo.columnKey === 'act_price' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "act_price" && state.sortedInfo.order,
|
||||
ellipsis: true,
|
||||
render: (text, record) => (
|
||||
<JobLinesPartPriceChange line={record} job={job} refetch={refetch} />
|
||||
),
|
||||
render: (text, record) => <JobLinesPartPriceChange line={record} job={job} refetch={refetch} />
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.part_qty'),
|
||||
dataIndex: 'part_qty',
|
||||
key: 'part_qty',
|
||||
title: t("joblines.fields.part_qty"),
|
||||
dataIndex: "part_qty",
|
||||
key: "part_qty"
|
||||
},
|
||||
|
||||
// {
|
||||
@@ -240,73 +231,70 @@ export function JobLinesComponent({
|
||||
// ),
|
||||
// },
|
||||
{
|
||||
title: t('joblines.fields.mod_lbr_ty'),
|
||||
dataIndex: 'mod_lbr_ty',
|
||||
key: 'mod_lbr_ty',
|
||||
title: t("joblines.fields.mod_lbr_ty"),
|
||||
dataIndex: "mod_lbr_ty",
|
||||
key: "mod_lbr_ty",
|
||||
|
||||
sorter: (a, b) => alphaSort(a.mod_lbr_ty, b.mod_lbr_ty),
|
||||
sortOrder: state.sortedInfo.columnKey === 'mod_lbr_ty' && state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
record.mod_lbr_ty ? t(`joblines.fields.lbr_types.${record.mod_lbr_ty}`) : null,
|
||||
sortOrder: state.sortedInfo.columnKey === "mod_lbr_ty" && state.sortedInfo.order,
|
||||
render: (text, record) => (record.mod_lbr_ty ? t(`joblines.fields.lbr_types.${record.mod_lbr_ty}`) : null)
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.mod_lb_hrs'),
|
||||
dataIndex: 'mod_lb_hrs',
|
||||
key: 'mod_lb_hrs',
|
||||
title: t("joblines.fields.mod_lb_hrs"),
|
||||
dataIndex: "mod_lb_hrs",
|
||||
key: "mod_lb_hrs",
|
||||
|
||||
sorter: (a, b) => a.mod_lb_hrs - b.mod_lb_hrs,
|
||||
sortOrder: state.sortedInfo.columnKey === 'mod_lb_hrs' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "mod_lb_hrs" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.line_ind'),
|
||||
dataIndex: 'line_ind',
|
||||
key: 'line_ind',
|
||||
title: t("joblines.fields.line_ind"),
|
||||
dataIndex: "line_ind",
|
||||
key: "line_ind",
|
||||
sorter: (a, b) => alphaSort(a.line_ind, b.line_ind),
|
||||
sortOrder: state.sortedInfo.columnKey === 'line_ind' && state.sortedInfo.order,
|
||||
responsive: ['md'],
|
||||
sortOrder: state.sortedInfo.columnKey === "line_ind" && state.sortedInfo.order,
|
||||
responsive: ["md"]
|
||||
},
|
||||
...(Enhanced_Payroll.treatment === 'on'
|
||||
...(Enhanced_Payroll.treatment === "on"
|
||||
? [
|
||||
{
|
||||
title: t('joblines.fields.assigned_team'),
|
||||
dataIndex: 'assigned_team',
|
||||
key: 'assigned_team',
|
||||
render: (text, record) => (
|
||||
<JoblineTeamAssignment disabled={jobRO} jobline={record} jobId={job.id} />
|
||||
),
|
||||
},
|
||||
title: t("joblines.fields.assigned_team"),
|
||||
dataIndex: "assigned_team",
|
||||
key: "assigned_team",
|
||||
render: (text, record) => <JoblineTeamAssignment disabled={jobRO} jobline={record} jobId={job.id} />
|
||||
}
|
||||
]
|
||||
: []),
|
||||
|
||||
{
|
||||
title: t('joblines.fields.notes'),
|
||||
dataIndex: 'notes',
|
||||
key: 'notes',
|
||||
render: (text, record) => <JobLineNotePopup disabled={jobRO} jobline={record} />,
|
||||
title: t("joblines.fields.notes"),
|
||||
dataIndex: "notes",
|
||||
key: "notes",
|
||||
render: (text, record) => <JobLineNotePopup disabled={jobRO} jobline={record} />
|
||||
},
|
||||
{
|
||||
title: t('joblines.fields.location'),
|
||||
dataIndex: 'location',
|
||||
key: 'location',
|
||||
render: (text, record) => <JobLineLocationPopup jobline={record} disabled={jobRO} />,
|
||||
title: t("joblines.fields.location"),
|
||||
dataIndex: "location",
|
||||
key: "location",
|
||||
render: (text, record) => <JobLineLocationPopup jobline={record} disabled={jobRO} />
|
||||
},
|
||||
...(HasFeatureAccess({ featureName: 'bills', bodyshop })
|
||||
...(HasFeatureAccess({ featureName: "bills", bodyshop })
|
||||
? [
|
||||
{
|
||||
title: t('joblines.labels.billref'),
|
||||
dataIndex: 'billref',
|
||||
key: 'billref',
|
||||
title: t("joblines.labels.billref"),
|
||||
dataIndex: "billref",
|
||||
key: "billref",
|
||||
render: (text, record) => <JobLinesBillRefernece jobline={record} />,
|
||||
responsive: ['md'],
|
||||
},
|
||||
responsive: ["md"]
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
title: t('joblines.fields.status'),
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
title: t("joblines.fields.status"),
|
||||
dataIndex: "status",
|
||||
key: "status",
|
||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||
sortOrder: state.sortedInfo.columnKey === 'status' && state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
filteredValue: state.filteredInfo.status || null,
|
||||
|
||||
filters:
|
||||
@@ -316,18 +304,18 @@ export function JobLinesComponent({
|
||||
.filter(onlyUnique)
|
||||
.map((s) => {
|
||||
return {
|
||||
text: s || 'No Status*',
|
||||
value: [s],
|
||||
text: s || "No Status*",
|
||||
value: [s]
|
||||
};
|
||||
})) ||
|
||||
[],
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
render: (text, record) => <JobLineStatusPopup jobline={record} disabled={jobRO} />,
|
||||
render: (text, record) => <JobLineStatusPopup jobline={record} disabled={jobRO} />
|
||||
},
|
||||
{
|
||||
title: t('general.labels.actions'),
|
||||
dataIndex: 'actions',
|
||||
key: 'actions',
|
||||
title: t("general.labels.actions"),
|
||||
dataIndex: "actions",
|
||||
key: "actions",
|
||||
render: (text, record) => (
|
||||
<Space>
|
||||
{(record.manual_line || jobIsPrivate) && (
|
||||
@@ -337,7 +325,7 @@ export function JobLinesComponent({
|
||||
onClick={() => {
|
||||
setJobLineEditContext({
|
||||
actions: { refetch: refetch, submit: form && form.submit },
|
||||
context: { ...record, jobid: job.id },
|
||||
context: { ...record, jobid: job.id }
|
||||
});
|
||||
}}
|
||||
>
|
||||
@@ -352,16 +340,14 @@ export function JobLinesComponent({
|
||||
cache.modify({
|
||||
fields: {
|
||||
joblines(existingJobLines, { readField }) {
|
||||
return existingJobLines.filter(
|
||||
(jlRef) => record.id !== readField('id', jlRef)
|
||||
);
|
||||
},
|
||||
},
|
||||
return existingJobLines.filter((jlRef) => record.id !== readField("id", jlRef));
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
await axios.post('/job/totalsssu', {
|
||||
id: job.id,
|
||||
await axios.post("/job/totalsssu", {
|
||||
id: job.id
|
||||
});
|
||||
refetch && refetch();
|
||||
}}
|
||||
@@ -371,31 +357,29 @@ export function JobLinesComponent({
|
||||
</>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState((state) => ({
|
||||
...state,
|
||||
filteredInfo: filters,
|
||||
sortedInfo: sorter,
|
||||
sortedInfo: sorter
|
||||
}));
|
||||
};
|
||||
|
||||
const handleMark = (e) => {
|
||||
if (e.key === 'clear') {
|
||||
if (e.key === "clear") {
|
||||
setSelectedLines([]);
|
||||
} else {
|
||||
const markedTypes = [e.key];
|
||||
if (e.key === 'PAN') markedTypes.push('PAP');
|
||||
if (e.key === 'PAS') markedTypes.push('PASL');
|
||||
if (e.key === "PAN") markedTypes.push("PAP");
|
||||
if (e.key === "PAS") markedTypes.push("PASL");
|
||||
setSelectedLines((selectedLines) =>
|
||||
_.uniq([
|
||||
...selectedLines,
|
||||
...jobLines.filter(
|
||||
(item) => markedTypes.includes(item.part_type) || markedTypes.includes(item.mod_lbr_ty)
|
||||
),
|
||||
...jobLines.filter((item) => markedTypes.includes(item.part_type) || markedTypes.includes(item.mod_lbr_ty))
|
||||
])
|
||||
);
|
||||
}
|
||||
@@ -404,35 +388,35 @@ export function JobLinesComponent({
|
||||
const markMenu = {
|
||||
onClick: handleMark,
|
||||
items: [
|
||||
{ key: 'PAA', label: t('joblines.fields.part_types.PAA') },
|
||||
{ key: 'PAN', label: t('joblines.fields.part_types.PAN') },
|
||||
{ key: 'PAL', label: t('joblines.fields.part_types.PAL') },
|
||||
{ key: 'PAS', label: t('joblines.fields.part_types.PAS') },
|
||||
{ type: 'divider' },
|
||||
{ key: 'LAA', label: t('joblines.fields.lbr_types.LAA') },
|
||||
{ key: 'LAB', label: t('joblines.fields.lbr_types.LAB') },
|
||||
{ key: 'LAD', label: t('joblines.fields.lbr_types.LAD') },
|
||||
{ key: 'LAE', label: t('joblines.fields.lbr_types.LAE') },
|
||||
{ key: 'LAF', label: t('joblines.fields.lbr_types.LAF') },
|
||||
{ key: 'LAG', label: t('joblines.fields.lbr_types.LAG') },
|
||||
{ key: 'LAM', label: t('joblines.fields.lbr_types.LAM') },
|
||||
{ key: 'LAR', label: t('joblines.fields.lbr_types.LAR') },
|
||||
{ key: 'LAS', label: t('joblines.fields.lbr_types.LAS') },
|
||||
{ key: 'LAU', label: t('joblines.fields.lbr_types.LAU') },
|
||||
{ key: 'LA1', label: t('joblines.fields.lbr_types.LA1') },
|
||||
{ key: 'LA2', label: t('joblines.fields.lbr_types.LA2') },
|
||||
{ key: 'LA3', label: t('joblines.fields.lbr_types.LA3') },
|
||||
{ key: 'LA4', label: t('joblines.fields.lbr_types.LA4') },
|
||||
{ type: 'divider' },
|
||||
{ key: 'clear', label: t('general.labels.clear') },
|
||||
],
|
||||
{ key: "PAA", label: t("joblines.fields.part_types.PAA") },
|
||||
{ key: "PAN", label: t("joblines.fields.part_types.PAN") },
|
||||
{ key: "PAL", label: t("joblines.fields.part_types.PAL") },
|
||||
{ key: "PAS", label: t("joblines.fields.part_types.PAS") },
|
||||
{ type: "divider" },
|
||||
{ key: "LAA", label: t("joblines.fields.lbr_types.LAA") },
|
||||
{ key: "LAB", label: t("joblines.fields.lbr_types.LAB") },
|
||||
{ key: "LAD", label: t("joblines.fields.lbr_types.LAD") },
|
||||
{ key: "LAE", label: t("joblines.fields.lbr_types.LAE") },
|
||||
{ key: "LAF", label: t("joblines.fields.lbr_types.LAF") },
|
||||
{ key: "LAG", label: t("joblines.fields.lbr_types.LAG") },
|
||||
{ key: "LAM", label: t("joblines.fields.lbr_types.LAM") },
|
||||
{ key: "LAR", label: t("joblines.fields.lbr_types.LAR") },
|
||||
{ key: "LAS", label: t("joblines.fields.lbr_types.LAS") },
|
||||
{ key: "LAU", label: t("joblines.fields.lbr_types.LAU") },
|
||||
{ key: "LA1", label: t("joblines.fields.lbr_types.LA1") },
|
||||
{ key: "LA2", label: t("joblines.fields.lbr_types.LA2") },
|
||||
{ key: "LA3", label: t("joblines.fields.lbr_types.LA3") },
|
||||
{ key: "LA4", label: t("joblines.fields.lbr_types.LA4") },
|
||||
{ type: "divider" },
|
||||
{ key: "clear", label: t("general.labels.clear") }
|
||||
]
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<PartsOrderModalContainer />
|
||||
<PageHeader
|
||||
title={t('jobs.labels.estimatelines')}
|
||||
title={t("jobs.labels.estimatelines")}
|
||||
extra={
|
||||
<Space wrap>
|
||||
<Button onClick={() => refetch()}>
|
||||
@@ -443,29 +427,16 @@ export function JobLinesComponent({
|
||||
<Tag color="tomato">
|
||||
<Space>
|
||||
<WarningFilled />
|
||||
<span>{t('jobs.labels.specialcoveragepolicy')}</span>
|
||||
<span>{t("jobs.labels.specialcoveragepolicy")}</span>
|
||||
</Space>
|
||||
</Tag>
|
||||
)}
|
||||
<JobLineDispatchButton
|
||||
selectedLines={selectedLines}
|
||||
setSelectedLines={setSelectedLines}
|
||||
job={job}
|
||||
/>
|
||||
{Enhanced_Payroll.treatment === 'on' && (
|
||||
<JobLineBulkAssignComponent
|
||||
selectedLines={selectedLines}
|
||||
setSelectedLines={setSelectedLines}
|
||||
job={job}
|
||||
/>
|
||||
<JobLineDispatchButton selectedLines={selectedLines} setSelectedLines={setSelectedLines} job={job} />
|
||||
{Enhanced_Payroll.treatment === "on" && (
|
||||
<JobLineBulkAssignComponent selectedLines={selectedLines} setSelectedLines={setSelectedLines} job={job} />
|
||||
)}
|
||||
<Button
|
||||
disabled={
|
||||
(job && !job.converted) ||
|
||||
(selectedLines.length > 0 ? false : true) ||
|
||||
jobRO ||
|
||||
technician
|
||||
}
|
||||
disabled={(job && !job.converted) || (selectedLines.length > 0 ? false : true) || jobRO || technician}
|
||||
onClick={() => {
|
||||
setBillEnterContext({
|
||||
actions: { refetch: refetch },
|
||||
@@ -474,7 +445,7 @@ export function JobLinesComponent({
|
||||
job: { id: job.id },
|
||||
bill: {
|
||||
vendorid: bodyshop.inhousevendorid,
|
||||
invoice_number: 'ih',
|
||||
invoice_number: "ih",
|
||||
isinhouse: true,
|
||||
date: new dayjs(),
|
||||
total: 0,
|
||||
@@ -490,12 +461,12 @@ export function JobLinesComponent({
|
||||
applicable_taxes: {
|
||||
local: false,
|
||||
state: false,
|
||||
federal: false,
|
||||
},
|
||||
federal: false
|
||||
}
|
||||
};
|
||||
}),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//Clear out the selected lines. IO-785
|
||||
@@ -503,16 +474,11 @@ export function JobLinesComponent({
|
||||
}}
|
||||
>
|
||||
<HomeOutlined />
|
||||
{t('parts.actions.orderinhouse')}
|
||||
{t("parts.actions.orderinhouse")}
|
||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||
</Button>
|
||||
<Button
|
||||
disabled={
|
||||
(job && !job.converted) ||
|
||||
(selectedLines.length > 0 ? false : true) ||
|
||||
jobRO ||
|
||||
technician
|
||||
}
|
||||
disabled={(job && !job.converted) || (selectedLines.length > 0 ? false : true) || jobRO || technician}
|
||||
onClick={() => {
|
||||
setPartsOrderContext({
|
||||
actions: { refetch: refetch },
|
||||
@@ -521,18 +487,16 @@ export function JobLinesComponent({
|
||||
job: job,
|
||||
linesToOrder: selectedLines.map((l) => ({
|
||||
...l,
|
||||
oem_partno: `${l.oem_partno || ''} ${
|
||||
l.alt_partno ? `(${l.alt_partno})` : ''
|
||||
}`.trim(),
|
||||
})),
|
||||
},
|
||||
oem_partno: `${l.oem_partno || ""} ${l.alt_partno ? `(${l.alt_partno})` : ""}`.trim()
|
||||
}))
|
||||
}
|
||||
});
|
||||
|
||||
//Clear out the selected lines. IO-785
|
||||
setSelectedLines([]);
|
||||
}}
|
||||
>
|
||||
{t('parts.actions.order')}
|
||||
{t("parts.actions.order")}
|
||||
{selectedLines.length > 0 && ` (${selectedLines.length})`}
|
||||
</Button>
|
||||
<Button
|
||||
@@ -541,44 +505,31 @@ export function JobLinesComponent({
|
||||
...state,
|
||||
filteredInfo: {
|
||||
...state.filteredInfo,
|
||||
part_type: [
|
||||
'PAN',
|
||||
'PAC',
|
||||
'PAR',
|
||||
'PAL',
|
||||
'PAA',
|
||||
'PAM',
|
||||
'PAP',
|
||||
'PAS',
|
||||
'PASL',
|
||||
'PAG',
|
||||
],
|
||||
},
|
||||
part_type: ["PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG"]
|
||||
}
|
||||
}));
|
||||
}}
|
||||
>
|
||||
<FilterFilled /> {t('jobs.actions.filterpartsonly')}
|
||||
<FilterFilled /> {t("jobs.actions.filterpartsonly")}
|
||||
</Button>
|
||||
<Dropdown menu={markMenu} trigger={['click']}>
|
||||
<Button>{t('jobs.actions.mark')}</Button>
|
||||
<Dropdown menu={markMenu} trigger={["click"]}>
|
||||
<Button>{t("jobs.actions.mark")}</Button>
|
||||
</Dropdown>
|
||||
<Button
|
||||
disabled={jobRO || technician}
|
||||
onClick={() => {
|
||||
setJobLineEditContext({
|
||||
actions: { refetch: refetch },
|
||||
context: { jobid: job.id },
|
||||
context: { jobid: job.id }
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('joblines.actions.new')}
|
||||
{t("joblines.actions.new")}
|
||||
</Button>
|
||||
{bodyshop.region_config.toLowerCase().startsWith('us') && (
|
||||
<JobSendPartPriceChangeComponent job={job} />
|
||||
)}
|
||||
{bodyshop.region_config.toLowerCase().startsWith("us") && <JobSendPartPriceChangeComponent job={job} />}
|
||||
<JobCreateIOU job={job} selectedJobLines={selectedLines} />
|
||||
<Input.Search
|
||||
placeholder={t('general.labels.search')}
|
||||
placeholder={t("general.labels.search")}
|
||||
onChange={(e) => {
|
||||
e.preventDefault();
|
||||
setSearchText(e.target.value);
|
||||
@@ -595,7 +546,7 @@ export function JobLinesComponent({
|
||||
dataSource={jobLines}
|
||||
onChange={handleTableChange}
|
||||
scroll={{
|
||||
x: true,
|
||||
x: true
|
||||
}}
|
||||
expandable={{
|
||||
expandedRowRender: (record) => <JobLinesExpander jobline={record} jobid={job.id} />,
|
||||
@@ -606,7 +557,7 @@ export function JobLinesComponent({
|
||||
<MinusCircleTwoTone onClick={(e) => onExpand(record, e)} />
|
||||
) : (
|
||||
<PlusCircleTwoTone onClick={(e) => onExpand(record, e)} />
|
||||
),
|
||||
)
|
||||
}}
|
||||
onRow={(record, rowIndex) => {
|
||||
return {
|
||||
@@ -615,7 +566,7 @@ export function JobLinesComponent({
|
||||
notMatchingLines.length !== selectedLines.length
|
||||
? setSelectedLines(notMatchingLines)
|
||||
: setSelectedLines([...selectedLines, record]);
|
||||
}, // double click row
|
||||
} // double click row
|
||||
};
|
||||
}}
|
||||
rowSelection={{
|
||||
@@ -625,11 +576,11 @@ export function JobLinesComponent({
|
||||
},
|
||||
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
||||
if (selected) {
|
||||
setSelectedLines((selectedLines) => _.uniqBy([...selectedLines, record], 'id'));
|
||||
setSelectedLines((selectedLines) => _.uniqBy([...selectedLines, record], "id"));
|
||||
} else {
|
||||
setSelectedLines((selectedLines) => selectedLines.filter((l) => l.id !== record.id));
|
||||
}
|
||||
},
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -1,48 +1,29 @@
|
||||
import React, {useMemo, useState} from "react";
|
||||
import React, { useMemo, useState } from "react";
|
||||
import JobLinesComponent from "./job-lines.component";
|
||||
|
||||
function JobLinesContainer({job, joblines, refetch, form, ...rest}) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
function JobLinesContainer({ job, joblines, refetch, form, ...rest }) {
|
||||
const [searchText, setSearchText] = useState("");
|
||||
|
||||
const jobLines = useMemo(() => {
|
||||
return joblines
|
||||
? searchText
|
||||
? joblines.filter(
|
||||
(jl) =>
|
||||
(jl.unq_seq || "")
|
||||
.toString()
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.line_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.part_type || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.oem_partno || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.op_code_desc || "")
|
||||
.toLowerCase()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.db_price || "")
|
||||
.toString()
|
||||
.includes(searchText.toLowerCase()) ||
|
||||
(jl.act_price || "").toString().includes(searchText.toLowerCase())
|
||||
)
|
||||
: joblines
|
||||
: [];
|
||||
}, [joblines, searchText]);
|
||||
const jobLines = useMemo(() => {
|
||||
return joblines
|
||||
? searchText
|
||||
? joblines.filter(
|
||||
(jl) =>
|
||||
(jl.unq_seq || "").toString().toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(jl.line_desc || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(jl.part_type || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(jl.oem_partno || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(jl.op_code_desc || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||
(jl.db_price || "").toString().includes(searchText.toLowerCase()) ||
|
||||
(jl.act_price || "").toString().includes(searchText.toLowerCase())
|
||||
)
|
||||
: joblines
|
||||
: [];
|
||||
}, [joblines, searchText]);
|
||||
|
||||
return (
|
||||
<JobLinesComponent
|
||||
refetch={refetch}
|
||||
jobLines={jobLines}
|
||||
setSearchText={setSearchText}
|
||||
job={job}
|
||||
form={form}
|
||||
/>
|
||||
);
|
||||
return (
|
||||
<JobLinesComponent refetch={refetch} jobLines={jobLines} setSearchText={setSearchText} job={job} form={form} />
|
||||
);
|
||||
}
|
||||
|
||||
export default JobLinesContainer;
|
||||
|
||||
Reference in New Issue
Block a user