diff --git a/bodyshop_translations.babel b/bodyshop_translations.babel
index b4aaee9da..7c733bcdc 100644
--- a/bodyshop_translations.babel
+++ b/bodyshop_translations.babel
@@ -5754,6 +5754,27 @@
+
+ addtoproduction
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
changestatus
false
@@ -5906,6 +5927,27 @@
errors
+
+ addingtoproduction
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
creating
false
@@ -8876,6 +8918,27 @@
successes
+
+ addedtoproduction
+ false
+
+
+
+
+
+ en-US
+ false
+
+
+ es-MX
+ false
+
+
+ fr-CA
+ false
+
+
+
all_deleted
false
diff --git a/client/src/App/App.container.jsx b/client/src/App/App.container.jsx
index bcf9825c6..ab18d78e2 100644
--- a/client/src/App/App.container.jsx
+++ b/client/src/App/App.container.jsx
@@ -15,14 +15,14 @@ import { auth } from "../firebase/firebase.utils";
import errorLink from "../graphql/apollo-error-handling";
import App from "./App";
-import LogRocket from 'logrocket';
-LogRocket.init('gvfvfw/bodyshopapp');
+import LogRocket from "logrocket";
+LogRocket.init("gvfvfw/bodyshopapp");
export default class AppContainer extends Component {
constructor() {
super();
const httpLink = new HttpLink({
- uri: process.env.REACT_APP_GRAPHQL_ENDPOINT
+ uri: process.env.REACT_APP_GRAPHQL_ENDPOINT,
});
const wsLink = new WebSocketLink({
@@ -36,18 +36,18 @@ export default class AppContainer extends Component {
if (token) {
return {
headers: {
- authorization: token ? `Bearer ${token}` : ""
- }
+ authorization: token ? `Bearer ${token}` : "",
+ },
};
}
- }
- }
+ },
+ },
});
const subscriptionMiddleware = {
applyMiddleware: async (options, next) => {
options.authToken = await auth.currentUser.getIdToken(true);
next();
- }
+ },
};
wsLink.subscriptionClient.use([subscriptionMiddleware]);
@@ -73,13 +73,13 @@ export default class AppContainer extends Component {
);
const authLink = setContext((_, { headers }) => {
- return auth.currentUser.getIdToken().then(token => {
+ return auth.currentUser.getIdToken().then((token) => {
if (token) {
return {
headers: {
...headers,
- authorization: token ? `Bearer ${token}` : ""
- }
+ authorization: token ? `Bearer ${token}` : "",
+ },
};
} else {
return { headers };
@@ -91,12 +91,12 @@ export default class AppContainer extends Component {
delay: {
initial: 300,
max: 5,
- jitter: true
+ jitter: true,
},
attempts: {
max: 5,
- retryIf: (error, _operation) => !!error
- }
+ retryIf: (error, _operation) => !!error,
+ },
});
const middlewares = [];
@@ -110,7 +110,7 @@ export default class AppContainer extends Component {
const client = new ApolloClient({
link: ApolloLink.from(middlewares),
cache,
- connectToDevTools: true
+ connectToDevTools: true,
});
this.state = { client };
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.addtoproduction.util.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.addtoproduction.util.jsx
new file mode 100644
index 000000000..19c44ed83
--- /dev/null
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.addtoproduction.util.jsx
@@ -0,0 +1,33 @@
+import { notification } from "antd";
+import i18n from "i18next";
+import { UPDATE_JOB } from "../../graphql/jobs.queries";
+
+export default function AddToProduction(
+ apolloClient,
+ jobId,
+ completionCallback
+) {
+ //get a list of all fields on the job
+ apolloClient
+ .mutate({
+ mutation: UPDATE_JOB,
+ variables: { jobId: jobId, job: { inproduction: true } },
+ })
+ .then((res) => {
+ notification["success"]({
+ message: i18n.t("jobs.successes.addedtoproduction"),
+ });
+ if (completionCallback) completionCallback();
+ })
+ .catch((error) => {
+ notification["errors"]({
+ message: i18n.t("jobs.errors.addingtoproduction", {
+ error: JSON.stringify(error),
+ }),
+ });
+ });
+
+ //insert the new job. call the callback with the returned ID when done.
+
+ return;
+}
diff --git a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
index 164c96c3c..afbfc84b2 100644
--- a/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
+++ b/client/src/components/jobs-detail-header-actions/jobs-detail-header-actions.component.jsx
@@ -1,15 +1,15 @@
-import React from "react";
-import { Menu, Dropdown, Button, Popconfirm } from "antd";
-import { useTranslation } from "react-i18next";
import { DownCircleFilled } from "@ant-design/icons";
-import { Link } from "react-router-dom";
-import DuplicateJob from "./jobs-detail-header-actions.duplicate";
import { useApolloClient } from "@apollo/react-hooks";
-
+import { Button, Dropdown, Menu, Popconfirm } from "antd";
+import React from "react";
+import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
+import { Link, useHistory } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../redux/user/user.selectors";
-import { useHistory } from "react-router-dom";
+import AddToProduction from "./jobs-detail-header-actions.addtoproduction.util";
+import DuplicateJob from "./jobs-detail-header-actions.duplicate.util";
+
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -23,22 +23,27 @@ export function JobsDetailHeaderActions({ job, bodyshop }) {
const client = useApolloClient();
const history = useHistory();
const statusmenu = (
-