This commit is contained in:
Jake Kasper
2025-08-27 14:12:49 -04:00
parent 6123bb2a71
commit 88f02f33ac

View File

@@ -329,13 +329,16 @@ const ApplicationPlanModal = ({
required
>
<option value="">Select equipment</option>
{equipment.map(eq => (
<option key={eq.id} value={eq.id}>
{eq.equipment_name || eq.name || eq.manufacturer || 'Unnamed Equipment'}
{eq.equipment_type || eq.type ? ` (${eq.equipment_type || eq.type})` : ''}
{eq.equipment_model || eq.model ? ` - ${eq.equipment_model || eq.model}` : ''}
</option>
))}
{equipment
.filter(eq => !applicationType ||
(applicationType === 'granular' && eq.category_name === 'Spreader') ||
(applicationType === 'liquid' && eq.category_name === 'Sprayer')
)
.map(eq => (
<option key={eq.id} value={eq.id}>
{eq.custom_name} ({eq.type_name})
</option>
))}
</select>
</div>
@@ -355,9 +358,9 @@ const ApplicationPlanModal = ({
<option value="">Select nozzle</option>
{nozzles.map(nozzle => (
<option key={nozzle.id} value={nozzle.id}>
{nozzle.nozzle_name || nozzle.name}
{nozzle.flow_rate && ` - ${nozzle.flow_rate} GPM`}
{nozzle.nozzle_type && ` (${nozzle.nozzle_type})`}
{nozzle.custom_name} - {nozzle.manufacturer}
{nozzle.flow_rate_gpm && ` (${nozzle.flow_rate_gpm} GPM)`}
{nozzle.orifice_size && ` - ${nozzle.orifice_size}`}
</option>
))}
</select>
@@ -390,15 +393,15 @@ const ApplicationPlanModal = ({
<select
value={product.uniqueId || ''}
onChange={(e) => {
const selectedProduct = products.find(p => p.uniqueId === e.target.value);
const selectedProduct = products.find(p => (p.uniqueId || p.id) === e.target.value);
if (selectedProduct) {
updateProduct(index, 'uniqueId', e.target.value);
updateProduct(index, 'productId', selectedProduct.isShared ? selectedProduct.id : null);
updateProduct(index, 'userProductId', !selectedProduct.isShared ? selectedProduct.id : null);
updateProduct(index, 'isUserProduct', !selectedProduct.isShared);
updateProduct(index, 'productName', selectedProduct.product_name || selectedProduct.name);
updateProduct(index, 'productBrand', selectedProduct.product_brand || selectedProduct.brand);
updateProduct(index, 'productType', selectedProduct.product_type || selectedProduct.productType);
updateProduct(index, 'productName', selectedProduct.name || selectedProduct.product_name);
updateProduct(index, 'productBrand', selectedProduct.brand || selectedProduct.product_brand);
updateProduct(index, 'productType', selectedProduct.productType || selectedProduct.product_type);
// Pre-populate application rate if available
if (selectedProduct.applicationRate) {
@@ -410,7 +413,7 @@ const ApplicationPlanModal = ({
}
// Set appropriate rate unit based on product type
const productType = selectedProduct.product_type || selectedProduct.productType;
const productType = selectedProduct.productType || selectedProduct.product_type;
if (productType === 'granular') {
updateProduct(index, 'rateUnit', 'lb/1000sqft');
} else if (productType === 'liquid') {
@@ -429,9 +432,9 @@ const ApplicationPlanModal = ({
(prod.type === applicationType)
)
.map(prod => (
<option key={prod.uniqueId} value={prod.uniqueId}>
{prod.product_name || prod.name || prod.productName || 'Unknown Product'}
{(prod.product_brand || prod.brand || prod.productBrand) && ` - ${prod.product_brand || prod.brand || prod.productBrand}`}
<option key={prod.uniqueId || prod.id} value={prod.uniqueId || prod.id}>
{prod.name || prod.product_name || prod.productName || 'Unknown Product'}
{(prod.brand || prod.product_brand || prod.productBrand) && ` - ${prod.brand || prod.product_brand || prod.productBrand}`}
{prod.isShared === false && ' (Custom)'}
</option>
))}