feat: add and enhance PermitsScreen and RequestPermitModal
- add LoadingScreen component - update utilities
This commit is contained in:
@ -14,6 +14,7 @@ export default function ProtectedLayout() {
|
||||
return <Redirect href="/login" />;
|
||||
}
|
||||
|
||||
// TODO: Aggiungere padding per i dispositivi con notch/bottom bar
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
|
||||
@ -77,12 +77,12 @@ export default function AttendanceScreen() {
|
||||
<View className={`w-3 h-3 rounded-full shadow-sm ${item.status === 'complete' ? 'bg-green-500' : 'bg-orange-500'}`} />
|
||||
<View>
|
||||
<Text className="font-bold text-gray-800 text-lg mb-0.5">{item.site}</Text>
|
||||
<Text className="text-sm text-gray-400 font-medium">{item.in} - {item.out || 'In corso'}</Text>
|
||||
<Text className="text-base text-gray-400 font-medium">{item.in} - {item.out || 'In corso'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
{item.status === 'complete' && (
|
||||
<View className="bg-gray-100 px-3 py-1.5 rounded-lg">
|
||||
<Text className="text-sm font-mono text-gray-600 font-bold">8h</Text>
|
||||
<Text className="text-base font-mono text-gray-600 font-bold">8h</Text>
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
@ -4,6 +4,7 @@ import { Alert, ScrollView, Text, TouchableOpacity, View, ActivityIndicator, Ref
|
||||
import { TimeOffRequest, TimeOffRequestType } from '@/types/types';
|
||||
import RequestPermitModal from '@/components/RequestPermitModal';
|
||||
import CalendarWidget from '@/components/CalendarWidget';
|
||||
import LoadingScreen from '@/components/LoadingScreen';
|
||||
import api from '@/utils/api';
|
||||
import { formatDate, formatTime } from '@/utils/dateTime';
|
||||
|
||||
@ -51,14 +52,8 @@ export default function PermitsScreen() {
|
||||
fetchPermits();
|
||||
};
|
||||
|
||||
// TODO: Migliorare schermata di caricamento -> spostarla in un componente a parte
|
||||
if (isLoading && !refreshing) {
|
||||
return (
|
||||
<View className="flex-1 justify-center items-center bg-gray-50">
|
||||
<ActivityIndicator size="large" color="#099499" />
|
||||
<Text className="text-gray-500 mt-2">Caricamento...</Text>
|
||||
</View>
|
||||
);
|
||||
return <LoadingScreen />;
|
||||
}
|
||||
|
||||
return (
|
||||
@ -96,7 +91,7 @@ export default function PermitsScreen() {
|
||||
) : (
|
||||
<View className="gap-4">
|
||||
<Text className="text-xl font-bold text-gray-800 px-1">Le tue richieste</Text>
|
||||
{/* TODO: Aggiungere una paginazione con delle freccette affianco? */}
|
||||
{/* TODO: Aggiungere una paginazione con delle freccette affianco? - Limite backend? */}
|
||||
{permits.map((item) => (
|
||||
<View key={item.id} className="bg-white p-5 rounded-3xl shadow-sm border border-gray-100 flex-row justify-between items-center">
|
||||
<View className="flex-row items-center gap-4">
|
||||
@ -115,6 +110,7 @@ export default function PermitsScreen() {
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
{/* TODO: Aggiungere funzionalità per modificare/eliminare la richiesta? */}
|
||||
<View className={`px-3 py-1.5 rounded-lg ${item.status ? 'bg-green-100' : 'bg-yellow-100'}`}>
|
||||
<Text className={`text-xs font-bold uppercase tracking-wide ${item.status ? 'text-green-700' : 'text-yellow-700'}`}>
|
||||
{item.status ? 'Approvato' : 'In Attesa'}
|
||||
|
||||
Reference in New Issue
Block a user