From cb11de88b5b0851d070de95b9f451fc4a7c0175c Mon Sep 17 00:00:00 2001 From: Vanessa Huynh Date: Mon, 20 May 2024 13:34:21 -0700 Subject: [PATCH 1/3] fixed UI --- App.js | 2 +- pages/Waiver.js | 49 +++++++++++++++++++---------- pages/admin/adminIndividualEvent.js | 2 +- pages/admin/adminVolunteers.js | 16 ++++++++-- tempCodeRunnerFile.js | 1 + 5 files changed, 50 insertions(+), 20 deletions(-) create mode 100644 tempCodeRunnerFile.js diff --git a/App.js b/App.js index ecdf448..9531e41 100644 --- a/App.js +++ b/App.js @@ -24,7 +24,7 @@ export default function App() { // persistence: getReactNativePersistence(ReactNativeAsyncStorage) //async-storage in Waiver page return ( - + diff --git a/pages/Waiver.js b/pages/Waiver.js index 44ee839..f8a8397 100644 --- a/pages/Waiver.js +++ b/pages/Waiver.js @@ -79,7 +79,12 @@ export default function Waiver({route, navigation}) { return ( - + {/* */} + + + 9341 Mill Street, Ben Lomond, CA 95005 831-336-3513 + www.mountainartcenter.org + Last Name @@ -99,8 +104,8 @@ export default function Waiver({route, navigation}) { - 9341 Mill Street, Ben Lomond, CA 95005 831-336-3513 - www.mountainartcenter.org + {/* 9341 Mill Street, Ben Lomond, CA 95005 831-336-3513 + www.mountainartcenter.org */} VOLUNTEER WAIVER Release Agreement & Emergency Contact Information @@ -316,44 +321,56 @@ const styles = StyleSheet.create({ headerContainer: { flexDirection: 'row', // justifyContent: 'space-between', - justifyContent: 'flex-start', - alignItems: 'center', + justifyContent: 'space-around', + alignItems: 'flex-start',//align logo and Last name/1st init inputs with main content + // width: '105%', + width: '90%', +// paddingHorizontal: "5%" + }, + logoContainer: { + alignItems: 'flex-start', }, headerRight: { //initial identity - marginTop: 100, + marginTop: 50, alignItems: 'flex-line', flexDirection:'row', - marginLeft: 20, +// marginLeft: 20, + // justifyContent:'space-around' }, logo: { - marginTop: 100, + marginTop: 50, width: 150, height: 50, - marginRight: 20, //distance between logo and init identity + // marginRight: 20, //distance between logo and init identity + flexDirection: 'row', + alignItems: 'flex-start', + resizeMode: 'contain' }, inputContainer: { // marginBottom: 10, - width: 70, - marginLeft: 20, + width: 60, + marginLeft: 10, + justifyContent: "space-around", + marginRight: -6 }, inputLabel: { marginBottom: 5, - fontSize: 14, + marginLeft: 5, + fontSize: 10, color: '#333', fontWeight: 'normal', }, addressText: { fontSize: 8, textAlign: 'left', - marginBottom: 10, - marginRight: 124, + // marginRight: 485, }, scmacEmail: { fontSize: 8, textAlign: 'left', marginBottom: 10, - marginTop: 0.05, - marginRight: 240, + // marginTop: 0.05, + // marginLeft: -600, }, formContainer: { width: '80%', diff --git a/pages/admin/adminIndividualEvent.js b/pages/admin/adminIndividualEvent.js index 7f386b2..dbef4ba 100644 --- a/pages/admin/adminIndividualEvent.js +++ b/pages/admin/adminIndividualEvent.js @@ -9,7 +9,7 @@ import { auth, db } from '../../firebaseConfig'; import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; import { NavigationContainer, useFocusEffect } from '@react-navigation/native'; import { Octicons, Entypo } from '@expo/vector-icons'; -import OptionsMenu from "react-native-options-menu"; +// import OptionsMenu from "react-native-options-menu"; import { createEvent } from '../api/event'; const Tab = createMaterialTopTabNavigator(); diff --git a/pages/admin/adminVolunteers.js b/pages/admin/adminVolunteers.js index 9bade27..d472dd9 100644 --- a/pages/admin/adminVolunteers.js +++ b/pages/admin/adminVolunteers.js @@ -197,7 +197,8 @@ const styles = StyleSheet.create({ filterContainer: { marginTop: 10, padding: 10, - flexDirection: 'row' + flexDirection: 'row', + justifyContent: 'space-around' // adjust filter spacing // backgroundColor: 'rgba(255, 0, 0, 0.3)', }, dateHeader: { @@ -207,6 +208,7 @@ const styles = StyleSheet.create({ }, buttonContainer: { flexDirection: 'row', + justifyContent:'center' }, button: { paddingVertical: 5, @@ -218,6 +220,7 @@ const styles = StyleSheet.create({ color: '#939393', fontSize: 16, fontWeight: 'bold', + }, circle: { width: 40, @@ -228,7 +231,8 @@ const styles = StyleSheet.create({ }, textContainer: { flex: 1, - marginLeft: "5%" + marginLeft: "5%", + justifyContent: 'center' }, name: { fontSize: 16, @@ -245,6 +249,7 @@ const styles = StyleSheet.create({ position: 'absolute', top: -10, right: 0, + // textAlign:'center' }, moreButtonText: { fontSize: 20, @@ -272,10 +277,17 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignContent: 'center', }, + exportButtonContainer: { + flexDirection: 'row', + justifyContent: 'center', + width: "100%", + marginTop: 20, + }, exportButton: { color: 'white', fontSize: 16, fontWeight: 'bold', + }, }); diff --git a/tempCodeRunnerFile.js b/tempCodeRunnerFile.js new file mode 100644 index 0000000..9fb75b8 --- /dev/null +++ b/tempCodeRunnerFile.js @@ -0,0 +1 @@ +E \ No newline at end of file From e2114919e629f1cf20a474e2b37e3085f614c92c Mon Sep 17 00:00:00 2001 From: Vanessa Huynh Date: Thu, 30 May 2024 14:15:04 -0700 Subject: [PATCH 2/3] fixed waiver functioning --- App.js | 2 +- pages/Waiver.js | 214 +++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 184 insertions(+), 32 deletions(-) diff --git a/App.js b/App.js index 9531e41..1bca7bb 100644 --- a/App.js +++ b/App.js @@ -24,7 +24,7 @@ export default function App() { // persistence: getReactNativePersistence(ReactNativeAsyncStorage) //async-storage in Waiver page return ( - + diff --git a/pages/Waiver.js b/pages/Waiver.js index f8a8397..fc3d90e 100644 --- a/pages/Waiver.js +++ b/pages/Waiver.js @@ -2,8 +2,10 @@ import Checkbox from 'expo-checkbox'; import React, { useEffect, useState } from 'react'; import { ScrollView, View, Text, TextInput, TouchableOpacity, StyleSheet, Image, CheckBox, Alert } from 'react-native'; import { addWaiver } from "./api/waivers.js" +import { collection, addDoc } from 'firebase/firestore'; import { doc, getDoc } from 'firebase/firestore'; import { auth, db } from '../firebaseConfig'; +import { getAuth } from 'firebase/auth'; export default function Waiver({route, navigation}) { const [lastName, setLastName] = useState(''); @@ -34,47 +36,197 @@ export default function Waiver({route, navigation}) { const [isChecked, setIsChecked] = useState(false); const [uid, setUid] = useState(''); - // await and async? - const handleSubmit = () => { - // Firebase + // useEffect(() => { + // async function fetchData() { + // if (route.params && route.params.item) { + // const { item } = route.params; + // setUid(item.uid); + // const userRef = await getDoc(doc(db, "users", item.uid)); + + // if (userRef.exists()) { + // const userData = userRef.data(); + // console.log("User Data:", userData); + // setLastName(userData.lname); + // setFirstInitial(userData.fname[0]); + // setVolunteerName(`${userData.fname} ${userData.lname}`); + // setVolunteerEmail(userData.email); + // setVolunteerPhoneCell(userData.phone); + // } else { + // console.error("User document does not exist!"); + // } + // } else { + // console.error("Route parameters are missing!"); + // } + // } + // fetchData(); + // }, [route.params]); + + // const handleSubmit = async () => { + // if (isChecked) { + // console.log("lastName:", lastName); + // console.log("firstInitial:", firstInitial); + // console.log("volunteerName:", volunteerName); + // console.log("volunteerEmail:", volunteerEmail); + // console.log("volunteerPhoneCell:", volunteerPhoneCell); + // console.log("homeAddress:", homeAddress); + // console.log("homeCity:", homeCity); + // console.log("homeZip:", homeZip); + // console.log("mailingAddress:", mailingAddress); + // console.log("mailingCity:", mailingCity); + // console.log("mailingZip:", mailingZip); + // console.log("emergencyContactName:", emergencyContactName); + // console.log("emergencyContactRelationship:", emergencyContactRelationship); + // console.log("emergencyContactPhoneCell:", emergencyContactPhoneCell); + // console.log("emergencyContactPhoneHome:", emergencyContactPhoneHome); + // console.log("volunteerAgreement:", volunteerAgreement); + // console.log("volunteerDate:", volunteerDate); + + // if ( + // lastName && firstInitial && volunteerName && volunteerEmail && volunteerPhoneCell && + // homeAddress && homeCity && homeZip && mailingAddress && mailingCity && mailingZip && + // emergencyContactName && emergencyContactRelationship && emergencyContactPhoneCell && + // emergencyContactPhoneHome && volunteerAgreement && volunteerDate && + // lastName.trim() && firstInitial.trim() && volunteerName.trim() && volunteerEmail.trim() && volunteerPhoneCell.trim() && + // homeAddress.trim() && homeCity.trim() && homeZip.trim() && mailingAddress.trim() && mailingCity.trim() && mailingZip.trim() && + // emergencyContactName.trim() && emergencyContactRelationship.trim() && emergencyContactPhoneCell.trim() && + // emergencyContactPhoneHome.trim() && volunteerAgreement.trim() && volunteerDate.trim() + // ) { + // try { + // const waiverData = { + // emergencyContactName, + // emergencyContactPhoneCell, + // emergencyContactPhoneHome, + // emergencyContactRelationship, + // firstInitial, + // homeAddress, + // homeCity, + // homeZip, + // lastName, + // mailingAddress, + // mailingCity, + // mailingZip, + // parentGuardianAddress, + // parentGuardianEmail, + // parentGuardianName, + // parentGuardianSignature, + // volunteerDate, + // volunteerEmail, + // volunteerName, + // volunteerPhoneCell, + // volunteerPhoneHome, + // volunteerSignature, + // }; + + // await addWaiver(uid, waiverData); + // navigation.navigate("Events"); + // } catch (error) { + // console.error("Error submitting waiver:", error); + // Alert.alert("Error submitting waiver. Please try again."); + // } + // } else { + // Alert.alert("Please fill out all required fields."); + // } + // } else { + // Alert.alert("Please agree to the Terms and Conditions"); + // } + // }; + useEffect(() => { + const auth = getAuth(); + const user = auth.currentUser; + if (user) { + setUid(user.uid); + } + }, []); + + const handleSubmit = async () => { if (isChecked) { - if (lastName || firstInitial || volunteerName || volunteerEmail || volunteerPhoneCell || volunteerPhoneHome - || homeAddress || homeCity || homeZip || mailingAddress || mailingCity || mailingZip || emergencyContactName - || emergencyContactRelationship || emergencyContactPhoneCell || emergencyContactPhoneHome || volunteerAgreement - || volunteerDate) { - addWaiver(uid, emergencyContactName, emergencyContactPhoneCell, emergencyContactPhoneHome, - emergencyContactRelationship, firstInitial, homeAddress, homeCity, homeZip, lastName, - mailingAddress, mailingCity, mailingZip, parentGuardianAddress, parentGuardianEmail, - parentGuardianName, parentGuardianSignature, volunteerDate, volunteerEmail, volunteerName, - volunteerPhoneCell, volunteerPhoneHome, volunteerSignature); + const waiverData = { + uid, // Include uid in the waiver data + emergencyContactName, + emergencyContactPhoneCell, + emergencyContactPhoneHome, + emergencyContactRelationship, + firstInitial, + homeAddress, + homeCity, + homeZip, + lastName, + mailingAddress, + mailingCity, + mailingZip, + parentGuardianAddress, + parentGuardianEmail, + parentGuardianName, + parentGuardianSignature, + volunteerDate, + volunteerEmail, + volunteerName, + volunteerPhoneCell, + volunteerPhoneHome, + volunteerSignature, + }; + + const hasData = Object.values(waiverData).some(value => value && value.trim()); + + if (hasData) { + try { + await addDoc(collection(db, "waivers"), waiverData); + Alert.alert("Waiver submitted successfully!"); navigation.navigate("Events"); + } catch (error) { + console.error("Error submitting waiver:", error); + Alert.alert("Error submitting waiver. Please try again."); + } + } else { + Alert.alert("Please fill out at least one field."); } - } - else { + } else { Alert.alert("Please agree to the Terms and Conditions"); } }; - useEffect( () => { - async function fetchData() { - const { item } = route.params; - setUid(item.uid); - console.log(item.uid); +// // await and async? +// const handleSubmit = () => { +// // Firebase +// if (isChecked) { +// if (lastName || firstInitial || volunteerName || volunteerEmail || volunteerPhoneCell || volunteerPhoneHome +// || homeAddress || homeCity || homeZip || mailingAddress || mailingCity || mailingZip || emergencyContactName +// || emergencyContactRelationship || emergencyContactPhoneCell || emergencyContactPhoneHome || volunteerAgreement +// || volunteerDate) { +// addWaiver(uid, emergencyContactName, emergencyContactPhoneCell, emergencyContactPhoneHome, +// emergencyContactRelationship, firstInitial, homeAddress, homeCity, homeZip, lastName, +// mailingAddress, mailingCity, mailingZip, parentGuardianAddress, parentGuardianEmail, +// parentGuardianName, parentGuardianSignature, volunteerDate, volunteerEmail, volunteerName, +// volunteerPhoneCell, volunteerPhoneHome, volunteerSignature); +// navigation.navigate("Events"); +// } +// } +// else { +// Alert.alert("Please agree to the Terms and Conditions"); +// } +// }; + +// useEffect( () => { +// async function fetchData() { +// const { item } = route.params; +// setUid(item.uid); +// console.log(item.uid); - const userRef = await getDoc(doc(db, "users", item.uid)); +// const userRef = await getDoc(doc(db, "users", item.uid)); - setLastName(userRef.data().lname); - setFirstInitial(userRef.data().fname[0]); - setVolunteerName(userRef.data().fname + " " + userRef.data().lname); - setVolunteerEmail(userRef.data().email); - setVolunteerPhoneCell(userRef.data().phone); +// setLastName(userRef.data().lname); +// setFirstInitial(userRef.data().fname[0]); +// setVolunteerName(userRef.data().fname + " " + userRef.data().lname); +// setVolunteerEmail(userRef.data().email); +// setVolunteerPhoneCell(userRef.data().phone); + +// // cpontinue doing all the fields from signup!!! slay +// // const event = item; +// // const eventData = event.data(); +// } +// fetchData(); +// }, []) - // cpontinue doing all the fields from signup!!! slay - // const event = item; - // const eventData = event.data(); - } - fetchData(); - }, []) return ( From 42bc6564f6d48b984862f5deb414e39349bd8290 Mon Sep 17 00:00:00 2001 From: Vanessa Huynh Date: Thu, 30 May 2024 14:17:32 -0700 Subject: [PATCH 3/3] fixed Waiver functioning --- pages/Waiver.js | 94 ------------------------------------------------- 1 file changed, 94 deletions(-) diff --git a/pages/Waiver.js b/pages/Waiver.js index fc3d90e..090b906 100644 --- a/pages/Waiver.js +++ b/pages/Waiver.js @@ -36,100 +36,6 @@ export default function Waiver({route, navigation}) { const [isChecked, setIsChecked] = useState(false); const [uid, setUid] = useState(''); - // useEffect(() => { - // async function fetchData() { - // if (route.params && route.params.item) { - // const { item } = route.params; - // setUid(item.uid); - // const userRef = await getDoc(doc(db, "users", item.uid)); - - // if (userRef.exists()) { - // const userData = userRef.data(); - // console.log("User Data:", userData); - // setLastName(userData.lname); - // setFirstInitial(userData.fname[0]); - // setVolunteerName(`${userData.fname} ${userData.lname}`); - // setVolunteerEmail(userData.email); - // setVolunteerPhoneCell(userData.phone); - // } else { - // console.error("User document does not exist!"); - // } - // } else { - // console.error("Route parameters are missing!"); - // } - // } - // fetchData(); - // }, [route.params]); - - // const handleSubmit = async () => { - // if (isChecked) { - // console.log("lastName:", lastName); - // console.log("firstInitial:", firstInitial); - // console.log("volunteerName:", volunteerName); - // console.log("volunteerEmail:", volunteerEmail); - // console.log("volunteerPhoneCell:", volunteerPhoneCell); - // console.log("homeAddress:", homeAddress); - // console.log("homeCity:", homeCity); - // console.log("homeZip:", homeZip); - // console.log("mailingAddress:", mailingAddress); - // console.log("mailingCity:", mailingCity); - // console.log("mailingZip:", mailingZip); - // console.log("emergencyContactName:", emergencyContactName); - // console.log("emergencyContactRelationship:", emergencyContactRelationship); - // console.log("emergencyContactPhoneCell:", emergencyContactPhoneCell); - // console.log("emergencyContactPhoneHome:", emergencyContactPhoneHome); - // console.log("volunteerAgreement:", volunteerAgreement); - // console.log("volunteerDate:", volunteerDate); - - // if ( - // lastName && firstInitial && volunteerName && volunteerEmail && volunteerPhoneCell && - // homeAddress && homeCity && homeZip && mailingAddress && mailingCity && mailingZip && - // emergencyContactName && emergencyContactRelationship && emergencyContactPhoneCell && - // emergencyContactPhoneHome && volunteerAgreement && volunteerDate && - // lastName.trim() && firstInitial.trim() && volunteerName.trim() && volunteerEmail.trim() && volunteerPhoneCell.trim() && - // homeAddress.trim() && homeCity.trim() && homeZip.trim() && mailingAddress.trim() && mailingCity.trim() && mailingZip.trim() && - // emergencyContactName.trim() && emergencyContactRelationship.trim() && emergencyContactPhoneCell.trim() && - // emergencyContactPhoneHome.trim() && volunteerAgreement.trim() && volunteerDate.trim() - // ) { - // try { - // const waiverData = { - // emergencyContactName, - // emergencyContactPhoneCell, - // emergencyContactPhoneHome, - // emergencyContactRelationship, - // firstInitial, - // homeAddress, - // homeCity, - // homeZip, - // lastName, - // mailingAddress, - // mailingCity, - // mailingZip, - // parentGuardianAddress, - // parentGuardianEmail, - // parentGuardianName, - // parentGuardianSignature, - // volunteerDate, - // volunteerEmail, - // volunteerName, - // volunteerPhoneCell, - // volunteerPhoneHome, - // volunteerSignature, - // }; - - // await addWaiver(uid, waiverData); - // navigation.navigate("Events"); - // } catch (error) { - // console.error("Error submitting waiver:", error); - // Alert.alert("Error submitting waiver. Please try again."); - // } - // } else { - // Alert.alert("Please fill out all required fields."); - // } - // } else { - // Alert.alert("Please agree to the Terms and Conditions"); - // } - // }; useEffect(() => { const auth = getAuth(); const user = auth.currentUser;