This commit is contained in:
Jake Kasper
2025-08-25 14:06:03 -04:00
parent d400a84653
commit eef39c6a59

View File

@@ -434,20 +434,6 @@ const ApplicationPlanModal = ({
} }
}, [editingPlan, products]); }, [editingPlan, products]);
// Load spreader recommendation when relevant fields change
useEffect(() => {
loadSpreaderRecommendation(planData.selectedProduct, planData.equipmentId, planData.selectedAreas);
}, [planData.selectedProduct, planData.equipmentId, planData.selectedAreas, selectedPropertyDetails, equipment]);
const handlePropertyChange = async (propertyId) => {
setPlanData({ ...planData, propertyId, selectedAreas: [] });
if (propertyId && propertyId !== selectedPropertyDetails?.id?.toString()) {
setLoadingProperty(true);
await onPropertySelect(propertyId);
setLoadingProperty(false);
}
};
// Load spreader recommendations when granular product and spreader are selected // Load spreader recommendations when granular product and spreader are selected
const loadSpreaderRecommendation = async (product, equipmentId, selectedAreas) => { const loadSpreaderRecommendation = async (product, equipmentId, selectedAreas) => {
if (!product || !equipmentId || !selectedAreas.length || product.productType !== 'granular') { if (!product || !equipmentId || !selectedAreas.length || product.productType !== 'granular') {
@@ -546,6 +532,20 @@ const ApplicationPlanModal = ({
} }
}; };
// Load spreader recommendation when relevant fields change
useEffect(() => {
loadSpreaderRecommendation(planData.selectedProduct, planData.equipmentId, planData.selectedAreas);
}, [planData.selectedProduct, planData.equipmentId, planData.selectedAreas, selectedPropertyDetails, equipment]);
const handlePropertyChange = async (propertyId) => {
setPlanData({ ...planData, propertyId, selectedAreas: [] });
if (propertyId && propertyId !== selectedPropertyDetails?.id?.toString()) {
setLoadingProperty(true);
await onPropertySelect(propertyId);
setLoadingProperty(false);
}
};
// Filter equipment based on application type // Filter equipment based on application type
const availableEquipment = equipment.filter(eq => { const availableEquipment = equipment.filter(eq => {
if (planData.applicationType === 'liquid') { if (planData.applicationType === 'liquid') {