This commit is contained in:
2026-05-02 16:31:23 +03:30
parent f8d1f84ed6
commit baf3f01dbc
9 changed files with 1386 additions and 1626 deletions
@@ -20,23 +20,50 @@ const YieldHarvestPage = () => {
const selectionSummary = useMemo(() => {
const from = searchParams.get("from");
const planType = searchParams.get("planType");
const planId = searchParams.get("planId");
const planName = searchParams.get("planName");
const relatedType = searchParams.get("relatedType");
const relatedPlanId = searchParams.get("relatedPlanId");
const relatedPlanName = searchParams.get("relatedPlanName");
if (!from || !planType || !planName || !relatedType || !relatedPlanName) {
if (!from || !planType || !planId || !planName || !relatedType || !relatedPlanId || !relatedPlanName) {
return null;
}
return {
from,
planType,
planId,
planName,
relatedType,
relatedPlanId,
relatedPlanName,
};
}, [searchParams]);
const planContext = useMemo(() => {
if (!selectionSummary) return undefined;
const context: {
irrigationPlanId?: string;
fertilizationPlanId?: string;
} = {};
if (selectionSummary.planType === "irrigation") {
context.irrigationPlanId = selectionSummary.planId;
} else {
context.fertilizationPlanId = selectionSummary.planId;
}
if (selectionSummary.relatedType === "irrigation") {
context.irrigationPlanId = selectionSummary.relatedPlanId;
} else {
context.fertilizationPlanId = selectionSummary.relatedPlanId;
}
return context;
}, [selectionSummary]);
const handleBack = () => {
const from = selectionSummary?.from;
@@ -97,7 +124,7 @@ const YieldHarvestPage = () => {
</Card>
) : null}
<PlantProductionPage />
<PlantProductionPage planContext={planContext} />
</Stack>
);
};