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