feature/IO-3255-simplified-parts-management - Favor isPartsEntry over isPartsManagementOnly
This commit is contained in:
@@ -4,7 +4,7 @@ import { selectBreadcrumbs, selectIsPartsEntry } from "../../redux/application/a
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import GlobalSearch from "../global-search/global-search.component";
|
||||
import GlobalSearchOs from "../global-search/global-search-os.component";
|
||||
import "./breadcrumbs.styles.scss";
|
||||
@@ -13,11 +13,10 @@ import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
breadcrumbs: selectBreadcrumbs,
|
||||
bodyshop: selectBodyshop,
|
||||
partsManagementOnly: selectPartsManagementOnly,
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
export function BreadCrumbs({ breadcrumbs, bodyshop, partsManagementOnly, isPartsEntry }) {
|
||||
export function BreadCrumbs({ breadcrumbs, bodyshop, isPartsEntry }) {
|
||||
const {
|
||||
treatments: { OpenSearch }
|
||||
} = useSplitTreatments({
|
||||
@@ -35,7 +34,7 @@ export function BreadCrumbs({ breadcrumbs, bodyshop, partsManagementOnly, isPart
|
||||
{
|
||||
key: "home",
|
||||
title: (
|
||||
<Link to={partsManagementOnly || isPartsEntry ? `/parts/` : `/manage/`}>
|
||||
<Link to={isPartsEntry ? `/parts/` : `/manage/`}>
|
||||
<HomeFilled /> {(bodyshop && bodyshop.shopname && `(${bodyshop.shopname})`) || ""}
|
||||
</Link>
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { DELETE_JOB_LINE_BY_PK } from "../../graphql/jobs-lines.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectTechnician } from "../../redux/tech/tech.selectors";
|
||||
import { onlyUnique } from "../../utils/arrayHelper";
|
||||
@@ -32,7 +32,7 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re
|
||||
import { useSplitTreatments } from "@splitsoftware/splitio-react";
|
||||
import _ from "lodash";
|
||||
import { FaTasks } from "react-icons/fa";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import dayjs from "../../utils/day";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
||||
@@ -51,7 +51,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
technician: selectTechnician,
|
||||
partsManagementOnly: selectPartsManagementOnly
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
@@ -78,10 +78,8 @@ export function JobLinesComponent({
|
||||
setBillEnterContext,
|
||||
setTaskUpsertContext,
|
||||
billsQuery,
|
||||
handleBillOnRowClick,
|
||||
handlePartsOrderOnRowClick,
|
||||
handlePartsDispatchOnRowClick,
|
||||
partsManagementOnly
|
||||
isPartsEntry
|
||||
}) {
|
||||
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
||||
const {
|
||||
@@ -96,7 +94,7 @@ export function JobLinesComponent({
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: {
|
||||
...(partsManagementOnly
|
||||
...(isPartsEntry
|
||||
? {
|
||||
part_type: ["PAN", "PAC", "PAR", "PAL", "PAA", "PAM", "PAP", "PAS", "PASL", "PAG"]
|
||||
}
|
||||
@@ -229,7 +227,7 @@ export function JobLinesComponent({
|
||||
sorter: (a, b) => a.part_qty - b.part_qty,
|
||||
sortOrder: state.sortedInfo.columnKey === "part_qty" && state.sortedInfo.order
|
||||
},
|
||||
...(!partsManagementOnly
|
||||
...(!isPartsEntry
|
||||
? [
|
||||
{
|
||||
title: t("joblines.fields.mod_lbr_ty"),
|
||||
@@ -281,7 +279,7 @@ export function JobLinesComponent({
|
||||
key: "location",
|
||||
render: (text, record) => <JobLineLocationPopup jobline={record} disabled={jobRO} />
|
||||
},
|
||||
...(!partsManagementOnly && HasFeatureAccess({ featureName: "bills", bodyshop })
|
||||
...(!isPartsEntry && HasFeatureAccess({ featureName: "bills", bodyshop })
|
||||
? [
|
||||
{
|
||||
title: t("joblines.labels.billref"),
|
||||
@@ -315,7 +313,7 @@ export function JobLinesComponent({
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
render: (text, record) => <JobLineStatusPopup jobline={record} disabled={jobRO} />
|
||||
},
|
||||
...!partsManagementOnly
|
||||
...(!isPartsEntry
|
||||
? [
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
@@ -382,7 +380,7 @@ export function JobLinesComponent({
|
||||
)
|
||||
}
|
||||
]
|
||||
: []
|
||||
: [])
|
||||
];
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
@@ -555,7 +553,7 @@ export function JobLinesComponent({
|
||||
<Dropdown menu={markMenu} trigger={["click"]}>
|
||||
<Button id="repair-data-mark-button">{t("jobs.actions.mark")}</Button>
|
||||
</Dropdown>
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<Button
|
||||
disabled={jobRO || technician}
|
||||
onClick={() => {
|
||||
@@ -592,12 +590,12 @@ export function JobLinesComponent({
|
||||
}}
|
||||
expandable={{
|
||||
expandedRowRender: (record) =>
|
||||
partsManagementOnly ? (
|
||||
isPartsEntry ? (
|
||||
<JobLinesExpanderSimple jobline={record} jobid={job.id} />
|
||||
) : (
|
||||
<JobLinesExpander jobline={record} jobid={job.id} />
|
||||
),
|
||||
rowExpandable: (record) => true,
|
||||
rowExpandable: () => true,
|
||||
//expandRowByClick: true,
|
||||
expandIcon: ({ expanded, onExpand, record }) =>
|
||||
expanded ? (
|
||||
@@ -606,9 +604,9 @@ export function JobLinesComponent({
|
||||
<PlusCircleTwoTone onClick={(e) => onExpand(record, e)} />
|
||||
)
|
||||
}}
|
||||
onRow={(record, rowIndex) => {
|
||||
onRow={(record) => {
|
||||
return {
|
||||
onDoubleClick: (event) => {
|
||||
onDoubleClick: () => {
|
||||
const notMatchingLines = selectedLines.filter((i) => i.id !== record.id);
|
||||
notMatchingLines.length !== selectedLines.length
|
||||
? setSelectedLines(notMatchingLines)
|
||||
@@ -618,10 +616,10 @@ export function JobLinesComponent({
|
||||
}}
|
||||
rowSelection={{
|
||||
selectedRowKeys: selectedLines.map((item) => item && item.id),
|
||||
onSelectAll: (selected, selectedRows, changeRows) => {
|
||||
onSelectAll: (selected, selectedRows) => {
|
||||
setSelectedLines(selectedRows);
|
||||
},
|
||||
onSelect: (record, selected, selectedRows, nativeEvent) => {
|
||||
onSelect: (record, selected) => {
|
||||
if (selected) {
|
||||
setSelectedLines((selectedLines) => _.uniqBy([...selectedLines, record], "id"));
|
||||
} else {
|
||||
|
||||
@@ -11,7 +11,7 @@ import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions.js";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AuditTrailMapping from "../../utils/AuditTrailMappings.js";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateTimeFormatter, DateTimeFormatterFunction } from "../../utils/DateFormatter";
|
||||
@@ -32,7 +32,6 @@ import "./jobs-detail-header.styles.scss";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
partsManagementOnly: selectPartsManagementOnly,
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
@@ -54,7 +53,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
)
|
||||
});
|
||||
|
||||
export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, partsManagementOnly, isPartsEntry }) {
|
||||
export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const { notification } = useNotification();
|
||||
const [notesClamped, setNotesClamped] = useState(true);
|
||||
@@ -64,9 +63,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, pa
|
||||
const colSpan = {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 24 },
|
||||
md: { span: partsManagementOnly ? 8 : 12 },
|
||||
lg: { span: partsManagementOnly ? 8 : 6 },
|
||||
xl: { span: partsManagementOnly ? 8 : 6 }
|
||||
md: { span: isPartsEntry ? 8 : 12 },
|
||||
lg: { span: isPartsEntry ? 8 : 6 },
|
||||
xl: { span: isPartsEntry ? 8 : 6 }
|
||||
};
|
||||
|
||||
const vehicleTitle =
|
||||
@@ -150,7 +149,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, pa
|
||||
<CurrencyFormatter>{job.owner_owing}</CurrencyFormatter>
|
||||
</DataLabel>
|
||||
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<>
|
||||
<DataLabel label={t("jobs.fields.alt_transport")}>
|
||||
{job.alt_transport}
|
||||
@@ -345,7 +344,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, pa
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<Col {...colSpan}>
|
||||
<Card
|
||||
style={{ height: "100%" }}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Col, Row } from "antd";
|
||||
import React from "react";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import BillDetailEditcontainer from "../bill-detail-edit/bill-detail-edit.container";
|
||||
import BillsListTable from "../bills-list-table/bills-list-table.component";
|
||||
@@ -7,15 +6,15 @@ import JobBillsTotal from "../job-bills-total/job-bills-total.component";
|
||||
import PartsDispatchTable from "../parts-dispatch-table/parts-dispatch-table.component";
|
||||
import PartsOrderListTableComponent from "../parts-order-list-table/parts-order-list-table.component";
|
||||
import PartsOrderModal from "../parts-order-modal/parts-order-modal.container";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
partsManagementOnly: selectPartsManagementOnly
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
const mapDispatchToProps = () => ({});
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsDetailPliComponent);
|
||||
|
||||
export function JobsDetailPliComponent({
|
||||
@@ -24,9 +23,9 @@ export function JobsDetailPliComponent({
|
||||
handleBillOnRowClick,
|
||||
handlePartsOrderOnRowClick,
|
||||
handlePartsDispatchOnRowClick,
|
||||
partsManagementOnly
|
||||
isPartsEntry
|
||||
}) {
|
||||
if (partsManagementOnly) {
|
||||
if (isPartsEntry) {
|
||||
return (
|
||||
<Row gutter={[16, 16]}>
|
||||
<Col span={24}>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { PageHeader } from "@ant-design/pro-layout";
|
||||
import { useLazyQuery, useMutation } from "@apollo/client";
|
||||
import { Button, Drawer, Grid, Popconfirm, Space, Table } from "antd";
|
||||
import queryString from "query-string";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { FaTasks } from "react-icons/fa";
|
||||
import { connect } from "react-redux";
|
||||
@@ -12,9 +12,9 @@ import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { QUERY_BILL_BY_PK } from "../../graphql/bills.queries";
|
||||
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
@@ -32,7 +32,7 @@ import PrintWrapper from "../print-wrapper/print-wrapper.component";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
partsManagementOnly: selectPartsManagementOnly
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
@@ -62,7 +62,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
handleOnRowClick,
|
||||
setPartsReceiveContext,
|
||||
setTaskUpsertContext,
|
||||
partsManagementOnly
|
||||
isPartsEntry
|
||||
}) {
|
||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||
.filter((screen) => !!screen[1])
|
||||
@@ -136,7 +136,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
>
|
||||
{t("parts_orders.actions.receive")}
|
||||
</Button>
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<Button
|
||||
title={t("tasks.buttons.create")}
|
||||
onClick={() => {
|
||||
@@ -174,7 +174,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
<DeleteFilled />
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<Button
|
||||
disabled={
|
||||
(jobRO ? !record.return : jobRO) ||
|
||||
@@ -311,7 +311,7 @@ export function PartsOrderListTableDrawerComponent({
|
||||
title: t("parts_orders.fields.backordered_on"),
|
||||
dataIndex: "backordered_on",
|
||||
key: "backordered_on",
|
||||
render: (text, record) => <DateFormatter>{text}</DateFormatter>
|
||||
render: (text) => <DateFormatter>{text}</DateFormatter>
|
||||
},
|
||||
{
|
||||
title: t("parts_orders.fields.backordered_eta"),
|
||||
|
||||
@@ -8,9 +8,9 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||
import { DELETE_PARTS_ORDER } from "../../graphql/parts-orders.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { DateFormatter } from "../../utils/DateFormatter";
|
||||
import { TemplateList } from "../../utils/TemplateConstants";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
@@ -24,7 +24,7 @@ import ShareToTeamsButton from "../share-to-teams/share-to-teams.component.jsx";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
bodyshop: selectBodyshop,
|
||||
partsManagementOnly: selectPartsManagementOnly
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
@@ -54,7 +54,7 @@ export function PartsOrderListTableComponent({
|
||||
handleOnRowClick,
|
||||
setPartsReceiveContext,
|
||||
setTaskUpsertContext,
|
||||
partsManagementOnly
|
||||
isPartsEntry
|
||||
}) {
|
||||
const responsibilityCenters = bodyshop.md_responsibility_centers;
|
||||
const Templates = TemplateList("partsorder", { job });
|
||||
@@ -108,7 +108,7 @@ export function PartsOrderListTableComponent({
|
||||
>
|
||||
{t("parts_orders.actions.receive")}
|
||||
</Button>
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<>
|
||||
<Button
|
||||
title={t("tasks.buttons.create")}
|
||||
@@ -148,7 +148,7 @@ export function PartsOrderListTableComponent({
|
||||
<Button disabled={jobRO} icon={<DeleteFilled />} />
|
||||
</Popconfirm>
|
||||
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<Button
|
||||
disabled={
|
||||
(jobRO ? !record.return : jobRO) ||
|
||||
|
||||
@@ -18,14 +18,14 @@ import JobsDetailHeader from "../../components/jobs-detail-header/jobs-detail-he
|
||||
import JobsDetailPliContainer from "../../components/jobs-detail-pli/jobs-detail-pli.container.jsx";
|
||||
import { QUERY_PARTS_BILLS_BY_JOBID } from "../../graphql/bills.queries.js";
|
||||
import { insertAuditTrail } from "../../redux/application/application.actions.js";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors.js";
|
||||
import { selectIsPartsEntry, selectJobReadOnly } from "../../redux/application/application.selectors.js";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions.js";
|
||||
import { selectBodyshop, selectPartsManagementOnly } from "../../redux/user/user.selectors.js";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
partsManagementOnly: selectPartsManagementOnly
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setPrintCenterContext: (context) =>
|
||||
@@ -53,7 +53,7 @@ export function SimplifiedPartsJobDetailComponent({
|
||||
mutationUpdateJob,
|
||||
insertAuditTrail,
|
||||
refetch,
|
||||
partsManagementOnly
|
||||
isPartsEntry
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
@@ -137,7 +137,7 @@ export function SimplifiedPartsJobDetailComponent({
|
||||
{t("jobs.actions.printCenter")}
|
||||
</Button>
|
||||
|
||||
{!partsManagementOnly && (
|
||||
{!isPartsEntry && (
|
||||
<>
|
||||
<JobsDetailHeaderActions key="actions" job={job} refetch={refetch} />
|
||||
<Button type="primary" loading={loading} disabled={jobRO} onClick={() => form.submit()}>
|
||||
|
||||
Reference in New Issue
Block a user