feat(plans): כפתור "משוך מ-מנהל-התכנון" בטופס-התכנית (Phase C טריגר 1)
טריגר 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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user