BOD-21 Bug fixes for production columns.
This commit is contained in:
@@ -5754,6 +5754,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>addtoproduction</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>changestatus</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -5906,6 +5927,27 @@
|
||||
<folder_node>
|
||||
<name>errors</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>addingtoproduction</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>creating</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -8876,6 +8918,27 @@
|
||||
<folder_node>
|
||||
<name>successes</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>addedtoproduction</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
<description></description>
|
||||
<comment></comment>
|
||||
<default_text></default_text>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>es-MX</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-CA</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>all_deleted</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 = (
|
||||
<Menu key="popovermenu">
|
||||
<Menu.Item key="cccontract">
|
||||
<Menu key='popovermenu'>
|
||||
<Menu.Item key='cccontract'>
|
||||
<Link
|
||||
to={{
|
||||
pathname: "/manage/courtesycars/contracts/new",
|
||||
state: { jobId: job.id },
|
||||
}}
|
||||
>
|
||||
}}>
|
||||
{t("menus.jobsactions.newcccontract")}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<Menu.Item key="duplicatejob">
|
||||
<Menu.Item
|
||||
key='addtoproduction'
|
||||
disabled={!!!job.converted}
|
||||
onClick={() => AddToProduction(client, job.id)}>
|
||||
{t("jobs.actions.addtoproduction")}
|
||||
</Menu.Item>
|
||||
<Menu.Item key='duplicatejob'>
|
||||
<Popconfirm
|
||||
title={t("jobs.labels.duplicateconfirm")}
|
||||
okText="Yes"
|
||||
cancelText="No"
|
||||
okText='Yes'
|
||||
cancelText='No'
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
onConfirm={() =>
|
||||
DuplicateJob(
|
||||
@@ -50,15 +55,14 @@ export function JobsDetailHeaderActions({ job, bodyshop }) {
|
||||
}
|
||||
)
|
||||
}
|
||||
getPopupContainer={(trigger) => trigger.parentNode}
|
||||
>
|
||||
getPopupContainer={(trigger) => trigger.parentNode}>
|
||||
{t("menus.jobsactions.duplicate")}
|
||||
</Popconfirm>
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
return (
|
||||
<Dropdown overlay={statusmenu} key="changestatus">
|
||||
<Dropdown overlay={statusmenu} key='changestatus'>
|
||||
<Button>
|
||||
{t("general.labels.actions")} <DownCircleFilled />
|
||||
</Button>
|
||||
|
||||
@@ -1,44 +1,41 @@
|
||||
import React from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import Board from "react-trello";
|
||||
import { Card } from "antd";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export default function ProductionBoardKanbanComponent({
|
||||
export function ProductionBoardKanbanComponent({
|
||||
loading,
|
||||
data,
|
||||
columnState,
|
||||
bodyshop,
|
||||
}) {
|
||||
console.log("data", data);
|
||||
const data2 = {
|
||||
lanes: [
|
||||
{
|
||||
id: "lane1",
|
||||
title: "Planned Tasks",
|
||||
label: "2/2",
|
||||
cards: [
|
||||
{
|
||||
id: "Card1",
|
||||
title: "Write Blog",
|
||||
description: "Can AI make memes",
|
||||
label: "30 mins",
|
||||
},
|
||||
{
|
||||
id: "Card2",
|
||||
title: "Pay Rent",
|
||||
description: "Transfer via NEFT",
|
||||
label: "5 mins",
|
||||
metadata: { sha: "be312a1" },
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "lane2",
|
||||
title: "Completed",
|
||||
label: "0/0",
|
||||
|
||||
const [cards, setCards] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
const cols = bodyshop.md_ro_statuses.open_statuses.map((s) => {
|
||||
return {
|
||||
id: s,
|
||||
title: s,
|
||||
cards: [],
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
});
|
||||
if (data)
|
||||
data.forEach((d) =>
|
||||
cols
|
||||
.find((c) => c.id === d.status)
|
||||
.cards.push({ id: d.id, title: d.est_number, description: d.ownr_fn })
|
||||
);
|
||||
|
||||
setCards(cols);
|
||||
}, [data, bodyshop.md_ro_statuses.open_statuses, setCards]);
|
||||
|
||||
const kanbanCard = (card) => <Card>{card.title}</Card>;
|
||||
|
||||
@@ -46,7 +43,8 @@ export default function ProductionBoardKanbanComponent({
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Board data={data2} components={{ Card: kanbanCard }} />
|
||||
<Board data={{ lanes: cards }} components={{ Card: kanbanCard }} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, null)(ProductionBoardKanbanComponent);
|
||||
|
||||
@@ -17,7 +17,8 @@ export default function ProductionListColumnAlert({ record }) {
|
||||
job: {
|
||||
production_vars: {
|
||||
...record.production_vars,
|
||||
alert: !record.production_vars.alert,
|
||||
alert:
|
||||
(record.production_vars && !record.production_vars.alert) || true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -155,6 +155,7 @@ export default [
|
||||
title: i18n.t("production.labels.alert"),
|
||||
dataIndex: "alert",
|
||||
key: "alert",
|
||||
width: "4%",
|
||||
render: (text, record) => <ProductionListColumnAlert record={record} />,
|
||||
},
|
||||
{
|
||||
@@ -168,6 +169,7 @@ export default [
|
||||
title: i18n.t("production.labels.cycletime"),
|
||||
dataIndex: "ct",
|
||||
key: "ct",
|
||||
width: "3%",
|
||||
render: (text, record) => {
|
||||
let ct = 0;
|
||||
if (!!record.actual_in) {
|
||||
@@ -183,8 +185,10 @@ export default [
|
||||
title: i18n.t("production.labels.bodypriority"),
|
||||
dataIndex: "bodypriority",
|
||||
key: "bodypriority",
|
||||
width: "3%",
|
||||
sorter: (a, b) =>
|
||||
a.production_vars.bodypriority - b.production_vars.bodypriority,
|
||||
((a.production_vars && a.production_vars.bodypriority) || 11) -
|
||||
((b.production_vars && b.production_vars.bodypriority) || 11),
|
||||
render: (text, record) => (
|
||||
<ProductionListColumnBodyPriority record={record} />
|
||||
),
|
||||
@@ -193,8 +197,10 @@ export default [
|
||||
title: i18n.t("production.labels.paintpriority"),
|
||||
dataIndex: "paintpriority",
|
||||
key: "paintpriority",
|
||||
width: "3%",
|
||||
sorter: (a, b) =>
|
||||
a.production_vars.paintpriority - b.production_vars.paintpriority,
|
||||
((a.production_vars && a.production_vars.paintpriority) || 11) -
|
||||
((b.production_vars && b.production_vars.paintpriority) || 11),
|
||||
render: (text, record) => (
|
||||
<ProductionListColumnPaintPriority record={record} />
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.production-alert {
|
||||
animation: alertBlinker 1s linear infinite;
|
||||
color: blue;
|
||||
}
|
||||
@keyframes alertBlinker {
|
||||
50% {
|
||||
|
||||
@@ -407,6 +407,7 @@
|
||||
"actions": {
|
||||
"addDocuments": "Add Job Documents",
|
||||
"addNote": "Add Note",
|
||||
"addtoproduction": "Add to Production",
|
||||
"changestatus": "Change Status",
|
||||
"convert": "Convert",
|
||||
"gotojob": "Go to Job",
|
||||
@@ -416,6 +417,7 @@
|
||||
"schedule": "Schedule"
|
||||
},
|
||||
"errors": {
|
||||
"addingtoproduction": "Error adding to production. {{error}}",
|
||||
"creating": "Error encountered while creating job. {{error}}",
|
||||
"deleted": "Error deleting job.",
|
||||
"noaccess": "This job does not exist or you do not have access to it.",
|
||||
@@ -568,6 +570,7 @@
|
||||
"vehicle_info": "Vehicle"
|
||||
},
|
||||
"successes": {
|
||||
"addedtoproduction": "Job added to production board.",
|
||||
"all_deleted": "{{count}} jobs deleted successfully.",
|
||||
"converted": "Job converted successfully.",
|
||||
"created": "Job created successfully. Click to view.",
|
||||
|
||||
@@ -407,6 +407,7 @@
|
||||
"actions": {
|
||||
"addDocuments": "Agregar documentos de trabajo",
|
||||
"addNote": "Añadir la nota",
|
||||
"addtoproduction": "",
|
||||
"changestatus": "Cambiar Estado",
|
||||
"convert": "Convertir",
|
||||
"gotojob": "",
|
||||
@@ -416,6 +417,7 @@
|
||||
"schedule": "Programar"
|
||||
},
|
||||
"errors": {
|
||||
"addingtoproduction": "",
|
||||
"creating": "",
|
||||
"deleted": "Error al eliminar el trabajo.",
|
||||
"noaccess": "Este trabajo no existe o no tiene acceso a él.",
|
||||
@@ -568,6 +570,7 @@
|
||||
"vehicle_info": "Vehículo"
|
||||
},
|
||||
"successes": {
|
||||
"addedtoproduction": "",
|
||||
"all_deleted": "{{count}} trabajos eliminados con éxito.",
|
||||
"converted": "Trabajo convertido con éxito.",
|
||||
"created": "Trabajo creado con éxito. Click para ver.",
|
||||
|
||||
@@ -407,6 +407,7 @@
|
||||
"actions": {
|
||||
"addDocuments": "Ajouter des documents de travail",
|
||||
"addNote": "Ajouter une note",
|
||||
"addtoproduction": "",
|
||||
"changestatus": "Changer le statut",
|
||||
"convert": "Convertir",
|
||||
"gotojob": "",
|
||||
@@ -416,6 +417,7 @@
|
||||
"schedule": "Programme"
|
||||
},
|
||||
"errors": {
|
||||
"addingtoproduction": "",
|
||||
"creating": "",
|
||||
"deleted": "Erreur lors de la suppression du travail.",
|
||||
"noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.",
|
||||
@@ -568,6 +570,7 @@
|
||||
"vehicle_info": "Véhicule"
|
||||
},
|
||||
"successes": {
|
||||
"addedtoproduction": "",
|
||||
"all_deleted": "{{count}} travaux supprimés avec succès.",
|
||||
"converted": "Travail converti avec succès.",
|
||||
"created": "Le travail a été créé avec succès. Clique pour voir.",
|
||||
|
||||
Reference in New Issue
Block a user