From 174f1acd46c4ffbde88c04465e8fa6b6810ce113 Mon Sep 17 00:00:00 2001 From: Alberto Duarte Delgado Date: Mon, 30 Mar 2026 17:37:42 +0100 Subject: logica de reservas --- src/app/(protected)/reservations/create.tsx | 110 ++++++++++++++++++++++++++-- 1 file changed, 104 insertions(+), 6 deletions(-) (limited to 'src/app/(protected)/reservations') diff --git a/src/app/(protected)/reservations/create.tsx b/src/app/(protected)/reservations/create.tsx index c1c88b3..138f0ee 100644 --- a/src/app/(protected)/reservations/create.tsx +++ b/src/app/(protected)/reservations/create.tsx @@ -1,10 +1,72 @@ -import { StyleSheet, Text, View } from 'react-native'; +import { useLocalSearchParams } from 'expo-router'; +import { Pressable, StyleSheet, Text, TextInput, View } from 'react-native'; +import { useCreateReservation } from '@/features/reservations/hooks/useCreateReservation'; export default function CreateReservationScreen() { + const params = useLocalSearchParams<{ + officeId?: string; + officeName?: string; + }>(); + + const officeId = + typeof params.officeId === 'string' ? params.officeId : undefined; + const officeName = + typeof params.officeName === 'string' ? params.officeName : undefined; + + const { + date, + startTime, + endTime, + isSubmitting, + error, + successMessage, + setDate, + setStartTime, + setEndTime, + submit, + } = useCreateReservation({ officeId, officeName }); + return ( Crear reserva - Pantalla en construcción. + + + Espacio + {officeName ?? 'No indicado'} + + ID oficina + {officeId ?? 'No indicado'} + + + + + + + + + {error ? {error} : null} + {successMessage ? {successMessage} : null} + + + + {isSubmitting ? 'Guardando...' : 'Guardar reserva'} + + ); } @@ -13,16 +75,52 @@ const styles = StyleSheet.create({ container: { flex: 1, padding: 16, - justifyContent: 'center', - alignItems: 'center', gap: 12, }, title: { fontSize: 28, fontWeight: '700', + marginBottom: 8, + }, + infoBox: { + borderWidth: 1, + borderColor: '#ddd', + borderRadius: 12, + padding: 12, + gap: 6, + marginBottom: 8, }, - text: { + label: { + fontSize: 14, + fontWeight: '700', + color: '#444', + }, + value: { fontSize: 16, - color: '#555', + color: '#111', + }, + input: { + borderWidth: 1, + borderColor: '#ccc', + borderRadius: 10, + paddingHorizontal: 14, + paddingVertical: 12, + }, + button: { + backgroundColor: '#1f6feb', + paddingVertical: 14, + borderRadius: 10, + alignItems: 'center', + marginTop: 8, + }, + buttonText: { + color: '#fff', + fontWeight: '600', + }, + error: { + color: 'red', + }, + success: { + color: 'green', }, }); -- cgit v1.2.3-54-g00ecf