Compare commits
5 Commits
mai/knuth/
...
260f65ea02
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
260f65ea02 | ||
|
|
501b573967 | ||
|
|
23b8ef4bba | ||
|
|
54c6eb8dae | ||
|
|
967f2f6d09 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -46,3 +46,9 @@ tmp/
|
|||||||
# TypeScript
|
# TypeScript
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
.worktrees/
|
.worktrees/
|
||||||
|
backend/server
|
||||||
|
backend/.m/
|
||||||
|
.m/inbox_lastread
|
||||||
|
backend/server
|
||||||
|
backend/.m/
|
||||||
|
.m/inbox_lastread
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ type ProceedingType struct {
|
|||||||
Name string `db:"name" json:"name"`
|
Name string `db:"name" json:"name"`
|
||||||
Description *string `db:"description" json:"description,omitempty"`
|
Description *string `db:"description" json:"description,omitempty"`
|
||||||
Jurisdiction *string `db:"jurisdiction" json:"jurisdiction,omitempty"`
|
Jurisdiction *string `db:"jurisdiction" json:"jurisdiction,omitempty"`
|
||||||
|
Category *string `db:"category" json:"category,omitempty"`
|
||||||
DefaultColor string `db:"default_color" json:"default_color"`
|
DefaultColor string `db:"default_color" json:"default_color"`
|
||||||
SortOrder int `db:"sort_order" json:"sort_order"`
|
SortOrder int `db:"sort_order" json:"sort_order"`
|
||||||
IsActive bool `db:"is_active" json:"is_active"`
|
IsActive bool `db:"is_active" json:"is_active"`
|
||||||
|
|||||||
@@ -51,13 +51,28 @@ export function DeadlineCalculator() {
|
|||||||
}) => api.post<CalculateResponse>("/deadlines/calculate", params),
|
}) => api.post<CalculateResponse>("/deadlines/calculate", params),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Auto-calculate when proceeding type changes (using current trigger date)
|
||||||
|
function doCalculate(type: string, date: string) {
|
||||||
|
if (!type || !date) return;
|
||||||
|
calculateMutation.mutate({
|
||||||
|
proceeding_type: type,
|
||||||
|
trigger_event_date: date,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleProceedingChange(newType: string) {
|
||||||
|
setProceedingType(newType);
|
||||||
|
doCalculate(newType, triggerDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDateChange(newDate: string) {
|
||||||
|
setTriggerDate(newDate);
|
||||||
|
if (proceedingType) doCalculate(proceedingType, newDate);
|
||||||
|
}
|
||||||
|
|
||||||
function handleCalculate(e: React.FormEvent) {
|
function handleCalculate(e: React.FormEvent) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (!proceedingType || !triggerDate) return;
|
doCalculate(proceedingType, triggerDate);
|
||||||
calculateMutation.mutate({
|
|
||||||
proceeding_type: proceedingType,
|
|
||||||
trigger_event_date: triggerDate,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const results = calculateMutation.data;
|
const results = calculateMutation.data;
|
||||||
@@ -80,27 +95,43 @@ export function DeadlineCalculator() {
|
|||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={proceedingType}
|
value={proceedingType}
|
||||||
onChange={(e) => setProceedingType(e.target.value)}
|
onChange={(e) => handleProceedingChange(e.target.value)}
|
||||||
disabled={typesLoading}
|
disabled={typesLoading}
|
||||||
className={inputClass}
|
className={inputClass}
|
||||||
>
|
>
|
||||||
<option value="">Bitte wählen...</option>
|
<option value="">Bitte wählen...</option>
|
||||||
{(() => {
|
{(() => {
|
||||||
const grouped = new Map<string, ProceedingType[]>();
|
const types = proceedingTypes ?? [];
|
||||||
for (const pt of proceedingTypes ?? []) {
|
const categoryLabels: Record<string, string> = {
|
||||||
const key = pt.jurisdiction ?? "Sonstige";
|
hauptverfahren: "Hauptverfahren",
|
||||||
if (!grouped.has(key)) grouped.set(key, []);
|
im_verfahren: "Verfahren im Verfahren",
|
||||||
grouped.get(key)!.push(pt);
|
rechtsbehelf: "Rechtsbehelfe",
|
||||||
}
|
};
|
||||||
const labels: Record<string, string> = {
|
const jurisdictionLabels: Record<string, string> = {
|
||||||
UPC: "UPC-Verfahren",
|
UPC: "UPC",
|
||||||
DE: "Deutsche Patentverfahren",
|
DE: "Deutsche Patentverfahren",
|
||||||
};
|
};
|
||||||
return Array.from(grouped.entries()).map(([jurisdiction, types]) => (
|
// Group by jurisdiction + category
|
||||||
<optgroup key={jurisdiction} label={labels[jurisdiction] ?? jurisdiction}>
|
const groups: { key: string; label: string; items: typeof types }[] = [];
|
||||||
{types.map((pt) => (
|
const seen = new Set<string>();
|
||||||
|
for (const pt of types) {
|
||||||
|
const j = pt.jurisdiction ?? "Sonstige";
|
||||||
|
const c = pt.category ?? "hauptverfahren";
|
||||||
|
const key = `${j}::${c}`;
|
||||||
|
if (!seen.has(key)) {
|
||||||
|
seen.add(key);
|
||||||
|
const jLabel = jurisdictionLabels[j] ?? j;
|
||||||
|
const cLabel = categoryLabels[c] ?? c;
|
||||||
|
const label = j === "DE" ? jLabel : `${jLabel} — ${cLabel}`;
|
||||||
|
groups.push({ key, label, items: [] });
|
||||||
|
}
|
||||||
|
groups.find((g) => g.key === key)!.items.push(pt);
|
||||||
|
}
|
||||||
|
return groups.map((g) => (
|
||||||
|
<optgroup key={g.key} label={g.label}>
|
||||||
|
{g.items.map((pt) => (
|
||||||
<option key={pt.id} value={pt.code}>
|
<option key={pt.id} value={pt.code}>
|
||||||
{pt.name} ({pt.code})
|
{pt.name}
|
||||||
</option>
|
</option>
|
||||||
))}
|
))}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
@@ -115,7 +146,7 @@ export function DeadlineCalculator() {
|
|||||||
<input
|
<input
|
||||||
type="date"
|
type="date"
|
||||||
value={triggerDate}
|
value={triggerDate}
|
||||||
onChange={(e) => setTriggerDate(e.target.value)}
|
onChange={(e) => handleDateChange(e.target.value)}
|
||||||
className={inputClass}
|
className={inputClass}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -197,6 +197,7 @@ export interface ProceedingType {
|
|||||||
name: string;
|
name: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
jurisdiction?: string;
|
jurisdiction?: string;
|
||||||
|
category?: string;
|
||||||
default_color: string;
|
default_color: string;
|
||||||
sort_order: number;
|
sort_order: number;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user