From 87f25b1ed4580387984dff0dc7957cee1ee8165e Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Thu, 1 Aug 2024 12:16:56 -0700 Subject: [PATCH] IO-2857 Tech console fixes Signed-off-by: Allan Carr --- .../job-lines-expander.component.jsx | 30 ++++++++++++++----- .../job-lines-part-price-change.component.jsx | 13 ++++++-- .../job-detail-lines/job-lines.component.jsx | 23 +++++++------- .../job-line-convert-to-labor.component.jsx | 7 +++-- .../job-send-parts-price-change.component.jsx | 4 +-- client/src/pages/tech/tech.page.component.jsx | 3 ++ 6 files changed, 54 insertions(+), 26 deletions(-) diff --git a/client/src/components/job-detail-lines/job-lines-expander.component.jsx b/client/src/components/job-detail-lines/job-lines-expander.component.jsx index ceec1b2df..2d932bba5 100644 --- a/client/src/components/job-detail-lines/job-lines-expander.component.jsx +++ b/client/src/components/job-detail-lines/job-lines-expander.component.jsx @@ -7,6 +7,7 @@ import { Link } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import { GET_JOB_LINE_ORDERS } from "../../graphql/jobs.queries"; import { QUERY_JOBLINE_TASKS_PAGINATED } from "../../graphql/tasks.queries.js"; +import { selectTechnician } from "../../redux/tech/tech.selectors.js"; import { selectBodyshop } from "../../redux/user/user.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; import { DateFormatter } from "../../utils/DateFormatter"; @@ -16,14 +17,15 @@ import FeatureWrapper from "../feature-wrapper/feature-wrapper.component.jsx"; import TaskListContainer from "../task-list/task-list.container.jsx"; const mapStateToProps = createStructuredSelector({ - bodyshop: selectBodyshop + bodyshop: selectBodyshop, + technician: selectTechnician }); const mapDispatchToProps = (dispatch) => ({}); export default connect(mapStateToProps, mapDispatchToProps)(JobLinesExpander); -export function JobLinesExpander({ jobline, jobid, bodyshop }) { +export function JobLinesExpander({ jobline, jobid, bodyshop, technician }) { const { t } = useTranslation(); const { loading, error, data } = useQuery(GET_JOB_LINE_ORDERS, { fetchPolicy: "network-only", @@ -48,9 +50,15 @@ export function JobLinesExpander({ jobline, jobid, bodyshop }) { children: ( - - {line.parts_order.order_number} - + {!technician ? ( + <> + + {line.parts_order.order_number} + + + ) : ( + `${line.parts_order.order_number}` + )} {line.parts_order.order_date} @@ -121,9 +129,15 @@ export function JobLinesExpander({ jobline, jobid, bodyshop }) { children: ( - - {line.bill.invoice_number} - + {!technician ? ( + <> + + {line.bill.invoice_number} + + + ) : ( + `${line.bill.invoice_number}` + )} diff --git a/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx b/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx index 9b394af71..a7548542c 100644 --- a/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx +++ b/client/src/components/job-detail-lines/job-lines-part-price-change.component.jsx @@ -3,13 +3,21 @@ import { Button, Form, notification, Popover, Tooltip } from "antd"; import axios from "axios"; import { t } from "i18next"; import React, { useState } from "react"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; import { UPDATE_LINE_PPC } from "../../graphql/jobs-lines.queries"; +import { selectTechnician } from "../../redux/tech/tech.selectors"; import CurrencyFormatter from "../../utils/CurrencyFormatter"; 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 mapStateToProps = createStructuredSelector({ + technician: selectTechnician +}); +const mapDispatchToProps = (dispatch) => ({}); + +export function JobLinesPartPriceChange({ job, line, refetch, technician }) { const [loading, setLoading] = useState(false); const [updatePartPrice] = useMutation(UPDATE_LINE_PPC); @@ -52,7 +60,7 @@ export default function JobLinesPartPriceChange({ job, line, refetch }) { } }; - const popcontent = InstanceRenderManager({ + const popcontent = !technician && InstanceRenderManager({ imex: null, rome: (
@@ -95,3 +103,4 @@ export default function JobLinesPartPriceChange({ job, line, refetch }) { ); } +export default connect(mapStateToProps, mapDispatchToProps)(JobLinesPartPriceChange); diff --git a/client/src/components/job-detail-lines/job-lines.component.jsx b/client/src/components/job-detail-lines/job-lines.component.jsx index a639001f9..75414538c 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -329,7 +329,7 @@ export function JobLinesComponent({ key: "actions", render: (text, record) => ( - {(record.manual_line || jobIsPrivate) && ( + {(record.manual_line || jobIsPrivate) && !technician && ( <> - {(record.manual_line || jobIsPrivate) && ( + {(record.manual_line || jobIsPrivate) && !technician && ( <> - {InstanceRenderManager({ rome: })} + {InstanceRenderManager({ rome: })} ({ insertAuditTrail: ({ jobid, operation, type }) => dispatch(insertAuditTrail({ jobid, operation, type })) }); export default connect(mapStateToProps, mapDispatchToProps)(JobLineConvertToLabor); -export function JobLineConvertToLabor({ children, jobline, job, insertAuditTrail, ...otherBtnProps }) { +export function JobLineConvertToLabor({ children, jobline, job, insertAuditTrail, technician, ...otherBtnProps }) { const { t } = useTranslation(); const [loading, setLoading] = useState(false); @@ -165,7 +166,7 @@ export function JobLineConvertToLabor({ children, jobline, job, insertAuditTrail return ( <> {children} - {jobline.act_price !== 0 && ( + {jobline.act_price !== 0 && !technician && ( ); diff --git a/client/src/pages/tech/tech.page.component.jsx b/client/src/pages/tech/tech.page.component.jsx index 9f6b11cf7..2733bae68 100644 --- a/client/src/pages/tech/tech.page.component.jsx +++ b/client/src/pages/tech/tech.page.component.jsx @@ -33,6 +33,8 @@ const TimeTicketModalTask = lazy( const TechAssignedProdJobs = lazy(() => import("../tech-assigned-prod-jobs/tech-assigned-prod-jobs.component")); const TechDispatchedParts = lazy(() => import("../tech-dispatched-parts/tech-dispatched-parts.page")); +const TaskUpsertModalContainer = lazy(() => import("../../components/task-upsert-modal/task-upsert-modal.container")); + const { Content } = Layout; const mapStateToProps = createStructuredSelector({ @@ -67,6 +69,7 @@ export function TechPage({ technician }) { +