From 47263f263faaf319a3dfefb10bfc28ddd80d0c65 Mon Sep 17 00:00:00 2001 From: deepthi-m Date: Tue, 3 Oct 2023 13:31:06 +0530 Subject: [PATCH] Deepthi M|Gok-363|Removed unused code --- src/components/BasicTableModal/index.jsx | 16 ++++------------ src/service/save-receipt.js | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/components/BasicTableModal/index.jsx b/src/components/BasicTableModal/index.jsx index c483f03..cc59f3f 100644 --- a/src/components/BasicTableModal/index.jsx +++ b/src/components/BasicTableModal/index.jsx @@ -36,9 +36,9 @@ const TableModal = (props) => { const [editingRowId, setEditingRowId] = useState(null); const [cookies] = useCookies(); const [saveClicked, setSaveClicked] = useState(false); - const [isEditing, setIsEditing] = useState(false); // Track editing mode + const [isEditing, setIsEditing] = useState(false); const editRowRef = useRef(null); - const [editedQuantity, setEditedQuantity] = useState({}); // State to track edited quantity values + const [editedQuantity, setEditedQuantity] = useState({}); const { data: stockRoom, error: stockRoomError } = useSWR( stockRoomURL(cookies[locationCookieName]?.name.trim()), @@ -70,13 +70,6 @@ useEffect(() => { }; }, []); - const handleQuantityChange = (rowId, value) => { - // Update the edited quantity state when the quantity input changes - setEditedQuantity((prevEditedQuantity) => ({ - ...prevEditedQuantity, - [rowId]: value, - })); - }; const handleActualQuantityChange = (rowId, value) => { const updatedEditedRows = editedRows.map((row) => { @@ -104,12 +97,11 @@ useEffect(() => { if (editedRow) { const { productName, quantity, actualQuantity, expiration, batchNumber } = editedRow; - // Use the edited quantity state if available, otherwise use the original quantity value const editedQuantityValue = editedQuantity[rowId] || quantity; const response = await saveEditedQuantity( productName, - editedQuantityValue, // Use the edited quantity value + quantity, actualQuantity, expiration, batchNumber, @@ -200,7 +192,7 @@ useEffect(() => { onKeyDown={(e) => { if (e.key === '-' || e.key === 'e') { - e.preventDefault(); // Prevent typing "-" and "e" + e.preventDefault(); } }} diff --git a/src/service/save-receipt.js b/src/service/save-receipt.js index 0aecd53..2b0d70a 100644 --- a/src/service/save-receipt.js +++ b/src/service/save-receipt.js @@ -15,7 +15,7 @@ const saveReceipt = async (items, outwardNumber, destinationUuid) => { const itemName = encodeURIComponent(item.item); const response = await getRequest(`/openmrs/ws/rest/v2/inventory/item?v=full&q=${itemName}`); const itemUuid = response.results[0]?.uuid; - // Add the item to the requestBody.items array with all corresponding properties + itemsArray.push({ item: itemUuid, quantity: item.totalQuantity,