Merged in feature/IO-2514-Production-Board-Estimators (pull request #1130)
Feature/IO-2514 Production Board Estimators Approved-by: Dave Richer
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import React from "react";
|
|
||||||
import { Button, Dropdown, Menu } from "antd";
|
import { Button, Dropdown, Menu } from "antd";
|
||||||
import dataSource from "./production-list-columns.data";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import dataSource from "./production-list-columns.data";
|
||||||
|
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
@@ -24,6 +24,7 @@ export function ProductionColumnsComponent({
|
|||||||
columnState,
|
columnState,
|
||||||
technician,
|
technician,
|
||||||
bodyshop,
|
bodyshop,
|
||||||
|
data,
|
||||||
tableState,
|
tableState,
|
||||||
}) {
|
}) {
|
||||||
const [columns, setColumns] = columnState;
|
const [columns, setColumns] = columnState;
|
||||||
@@ -36,6 +37,7 @@ export function ProductionColumnsComponent({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state: tableState,
|
state: tableState,
|
||||||
|
data: data,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).filter((i) => i.key === e.key),
|
}).filter((i) => i.key === e.key),
|
||||||
]);
|
]);
|
||||||
@@ -46,6 +48,7 @@ export function ProductionColumnsComponent({
|
|||||||
technician,
|
technician,
|
||||||
state: tableState,
|
state: tableState,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
|
data: data,
|
||||||
});
|
});
|
||||||
const menu = (
|
const menu = (
|
||||||
<Menu
|
<Menu
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { PauseCircleOutlined, BranchesOutlined } from "@ant-design/icons";
|
import { BranchesOutlined, PauseCircleOutlined } from "@ant-design/icons";
|
||||||
import { Space, Tooltip } from "antd";
|
import { Space, Tooltip } from "antd";
|
||||||
import i18n from "i18next";
|
import i18n from "i18next";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
@@ -25,7 +25,7 @@ import ProductionListColumnCategory from "./production-list-columns.status.categ
|
|||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
import ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
|
||||||
|
|
||||||
const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
const r = ({ technician, state, activeStatuses, data, bodyshop }) => {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
title: i18n.t("jobs.actions.viewdetail"),
|
title: i18n.t("jobs.actions.viewdetail"),
|
||||||
@@ -536,6 +536,31 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
|||||||
<JobPartsQueueCount parts={record.joblines_status} record={record} />
|
<JobPartsQueueCount parts={record.joblines_status} record={record} />
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18n.t("jobs.labels.estimator"),
|
||||||
|
dataIndex: "estimator",
|
||||||
|
key: "estimator",
|
||||||
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
`${a.est_ct_fn || ""} ${a.est_ct_ln || ""}`.trim(),
|
||||||
|
`${b.est_ct_fn || ""} ${b.est_ct_ln || ""}`.trim()
|
||||||
|
),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "estimator" && state.sortedInfo.order,
|
||||||
|
filters:
|
||||||
|
data?.map((s) => {
|
||||||
|
return {
|
||||||
|
text: `${s.est_ct_fn || ""} ${s.est_ct_ln || ""}`.trim(),
|
||||||
|
value: [`${s.est_ct_fn || ""} ${s.est_ct_ln || ""}`.trim()],
|
||||||
|
};
|
||||||
|
}) || [],
|
||||||
|
onFilter: (value, record) =>
|
||||||
|
value.includes(
|
||||||
|
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim()
|
||||||
|
),
|
||||||
|
render: (text, record) =>
|
||||||
|
`${record.est_ct_fn || ""} ${record.est_ct_ln || ""}`.trim(),
|
||||||
|
},
|
||||||
|
|
||||||
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
//Added as a place holder for St Claude. Not implemented as it requires another join for a field used by only 1 client.
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function ProductionListTable({
|
|||||||
technician,
|
technician,
|
||||||
currentUser,
|
currentUser,
|
||||||
state,
|
state,
|
||||||
|
data,
|
||||||
setColumns,
|
setColumns,
|
||||||
setState,
|
setState,
|
||||||
}) {
|
}) {
|
||||||
@@ -41,6 +42,7 @@ export function ProductionListTable({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
|
data: data,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width,
|
width: k.width,
|
||||||
@@ -95,6 +97,7 @@ export function ProductionListTable({
|
|||||||
...ProductionListColumns({
|
...ProductionListColumns({
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
|
data: data,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width,
|
width: k.width,
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
Statistic,
|
Statistic,
|
||||||
Table,
|
Table,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import React, { useMemo, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import ReactDragListView from "react-drag-listview";
|
import ReactDragListView from "react-drag-listview";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
@@ -79,6 +79,7 @@ export function ProductionListTable({
|
|||||||
bodyshop,
|
bodyshop,
|
||||||
technician,
|
technician,
|
||||||
state,
|
state,
|
||||||
|
data: data,
|
||||||
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
}).find((e) => e.key === k.key),
|
}).find((e) => e.key === k.key),
|
||||||
width: k.width ?? 100,
|
width: k.width ?? 100,
|
||||||
@@ -87,6 +88,33 @@ export function ProductionListTable({
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const newColumns =
|
||||||
|
(state &&
|
||||||
|
matchingColumnConfig &&
|
||||||
|
matchingColumnConfig.columns.columnKeys.map((k) => {
|
||||||
|
return {
|
||||||
|
...ProductionListColumns({
|
||||||
|
bodyshop,
|
||||||
|
technician,
|
||||||
|
state,
|
||||||
|
data: data,
|
||||||
|
activeStatuses: bodyshop.md_ro_statuses.active_statuses,
|
||||||
|
}).find((e) => e.key === k.key),
|
||||||
|
width: k.width ?? 100,
|
||||||
|
};
|
||||||
|
})) ||
|
||||||
|
[];
|
||||||
|
setColumns(newColumns);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [
|
||||||
|
//state,
|
||||||
|
matchingColumnConfig,
|
||||||
|
bodyshop,
|
||||||
|
technician,
|
||||||
|
data,
|
||||||
|
]); //State removed from dependency array as it causes race condition when removing columns from table view and is not needed.
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
@@ -104,7 +132,8 @@ export function ProductionListTable({
|
|||||||
|
|
||||||
const removeColumn = (e) => {
|
const removeColumn = (e) => {
|
||||||
const { key } = e;
|
const { key } = e;
|
||||||
setColumns(columns.filter((i) => i.key !== key));
|
const newColumns = columns.filter((i) => i.key !== key);
|
||||||
|
setColumns(newColumns);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleResize =
|
const handleResize =
|
||||||
@@ -227,6 +256,7 @@ export function ProductionListTable({
|
|||||||
<ProductionListColumnsAdd
|
<ProductionListColumnsAdd
|
||||||
columnState={[columns, setColumns]}
|
columnState={[columns, setColumns]}
|
||||||
tableState={state}
|
tableState={state}
|
||||||
|
data={data}
|
||||||
/>
|
/>
|
||||||
<ProductionListSaveConfigButton
|
<ProductionListSaveConfigButton
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -237,6 +267,7 @@ export function ProductionListTable({
|
|||||||
state={state}
|
state={state}
|
||||||
setState={setState}
|
setState={setState}
|
||||||
setColumns={setColumns}
|
setColumns={setColumns}
|
||||||
|
data={data}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
|
|||||||
@@ -364,6 +364,8 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
|||||||
employee_refinish
|
employee_refinish
|
||||||
employee_prep
|
employee_prep
|
||||||
employee_csr
|
employee_csr
|
||||||
|
est_ct_fn
|
||||||
|
est_ct_ln
|
||||||
suspended
|
suspended
|
||||||
date_repairstarted
|
date_repairstarted
|
||||||
joblines_status {
|
joblines_status {
|
||||||
|
|||||||
Reference in New Issue
Block a user