thêm modal thêm mới/cập nhật NKĐT

This commit is contained in:
Tran Anh Tuan
2025-11-07 16:50:47 +07:00
parent f7b05f1e08
commit 53bf2d18e6
4 changed files with 718 additions and 49 deletions

View File

@@ -1,56 +1,21 @@
import AlarmList from "@/components/AlarmList";
import { Link } from "expo-router";
import {
Platform,
StyleSheet,
Text,
TouchableOpacity,
View,
} from "react-native";
import CreateOrUpdateHaulModal from "@/components/tripInfo/modal/CreateOrUpdateHaulModal";
import { useState } from "react";
import { Button, Platform, StyleSheet, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
const alarmExample = {
alarms: [
{
name: "Ngập nước có cảnh báo",
t: 1762226488,
level: 1,
id: "0:8:1",
},
{
name: "Tầu cảnh báo sos",
t: 1762226596,
level: 3,
id: "50:15",
},
{
name: "Khói có cảnh báo",
t: 1762226589,
level: 1,
id: "0:1:1",
},
{
name: "Cửa có cảnh báo",
t: 1762226547,
level: 1,
id: "0:7:1",
},
],
level: 3,
};
export default function Warning() {
const [isShowModal, setIsShowModal] = useState(false);
return (
<SafeAreaView style={{ flex: 1 }}>
<View style={styles.container}>
<Text style={styles.titleText}>Nhật Chuyến Đi</Text>
<Link href="/modal" asChild>
<TouchableOpacity style={styles.button}>
<Text style={styles.buttonText}>Mở Modal</Text>
</TouchableOpacity>
</Link>
<AlarmList alarmsData={alarmExample.alarms} />
<CreateOrUpdateHaulModal
haulData={fishingInfoDatas}
isVisible={isShowModal}
onClose={function (): void {
setIsShowModal(false);
}}
/>
<Button title="Thêm thu hoạch" onPress={() => setIsShowModal(true)} />
</View>
</SafeAreaView>
);
@@ -88,3 +53,106 @@ const styles = StyleSheet.create({
fontWeight: "600",
},
});
const fishingInfoDatas: Model.FishingLogInfo[] = [
{
fish_species_id: 10,
fish_name: "Cá quỷ biển (Barracuda)",
catch_number: 820,
catch_unit: "kg",
fish_size: 29,
fish_rarity: 1,
fish_condition: "Bị thương",
gear_usage: "",
},
{
fish_species_id: 1,
fish_name: "Cá thu",
catch_number: 1293,
catch_unit: "kg",
fish_size: 37,
fish_rarity: 1,
fish_condition: "Bị thương",
gear_usage: "",
},
{
fish_species_id: 13,
fish_name: "Cá song đỏ",
catch_number: 1738,
catch_unit: "kg",
fish_size: 28,
fish_rarity: 2,
fish_condition: "Còn sống",
gear_usage: "",
},
{
fish_species_id: 17,
fish_name: "Cá nược",
catch_number: 690,
catch_unit: "kg",
fish_size: 63,
fish_rarity: 1,
fish_condition: "Chết",
gear_usage: "",
},
{
fish_species_id: 19,
fish_name: "Cá hổ Thái Lan",
catch_number: 825,
catch_unit: "kg",
fish_size: 55,
fish_rarity: 4,
fish_condition: "Chết",
gear_usage: "Câu tay",
},
{
fish_species_id: 8,
fish_name: "Cá hồng phớn",
catch_number: 1409,
catch_unit: "kg",
fish_size: 172,
fish_rarity: 3,
fish_condition: "Chết",
gear_usage: "Bẫy lưới",
},
{
fish_species_id: 16,
fish_name: "Cá rồng biển",
catch_number: 1426,
catch_unit: "kg",
fish_size: 105,
fish_rarity: 3,
fish_condition: "Chết",
gear_usage: "Lưới rê",
},
{
fish_species_id: 3,
fish_name: "Cá chim trắng",
catch_number: 176,
catch_unit: "kg",
fish_size: 83,
fish_rarity: 2,
fish_condition: "Chết",
gear_usage: "",
},
{
fish_species_id: 14,
fish_name: "Cá mú cườm",
catch_number: 724,
catch_unit: "kg",
fish_size: 36,
fish_rarity: 2,
fish_condition: "Chết",
gear_usage: "",
},
{
fish_species_id: 18,
fish_name: "Cá đuối quạt",
catch_number: 1712,
catch_unit: "kg",
fish_size: 105,
fish_rarity: 4,
fish_condition: "Còn sống",
gear_usage: "Câu vàng",
},
];