feat(case-ui): חלוקת רשימת-המסמכים בטאב-הסקירה ל-4 קבוצות
חלוקה פנימית (לנוחות בלבד, לא משנה doc_type) של רשימת מסמכי-התיק:
1. עיקריים (appeal/response/appraisal) · 2. נלווים · 3. פרוטוקול ועדת הערר ·
4. לאחר הדיון. הסיווג נגזר בצד-הלקוח מ-doc_type + שני דגלי-metadata.
שני פקדים חדשים בעורך-התיוג:
- מתג "התקבל אחרי הדיון" → metadata.is_post_hearing (כבר נצרך ע"י בלוק-ח);
גובר על הסיווג-לפי-סוג ומעביר לקבוצה 4.
- בורר "פרוטוקול של: ועדת הערר / ועדה מקומית-מחוזית" → metadata.protocol_scope
(נראה רק כשהסוג protocol); ברירת-מחדל appeal→קבוצה 3, lower→קבוצה 2.
Backend: PATCH /documents/{id} + MCP document_update מקבלים is_post_hearing
ו-protocol_scope, נשמרים ב-metadata JSONB (אותו מסלול כמו appraiser_side).
עיצוב אושר ב-Claude Design (X17): 18k-case-documents-grouped.html.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,8 @@ export function useUploadDocument(caseNumber: string) {
|
||||
export type DocumentPatch = {
|
||||
doc_type?: string;
|
||||
appraiser_side?: string; // "" clears; "committee" | "appellant" | "deciding" sets
|
||||
is_post_hearing?: boolean; // true = received after the hearing (→ group 4); false clears
|
||||
protocol_scope?: string; // "" clears; "appeal" | "lower" (protocol docs only)
|
||||
};
|
||||
|
||||
export type PatchDocumentResponse = {
|
||||
|
||||
@@ -64,6 +64,79 @@ export function doctypeTone(value: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
// ── Overview groups (display-only convenience buckets) ─────────────
|
||||
//
|
||||
// The case-overview document list is split into four sections purely for
|
||||
// the chair's convenience — grouping NEVER changes a document's stored
|
||||
// doc_type. Classification is derived on the client from doc_type plus two
|
||||
// metadata flags (is_post_hearing, protocol_scope).
|
||||
|
||||
export type DocGroup = "primary" | "ancillary" | "hearing_protocol" | "post_hearing";
|
||||
|
||||
export const DOC_GROUP_LABELS: Record<DocGroup, string> = {
|
||||
primary: "מסמכים עיקריים",
|
||||
ancillary: "מסמכים נלווים",
|
||||
hearing_protocol: "פרוטוקול דיון ועדת הערר",
|
||||
post_hearing: "מסמכים לאחר הדיון",
|
||||
};
|
||||
|
||||
export const DOC_GROUP_HINTS: Record<DocGroup, string> = {
|
||||
primary: "כתבי ערר, תשובות ושומות שהוגשו לפני הדיון",
|
||||
ancillary: "פרוטוקולי/החלטות ועדה מקומית-מחוזית, תכניות, וכל השאר",
|
||||
hearing_protocol: "הדיון בפני הוועדה",
|
||||
post_hearing: "השלמות ותגובות שהתקבלו לאחר הדיון",
|
||||
};
|
||||
|
||||
/** Fixed render order of the groups in the overview panel. */
|
||||
export const DOC_GROUP_ORDER: DocGroup[] = [
|
||||
"primary",
|
||||
"ancillary",
|
||||
"hearing_protocol",
|
||||
"post_hearing",
|
||||
];
|
||||
|
||||
/** doc_types that count as "primary" pre-hearing filings (group 1). */
|
||||
const PRIMARY_DOC_TYPES = new Set<DocType>(["appeal", "response", "appraisal"]);
|
||||
|
||||
/**
|
||||
* Classify a document into one of the four overview groups.
|
||||
*
|
||||
* Priority order matters:
|
||||
* 1. is_post_hearing wins over everything — a post-hearing כתב תשובה
|
||||
* belongs in group 4, not group 1.
|
||||
* 2. A protocol goes to group 3 (ועדת הערר) by default, or group 2 when
|
||||
* explicitly tagged as a lower-committee protocol (protocol_scope==="lower").
|
||||
* 3. appeal/response/appraisal → group 1; everything else → group 2.
|
||||
*/
|
||||
export function documentGroup(
|
||||
docType: string,
|
||||
metadata?: Record<string, unknown> | null,
|
||||
): DocGroup {
|
||||
if (metadata?.is_post_hearing === true) return "post_hearing";
|
||||
if (docType === "protocol") {
|
||||
return metadata?.protocol_scope === "lower" ? "ancillary" : "hearing_protocol";
|
||||
}
|
||||
if (PRIMARY_DOC_TYPES.has(docType as DocType)) return "primary";
|
||||
return "ancillary";
|
||||
}
|
||||
|
||||
// ── Protocol scope (only relevant when doc_type === "protocol") ────
|
||||
// Distinguishes the appeal-committee hearing protocol (group 3) from a
|
||||
// lower (local/district) committee protocol (group 2). Stored in
|
||||
// documents.metadata.protocol_scope; absent === "appeal" (the default).
|
||||
|
||||
export type ProtocolScope = "appeal" | "lower";
|
||||
|
||||
export const PROTOCOL_SCOPE_LABELS: Record<ProtocolScope, string> = {
|
||||
appeal: "ועדת הערר",
|
||||
lower: "ועדה מקומית/מחוזית",
|
||||
};
|
||||
|
||||
export const PROTOCOL_SCOPE_OPTIONS: { value: ProtocolScope; label: string }[] = [
|
||||
{ value: "appeal", label: PROTOCOL_SCOPE_LABELS.appeal },
|
||||
{ value: "lower", label: PROTOCOL_SCOPE_LABELS.lower },
|
||||
];
|
||||
|
||||
// ── Appraiser sides (only relevant when doc_type === "appraisal") ──
|
||||
|
||||
export type AppraiserSide = "committee" | "appellant" | "deciding";
|
||||
|
||||
Reference in New Issue
Block a user