feat(plans): כפתור "משוך מ-מנהל-התכנון" בטופס-התכנית (Phase C טריגר 1)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 11s

טריגר 1 הידני: בטופס PlanForm, כפתור "משוך מ-מנהל-התכנון" — היו"ר
מקליד מספר-תכנית, לוחץ, והשדות (שם/תאריך-רשומות/י"פ/סוג/ייעוד)
מתמלאים מ-mavat דרך POST /api/plans/fetch (#292). היו"ר בודק ושומר —
שער-היו"ר נשמר (שום שמירה אוטומטית).

- plans.ts: useFetchPlan + PlanFetchResult.
- PlanForm: כפתור עם spinner (~דקה, דפדפן חי), מילוי-שדות (מחליף
  בערך-mavat היכן שקיים, שומר ערך-יו"ר היכן ש-mavat ריק), קישור-מקור
  "מקור: מנהל-התכנון" בתצוגה-המקדימה (פרובננס INV-AH).

עבר שער-עיצוב (מוקאפ 22-plans-review מאושר). ההוק ידני (לא תלוי
types שנוצרים). tsc  lint  (0 errors).

INV-AH: source_url מוצג; שדה-חסר ריק לא מומצא. G10: מילוי-טופס בלבד,
שמירה דרך plan_upsert הקיים. G2: צורך את /api/plans/fetch (#292).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-17 11:32:32 +00:00
parent 4994ae0cba
commit 2b1fb18dfd
2 changed files with 91 additions and 1 deletions

View File

@@ -81,6 +81,32 @@ export function usePlanDuplicates(planId: string, enabled = true) {
});
}
/** The candidate mavat returns for the form (INV-AH: every value carries source_url). */
export type PlanFetchResult = {
plan_number: string;
display_name: string;
plan_type: string;
purpose: string;
gazette_date: string; // ISO YYYY-MM-DD, "" if mavat doesn't expose it
yalkut_number: string;
yalkut_page: string;
source_url: string; // the mavat plan page
};
/**
* Pull a plan's identity + validity from mavat (מנהל התכנון) to prefill the form.
* Slow — drives a real browser on the host bridge (~½1 min); surface a spinner.
*/
export function useFetchPlan() {
return useMutation({
mutationFn: (planNumber: string) =>
apiRequest<PlanFetchResult>(`/api/plans/fetch`, {
method: "POST",
body: { plan_number: planNumber },
}),
});
}
export type PlanUpsert = {
plan_number: string;
display_name?: string;