diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index 5e77d1534..9b5598b52 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -22856,6 +22856,27 @@ labels + + allpartsto + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + email false @@ -22982,6 +23003,27 @@ + + receive + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + returnpartsorder false diff --git a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx index d0f4b180e..cfe7a76c6 100644 --- a/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx +++ b/client/src/components/bill-enter-modal/bill-enter-modal.container.jsx @@ -44,10 +44,6 @@ function BillEnterModalContainer({ const client = useApolloClient(); const handleFinish = async (values) => { - console.log( - "🚀 ~ file: bill-enter-modal.container.jsx ~ line 41 ~ handleFinish ~ values", - values - ); setLoading(true); const { upload, location, ...remainingValues } = values; 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 625b12d46..34843fc9d 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -14,11 +14,13 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter"; 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 PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; + const mapStateToProps = createStructuredSelector({ //currentUser: selectCurrentUser jobRO: selectJobReadOnly, @@ -257,6 +259,9 @@ export function JobLinesComponent({ })) || [], onFilter: (value, record) => value.includes(record.status), + render: (text, record) => ( + + ), }, // { // title: t("allocations.fields.employee"), diff --git a/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx b/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx new file mode 100644 index 000000000..40b91d7bc --- /dev/null +++ b/client/src/components/job-line-status-popup/job-line-status-popup.component.jsx @@ -0,0 +1,82 @@ +import { notification, Select } from "antd"; +import React, { useEffect, useState } from "react"; +import { useMutation } from "react-apollo"; +import { useTranslation } from "react-i18next"; +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; + +const mapStateToProps = createStructuredSelector({ + //currentUser: selectCurrentUser + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); + +export function JobLineStatusPopup({ bodyshop, jobline, disabled }) { + const [editing, setEditing] = useState(false); + const [loading, setLoading] = useState(false); + const [status, setStatus] = useState(jobline.status); + const [updateJob] = useMutation(UPDATE_JOB_LINE); + const { t } = useTranslation(); + + useEffect(() => { + if (editing) setStatus(jobline.status); + }, [editing, jobline.status]); + + const handleChange = (e) => { + setStatus(e); + }; + + const handleSave = async (e) => { + setLoading(true); + const result = await updateJob({ + variables: { lineId: jobline.id, line: { status: status || "" } }, + }); + + if (!!!result.errors) { + notification["success"]({ message: t("joblines.successes.saved") }); + } else { + notification["error"]({ + message: t("joblines.errors.saving", { + error: JSON.stringify(result.errors), + }), + }); + } + setLoading(false); + setEditing(false); + }; + + if (editing) + return ( +
+ + + +
+ ); + return ( +
!disabled && setEditing(true)} + > + {jobline.status} +
+ ); +} +export default connect(mapStateToProps, mapDispatchToProps)(JobLineStatusPopup); diff --git a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx index 55e55270b..dd8a75348 100644 --- a/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx +++ b/client/src/components/parts-order-list-table/parts-order-list-table.component.jsx @@ -15,6 +15,7 @@ import { DateFormatter } from "../../utils/DateFormatter"; import { alphaSort } from "../../utils/sorters"; import { TemplateList } from "../../utils/TemplateConstants"; import PartsOrderLineBackorderButton from "../parts-order-line-backorder-button/parts-order-line-backorder-button.component"; +import PartsReceiveModalContainer from "../parts-receive-modal/parts-receive-modal.container"; import PrintWrapper from "../print-wrapper/print-wrapper.component"; const mapStateToProps = createStructuredSelector({ @@ -25,6 +26,8 @@ const mapStateToProps = createStructuredSelector({ const mapDispatchToProps = (dispatch) => ({ setBillEnterContext: (context) => dispatch(setModalContext({ context: context, modal: "billEnter" })), + setPartsReceiveContext: (context) => + dispatch(setModalContext({ context: context, modal: "partsReceive" })), }); export function PartsOrderListTableComponent({ @@ -34,6 +37,7 @@ export function PartsOrderListTableComponent({ job, billsQuery, handleOnRowClick, + setPartsReceiveContext, }) { const responsibilityCenters = bodyshop.md_responsibility_centers; @@ -102,6 +106,29 @@ export function PartsOrderListTableComponent({ key: "actions", render: (text, record) => ( +