diff --git a/src/inventory/aushada/aushada.jsx b/src/inventory/aushada/aushada.jsx index b0e6c13..945a5dc 100644 --- a/src/inventory/aushada/aushada.jsx +++ b/src/inventory/aushada/aushada.jsx @@ -70,6 +70,7 @@ const Aushada = (props) => { const [instituteId, setInstituteId] = useState([]); const [instituteIdExists, setInstituteIdExists] = useState(false); const locationUuid = cookies[locationCookieName].uuid; + const [isTableVisible, setIsTableVisible] = useState(false); const { data: stockRoom, error: stockRoomError } = useSWR( stockRoomURL(cookies[locationCookieName]?.name.trim()), @@ -151,6 +152,7 @@ const Aushada = (props) => { }; fetchData(); } + setIsTableVisible(true); } }, [stockIntakeButtonClick, outwardNumber,selectedDate,instituteId,items]); @@ -177,7 +179,6 @@ const Aushada = (props) => { if (items.length > 0) { setIsOutwardNumberDisabled(true); - setIsFetchStockDisabled(true); } }, [items, outwardNumber, isDateSelected,instituteIdExists]); @@ -243,7 +244,19 @@ const Aushada = (props) => { const handleDateChange = (date) => { setSelectedDate(date[0]); setIsDateSelected(true); + setStockIntakeButtonClick(false); }; + useEffect(() => { + setIsTableVisible(false); + setItems([]); + if(selectedDate==null){ + setIsDateSelected(false); + } + }, [selectedDate]); + + const notificationMessage = enableEaushadhaInwardApi + ? 'No data is received for given inward date in this location. Could you please retry?' + : 'No data is received for the outward number. Could you please retry?'; return ( <> @@ -306,35 +319,30 @@ const Aushada = (props) => { {stockReceiptError && ( -