seeding app
This commit is contained in:
@@ -95,11 +95,12 @@ const ApplicationPlanModal = ({
|
||||
setPlannedDate(editingPlan.plannedDate || new Date().toISOString().split('T')[0]);
|
||||
setNotes(editingPlan.notes || '');
|
||||
|
||||
// Determine application type
|
||||
// Determine application type (prefer plan fields)
|
||||
const ptypes = (editingPlan.products || []).map(p => (p.productType || '').toLowerCase());
|
||||
const derivedType = ptypes.includes('liquid') ? 'liquid' : (ptypes.includes('seed') ? 'seed' : 'granular');
|
||||
setApplicationType(derivedType);
|
||||
if (derivedType === 'seed') setSeedMode('overseed');
|
||||
const inferred = ptypes.includes('liquid') ? 'liquid' : (ptypes.includes('seed') ? 'seed' : 'granular');
|
||||
const t = (editingPlan.applicationType || inferred || 'granular').toLowerCase();
|
||||
setApplicationType(t);
|
||||
if (t === 'seed') setSeedMode(editingPlan.seedingMode || 'overseed');
|
||||
|
||||
// Map products into modal structure
|
||||
const mapped = (editingPlan.products || []).map(p => ({
|
||||
@@ -531,6 +532,7 @@ const ApplicationPlanModal = ({
|
||||
equipmentId: selectedEquipmentId,
|
||||
nozzleId: selectedNozzleId || null,
|
||||
applicationType,
|
||||
seedingMode: applicationType === 'seed' ? seedMode : null,
|
||||
plannedDate,
|
||||
notes: applicationType === 'seed' ? `${notes || ''} [Seeding: ${seedMode.replace('_',' ')}]`.trim() : notes
|
||||
};
|
||||
@@ -793,8 +795,8 @@ const ApplicationPlanModal = ({
|
||||
|
||||
let rateSet = false;
|
||||
|
||||
// For shared products: check rates array
|
||||
if (selectedProduct.isShared && selectedProduct.rates && selectedProduct.rates.length > 0) {
|
||||
// If rates exist (shared or custom with base rates), use them
|
||||
if (selectedProduct.rates && selectedProduct.rates.length > 0) {
|
||||
let chosen = selectedProduct.rates[0];
|
||||
if (applicationType === 'seed') {
|
||||
const picked = pickSeedRate(selectedProduct.rates, seedMode);
|
||||
|
||||
@@ -842,6 +842,8 @@ const Applications = () => {
|
||||
...(planData.applicationType === 'liquid' && planData.nozzleId && { nozzleId: parseInt(planData.nozzleId) }),
|
||||
plannedDate: planData.plannedDate || new Date().toISOString().split('T')[0],
|
||||
notes: planData.notes || '',
|
||||
applicationType: planData.applicationType,
|
||||
seedingMode: planData.seedingMode || null,
|
||||
areaSquareFeet: totalAreaSquareFeet,
|
||||
equipment: {
|
||||
id: selectedEquipment?.id,
|
||||
@@ -899,6 +901,8 @@ const Applications = () => {
|
||||
...(planData.applicationType === 'liquid' && planData.nozzleId && { nozzleId: parseInt(planData.nozzleId) }),
|
||||
plannedDate: new Date().toISOString().split('T')[0],
|
||||
notes: planData.notes || '',
|
||||
applicationType: planData.applicationType,
|
||||
seedingMode: planData.seedingMode || null,
|
||||
areaSquareFeet: totalAreaSquareFeet,
|
||||
equipment: {
|
||||
id: selectedEquipment?.id,
|
||||
|
||||
Reference in New Issue
Block a user