diff --git a/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx
new file mode 100644
index 000000000..5df9127e9
--- /dev/null
+++ b/client/src/components/parts-order-backorder-eta/parts-order-backorder-eta.component.jsx
@@ -0,0 +1,91 @@
+import { useMutation } from "@apollo/client";
+import { Button, Form, notification, Popover, Spin } from "antd";
+import React, { useState } from "react";
+import { useTranslation } from "react-i18next";
+import { connect } from "react-redux";
+import { createStructuredSelector } from "reselect";
+import { logImEXEvent } from "../../firebase/firebase.utils";
+import { MUTATION_UPDATE_BO_ETA } from "../../graphql/parts-orders.queries";
+import { selectBodyshop } from "../../redux/user/user.selectors";
+import { DateFormatter } from "../../utils/DateFormatter";
+import FormDatePicker from "../form-date-picker/form-date-picker.component";
+import { CalendarFilled } from "@ant-design/icons";
+const mapStateToProps = createStructuredSelector({
+ bodyshop: selectBodyshop,
+});
+
+export function PartsOrderBackorderEta({
+ backordered_eta,
+ partsOrderStatus,
+ partsLineId,
+ jobLineId,
+ disabled,
+ bodyshop,
+}) {
+ const [visibility, setVisibility] = useState(false);
+ const [loading, setLoading] = useState(false);
+ const [updateBoDate] = useMutation(MUTATION_UPDATE_BO_ETA);
+ const { t } = useTranslation();
+ const [form] = Form.useForm();
+
+ const isAlreadyBackordered =
+ bodyshop.md_order_statuses.default_bo === partsOrderStatus;
+
+ const handleFinish = async (values) => {
+ setLoading(true);
+ logImEXEvent("job_parts_backorder_update_eta");
+
+ const result = await updateBoDate({
+ variables: {
+ partsLineId,
+ partsOrder: { backordered_eta: values.eta },
+ },
+ });
+
+ if (!!result.errors) {
+ notification["error"]({
+ message: t("parts_orders.errors.backordering", {
+ message: JSON.stringify(result.errors),
+ }),
+ });
+ }
+
+ setVisibility(false);
+ setLoading(false);
+ };
+
+ const handlePopover = (e) => {
+ setVisibility(true);
+ };
+
+ const popContent = (
+
+
+
+
+
+
+
+
+ );
+
+ return (
+
+ {backordered_eta}
+ {isAlreadyBackordered && (
+
+ )}
+ {loading && }
+
+ );
+}
+
+export default connect(mapStateToProps, null)(PartsOrderBackorderEta);
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 3cc442633..78552bb98 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
@@ -14,6 +14,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
import { DateFormatter } from "../../utils/DateFormatter";
import { alphaSort } from "../../utils/sorters";
import { TemplateList } from "../../utils/TemplateConstants";
+import PartsOrderBackorderEta from "../parts-order-backorder-eta/parts-order-backorder-eta.component";
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";
@@ -245,7 +246,15 @@ export function PartsOrderListTableComponent({
title: t("parts_orders.fields.backordered_eta"),
dataIndex: "backordered_eta",
key: "backordered_eta",
- render: (text, record) => {text},
+ render: (text, record) => (
+
+ ),
},
{
title: t("general.labels.actions"),
diff --git a/client/src/graphql/parts-orders.queries.js b/client/src/graphql/parts-orders.queries.js
index 65de1f573..3559b4bc7 100644
--- a/client/src/graphql/parts-orders.queries.js
+++ b/client/src/graphql/parts-orders.queries.js
@@ -10,6 +10,24 @@ export const INSERT_NEW_PARTS_ORDERS = gql`
}
`;
+export const MUTATION_UPDATE_BO_ETA = gql`
+ mutation MUTATION_UPDATE_BO_ETA(
+ $partsLineId: uuid!
+ $partsOrder: parts_order_lines_set_input
+ ) {
+ update_parts_order_lines(
+ where: { id: { _eq: $partsLineId } }
+ _set: $partsOrder
+ ) {
+ returning {
+ status
+ backordered_eta
+ id
+ }
+ }
+ }
+`;
+
export const MUTATION_BACKORDER_PART_LINE = gql`
mutation MUTATION_BACKORDER_PART_LINE(
$jobLineId: uuid!