import { useLocalSearchParams } from 'expo-router'; import { KeyboardAvoidingView, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, View, } from 'react-native'; import { useCreateReservation } from '@/features/reservations/hooks/useCreateReservation'; import { StatusMessage } from '@/shared/ui/StatusMessage'; 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, isFormComplete, isSubmitting, error, successMessage, setDate, setStartTime, setEndTime, submit, } = useCreateReservation({ officeId, officeName }); return ( Crear reserva Completa la fecha y el horario en formato 24h. Espacio {officeName ?? 'No indicado'} Condiciones de reserva Horario permitido: de 08:00 a 20:00 Duración mínima: 30 minutos Duración máxima: 8 horas Fecha Formato: YYYY-MM-DD Hora de inicio Formato 24h Hora de fin Debe ser posterior {error ? : null} {successMessage ? : null} {isSubmitting ? 'Guardando...' : 'Guardar reserva'} ); } const styles = StyleSheet.create({ container: { flex: 1, }, content: { padding: 16, gap: 14, }, title: { fontSize: 28, fontWeight: '700', }, subtitle: { color: '#555', marginBottom: 4, }, infoBox: { borderWidth: 1, borderColor: '#ddd', borderRadius: 12, padding: 12, gap: 6, marginBottom: 8, }, rulesBox: { borderWidth: 1, borderColor: '#d7e3f7', backgroundColor: '#f4f8ff', borderRadius: 12, padding: 12, gap: 4, }, rulesTitle: { fontSize: 14, fontWeight: '700', color: '#1d4f91', marginBottom: 2, }, rulesText: { color: '#365b86', fontSize: 13, }, field: { gap: 6, }, row: { flexDirection: 'row', gap: 12, }, rowField: { flex: 1, }, label: { fontSize: 14, fontWeight: '700', color: '#444', }, value: { fontSize: 16, color: '#111', }, input: { borderWidth: 1, borderColor: '#ccc', borderRadius: 10, paddingHorizontal: 14, paddingVertical: 12, }, helper: { color: '#666', fontSize: 12, }, button: { backgroundColor: '#1f6feb', paddingVertical: 14, borderRadius: 10, alignItems: 'center', marginTop: 8, }, buttonDisabled: { backgroundColor: '#8fb5ec', }, buttonText: { color: '#fff', fontWeight: '600', }, });