Browse Source

quick update for po detail

master
cyril.tsui 1 week ago
parent
commit
da4f29f41b
2 changed files with 10 additions and 6 deletions
  1. +7
    -6
      src/components/PoDetail/PoDetail.tsx
  2. +3
    -0
      src/components/PoDetail/PoInputGrid.tsx

+ 7
- 6
src/components/PoDetail/PoDetail.tsx View File

@@ -182,7 +182,7 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => {
const searchParams = useSearchParams(); const searchParams = useSearchParams();
const [row, setRow] = useState(rows[0]); const [row, setRow] = useState(rows[0]);
const [stockInLine, setStockInLine] = useState<StockInLine[]>([]);
const [stockInLine, setStockInLine] = useState<StockInLine[]>(rows[0].stockInLine);
const [processedQty, setProcessedQty] = useState(rows[0].processed); const [processedQty, setProcessedQty] = useState(rows[0].processed);


const router = useRouter(); const router = useRouter();
@@ -288,9 +288,9 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => {
setRows(purchaseOrder.pol || []); setRows(purchaseOrder.pol || []);
}, [purchaseOrder]); }, [purchaseOrder]);


useEffect(() => {
setStockInLine([])
}, []);
// useEffect(() => {
// setStockInLine([])
// }, []);


function Row(props: { row: PurchaseOrderLine }) { function Row(props: { row: PurchaseOrderLine }) {
const { row } = props; const { row } = props;
@@ -330,15 +330,16 @@ const PoDetail: React.FC<Props> = ({ po, qc, warehouse }) => {
(id: number) => { (id: number) => {
console.log(id) console.log(id)
//rows = purchaseOrderLine //rows = purchaseOrderLine
console.log(rows)
const target = rows.find((r) => r.id === id) const target = rows.find((r) => r.id === id)
const stockInLine = target!.stockInLine const stockInLine = target!.stockInLine
console.log(stockInLine) console.log(stockInLine)
console.log(stockInLine)
setStockInLine(stockInLine) setStockInLine(stockInLine)
setRow(target!)
// console.log(pathname) // console.log(pathname)
// router.replace(`/po/edit?id=${item.poId}&polId=${item.polId}&stockInLineId=${item.stockInLineId}`); // router.replace(`/po/edit?id=${item.poId}&polId=${item.polId}&stockInLineId=${item.stockInLineId}`);
}, },
[]
[rows]
); );


const handleStart = useCallback( const handleStart = useCallback(


+ 3
- 0
src/components/PoDetail/PoInputGrid.tsx View File

@@ -121,6 +121,9 @@ function PoInputGrid({
); );
console.log(stockInLine); console.log(stockInLine);
const [entries, setEntries] = useState<StockInLineRow[]>(stockInLine || []); const [entries, setEntries] = useState<StockInLineRow[]>(stockInLine || []);
useEffect(() => {
setEntries(stockInLine)
}, [stockInLine])
const [modalInfo, setModalInfo] = useState< const [modalInfo, setModalInfo] = useState<
StockInLine & { qcResult?: PurchaseQcResult[] } StockInLine & { qcResult?: PurchaseQcResult[] }
>(); >();


Loading…
Cancel
Save