Commit 6261f87b authored by Shanelle Valencia's avatar Shanelle Valencia

[AFP-24] 🚧 Fix search issues with order type [@valencia]

parent 99c953ef
import React, { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
<<<<<<< HEAD
import { Order } from 'Order';
=======
>>>>>>> ef2fc70222401291e5bd34259571daf7388cacca
const SearchOrder = (props: any) => {
const orders = props.orders;
......@@ -12,10 +11,9 @@ const SearchOrder = (props: any) => {
const [searchResult, setSearchResult] = useState([]);
console.log("ORDERS", orders)
<<<<<<< HEAD
// console.log("props", props)
=======
>>>>>>> ef2fc70222401291e5bd34259571daf7388cacca
const handleSearchInput = (event: any) => {
setSearchInput(event.target.value);
......@@ -26,16 +24,11 @@ const SearchOrder = (props: any) => {
}
useEffect(() => {
<<<<<<< HEAD
if (orders.length > 0) {
const res = orders.filter((order: Order) =>
order.orderNumber.includes(searchInput) //|| order.date.includes(searchInput)
=======
if (orders.length > 0) {
const res = orders.filter((order: any) =>
order.orderNumber.includes(searchInput) || order.date.includes(searchInput)
order.orderNumber.includes(searchInput) //|| order.date.includes(searchInput)
// console.log(orderNum)
>>>>>>> ef2fc70222401291e5bd34259571daf7388cacca
);
// debugger
setSearchResult(res);
......@@ -53,21 +46,13 @@ const SearchOrder = (props: any) => {
onChange={handleSearchInput}
/>
<ul>
<<<<<<< HEAD
{searchResult.map((item: any, idx) => {
// debugger
return (
<li key={idx}>
<Link to={"/orders/" + item.orderNumber}>{item.orderNumber}</Link>
</li>
=======
{searchResult.map((item, idx) => {
// debugger
return (
<tr key={idx}>
<Link to={"/orders/" + item}>item</Link>
</tr>
>>>>>>> ef2fc70222401291e5bd34259571daf7388cacca
)
})}
</ul>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment