diff --git a/asset/apreton-de-manos.png b/assets/apreton-de-manos.png similarity index 100% rename from asset/apreton-de-manos.png rename to assets/apreton-de-manos.png diff --git a/asset/logo.png b/assets/logo.png similarity index 100% rename from asset/logo.png rename to assets/logo.png diff --git a/asset/tienda-alt.png b/assets/tienda-alt.png similarity index 100% rename from asset/tienda-alt.png rename to assets/tienda-alt.png diff --git a/src/components/cardList/CardList.tsx b/src/components/cardList/CardList.tsx index e10591c..fed5fbb 100644 --- a/src/components/cardList/CardList.tsx +++ b/src/components/cardList/CardList.tsx @@ -11,34 +11,37 @@ interface Props { columnDisplay: string } -export const CardList:FC = ({entities, screenName, columnDisplay}) => { +export const CardList: FC = ({ entities, screenName, columnDisplay }) => { const navitation = useNavigation>(); - - return ( - <> - - - - - navitation - .navigate(screenName , {id:item['id']} )} - > - - {item[columnDisplay]} - - - - } - keyExtractor={item => item["id"]} - /> - - - - ) + + return ( + <> + + + + + navitation + .navigate(screenName, { id: item['id'] })} + > + + + {item[columnDisplay]} + + + + + + } + keyExtractor={item => item["id"]} + /> + + + + ) } \ No newline at end of file diff --git a/src/components/cardList/ProductCardList.tsx b/src/components/cardList/ProductCardList.tsx new file mode 100644 index 0000000..b2913da --- /dev/null +++ b/src/components/cardList/ProductCardList.tsx @@ -0,0 +1,55 @@ +import React, { FC, useEffect, useState } from 'react' +import { FlatList, RefreshControl, Text, TouchableOpacity, View } from 'react-native' + +import { useNavigation } from '@react-navigation/native'; +import { CardItem } from '../CardItem'; +import { NativeStackNavigationProp } from '@react-navigation/native-stack'; +import { Avatar, Layout } from '@ui-kitten/components'; + +interface Props { + entities: [], + screenName: string, + columnDisplay: string +} + +export const ProductCardList: FC = ({ entities, screenName, columnDisplay }) => { + + const navitation = useNavigation>(); + + + return ( + <> + + + + + navitation + .navigate(screenName, { id: item['id'] })} + > + + + + + {item[columnDisplay]} + + + + + + + + } + keyExtractor={item => item["id"]} + /> + + + + ) +} \ No newline at end of file diff --git a/src/screens/product/ProductFormScreen.tsx b/src/screens/product/ProductFormScreen.tsx index 79bc317..2ad9055 100644 --- a/src/screens/product/ProductFormScreen.tsx +++ b/src/screens/product/ProductFormScreen.tsx @@ -1,5 +1,5 @@ import { useEffect } from 'react' -import { Text } from 'react-native' +import { Text,Image } from 'react-native' import { Background } from '../../components/Background' import { Button } from '../../components/Button'; import { Card } from '../../components/Card'; @@ -11,7 +11,7 @@ import { useFetchWithAuth } from '../../hooks/useFetchWithAuth'; import { saveWithAuth } from '../../hooks/saveWithAuth'; import { InputNumber } from '../../components/InputNumber'; import { InputDate } from '../../components/InputDate'; - +import { Avatar, Layout } from '@ui-kitten/components'; interface Props extends NativeStackScreenProps { }; @@ -75,7 +75,16 @@ export const ProductFormScreen = ({ route, navigation }: Props) => { <> + + Registro de Productos + diff --git a/src/screens/product/ProductListScreen.tsx b/src/screens/product/ProductListScreen.tsx index 8f53ba0..cdcf602 100644 --- a/src/screens/product/ProductListScreen.tsx +++ b/src/screens/product/ProductListScreen.tsx @@ -5,6 +5,8 @@ import { Card } from '../../components/Card' import { CardList } from '../../components/cardList/CardList' import { Button } from '../../components/Button' import { useFetchWithAuth } from '../../hooks/useFetchWithAuth' +import { ProductCardList } from '../../components/cardList/ProductCardList'; + export const ProductListScreen = () => { const navigation = useNavigation(); @@ -52,7 +54,7 @@ export const ProductListScreen = () => { Listado de Produtos - + } diff --git a/src/screens/salesorder/ProductList.tsx b/src/screens/salesorder/ProductList.tsx new file mode 100644 index 0000000..718c675 --- /dev/null +++ b/src/screens/salesorder/ProductList.tsx @@ -0,0 +1,75 @@ +import { useEffect, useState } from 'react' +import { FlatList, RefreshControl, Text, View } from 'react-native' +import { useNavigation } from '@react-navigation/native'; +import { Card } from '../../components/Card' +import { CardList } from '../../components/cardList/CardList' +import { Button } from '../../components/Button' +import { useFetchWithAuth } from '../../hooks/useFetchWithAuth' +import { ProductCardList } from '../../components/cardList/ProductCardList'; + + +export const ProductList = () => { + const navigation = useNavigation(); + const [refreshing, setRefreshing] = useState(false); + const endpoints = "producto"; + let defaultData: [] = []; + + const [entities, setEntities] = useState(defaultData); + + const getInitData = async () => { + const { data, error } = await useFetchWithAuth(endpoints); + if (!error) { + setEntities(data); + } else { + console.log(error) + } + } + + useEffect(() => { + getInitData(); + }, [refreshing]) + + const onRefresh = () => { + setRefreshing(true); + setTimeout(() => { + setRefreshing(false); + }, 1000); + }; + + return ( + +