From 691be0531a1725717a4839dfeb281836d14856fc Mon Sep 17 00:00:00 2001 From: Jake Kasper Date: Thu, 21 Aug 2025 20:13:20 -0400 Subject: [PATCH] products updates --- backend/scripts/seed-products.sql | 19 ++++++++++++++++++- frontend/src/pages/Products/Products.js | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/backend/scripts/seed-products.sql b/backend/scripts/seed-products.sql index 3b153b8..c363674 100644 --- a/backend/scripts/seed-products.sql +++ b/backend/scripts/seed-products.sql @@ -9,7 +9,9 @@ INSERT INTO product_categories (name, description) VALUES ('Insecticides', 'Products for insect control'), ('Pre-emergent', 'Products that prevent weeds from germinating'), ('Post-emergent', 'Products that kill existing weeds'), -('Growth Regulators', 'Products that modify plant growth') +('Growth Regulators', 'Products that modify plant growth'), +('Surfactants', 'Products that improve spray coverage and penetration'), +('Adjuvants', 'Products that enhance pesticide performance') ON CONFLICT (name) DO NOTHING; -- Get category IDs for reference @@ -22,6 +24,8 @@ DECLARE pre_emergent_cat_id INTEGER; post_emergent_cat_id INTEGER; growth_reg_cat_id INTEGER; + surfactant_cat_id INTEGER; + adjuvant_cat_id INTEGER; BEGIN SELECT id INTO herbicide_cat_id FROM product_categories WHERE name = 'Herbicides'; SELECT id INTO fertilizer_cat_id FROM product_categories WHERE name = 'Fertilizers'; @@ -30,6 +34,8 @@ BEGIN SELECT id INTO pre_emergent_cat_id FROM product_categories WHERE name = 'Pre-emergent'; SELECT id INTO post_emergent_cat_id FROM product_categories WHERE name = 'Post-emergent'; SELECT id INTO growth_reg_cat_id FROM product_categories WHERE name = 'Growth Regulators'; + SELECT id INTO surfactant_cat_id FROM product_categories WHERE name = 'Surfactants'; + SELECT id INTO adjuvant_cat_id FROM product_categories WHERE name = 'Adjuvants'; -- Insert herbicides INSERT INTO products (name, brand, category_id, product_type, active_ingredients, description) VALUES @@ -80,6 +86,17 @@ BEGIN ('Thiamethoxam 25WG', 'Meridian', insecticide_cat_id, 'granular', 'Thiamethoxam 25%', 'Systemic insecticide for grub prevention and surface insects') ON CONFLICT (name, brand) DO NOTHING; + -- Insert surfactants and adjuvants + INSERT INTO products (name, brand, category_id, product_type, active_ingredients, description) VALUES + ('NIS 90%', 'Various', surfactant_cat_id, 'liquid', 'Nonionic Surfactant 90%', 'Non-ionic surfactant for improved spray coverage and penetration'), + ('MSO', 'Various', adjuvant_cat_id, 'liquid', 'Methylated Seed Oil 83%', 'Crop oil concentrate for enhanced herbicide uptake'), + ('Silicone Surfactant', 'Silwet L-77', surfactant_cat_id, 'liquid', 'Organosilicone 100%', 'Super spreader for maximum coverage'), + ('Penetrant', 'LI-700', adjuvant_cat_id, 'liquid', 'Lecithin + Propionic Acid', 'Penetrating agent for improved systemic activity'), + ('COC', 'Various', adjuvant_cat_id, 'liquid', 'Crop Oil Concentrate 83%', 'Oil-based adjuvant for herbicide enhancement'), + ('AMS', 'Various', adjuvant_cat_id, 'granular', 'Ammonium Sulfate 21-0-0-24S', 'Water conditioner and spray enhancer'), + ('Sticker Spreader', 'Bond', adjuvant_cat_id, 'liquid', 'Pinolene + Surfactants', 'Improves adhesion and spreading of sprays') + ON CONFLICT (name, brand) DO NOTHING; + END $$; -- Insert application rates for key products diff --git a/frontend/src/pages/Products/Products.js b/frontend/src/pages/Products/Products.js index fd5de9e..8482099 100644 --- a/frontend/src/pages/Products/Products.js +++ b/frontend/src/pages/Products/Products.js @@ -364,7 +364,7 @@ const CreateProductModal = ({ onSubmit, onCancel, sharedProducts, categories }) } const submitData = { - productId: formData.productId || null, + productId: formData.productId ? parseInt(formData.productId) : null, customName: formData.customName || null, customRateAmount: formData.customRateAmount ? parseFloat(formData.customRateAmount) : null, customRateUnit: formData.customRateUnit || null,