diff --git a/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver b/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver new file mode 100644 index 0000000..ba9dd7e --- /dev/null +++ b/%ProgramData%/Microsoft/Windows/UUS/State/_active.uusver @@ -0,0 +1 @@ +1215.2401.19022.0 \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..82e6d33 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,9 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + ] +} \ No newline at end of file diff --git a/App.js b/App.js index 1fde61d..774ebe1 100644 --- a/App.js +++ b/App.js @@ -1,25 +1,299 @@ -import 'react-native-gesture-handler' +import 'react-native-gesture-handler'; import { NavigationContainer } from "@react-navigation/native"; +import { Ionicons, FontAwesome5 } from '@expo/vector-icons'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; -// import { NavigationContainer } from '@react-navigation/native'; -// import { createNativeStackNavigator } from '@react-navigation/native-stack'; -import Login from "./Pages/login" -import { View } from 'react-native'; -import { createNativeStackNavigator } from '@react-navigation/native-stack'; +import { createStackNavigator } from '@react-navigation/stack'; +import { TouchableOpacity, View, Text, StyleSheet } from "react-native"; +import { Entypo } from '@expo/vector-icons'; +import React, { useState, useEffect, createContext, useContext } from 'react' +// import SkeletonContent from 'react-native-skeleton-content' +import Login from "./Pages/login"; +import ChangePw from "./Pages/changePw" import AddCourse from "./Pages/AddCourse"; +import DashBoard from "./Pages/Dashboard"; +import StaffDashBoard from "./Pages/StaffDashBoard" +import SignUp from "./Pages/Signup"; +import Notification from './Pages/Notifications'; +import Profile from "./Pages/Profile"; +import Attendence from './Pages/AttendenceManager'; +import ipAddr from "./functions/ip_addr"; +import axios from 'axios'; +import StaffLogin from "./Pages/staffLogin" +import StaffProfile from "./Pages/StaffProfile" +import StaffAttendence from "./Pages/StaffAtt" +import AttendanceDisplay from './Pages/AttDisplay'; +import * as Device from 'expo-device'; +import AsyncStorage from '@react-native-async-storage/async-storage'; +import Schedule from './Pages/Schedule'; +import CoursesDisplay from './Pages/coursesDisplay'; +import registerNNPushToken from 'native-notify'; +import { registerIndieID, unregisterIndieDevice } from 'native-notify'; +// import { registerForPushNotificationsAsync } from './functions/notify_sender'; -const BottomTab = createBottomTabNavigator() -const Stack = createNativeStackNavigator(); + + +const BottomTab = createBottomTabNavigator(); +const Stack = createStackNavigator(); +const LogContext = createContext(null); export default function App() { + registerNNPushToken(19717, '6cGVSWyXY5RoTiF9pUgfiS'); + const [isLoggedIn, setLoggedIn] = useState(false); + const [isStaffLoggedIn, setStaffLoggedIn] = useState(false); + + const [loading, setLoading] = useState(true); + const [expoPushToken, setExpoPushToken] = useState(''); + const makeItTrue = () => { + setStaffLoggedIn(true); + } + + useEffect(() => { + var tok, roll; + async function fetch() { + try { + tok = await AsyncStorage.getItem("token"); + roll = await AsyncStorage.getItem("roll"); + } catch (err) { + console.log("Error in app.js token and roll fetching : ", err.message) + } + if (!tok) { + setLoggedIn(false); + setLoading(false); + console.log("INFO : No Auth token", tok) + return; + } + console.log("INFO: Auth Token is present") + axios({ + url: "http://" + ipAddr + ":3000/auth/verify", + method: "POST", + params: { token: tok } + }).then(res => { + console.log("token verifiction finish") + console.log(res.data) + if (res.data.success) { + if (res.data.isFaculty) { + setStaffLoggedIn(true); + } else { + setLoggedIn(true); + } + } + setLoading(false); + }).catch(err => { + console.log("ERROR: In verifying token", err.message); + setLoading(false); + }) + } + fetch(); + + }, []) return ( - - - - - - + loading ? : + <> + + { + isStaffLoggedIn ? + + + + : (isLoggedIn ? + + + + : + + + ) + } + + + ) +} + +export { LogContext } + +function Loading() { + return ( + + Loading... + + ) +} + +function AfterLoginStaff() { + return ( + <> + ({ + headerRight: () => ( + { + console.log("Notification Pressed"); + navigation.navigate("Notification"); + }} + > + + + ) + })} + > + + + + + + + + + + + + + ) +} + + +function AfterLogin() { + return ( + <> + ({ + headerRight: () => ( + { + console.log("Notification Pressed"); + navigation.navigate("Notification"); + }} + > + + + ) + })} + > + + + + + + + + + + + + ) +} + +function MainScreenStaffs() { + return ( + + } + options={{ + tabBarLabel: "Staff Dashboard", + tabBarIcon: () => (), + headerShown: true, + headerTitle: "Staff Dashboard" + }} + /> + (), + headerShown: true, + headerTitle: "Profile" + }} + /> + + ); +} + +function MainScreen() { + return ( + + } + options={{ + tabBarLabel: "Dashboard", + tabBarIcon: () => (), + headerShown: true, + headerTitle: "Dashboard" + }} + /> + (), + headerShown: true, + headerTitle: "Profile" + }} + /> + + ); +} + +function BeforeLogin() { + return ( + + + } + options={{ + tabBarLabel: "Student Login", + tabBarIcon: () => (), + headerShown: true, + headerTitle: "Student Login", + }} + /> + (), + headerShown: true, + headerTitle: "Register" + }} + /> + } + options={{ + tabBarLabel: "Staff Login", + tabBarIcon: () => (), + headerShown: true, + headerTitle: "Staff Login", + }} + /> + + ) +} + + -} \ No newline at end of file +const styles = StyleSheet.create({ + loadingContainer: { + display: "flex", + justifyContent: "center", + alignItems: "center", + height: "100%" + }, + loadingText: { + fontSize: 22, + fontWeight: "bold" + } +}) \ No newline at end of file diff --git a/Components/Schedule.json b/Components/Schedule.json new file mode 100644 index 0000000..f36f990 --- /dev/null +++ b/Components/Schedule.json @@ -0,0 +1,10 @@ +[ + {"courseNo": 13,"Hour":"1","Subject":"SRP Lab","staff":"Jasmine","location":"KP"}, + {"courseNo": 13,"Hour":"2","Subject":"SRP Lab","staff":"Jasmine","location":"KP"}, + {"courseNo": 13,"Hour":"3","Subject":"Social Network Analysis","staff":"Mala","location":"KP"}, + {"courseNo": 13,"Hour":"4","Subject":"Social Network Analysis","staff":"Mala","location":"KP"}, + {"courseNo": 13,"Hour":"5","Subject":"IOT ","staff":"Selvi Ravindran","location":"KP"}, + {"courseNo": 13,"Hour":"6","Subject":"IOT ","staff":"Selvi Ravindran","location":"KP"}, + {"courseNo": 13,"Hour":"7","Subject":"SRP Lab","staff":"Jasmine","location":"KP"}, + {"courseNo": 13,"Hour":"8","Subject":"SRP Lab","staff":"Jasmine","location":"KP"} +] \ No newline at end of file diff --git a/Components/Skeleton.js b/Components/Skeleton.js new file mode 100644 index 0000000..145781d --- /dev/null +++ b/Components/Skeleton.js @@ -0,0 +1,44 @@ +import { View } from "react-native"; +import { StyleSheet } from "react-native"; +const CardSkeleton = () => { + return ( + + {/* Placeholder card content */} + + + + + ); +}; + +const styles = StyleSheet.create({ + container: { + backgroundColor: '#F6F6F6', + borderRadius: 13, + padding: 16, + marginBottom: 16, + marginTop: 50, + }, + placeholder: { + backgroundColor: '#ccc', + height: 16, + borderRadius: 4, + marginBottom: 8, + }, + card: { + backgroundColor: '#FFFFFF', + borderRadius: 8, + padding: 16, + marginHorizontal: 16, + marginBottom: 16, + marginTop: 50, + shadowColor: '#000', + shadowOpacity: 0.1, + shadowOffset: { width: 0, height: 2 }, + shadowRadius: 4, + elevation: 2, + } +}) + + +export default CardSkeleton \ No newline at end of file diff --git a/Components/att.json b/Components/att.json new file mode 100644 index 0000000..6c0bab7 --- /dev/null +++ b/Components/att.json @@ -0,0 +1,12 @@ +[ + {"subject":"Cloud Computing","totalHours":"45","classMissed":"0","type":"T"}, + {"subject":"Data Analytics","totalHours":"45","classMissed":"3","type":"T"}, + {"subject":"Web Design","totalHours":"45","classMissed":"7","type":"T"}, + {"subject":"Cloud Computing","totalHours":"60","classMissed":"3","type":"L"}, + {"subject":"Data Analytics","totalHours":"45","classMissed":"3","type":"T"}, + {"subject":"Viz","totalHours":"60","classMissed":"1","type":"L"}, + {"subject":"Cloud Computing","totalHours":"45","classMissed":"0","type":"T"}, + {"subject":"Data Analytics","totalHours":"45","classMissed":"3","type":"E"}, + {"subject":"Data Analytics","totalHours":"45","classMissed":"3","type":"T"}, + {"subject":"IOT & Embeeded System","totalHours":"45","classMissed":"0","type":"T"} +] diff --git a/Components/info.json b/Components/info.json new file mode 100644 index 0000000..5aee26e --- /dev/null +++ b/Components/info.json @@ -0,0 +1,5 @@ +[ + {"staff":"Swaminathan","info":"Class Cancelled","detail":"Tuesday 7nd hour class cancelled","date":"16","month":"Feb"}, + {"staff":"Swaminathan","info":"Class Postponed","detail":"Class cancelled due to this reason","date":"16","month":"Feb"}, + {"staff":"Jasmine","info":"Class Venue changed","detail":"Friday 1st hour class venue changed to 2nd floor lab","date":"16","month":"Feb"} +] \ No newline at end of file diff --git a/Components/project id.txt b/Components/project id.txt new file mode 100644 index 0000000..e64c212 --- /dev/null +++ b/Components/project id.txt @@ -0,0 +1,4 @@ +Dhanush "projectId": "63c02ab0-10b2-4529-bee3-7d9dab1a6bc6" + + +Yuvaraj "projectId": "34c13a11-7fb6-4d1c-8400-48c01150a920" diff --git a/Pages/AddCourse.js b/Pages/AddCourse.js index a8e6181..509286c 100644 --- a/Pages/AddCourse.js +++ b/Pages/AddCourse.js @@ -1,42 +1,91 @@ import { StatusBar } from 'expo-status-bar'; -import { useState } from 'react'; +import { useEffect, useState } from 'react'; import { StyleSheet, Text, View, Switch, TextInput, Button, Image, KeyboardAvoidingView } from 'react-native'; -import SearchableDropdown from 'react-native-searchable-dropdown'; +import DropDownPicker from 'react-native-dropdown-picker'; +import ipAddr from "../functions/ip_addr" + import { useNavigation } from '@react-navigation/native'; +import axios from 'axios'; +import { Axios } from 'axios'; +import AsyncStorage from '@react-native-async-storage/async-storage'; export default function App() { const navigate = useNavigation(); const [on, Seton] = useState(true) const [staffs, setStaffs] = useState([ - { id:1, dept: "IT", name: "Selvi Ravindran" }, {id:2, dept: "IT", name: "Swaminathan" } - // "Selvi Ravindran", "Swaminathan" - ]) + { label: 'Selvi Ravindran', value: 'Selvi Ravindran' }, + { label: 'Swaminathan', value: 'Swaminathan' }, + { label: 'Jasmine', value: 'Jasmine' }, + { label: 'Senthil Kumar', value: 'Senthil Kumar' }, + ]); + const [allStaff, setAllStaff] = useState([]) + const [subject, setSubjects] = useState([]) + + useEffect(() => { + getSub() + }, []) + + + const getSub = async () => { + const res = await axios({ + url: `http://${ipAddr}:3000/user/getAllCourses`, + method: "get", + params: { sem: 6 } + }) + //console.log(res.data) + + var subs = [] + var st = [] + + res.data.forEach(subject => { + subs.push({ value: subject._id.courseCode, label: subject._id.name }) + st.push({ value: subject._id.courseCode, staffs: subject.staffs }) + console.log(subject) + }) + setAllStaff(st) + setSubjects(subs) + } + const [courseName, setcourseName] = useState('') const [faculty, setfaculty] = useState('') const [error, setError] = useState({}) - const validateForm = () => { - let error = {} - console.log("length courseName : " + courseName.length + " faculty length : " + faculty.length) - if (courseName == '') error.courseName = "! Please Enter courseName" - if (faculty == '') error.faculty = "! please enter faculty" - setError(error) - console.log(Object.keys(error).length) - return Object.keys(error).length === 0; + const [index, setIndex] = useState(1); + const validateForm = () => { + return true; } - const handleSubmit = () => { + const handleSubmit = async () => { + console.log(value) + console.log(svalue) if (validateForm()) { console.log("done uh"); - navigate.navigate("Profile", { name: courseName }) + const token = await AsyncStorage.getItem("token") + try { + const res = await axios({ + url: `http://${ipAddr}:3000/user/enrollCourse`, + method: "post", + params: { token, courseCode: value, faculty: svalue } + }) + console.log("sucess") + console.log(res.data) + navigate.navigate("CourseDisplay") + } + catch (err) { + console.log(err.message) + } } else { console.log("oh no ") } } + const [open, setOpen] = useState(false); + const [open1, setOpen1] = useState(false); + const [value, setValue] = useState(null); + const [svalue, setSvalue] = useState(null); return ( Add a Course @@ -53,55 +102,43 @@ export default function App() { Course Details - + { + setValue(val) + console.log(allStaff) + const course = allStaff.filter(staff => staff.value === val()); + console.log("Filtered staff for selected value:", course); + const staffsArray = [] + course[0].staffs.forEach(staff => { + staffsArray.push({ label: staff, value: staff }) + }) + console.log(staffsArray) + setStaffs(staffsArray) + } + } + style={styles.input} + setItems={setSubjects} + placeholder={'Select Course'} + /> { error.courseName ? {error.courseName} : null } Faculty Details - { - - setStaffs({ choosen: item }); - }} - - itemStyle={styles.input} - - itemTextStyle={{ color: '#222' }} - itemsContainerStyle={{ maxHeight: 140 }} + { error.courseName ? {error.courseName} : null @@ -137,7 +174,8 @@ const styles = StyleSheet.create({ borderColor: "#ddd", padding: 10, marginBottom: 12, - borderRadius: 5 + borderRadius: 5, + zIndex: 2 }, text: { marginBottom: 15, diff --git a/Pages/AttDisplay.js b/Pages/AttDisplay.js new file mode 100644 index 0000000..4248f1e --- /dev/null +++ b/Pages/AttDisplay.js @@ -0,0 +1,292 @@ +import { View, Text, StyleSheet, Pressable, ScrollView, Modal, Button, FlatList } from 'react-native' +import React, { useEffect, useState } from 'react' +import AsyncStorage from '@react-native-async-storage/async-storage'; +import { Ionicons } from '@expo/vector-icons'; +import { useNavigation } from '@react-navigation/native'; +import axios from 'axios'; +import ipAddr from "../functions/ip_addr" +import { useFocusEffect } from '@react-navigation/native'; +import Icon from 'react-native-vector-icons/FontAwesome'; +import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'; +import { faA, faP } from '@fortawesome/free-solid-svg-icons'; + +const AttendanceDisplay = () => { + const navigate = useNavigation(); + const [theoryCourses, settheoryCourses] = useState([]) + const [labCourses, setlabCourses] = useState([]) + + const [open, setOpen] = useState(false) + useEffect(() => { + GetCourses() + console.log("course fetching") + }, []) + + useFocusEffect( + React.useCallback(() => { + GetCourses() + console.log("course fetching") + }, []) + ); + + const GetCourses = async () => { + var roll = await AsyncStorage.getItem("roll"); + console.log(roll) + const res = await axios({ + url: `http://${ipAddr}:3000/user/getMyCourses`, + method: "get", + params: { roll } + }) + + console.log(res.data) + var l = [] + var t = [] + + res.data.forEach(course => { + console.log(course) + if (course.type == "Theory") { + t.push(course); + } else { + l.push(course); + } + }); + settheoryCourses(t) + setlabCourses(l) + console.log(res.data) + } + + const [subName, setSubName] = useState("") + const [att, setAtt] = useState([]) + + const viewAtt = async (courseNo) => { + const name = await AsyncStorage.getItem("name"); + const roll = await AsyncStorage.getItem("roll"); + + const res = await axios({ + url: `http://${ipAddr}:3000/att/getAtt`, + method: "get", + params: { roll, courseNo } + }) + console.log(res.data) + setAtt(res.data) + + } + return ( + + + { + setOpen(false); + }} + animationType="fade" + > + + + + + + + {subName} + + + + {/* index.toString()} + renderItem={({ item }) => ( + + + {item.date} + + + hour-{item.hour} + + {item.isPresent ? ( + + ) : ( + + )} + + + + )} + /> */} + + {att.map((row, index) => ( + + + {row.date} + + + hour-{row.hour} + + {row.isPresent ? : } + + + + ))} + + + +