Liste mit dazu

This commit is contained in:
rxf
2025-12-17 16:59:59 +01:00
parent fa53c5daed
commit 44a93ac1e7
2 changed files with 142 additions and 21 deletions

View File

@@ -26,6 +26,20 @@ function App() {
const [isModalOpen, setIsModalOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false);
const [appointmentToDeleteId, setAppointmentToDeleteId] = useState(null); const [appointmentToDeleteId, setAppointmentToDeleteId] = useState(null);
// Helfer: Start des heutigen Tages für Filter "aktuelle Termine"
const startOfToday = new Date();
startOfToday.setHours(0, 0, 0, 0);
// Gefilterte Liste: nur nicht erledigte Termine ab heute
const currentAppointments = appointments
.filter(a => !a.erledigt && a.termin >= startOfToday)
.sort((a, b) => a.termin - b.termin);
// Drucken triggern
const handlePrintCurrent = () => {
window.print();
};
// NEU: Lädt Termine vom Backend beim Start // NEU: Lädt Termine vom Backend beim Start
useEffect(() => { useEffect(() => {
fetchAppointments(); fetchAppointments();
@@ -188,20 +202,30 @@ function App() {
return ( return (
<div className="app-container"> <div className="app-container">
{/* ... (Header und Formular-Einbindung) ... */} <div className="screen-only">
{/* Druck-Button für aktuelle Termine */}
<div className="print-controls">
<button className="print-button" onClick={handlePrintCurrent}>
Aktuelle Termine drucken
</button>
</div>
{/* Formular */}
<AppointmentForm <AppointmentForm
onAddAppointment={addAppointment} onAddAppointment={addAppointment}
editingAppointment={editingAppointment} editingAppointment={editingAppointment}
onUpdateAppointment={updateAppointment} onUpdateAppointment={updateAppointment}
onCancelEdit={() => setEditingAppointment(null)} onCancelEdit={() => setEditingAppointment(null)}
/> />
{/* ... */}
{/* Gesamte Liste */}
<AppointmentList <AppointmentList
appointments={appointments} appointments={appointments}
onToggleDone={toggleDone} onToggleDone={toggleDone}
onEdit={(app) => setEditingAppointment(app)} onEdit={(app) => setEditingAppointment(app)}
onDelete={openDeleteModal} onDelete={openDeleteModal}
/> />
{/* NEU: MODAL KOMPONENTE */} {/* NEU: MODAL KOMPONENTE */}
<ConfirmationModal <ConfirmationModal
isOpen={isModalOpen} isOpen={isModalOpen}
@@ -210,7 +234,36 @@ function App() {
onConfirm={handleConfirmDelete} onConfirm={handleConfirmDelete}
onCancel={handleCancelDelete} onCancel={handleCancelDelete}
/> />
{/* Debug Output kann nun entfernt werden */} </div>
{/* Druckansicht: nur aktuelle (offene) Termine ab heute */}
<div className="print-only">
<h1>Aktuelle Arzt-Termine</h1>
{currentAppointments.length === 0 ? (
<p>Keine aktuellen Termine vorhanden.</p>
) : (
<table className="print-table">
<thead>
<tr>
<th>Arzt</th>
<th>Fachrichtung</th>
<th>Datum</th>
<th>Bemerkungen</th>
</tr>
</thead>
<tbody>
{currentAppointments.map(app => (
<tr key={app.id}>
<td>{app.arztName}</td>
<td>{app.arztArt || ''}</td>
<td>{app.termin.toLocaleString('de-DE')}</td>
<td>{app.bemerkungen || ''}</td>
</tr>
))}
</tbody>
</table>
)}
</div>
</div> </div>
); );
} }

View File

@@ -208,3 +208,71 @@ body {
.cancel-button:hover { .cancel-button:hover {
background-color: #c82333; background-color: #c82333;
} }
/* Druck-Funktionalität */
.print-controls {
display: flex;
justify-content: flex-end;
margin-bottom: 20px;
}
.print-button {
background-color: #007bff;
color: white;
padding: 10px 16px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
}
.print-button:hover {
background-color: #0069d9;
}
/* Standard: Druckbereich ausblenden, Bildschirm-Inhalte anzeigen */
.print-only {
display: none;
}
@media print {
/* Bildschirm-UI ausblenden */
.screen-only, .screen-only * {
display: none !important;
}
/* Nur Druckbereich anzeigen */
.print-only {
display: block !important;
}
body {
background: #ffffff;
margin: 10mm;
color: #000;
}
.print-only h1 {
margin-top: 0;
font-size: 20px;
}
.print-table {
width: 100%;
border-collapse: collapse;
font-size: 12px;
}
.print-table th,
.print-table td {
border: 1px solid #000;
padding: 6px;
text-align: left;
}
.print-table thead th {
background: #eee;
-webkit-print-color-adjust: exact;
print-color-adjust: exact;
}
}