diff --git a/frontend/src/components/Applications/ApplicationPlanModal.js b/frontend/src/components/Applications/ApplicationPlanModal.js
index fffc8c2..2c8c34b 100644
--- a/frontend/src/components/Applications/ApplicationPlanModal.js
+++ b/frontend/src/components/Applications/ApplicationPlanModal.js
@@ -19,6 +19,7 @@ const ApplicationPlanModal = ({
const [selectedEquipmentId, setSelectedEquipmentId] = useState('');
const [selectedNozzleId, setSelectedNozzleId] = useState('');
const [selectedProducts, setSelectedProducts] = useState([]);
+ const [applicationType, setApplicationType] = useState('');
const [plannedDate, setPlannedDate] = useState('');
const [notes, setNotes] = useState('');
const [loading, setLoading] = useState(false);
@@ -105,17 +106,42 @@ const ApplicationPlanModal = ({
});
};
- // Add product to plan
+ // Add product to plan (for liquid tank mixes)
const addProduct = () => {
setSelectedProducts(prev => [...prev, {
+ uniqueId: '',
productId: null,
userProductId: null,
+ productName: '',
+ productBrand: '',
+ productType: applicationType,
rateAmount: '',
- rateUnit: 'oz/1000sqft',
+ rateUnit: applicationType === 'granular' ? 'lb/1000sqft' : 'oz/1000sqft',
isUserProduct: false
}]);
};
+ // Handle application type change
+ const handleApplicationTypeChange = (type) => {
+ setApplicationType(type);
+ // Clear products when switching type
+ setSelectedProducts([]);
+ // Add initial product
+ setTimeout(() => {
+ setSelectedProducts([{
+ uniqueId: '',
+ productId: null,
+ userProductId: null,
+ productName: '',
+ productBrand: '',
+ productType: type,
+ rateAmount: '',
+ rateUnit: type === 'granular' ? 'lb/1000sqft' : 'oz/1000sqft',
+ isUserProduct: false
+ }]);
+ }, 0);
+ };
+
// Remove product from plan
const removeProduct = (index) => {
setSelectedProducts(prev => prev.filter((_, i) => i !== index));
@@ -245,7 +271,7 @@ const ApplicationPlanModal = ({
{equipment.map(eq => (
))}
@@ -286,78 +312,145 @@ const ApplicationPlanModal = ({
/>
+ {/* Application Type */}
+
+
{/* Products */}
-
+ {applicationType === 'liquid' && (
+
+ )}
{selectedProducts.map((product, index) => (
-
-
+
+ {/* Product Selection */}
+
-
-
updateProduct(index, 'rateAmount', e.target.value)}
- className="border border-gray-300 rounded px-2 py-1 flex-1"
- required
- />
-
+ {/* Rate Input */}
+
+
+
+ updateProduct(index, 'rateAmount', e.target.value)}
+ className="w-full border border-gray-300 rounded px-3 py-2"
+ required
+ />
+
+
+
+
+
-
+ {/* Remove Button */}
+ {applicationType === 'liquid' && selectedProducts.length > 1 && (
+
+
+
+ )}
))}
{selectedProducts.length === 0 && (
-
No products added yet
+
+
+ {applicationType ? `Select a ${applicationType} product to continue` : 'Select application type first'}
+
+
)}
@@ -376,52 +469,67 @@ const ApplicationPlanModal = ({
- {/* Right Column - Map */}
+ {/* Right Column - Areas & Map */}
-
-
- {selectedPropertyDetails ? (
-
- ) : (
-
-
Select a property to view areas
-
- )}
-
-
- {selectedAreas.length > 0 && selectedPropertyDetails && (
-
-
Selected Areas:
-
- {selectedAreas.map(areaId => {
- const area = selectedPropertyDetails.sections?.find(s => s.id === areaId);
- return (
-
- {area?.name} ({Math.round(area?.area || 0).toLocaleString()} sq ft)
+ {/* Area Selection with Checkboxes */}
+ {selectedPropertyDetails?.sections?.length > 0 && (
+
+
+
+ {selectedPropertyDetails.sections.map(section => (
+
+ ))}
-
- Total: {selectedAreas.reduce((total, areaId) => {
- const area = selectedPropertyDetails.sections?.find(s => s.id === areaId);
- return total + (area?.area || 0);
- }, 0).toLocaleString()} sq ft
-
+
+ {selectedAreas.length > 0 && (
+
+
+ Total Selected: {selectedAreas.reduce((total, areaId) => {
+ const area = selectedPropertyDetails.sections?.find(s => s.id === areaId);
+ return total + (area?.area || 0);
+ }, 0).toLocaleString()} sq ft
+
+
+ )}
)}
+
+ {/* Map Display */}
+
+
+
+ {selectedPropertyDetails ? (
+
+ ) : (
+
+
Select a property to view areas
+
+ )}
+
+