diff --git a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx index 69dfdf3..3366777 100644 --- a/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx +++ b/frontend/src/app/fertilizer/_components/FertilizerEditPage.tsx @@ -369,7 +369,10 @@ export default function FertilizerEditPage({ planId }: { planId?: number }) { const getPlanAvailableStock = (fertilizer: Fertilizer) => { const stock = getStockInfo(fertilizer); if (!stock) return null; - return getNumericValue(stock.available_stock); + const serverAvailable = getNumericValue(stock.available_stock); + const initialReserve = initialPlanTotals[fertilizer.id] ?? 0; + const currentPlanTotal = colTotal(fertilizer.id); + return serverAvailable + initialReserve - currentPlanTotal; }; const getPlanShortage = (fertilizer: Fertilizer) => { const available = getPlanAvailableStock(fertilizer);