This commit is contained in:
Jake Kasper
2025-09-03 15:00:25 -04:00
parent 60aede72af
commit 51e230744c

View File

@@ -238,12 +238,12 @@ const AdminProducts = () => {
}
// For custom seed products, parse activeIngredients JSON for blend and seed rates
if (!product.isShared && productType === 'seed' && product.customActiveIngredients) {
if (!product.isShared && productType === 'seed' && product.activeIngredients) {
try {
const ai = typeof product.customActiveIngredients === 'string' ? JSON.parse(product.customActiveIngredients) : product.customActiveIngredients;
const ai = typeof product.activeIngredients === 'string' ? JSON.parse(product.activeIngredients) : product.activeIngredients;
if (Array.isArray(ai?.seedBlend)) nextSeedBlend = ai.seedBlend;
if (ai?.seedRates) {
const unit = ai.seedRates.unit || product.customRateUnit || 'lbs/1000 sq ft';
const unit = ai.seedRates.unit || product.rateUnit || 'lbs/1000 sq ft';
const rates = [];
if (ai.seedRates.new) rates.push({ applicationType: 'New Lawn', rateAmount: ai.seedRates.new, rateUnit: unit, notes: '' });
if (ai.seedRates.overseed) rates.push({ applicationType: 'Overseeding', rateAmount: ai.seedRates.overseed, rateUnit: unit, notes: '' });
@@ -262,8 +262,8 @@ const AdminProducts = () => {
seedBlend: nextSeedBlend,
rates: nextRates.length > 0 ? nextRates : [{
applicationType: productType,
rateAmount: product.customRateAmount || '',
rateUnit: product.customRateUnit || 'lbs/1000 sq ft',
rateAmount: product.rateAmount || '',
rateUnit: product.rateUnit || 'lbs/1000 sq ft',
notes: ''
}]
});