IO-757 Adjust job links on tech console.

This commit is contained in:
Patrick Fic
2021-03-17 13:28:34 -07:00
parent 10da7fdbb7
commit 7cb13d289c
7 changed files with 6132 additions and 4233 deletions

View File

@@ -10,7 +10,7 @@ import { useTranslation } from "react-i18next";
import ProductionSubletsManageComponent from "../production-sublets-manage/production-sublets-manage.component";
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
export default function ProductionBoardCard(card) {
export default function ProductionBoardCard(technician, card) {
const { t } = useTranslation();
const menu = (
<div>
@@ -86,9 +86,15 @@ export default function ProductionBoardCard(card) {
<div className="imex-flex-row imex-flex-row__flex-space-around">
<ProductionAlert record={card} key="alert" />
<ProductionSubletsManageComponent subletJobLines={card.subletLines} />
<Link to={`/manage/jobs/${card.id}`}>
<EyeFilled />
</Link>
{technician ? (
<Link to={`/tech/joblookup?selected=${card.id}`}>
<EyeFilled />
</Link>
) : (
<Link to={`/manage/jobs/${card.id}`}>
<EyeFilled />
</Link>
)}
</div>
</Card>
</Dropdown>

View File

@@ -13,12 +13,13 @@ import { createBoardData } from "./production-board-kanban.utils.js";
import IndefiniteLoading from "../indefinite-loading/indefinite-loading.component";
import { logImEXEvent } from "../../firebase/firebase.utils";
import ProductionBoardFilters from "../production-board-filters/production-board-filters.component";
import { selectTechnician } from "../../redux/tech/tech.selectors";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
});
export function ProductionBoardKanbanComponent({ data, bodyshop }) {
export function ProductionBoardKanbanComponent({ data, bodyshop, technician }) {
const [boardLanes, setBoardLanes] = useState({
columns: [{ id: "Loading...", title: "Loading...", cards: [] }],
});
@@ -119,7 +120,7 @@ export function ProductionBoardKanbanComponent({ data, bodyshop }) {
<Board
children={boardLanes}
disableCardDrag={isMoving}
renderCard={ProductionBoardCard}
renderCard={(card) => ProductionBoardCard(technician, card)}
onCardDragEnd={handleDragEnd}
/>
</div>

View File

@@ -2,7 +2,23 @@ import React from "react";
import { Button, Dropdown, Menu } from "antd";
import dataSource from "./production-list-columns.data";
import { useTranslation } from "react-i18next";
export default function ProductionColumnsComponent({ columnState }) {
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectTechnician } from "../../redux/tech/tech.selectors";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
technician: selectTechnician,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(
mapStateToProps,
mapDispatchToProps
)(ProductionColumnsComponent);
export function ProductionColumnsComponent({ columnState, technician }) {
const [columns, setColumns] = columnState;
const { t } = useTranslation();
@@ -14,7 +30,7 @@ export default function ProductionColumnsComponent({ columnState }) {
const menu = (
<Menu onClick={handleAdd}>
{dataSource
{dataSource({ technician })
.filter((i) => !columnKeys.includes(i.key))
.map((item) => (
<Menu.Item key={item.key}>{item.title}</Menu.Item>

View File

@@ -9,239 +9,246 @@ import ProductionSubletsManageComponent from "../production-sublets-manage/produ
import ProductionListColumnAlert from "./production-list-columns.alert.component";
import ProductionListColumnBodyPriority from "./production-list-columns.bodypriority.component";
import ProductionListDate from "./production-list-columns.date.component";
import ProductionListColumnDetailPriority from "./production-list-columns.detailpriority.component";
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 ProductionlistColumnTouchTime from "./prodution-list-columns.touchtime.component";
import ProductionListColumnDetailPriority from "./production-list-columns.detailpriority.component";
const r = [
{
title: i18n.t("jobs.actions.viewdetail"),
dataIndex: "viewdetail",
key: "viewdetail",
ellipsis: true,
render: (text, record) => (
<Link to={{ search: `?selected=${record.id}` }}>
{i18n.t("general.labels.view")}
</Link>
),
},
{
title: i18n.t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
ellipsis: true,
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
render: (text, record) => (
<Link to={`/manage/jobs/${record.id}`}>{record.ro_number}</Link>
),
},
{
title: i18n.t("jobs.fields.owner"),
dataIndex: "ownr",
key: "ownr",
ellipsis: true,
render: (text, record) => (
<span>{`${record.ownr_fn || ""} ${record.ownr_ln || ""} ${
record.ownr_co_nm || ""
}`}</span>
),
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
},
{
title: i18n.t("jobs.fields.vehicle"),
dataIndex: "vehicle",
key: "vehicle",
ellipsis: true,
render: (text, record) => (
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
} ${record.v_color || ""} ${record.plate_no || ""}`}</span>
),
},
{
title: i18n.t("jobs.fields.actual_in"),
dataIndex: "actual_in",
key: "actual_in",
ellipsis: true,
sorter: (a, b) => a.actual_in - b.actual_in,
render: (text, record) => (
<DateFormatter>{record.actual_in || ""}</DateFormatter>
),
},
{
title: i18n.t("jobs.fields.scheduled_completion"),
dataIndex: "scheduled_completion",
key: "scheduled_completion",
ellipsis: true,
sorter: (a, b) => a.scheduled_completion - b.scheduled_completion,
render: (text, record) => (
<ProductionListDate record={record} field="scheduled_completion" />
),
},
{
title: i18n.t("jobs.fields.scheduled_delivery"),
dataIndex: "scheduled_delivery",
key: "scheduled_delivery",
ellipsis: true,
sorter: (a, b) => a.scheduled_delivery - b.scheduled_delivery,
render: (text, record) => (
<ProductionListDate record={record} field="scheduled_delivery" />
),
},
{
title: i18n.t("jobs.fields.ins_co_nm"),
dataIndex: "ins_co_nm",
key: "ins_co_nm",
ellipsis: true,
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
},
{
title: i18n.t("jobs.fields.clm_no"),
dataIndex: "clm_no",
key: "clm_no",
ellipsis: true,
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
},
{
title: i18n.t("jobs.fields.clm_total"),
dataIndex: "clm_total",
key: "clm_total",
ellipsis: true,
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
),
},
{
title: i18n.t("jobs.fields.owner_owing"),
dataIndex: "owner_owing",
key: "owner_owing",
ellipsis: true,
sorter: (a, b) => a.owner_owing - b.owner_owing,
render: (text, record) => (
<CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
),
},
{
title: i18n.t("jobs.fields.ownr_ph1"),
dataIndex: "ownr_ph1",
key: "ownr_ph1",
ellipsis: true,
render: (text, record) => (
<PhoneFormatter>{record.ownr_ph1}</PhoneFormatter>
),
},
{
title: i18n.t("jobs.fields.specialcoveragepolicy"),
dataIndex: "special_coverage_policy",
key: "special_coverage_policy",
ellipsis: true,
},
{
title: i18n.t("jobs.fields.csr"),
dataIndex: "csr",
key: "csr",
ellipsis: true,
sorter: (a, b) => alphaSort(a.csr, b.csr),
},
{
title: i18n.t("jobs.fields.alt_transport"),
dataIndex: "alt_transport",
key: "alt_transport",
ellipsis: true,
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
},
{
title: i18n.t("jobs.fields.status"),
dataIndex: "status",
key: "status",
ellipsis: true,
sorter: (a, b) => alphaSort(a.status, b.status),
render: (text, record) => <ProductionListColumnStatus record={record} />,
},
{
title: i18n.t("production.labels.bodyhours"),
dataIndex: "labhrs",
key: "labhrs",
sorter: (a, b) =>
a.labhrs.aggregate.sum.mod_lb_hrs - b.labhrs.aggregate.sum.mod_lb_hrs,
render: (text, record) => record.labhrs.aggregate.sum.mod_lb_hrs,
},
{
title: i18n.t("production.labels.refinishhours"),
dataIndex: "larhrs",
key: "larhrs",
sorter: (a, b) =>
a.larhrs.aggregate.sum.mod_lb_hrs - b.larhrs.aggregate.sum.mod_lb_hrs,
render: (text, record) => record.larhrs.aggregate.sum.mod_lb_hrs,
},
{
title: i18n.t("production.labels.alert"),
dataIndex: "alert",
key: "alert",
render: (text, record) => <ProductionListColumnAlert record={record} />,
},
{
title: i18n.t("production.labels.note"),
dataIndex: "note",
key: "note",
ellipsis: true,
render: (text, record) => <ProductionListColumnNote record={record} />,
},
{
title: i18n.t("production.labels.touchtime"),
dataIndex: "tt",
key: "tt",
render: (text, record) => {
return <ProductionlistColumnTouchTime job={record} />;
const r = ({ technician }) => {
return [
{
title: i18n.t("jobs.actions.viewdetail"),
dataIndex: "viewdetail",
key: "viewdetail",
ellipsis: true,
render: (text, record) => (
<Link to={{ search: `?selected=${record.id}` }}>
{i18n.t("general.labels.view")}
</Link>
),
},
},
{
title: i18n.t("production.labels.bodypriority"),
dataIndex: "bodypriority",
key: "bodypriority",
{
title: i18n.t("jobs.fields.ro_number"),
dataIndex: "ro_number",
key: "ro_number",
ellipsis: true,
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
render: (text, record) =>
technician ? (
<Link to={`/tech/joblookup?selected=${record.id}`}>
{record.ro_number}
</Link>
) : (
<Link to={`/manage/jobs/${record.id}`}>{record.ro_number}</Link>
),
},
{
title: i18n.t("jobs.fields.owner"),
dataIndex: "ownr",
key: "ownr",
ellipsis: true,
render: (text, record) => (
<span>{`${record.ownr_fn || ""} ${record.ownr_ln || ""} ${
record.ownr_co_nm || ""
}`}</span>
),
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
},
{
title: i18n.t("jobs.fields.vehicle"),
dataIndex: "vehicle",
key: "vehicle",
ellipsis: true,
render: (text, record) => (
<span>{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${
record.v_model_desc || ""
} ${record.v_color || ""} ${record.plate_no || ""}`}</span>
),
},
{
title: i18n.t("jobs.fields.actual_in"),
dataIndex: "actual_in",
key: "actual_in",
ellipsis: true,
sorter: (a, b) => a.actual_in - b.actual_in,
render: (text, record) => (
<DateFormatter>{record.actual_in || ""}</DateFormatter>
),
},
{
title: i18n.t("jobs.fields.scheduled_completion"),
dataIndex: "scheduled_completion",
key: "scheduled_completion",
ellipsis: true,
sorter: (a, b) => a.scheduled_completion - b.scheduled_completion,
render: (text, record) => (
<ProductionListDate record={record} field="scheduled_completion" />
),
},
{
title: i18n.t("jobs.fields.scheduled_delivery"),
dataIndex: "scheduled_delivery",
key: "scheduled_delivery",
ellipsis: true,
sorter: (a, b) => a.scheduled_delivery - b.scheduled_delivery,
render: (text, record) => (
<ProductionListDate record={record} field="scheduled_delivery" />
),
},
{
title: i18n.t("jobs.fields.ins_co_nm"),
dataIndex: "ins_co_nm",
key: "ins_co_nm",
ellipsis: true,
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
},
{
title: i18n.t("jobs.fields.clm_no"),
dataIndex: "clm_no",
key: "clm_no",
ellipsis: true,
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
},
{
title: i18n.t("jobs.fields.clm_total"),
dataIndex: "clm_total",
key: "clm_total",
ellipsis: true,
sorter: (a, b) => a.clm_total - b.clm_total,
render: (text, record) => (
<CurrencyFormatter>{record.clm_total}</CurrencyFormatter>
),
},
{
title: i18n.t("jobs.fields.owner_owing"),
dataIndex: "owner_owing",
key: "owner_owing",
ellipsis: true,
sorter: (a, b) => a.owner_owing - b.owner_owing,
render: (text, record) => (
<CurrencyFormatter>{record.owner_owing}</CurrencyFormatter>
),
},
{
title: i18n.t("jobs.fields.ownr_ph1"),
dataIndex: "ownr_ph1",
key: "ownr_ph1",
ellipsis: true,
render: (text, record) => (
<PhoneFormatter>{record.ownr_ph1}</PhoneFormatter>
),
},
{
title: i18n.t("jobs.fields.specialcoveragepolicy"),
dataIndex: "special_coverage_policy",
key: "special_coverage_policy",
ellipsis: true,
},
{
title: i18n.t("jobs.fields.csr"),
dataIndex: "csr",
key: "csr",
ellipsis: true,
sorter: (a, b) => alphaSort(a.csr, b.csr),
},
{
title: i18n.t("jobs.fields.alt_transport"),
dataIndex: "alt_transport",
key: "alt_transport",
ellipsis: true,
sorter: (a, b) => alphaSort(a.alt_transport, b.alt_transport),
},
{
title: i18n.t("jobs.fields.status"),
dataIndex: "status",
key: "status",
ellipsis: true,
sorter: (a, b) => alphaSort(a.status, b.status),
render: (text, record) => <ProductionListColumnStatus record={record} />,
},
{
title: i18n.t("production.labels.bodyhours"),
dataIndex: "labhrs",
key: "labhrs",
sorter: (a, b) =>
a.labhrs.aggregate.sum.mod_lb_hrs - b.labhrs.aggregate.sum.mod_lb_hrs,
render: (text, record) => record.labhrs.aggregate.sum.mod_lb_hrs,
},
{
title: i18n.t("production.labels.refinishhours"),
dataIndex: "larhrs",
key: "larhrs",
sorter: (a, b) =>
a.larhrs.aggregate.sum.mod_lb_hrs - b.larhrs.aggregate.sum.mod_lb_hrs,
render: (text, record) => record.larhrs.aggregate.sum.mod_lb_hrs,
},
{
title: i18n.t("production.labels.alert"),
dataIndex: "alert",
key: "alert",
sorter: (a, b) =>
((a.production_vars && a.production_vars.bodypriority) || 11) -
((b.production_vars && b.production_vars.bodypriority) || 11),
render: (text, record) => (
<ProductionListColumnBodyPriority record={record} />
),
},
{
title: i18n.t("production.labels.paintpriority"),
dataIndex: "paintpriority",
key: "paintpriority",
render: (text, record) => <ProductionListColumnAlert record={record} />,
},
{
title: i18n.t("production.labels.note"),
dataIndex: "note",
key: "note",
ellipsis: true,
render: (text, record) => <ProductionListColumnNote record={record} />,
},
{
title: i18n.t("production.labels.touchtime"),
dataIndex: "tt",
key: "tt",
render: (text, record) => {
return <ProductionlistColumnTouchTime job={record} />;
},
},
{
title: i18n.t("production.labels.bodypriority"),
dataIndex: "bodypriority",
key: "bodypriority",
sorter: (a, b) =>
((a.production_vars && a.production_vars.paintpriority) || 11) -
((b.production_vars && b.production_vars.paintpriority) || 11),
render: (text, record) => (
<ProductionListColumnPaintPriority record={record} />
),
},
{
title: i18n.t("production.labels.detailpriority"),
dataIndex: "detailpriority",
key: "detailpriority",
sorter: (a, b) =>
((a.production_vars && a.production_vars.bodypriority) || 11) -
((b.production_vars && b.production_vars.bodypriority) || 11),
render: (text, record) => (
<ProductionListColumnBodyPriority record={record} />
),
},
{
title: i18n.t("production.labels.paintpriority"),
dataIndex: "paintpriority",
key: "paintpriority",
sorter: (a, b) =>
((a.production_vars && a.production_vars.detailpriority) || 11) -
((b.production_vars && b.production_vars.detailpriority) || 11),
render: (text, record) => (
<ProductionListColumnDetailPriority record={record} />
),
},
{
title: i18n.t("production.labels.sublets"),
dataIndex: "sublets",
key: "sublets",
render: (text, record) => (
<ProductionSubletsManageComponent subletJobLines={record.subletLines} />
),
},
];
sorter: (a, b) =>
((a.production_vars && a.production_vars.paintpriority) || 11) -
((b.production_vars && b.production_vars.paintpriority) || 11),
render: (text, record) => (
<ProductionListColumnPaintPriority record={record} />
),
},
{
title: i18n.t("production.labels.detailpriority"),
dataIndex: "detailpriority",
key: "detailpriority",
sorter: (a, b) =>
((a.production_vars && a.production_vars.detailpriority) || 11) -
((b.production_vars && b.production_vars.detailpriority) || 11),
render: (text, record) => (
<ProductionListColumnDetailPriority record={record} />
),
},
{
title: i18n.t("production.labels.sublets"),
dataIndex: "sublets",
key: "sublets",
render: (text, record) => (
<ProductionSubletsManageComponent subletJobLines={record.subletLines} />
),
},
];
};
export default r;

View File

@@ -3,17 +3,19 @@ import React, { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { SUBSCRIPTION_JOBS_IN_PRODUCTION } from "../../graphql/jobs.queries";
import { selectTechnician } from "../../redux/tech/tech.selectors";
import { selectBodyshop } from "../../redux/user/user.selectors";
import ProductionListColumns from "../production-list-columns/production-list-columns.data";
import ProductionListTable from "./production-list-table.component";
const mapStateToProps = createStructuredSelector({
bodyshop: selectBodyshop,
technician: selectTechnician,
});
export default connect(mapStateToProps, null)(ProductionListTableContainer);
export function ProductionListTableContainer({ bodyshop }) {
export function ProductionListTableContainer({ bodyshop, technician }) {
const { loading, data } = useSubscription(SUBSCRIPTION_JOBS_IN_PRODUCTION, {
// variables: {
// statusList: bodyshop.md_ro_statuses.production_statuses || [],
@@ -24,7 +26,7 @@ export function ProductionListTableContainer({ bodyshop }) {
(bodyshop.production_config &&
bodyshop.production_config.columnKeys.map((k) => {
return {
...ProductionListColumns.find((e) => e.key === k.key),
...ProductionListColumns({ technician }).find((e) => e.key === k.key),
width: k.width,
};
})) ||