Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
judithmarg committed Apr 27, 2024
1 parent f6eb0bf commit e8924af
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/components/DropdownSelector2.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const DropdownSelector2 = ({ title, name, options, selectedOption, onOptionChang
{selectedOption.charAt(0).toUpperCase() + selectedOption.slice(1)}
</Text>
</View>
<FontAwesome5 name={menuVisible ? "chevron-up" : "chevron-down"} size={20} color="white" />
<FontAwesome5 name={menuVisible ? "chevron-up" : "chevron-down"} size={15} color="white" />
</View>
</MenuTrigger>
<MenuOptions customStyles={{ optionsContainer: styles.optionsContainer, optionsWrapper: styles.optionsWrapper, }}>
Expand Down Expand Up @@ -76,11 +76,11 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'space-between',
paddingVertical: 12,
paddingHorizontal: 25,
paddingHorizontal: 20,
backgroundColor: theme.colors.tertiary,
borderRadius: 22,
width: "auto",
maxWidth: screenWidth - 40,
width: 'auto',
maxWidth: screenWidth - 200,
alignSelf: "center",
},
menuTriggerInter: {
Expand Down
31 changes: 21 additions & 10 deletions src/screens/PayScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import DropdownSelector2 from "../components/DropdownSelector2.js";
import PaymentStore from "../stores/PaymentStore.js";
import useStore from "../stores/store.js";
import userStore from "../stores/userStore";
import { formatDate } from "date-fns";
const screenWidth = Dimensions.get("window").width;
const screenHeight = Dimensions.get("window").height;

Expand All @@ -32,11 +33,11 @@ const PayScreen = ({ route }) => {
setSelectedCurrency(option);
};

const [selectedCash, setSelectedCash] = useState('CTA 1239123234');
const cash_accounts = ['CTA 1239123234', 'CTA 1239123235', 'CTA 1239123236'];
const [selectedDate, setSelectedDate] = useState("");
const [selectedBank, setSelectedBank] = useState('BNB 1213434789');
const banks = ['BNB 1213434789', 'BCP 4432765343'];
const [selectedCash, setSelectedCash] = useState('CTA 11101010001');
const cash_accounts = ['CTA 11101010001', 'CTA 11101010002', 'CTA 11101020001', 'CTA 11101020002'];
const [selectedDate, setSelectedDate] = useState(formatDate(new Date(), 'yyyy-MM-dd'));
const [selectedBank, setSelectedBank] = useState('FIE.CTA 6-8918');
const banks = ['FIE.CTA 6-8918', 'BISA.CTA 4454770019','UNION.CTA 1-18604442', 'BNB.CTA 300017-4016','BISA.CTA 4454772011'];

const {
control,
Expand All @@ -63,7 +64,7 @@ const PayScreen = ({ route }) => {
total: note.importe_nota,
pagado: data.amount,
});
updateNota(note.id, {Saldo_pendiente: note.Saldo_pendiente - data.amount, Monto_pagado: note.Monto_pagado + parseInt(data.amount) });
updateNota(note.id, {Saldo_pendiente: note.Saldo_pendiente - parseFloat(data.amount), Monto_pagado: note.Monto_pagado + parseFloat(data.amount) });
agregarPago({
cta_deposito: selectedBank,
cuenta: note.Cuenta|| "",
Expand Down Expand Up @@ -113,7 +114,7 @@ const PayScreen = ({ route }) => {
rules={{
required: "Este campo es requerido",
pattern: {
value: /^[0-9]+$/,
value: /^[0-9]+[.][0-9]{0,2}$/,
message: "Ingrese solo números",
},
}}
Expand Down Expand Up @@ -141,6 +142,7 @@ const PayScreen = ({ route }) => {
}}
errors={errors}
/>
{method === 'cheque' &&
<InputField
control={control}
name="checkBankNumber"
Expand All @@ -154,24 +156,32 @@ const PayScreen = ({ route }) => {
},
}}
errors={errors}
/>
/>}

{/* El input de abajo necesita usar un datetime picker para la fecha */}

<View style={styles.lineForm}>
<DateInputField
control={control}
name="checkBankDate"
title="Fecha Cheque"
title={method==='method'?"Fecha Cheque": "Fecha"}
callThrough={setSelectedDate}
/>

{method==='efectivo' &&
<DropdownSelector2
title="Cta/Caja Banco"
options={cash_accounts}
selectedOption={selectedCash}
onOptionChange={setSelectedCash}
/>}
{method==='banco' &&
<DropdownSelector2
title="Cta/Caja Banco"
options={banks}
selectedOption={selectedBank}
onOptionChange={setSelectedBank}
/>
/>}
</View>
<InputField
control={control}
Expand Down Expand Up @@ -258,6 +268,7 @@ const styles = StyleSheet.create({
},
lineForm: {
flexDirection: "row",
justifyContent: "space-between",
},
formContainer: {
flex: 1,
Expand Down
4 changes: 2 additions & 2 deletions src/stores/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ const useStore = create((set, get) => ({
updateNota: async (notaId, data) => {
const notaRef = doc(db, 'notas_pendientes', notaId);
await updateDoc(notaRef, data);
console.log("Nota actualizada en Firestore.");
// console.log("Nota actualizada en Firestore.");
},

agregarPago: async (pago) => {
const pagosRealizados = collection(db, 'notas_cobradas');
await addDoc(pagosRealizados, pago);
console.log("Pago agregado al estado.");
// console.log("Pago agregado al estado.");
},
}));

Expand Down

0 comments on commit e8924af

Please sign in to comment.