diff --git a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx index d985301b6..d53a2b052 100644 --- a/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx +++ b/client/src/components/bill-line-search-select/bill-line-search-select.component.jsx @@ -16,6 +16,7 @@ const BillLineSearchSelect = ( ref={ref} showSearch popupMatchSelectWidth={false} + optionLabelProp={"name"} // optionFilterProp="line_desc" filterOption={(inputValue, option) => { return ( @@ -57,6 +58,9 @@ const BillLineSearchSelect = ( style={{ ...(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()} > {`${item.removed ? `(REMOVED) ` : ""}${item.line_desc}${ diff --git a/client/src/components/vendor-search-select/vendor-search-select.component.jsx b/client/src/components/vendor-search-select/vendor-search-select.component.jsx index 59a801b03..aaf0626ed 100644 --- a/client/src/components/vendor-search-select/vendor-search-select.component.jsx +++ b/client/src/components/vendor-search-select/vendor-search-select.component.jsx @@ -1,89 +1,92 @@ -import { HeartOutlined } from "@ant-design/icons"; -import { Select, Space, Tag } from "antd"; -import React, { forwardRef, useEffect, useState } from "react"; +import {HeartOutlined} from "@ant-design/icons"; +import {Select, Space, Tag} from "antd"; +import React, {forwardRef, useEffect, useState} from "react"; import PhoneNumberFormatter from "../../utils/PhoneFormatter"; -const { Option } = Select; + +const {Option} = Select; //To be used as a form element only. const VendorSearchSelect = ( - { value, onChange, options, onSelect, disabled, preferredMake, showPhone }, - ref + {value, onChange, options, onSelect, disabled, preferredMake, showPhone}, + ref ) => { - const [option, setOption] = useState(value); + const [option, setOption] = useState(value); - useEffect(() => { - if (value !== option && onChange) { - onChange(option); - } - }, [value, option, onChange]); + useEffect(() => { + if (value !== option && onChange) { + onChange(option); + } + }, [value, option, onChange]); - const favorites = - preferredMake && options - ? options.filter( - (o) => - o.favorite.filter( - (f) => f.toLowerCase() === preferredMake.toLowerCase() - ).length > 0 - ) - : []; + const favorites = + preferredMake && options + ? options.filter( + (o) => + o.favorite.filter( + (f) => f.toLowerCase() === preferredMake.toLowerCase() + ).length > 0 + ) + : []; - return ( - + {favorites + ? favorites.map((o) => ( + + )) + : null} + {options + ? options.map((o) => ( + - )) - : null} - - ); + + {o.phone && showPhone && ( + {o.phone} + )} + {o.discount && o.discount !== 0 ? ( + {`${o.discount * 100}%`} + ) : null} + + + + + )) + : null} + + ); }; export default forwardRef(VendorSearchSelect);