From 0ec43ce473b0a3e2c705cb88a70ea224f92766b4 Mon Sep 17 00:00:00 2001 From: vinoth Date: Fri, 22 Nov 2024 18:08:05 +0530 Subject: [PATCH] bug fixes psychometic --- src/constants/Constants.tsx | 2 +- src/core/utils.tsx | 2 +- src/navigation/DrawerNavigator.tsx | 4 ++- src/reducers/homestudy.reducer.tsx | 5 +++ src/screens/CreatePassword.tsx | 3 ++ .../HomeStudy/HomeStudyGenerateQuestions.tsx | 2 ++ src/screens/Pscyometric/QuestionScreen.tsx | 5 ++- .../Pscyometric/ReportPsychometric.tsx | 2 ++ .../Pscyometric/StudentListPsychometric.tsx | 36 +++++++++++++++++-- 9 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/constants/Constants.tsx b/src/constants/Constants.tsx index b14c91b..a451c2c 100644 --- a/src/constants/Constants.tsx +++ b/src/constants/Constants.tsx @@ -150,7 +150,7 @@ export const MONTHLIST = [ numberPatten: /^\d{10}$/, commonEmailPatter: /[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,3}$/, //NOSONAR emailPatten: /^([a-z|0-9](\.|_){0,1})+[a-z|0-9]\@([a-z|0-9])+((\.){0,1}[a-z|0-9]){2}\.[a-z]{2,3}$/gm, //NOSONAR - passwordPatten: /^(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,12}$/, //NOSONAR + passwordPatten: /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,12}$/, //NOSONAR phoneRegExp: /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/, //NOSONAR address: /^\S+(?: \S+)*$/, //NOSONAR } diff --git a/src/core/utils.tsx b/src/core/utils.tsx index 5554e08..806e603 100644 --- a/src/core/utils.tsx +++ b/src/core/utils.tsx @@ -29,7 +29,7 @@ export const passwordStrengthValidator = (password:any) => { return 'Password cannot be empty.' } if (!re.test(password)) { - return 'Password atleast 8 character,one upper case, one number and one special characters.' + return 'Password atleast 8 character,one upper case, one lower case, one number and one special characters.' } return '' diff --git a/src/navigation/DrawerNavigator.tsx b/src/navigation/DrawerNavigator.tsx index 6b0443c..d1cde85 100644 --- a/src/navigation/DrawerNavigator.tsx +++ b/src/navigation/DrawerNavigator.tsx @@ -21,6 +21,8 @@ import TeacherUpdate from '@screens/Teacher/TeacherUpdate' //NOSONAR import TeacherInfo from '@screens/Teacher/TeacherInfo' //NOSONAR import TeacherAttendance from "@screens/Teacher/TeacherAttendance" //NOSONAR import HomePsychometric from "@screens/Pscyometric/HomePsychometric" +import StudentListPsychometric from "@screens/Pscyometric/StudentListPsychometric" + import Greetings from "@screens/Greetings" //NOSONAR const Drawer = createDrawerNavigator(); @@ -78,7 +80,7 @@ const DrawerNavigator = () => { - + {/* */} {/* */} diff --git a/src/reducers/homestudy.reducer.tsx b/src/reducers/homestudy.reducer.tsx index 299e946..8b089ba 100644 --- a/src/reducers/homestudy.reducer.tsx +++ b/src/reducers/homestudy.reducer.tsx @@ -50,6 +50,11 @@ export const homestudy = (state = defaultState, action: any) => { case GET_HOME_STUDY_LIST_FAILURE: return { ...state, loading: false, error: action.error } case GENERATE_HOME_STUDY_RANDOM_QUESTION_SUCCESS: + if (response.hasOwnProperty('status')) { + if (!response.status) { + Toast.show(response.message, Toast.SHORT) + } + } return { ...state, loading: false, random_question: response } case GET_HOME_STUDY_TRANSACTION_DETAILS_SUCCESS: return { ...state, loading: false, home_study_details: response } diff --git a/src/screens/CreatePassword.tsx b/src/screens/CreatePassword.tsx index 937ea5d..d763b89 100644 --- a/src/screens/CreatePassword.tsx +++ b/src/screens/CreatePassword.tsx @@ -190,7 +190,10 @@ class CreatePassword extends React.Component{ . 1 uppercase + . 1 lowercase . 1 number + + . 1 Symbol diff --git a/src/screens/HomeStudy/HomeStudyGenerateQuestions.tsx b/src/screens/HomeStudy/HomeStudyGenerateQuestions.tsx index e9523fa..f1eb148 100644 --- a/src/screens/HomeStudy/HomeStudyGenerateQuestions.tsx +++ b/src/screens/HomeStudy/HomeStudyGenerateQuestions.tsx @@ -203,6 +203,7 @@ class HomeStudyGenerateQuestions extends React.Component{ + {this.props.homestudyLoading && } )} @@ -240,6 +241,7 @@ const styles = StyleSheet.create({ const mapStateToProps = (state: any) => ({ loading: state.questionbank.loading, isLoading: state.students.loading, + homestudyLoading: state.homestudy.loading, blueprintSubject: state.questionbank.bluprint_subject_dropdown, blueprintLesson: state.questionbank.bluprint_lesson_dropdown, records: state.questionbank.assessmentrecords, diff --git a/src/screens/Pscyometric/QuestionScreen.tsx b/src/screens/Pscyometric/QuestionScreen.tsx index fe766f3..b8b7740 100644 --- a/src/screens/Pscyometric/QuestionScreen.tsx +++ b/src/screens/Pscyometric/QuestionScreen.tsx @@ -93,7 +93,7 @@ class QuestionScreen extends React.Component{ }) } handleBack = async () => { - + await this.props.getPsychometricStudentDropdownByClass({ token: this.token, academic_year: this.state.academicYear.toString() }) this.props.navigation.navigate("Pscyometric") } handleNext = async () => { @@ -413,6 +413,9 @@ const mapDispatchToProps = (dispatch: any) => ({ getPsychometricCasheAnswer: (user: any) => { dispatch(ActionCreators.getPsychometricCasheAnswer(user)) }, + getPsychometricStudentDropdownByClass: (user: any) => { + dispatch(ActionCreators.getPsychometricStudentDropdownByClass(user)) + }, }) QuestionScreen.propTypes = { diff --git a/src/screens/Pscyometric/ReportPsychometric.tsx b/src/screens/Pscyometric/ReportPsychometric.tsx index d3376de..40c2182 100644 --- a/src/screens/Pscyometric/ReportPsychometric.tsx +++ b/src/screens/Pscyometric/ReportPsychometric.tsx @@ -257,6 +257,7 @@ class ReportPsychometric extends React.Component{ position: 'BOTTOM', labelRotationAngle: -60, // Rotate the labels to make them vertical drawLabels: true, + textColor: processColor('#282313'), }} yAxis={{ left: { @@ -265,6 +266,7 @@ class ReportPsychometric extends React.Component{ }, right: { enabled: true, + textColor: processColor('#282313'), }, }} animation={{ durationX: 1000 }} diff --git a/src/screens/Pscyometric/StudentListPsychometric.tsx b/src/screens/Pscyometric/StudentListPsychometric.tsx index a06bd19..fab553e 100644 --- a/src/screens/Pscyometric/StudentListPsychometric.tsx +++ b/src/screens/Pscyometric/StudentListPsychometric.tsx @@ -25,7 +25,8 @@ class StudentListPsychometric extends React.Component{ scrollView: any; token: any; state: any = { - academicYear: '' + academicYear: '', + parent:false }; constructor(props: any) { @@ -41,7 +42,16 @@ class StudentListPsychometric extends React.Component{ const userInfo = await AsyncStorage.getItem('userInfo') if (this.token) { - if (this.props.route.params.hasOwnProperty('data')) { + + if (userInfo) { + const userDetails: any = JSON.parse(userInfo) + this.isLoggedinAs = userDetails.usertype + if (userDetails.usertype === UserRoles.parent) { + this.setState({parent:true}) + } + } + + if (this.props?.route?.params?.hasOwnProperty('data')) { const dataParams: any = this.props.route.params.data this.props.getPsychometricStudentDropdownByClass({ token: this.token, academic_year: this.state.academicYear.toString(), class_id: dataParams.id }) } else { @@ -90,6 +100,10 @@ class StudentListPsychometric extends React.Component{ } } + toClass = () => { + this.props.navigation.navigate("ClassListPsychometric") + } + renderRow = ({ item }: any) => ( @@ -118,13 +132,16 @@ class StudentListPsychometric extends React.Component{ render() { let label: any = 'Select Student' - if (this.props.route.params.hasOwnProperty('data')) { + if (this.props?.route?.params?.hasOwnProperty('data')) { const dataParams: any = this.props.route.params.data label = dataParams.grade_standard } return ( {label} + {!this.props?.route?.params?.hasOwnProperty('data') && !this.state.parent && + Filter by Class + } {!this.props.loading && this.props.studentList &&