diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel index c73ff4b0c..76f6984b1 100644 --- a/bodyshop_translations.babel +++ b/bodyshop_translations.babel @@ -886,6 +886,27 @@ + + addpartslocation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + addspeedprint false @@ -1379,6 +1400,27 @@ + + partslocation + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + responsibilitycenter false @@ -8601,6 +8643,27 @@ + + location + false + + + + + + en-US + false + + + es-MX + false + + + fr-CA + false + + + mod_lb_hrs false 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 01d9e3333..fbc9e289e 100644 --- a/client/src/components/job-detail-lines/job-lines.component.jsx +++ b/client/src/components/job-detail-lines/job-lines.component.jsx @@ -13,6 +13,7 @@ import { alphaSort } from "../../utils/sorters"; // import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container"; import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container"; import JobLineNotePopup from "../job-line-note-popup/job-line-note-popup.component"; +import JobLineLocationPopup from "../job-line-location-popup/job-line-location-popup.component"; const mapDispatchToProps = (dispatch) => ({ setJobLineEditContext: (context) => @@ -170,6 +171,12 @@ export function JobLinesComponent({ key: "notes", render: (text, record) => , }, + { + title: t("joblines.fields.location"), + dataIndex: "location", + key: "location", + render: (text, record) => , + }, { title: t("joblines.fields.status"), dataIndex: "status", diff --git a/client/src/components/job-line-location-popup/job-line-location-popup.component.jsx b/client/src/components/job-line-location-popup/job-line-location-popup.component.jsx new file mode 100644 index 000000000..8d0d0d138 --- /dev/null +++ b/client/src/components/job-line-location-popup/job-line-location-popup.component.jsx @@ -0,0 +1,83 @@ +import React, { useState, useEffect } from "react"; +import { Input, notification, Select } from "antd"; +import LoadingSpinner from "../loading-spinner/loading-spinner.component"; +import { useMutation } from "react-apollo"; +import { UPDATE_JOB_LINE } from "../../graphql/jobs-lines.queries"; +import { useTranslation } from "react-i18next"; + +import { connect } from "react-redux"; +import { createStructuredSelector } from "reselect"; +import { selectBodyshop } from "../../redux/user/user.selectors"; +const mapStateToProps = createStructuredSelector({ + //currentUser: selectCurrentUser + bodyshop: selectBodyshop, +}); +const mapDispatchToProps = (dispatch) => ({ + //setUserLanguage: language => dispatch(setUserLanguage(language)) +}); + +export function JobLineLocationPopup({ bodyshop, jobline }) { + const [editing, setEditing] = useState(false); + const [loading, setLoading] = useState(false); + const [location, setLocation] = useState(jobline.location); + const [updateJob] = useMutation(UPDATE_JOB_LINE); + const { t } = useTranslation(); + + useEffect(() => { + if (editing) setLocation(jobline.location); + }, [editing, jobline.location]); + + const handleChange = (e) => { + setLocation(e); + }; + + const handleSave = async (e) => { + setLoading(true); + const result = await updateJob({ + variables: { lineId: jobline.id, line: { location: location || "" } }, + }); + + 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 ( +
setEditing(true)} + > + {jobline.location} +
+ ); +} +export default connect( + mapStateToProps, + mapDispatchToProps +)(JobLineLocationPopup); diff --git a/client/src/components/shop-info/shop-info.component.jsx b/client/src/components/shop-info/shop-info.component.jsx index d0efeeff9..8a5183d11 100644 --- a/client/src/components/shop-info/shop-info.component.jsx +++ b/client/src/components/shop-info/shop-info.component.jsx @@ -17,6 +17,7 @@ import ShopInfoSchedulingComponent from "./shop-info.scheduling.component"; import LayoutFormRow from "../layout-form-row/layout-form-row.component"; import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component"; import ShopInfoSpeedPrint from "./shop-info.speedprint.component"; +import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component"; export default function ShopInfoComponent({ form, saveLoading }) { const { t } = useTranslation(); @@ -273,6 +274,61 @@ export default function ShopInfoComponent({ form, saveLoading }) { ); }} + + + {(fields, { add, remove, move }) => { + return ( +
+ {fields.map((field, index) => ( + +
+ + + + + { + remove(field.name); + }} + /> + +
+
+ ))} + + + +
+ ); + }} +