Fix for IO-2534

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-01-08 17:03:24 -05:00
parent 2e589c44a6
commit 7589f78fe1
2 changed files with 84 additions and 77 deletions

View File

@@ -16,6 +16,7 @@ const BillLineSearchSelect = (
ref={ref} ref={ref}
showSearch showSearch
popupMatchSelectWidth={false} popupMatchSelectWidth={false}
optionLabelProp={"name"}
// optionFilterProp="line_desc" // optionFilterProp="line_desc"
filterOption={(inputValue, option) => { filterOption={(inputValue, option) => {
return ( return (
@@ -57,6 +58,9 @@ const BillLineSearchSelect = (
style={{ style={{
...(item.removed ? { textDecoration: "line-through" } : {}), ...(item.removed ? { textDecoration: "line-through" } : {}),
}} }}
name={`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${
item.oem_partno ? ` - ${item.oem_partno}` : ""
}${item.alt_partno ? ` (${item.alt_partno})` : ""}`.trim()}
> >
<span> <span>
{`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${ {`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${

View File

@@ -1,13 +1,14 @@
import { HeartOutlined } from "@ant-design/icons"; import {HeartOutlined} from "@ant-design/icons";
import { Select, Space, Tag } from "antd"; import {Select, Space, Tag} from "antd";
import React, { forwardRef, useEffect, useState } from "react"; import React, {forwardRef, useEffect, useState} from "react";
import PhoneNumberFormatter from "../../utils/PhoneFormatter"; import PhoneNumberFormatter from "../../utils/PhoneFormatter";
const { Option } = Select;
const {Option} = Select;
//To be used as a form element only. //To be used as a form element only.
const VendorSearchSelect = ( const VendorSearchSelect = (
{ value, onChange, options, onSelect, disabled, preferredMake, showPhone }, {value, onChange, options, onSelect, disabled, preferredMake, showPhone},
ref ref
) => { ) => {
const [option, setOption] = useState(value); const [option, setOption] = useState(value);
@@ -41,6 +42,7 @@ const VendorSearchSelect = (
optionFilterProp="name" optionFilterProp="name"
onSelect={onSelect} onSelect={onSelect}
disabled={disabled || false} disabled={disabled || false}
optionLabelProp={"name"}
> >
{favorites {favorites
? favorites.map((o) => ( ? favorites.map((o) => (
@@ -51,9 +53,9 @@ const VendorSearchSelect = (
discount={o.discount} discount={o.discount}
> >
<div className="imex-flex-row"> <div className="imex-flex-row">
<div style={{ flex: 1 }}>{o.name}</div> <div style={{flex: 1}}>{o.name}</div>
<Space style={{ marginLeft: "1rem" }}> <Space style={{marginLeft: "1rem"}}>
<HeartOutlined style={{ color: "red" }} /> <HeartOutlined style={{color: "red"}}/>
{o.phone && showPhone && ( {o.phone && showPhone && (
<PhoneNumberFormatter>{o.phone}</PhoneNumberFormatter> <PhoneNumberFormatter>{o.phone}</PhoneNumberFormatter>
)} )}
@@ -68,10 +70,10 @@ const VendorSearchSelect = (
{options {options
? options.map((o) => ( ? options.map((o) => (
<Option key={o.id} value={o.id} name={o.name} discount={o.discount}> <Option key={o.id} value={o.id} name={o.name} discount={o.discount}>
<div className="imex-flex-row" style={{ width: "100%" }}> <div className="imex-flex-row" style={{width: "100%"}}>
<div style={{ flex: 1 }}>{o.name}</div> <div style={{flex: 1}}>{o.name}</div>
<Space style={{ marginLeft: "1rem" }}> <Space style={{marginLeft: "1rem"}}>
{o.phone && showPhone && ( {o.phone && showPhone && (
<PhoneNumberFormatter>{o.phone}</PhoneNumberFormatter> <PhoneNumberFormatter>{o.phone}</PhoneNumberFormatter>
)} )}
@@ -81,6 +83,7 @@ const VendorSearchSelect = (
</Space> </Space>
</div> </div>
</Option> </Option>
)) ))
: null} : null}
</Select> </Select>