+ {/* Success/Error Messages */}
+ {(successMsg || errorMsg) && (
+
+ {errorMsg && (
+
+
+
+
Fehler:
+
{errorMsg}
+
+
+ )}
+ {successMsg && (
+
+
+
+
Erfolg:
+
{successMsg}
+
+
+ )}
+
+ )}
+
{/* Quick Stats */}
@@ -193,7 +261,7 @@ export function AdminBookings() {
Confirm
)}
+
+ {/* Cancel Confirmation Modal */}
+ {showCancelConfirm && (
+
+
+
Buchung stornieren
+
+ Bist du sicher, dass du diese Buchung stornieren möchtest? Diese Aktion kann nicht rückgängig gemacht werden.
+
+
+
+
+
+
+
+ )}
);
}
\ No newline at end of file
diff --git a/src/server/rpc/availability.ts b/src/server/rpc/availability.ts
index be23bae..d695f27 100644
--- a/src/server/rpc/availability.ts
+++ b/src/server/rpc/availability.ts
@@ -87,32 +87,41 @@ const remove = os
const list = os.handler(async () => {
const allSlots = await kv.getAllItems();
- // Filter out past slots automatically
+ // Auto-delete past slots
const today = new Date().toISOString().split("T")[0]; // YYYY-MM-DD
const now = new Date();
const currentTime = `${String(now.getHours()).padStart(2, "0")}:${String(now.getMinutes()).padStart(2, "0")}`;
- const filteredSlots = allSlots.filter(slot => {
- // Keep slots for future dates
- if (slot.date > today) return true;
+ let deletedCount = 0;
+ const slotsToDelete: string[] = [];
+
+ // Identify past slots for deletion
+ allSlots.forEach(slot => {
+ const isPastDate = slot.date < today;
+ const isPastTime = slot.date === today && slot.time <= currentTime;
- // For today: only keep future time slots
- if (slot.date === today) {
- return slot.time > currentTime;
+ if (isPastDate || isPastTime) {
+ slotsToDelete.push(slot.id);
}
-
- // Remove past slots
- return false;
});
- // Debug logging (commented out - uncomment if needed)
- // const statusCounts = filteredSlots.reduce((acc, slot) => {
- // acc[slot.status] = (acc[slot.status] || 0) + 1;
- // return acc;
- // }, {} as Record