diff --git a/src/Components/Facility/AddInventoryForm.tsx b/src/Components/Facility/AddInventoryForm.tsx index d5c8cacf39c..3ef67b2faa8 100644 --- a/src/Components/Facility/AddInventoryForm.tsx +++ b/src/Components/Facility/AddInventoryForm.tsx @@ -1,6 +1,5 @@ import { Button, Card, CardContent, InputLabel } from "@material-ui/core"; import CheckCircleOutlineIcon from '@material-ui/icons/CheckCircleOutline'; -import moment from 'moment'; import React, { useCallback, useReducer, useState, useEffect } from "react"; import { useDispatch } from "react-redux"; import { statusType, useAbortableEffect } from "../../Common/utils"; @@ -11,12 +10,11 @@ import { Loading } from "../Common/Loading"; import PageTitle from "../Common/PageTitle"; import { InventoryItemsModel } from "./models"; - const initForm = { id: "", quantity: "", unit: "", - isIncoming: true, + isIncoming: false, }; const initialState = { form: { ...initForm } @@ -95,18 +93,19 @@ export const AddInventoryForm = (props: any) => { item: Number(state.form.id), unit: Number(state.form.unit), }; - + const res = await dispatchAction(postInventory(data, { facilityId })); setIsLoading(false); if (res && res.data) { Notification.Success({ msg: "Inventory created successfully" }); - } else { - Notification.Success({ - msg: "something went wrong!" - }); } + // else { + // Notification.Error({ + // msg: "something went wrong!" + // }); + // } goBack(); }; diff --git a/src/Components/Facility/InventoryList.tsx b/src/Components/Facility/InventoryList.tsx index 830aca51f19..e4b8dd82afd 100644 --- a/src/Components/Facility/InventoryList.tsx +++ b/src/Components/Facility/InventoryList.tsx @@ -20,8 +20,6 @@ export default function InventoryList(props: any) { const [offset, setOffset] = useState(0); const [currentPage, setCurrentPage] = useState(1); const [totalCount, setTotalCount] = useState(0); - - const limit = 14; const fetchData = useCallback( @@ -38,10 +36,10 @@ export default function InventoryList(props: any) { }, [dispatchAction, offset, facilityId] ); - + useAbortableEffect( (status: statusType) => { - fetchData(status); + fetchData(status); }, [fetchData] ); @@ -61,12 +59,12 @@ export default function InventoryList(props: any) { // } // setIsLoading(false); // } - + let inventoryList: any = []; if (inventory && inventory.length) { inventoryList = inventory.map((inventoryItem: any) => ( -
@@ -79,7 +77,7 @@ export default function InventoryList(props: any) {
{inventoryItem.quantity} {inventoryItem.item_object?.default_unit?.name}
@@ -128,17 +126,17 @@ export default function InventoryList(props: any) { {totalCount > limit && (+ {moment(inventoryItem.created_date).format("DD-MM-YYYY hh:mm:ss")} + {/* {new Date(inventoryItem.created_date).getDate()}-{new Date(inventoryItem.created_date).getMonth()}-{new Date(inventoryItem.created_date).getFullYear()} */} +
++ {inventoryItem.quantity} {inventoryItem.item_object?.default_unit?.name} +
++ {inventoryItem.is_incoming ? Incoming : Outgoing} +
++ No log for this inventory available +
++ Created On + | ++ Quantity + | ++ Status + | + +
---|