fix(#77 frontend): separate מספר-תיק field on committee upload + editable case_number in edit sheet
Pairs with the backend PR. Stops the citation (מראה-מקום) from being stored as the identifier, and lets a wrong identifier be corrected after the fact. - upload sheet: new required 'מספר תיק (מזהה ייחודי)' field for committee decisions → sent as case_number; the citation field is now sent as the separate citation (→ citation_formatted) instead of as case_number. - edit sheet: the case_number block is now an editable input (was read-only). Halachot/chunks key off case_law_id (UUID), so renaming case_number is safe. - precedent-library.ts: InternalDecisionUploadInput += citation; PrecedentPatch += case_number. - types.ts: regenerated (api:types) — PrecedentUpdateRequest now carries case_number. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -50,6 +50,10 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
// require chair_name + district. Routing is by citation prefix.
|
||||
const [chairName, setChairName] = useState("");
|
||||
const [district, setDistrict] = useState<CommitteeDistrict | "">("");
|
||||
// Canonical identifier for committee decisions (e.g. "8027-25"), kept
|
||||
// distinct from the citation (מראה-מקום). Previously the citation was sent
|
||||
// as case_number, polluting the identifier.
|
||||
const [caseNumber, setCaseNumber] = useState("");
|
||||
const isCommittee = isCommitteeCitation(citation);
|
||||
|
||||
const [taskId, setTaskId] = useState<string | null>(null);
|
||||
@@ -72,7 +76,7 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setHeadnote(""); setIsBinding(true); setTaskId(null);
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setChairName(""); setDistrict("");
|
||||
setChairName(""); setDistrict(""); setCaseNumber("");
|
||||
}, [open]);
|
||||
|
||||
// Auto-close on completion + refresh library list/stats so the new
|
||||
@@ -110,6 +114,10 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
|
||||
try {
|
||||
if (isCommittee) {
|
||||
if (!caseNumber.trim()) {
|
||||
toast.error("מספר תיק (מזהה ייחודי) חובה להחלטת ועדת ערר");
|
||||
return;
|
||||
}
|
||||
if (!chairName.trim()) {
|
||||
toast.error("שם יו\"ר חובה להחלטת ועדת ערר");
|
||||
return;
|
||||
@@ -120,7 +128,8 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
}
|
||||
const res = await uploadInternal.mutateAsync({
|
||||
file,
|
||||
case_number: citation.trim(),
|
||||
case_number: caseNumber.trim(),
|
||||
citation: citation.trim(),
|
||||
chair_name: chairName.trim(),
|
||||
district,
|
||||
case_name: caseName.trim(),
|
||||
@@ -202,7 +211,20 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
</div>
|
||||
|
||||
{isCommittee && (
|
||||
<div className="grid grid-cols-2 gap-3 rounded-md border border-gold/40 bg-gold-wash/40 p-3">
|
||||
<div className="space-y-3 rounded-md border border-gold/40 bg-gold-wash/40 p-3">
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="committee-case-number">מספר תיק — מזהה ייחודי (חובה)</Label>
|
||||
<Input
|
||||
id="committee-case-number" value={caseNumber}
|
||||
onChange={(e) => setCaseNumber(e.target.value)}
|
||||
placeholder="8027-25"
|
||||
disabled={isProcessing} dir="rtl"
|
||||
/>
|
||||
<p className="text-[0.72rem] text-ink-muted">
|
||||
המזהה הנקי בלבד (למשל 8027-25) — לא המראה-מקום המלא.
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="space-y-1">
|
||||
<Label htmlFor="chair-name">שם יו"ר (חובה)</Label>
|
||||
<Input
|
||||
@@ -230,6 +252,7 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user