Refactor MachineCard component and update API endpoints

This commit is contained in:
2026-08-03 10:58:16 +02:00
parent e49d6f0e5b
commit ccbc8d62c5
4 changed files with 12 additions and 43 deletions

View File

@@ -1,14 +1,13 @@
import { AlertTriangle, Car, KeySquare } from 'lucide-react-native';
import { Car } from 'lucide-react-native';
import React from 'react';
import { Text, View, TouchableOpacity } from 'react-native';
import { Text, View } from 'react-native';
import { MachineAttendanceItem } from '@/types/types';
interface MachineCardProps {
item: MachineAttendanceItem;
onExitPress: (item: MachineAttendanceItem) => void;
}
export default function MachineCard({ item, onExitPress }: MachineCardProps) {
export default function MachineCard({ item }: MachineCardProps) {
return (
<View className="bg-white p-5 rounded-3xl shadow-sm border border-gray-100 flex-col mb-4">
<View className="flex-row items-center border-b border-gray-50 pb-3 mb-3">
@@ -34,23 +33,15 @@ export default function MachineCard({ item, onExitPress }: MachineCardProps) {
</Text>
</View>
{/* The exit is registered automatically at check-in; older records
created before that change may still have no exit */}
{item.out ? (
<View className="flex-row items-center">
<Text className="font-bold text-green-600">
Uscita: {item.out}
</Text>
</View>
) : (
<View className="flex-row items-center flex-1 justify-end">
<TouchableOpacity
onPress={() => onExitPress(item)}
className="bg-red-50 px-4 py-2 rounded-full border border-red-200 flex-row items-center shadow-sm active:bg-red-100"
>
<KeySquare size={14} color="#dc2626" />
<Text className="text-red-600 font-bold ml-2 text-sm">Registra Uscita</Text>
</TouchableOpacity>
</View>
)}
) : null}
</View>
</View>
);