Merged in release/2022-01-14 (pull request #347)
release/2022-01-14 Approved-by: Patrick Fic
This commit is contained in:
@@ -18,6 +18,7 @@ import ProductionListLastContacted from "./production-list-columns.lastcontacted
|
|||||||
import ProductionListColumnPaintPriority from "./production-list-columns.paintpriority.component";
|
import ProductionListColumnPaintPriority from "./production-list-columns.paintpriority.component";
|
||||||
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
import ProductionListColumnNote from "./production-list-columns.productionnote.component";
|
||||||
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
import ProductionListColumnStatus from "./production-list-columns.status.component";
|
||||||
|
import ProductionListColumnCategory from "./production-list-columns.status.category";
|
||||||
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, bodyshop }) => {
|
||||||
@@ -251,6 +252,29 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
|||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
render: (text, record) => <ProductionListColumnStatus record={record} />,
|
render: (text, record) => <ProductionListColumnStatus record={record} />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18n.t("jobs.fields.category"),
|
||||||
|
dataIndex: "category",
|
||||||
|
key: "category",
|
||||||
|
ellipsis: true,
|
||||||
|
|
||||||
|
filters:
|
||||||
|
(bodyshop &&
|
||||||
|
bodyshop.md_categories.map((s) => {
|
||||||
|
return {
|
||||||
|
text: s,
|
||||||
|
value: [s],
|
||||||
|
};
|
||||||
|
})) ||
|
||||||
|
[],
|
||||||
|
onFilter: (value, record) => value.includes(record.category),
|
||||||
|
sorter: (a, b) => alphaSort(a.category, b.category),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "category" && state.sortedInfo.order,
|
||||||
|
render: (text, record) => (
|
||||||
|
<ProductionListColumnCategory record={record} />
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t("production.labels.bodyhours"),
|
title: i18n.t("production.labels.bodyhours"),
|
||||||
dataIndex: "labhrs",
|
dataIndex: "labhrs",
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import { useMutation } from "@apollo/client";
|
||||||
|
import { Dropdown, Menu, Spin } from "antd";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
|
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||||
|
import { insertAuditTrail } from "../../redux/application/application.actions";
|
||||||
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
bodyshop: selectBodyshop,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
insertAuditTrail: ({ jobid, operation }) =>
|
||||||
|
dispatch(insertAuditTrail({ jobid, operation })),
|
||||||
|
});
|
||||||
|
export function ProductionListColumnCategory({ record, bodyshop }) {
|
||||||
|
const [updateJob] = useMutation(UPDATE_JOB);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
|
||||||
|
const handleSetStatus = async (e) => {
|
||||||
|
logImEXEvent("production_change_status");
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
const { key } = e;
|
||||||
|
await updateJob({
|
||||||
|
variables: {
|
||||||
|
jobId: record.id,
|
||||||
|
job: {
|
||||||
|
category: key,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Dropdown
|
||||||
|
overlay={
|
||||||
|
<Menu
|
||||||
|
style={{ maxHeight: "200px", overflowY: "auto" }}
|
||||||
|
onClick={handleSetStatus}
|
||||||
|
>
|
||||||
|
{bodyshop.md_categories.map((item) => (
|
||||||
|
<Menu.Item key={item}>{item}</Menu.Item>
|
||||||
|
))}
|
||||||
|
</Menu>
|
||||||
|
}
|
||||||
|
trigger={["click"]}
|
||||||
|
>
|
||||||
|
<div style={{ width: "100%", height: "19px", cursor: "pointer" }}>
|
||||||
|
{record.category}
|
||||||
|
{loading && <Spin />}
|
||||||
|
</div>
|
||||||
|
</Dropdown>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(ProductionListColumnCategory);
|
||||||
@@ -88,6 +88,12 @@ export function ProductionListTable({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter",
|
||||||
|
pagination,
|
||||||
|
filters,
|
||||||
|
sorter
|
||||||
|
);
|
||||||
setState({
|
setState({
|
||||||
...state,
|
...state,
|
||||||
filteredInfo: filters,
|
filteredInfo: filters,
|
||||||
@@ -263,8 +269,10 @@ export function ProductionListTable({
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
columns={columns.map((c, index) => {
|
columns={columns.map((c, index) => {
|
||||||
|
console.log(c);
|
||||||
return {
|
return {
|
||||||
...c,
|
...c,
|
||||||
|
filteredValue: state.filteredInfo[c.key] || null,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||||
title: headerItem(c),
|
title: headerItem(c),
|
||||||
|
|||||||
@@ -25,15 +25,20 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) {
|
|||||||
const { ssbuckets } = bodyshop;
|
const { ssbuckets } = bodyshop;
|
||||||
|
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
return Object.keys(loadData.expectedLoad).map((key) => {
|
return (
|
||||||
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
(loadData &&
|
||||||
|
loadData.expectedLoad &&
|
||||||
|
Object.keys(loadData.expectedLoad).map((key) => {
|
||||||
|
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
bucket: loadData.expectedLoad[key].label,
|
bucket: loadData.expectedLoad[key].label,
|
||||||
current: loadData.expectedLoad[key].count,
|
current: loadData.expectedLoad[key].count,
|
||||||
target: metadataBucket && metadataBucket.target,
|
target: metadataBucket && metadataBucket.target,
|
||||||
};
|
};
|
||||||
});
|
})) ||
|
||||||
|
[]
|
||||||
|
);
|
||||||
}, [loadData, ssbuckets]);
|
}, [loadData, ssbuckets]);
|
||||||
|
|
||||||
const popContent = (
|
const popContent = (
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
|
|||||||
ro_number
|
ro_number
|
||||||
ownr_fn
|
ownr_fn
|
||||||
ownr_ln
|
ownr_ln
|
||||||
|
category
|
||||||
ownr_co_nm
|
ownr_co_nm
|
||||||
v_model_yr
|
v_model_yr
|
||||||
v_model_desc
|
v_model_desc
|
||||||
@@ -193,6 +194,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql`
|
|||||||
status
|
status
|
||||||
ro_number
|
ro_number
|
||||||
ownr_fn
|
ownr_fn
|
||||||
|
category
|
||||||
ownr_ln
|
ownr_ln
|
||||||
ownr_co_nm
|
ownr_co_nm
|
||||||
v_model_yr
|
v_model_yr
|
||||||
@@ -263,6 +265,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
|||||||
id
|
id
|
||||||
updated_at
|
updated_at
|
||||||
status
|
status
|
||||||
|
category
|
||||||
ro_number
|
ro_number
|
||||||
ownr_fn
|
ownr_fn
|
||||||
ownr_ln
|
ownr_ln
|
||||||
|
|||||||
Reference in New Issue
Block a user