import React, { useState } from 'react'; import { View, Text, Modal, TouchableOpacity, TextInput, ScrollView } from 'react-native'; import { PermitType } from '@/types/types'; import { X } from 'lucide-react-native'; interface RequestPermitModalProps { visible: boolean; onClose: () => void; onSubmit: (data: any) => void; } export default function RequestPermitModal({ visible, onClose, onSubmit}: RequestPermitModalProps) { const [type, setType] = useState('Ferie'); const [startDate, setStartDate] = useState(''); const [endDate, setEndDate] = useState(''); const [startTime, setStartTime] = useState(''); const [endTime, setEndTime] = useState(''); return ( {/* Header Modale */} Nuova Richiesta {/* Tipologia */} Tipologia Assenza {(['Ferie', 'Permesso', 'Malattia'] as PermitType[]).map((t) => ( setType(t)} className={`flex-1 py-4 rounded-xl border-2 items-center justify-center ${ type === t ? 'border-[#099499] bg-teal-50' : 'border-gray-100 bg-white' }`} > {t} ))} {/* Date Selection */} {type === 'Permesso' ? 'Data' : 'Dal'} {type !== 'Permesso' && ( Al )} {/* Time Selection (Solo Permessi) */} {type === 'Permesso' && ( Dalle Ore Alle Ore )} { onSubmit({ type, startDate, endDate, startTime, endTime }); onClose(); }} className="w-full py-4 bg-[#099499] rounded-2xl shadow-lg mt-4 active:scale-[0.98]" > Invia Richiesta ); };