Commit 44bf1622 authored by Nawasan Wisitsingkhon's avatar Nawasan Wisitsingkhon

search order by id

parent 735c3fd7
......@@ -18,6 +18,7 @@ import PopupAlert from "@/components/PopupAlert";
import Head from "next/head";
import Link from "next/link";
import ConfirmPayment from "@/components/order/ConfirmPayment";
import { useRouter } from "next/router";
export default function Order() {
const user = useContext(UserContext);
......@@ -27,6 +28,7 @@ export default function Order() {
const order = useContext(OrderContext);
const [payment, setPayment] = useState({ open: false, id: -1, price: -1 });
const [payFilter, setPayFilter] = useState(false);
const router = useRouter()
const fetchProduct = async () => {
try {
......@@ -102,6 +104,7 @@ export default function Order() {
{order.value.map(
(order, idx) =>
order &&
(!router.query?.q || Number(router.query.q) === order.id ) &&
(!payFilter || order.pay_status === 0) && (
<TableRow key={idx}>
<TableCell>{order.id}</TableCell>
......
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