Files
SeaGateway-App/components/tripInfo/modal/NetDetailModal/components/InfoSection.tsx
2025-11-07 17:56:13 +07:00

89 lines
2.3 KiB
TypeScript

import React from "react";
import { Text, View } from "react-native";
import styles from "../../style/NetDetailModal.styles";
interface InfoSectionProps {
netData?: Model.FishingLog;
isCompleted: boolean;
stt?: number;
}
export const InfoSection: React.FC<InfoSectionProps> = ({
netData,
isCompleted,
stt,
}) => {
if (!netData) {
return null;
}
const infoItems = [
{ label: "Số thứ tự", value: `Mẻ ${stt}` },
{
label: "Trạng thái",
value: netData.status === 1 ? "Đã hoàn thành" : "Chưa hoàn thành",
isStatus: true,
},
{
label: "Thời gian bắt đầu",
value: netData.start_at
? new Date(netData.start_at).toLocaleString()
: "Chưa cập nhật",
},
{
label: "Thời gian kết thúc",
value: netData.start_at
? new Date(netData.end_at).toLocaleString()
: "Chưa cập nhật",
},
// {
// label: "Vị trí hạ thu",
// value: netData.viTriHaThu || "Chưa cập nhật",
// },
// {
// label: "Vị trí thu lưới",
// value: netData.viTriThuLuoi || "Chưa cập nhật",
// },
// {
// label: "Độ sâu hạ thu",
// value: netData.doSauHaThu || "Chưa cập nhật",
// },
// {
// label: "Độ sâu thu lưới",
// value: netData.doSauThuLuoi || "Chưa cập nhật",
// },
];
return (
<View style={styles.infoCard}>
{infoItems.map((item, index) => (
<View key={index} style={styles.infoRow}>
<Text style={styles.infoLabel}>{item.label}</Text>
{item.isStatus ? (
<View
style={[
styles.statusBadge,
item.value === "Đã hoàn thành"
? styles.statusBadgeCompleted
: styles.statusBadgeInProgress,
]}
>
<Text
style={[
styles.statusBadgeText,
item.value === "Đã hoàn thành"
? styles.statusBadgeTextCompleted
: styles.statusBadgeTextInProgress,
]}
>
{item.value}
</Text>
</View>
) : (
<Text style={styles.infoValue}>{item.value}</Text>
)}
</View>
))}
</View>
);
};