diff --git a/frontend/src/components/Applications/ApplicationPlanModal.js b/frontend/src/components/Applications/ApplicationPlanModal.js index e742cf9..8b712d1 100644 --- a/frontend/src/components/Applications/ApplicationPlanModal.js +++ b/frontend/src/components/Applications/ApplicationPlanModal.js @@ -448,11 +448,33 @@ const ApplicationPlanModal = ({ selectedAreas, equipmentId: selectedEquipmentId, nozzleId: selectedNozzleId || null, - products: selectedProducts, + applicationType, plannedDate, notes }; + // Add products in the format expected by Applications.js + if (applicationType === 'liquid') { + // For liquid: send selectedProducts array with product objects + planData.selectedProducts = selectedProducts.map(product => ({ + product: products.find(p => (p.uniqueId || p.id) === product.uniqueId), + rateAmount: product.rateAmount, + rateUnit: product.rateUnit + })); + } else { + // For granular: send single selectedProduct object + const firstProduct = selectedProducts[0]; + const productDetails = products.find(p => (p.uniqueId || p.id) === firstProduct.uniqueId); + + planData.selectedProduct = { + ...productDetails, + customRateAmount: firstProduct.rateAmount, + customRateUnit: firstProduct.rateUnit, + rateAmount: firstProduct.rateAmount, + rateUnit: firstProduct.rateUnit + }; + } + await onSubmit(planData); onClose(); } catch (error) {