bug fixes and gender add for student
This commit is contained in:
parent
b1ccbdce13
commit
96af46baa7
|
@ -20,6 +20,7 @@ class Sidebar extends React.Component<any, any> {
|
|||
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<any, any> {
|
|||
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<any, any> {
|
|||
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<any, any> {
|
|||
}
|
||||
<Text style={{ fontSize: 16, marginTop: 10, fontFamily: "Quicksand_700Bold" }}>{this.state.name}</Text>
|
||||
<Text style={{ color: "gray", marginBottom: 10, fontFamily: "Quicksand_700Bold" }}>({this.state.role})</Text>
|
||||
<Text style={{ color: "gray", marginBottom: 10, fontFamily: "Quicksand_700Bold" }}>{this.state.school_name}</Text>
|
||||
<View style={styles.sidebarDivider}></View>
|
||||
<FlatList
|
||||
style={{ width: "100%", marginLeft: 30 }}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { createDrawerNavigator } from '@react-navigation/drawer';
|
||||
import { createStackNavigator } from '@react-navigation/stack';
|
||||
import { StyleSheet, View } from 'react-native'
|
||||
|
||||
import React from 'react'
|
||||
|
@ -21,6 +22,24 @@ import TeacherInfo from '@screens/Teacher/TeacherInfo' //NOSONAR
|
|||
|
||||
const Drawer = createDrawerNavigator();
|
||||
|
||||
const Stack = createStackNavigator();
|
||||
|
||||
const ClassStackNavigator = () => (
|
||||
<Stack.Navigator initialRouteName="ClassView" screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="ClassView" component={ClassView} />
|
||||
<Stack.Screen name="ClassCreate" component={ClassCreate} />
|
||||
<Stack.Screen name="ClassUpdate" component={ClasslUpdate} />
|
||||
</Stack.Navigator>
|
||||
);
|
||||
|
||||
const TeeacherStackNavigator = () => (
|
||||
<Stack.Navigator initialRouteName="Teacher" screenOptions={{ headerShown: false }}>
|
||||
<Stack.Screen name="Teacher" component={TeacherView} />
|
||||
<Stack.Screen name="TeacherCreate" component={TeacherCreate} />
|
||||
<Stack.Screen name="TeacherUpdate" component={TeacherUpdate} />
|
||||
</Stack.Navigator>
|
||||
);
|
||||
|
||||
const DrawerNavigator = () => {
|
||||
return (
|
||||
<Drawer.Navigator
|
||||
|
@ -51,12 +70,12 @@ const DrawerNavigator = () => {
|
|||
<Drawer.Screen name="ChangePassword" component={ChangePassword} />
|
||||
<Drawer.Screen name="School" component={SchoolView} />
|
||||
<Drawer.Screen name="SchoolUpdate" component={SchoolUpdate} />
|
||||
<Drawer.Screen name="Class" component={ClassView} />
|
||||
<Drawer.Screen name="ClassCreate" component={ClassCreate} />
|
||||
<Drawer.Screen name="ClassUpdate" component={ClasslUpdate} />
|
||||
<Drawer.Screen name="TeacherView" component={TeacherView} />
|
||||
<Drawer.Screen name="TeacherCreate" component={TeacherCreate} />
|
||||
<Drawer.Screen name="TeacherUpdate" component={TeacherUpdate} />
|
||||
<Drawer.Screen name="Class" component={ClassStackNavigator} />
|
||||
{/* <Drawer.Screen name="ClassCreate" component={ClassCreate} /> */}
|
||||
{/* <Drawer.Screen name="ClassUpdate" component={ClasslUpdate} /> */}
|
||||
<Drawer.Screen name="TeacherView" component={TeeacherStackNavigator} />
|
||||
{/* <Drawer.Screen name="TeacherCreate" component={TeacherCreate} />
|
||||
<Drawer.Screen name="TeacherUpdate" component={TeacherUpdate} /> */}
|
||||
<Drawer.Screen name="TeacherInfo" component={TeacherInfo} />
|
||||
</Drawer.Navigator>
|
||||
);
|
||||
|
|
|
@ -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: [],
|
||||
|
|
|
@ -23,7 +23,7 @@ class InstantFeedbackDetail extends React.Component<any, any>{
|
|||
|
||||
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()
|
||||
|
|
|
@ -23,7 +23,7 @@ class InstantFeedbackDetailView extends React.Component<any, any>{
|
|||
|
||||
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()
|
||||
|
|
|
@ -191,7 +191,7 @@ class QuizSummaryDetails extends React.Component<any, any>{
|
|||
this.onSelectChange('card_id', itemValue)
|
||||
}
|
||||
placeholder={{
|
||||
label: '--Select School--',
|
||||
label: '--Select Student--',
|
||||
value: null,
|
||||
}}
|
||||
useNativeAndroidPickerStyle={false}
|
||||
|
|
|
@ -93,7 +93,8 @@ class GetStarted extends React.Component<any, any>{
|
|||
);
|
||||
}
|
||||
return (<View style={AuthStyles.container}>
|
||||
|
||||
<Image source={Images.logo} style={AuthStyles.logoImg} />
|
||||
<Text style={[BaseStyles.headerLabel, BaseStyles.font700Bold, BaseStyles.marBottom30]}>Select School</Text>
|
||||
<View style={[AppStyles.inputView, BaseStyles.marTop5]}>
|
||||
{/* <Picker
|
||||
name="subject_id"
|
||||
|
|
|
@ -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) => <View style={[BaseStyles.separator, style]} />
|
||||
|
||||
|
@ -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<any, any>{
|
|||
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 }) => (
|
||||
<>
|
||||
<Text style={[AppStyles.cardHeader, BaseStyles.marTop5]}>Student Name<Text style={AppStyles.required}> *</Text></Text>
|
||||
<View style={[AppStyles.inputView, BaseStyles.marTop5]} >
|
||||
|
@ -293,6 +296,24 @@ class StudentCreate extends React.Component<any, any>{
|
|||
</View>
|
||||
{(errors.student_name && touched.student_name) && <Text style={AppStyles.error}>{errors.student_name}</Text>}
|
||||
|
||||
<Text style={[AppStyles.cardHeader, BaseStyles.marTop5]}>Gender<Text style={AppStyles.required}> *</Text></Text>
|
||||
<RadioButton.Group onValueChange={(value) => setFieldValue('gender', value)}
|
||||
value={values.gender}>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="M" />
|
||||
<Text style={styles.radioLabel}>Male</Text>
|
||||
</View>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="F" />
|
||||
<Text style={styles.radioLabel}>Female</Text>
|
||||
</View>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="O" />
|
||||
<Text style={styles.radioLabel}>Others</Text>
|
||||
</View>
|
||||
</RadioButton.Group>
|
||||
{(errors.gender && touched.gender) && <Text style={AppStyles.error}>{errors.gender}</Text>}
|
||||
|
||||
<Text style={[AppStyles.cardHeader, BaseStyles.marTop5]}>Phone Number<Text style={AppStyles.required}> *</Text></Text>
|
||||
<View style={[AppStyles.inputView, BaseStyles.marTop5,]} >
|
||||
<TextInput style={AppStyles.inputText} name="phone_number" placeholder="Enter the Phone Number"
|
||||
|
@ -388,7 +409,15 @@ const styles = StyleSheet.create({
|
|||
alignSelf: 'center',
|
||||
paddingHorizontal: 10,
|
||||
marginVertical: 4
|
||||
}
|
||||
},
|
||||
radioContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 10,
|
||||
},
|
||||
radioLabel: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -332,7 +332,7 @@ class StudentProfile extends React.Component<any, any>{
|
|||
<View style={[{ flex: 1, flexDirection: "row", width: "100%", justifyContent: "center", alignContent: "center" }, BaseStyles.marBottom10, BaseStyles.marLeft10]}>
|
||||
<VictoryPie
|
||||
width={280}
|
||||
height={150}
|
||||
height={280}
|
||||
cornerRadius={({ datum }) => 3}
|
||||
data={subjectItem.chart_info}
|
||||
style={{
|
||||
|
|
|
@ -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) => <View style={[BaseStyles.separator, style]} />
|
||||
|
||||
|
@ -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<any, any>{
|
|||
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)}
|
||||
>
|
||||
|
@ -298,6 +301,24 @@ class StudentUpdate extends React.Component<any, any>{
|
|||
</View>
|
||||
{(errors.student_name && touched.student_name) && <Text style={AppStyles.error}>{errors.student_name}</Text>}
|
||||
|
||||
<Text style={[AppStyles.cardHeader, BaseStyles.marTop5]}>Gender<Text style={AppStyles.required}> *</Text></Text>
|
||||
<RadioButton.Group onValueChange={(value) => setFieldValue('gender', value)}
|
||||
value={values.gender}>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="M" />
|
||||
<Text style={styles.radioLabel}>Male</Text>
|
||||
</View>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="F" />
|
||||
<Text style={styles.radioLabel}>Female</Text>
|
||||
</View>
|
||||
<View style={styles.radioContainer}>
|
||||
<RadioButton.Android value="O" />
|
||||
<Text style={styles.radioLabel}>Others</Text>
|
||||
</View>
|
||||
</RadioButton.Group>
|
||||
{(errors.gender && touched.gender) && <Text style={AppStyles.error}>{errors.gender}</Text>}
|
||||
|
||||
<Text style={[AppStyles.cardHeader, BaseStyles.marTop5]}>Phone Number<Text style={AppStyles.required}> *</Text></Text>
|
||||
<View style={[AppStyles.inputView, BaseStyles.marTop5,BaseStyles.disabledLight]} >
|
||||
<TextInput style={AppStyles.inputText} name="phone_number" placeholder="Enter the Phone Number"
|
||||
|
@ -394,7 +415,15 @@ const styles = StyleSheet.create({
|
|||
alignSelf: 'center',
|
||||
paddingHorizontal: 10,
|
||||
marginVertical: 4
|
||||
}
|
||||
},
|
||||
radioContainer: {
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
marginBottom: 10,
|
||||
},
|
||||
radioLabel: {
|
||||
marginLeft: 8,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -240,6 +240,7 @@ class StudentView extends React.Component<any, any>{
|
|||
keyExtractor={(item, index) => index.toString()}
|
||||
onEndReached={this.hasLoadMore}
|
||||
onEndReachedThreshold={0.1}
|
||||
ListFooterComponent={<View style={styles.footer} />}
|
||||
/>}
|
||||
{!this.props.loading && this.props.records.length === 0 &&
|
||||
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
|
||||
|
@ -280,7 +281,9 @@ const styles = StyleSheet.create({
|
|||
justifyContent: "center",
|
||||
marginLeft: 10
|
||||
},
|
||||
|
||||
footer: {
|
||||
height: 100,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class TeacherCreate extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
}
|
||||
|
||||
onCancel = () => {
|
||||
this.props.navigation.navigate("TeacherView")
|
||||
this.props.navigation.navigate("Teacher")
|
||||
}
|
||||
|
||||
onTeacherSubmit = (data: any, actions: any) => {
|
||||
|
|
|
@ -36,7 +36,7 @@ class TeacherUpdate extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
}
|
||||
|
||||
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<any, any>{
|
|||
}
|
||||
|
||||
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<any, any>{
|
|||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ class TeacherView extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
)
|
||||
}
|
||||
}
|
||||
if (this.props.data.status) {
|
||||
this.fetchTeacherListData()
|
||||
this.props.initTeacher()
|
||||
}
|
||||
}
|
||||
|
||||
fetchTeacherListData = async () => {
|
||||
|
@ -99,7 +104,7 @@ class TeacherView extends React.Component<any, any>{
|
|||
}
|
||||
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<any, any>{
|
|||
keyExtractor={(item, index) => index.toString()}
|
||||
onEndReached={this.hasLoadMore}
|
||||
onEndReachedThreshold={0.1}
|
||||
ListFooterComponent={<View style={styles.footer} />}
|
||||
/>}
|
||||
{ !this.props.loading && this.props.records.length === 0 &&
|
||||
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
|
||||
|
@ -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) => ({
|
||||
|
|
|
@ -46,7 +46,7 @@ class ClassCreate extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
}
|
||||
|
||||
onCancel = () => {
|
||||
this.props.navigation.navigate("Class")
|
||||
this.props.navigation.navigate("ClassView")
|
||||
}
|
||||
|
||||
onSelectChange = (event: any, action: any, setFieldValue: any) => {
|
||||
|
|
|
@ -49,7 +49,7 @@ class ClasslUpdate extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
}
|
||||
|
||||
onCancel = () => {
|
||||
this.props.navigation.navigate("Class")
|
||||
this.props.navigation.navigate("ClassView")
|
||||
}
|
||||
|
||||
onSelectChange = (event: any, action: any, setFieldValue: any) => {
|
||||
|
|
|
@ -17,7 +17,8 @@ class ClassView extends React.Component<any, any>{
|
|||
search: '',
|
||||
classListInfo: [],
|
||||
data: [],
|
||||
academicYear: ''
|
||||
academicYear: '',
|
||||
isFetching: false
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
|
@ -28,6 +29,7 @@ class ClassView extends React.Component<any, any>{
|
|||
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<any, any>{
|
|||
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<any, any>{
|
|||
)
|
||||
}
|
||||
}
|
||||
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<any, any>{
|
|||
)
|
||||
}
|
||||
|
||||
onRefresh() {
|
||||
this.setState({isFetching: true,},() => {this.fetchClassListData()});
|
||||
}
|
||||
|
||||
renderRow = ({ item }: any) => (
|
||||
<View style={[BaseStyles.padHorizontal20, styles.classCard]}>
|
||||
<View style={styles.item}>
|
||||
|
@ -173,6 +183,9 @@ class ClassView extends React.Component<any, any>{
|
|||
keyExtractor={(item, index) => index.toString()}
|
||||
onEndReached={this.hasLoadMore}
|
||||
onEndReachedThreshold={0.1}
|
||||
onRefresh={() => this.onRefresh()}
|
||||
refreshing={this.state.isFetching}
|
||||
ListFooterComponent={<View style={styles.footer} />}
|
||||
/>}
|
||||
{!this.props.loading && this.props.records.length === 0 &&
|
||||
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
|
||||
|
@ -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) => ({
|
||||
|
|
|
@ -151,20 +151,20 @@ class SchoolView extends React.Component<any, any>{
|
|||
<Text style={AppStyles.allHeader}>Contact Details</Text>
|
||||
<Sepator />
|
||||
{/* Two column View */}
|
||||
<View style={[styles.container]}>
|
||||
<View style={styles.item}>
|
||||
{/* <View style={[styles.container]}> */}
|
||||
{/* <View style={styles.item}> */}
|
||||
<Text style={AppStyles.cardHeader}>Person Name</Text>
|
||||
{schoolInfo?.contact_persons && <Text style={AppStyles.cardData}>{schoolInfo?.contact_persons[0]?.name || ''}</Text>}
|
||||
|
||||
<Text style={AppStyles.cardHeader}>Phone Number</Text>
|
||||
{schoolInfo?.contact_persons && <Text style={AppStyles.cardData}>{schoolInfo?.contact_persons[0].phone_number || ''}</Text>}
|
||||
</View>
|
||||
<View style={styles.item}>
|
||||
{/* </View>
|
||||
<View style={styles.item}> */}
|
||||
<Text style={AppStyles.cardHeader}>Designation</Text>
|
||||
{schoolInfo?.contact_persons && <Text style={AppStyles.cardData}>{schoolInfo?.contact_persons[0].designation || ''}</Text>}
|
||||
|
||||
</View>
|
||||
</View>
|
||||
{/* </View> */}
|
||||
{/* </View> */}
|
||||
{/* Endof Two column View */}
|
||||
|
||||
<Text style={AppStyles.cardHeader}>Email Id</Text>
|
||||
|
@ -200,7 +200,8 @@ class SchoolView extends React.Component<any, any>{
|
|||
ref={ref => this.map = ref}
|
||||
provider={this.props.provider}
|
||||
style={styles.map}
|
||||
initialRegion={this.state.school_coordinates}>
|
||||
region={this.state.school_coordinates}
|
||||
>
|
||||
<Marker
|
||||
draggable={false}
|
||||
coordinate={this.state.school_coordinates}
|
||||
|
|
|
@ -889,7 +889,8 @@ export const PickerStyle = {
|
|||
fontSize: 18,
|
||||
color: "#4a537c",
|
||||
height: 34,
|
||||
padding:0
|
||||
padding:0,
|
||||
marginRight:35
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue