Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bill image #20

Merged
merged 6 commits into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"react-native-popup-menu": "^0.16.1",
"react-native-safe-area-context": "^4.9.0",
"react-native-screens": "^3.29.0",
"zustand": "^4.5.2"
"react-native-view-shot": "^3.8.0",
"zustand": "^4.5.2",
"expo-sharing": "~11.10.0"
},
"devDependencies": {
"@babel/core": "^7.20.0"
Expand Down
16 changes: 16 additions & 0 deletions src/PaymentStore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {create} from 'zustand'

const PaymentStore = create((set) => ({
pagosRealizados: [],
agregarPago: (nuevoPago) => set((state) => ({
pagosRealizados: [...state.pagosRealizados, nuevoPago]
})),
eliminarPago: (numeroNota) => set((state) => ({
pagosRealizados: state.pagosRealizados.filter(pago => pago.numeroNota !== numeroNota),
})),
borrarPagos: () => set(() => ({
pagosRealizados: []
}))
}))

export default PaymentStore;
149 changes: 149 additions & 0 deletions src/a.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
import React from 'react';
import { View, Text, StyleSheet, ScrollView, TouchableOpacity, Image } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { Dimensions } from 'react-native';
import { theme } from "../../constants";
const screenWidth = Dimensions.get("window").width;
const screenHeight = Dimensions.get("window").height;
import zigzag from "../assets/ziza.png";


const cliente = "John Doe";
const numeroCliente = "20102353001";
const fecha = "06/08/2023";
const pagosRealizados = [
{ numeroNota: "215", fechaNota: "11/07/23", total: "520", pagado: "210" },
{ numeroNota: "221", fechaNota: "05/10/23", total: "340", pagado: "340" }
];
const totalPagado = "350";

const FacturaScreen = () => {
return (
<SafeAreaView style={styles.safeArea}>
<ScrollView style={styles.scrollView}>
style={styles.container}>
{/* <Image source={zigzag} style={styles.zigzagBorder} resizeMode="repeat" /> */}
<ScrollView style={styles.content}>
<View style={styles.titleContainer}>
<Text style={styles.title}>COMPROBANTE DE PAGO</Text>
<Text style={styles.title}>{fecha}</Text>
</View>
<View style={styles.textLine}>
<Text>Cliente:</Text>
<Text>{cliente}</Text>
</View>
<View style={styles.textLine}>
<Text>N° Cliente:</Text>
<Text>{numeroCliente}</Text>
</View>
<View style={styles.dottedLine} />



{pagosRealizados.map((pago, index) => (
<View key={index} style={styles.notaContent}>
<View style={styles.textLine}>
<Text> Numero de Nota:</Text>
<Text> {pago.numeroNota} </Text>
</View>
<View style={styles.textLine}>
<Text> Fecha de nota: </Text>
<Text> {pago.fechaNota} </Text>
</View>
<View style={styles.textLine}>
<Text> Total: {pago.total} Bs </Text>
<Text> Pagado: {pago.pagado} Bs </Text>
</View>
</View>
))}
<View style={styles.dottedLine} />
<View style={styles.textLine}>
<Text>Total Pagado:</Text>
<Text style={styles.title}>{totalPagado} Bs</Text>
</View>
</ScrollView>
<Image source={zigzag} style={styles.zigzagBorderBottom} resizeMode="repeat" />
<View style={styles.buttonContainer}>
<TouchableOpacity activeOpacity={0} style={styles.button}>
<Text style={styles.buttonText}>Imprimir</Text>
</TouchableOpacity>
</View>
</View>
</ScrollView>
</SafeAreaView>
);
};

const styles = StyleSheet.create({
safeArea: {
flex: 1,
},
scrollView: {
backgroundColor: theme.colors.primary,
},
container: {
justifyContent: "center",
alignItems: "center",
},
zigzagBorder: {
width: screenWidth - 40,
height: 15,
},
zigzagBorderBottom: {
width: screenWidth - 40,
height: 15,
transform: [{ rotate: "180deg" }],
},
titleContainer: {
justifyContent: "center",
alignItems: "center",
marginBottom: 22,
},
title: {
fontSize: 16,
fontWeight: "bold",
},
content: {
paddingHorizontal: 20,
paddingVertical: 20,
maxHeight: screenHeight * 0.8,
width: screenWidth - 40,
},
dottedLine: {
borderBottomWidth: 3,
borderBottomColor: "black",
borderStyle: "dotted",
marginVertical: 8,
},
textLine: {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
},
notaContent: {
marginVertical: 5,
},
buttonContainer: {
marginTop: 20,
flexDirection: "row",
justifyContent: "center",
width: screenWidth - 40,
},
button: {
justifyContent: "center",
alignItems: "center",
elevation: 5,
paddingVertical: 15,
paddingHorizontal: 25,
backgroundColor: theme.colors.tertiary,
borderRadius: 22,
flex: 1,
},
buttonText: {
color: theme.colors.primary,
fontSize: 16,
fontWeight: "bold",
},
});

export default FacturaScreen;
2 changes: 1 addition & 1 deletion src/components/ClientDebit.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const ClientDebit = ({ clientInfo }) => {
/>
<SimpleButton
text="Recibo"
onPress={toggleModal}
onPress={() => navigation.navigate('Factura')}
width={screenWidth * 0.4}
/>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NoteItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const NoteItem = ({ note, onSelect }) => {
<View>
<SimpleButton
text="Pagar"
onPress={() => navigation.navigate("PayScreen")}
onPress={() => navigation.navigate("PayScreen", { note })}
/>
</View>
</View>
Expand Down
6 changes: 6 additions & 0 deletions src/navigation/AppNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import BillScreen from '../screens/BillScreen'
import ClientPaymentScreen from '../screens/ClientPaymentScreen';
import PayScreen from '../screens/PayScreen';
import AutomaticPayScreen from '../screens/AutomaticPayScreen';
import FacturaScreen from '../screens/FacturaScreen';
import ProfileScreen from '../screens/ProfileScreen';

const Stack = createNativeStackNavigator();
Expand Down Expand Up @@ -55,6 +56,11 @@ function AppNavigator() {
headerShown: false,
}}
/>
<Stack.Screen
name="Factura"
component={FacturaScreen}
options={{ headerShown: false }}
/>
<Stack.Screen
name='ProfileScreen'
component={ProfileScreen}
Expand Down
1 change: 0 additions & 1 deletion src/screens/ClientPaymentScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const ClientPaymentScreen = ({ route }) => {
setAnimationKey(Date.now());
}, [])
);
console.log(itemClient);
const handleOptionChange = (option) => {
setSelectedOption(option);
};
Expand Down
Loading
Loading