From 2cbd523f58c64369b7e37bda3715638d03fce379 Mon Sep 17 00:00:00 2001 From: Felix Kiprotich <72152368+FelixKiprotich350@users.noreply.github.com> Date: Thu, 18 Jul 2024 22:31:11 +0300 Subject: [PATCH] (fix) Fix reverseal of autochange quantity commit and removed unused code (#112) * Improved Dispensing module- Selectable items must have quantities greater or equal to the dispensing quantity * camelcase naming fix * fixed count condition to be greater than 0 only * enabled autopick batch quantity in cases where it is less than prescribed quantity * Corrected and simplified date calculation * Fixed updatequantity when stock is diabled in dispensing module * (fix) O3-3557: Ensure selectable batches have sufficient quantities for dispensing * Added a comment for the isValiBatch function which checks the expiry of the drugs * reverted back quantity dispense component * removed unused functions in the Fix the auto change of dispensing quantity when a batch is selected #110 PR --------- Co-authored-by: Mark Goodrich --- src/forms/dispense-form.component.tsx | 12 +----------- .../stock-dispense/stock-dispense.component.tsx | 7 +------ 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/src/forms/dispense-form.component.tsx b/src/forms/dispense-form.component.tsx index 35bb93f..ee3832b 100644 --- a/src/forms/dispense-form.component.tsx +++ b/src/forms/dispense-form.component.tsx @@ -64,11 +64,6 @@ const DispenseForm: React.FC = ({ // to prevent duplicate submits const [isSubmitting, setIsSubmitting] = useState(false); - //track quantity to dispense - const [currentQuantity, setCurrentQuantity] = useState( - quantityRemaining ? quantityRemaining : medicationDispense?.quantity?.value, - ); - // Submit medication dispense form const handleSubmit = () => { if (!isSubmitting) { @@ -170,10 +165,6 @@ const DispenseForm: React.FC = ({ } }; - const setAvailableQuantity = (batch) => { - setCurrentQuantity(Number(batch.quantity)); - }; - // initialize the internal dispense payload with the dispenses passed in as props useEffect(() => setMedicationDispensePayload(medicationDispense), [medicationDispense]); @@ -218,14 +209,13 @@ const DispenseForm: React.FC = ({ {config.enableStockDispense && ( )} diff --git a/src/forms/stock-dispense/stock-dispense.component.tsx b/src/forms/stock-dispense/stock-dispense.component.tsx index de10a10..aab8783 100644 --- a/src/forms/stock-dispense/stock-dispense.component.tsx +++ b/src/forms/stock-dispense/stock-dispense.component.tsx @@ -9,14 +9,9 @@ type StockDispenseProps = { medicationDispense: MedicationDispense; updateInventoryItem: (inventoryItem: InventoryItem) => void; inventoryItem: InventoryItem; - updateAvailableQuantityToMedicationDispenseQuantity: (inventoryItem: InventoryItem) => void; }; -const StockDispense: React.FC = ({ - medicationDispense, - updateInventoryItem, - updateAvailableQuantityToMedicationDispenseQuantity, -}) => { +const StockDispense: React.FC = ({ medicationDispense, updateInventoryItem }) => { const { t } = useTranslation(); const drugUuid = medicationDispense?.medicationReference?.reference?.split('/')[1]; const { inventoryItems, error, isLoading } = useDispenseStock(drugUuid);