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

Fix bug/size text #18

Merged
merged 4 commits into from
Mar 18, 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
88 changes: 50 additions & 38 deletions src/components/ClientDebit.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
//ClientDebit.js
import React, { useEffect, useState, useCallback } from "react";
import { View, Text, TouchableOpacity, Dimensions, StyleSheet} from "react-native";
import {
View,
Text,
TouchableOpacity,
Dimensions,
StyleSheet,
} from "react-native";
import { theme } from "../../constants";
import { useFocusEffect } from "@react-navigation/native";
import Modal from "../modals/SimpleModal";
import { StatusBar } from "expo-status-bar";
import { useNavigation } from "@react-navigation/native";
const screenWidth = Dimensions.get('window').width;
import SimpleButton from "../utils/SimpleButton";
import StyledText from "../utils/StyledText";

const screenWidth = Dimensions.get("window").width;

const ClientDebit = ({ clientInfo }) => {
const vBalance = parseFloat(clientInfo.NotasPendientes.reduce((total, nota) => total + nota.Saldo_pendiente, 0).toFixed(2));
const vBalance = parseFloat(
clientInfo.NotasPendientes.reduce(
(total, nota) => total + nota.Saldo_pendiente,
0
).toFixed(2)
);
const [totalDebit, setTotalDebit] = useState(0);
const [modalVisible, setModalVisible] = useState(false);
const [animationKey, setAnimationKey] = useState(Date.now());
Expand Down Expand Up @@ -54,54 +68,52 @@ const ClientDebit = ({ clientInfo }) => {
<View style={clientDebitStyles.container}>
<StatusBar style="ligth" backgroundColor={statusBarColor} />
<Modal isVisible={modalVisible} onClose={toggleModal} />
<Text style={clientDebitStyles.text}> {vBalance} Bs</Text>
<StyledText balance style={clientDebitStyles.text}> {vBalance} Bs</StyledText>
<View style={clientDebitStyles.spaceButtons}>
<TouchableOpacity onPress={() => navigation.navigate("AutomaticPayScreen")} style={clientDebitStyles.button}>
<Text style={clientDebitStyles.textButton}>Automático</Text>
</TouchableOpacity>
<TouchableOpacity
<SimpleButton
text="Automático"
onPress={() => navigation.navigate("AutomaticPayScreen")}
width={screenWidth * 0.4}
/>
<SimpleButton
text="Recibo"
onPress={toggleModal}
style={clientDebitStyles.button}
>
<Text style={clientDebitStyles.textButton}>Recibo</Text>
</TouchableOpacity>
width={screenWidth * 0.4}
/>
</View>
</View>
);
};

const clientDebitStyles = StyleSheet.create({
container: {
backgroundColor: theme.colors.skyBlue,
borderRadius:22,
width: screenWidth-40,
alignSelf: 'center',
marginBottom: 20,
backgroundColor: theme.colors.skyBlue,
borderRadius: 22,
width: screenWidth - 40,
alignSelf: "center",
marginBottom: 20,
},
spaceButtons: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingHorizontal: 10,
marginBottom: 10,
flexDirection: "row",
justifyContent: "space-between",
paddingHorizontal: 10,
marginBottom: 10,
},
text: {
fontSize: 30,
fontWeight: 'bold',
alignSelf: 'center',
padding: 15,
padding: 15,
},
button: {
backgroundColor: theme.colors.tertiary,
borderRadius: 22,
paddingVertical: 12,
padding: 10,
width: screenWidth * 0.4,
},
button:{
backgroundColor: theme.colors.tertiary,
borderRadius: 22,
paddingVertical: 12,
padding: 10,
width: screenWidth*0.4,
textButton: {
color: theme.colors.primary,
fontSize: 16,
alignSelf: "center",
fontWeight: "bold",
},
textButton:{
color: theme.colors.primary,
fontSize: 16,
alignSelf: 'center',
fontWeight: "bold",
}
})
});
export default ClientDebit;
34 changes: 4 additions & 30 deletions src/components/ClientItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const ClientItem = ({ client, onSelect }) => {
<BorderBox onPress={() => onSelect(client.id)} style={{marginVertical: 10}}>
<View style={styles.iconContainer}>
<View style={styles.iconWraped}>
<Text style={styles.icon}>{vNombre.charAt(0)}</Text>
{/* <Text style={styles.icon}>{vNombre.charAt(0)}</Text> */}
<StyledText initial>{vNombre.charAt(0)}</StyledText>
</View>
<View style={styles.detailsContainer}>
{/* <StyledText boldText>{vNombre}</StyledText> */}
<Text style={styles.name}>{vNombre}</Text>
<Text style={styles.code}>{vCuenta}</Text>
<StyledText boldTextUpper>{vNombre}</StyledText>
<StyledText regularText>{vCuenta}</StyledText>
{/* <View style={styles.codeContainer}>
<MaterialCommunityIcons name="account" size={19} color="black" />
<StyledText regularText style={{marginLeft:5,}}>{vCuenta}</StyledText>
Expand Down Expand Up @@ -66,11 +66,6 @@ const styles = StyleSheet.create({
width: 70,
height: 70,
},
icon: {
color: theme.colors.primary,
fontSize: 30,
fontWeight: 'medium',
},
detailsContainer: {
marginLeft: 17,
flex: 1,
Expand All @@ -79,19 +74,10 @@ const styles = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
},
balance: {
fontSize: 16,
marginLeft: 8,
color: theme.colors.secondaryText,
},
notesContainer: {
flexDirection: 'column',
// alignItems: 'flex-start',
},
notes: {
fontSize: 16,
color: theme.colors.secondaryText,
},
lineContainer: {
justifyContent: 'center',
alignItems: 'center',
Expand All @@ -102,18 +88,6 @@ const styles = StyleSheet.create({
width: windowWidth*0.8,
height: 2,
},
name: {
fontWeight: 'bold',
fontSize: 16,
textTransform: 'uppercase',
// textAlign: 'center',
},
code: {
fontSize: 16,
// textAlign: 'center',
color: theme.colors.secondaryText,
// marginLeft:20,
},
textLine: {
flexDirection: "row",
justifyContent: "space-between",
Expand Down
23 changes: 6 additions & 17 deletions src/components/DropdownSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FontAwesome5 } from "@expo/vector-icons";
import { Menu, MenuOptions, MenuOption, MenuTrigger } from "react-native-popup-menu";
import { theme } from '../../constants';
import { StyleSheet, Dimensions } from 'react-native';
import StyledText from "../utils/StyledText";
const screenWidth = Dimensions.get('window').width;

const DropdownSelector = ({ title, options, selectedOption, onOptionChange }) => {
Expand All @@ -17,15 +18,15 @@ const DropdownSelector = ({ title, options, selectedOption, onOptionChange }) =>
return (
<View style={styles.container}>
<View style={styles.label}>
<Text style={styles.optionText}>{title}</Text>
<StyledText boldText>{title}</StyledText>
</View>
<Menu opened={menuVisible} onBackdropPress={() => setMenuVisible(false)}>
<MenuTrigger onPress={toggleMenu} style={styles.trigger}>
<View style={styles.menuTrigger}>
<View style={styles.menuTriggerInter}>
<Text style={styles.triggerText}>
{selectedOption.charAt(0).toUpperCase() + selectedOption.slice(1)}
</Text>
<StyledText buttonText style={styles.triggerText}>
{selectedOption.charAt(0).toUpperCase() + selectedOption.slice(1)}
</StyledText>
</View>
<FontAwesome5 name={menuVisible ? "chevron-up" : "chevron-down"} size={20} color="white" />
</View>
Expand All @@ -34,7 +35,7 @@ const DropdownSelector = ({ title, options, selectedOption, onOptionChange }) =>
{options.map((option) => (
<MenuOption key={option} onSelect={() => { onOptionChange(option); setMenuVisible(false); }}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Text style={styles.optionsText}>{option}</Text>
<StyledText buttonText>{option}</StyledText>
{selectedOption === option && (
<FontAwesome5 name="check" size={17} color="white" style={{ marginLeft: 10 }} />
)}
Expand Down Expand Up @@ -63,15 +64,6 @@ const styles = StyleSheet.create({
borderRadius: 20,
flex:1
},
optionText: {
fontSize: 16,
fontWeight: "bold",
},
optionsText: {
color: theme.colors.primary,
fontSize: 16,
fontWeight: "bold",
},
menuTrigger: {
flexDirection: "row",
alignItems: 'center',
Expand All @@ -89,9 +81,6 @@ const styles = StyleSheet.create({
flex: 1,
},
triggerText: {
color: theme.colors.primary,
fontSize: 16,
fontWeight: "bold",
marginRight: 12,
},
optionsContainer: {
Expand Down
36 changes: 8 additions & 28 deletions src/components/NoteItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { theme } from "../../constants";
import BorderBox from "../utils/BorderBox";
import StyledText from "../utils/StyledText";
import { useNavigation } from "@react-navigation/native";
import SimpleButton from "../utils/SimpleButton";

const NoteItem = ({ note, onSelect }) => {
const [modalVisible, setModalVisible] = useState(false);
Expand All @@ -37,17 +38,16 @@ const NoteItem = ({ note, onSelect }) => {
]}
>
<View style={noteItemstyles.row}>
<View style={noteItemstyles.textNro}>
<Text style={noteItemstyles.textNro}>{note.nro_nota}</Text>
<Text style={noteItemstyles.textDate}>{note.Fecha_venta}</Text>
</View>
<View>
<Text style={noteItemstyles.amount}>{note.Saldo_pendiente}</Text>
<StyledText boldText>{note.nro_nota}</StyledText>
<StyledText regularText>{note.Fecha_venta}</StyledText>
</View>
<StyledText money>{note.Saldo_pendiente} Bs</StyledText>
<View>
<TouchableOpacity onPress={() => navigation.navigate("PayScreen")} style={noteItemstyles.button}>
<Text style={noteItemstyles.textButton}>Pagar</Text>
</TouchableOpacity>
<SimpleButton
text="Pagar"
onPress={() => navigation.navigate("PayScreen")}
/>
</View>
</View>
<View style={[noteItemstyles.textLine, { marginTop: 15 }]}>
Expand Down Expand Up @@ -92,32 +92,12 @@ const noteItemstyles = StyleSheet.create({
justifyContent: "space-between",
alignItems: "center",
},
textNro: {
fontWeight: "bold",
fontSize: 16,
color: theme.colors.tertiary,
},
textDate: {
fontSize: 16,
color: theme.colors.secondaryText,
},
amount: {
fontWeight: "bold",
fontSize: 16,
color: theme.colors.green,
},
button: {
backgroundColor: theme.colors.tertiary,
paddingHorizontal: 20,
paddingVertical: 10,
borderRadius: 22,
},
textButton: {
color: theme.colors.primary,
fontSize: 16,
alignSelf: "center",
fontWeight: "bold",
},
textLine: {
flexDirection: "row",
justifyContent: "space-between",
Expand Down
31 changes: 11 additions & 20 deletions src/components/SearchBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { Ionicons } from "@expo/vector-icons";
import { FontAwesome5 } from "@expo/vector-icons";
import { Menu, MenuOptions, MenuOption, MenuTrigger } from "react-native-popup-menu";
import { theme } from "../../constants";
import StyledText from "../utils/StyledText";
const windowWidth = Dimensions.get("window").width;

const { height } = Dimensions.get('window');
const regularTextSize = height * 0.021
const SearchBar = ({ searchQuery, setSearchQuery, selectedOption, onOptionChange,}) => {
const [menuVisible, setMenuVisible] = useState(false);

Expand All @@ -21,23 +23,23 @@ const SearchBar = ({ searchQuery, setSearchQuery, selectedOption, onOptionChange
<Menu opened={menuVisible} onBackdropPress={() => setMenuVisible(false)}>
<MenuTrigger onPress={toggleMenu} style={searchBarStyles.trigger}>
<TouchableOpacity onPress={toggleMenu} activeOpacity={1} style={{ flexDirection: "row", alignItems: "center", justifyContent: "space-between", }}>
<Text style={searchBarStyles.triggerText}>
<StyledText buttonText style={{marginRight: 12}}>
{selectedOption.charAt(0).toUpperCase() + selectedOption.slice(1)}
</Text>
</StyledText>
<FontAwesome5 name={menuVisible ? "chevron-up" : "chevron-down"} size={20} color="white" />
</TouchableOpacity>
</MenuTrigger>
<MenuOptions customStyles={{ optionsContainer: searchBarStyles.optionsContainer, optionsWrapper: searchBarStyles.optionsWrapper, }}>
<MenuOption onSelect={() => { onOptionChange("cliente"); setMenuVisible(false); }} >
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Text style={searchBarStyles.optionsText}>Cliente</Text>
<StyledText buttonText>Cliente</StyledText>
{selectedOption === "cliente" && (
<FontAwesome5 name="check" size={17} color="white" marginLeft={10} />)}
</View>
</MenuOption>
<MenuOption onSelect={() => { onOptionChange("cuenta"); setMenuVisible(false); }}>
<View style={{ flexDirection: "row", alignItems: "center" }}>
<Text style={searchBarStyles.optionsText}>Cuenta</Text>
<StyledText buttonText>Cuenta</StyledText>
{selectedOption === "cuenta" && (
<FontAwesome5 name="check" size={17} color="white" marginLeft={10} />
)}
Expand All @@ -60,10 +62,10 @@ const searchBarStyles = StyleSheet.create({
marginHorizontal: windowWidth * 0.05,
},
searchTextInput: {
flex: 1,
marginLeft: 7,
marginRight: 10,
fontSize: 17,
flex: 1,//
marginLeft: 7,//
marginRight: 10,//
fontSize: regularTextSize,
color: theme.colors.primaryText,
},
trigger: {
Expand All @@ -72,12 +74,6 @@ const searchBarStyles = StyleSheet.create({
backgroundColor: theme.colors.tertiary,
borderRadius: 22,
},
triggerText: {
color: theme.colors.primary,
fontSize: 16,
fontWeight: "bold",
marginRight: 12,
},
optionsContainer: {
paddingVertical: 15,
marginTop: 55,
Expand All @@ -89,10 +85,5 @@ const searchBarStyles = StyleSheet.create({
optionsWrapper: {
marginLeft: 20,
},
optionsText: {
color: theme.colors.primary,
fontSize: 16,
fontWeight: "bold",
},
});
export default SearchBar;
Loading
Loading