diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f2538d6..28b394f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,8 +4,10 @@
-
-
+
+
+
+
@@ -127,7 +129,7 @@
1774643312599
-
+
@@ -305,7 +307,15 @@
1774717642991
-
+
+
+ 1774717937214
+
+
+
+ 1774717937214
+
+
@@ -336,6 +346,7 @@
-
+
+
\ No newline at end of file
diff --git a/apps/web/src/lib/i18n/locales/en.json b/apps/web/src/lib/i18n/locales/en.json
index 9b500f5..20dd97c 100644
--- a/apps/web/src/lib/i18n/locales/en.json
+++ b/apps/web/src/lib/i18n/locales/en.json
@@ -99,7 +99,11 @@
"deskNote": "Note: Desk bookings are full-day. Times will be automatically adjusted to encompass the entire day.",
"saving": "Saving...",
"editBookingTitle": "Edit Booking",
- "saveChanges": "Save Changes"
+ "saveChanges": "Save Changes",
+ "upcoming": "Upcoming Bookings",
+ "past": "Past Bookings",
+ "showPast": "Show past bookings",
+ "hidePast": "Hide past bookings"
},
"reports": {
"title": "Admin Reporting Dashboard",
diff --git a/apps/web/src/lib/i18n/locales/es-ES.json b/apps/web/src/lib/i18n/locales/es-ES.json
index ae16fb2..cc08f65 100644
--- a/apps/web/src/lib/i18n/locales/es-ES.json
+++ b/apps/web/src/lib/i18n/locales/es-ES.json
@@ -99,7 +99,11 @@
"deskNote": "Nota: Las reservas de puestos son para todo el día. Las horas se ajustarán automáticamente para abarcar el día completo.",
"saving": "Guardando...",
"editBookingTitle": "Editar reserva",
- "saveChanges": "Guardar cambios"
+ "saveChanges": "Guardar cambios",
+ "upcoming": "Próximas reservas",
+ "past": "Reservas pasadas",
+ "showPast": "Mostrar reservas pasadas",
+ "hidePast": "Ocultar reservas pasadas"
},
"reports": {
"title": "Panel de Control de Informes",
diff --git a/apps/web/src/routes/dashboard/my-bookings/+page.svelte b/apps/web/src/routes/dashboard/my-bookings/+page.svelte
index 3ffcfb3..11e0997 100644
--- a/apps/web/src/routes/dashboard/my-bookings/+page.svelte
+++ b/apps/web/src/routes/dashboard/my-bookings/+page.svelte
@@ -2,8 +2,8 @@
import { onMount } from "svelte";
import { token } from "$lib/stores/auth";
import { apiFetch } from "$lib/api/client";
- import { Calendar, Clock, MapPin, Trash2, Edit2, ChevronRight, X } from "lucide-svelte";
- import { format } from "date-fns";
+ import { Calendar, Clock, MapPin, Trash2, Edit2, ChevronRight, X, ChevronDown, ChevronUp } from "lucide-svelte";
+ import { format, isPast } from "date-fns";
import { es, enUS } from 'date-fns/locale';
import { t, locale } from "svelte-i18n";
@@ -17,10 +17,14 @@
let editEndTimeDate = "";
let editEndTimeTime = "";
let saving = false;
+ let showPast = false;
$: dateLocale = $locale === 'es-ES' ? es : enUS;
$: dateFormat = $locale === 'es-ES' ? 'dd/MM/yyyy' : 'PPP';
+ $: upcomingReservations = reservations.filter(r => !isPast(new Date(r.endTime)));
+ $: pastReservations = reservations.filter(r => isPast(new Date(r.endTime)));
+
onMount(async () => {
await fetchReservations();
});
@@ -117,56 +121,122 @@
{:else}
-
- {#each reservations as res}
-
-
-
-
- {#if res.space.type === 'DESK'}
-
- {:else}
-
- {/if}
-
-
-
{res.space.name}
-
-
-
- {res.space.floor.building.name}, {$t('myBookings.floor', { values: { number: res.space.floor.number } })}
-
-
-
- {format(new Date(res.startTime), dateFormat, { locale: dateLocale })}
-
-
-
- {format(new Date(res.startTime), "HH:mm")} - {format(new Date(res.endTime), "HH:mm")}
-
+
+ {#if upcomingReservations.length > 0}
+
+ {$t('myBookings.upcoming')}
+
+ {#each upcomingReservations as res}
+
+
+
+
+ {#if res.space.type === 'DESK'}
+
+ {:else}
+
+ {/if}
+
+
+
{res.space.name}
+
+
+
+ {res.space.floor.building.name}, {$t('myBookings.floor', { values: { number: res.space.floor.number } })}
+
+
+
+ {format(new Date(res.startTime), dateFormat, { locale: dateLocale })}
+
+
+
+ {format(new Date(res.startTime), "HH:mm")} - {format(new Date(res.endTime), "HH:mm")}
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+ {/each}
-
- {/each}
+
+ {/if}
+
+ {#if pastReservations.length > 0}
+
+
+
+ {#if showPast}
+
+ {#each pastReservations as res}
+
+
+
+
+ {#if res.space.type === 'DESK'}
+
+ {:else}
+
+ {/if}
+
+
+
{res.space.name}
+
+
+
+ {res.space.floor.building.name}, {$t('myBookings.floor', { values: { number: res.space.floor.number } })}
+
+
+
+ {format(new Date(res.startTime), dateFormat, { locale: dateLocale })}
+
+
+
+ {format(new Date(res.startTime), "HH:mm")} - {format(new Date(res.endTime), "HH:mm")}
+
+
+
+
+
+
+ {/each}
+
+ {/if}
+
+ {/if}
{/if}