feature/IO-3255-simplified-parts-management - Cleanup
This commit is contained in:
@@ -28,6 +28,7 @@ import ProductionListColumnComment from "../production-list-columns/production-l
|
||||
import ProductionListColumnProductionNote from "../production-list-columns/production-list-columns.productionnote.component";
|
||||
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||
import "./jobs-detail-header.styles.scss";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
jobRO: selectJobReadOnly,
|
||||
@@ -58,7 +59,7 @@ export function JobsDetailHeader({ job, bodyshop, disabled, insertAuditTrail, is
|
||||
const { notification } = useNotification();
|
||||
const [notesClamped, setNotesClamped] = useState(true);
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const colSpan = {
|
||||
xs: { span: 24 },
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Card, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -9,18 +9,22 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||
import OwnerDetailUpdateJobsComponent from "../owner-detail-update-jobs/owner-detail-update-jobs.component";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
bodyshop: selectBodyshop,
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
||||
function OwnerDetailJobsComponent({ bodyshop, owner, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedJobs, setSelectedJobs] = useState([]);
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" }
|
||||
});
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
@@ -33,7 +37,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
||||
key: "ro_number",
|
||||
ellipsis: true,
|
||||
render: (text, record) => (
|
||||
<Link to={`/manage/jobs/${record.id}`}>{record.ro_number || t("general.labels.na")}</Link>
|
||||
<Link to={`${basePath}/jobs/${record.id}`}>{record.ro_number || t("general.labels.na")}</Link>
|
||||
),
|
||||
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||
sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order
|
||||
@@ -50,7 +54,7 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
||||
sortOrder: state.sortedInfo.columnKey === "vehicleid" && state.sortedInfo.order,
|
||||
render: (text, record) =>
|
||||
record.vehicleid ? (
|
||||
<Link to={`/manage/vehicles/${record.vehicleid}`}>
|
||||
<Link to={`${basePath}/vehicles/${record.vehicleid}`}>
|
||||
{`${record.v_model_yr || ""} ${record.v_make_desc || ""} ${record.v_model_desc || ""}`.trim()}
|
||||
</Link>
|
||||
) : (
|
||||
@@ -80,13 +84,9 @@ function OwnerDetailJobsComponent({ bodyshop, owner }) {
|
||||
title: t("jobs.fields.actual_completion"),
|
||||
dataIndex: "actual_completion",
|
||||
key: "actual_completion",
|
||||
render: (text, record) => (
|
||||
<DateTimeFormatter>{record.actual_completion}</DateTimeFormatter>
|
||||
),
|
||||
render: (text, record) => <DateTimeFormatter>{record.actual_completion}</DateTimeFormatter>,
|
||||
sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "actual_completion" &&
|
||||
state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "actual_completion" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
|
||||
@@ -18,6 +18,7 @@ import JobPartsQueueCount from "../job-parts-queue-count/job-parts-queue-count.c
|
||||
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import * as Sentry from "@sentry/react";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -31,7 +32,7 @@ export function SimplifiedPartsJobsListComponent({ bodyshop, refetch, loading, j
|
||||
const [filter, setFilter] = useLocalStorage("filter_jobs_all", null);
|
||||
const { page, sortcolumn, sortorder } = search;
|
||||
const history = useNavigate();
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Card, Table } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -10,12 +10,15 @@ import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
import { alphaSort, dateSort, statusSort } from "../../utils/sorters";
|
||||
import OwnerNameDisplay, { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||
import VehicleDetailUpdateJobsComponent from "../vehicle-detail-update-jobs/vehicle-detail-update-jobs.component";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
bodyshop: selectBodyshop,
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
});
|
||||
|
||||
export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
export function VehicleDetailJobsComponent({ vehicle, bodyshop, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedJobs, setSelectedJobs] = useState([]);
|
||||
const [state, setState] = useState({
|
||||
@@ -23,6 +26,8 @@ export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
filteredInfo: { text: "" }
|
||||
});
|
||||
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
};
|
||||
@@ -34,7 +39,7 @@ export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
key: "ro_number",
|
||||
ellipsis: true,
|
||||
render: (text, record) => (
|
||||
<Link to={`/manage/jobs/${record.id}`}>{record.ro_number || t("general.labels.na")}</Link>
|
||||
<Link to={`${basePath}/jobs/${record.id}`}>{record.ro_number || t("general.labels.na")}</Link>
|
||||
),
|
||||
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||
sortOrder: state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order
|
||||
@@ -45,11 +50,14 @@ export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
key: "owner",
|
||||
sorter: (a, b) => alphaSort(OwnerNameDisplayFunction(a), OwnerNameDisplayFunction(b)),
|
||||
sortOrder: state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<Link to={`/manage/owners/${record.owner.id}`}>
|
||||
render: (text, record) =>
|
||||
!isPartsEntry ? (
|
||||
<Link to={`${basePath}/owners/${record.owner.id}`}>
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</Link>
|
||||
) : (
|
||||
<OwnerNameDisplay ownerObject={record} />
|
||||
</Link>
|
||||
)
|
||||
)
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_no"),
|
||||
@@ -68,19 +76,15 @@ export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
text: status,
|
||||
value: status
|
||||
})),
|
||||
onFilter: (value, record) => value.includes(record.status),
|
||||
onFilter: (value, record) => value.includes(record.status)
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.actual_completion"),
|
||||
dataIndex: "actual_completion",
|
||||
key: "actual_completion",
|
||||
render: (text, record) => (
|
||||
<DateTimeFormatter>{record.actual_completion}</DateTimeFormatter>
|
||||
),
|
||||
render: (text, record) => <DateTimeFormatter>{record.actual_completion}</DateTimeFormatter>,
|
||||
sorter: (a, b) => dateSort(a.actual_completion, b.actual_completion),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "actual_completion" &&
|
||||
state.sortedInfo.order,
|
||||
sortOrder: state.sortedInfo.columnKey === "actual_completion" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
|
||||
@@ -5,6 +5,7 @@ import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.compon
|
||||
import { connect } from "react-redux";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
@@ -12,7 +13,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
|
||||
export function VehicleTagPopoverComponent({ job, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
if (!job.vehicle) return null;
|
||||
|
||||
const content = (
|
||||
|
||||
@@ -8,6 +8,7 @@ import { pageLimit } from "../../utils/config";
|
||||
import { connect } from "react-redux";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
@@ -16,7 +17,7 @@ const mapStateToProps = createStructuredSelector({
|
||||
export function VehiclesListContainer({ isPartsEntry }) {
|
||||
const searchParams = queryString.parse(useLocation().search);
|
||||
const { page, sortcolumn, sortorder, search } = searchParams;
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_VEHICLES_PAGINATED, {
|
||||
variables: {
|
||||
|
||||
@@ -13,6 +13,7 @@ import NotFound from "../../components/not-found/not-found.component";
|
||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
@@ -27,7 +28,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
export function VehicleDetailContainer({ setBreadcrumbs, addRecentItem, setSelectedHeader, isPartsEntry }) {
|
||||
const { vehId } = useParams();
|
||||
const { t } = useTranslation();
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
const { loading, data, error, refetch } = useQuery(QUERY_VEHICLE_BY_ID, {
|
||||
variables: { id: vehId },
|
||||
|
||||
@@ -7,6 +7,7 @@ import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||
import { setBreadcrumbs, setSelectedHeader } from "../../redux/application/application.actions";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectIsPartsEntry } from "../../redux/application/application.selectors.js";
|
||||
import getPartsBasePath from "../../utils/getPartsBasePath.js";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
isPartsEntry: selectIsPartsEntry
|
||||
@@ -19,7 +20,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function VehiclesPageContainer({ setBreadcrumbs, setSelectedHeader, isPartsEntry }) {
|
||||
const { t } = useTranslation();
|
||||
const basePath = isPartsEntry ? "/parts" : "/manage";
|
||||
const basePath = getPartsBasePath(isPartsEntry);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = t("titles.vehicles", {
|
||||
|
||||
5
client/src/utils/getPartsBasePath.js
Normal file
5
client/src/utils/getPartsBasePath.js
Normal file
@@ -0,0 +1,5 @@
|
||||
const getPartsBasePath = (isPartsEntry) => {
|
||||
return isPartsEntry ? "/parts" : "/manage";
|
||||
};
|
||||
|
||||
export default getPartsBasePath;
|
||||
@@ -71,7 +71,11 @@ const SOCKETIO_CORS_ORIGIN = [
|
||||
"https://old.imex.online",
|
||||
"https://www.old.imex.online",
|
||||
"https://wsadmin.imex.online",
|
||||
"https://www.wsadmin.imex.online"
|
||||
"https://www.wsadmin.imex.online",
|
||||
"https://devproe.web-est.com",
|
||||
"https://stagingproe.web-est.com",
|
||||
"https://pm.staging.web-est.com",
|
||||
"https://pm.web-est.com"
|
||||
];
|
||||
|
||||
const SOCKETIO_CORS_ORIGIN_DEV = ["http://localhost:3333", "https://localhost:3333"];
|
||||
|
||||
Reference in New Issue
Block a user