From bdcecb301030f2d3b4f5d132d9902c50ad63e1bf Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Tue, 21 Apr 2026 12:29:08 +0100 Subject: feat(offices): restaurar disponibilidad en detalle fixes #15 --- src/app/(protected)/offices/[officeId].tsx | 139 ++++++++++++++++++++++++++++- 1 file changed, 138 insertions(+), 1 deletion(-) (limited to 'src/app/(protected)/offices') diff --git a/src/app/(protected)/offices/[officeId].tsx b/src/app/(protected)/offices/[officeId].tsx index caedb05..91e6905 100644 --- a/src/app/(protected)/offices/[officeId].tsx +++ b/src/app/(protected)/offices/[officeId].tsx @@ -5,14 +5,16 @@ import { ScrollView, StyleSheet, Text, + TextInput, View, } from 'react-native'; import { useOffice } from '@/features/offices/hooks/useOffice'; import { useFavoriteOffices } from '@/features/offices/hooks/useFavoriteOffices'; +import { useOfficeAvailability } from '@/features/reservations/hooks/useOfficeAvailability'; import theme from '@/theme'; -import { Feather, MaterialIcons } from '@expo/vector-icons'; +import { MaterialIcons } from '@expo/vector-icons'; export default function OfficeDetailScreen() { const params = useLocalSearchParams<{ officeId: string }>(); @@ -25,6 +27,14 @@ export default function OfficeDetailScreen() { pendingOfficeId, toggleFavorite, } = useFavoriteOffices(); + const { + selectedDate, + reservations, + loading: availabilityLoading, + error: availabilityError, + setSelectedDate, + reload: reloadAvailability, + } = useOfficeAvailability(officeId); if (loading) { return ( @@ -124,6 +134,63 @@ export default function OfficeDetailScreen() { )} + {/* AVAILABILITY */} + + Disponibilidad + + Consulta los bloques ocupados para elegir un horario libre. + + + + Fecha + + + + {availabilityLoading ? ( + + + Cargando disponibilidad... + + ) : null} + + {availabilityError ? ( + + {availabilityError} + + Reintentar + + + ) : null} + + {!availabilityLoading && !availabilityError ? ( + reservations.length > 0 ? ( + + {reservations.map((reservation) => ( + + + {reservation.startTime} - {reservation.endTime} + + + Ocupado + + + ))} + + ) : ( + + No hay bloques ocupados para esta fecha. + + ) + ) : null} + + {/* FAVORITE */}