diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index dcb7ee5..2c90a99 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -20,6 +20,7 @@ class Sidebar extends React.Component { email: 'nazrin@gmail.com', name: 'Nazrin', role: 'School Admin', + school_name: 'Velammal School, Nungapakkam', routes: [ { name: "Home", @@ -84,8 +85,9 @@ class Sidebar extends React.Component { this.props.getMenuList({ token: token, app_type: 'mobile' }) if (userInfo) { const userDetails: any = JSON.parse(userInfo) + const profileDetails: any = JSON.parse(profileInfo) this.isLoggedinAs = userDetails.usertype - this.filterRoleBaseSideBar(userDetails, null) + this.filterRoleBaseSideBar(userDetails, profileDetails) } else { if (this.props.userinfo.hasOwnProperty('status')) { if (this.props.userinfo.status) { @@ -136,7 +138,7 @@ class Sidebar extends React.Component { validRoleBasedMenu.push(route) } }) - this.setState({ name: userInfo.name, role: userInfo.role_name, image: userInfo.image, routes: validRoleBasedMenu }) + this.setState({ name: userInfo.name, role: userInfo.role_name, school_name: profileInfo?.school_name, image: userInfo.image, routes: validRoleBasedMenu }) } @@ -154,6 +156,7 @@ class Sidebar extends React.Component { } {this.state.name} ({this.state.role}) + {this.state.school_name} ( + + + + + +); + +const TeeacherStackNavigator = () => ( + + + + + +); + const DrawerNavigator = () => { return ( { - - - - - - + + {/* */} + {/* */} + + {/* + */} ); diff --git a/src/reducers/teacher.reducer.tsx b/src/reducers/teacher.reducer.tsx index ad62c50..38390c4 100644 --- a/src/reducers/teacher.reducer.tsx +++ b/src/reducers/teacher.reducer.tsx @@ -18,7 +18,11 @@ import { //NOSONAR import Toast from 'react-native-simple-toast' -const defaultObj: any = {} +const defaultObj: any = { + data:{ + status: false + } +} const defaultState = { loading: false, records: [], diff --git a/src/screens/InstantFeedback/InstantFeedbackDetail.tsx b/src/screens/InstantFeedback/InstantFeedbackDetail.tsx index dd35051..0cde013 100644 --- a/src/screens/InstantFeedback/InstantFeedbackDetail.tsx +++ b/src/screens/InstantFeedback/InstantFeedbackDetail.tsx @@ -23,7 +23,7 @@ class InstantFeedbackDetail extends React.Component{ async componentDidMount() { const { navigation, route } = this.props; - const title = 'Instance Feedback Report'; + const title = 'Instant Feedback Report'; navigation.setOptions({ title }); this.token = await AsyncStorage.getItem('token') this.imageBaseUrl = await fetchBaseUrl() diff --git a/src/screens/InstantFeedback/InstantFeedbackDetailView.tsx b/src/screens/InstantFeedback/InstantFeedbackDetailView.tsx index 6616931..5eb0077 100644 --- a/src/screens/InstantFeedback/InstantFeedbackDetailView.tsx +++ b/src/screens/InstantFeedback/InstantFeedbackDetailView.tsx @@ -23,7 +23,7 @@ class InstantFeedbackDetailView extends React.Component{ async componentDidMount() { const { navigation, route } = this.props; - const title = 'Instance Feedback Report'; + const title = 'Instant Feedback Report'; navigation.setOptions({ title }); this.token = await AsyncStorage.getItem('token') this.imageBaseUrl = await fetchBaseUrl() diff --git a/src/screens/Quizzes/QuizSummaryDetails.tsx b/src/screens/Quizzes/QuizSummaryDetails.tsx index be6100e..d9e4d76 100644 --- a/src/screens/Quizzes/QuizSummaryDetails.tsx +++ b/src/screens/Quizzes/QuizSummaryDetails.tsx @@ -191,7 +191,7 @@ class QuizSummaryDetails extends React.Component{ this.onSelectChange('card_id', itemValue) } placeholder={{ - label: '--Select School--', + label: '--Select Student--', value: null, }} useNativeAndroidPickerStyle={false} diff --git a/src/screens/SchoolList.tsx b/src/screens/SchoolList.tsx index 445ef1e..b6ff7d1 100644 --- a/src/screens/SchoolList.tsx +++ b/src/screens/SchoolList.tsx @@ -93,7 +93,8 @@ class GetStarted extends React.Component{ ); } return ( - + + Select School {/* @@ -41,7 +42,8 @@ const StudentCreateValidationSchema = yup.object().shape({ email_id: yup .string() .matches(formValidationPatten.emailPatten, 'Please enter valid Email Id') - .required('Email Id is Required') + .required('Email Id is Required'), + gender: yup.string().required('Gender is required'), }) @@ -279,11 +281,12 @@ class StudentCreate extends React.Component{ parent_lastname: '', phone_number: '', email_id: '', - student_name: '' + student_name: '', + gender:'', }} onSubmit={(values, actions) => this.onStudentSubmit(values, actions)} > - {({ handleChange, handleBlur, handleSubmit, values, errors, touched, dirty, isValid }) => ( + {({ handleChange, handleBlur, handleSubmit, values, errors, touched, dirty, isValid, setFieldValue }) => ( <> Student Name * @@ -293,6 +296,24 @@ class StudentCreate extends React.Component{ {(errors.student_name && touched.student_name) && {errors.student_name}} + Gender * + setFieldValue('gender', value)} + value={values.gender}> + + + Male + + + + Female + + + + Others + + + {(errors.gender && touched.gender) && {errors.gender}} + Phone Number * { 3} data={subjectItem.chart_info} style={{ diff --git a/src/screens/Student/StudentUpdate.tsx b/src/screens/Student/StudentUpdate.tsx index ac79932..df88b58 100644 --- a/src/screens/Student/StudentUpdate.tsx +++ b/src/screens/Student/StudentUpdate.tsx @@ -13,6 +13,7 @@ import { FontAwesome } from "@expo/vector-icons" import BaseColors from "@theme/Colors" //NOSONAR import * as ImagePicker from 'expo-image-picker' import Constants from "expo-constants" +import { RadioButton } from 'react-native-paper' const Sepator = ({ style }: any) => @@ -41,7 +42,8 @@ const StudentUpdateValidationSchema = yup.object().shape({ email_id: yup .string() .matches(formValidationPatten.emailPatten, 'Please enter valid Email Id') - .required('Email Id is Required') + .required('Email Id is Required'), + gender: yup.string().required('Gender is required'), }) @@ -250,7 +252,8 @@ class StudentUpdate extends React.Component{ parent_lastname: studentInfo?.parent_lastname, phone_number: studentInfo?.phone_number, email_id: studentInfo?.email_id, - student_name: studentInfo?.student_name + student_name: studentInfo?.student_name, + gender: studentInfo?.gender }} onSubmit={(values, actions) => this.onStudentSubmit(values, actions)} > @@ -297,7 +300,25 @@ class StudentUpdate extends React.Component{ value={values.student_name} keyboardType="default" maxLength={50} /> {(errors.student_name && touched.student_name) && {errors.student_name}} - + + Gender * + setFieldValue('gender', value)} + value={values.gender}> + + + Male + + + + Female + + + + Others + + + {(errors.gender && touched.gender) && {errors.gender}} + Phone Number * { keyExtractor={(item, index) => index.toString()} onEndReached={this.hasLoadMore} onEndReachedThreshold={0.1} + ListFooterComponent={} />} {!this.props.loading && this.props.records.length === 0 && {common.noDataFound}} @@ -280,7 +281,9 @@ const styles = StyleSheet.create({ justifyContent: "center", marginLeft: 10 }, - + footer: { + height: 100, + }, }) diff --git a/src/screens/Teacher/TeacherCreate.tsx b/src/screens/Teacher/TeacherCreate.tsx index a274533..b073298 100644 --- a/src/screens/Teacher/TeacherCreate.tsx +++ b/src/screens/Teacher/TeacherCreate.tsx @@ -54,7 +54,7 @@ class TeacherCreate extends React.Component{ componentDidUpdate() { if (this.props.data.hasOwnProperty('status')) { if (this.props.data.status) { - this.props.navigation.navigate('TeacherView') + this.props.navigation.navigate('Teacher') } else { /** Formik Errors on submit */ if (this.formikActions) { @@ -69,7 +69,7 @@ class TeacherCreate extends React.Component{ } onCancel = () => { - this.props.navigation.navigate("TeacherView") + this.props.navigation.navigate("Teacher") } onTeacherSubmit = (data: any, actions: any) => { diff --git a/src/screens/Teacher/TeacherUpdate.tsx b/src/screens/Teacher/TeacherUpdate.tsx index f62f577..2c2f117 100644 --- a/src/screens/Teacher/TeacherUpdate.tsx +++ b/src/screens/Teacher/TeacherUpdate.tsx @@ -36,7 +36,7 @@ class TeacherUpdate extends React.Component{ formikActions: any; static propTypes = {}; state = { - id: this.props.route.params.teacher_id + id: this.props.route.teacher_id }; token: any; @@ -45,23 +45,25 @@ class TeacherUpdate extends React.Component{ } async componentDidMount() { + const { navigation, route, getTeacherDetail } = this.props; this.token = await AsyncStorage.getItem('token') if (this.token) { - if(this.props.route.params.hasOwnProperty('teacher_id')) { - this.props.getTeacherDetail({ teacher_id: this.props.route.params.teacher_id, token: this.token }) + if(route.params.hasOwnProperty('teacher_id')) { + getTeacherDetail({ teacher_id: route.params.teacher_id, token: this.token }) + this.props.initTeacher() } else { - this.props.navigation.navigate("TeacherView") + navigation.navigate("Teacher") } } else { - this.props.navigation.navigate('signin') + navigation.navigate('signin') } } componentDidUpdate() { if (this.props.data.hasOwnProperty('status')) { if (this.props.data.status) { - this.props.navigation.navigate('TeacherView') + this.props.navigation.navigate('Teacher') } else { /** Formik Errors on submit */ if (this.formikActions) { @@ -76,7 +78,7 @@ class TeacherUpdate extends React.Component{ } onCancel = () => { - this.props.navigation.navigate("TeacherView") + this.props.navigation.navigate("Teacher") } onTeacherUpdate = (data: any, actions: any) => { @@ -95,11 +97,11 @@ class TeacherUpdate extends React.Component{ if (this.props.info.hasOwnProperty('status')) { if (this.props.info.status) { - firstname = this.props.info.data.firstname - lastname = this.props.info.data.lastname - phoneNumber = this.props.info.data.phone_number - emailId = this.props.info.data.email - imageInput = this.props.info.data.image + firstname = this.props.route.params.data.firstname + lastname = this.props.route.params.data.lastname + phoneNumber = this.props.route.params.data.phone_number + emailId = this.props.route.params.data.email_id + imageInput = this.props.route.params.data.image } } diff --git a/src/screens/Teacher/TeacherView.tsx b/src/screens/Teacher/TeacherView.tsx index 3b0433c..d40ff10 100644 --- a/src/screens/Teacher/TeacherView.tsx +++ b/src/screens/Teacher/TeacherView.tsx @@ -30,6 +30,7 @@ class TeacherView extends React.Component{ this.token = await AsyncStorage.getItem('token') this.imageBaseUrl = await fetchBaseUrl() if (this.token) { + this.props.initTeacher() this.fetchTeacherListData() } else { this.props.navigation.navigate('signin') @@ -45,6 +46,10 @@ class TeacherView extends React.Component{ ) } } + if (this.props.data.status) { + this.fetchTeacherListData() + this.props.initTeacher() + } } fetchTeacherListData = async () => { @@ -99,7 +104,7 @@ class TeacherView extends React.Component{ } onTeacherUpdate = (data: any) => { this.pageCountReset() - this.props.navigation.navigate("TeacherUpdate", { teacher_id: data.ldap_id, data }) + this.props.navigation.navigate("TeacherUpdate", { teacher_id: data.ldap_id, data: data }) } onTeacherDelete = async (data: any) => { @@ -177,6 +182,7 @@ class TeacherView extends React.Component{ keyExtractor={(item, index) => index.toString()} onEndReached={this.hasLoadMore} onEndReachedThreshold={0.1} + ListFooterComponent={} />} { !this.props.loading && this.props.records.length === 0 && {common.noDataFound}} @@ -233,6 +239,9 @@ const styles = StyleSheet.create({ justifyContent: "center", marginLeft: 10 }, + footer: { + height: 100, + }, }) @@ -245,7 +254,8 @@ const mapStateToProps = (state: any) => ({ teacherList: state.teachers.list, records: state.teachers.records, info: state.teachers.info, - deleted_info: state.teachers.deleted_info + deleted_info: state.teachers.deleted_info, + data: state.teachers.data }) const mapDispatchToProps = (dispatch: any) => ({ diff --git a/src/screens/class/classCreate.tsx b/src/screens/class/classCreate.tsx index d6d9ab3..8afd7ef 100644 --- a/src/screens/class/classCreate.tsx +++ b/src/screens/class/classCreate.tsx @@ -46,7 +46,7 @@ class ClassCreate extends React.Component{ componentDidUpdate() { if (this.props.data.hasOwnProperty('status')) { if (this.props.data.status) { - this.props.navigation.navigate('Class') + this.props.navigation.navigate('ClassView') } else { /** Formik Errors on submit */ if(this.formikActions){ @@ -61,7 +61,7 @@ class ClassCreate extends React.Component{ } onCancel = () => { - this.props.navigation.navigate("Class") + this.props.navigation.navigate("ClassView") } onSelectChange = (event: any, action: any, setFieldValue: any) => { diff --git a/src/screens/class/classUpdate.tsx b/src/screens/class/classUpdate.tsx index e24f811..962bb0b 100644 --- a/src/screens/class/classUpdate.tsx +++ b/src/screens/class/classUpdate.tsx @@ -49,7 +49,7 @@ class ClasslUpdate extends React.Component{ componentDidUpdate() { if (this.props.data.hasOwnProperty('status')) { if (this.props.data.status) { - this.props.navigation.navigate('Class') + this.props.navigation.navigate('ClassView') } else { /** Formik Errors on submit */ if (this.formikActions) { @@ -64,7 +64,7 @@ class ClasslUpdate extends React.Component{ } onCancel = () => { - this.props.navigation.navigate("Class") + this.props.navigation.navigate("ClassView") } onSelectChange = (event: any, action: any, setFieldValue: any) => { diff --git a/src/screens/class/classView.tsx b/src/screens/class/classView.tsx index b1e687b..d1f3630 100644 --- a/src/screens/class/classView.tsx +++ b/src/screens/class/classView.tsx @@ -17,7 +17,8 @@ class ClassView extends React.Component{ search: '', classListInfo: [], data: [], - academicYear: '' + academicYear: '', + isFetching: false }; constructor(props: any) { @@ -28,6 +29,7 @@ class ClassView extends React.Component{ this.getCurrentAcademicYearData() //fetch the Current Academic year from Login Response this.token = await AsyncStorage.getItem('token') if (this.token) { + this.props.initClass() this.fetchClassListData() } else { this.props.navigation.navigate('signin') @@ -42,7 +44,6 @@ class ClassView extends React.Component{ const academicYear = userInfo.current_academic_year this.setState({ academicYear: academicYear }) } - console.log(this.state.academicYear) }).catch(error => { console.log(error) }) @@ -57,10 +58,15 @@ class ClassView extends React.Component{ ) } } + if (this.props.data.status) { + this.fetchClassListData() + this.props.initClass() + } } fetchClassListData = async () => { this.props.getAllClassList({ page: this.state.page, token: this.token, search: this.state.search, sort_by: 'asc', order_by: 'grade', academic_year: this.state.academicYear.toString() }) + this.setState({isFetching: false,}) } onSearchChange = (searchText: any) => { @@ -128,6 +134,10 @@ class ClassView extends React.Component{ ) } + onRefresh() { + this.setState({isFetching: true,},() => {this.fetchClassListData()}); + } + renderRow = ({ item }: any) => ( @@ -173,6 +183,9 @@ class ClassView extends React.Component{ keyExtractor={(item, index) => index.toString()} onEndReached={this.hasLoadMore} onEndReachedThreshold={0.1} + onRefresh={() => this.onRefresh()} + refreshing={this.state.isFetching} + ListFooterComponent={} />} {!this.props.loading && this.props.records.length === 0 && {common.noDataFound}} @@ -277,7 +290,10 @@ const styles = StyleSheet.create({ fontFamily: "Quicksand_500Medium", padding: 5, fontSize: 18 - } + }, + footer: { + height: 100, + }, }) const mapStateToProps = (state: any) => ({ @@ -289,7 +305,8 @@ const mapStateToProps = (state: any) => ({ classList: state.classes.list, records: state.classes.records, info: state.classes.info, - deleted_info: state.classes.deleted_info + deleted_info: state.classes.deleted_info, + data: state.classes.data }) const mapDispatchToProps = (dispatch: any) => ({ diff --git a/src/screens/school/schoolView.tsx b/src/screens/school/schoolView.tsx index c1a845a..60cf798 100644 --- a/src/screens/school/schoolView.tsx +++ b/src/screens/school/schoolView.tsx @@ -151,20 +151,20 @@ class SchoolView extends React.Component{ Contact Details {/* Two column View */} - - + {/* */} + {/* */} Person Name {schoolInfo?.contact_persons && {schoolInfo?.contact_persons[0]?.name || ''}} Phone Number {schoolInfo?.contact_persons && {schoolInfo?.contact_persons[0].phone_number || ''}} - - + {/* + */} Designation {schoolInfo?.contact_persons && {schoolInfo?.contact_persons[0].designation || ''}} - - + {/* */} + {/* */} {/* Endof Two column View */} Email Id @@ -200,7 +200,8 @@ class SchoolView extends React.Component{ ref={ref => this.map = ref} provider={this.props.provider} style={styles.map} - initialRegion={this.state.school_coordinates}> + region={this.state.school_coordinates} + >