Files
triqura-ecd/app/epd/agenda/page.tsx
colinislit b7b5a0888b feat(agenda): Epic 4 - EPD Koppeling (appointment-report integration)
Implements bidirectional linking between appointments and reports:
- E4.S1: Create report from appointment modal with encounter pre-linked
- E4.S2: Link existing reports to appointments via EncounterSelector
- E4.S3: Show linked reports in appointment modal edit view
- E4.S4: Navigation between appointments and reports with deep linking

Also includes bug fixes for patient search:
- Fix FHIR to internal format mapping for patient data
- Fix debounced search interference after patient selection
- Fix UUID handling for optional practitioner_id

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-02 19:34:07 +01:00

46 lines
1.2 KiB
TypeScript

/**
* Behandelaar Agenda - Level 1
*
* Kalender view met alle afspraken van de behandelaar.
* Supports day, week, and workweek views.
*/
import { startOfWeek, endOfWeek, parseISO, isValid } from 'date-fns';
import { AgendaView } from './components/agenda-view';
import { getEncounters } from './actions';
interface AgendaPageProps {
searchParams: Promise<{ date?: string; encounterId?: string }>;
}
export default async function AgendaPage({ searchParams }: AgendaPageProps) {
const { date: dateParam, encounterId } = await searchParams;
// Parse date from URL or use current date
let targetDate = new Date();
if (dateParam) {
const parsedDate = parseISO(dateParam);
if (isValid(parsedDate)) {
targetDate = parsedDate;
}
}
// Get initial date range (week of target date)
const start = startOfWeek(targetDate, { weekStartsOn: 1 });
const end = endOfWeek(targetDate, { weekStartsOn: 1 });
// Fetch initial events
const initialEvents = await getEncounters({
startDate: start.toISOString(),
endDate: end.toISOString(),
});
return (
<AgendaView
initialEvents={initialEvents}
initialDate={targetDate}
highlightEncounterId={encounterId}
/>
);
}