Skip to content
Open
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
2 changes: 1 addition & 1 deletion App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function App() {
// persistence: getReactNativePersistence(ReactNativeAsyncStorage) //async-storage in Waiver page
return (
<NavigationContainer independent={true}>
<Stack.Navigator initialRouteName='Login'>
<Stack.Navigator initialRouteName='Waiver'>
<Stack.Screen name="Login" component={Login} options={{ headerShown: false, gestureEnabled: false }} />
<Stack.Screen name="Signup" component={Signup} options={{ headerShown: false, gestureEnabled: false }} />
<Stack.Screen name="Profile" component={Profile} options={{ animationEnabled: false, headerShown: false, gestureEnabled: false }} />
Expand Down
169 changes: 122 additions & 47 deletions pages/Waiver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
Expand Down Expand Up @@ -34,52 +36,113 @@ export default function Waiver({route, navigation}) {
const [isChecked, setIsChecked] = useState(false);
const [uid, setUid] = useState('');

// await and async?
const handleSubmit = () => {
// Firebase
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 (
<ScrollView contentContainerStyle={styles.container}>
<View style={styles.headerContainer}>
<Image source={require('../assets/scmac-logo.png')} style={styles.logo} />
{/* <Image source={require('../assets/scmac-logo.png')} style={styles.logo} /> */}
<View style={styles.logoContainer}>
<Image source={require('../assets/scmac-logo.png')} style={styles.logo} />
<Text style={styles.addressText}>9341 Mill Street, Ben Lomond, CA 95005 831-336-3513</Text>
<Text style={styles.scmacEmail}>www.mountainartcenter.org</Text>
</View>
<View style={styles.headerRight}>
<View style={styles.inputContainer}>
<Text style={styles.inputLabel}>Last Name </Text>
Expand All @@ -99,8 +162,8 @@ export default function Waiver({route, navigation}) {
</View>
</View>
</View>
<Text style={styles.addressText}>9341 Mill Street, Ben Lomond, CA 95005 831-336-3513</Text>
<Text style={styles.scmacEmail}>www.mountainartcenter.org</Text>
{/* <Text style={styles.addressText}>9341 Mill Street, Ben Lomond, CA 95005 831-336-3513</Text>
<Text style={styles.scmacEmail}>www.mountainartcenter.org</Text> */}
<Text style={styles.title}>VOLUNTEER WAIVER</Text>
<Text style={styles.subtitle}>Release Agreement & Emergency Contact Information</Text>
<View style={styles.formContainer}>
Expand Down Expand Up @@ -316,44 +379,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%',
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/adminIndividualEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 14 additions & 2 deletions pages/admin/adminVolunteers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -207,6 +208,7 @@ const styles = StyleSheet.create({
},
buttonContainer: {
flexDirection: 'row',
justifyContent:'center'
},
button: {
paddingVertical: 5,
Expand All @@ -218,6 +220,7 @@ const styles = StyleSheet.create({
color: '#939393',
fontSize: 16,
fontWeight: 'bold',

},
circle: {
width: 40,
Expand All @@ -228,7 +231,8 @@ const styles = StyleSheet.create({
},
textContainer: {
flex: 1,
marginLeft: "5%"
marginLeft: "5%",
justifyContent: 'center'
},
name: {
fontSize: 16,
Expand All @@ -245,6 +249,7 @@ const styles = StyleSheet.create({
position: 'absolute',
top: -10,
right: 0,
// textAlign:'center'
},
moreButtonText: {
fontSize: 20,
Expand Down Expand Up @@ -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',

},
});

Expand Down
1 change: 1 addition & 0 deletions tempCodeRunnerFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
E