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>
This commit is contained in:
@@ -5,15 +5,29 @@
|
||||
* Supports day, week, and workweek views.
|
||||
*/
|
||||
|
||||
import { startOfWeek, endOfWeek } from 'date-fns';
|
||||
import { startOfWeek, endOfWeek, parseISO, isValid } from 'date-fns';
|
||||
import { AgendaView } from './components/agenda-view';
|
||||
import { getEncounters } from './actions';
|
||||
|
||||
export default async function AgendaPage() {
|
||||
// Get initial date range (current week)
|
||||
const now = new Date();
|
||||
const start = startOfWeek(now, { weekStartsOn: 1 });
|
||||
const end = endOfWeek(now, { weekStartsOn: 1 });
|
||||
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({
|
||||
@@ -24,7 +38,8 @@ export default async function AgendaPage() {
|
||||
return (
|
||||
<AgendaView
|
||||
initialEvents={initialEvents}
|
||||
initialDate={now}
|
||||
initialDate={targetDate}
|
||||
highlightEncounterId={encounterId}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user