IO-1536 Add VIN Highlighting.
This commit is contained in:
@@ -11,6 +11,7 @@ import AlertComponent from "../alert/alert.component";
|
|||||||
import OwnerNameDisplay, {
|
import OwnerNameDisplay, {
|
||||||
OwnerNameDisplayFunction,
|
OwnerNameDisplayFunction,
|
||||||
} from "../owner-name-display/owner-name-display.component";
|
} from "../owner-name-display/owner-name-display.component";
|
||||||
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
export default function GlobalSearch() {
|
export default function GlobalSearch() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@@ -97,7 +98,11 @@ export default function GlobalSearch() {
|
|||||||
} ${vehicle.v_model_desc || ""}`}
|
} ${vehicle.v_model_desc || ""}`}
|
||||||
</span>
|
</span>
|
||||||
<span>{vehicle.plate_no || ""}</span>
|
<span>{vehicle.plate_no || ""}</span>
|
||||||
<span> {vehicle.v_vin || ""}</span>
|
<span>
|
||||||
|
<VehicleVinDisplay>
|
||||||
|
{vehicle.v_vin || ""}
|
||||||
|
</VehicleVinDisplay>
|
||||||
|
</span>
|
||||||
</Space>
|
</Space>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Table, Input, Card, Space } from "antd";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
|
|
||||||
export default function JobsCreateVehicleInfoSearchComponent({
|
export default function JobsCreateVehicleInfoSearchComponent({
|
||||||
loading,
|
loading,
|
||||||
@@ -27,7 +28,9 @@ export default function JobsCreateVehicleInfoSearchComponent({
|
|||||||
tableState.sortedInfo.columnKey === "v_vin" &&
|
tableState.sortedInfo.columnKey === "v_vin" &&
|
||||||
tableState.sortedInfo.order,
|
tableState.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/vehicles/" + record.id}>{record.v_vin}</Link>
|
<Link to={"/manage/vehicles/" + record.id}>
|
||||||
|
<VehicleVinDisplay>{record.v_vin}</VehicleVinDisplay>
|
||||||
|
</Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import JobsRelatedRos from "../jobs-related-ros/jobs-related-ros.component";
|
|||||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||||
import ProductionListColumnComment from "../production-list-columns/production-list-columns.comment.component";
|
import ProductionListColumnComment from "../production-list-columns/production-list-columns.comment.component";
|
||||||
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
import { OwnerNameDisplayFunction } from "../owner-name-display/owner-name-display.component";
|
||||||
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
@@ -211,7 +212,9 @@ export function JobsDetailHeader({ job, bodyshop, disabled }) {
|
|||||||
}`})`}
|
}`})`}
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
|
<DataLabel key="4" label={t("vehicles.fields.v_vin")}>
|
||||||
{`${job.v_vin || t("general.labels.na")}`}
|
<VehicleVinDisplay>
|
||||||
|
{`${job.v_vin || t("general.labels.na")}`}
|
||||||
|
</VehicleVinDisplay>
|
||||||
</DataLabel>
|
</DataLabel>
|
||||||
<DataLabel label={t("jobs.labels.relatedros")}>
|
<DataLabel label={t("jobs.labels.relatedros")}>
|
||||||
<JobsRelatedRos jobid={job.id} job={job} />
|
<JobsRelatedRos jobid={job.id} job={job} />
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Button, Col, Descriptions, Popover, Row, Tag } from "antd";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
|
|
||||||
export default function VehicleTagPopoverComponent({ job }) {
|
export default function VehicleTagPopoverComponent({ job }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -27,7 +28,9 @@ export default function VehicleTagPopoverComponent({ job }) {
|
|||||||
{`${job.plate_st || t("general.labels.na")}`}
|
{`${job.plate_st || t("general.labels.na")}`}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
|
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
|
||||||
{`${job.v_vin || t("general.labels.na")}`}
|
<VehicleVinDisplay>
|
||||||
|
{`${job.v_vin || t("general.labels.na")}`}
|
||||||
|
</VehicleVinDisplay>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</Col>
|
</Col>
|
||||||
@@ -46,7 +49,9 @@ export default function VehicleTagPopoverComponent({ job }) {
|
|||||||
{`${job.vehicle.plate_st || t("general.labels.na")}`}
|
{`${job.vehicle.plate_st || t("general.labels.na")}`}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
|
<Descriptions.Item key="4" label={t("vehicles.fields.v_vin")}>
|
||||||
{`${job.vehicle.v_vin || t("general.labels.na")}`}
|
<VehicleVinDisplay>{`${
|
||||||
|
job.vehicle.v_vin || t("general.labels.na")
|
||||||
|
}`}</VehicleVinDisplay>
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
</Descriptions>
|
</Descriptions>
|
||||||
</Col>
|
</Col>
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from "react";
|
||||||
|
|
||||||
|
export default function VehicleVinDisplay({ children }) {
|
||||||
|
if (!children) return null;
|
||||||
|
console.log(children);
|
||||||
|
if (typeof children !== "string" || children.length !== 17) return children;
|
||||||
|
const vin = children.trim();
|
||||||
|
|
||||||
|
const first = vin.substring(0, 9);
|
||||||
|
const second = vin.substring(9, 17);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<span>{first}</span>
|
||||||
|
<span style={{ textDecoration: "underline" }}>{second}</span>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import queryString from "query-string";
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useHistory, useLocation } from "react-router-dom";
|
||||||
|
import VehicleVinDisplay from "../vehicle-vin-display/vehicle-vin-display.component";
|
||||||
export default function VehiclesListComponent({
|
export default function VehiclesListComponent({
|
||||||
loading,
|
loading,
|
||||||
vehicles,
|
vehicles,
|
||||||
@@ -31,7 +32,7 @@ export default function VehiclesListComponent({
|
|||||||
key: "v_vin",
|
key: "v_vin",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link to={"/manage/vehicles/" + record.id}>
|
<Link to={"/manage/vehicles/" + record.id}>
|
||||||
{record.v_vin || "N/A"}
|
<VehicleVinDisplay>{record.v_vin || "N/A"}</VehicleVinDisplay>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user