Skip to content

Commit

Permalink
Deepthi M|Gok-363|Removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
deepthi-mantena committed Oct 3, 2023
1 parent f716fca commit 47263f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
16 changes: 4 additions & 12 deletions src/components/BasicTableModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -200,7 +192,7 @@ useEffect(() => {

onKeyDown={(e) => {
if (e.key === '-' || e.key === 'e') {
e.preventDefault(); // Prevent typing "-" and "e"
e.preventDefault();
}
}}

Expand Down
2 changes: 1 addition & 1 deletion src/service/save-receipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 47263f2

Please sign in to comment.