diff --git a/routes/ADrawer.js b/routes/ADrawer.js index 2617974..5b2e7f9 100644 --- a/routes/ADrawer.js +++ b/routes/ADrawer.js @@ -1,185 +1,185 @@ -import React,{useState} from 'react' -import {StyleSheet, Text, View, TouchableOpacity,Dimensions, Alert} from 'react-native' -import MIcon from 'react-native-vector-icons/MaterialIcons' -import MCIcon from 'react-native-vector-icons/MaterialCommunityIcons' -import {SafeAreaView, NavigationActions} from 'react-navigation' -import firebase from '../assets/DatabaseConfig' - -export default function CustomerDrawer({navigation}) { - - const [screen, setScreen]=useState('Home') - - // console.log(navigation.dangerouslyGetParent().state.routes[1]) - - // console.log(navigation.state.routes[1].key) - navigateToScreen = ( route ) =>( - () => { - navigation.dispatch(NavigationActions.navigate({routeName:route})); - setScreen(route) - }) - - function onSignoutPress() { - // console.log("meow") - Alert.alert( - "Logout", - "Are you sure you want to logout?", - [ - { - text: "Yes", - onPress: ()=>{ - firebase.auth().signOut() - .then(() => { - navigation.navigate("LoginStack") - }) - .catch(function(error) { - alert(error) - }) - } - }, - { - text: "No", - // onPress: ()=> {console.log("NO")}, - } - ] - , {cancelable: false} - ) - } - - return( - - - - - - - Hello {navigation.getParam('user')} - - - - - - - {/* {navigation.state.routes.map((item)=>console.log(item.key))} */} - Home - - - - - - - Profile - - - - - - - Orders - - - - - - - Customers - - - - - - {}} activeOpacity={0.3}> - - - Shutdown - - - - - - - Sign out - - - - - - ) - -} - -const styles=StyleSheet.create({ - Safe: { - backgroundColor:'#ffffff' - }, - - HeaderImage: { - width:'100%', - height:Dimensions.get('window').height/4, - backgroundColor:"#d00f16", - justifyContent:'flex-end' - }, - - HeaderText:{ - fontFamily:'Roboto-Bold', - color:'#ffffff', - fontSize:24, - paddingLeft:16, - paddingBottom:16, - paddingTop:8 - }, - - TextDraw:{ - paddingTop:16, - paddingBottom:16, - paddingLeft:32, - color:"rgba(00,00,00,1)", - fontFamily:'Roboto-Medium', - fontSize:14, - alignSelf:'center', - }, - - MatIcon:{ - paddingLeft:8, - color:"#ffffff", - }, - - FAIcon:{ - paddingLeft:16, - paddingTop:12, - paddingBottom:12, - color:"rgba(00,00,00,0.58)" - }, - - TouchOpp:{ - flexDirection:'row', - alignItems:'center', - justifyContent:'flex-start', - }, - - lineStyle:{ - borderWidth: 1, - borderColor:'rgba(00,00,00,0.12)', - marginTop:Dimensions.get('window').height-560, - marginBottom:8, - alignSelf:'center', - width:Dimensions.get('window').width/1.6 - }, - - Active:{ - backgroundColor:'rgba(208,15,22,0.15)' - - }, - - ActiveText:{ - color:'#d00f16' - }, - - ActiveLogo:{ - color:'#d00f16' - } - - - - - +import React,{useState} from 'react' +import {StyleSheet, Text, View, TouchableOpacity,Dimensions, Alert} from 'react-native' +import MIcon from 'react-native-vector-icons/MaterialIcons' +import MCIcon from 'react-native-vector-icons/MaterialCommunityIcons' +import {SafeAreaView, NavigationActions} from 'react-navigation' +import firebase from '../assets/DatabaseConfig' + +export default function CustomerDrawer({navigation}) { + + const [screen, setScreen]=useState('Home') + + // console.log(navigation.dangerouslyGetParent().state.routes[1]) + + // console.log(navigation.state.routes[1].key) + navigateToScreen = ( route ) =>( + () => { + navigation.dispatch(NavigationActions.navigate({routeName:route})); + setScreen(route) + }) + + function onSignoutPress() { + // console.log("meow") + Alert.alert( + "Logout", + "Are you sure you want to logout?", + [ + { + text: "Yes", + onPress: ()=>{ + firebase.auth().signOut() + .then(() => { + navigation.navigate("LoginStack") + }) + .catch(function(error) { + alert(error) + }) + } + }, + { + text: "No", + // onPress: ()=> {console.log("NO")}, + } + ] + , {cancelable: false} + ) + } + + return( + + + + + + + Hello {navigation.getParam('user')} + + + + + + + {/* {navigation.state.routes.map((item)=>console.log(item.key))} */} + Home + + + + + + + Profile + + + + + + + Orders + + + + + + + Customers + + + + + + {}} activeOpacity={0.3}> + + + Shutdown + + + + + + + Sign out + + + + + + ) + +} + +const styles=StyleSheet.create({ + Safe: { + backgroundColor:'#ffffff' + }, + + HeaderImage: { + width:'100%', + height:Dimensions.get('window').height/4, + backgroundColor:"#d00f16", + justifyContent:'flex-end' + }, + + HeaderText:{ + fontFamily:'Roboto-Bold', + color:'#ffffff', + fontSize:24, + paddingLeft:16, + paddingBottom:16, + paddingTop:8 + }, + + TextDraw:{ + paddingTop:16, + paddingBottom:16, + paddingLeft:32, + color:"rgba(00,00,00,1)", + fontFamily:'Roboto-Medium', + fontSize:14, + alignSelf:'center', + }, + + MatIcon:{ + paddingLeft:8, + color:"#ffffff", + }, + + FAIcon:{ + paddingLeft:16, + paddingTop:12, + paddingBottom:12, + color:"rgba(00,00,00,0.58)" + }, + + TouchOpp:{ + flexDirection:'row', + alignItems:'center', + justifyContent:'flex-start', + }, + + lineStyle:{ + borderWidth: 1, + borderColor:'rgba(00,00,00,0.12)', + marginTop:Dimensions.get('window').height-560, + marginBottom:8, + alignSelf:'center', + width:Dimensions.get('window').width/1.6 + }, + + Active:{ + backgroundColor:'rgba(208,15,22,0.15)' + + }, + + ActiveText:{ + color:'#d00f16' + }, + + ActiveLogo:{ + color:'#d00f16' + } + + + + + }) \ No newline at end of file diff --git a/routes/AdminDrawer.js b/routes/AdminDrawer.js index 198e128..c29be34 100644 --- a/routes/AdminDrawer.js +++ b/routes/AdminDrawer.js @@ -1,184 +1,184 @@ -import { createDrawerNavigator} from 'react-navigation-drawer'; -import {Dimensions} from 'react-native' -// import { createStackNavigator } from 'react-navigation-stack'; -// import { createAppContainer } from 'react-navigation'; -// import Login from '../screens/Login'; -// import Registration from '../screens/Registration'; -// import Forgotpwemail from '../screens/Forgotpwemail'; -// import Home from '../screens/Home'; -// import Kitchen from '../screens/Kitchen'; -// import Store from '../screens/Store'; -// import AdminMenu from '../screens/AdminMenu'; -// import CustMenu from '../screens/CustMenu'; -// import Pending_Order_Admin from '../screens/Pending_Order_Admin'; -// import PendingOrdersList from '../screens/PendingOrdersList'; -// import RedemptionPoints from '../screens/RedemptionPoints'; -// import Signout from '../screens/Signout'; -// import Subcategory from '../screens/Subcategory'; -// import Customer_Profile from '../screens/Customer_Profile'; -// import change_password_customer from '../screens/change_password_customer'; -// import Forgotpw from '../screens/Forgotpw'; -// import Change_Password from '../screens/ChangePassword'; -import React from 'react'; -// import { Button } from 'react-native'; -import OrderStack from './OrderStack'; -// import LoginStack from './LoginStack'; -import RedemptionStack from './RedemptionStack'; -import AdminStack from './AdminStack'; -import CustomerStack from './CustomerStack'; -import ProfileStack from './ProfileStack'; -import ADrawer from './ADrawer'; - -// import firebase from '@react-native-firebase/app'; -// import ReviewDetails from '../screens/reviewDetails'; - -const Stacks = { - - Home:{ - screen:AdminStack - }, - - Orders:{ - screen:OrderStack - }, - - Redemption:{ - screen:RedemptionStack, - navigationOptions:{ - title:"Redemption Points" - } - }, - - Customers:{ - screen:CustomerStack - }, - - Profile:{ - screen:ProfileStack - }, - - // Signout: { - // screen:Signout - - // }, - - - - - - - - -// Home: { -// screen: Home, -// navigationOptions:{ -// title: 'LSD', -// headerLeft:() => null, -// // gestureEnabled:true -// } -// }, - -// Login: { -// screen: Login, -// navigationOptions:{ -// headerShown:false -// } -// }, - -// Registration: { -// screen: Registration, -// navigationOptions:{ -// title:null, -// headerTransparent: true -// } -// }, - -// Forgotpwemail: { -// screen: Forgotpwemail, -// navigationOptions:{ -// title:null, -// headerTransparent: true -// } -// }, - -// Home: { -// screen: Home, -// navigationOptions:{ -// title: 'LSD', -// headerLeft:() => null, -// // gestureEnabled:true -// } -// }, - -// Kitchen:{ -// screen:Kitchen - -// }, - -// Store:{ -// screen:Store -// }, - -// CustMenu:{ -// screen:CustMenu -// }, - -// AdminMenu:{ -// screen:AdminMenu -// }, - -// AddItem:{ -// screen: AddItem -// }, - -// UpdateItem:{ -// screen:UpdateItem -// } - - - - // Customer_Profile: { - // screen: Customer_Profile, - // navigationOptions:{ - // headerShown:false - // } - // }, - - // change_password_customer: { - // screen: change_password_customer, - // }, - -}; - -// home stack navigator screens -const AdminDrawer = createDrawerNavigator(Stacks, - { - drawerWidth:Dimensions.get('window').width-120, - contentComponent: ADrawer, - gesturesEnabled: false, - edgeWidth:0 - } -) -// , { -// defaultNavigationOptions: { -// headerTintColor: '#444', -// headerStyle: { -// backgroundColor: '#d00f16', -// height: 60, -// shadowColor: "black", -// shadowOffset: { -// width: 0, -// height: 2, -// }, -// shadowOpacity: 0.9, -// shadowRadius: 1.50, -// elevation: 3, -// }, - - - -// } -// }); - -// export default createAppContainer(HomeStack); +import { createDrawerNavigator} from 'react-navigation-drawer'; +import {Dimensions} from 'react-native' +// import { createStackNavigator } from 'react-navigation-stack'; +// import { createAppContainer } from 'react-navigation'; +// import Login from '../screens/Login'; +// import Registration from '../screens/Registration'; +// import Forgotpwemail from '../screens/Forgotpwemail'; +// import Home from '../screens/Home'; +// import Kitchen from '../screens/Kitchen'; +// import Store from '../screens/Store'; +// import AdminMenu from '../screens/AdminMenu'; +// import CustMenu from '../screens/CustMenu'; +// import Pending_Order_Admin from '../screens/Pending_Order_Admin'; +// import PendingOrdersList from '../screens/PendingOrdersList'; +// import RedemptionPoints from '../screens/RedemptionPoints'; +// import Signout from '../screens/Signout'; +// import Subcategory from '../screens/Subcategory'; +// import Customer_Profile from '../screens/Customer_Profile'; +// import change_password_customer from '../screens/change_password_customer'; +// import Forgotpw from '../screens/Forgotpw'; +// import Change_Password from '../screens/ChangePassword'; +import React from 'react'; +// import { Button } from 'react-native'; +import OrderStack from './OrderStack'; +// import LoginStack from './LoginStack'; +import RedemptionStack from './RedemptionStack'; +import AdminStack from './AdminStack'; +import CustomerStack from './CustomerStack'; +import ProfileStack from './ProfileStack'; +import ADrawer from './ADrawer'; + +// import firebase from '@react-native-firebase/app'; +// import ReviewDetails from '../screens/reviewDetails'; + +const Stacks = { + + Home:{ + screen:AdminStack + }, + + Orders:{ + screen:OrderStack + }, + + Redemption:{ + screen:RedemptionStack, + navigationOptions:{ + title:"Redemption Points" + } + }, + + Customers:{ + screen:CustomerStack + }, + + Profile:{ + screen:ProfileStack + }, + + // Signout: { + // screen:Signout + + // }, + + + + + + + + +// Home: { +// screen: Home, +// navigationOptions:{ +// title: 'LSD', +// headerLeft:() => null, +// // gestureEnabled:true +// } +// }, + +// Login: { +// screen: Login, +// navigationOptions:{ +// headerShown:false +// } +// }, + +// Registration: { +// screen: Registration, +// navigationOptions:{ +// title:null, +// headerTransparent: true +// } +// }, + +// Forgotpwemail: { +// screen: Forgotpwemail, +// navigationOptions:{ +// title:null, +// headerTransparent: true +// } +// }, + +// Home: { +// screen: Home, +// navigationOptions:{ +// title: 'LSD', +// headerLeft:() => null, +// // gestureEnabled:true +// } +// }, + +// Kitchen:{ +// screen:Kitchen + +// }, + +// Store:{ +// screen:Store +// }, + +// CustMenu:{ +// screen:CustMenu +// }, + +// AdminMenu:{ +// screen:AdminMenu +// }, + +// AddItem:{ +// screen: AddItem +// }, + +// UpdateItem:{ +// screen:UpdateItem +// } + + + + // Customer_Profile: { + // screen: Customer_Profile, + // navigationOptions:{ + // headerShown:false + // } + // }, + + // change_password_customer: { + // screen: change_password_customer, + // }, + +}; + +// home stack navigator screens +const AdminDrawer = createDrawerNavigator(Stacks, + { + drawerWidth:Dimensions.get('window').width-120, + contentComponent: ADrawer, + gesturesEnabled: false, + edgeWidth:0 + } +) +// , { +// defaultNavigationOptions: { +// headerTintColor: '#444', +// headerStyle: { +// backgroundColor: '#d00f16', +// height: 60, +// shadowColor: "black", +// shadowOffset: { +// width: 0, +// height: 2, +// }, +// shadowOpacity: 0.9, +// shadowRadius: 1.50, +// elevation: 3, +// }, + + + +// } +// }); + +// export default createAppContainer(HomeStack); export default AdminDrawer; \ No newline at end of file diff --git a/routes/AdminStack.js b/routes/AdminStack.js index fda45d8..6b2766e 100644 --- a/routes/AdminStack.js +++ b/routes/AdminStack.js @@ -1,177 +1,177 @@ -import { createStackNavigator } from 'react-navigation-stack'; -import { createAppContainer } from 'react-navigation'; -import Login from '../screens/Login'; -import Registration from '../screens/Registration'; -import Forgotpwemail from '../screens/Forgotpwemail'; -import Home from '../screens/Home'; -import Kitchen from '../screens/Kitchen'; -import Store from '../screens/Store'; -import AdminMenu from '../screens/AdminMenu'; -import CustMenu from '../screens/CustMenu'; -import Pending_Order_Admin from '../screens/Pending_Order_Admin'; -// import Subcategory from '../screens/Subcategory'; -import Customer_Profile from '../screens/Customer_Profile'; -import change_password_customer from '../screens/change_password_customer'; -// import Forgotpw from '../screens/Forgotpw'; -// import Change_Password from '../screens/ChangePassword'; -import React from 'react'; -import { Button } from 'react-native'; -import AddItem from '../screens/AddItem' -import UpdateItem from '../screens/UpdateItem' -import Icon from 'react-native-vector-icons/MaterialIcons'; -import { TouchableOpacity } from 'react-native-gesture-handler'; -// import firebase from '@react-native-firebase/app'; -// import ReviewDetails from '../screens/reviewDetails'; - -const screens = { - -// Home: { -// screen: Home, -// navigationOptions:{ -// title: 'LSD', -// headerLeft:() => null, -// // gestureEnabled:true -// } -// }, - -// Login: { -// screen: Login, -// navigationOptions:{ -// headerShown:false -// } -// }, - -// Registration: { -// screen: Registration, -// navigationOptions:{ -// title:null, -// headerTransparent: true -// } -// }, - -// Forgotpwemail: { -// screen: Forgotpwemail, -// navigationOptions:{ -// title:null, -// headerTransparent: true -// } -// }, - - Home: { - screen: Home, - navigationOptions:({navigation})=>{ - - return{ - title: 'Home', - headerTintColor:'white', - headerLeft:() => ( - navigation.toggleDrawer()} - // title="Info" - // color="#e8e8e8" - style={{paddingLeft:16}} - > - - - - - ), - } - } - - // gestureEnabled:true - // headerLeft: () => ( - // - - - - - ); -} - - -const styles = StyleSheet.create({ - // confirmbutton: { - // flexDirection: 'row', - // // width: "30%", - // padding: 50, - // alignItems: 'center', - // justifyContent: 'center', - // }, - Screen: { - // flexDirection: "column", - height: '100%', - padding: '10%', - backgroundColor: '#d3d3d3', - - // flex: '20%', - }, +import React from "react"; +import { StyleSheet, Alert, View, ImageBackground, Image, TextInput, Button, TouchableOpacity, } from "react-native"; +import LoginStack from '../routes/LoginStack'; +import firebase from "../assets/DatabaseConfig" ; +import auth from "@react-native-firebase/auth" ; +import database from "@react-native-firebase/database" ; + + +export default function Shopping({navigation}) { + + function onSignoutPress() { + console.log("meow") + Alert.alert( + "Logout", + "Are you sure you want to logout?" + [ + { + text: "Yes", + onPress: ()=>{ + firebase.auth().signOut() + .then(() => { + navigation.navigate("LoginStack") + }) + .catch(function(error) { + // console.log(error) + alert(error) + }) + } + }, + { + text: "No", + onPress: ()=> {console.log("NO")}, + } + ], {cancelable: false} + ) + } + + return ( + + + + + + + + ); +} + + +const styles = StyleSheet.create({ + // confirmbutton: { + // flexDirection: 'row', + // // width: "30%", + // padding: 50, + // alignItems: 'center', + // justifyContent: 'center', + // }, + Screen: { + // flexDirection: "column", + height: '100%', + padding: '10%', + backgroundColor: '#d3d3d3', + + // flex: '20%', + }, }); \ No newline at end of file diff --git a/screens/Store.js b/screens/Store.js index 832506f..2b89848 100644 --- a/screens/Store.js +++ b/screens/Store.js @@ -1,211 +1,211 @@ -import React, {useState} from 'react'; -// import { AppLoading } from 'expo'; -// import Navigator from './route/NavigDraw' -import { - StyleSheet, - Text, - View, - Image, - ImageBackground, - Dimensions, - TouchableOpacity, - Button, - ScrollView, -} from 'react-native'; -import firebase from '../assets/DatabaseConfig'; -import auth from '@react-native-firebase/auth'; -import database from '@react-native-firebase/database'; - -export default function Store({navigation}) { - // const [product, setProduct] = useState([ {name: 'ribbon'} ]); - const [SubCat, setSubCat] = useState([ - {Sub: 'Stationery', Cat: 'Store'}, - {Sub: 'Beverages', Cat: 'Store'}, - {Sub: 'Grooming', Cat: 'Store'}, - {Sub: 'Grocery', Cat: 'Store'}, - {Sub: 'Electronics', Cat: 'Store'}, - ]); - - const handleStationary = () => { - // setSubCat("Stationery") - email = firebase.auth().currentUser.email; - mydb = firebase.database().ref('/Users/' + email.substr(0, 8)); - mydb.once('value').then(function(snapshot) { - custflag = snapshot.child('Customerflag').val(); - if (custflag) { - navigation.navigate('CustMenu', SubCat[0]); - } else { - navigation.navigate('AdminMenu', SubCat[0]); - } - }); - }; - - const handleBeverages = () => { - // setSubCat("Stationery") - email = firebase.auth().currentUser.email; - mydb = firebase.database().ref('/Users/' + email.substr(0, 8)); - mydb.once('value').then(function(snapshot) { - custflag = snapshot.child('Customerflag').val(); - if (custflag) { - navigation.navigate('CustMenu', SubCat[1]); - } else { - navigation.navigate('AdminMenu', SubCat[1]); - } - }); - }; - - const handleGrooming = () => { - // setSubCat("Stationery") - email = firebase.auth().currentUser.email; - mydb = firebase.database().ref('/Users/' + email.substr(0, 8)); - mydb.once('value').then(function(snapshot) { - custflag = snapshot.child('Customerflag').val(); - if (custflag) { - navigation.navigate('CustMenu', SubCat[2]); - } else { - navigation.navigate('AdminMenu', SubCat[2]); - } - }); - }; - - const handleGrocery = () => { - // setSubCat("Stationery") - email = firebase.auth().currentUser.email; - mydb = firebase.database().ref('/Users/' + email.substr(0, 8)); - mydb.once('value').then(function(snapshot) { - custflag = snapshot.child('Customerflag').val(); - if (custflag) { - navigation.navigate('CustMenu', SubCat[3]); - } else { - navigation.navigate('AdminMenu', SubCat[3]); - } - }); - }; - - const handleElectronics = () => { - // setSubCat("Stationery") - email = firebase.auth().currentUser.email; - mydb = firebase.database().ref('/Users/' + email.substr(0, 8)); - mydb.once('value').then(function(snapshot) { - custflag = snapshot.child('Customerflag').val(); - if (custflag) { - navigation.navigate('CustMenu', SubCat[4]); - } else { - navigation.navigate('AdminMenu', SubCat[4]); - } - }); - }; - - return ( - - - - - Stationery - - - - - - - - Beverages - - - - - - - - Grooming - - - - - - - - Grocery - - - - - {/* - - - - Electronics - - - - */} - - - - - Electronics - - - - - {/*