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 ProductionListColumnNote from "./production-list-columns.productionnote.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";
|
||||
|
||||
const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
@@ -251,6 +252,29 @@ const r = ({ technician, state, activeStatuses, bodyshop }) => {
|
||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||
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"),
|
||||
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) => {
|
||||
console.log(
|
||||
"🚀 ~ file: production-list-table.component.jsx ~ line 91 ~ pagination, filters, sorter",
|
||||
pagination,
|
||||
filters,
|
||||
sorter
|
||||
);
|
||||
setState({
|
||||
...state,
|
||||
filteredInfo: filters,
|
||||
@@ -263,8 +269,10 @@ export function ProductionListTable({
|
||||
},
|
||||
}}
|
||||
columns={columns.map((c, index) => {
|
||||
console.log(c);
|
||||
return {
|
||||
...c,
|
||||
filteredValue: state.filteredInfo[c.key] || null,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === c.key && state.sortedInfo.order,
|
||||
title: headerItem(c),
|
||||
|
||||
@@ -25,15 +25,20 @@ export function ScheduleCalendarHeaderGraph({ bodyshop, loadData }) {
|
||||
const { ssbuckets } = bodyshop;
|
||||
|
||||
const data = useMemo(() => {
|
||||
return Object.keys(loadData.expectedLoad).map((key) => {
|
||||
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
||||
return (
|
||||
(loadData &&
|
||||
loadData.expectedLoad &&
|
||||
Object.keys(loadData.expectedLoad).map((key) => {
|
||||
const metadataBucket = ssbuckets.filter((b) => b.id === key)[0];
|
||||
|
||||
return {
|
||||
bucket: loadData.expectedLoad[key].label,
|
||||
current: loadData.expectedLoad[key].count,
|
||||
target: metadataBucket && metadataBucket.target,
|
||||
};
|
||||
});
|
||||
return {
|
||||
bucket: loadData.expectedLoad[key].label,
|
||||
current: loadData.expectedLoad[key].count,
|
||||
target: metadataBucket && metadataBucket.target,
|
||||
};
|
||||
})) ||
|
||||
[]
|
||||
);
|
||||
}, [loadData, ssbuckets]);
|
||||
|
||||
const popContent = (
|
||||
|
||||
@@ -123,6 +123,7 @@ export const QUERY_EXACT_JOB_IN_PRODUCTION = gql`
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
category
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
v_model_desc
|
||||
@@ -193,6 +194,7 @@ export const QUERY_EXACT_JOBS_IN_PRODUCTION = gql`
|
||||
status
|
||||
ro_number
|
||||
ownr_fn
|
||||
category
|
||||
ownr_ln
|
||||
ownr_co_nm
|
||||
v_model_yr
|
||||
@@ -263,6 +265,7 @@ export const QUERY_JOBS_IN_PRODUCTION = gql`
|
||||
id
|
||||
updated_at
|
||||
status
|
||||
category
|
||||
ro_number
|
||||
ownr_fn
|
||||
ownr_ln
|
||||
|
||||
Reference in New Issue
Block a user