sprint-bug-fixing (#7)

Co-authored-by: Karthik Sammy <10769@intelizign.com>
Reviewed-on: WizdomWaves/TedQuMobileApp#7
This commit is contained in:
karthik 2024-11-22 11:33:18 +00:00
parent 1f40003d01
commit 97caa2a276
9 changed files with 230 additions and 223 deletions

View File

@ -107,7 +107,7 @@ class AttendanceView extends React.Component<any, any>{
class_info: classDataInfo, action: common.attendance, students: studentList, isHome: false, routeTo: "AttendanceView", label: "Attendances" class_info: classDataInfo, action: common.attendance, students: studentList, isHome: false, routeTo: "AttendanceView", label: "Attendances"
}) })
} else { } else {
Toast.show("No students in this class", Toast.SHORT) Toast.show("No Students Present In this Class", Toast.SHORT)
} }
} }

View File

@ -30,7 +30,7 @@ const tagsStyles = {
} }
} }
class DiaryView extends React.PureComponent<any, any>{ class DiaryView extends React.PureComponent<any, any> {
// contentWidth:any = useWindowDimensions().width; // contentWidth:any = useWindowDimensions().width;
static propTypes = {}; static propTypes = {};
isLoggedinAs: any; isLoggedinAs: any;
@ -45,7 +45,7 @@ class DiaryView extends React.PureComponent<any, any>{
reply: "", reply: "",
academicYear: '', academicYear: '',
isFetching: false, isFetching: false,
records:[] records: []
}; };
constructor(props: any) { constructor(props: any) {
@ -110,7 +110,7 @@ class DiaryView extends React.PureComponent<any, any>{
this.fetchDiaryDetailList() this.fetchDiaryDetailList()
} }
componentDidUpdate(prevProps:any) { componentDidUpdate(prevProps: any) {
if (this.props.replyData.hasOwnProperty('status')) { if (this.props.replyData.hasOwnProperty('status')) {
if (this.props.replyData.status) { if (this.props.replyData.status) {
this.setState({ page: 1, reply: '' }) this.setState({ page: 1, reply: '' })
@ -121,7 +121,7 @@ class DiaryView extends React.PureComponent<any, any>{
}) })
} }
} }
if(prevProps.records != this.props.records){ if (prevProps.records != this.props.records) {
this.setState({ records: this.props.records }) this.setState({ records: this.props.records })
} }
} }
@ -144,7 +144,7 @@ class DiaryView extends React.PureComponent<any, any>{
page: this.state.page, token: this.token, academic_year: this.state.academicYear.toString(), class_id: this.props.route.params.info.class_id, page: this.state.page, token: this.token, academic_year: this.state.academicYear.toString(), class_id: this.props.route.params.info.class_id,
sort_by: 'asc', order_by: 'created_at' sort_by: 'asc', order_by: 'created_at'
}) })
this.setState({isFetching: false,}) this.setState({ isFetching: false, })
} }
hasLoadMore = () => { hasLoadMore = () => {
@ -169,7 +169,7 @@ class DiaryView extends React.PureComponent<any, any>{
reply: data, reply: data,
is_completed: item.is_completed is_completed: item.is_completed
} }
if ((item?.id && data && !item.is_homework) || (item.is_homework && this.isLoggedinAs === UserRoles.parent) || (item.is_homework && data)) { if ((item?.id && data && !item.is_homework) || (item.is_homework && this.isLoggedinAs === UserRoles.parent) || (item.is_homework && data)) {
this.props.sendReplyDiary({ this.props.sendReplyDiary({
token: this.token, id: item?.id, data: diaryResponse token: this.token, id: item?.id, data: diaryResponse
}) })
@ -177,35 +177,35 @@ class DiaryView extends React.PureComponent<any, any>{
} }
onRefresh() { onRefresh() {
this.setState({isFetching: true,},() => {this.fetchDiaryDetailList()}); this.setState({ isFetching: true, }, () => { this.fetchDiaryDetailList() });
} }
toDiaryCreate = () => { toDiaryCreate = () => {
if(!this.props.loading) { if (!this.props.loading) {
this.pageCountReset() this.pageCountReset()
this.props.navigation.navigate("DiaryCreate", { info: this.props.route.params.info }) this.props.navigation.navigate("DiaryCreate", { info: this.props.route.params.info })
} }
} }
handleOptionChange = (id:any, selectedOption:any) => { handleOptionChange = (id: any, selectedOption: any) => {
const is_completed = selectedOption == "true" ? true : false const is_completed = selectedOption == "true" ? true : false
const updatedData = this.state.records.map((item:any) => const updatedData = this.state.records.map((item: any) =>
item.id === id ? { ...item, is_completed } : item item.id === id ? { ...item, is_completed } : item
); );
this.setState({ records: updatedData}) this.setState({ records: updatedData })
}; };
renderRow = ({ item }: any) => { renderRow = ({ item }: any) => {
const renderers = { const renderers = {
oembed: (attribs:any) => { oembed: (attribs: any) => {
if (!attribs || !attribs.url) { if (!attribs || !attribs.url) {
return null return null
} }
const { url } = attribs const { url } = attribs
const videoIdIUrl = url.replace("watch?v=", "embed/") const videoIdIUrl = url.replace("watch?v=", "embed/")
const videoWidth = contentWidth - 20 const videoWidth = contentWidth - 20
const videoHeight = (videoWidth * 9) / 16 const videoHeight = (videoWidth * 9) / 16
return ( return (
<WebView <WebView
style={{ style={{
@ -222,14 +222,14 @@ class DiaryView extends React.PureComponent<any, any>{
} }
const tagsStyles = { const tagsStyles = {
table: { table: {
borderBottomWidth: 1, borderBottomWidth: 1,
borderRightWidth: 1, borderRightWidth: 1,
borderColor: '#bfbfbf' borderColor: '#bfbfbf'
}, },
td: { td: {
borderWidth: 1, borderWidth: 1,
borderRightWidth: 0, borderRightWidth: 0,
borderBottomWidth: 0, borderBottomWidth: 0,
borderColor: '#bfbfbf', borderColor: '#bfbfbf',
padding: 10, padding: 10,
@ -237,21 +237,21 @@ class DiaryView extends React.PureComponent<any, any>{
}; };
return ( return (
<View style={[AppStyles.diaryCard]}> <View style={[AppStyles.diaryCard]}>
<View style={[AppStyles.diaryHeaderContainer, BaseStyles.padHorizontal10]}> <View style={[AppStyles.diaryHeaderContainer, BaseStyles.padHorizontal10]}>
<Text style={[AppStyles.diaryLabel, { width: "75%" }]}>{item?.title}</Text> <Text style={[AppStyles.diaryLabel, { width: "75%" }]}>{item?.title}</Text>
<Text style={[AppStyles.diaryTypeLabel, AppStyles.diaryRemark]}>{item?.diary_type_name}</Text> <Text style={[AppStyles.diaryTypeLabel, AppStyles.diaryRemark]}>{item?.diary_type_name}</Text>
</View> </View>
{item?.class_list && item?.class_list.map((classInfo: any, classIndex: any) => ( {item?.class_list && item?.class_list.map((classInfo: any, classIndex: any) => (
<View key={classIndex} style={[AppStyles.diaryNameContainer, BaseStyles.marTop10, BaseStyles.padHorizontal10]}> <View key={classIndex} style={[AppStyles.diaryNameContainer, BaseStyles.marTop10, BaseStyles.padHorizontal10]}>
{classInfo?.is_all && classInfo?.class_name && <Text style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{classInfo?.class_name}</Text>} {classInfo?.is_all && classInfo?.class_name && <Text style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{classInfo?.class_name}</Text>}
{!classInfo?.is_all && classInfo?.student_list && classInfo?.student_list.map((studentInfo: any, index: any) => ( {!classInfo?.is_all && classInfo?.student_list && classInfo?.student_list.map((studentInfo: any, index: any) => (
<Text key={index} style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{studentInfo?.student_name}</Text> <Text key={index} style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{studentInfo?.student_name}</Text>
))} ))}
</View>))} </View>))}
<View style={[BaseStyles.marBottom10, BaseStyles.padHorizontal10,]}> <View style={[BaseStyles.marBottom10, BaseStyles.padHorizontal10,]}>
{/* <AutoHeightWebView {/* <AutoHeightWebView
style={{ width: '100%', marginVertical: 16 }} style={{ width: '100%', marginVertical: 16 }}
customStyle={` customStyle={`
table, th, td { table, th, td {
@ -266,166 +266,166 @@ class DiaryView extends React.PureComponent<any, any>{
source={{ html: item?.message }} source={{ html: item?.message }}
scrollEnabled={false} scrollEnabled={false}
/> */} /> */}
<RenderHtml <RenderHtml
source={{ html: `<div class="html-format">${item?.message}</div>` }} source={{ html: `<div class="html-format">${item?.message}</div>` }}
contentWidth={contentWidth-40} contentWidth={contentWidth - 40}
tagsStyles={tagsStyles} tagsStyles={tagsStyles}
classesStyles={{ classesStyles={{
'html-format': { 'html-format': {
fontFamily: "Quicksand_500Medium", color: BaseColors.black, fontFamily: "Quicksand_500Medium", color: BaseColors.black,
fontSize: 15 fontSize: 15
}, },
}} }}
renderers={renderers} renderers={renderers}
/> />
</View>
<View style={[BaseStyles.marBottom5, BaseStyles.padHorizontal10]}>
{item?.images !== '' && this.imageBaseUrl !== '' && <TouchableOpacity style={{ width: 160, height: 120, borderWidth: 1, borderColor: BaseColors.grey, borderRadius: 10 }}
onPress={this.onImagePreview.bind(this, item?.images)}>
<Image source={{ uri: `${this.imageBaseUrl + item?.images}` }} style={[AppStyles.diaryViewImage]} />
</TouchableOpacity>}
</View>
<Sepator />
<View style={[BaseStyles.padHorizontal10, { alignItems: "flex-end" }]}>
<Text style={[AppStyles.diaryCreatedBy, BaseStyles.font500Medium]}>
by <Text style={[BaseStyles.font700Bold]}>{item?.posted_by} </Text> {item?.created_at && <Text>{moment(item?.created_at).fromNow()}</Text>}
</Text>
</View>
{item?.is_homework && (this.isLoggedinAs === UserRoles.parent) &&
<View>
<RadioButton.Group
onValueChange={(value) => this.handleOptionChange(item.id, value)}
value={item.is_completed ? "true" : "false"}
>
<View style={styles.radioContainer}>
<RadioButton.Android value="true" />
<Text style={styles.radioLabel}>Completed</Text>
</View>
<View style={styles.radioContainer}>
<RadioButton.Android value="false" />
<Text style={styles.radioLabel}>Incomplete</Text>
</View>
</RadioButton.Group>
</View>}
<View style={[{ flex: 1, flexDirection: 'row' }]}>
<View style={[BaseStyles.padHorizontal10, AppStyles.DiaryReplyView, BaseStyles.marTop10, BaseStyles.marLeft10]} >
<TextInput style={[AppStyles.DiaryReplyText, { height: 30 }]} keyboardType="default" placeholder="Enter your reply" multiline={true} editable={true}
onChangeText={replyText => this.setState({ reply: replyText })} />
</View> </View>
<View style={[{ alignItems: 'center', justifyContent: 'center' }]}>
<TouchableOpacity style={[AppStyles.btnSend]} onPress={this.toDiaryReply.bind(this, this.state.reply, item)} activeOpacity={0.8}> <View style={[BaseStyles.marBottom5, BaseStyles.padHorizontal10]}>
<FontAwesome name="send" size={15} style={[AppStyles.sendIcon, { fontWeight: 'bold', textAlign: 'center' }]} /> {item?.images !== '' && this.imageBaseUrl !== '' && <TouchableOpacity style={{ width: 160, height: 120, borderWidth: 1, borderColor: BaseColors.grey, borderRadius: 10 }}
</TouchableOpacity> onPress={this.onImagePreview.bind(this, item?.images)}>
<Image source={{ uri: `${this.imageBaseUrl + item?.images}` }} style={[AppStyles.diaryViewImage]} />
</TouchableOpacity>}
</View> </View>
<Sepator />
<View style={[BaseStyles.padHorizontal10, { alignItems: "flex-end" }]}>
<Text style={[AppStyles.diaryCreatedBy, BaseStyles.font500Medium]}>
by <Text style={[BaseStyles.font700Bold]}>{item?.posted_by} </Text> {item?.created_at && <Text>{moment(item?.created_at).fromNow()}</Text>}
</Text>
</View>
{item?.is_homework && (this.isLoggedinAs === UserRoles.parent) &&
<View>
<RadioButton.Group
onValueChange={(value) => this.handleOptionChange(item.id, value)}
value={item.is_completed ? "true" : "false"}
>
<View style={styles.radioContainer}>
<RadioButton.Android value="true" />
<Text style={styles.radioLabel}>Completed</Text>
</View>
<View style={styles.radioContainer}>
<RadioButton.Android value="false" />
<Text style={styles.radioLabel}>Incomplete</Text>
</View>
</RadioButton.Group>
</View>}
<View style={[{ flex: 1, flexDirection: 'row' }]}>
<View style={[BaseStyles.padHorizontal10, AppStyles.DiaryReplyView, BaseStyles.marTop10, BaseStyles.marLeft10]} >
<TextInput style={[AppStyles.DiaryReplyText, { height: 30 }]} keyboardType="default" placeholder="Enter your reply" multiline={true} editable={true}
onChangeText={replyText => this.setState({ reply: replyText })} />
</View>
<View style={[{ alignItems: 'center', justifyContent: 'center' }]}>
<TouchableOpacity style={[AppStyles.btnSend]} onPress={this.toDiaryReply.bind(this, this.state.reply, item)} activeOpacity={0.8}>
<FontAwesome name="send" size={15} style={[AppStyles.sendIcon, { fontWeight: 'bold', textAlign: 'center' }]} />
</TouchableOpacity>
</View>
</View>
{!(item.is_homework && item.is_homework) ?
item?.reply && item?.reply.map((replyInfo: any, index: any) => (
(this.signedUserId === replyInfo?.parent_id) ?
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", alignItems: 'flex-end' }]}>
{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel, BaseStyles.marLeft10,]}>{replyInfo?.message}</Text>
</View>
</View> :
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, BaseStyles.marTop5, { padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 10 }]}>
<Text style={[AppStyles.nameLabel, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", }]}>{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel]}>{replyInfo?.message}</Text>
</View>
</View>
))
:
<View>
<View style={[BaseStyles.marVertical2, BaseStyles.marTop10, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row' }]}>
<View style={[AppStyles.tagLabelWoBorder, AppStyles.weakGoodColor11, { borderRadius: 16, paddingRight: 40, minWidth: '35%', Width: '35%' }]}>
<Text style={{ color: BaseColors.white }}>Students</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor: "rgb(248, 201, 124)", position: 'relative', right: 28 }]}>
<Text style={{ color: "rgb(248, 201, 124)" }}> {item.class_list[0].no_of_assessments}</Text>
</View>
</View>
<View style={[BaseStyles.marVertical2, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row', }]}>
<View style={[AppStyles.tagLabelWoBorder, { backgroundColor: "#00B200", borderRadius: 16, paddingRight: 40, minWidth: '35%', Width: '35%' }]}>
<Text style={{ color: BaseColors.white }}>Completed</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor: "#00B200", position: 'relative', right: 28 }]}>
<Text style={{ color: "#00B200" }}> {item.class_list[0].no_of_completed}</Text>
</View>
</View>
<View style={[BaseStyles.marVertical2, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row', }]}>
<View style={[AppStyles.tagLabelWoBorder, { backgroundColor: "#ff4d01", borderRadius: 16, paddingRight: 40, minWidth: '35%', Width: '35%' }]}>
<Text style={{ color: BaseColors.white }}>Incompleted</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor: "#ff4d01", position: 'relative', right: 28 }]}>
<Text style={{ color: "#ff4d01" }}> {item.class_list[0].no_of_incompleted}</Text>
</View>
</View>
{item?.student_list.map((student: any, index: any) => (
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{student?.student_name && student?.student_name.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<View style={[AppStyles.diaryHeaderContainer]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000",width: '60%' }]}>
{student?.student_name?.charAt(0).toUpperCase() + student?.student_name.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {(student?.reply_date) ? moment(student?.reply_date).fromNow() : ''}</Text>
</Text>
<Text style={[AppStyles.diaryTypeLabel, AppStyles.diaryHomeWork, { justifyContent: 'center' }]}>
{student.is_completed ? "Completed" : "Incompleted"}
</Text>
</View>
<Text style={[AppStyles.stdLabel, BaseStyles.marLeft10, { fontSize: 12}]}>{student?.reply}</Text>
</View>
</View>
))}
{item?.others_reply && item?.others_reply.map((replyInfo: any, index: any) => (
(this.signedUserId === replyInfo?.parent_id) ?
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", alignItems: 'flex-end' }]}>
{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel, BaseStyles.marLeft10,]}>{replyInfo?.message}</Text>
</View>
</View> :
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, BaseStyles.marTop5, { padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 10 }]}>
<Text style={[AppStyles.nameLabel, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", }]}>{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel]}>{replyInfo?.message}</Text>
</View>
</View>
))}
</View>
}
</View> </View>
)
{! (item.is_homework && item.is_homework) ?
item?.reply && item?.reply.map((replyInfo: any, index: any) => (
(this.signedUserId === replyInfo?.parent_id) ?
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", alignItems: 'flex-end' }]}>
{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel, BaseStyles.marLeft10,]}>{replyInfo?.message}</Text>
</View>
</View> :
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, BaseStyles.marTop5, { padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 10 }]}>
<Text style={[AppStyles.nameLabel, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", }]}>{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel]}>{replyInfo?.message}</Text>
</View>
</View>
))
:
<View>
<View style={[BaseStyles.marVertical2, BaseStyles.marTop10, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row'}]}>
<View style={[AppStyles.tagLabelWoBorder, AppStyles.weakGoodColor11, {borderRadius: 16, paddingRight: 40, minWidth:'35%', Width:'35%'}]}>
<Text style={{ color: BaseColors.white }}>Students</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor:"rgb(248, 201, 124)", position: 'relative', right: 28 }]}>
<Text style={{ color:"rgb(248, 201, 124)" }}> {item.class_list[0].no_of_assessments}</Text>
</View>
</View>
<View style={[BaseStyles.marVertical2, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row', }]}>
<View style={[AppStyles.tagLabelWoBorder, { backgroundColor:"#00B200", borderRadius: 16, paddingRight: 40, minWidth:'35%', Width:'35%' }]}>
<Text style={{ color: BaseColors.white }}>Completed</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor:"#00B200", position: 'relative', right: 28 }]}>
<Text style={{ color:"#00B200" }}> {item.class_list[0].no_of_completed}</Text>
</View>
</View>
<View style={[BaseStyles.marVertical2, BaseStyles.marHorizontal10, BaseStyles.padHorizontal10, { flexDirection: 'row', }]}>
<View style={[AppStyles.tagLabelWoBorder, { backgroundColor:"#ff4d01", borderRadius: 16, paddingRight: 40, minWidth:'35%', Width:'35%' }]}>
<Text style={{ color: BaseColors.white }}>Incompleted</Text>
</View>
<View style={[AppStyles.tagLabelWoBorder,
{ backgroundColor: BaseColors.white, borderWidth: 1, borderRadius: 16, borderColor:"#ff4d01", position: 'relative', right: 28 }]}>
<Text style={{ color:"#ff4d01" }}> {item.class_list[0].no_of_incompleted}</Text>
</View>
</View>
{item?.student_list.map((student: any, index: any) => (
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{student?.student_name && student?.student_name.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, BaseStyles.marBottom5, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", alignItems: 'flex-end' }]}>
{student.student_name.charAt(0).toUpperCase() + student.student_name.slice(1)}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {student?.reply_date && moment(student?.reply_date).fromNow()}</Text></Text>
<View style={[BaseStyles.marLeft10, {display:'flex', flexDirection:'row'}]}>
<Text style={[ AppStyles.diaryTypeLabel, AppStyles.diaryHomeWork, { alignItems: 'flex-end' }]}>
{student.is_completed ? "Completed" : "Incompleted"}
</Text>
<Text style={[AppStyles.stdLabel, { fontSize: 11, color: "#bab8b8" }]}> {student?.reply && student?.reply}</Text>
</View>
</View>
</View>
))}
{item?.others_reply && item?.others_reply.map((replyInfo: any, index: any) => (
(this.signedUserId === replyInfo?.parent_id) ?
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, { flexDirection: 'row-reverse', padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.marRight10, BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 20 }]}>
<Text style={[AppStyles.nameLabel, BaseStyles.marLeft10, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", alignItems: 'flex-end' }]}>
{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel, BaseStyles.marLeft10,]}>{replyInfo?.message}</Text>
</View>
</View> :
<View key={index} style={[BaseStyles.padHorizontal10, AppStyles.studentCard, BaseStyles.marTop5, { padding: 7, marginBottom: 0 }]}>
<View style={[{ backgroundColor: BaseColors.headerStyleBackgroundColor, alignSelf: 'center', justifyContent: 'center' }, styles.listViewImage, BaseStyles.marRight10]}>
<Text style={{ fontSize: 14, color: BaseColors.white, textAlign: 'center' }}>{replyInfo?.username && replyInfo?.username.charAt(0).toUpperCase() || 'NA'}</Text>
</View>
<View style={[BaseStyles.padding10, { flexDirection: 'column', width: '85%', backgroundColor: "#f5f7f7", borderRadius: 10 }]}>
<Text style={[AppStyles.nameLabel, { fontSize: 15, fontFamily: "Quicksand_700Bold", color: "#000", }]}>{replyInfo?.username.charAt(0).toUpperCase() + replyInfo?.username.slice(1) || 'NA'}
<Text style={{ fontSize: 11, color: "#bab8b8" }}> {moment(replyInfo?.reply_date).fromNow()}</Text></Text>
<Text style={[AppStyles.stdLabel]}>{replyInfo?.message}</Text>
</View>
</View>
))}
</View>
}
</View>
)
} }
render() { render() {
@ -438,7 +438,7 @@ class DiaryView extends React.PureComponent<any, any>{
} }
} }
this.state.records.forEach((diaryInfo: any) => { this.state.records.forEach((diaryInfo: any) => {
if (diaryCategoryList.length) { if (diaryCategoryList.length) {
const findDiaryType: any = diaryCategoryList.find((item: any) => item.id === parseInt(diaryInfo.diary_type)) const findDiaryType: any = diaryCategoryList.find((item: any) => item.id === parseInt(diaryInfo.diary_type))
if (findDiaryType) { if (findDiaryType) {
@ -462,7 +462,7 @@ class DiaryView extends React.PureComponent<any, any>{
renderItem={this.renderRow} renderItem={this.renderRow}
keyExtractor={(item, index) => index.toString()} keyExtractor={(item, index) => index.toString()}
onEndReached={this.hasLoadMore} onEndReached={this.hasLoadMore}
onEndReachedThreshold={0.1} onEndReachedThreshold={0.1}
removeClippedSubviews={false} removeClippedSubviews={false}
initialNumToRender={2} initialNumToRender={2}
onRefresh={() => this.onRefresh()} onRefresh={() => this.onRefresh()}

View File

@ -13,7 +13,7 @@ import moment from "moment"
import messaging from '@react-native-firebase/messaging' import messaging from '@react-native-firebase/messaging'
import Toast from 'react-native-simple-toast' import Toast from 'react-native-simple-toast'
class Home extends React.Component<any, any>{ class Home extends React.Component<any, any> {
static propTypes = {}; static propTypes = {};
token: any; token: any;
isLoggedinAs: any; isLoggedinAs: any;
@ -109,8 +109,8 @@ class Home extends React.Component<any, any>{
if ((userDetails.usertype === UserRoles.schoolAdmin) || (userDetails.usertype === UserRoles.teacher)) { if ((userDetails.usertype === UserRoles.schoolAdmin) || (userDetails.usertype === UserRoles.teacher)) {
this.fetchAdminDashboardList() this.fetchAdminDashboardList()
} else if (userDetails.usertype === UserRoles.parent) { } else if (userDetails.usertype === UserRoles.parent) {
this.fetchParentDashboardList() this.fetchParentDashboardList()
this.onNotificationOpen() this.onNotificationOpen()
} }
} }
@ -161,7 +161,7 @@ class Home extends React.Component<any, any>{
class_info: classDataInfo, action: this.state.action, students: studentList.data, isHome: true, routeTo: "Home", label: "Attendance" class_info: classDataInfo, action: this.state.action, students: studentList.data, isHome: true, routeTo: "Home", label: "Attendance"
}) })
} else { } else {
Toast.show("No students in this class", Toast.SHORT) Toast.show("No Students Present In this Class", Toast.SHORT)
} }
} }
/** Resets the action once the AR tag was proceeded */ /** Resets the action once the AR tag was proceeded */
@ -181,7 +181,7 @@ class Home extends React.Component<any, any>{
class_info: classDataInfo, action: this.state.action, students: studentList.data, isHome: true, routeTo: "Home", label: "Instant Feedback" class_info: classDataInfo, action: this.state.action, students: studentList.data, isHome: true, routeTo: "Home", label: "Instant Feedback"
}) })
} else { } else {
Toast.show("No students in this class", Toast.SHORT) Toast.show("No Students Present In this Class", Toast.SHORT)
} }
} }
@ -192,14 +192,14 @@ class Home extends React.Component<any, any>{
onInstantFeedback = (data: any) => { onInstantFeedback = (data: any) => {
if (data?.class_active) { if (data?.class_active) {
if(data?.is_attendance_taken && data?.is_teacher_present){ if (data?.is_attendance_taken && data?.is_teacher_present) {
this.setState({ class_info: data, action: 'instantFeedback' }) this.setState({ class_info: data, action: 'instantFeedback' })
this.props.getStudentsList({ token: this.token, class_id: data.class_id, academic_year: this.state.academicYear.toString() }) this.props.getStudentsList({ token: this.token, class_id: data.class_id, academic_year: this.state.academicYear.toString() })
}else if(!data?.is_teacher_present){ } else if (!data?.is_teacher_present) {
Toast.show("Unable to taken you are absent now", Toast.SHORT) Toast.show("Unable to take instant feedback as you are absent", Toast.SHORT)
}else{ } else {
Toast.show("Attendance not taken for students", Toast.SHORT) Toast.show("Attendance not taken for students", Toast.SHORT)
} }
} else { } else {
Toast.show("Class is inactive", Toast.SHORT) Toast.show("Class is inactive", Toast.SHORT)
} }
@ -207,13 +207,13 @@ class Home extends React.Component<any, any>{
onAttendance = (data: any) => { onAttendance = (data: any) => {
if (data?.class_active) { if (data?.class_active) {
if(!data?.is_attendance_taken && data?.is_teacher_present){ if (!data?.is_attendance_taken && data?.is_teacher_present) {
this.setState({ class_info: data, action: 'attendance' }) this.setState({ class_info: data, action: 'attendance' })
this.props.getStudentsList({ token: this.token, class_id: data.class_id, academic_year: this.state.academicYear.toString() }) this.props.getStudentsList({ token: this.token, class_id: data.class_id, academic_year: this.state.academicYear.toString() })
}else if(!data?.is_teacher_present){ } else if (!data?.is_teacher_present) {
Toast.show("Unable to taken you are absent now", Toast.SHORT) Toast.show("Unable to take attendance as you are absent", Toast.SHORT)
} }
else{ else {
Toast.show("Attendance Already Taken", Toast.SHORT) Toast.show("Attendance Already Taken", Toast.SHORT)
} }
} else { } else {
@ -269,7 +269,7 @@ class Home extends React.Component<any, any>{
<Text style={[BaseStyles.textCenter, BaseStyles.font32, BaseStyles.colorWhite]}>{item?.student_name && item?.student_name.charAt(0)}</Text> <Text style={[BaseStyles.textCenter, BaseStyles.font32, BaseStyles.colorWhite]}>{item?.student_name && item?.student_name.charAt(0)}</Text>
</View> </View>
} }
<View style={[BaseStyles.flexColum, BaseStyles.padding10]}> <View style={[BaseStyles.flexColum, BaseStyles.padding10, { width: '80%' }]}>
<Text style={[BaseStyles.marBottom5, BaseStyles.font18, AppStyles.nameLabel]}>{item?.student_name}</Text> <Text style={[BaseStyles.marBottom5, BaseStyles.font18, AppStyles.nameLabel]}>{item?.student_name}</Text>
<Text style={[BaseStyles.marBottom5, AppStyles.stdLabel]}>Card ID {item?.card_id}</Text> <Text style={[BaseStyles.marBottom5, AppStyles.stdLabel]}>Card ID {item?.card_id}</Text>
<Text style={[BaseStyles.marBottom5, AppStyles.stdLabel]}>Attendance {item?.attendance}%</Text> <Text style={[BaseStyles.marBottom5, AppStyles.stdLabel]}>Attendance {item?.attendance}%</Text>

View File

@ -113,7 +113,7 @@ class InstantFeedbackCreate extends React.Component<any, any>{
class_info: classDataInfo, action: common.instantFeedback, students: studentList, isHome: false, routeTo: "InstantFeedbackView", label: "Instant Feedback" class_info: classDataInfo, action: common.instantFeedback, students: studentList, isHome: false, routeTo: "InstantFeedbackView", label: "Instant Feedback"
}) })
} else { } else {
Toast.show("No students in this class", Toast.SHORT) Toast.show("No Students Present In this Class", Toast.SHORT)
} }
} }
} }

View File

@ -155,13 +155,16 @@ class AssessmentEdit extends React.Component<any, any>{
} }
handleStarPress = (newRating:any, rowIndex:any, questionId:any) => { handleStarPress = (newRating:any, rowIndex:any, questionId:any) => {
const updatedRating = newRating + rowIndex * 5; let updatedRating = newRating + rowIndex * 5;
this.setState({ rating: updatedRating }); this.setState({ rating: updatedRating });
const updatedQuestions = this.state.question_details.map((question:any) => ({ const updatedQuestions = this.state.question_details.map((question:any) => ({
...question, ...question,
question: question.question.map((q:any) => { question: question.question.map((q:any) => {
if (q.question_id === questionId) { if (q.question_id === questionId) {
if(q?.currentRating == 0.5) {
updatedRating = 0;
}
return { ...q, currentRating: updatedRating }; return { ...q, currentRating: updatedRating };
} }
return q; return q;
@ -193,6 +196,8 @@ class AssessmentEdit extends React.Component<any, any>{
fullStarColor={'orange'} fullStarColor={'orange'}
starSize={35} // Adjust the size of each star starSize={35} // Adjust the size of each star
halfStarEnabled={true} halfStarEnabled={true}
enableSwiping
/> />
); );
} }

View File

@ -16,7 +16,7 @@ const Sepator = ({ style }: any) => <View style={[BaseStyles.borderSeparator, st
const { width } = Dimensions.get('window') const { width } = Dimensions.get('window')
class QuestionBank extends React.Component<any, any>{ class QuestionBank extends React.Component<any, any> {
// static navigationOptions = ({ navigation }: any) => ({ // static navigationOptions = ({ navigation }: any) => ({
// headerTitle: navigation.state.params?.data?.question_name || 'Quizzes', // headerTitle: navigation.state.params?.data?.question_name || 'Quizzes',
// }); // });
@ -105,8 +105,8 @@ class QuestionBank extends React.Component<any, any>{
keyExtractor={(item, index) => index.toString()} keyExtractor={(item, index) => index.toString()}
/> />
} }
{!this.props.loading && this.props.records.length === 0 &&
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
{this.props.loading && <View style={[BaseStyles.marVertical20, { flex: 1, justifyContent: 'center' }]}> {this.props.loading && <View style={[BaseStyles.marVertical20, { flex: 1, justifyContent: 'center' }]}>
<ActivityIndicator size="large" color="#7165e3" /> <ActivityIndicator size="large" color="#7165e3" />
</View>} </View>}
@ -129,7 +129,7 @@ const styles = StyleSheet.create({
shadowOpacity: 0.3, shadowOpacity: 0.3,
shadowRadius: 2, shadowRadius: 2,
elevation: 2, elevation: 2,
}, },
}) })

View File

@ -476,6 +476,8 @@ class QuestionSetImport extends React.Component<any, any>{
)} )}
onBlur={handleBlur(`questions.${index}.question`)} onBlur={handleBlur(`questions.${index}.question`)}
value={values.questions[index].question} value={values.questions[index].question}
height={40}
multiline={true}
/> />
</View> </View>
{errors.questions && {errors.questions &&

View File

@ -127,11 +127,11 @@ class TakeQuizzes extends React.Component<any, any>{
class_info: classDataInfo, action: common.quiz, students: studentList, isHome: false, routeTo: "TakeQuizzes", label: "Quiz" class_info: classDataInfo, action: common.quiz, students: studentList, isHome: false, routeTo: "TakeQuizzes", label: "Quiz"
}) })
} else { } else {
Toast.show("No students in this class", Toast.SHORT) Toast.show("No Students Present In this Class", Toast.SHORT)
} }
} }
}else if(!quizAdminparams?.is_teacher_present){ }else if(!quizAdminparams?.is_teacher_present){
Toast.show("Unable to taken you are absent now", Toast.SHORT) Toast.show("Unable to take Quizzes as you are absent", Toast.SHORT)
}else{ }else{
Toast.show("Attendance not taken for students", Toast.SHORT) Toast.show("Attendance not taken for students", Toast.SHORT)
} }

View File

@ -517,7 +517,7 @@ export const AppStyles = StyleSheet.create({
height: 34, height: 34,
color: "#4a537c", color: "#4a537c",
fontFamily: "Quicksand_500Medium", fontFamily: "Quicksand_500Medium",
padding: 5, padding: 2,
fontSize: 16 fontSize: 16
}, },
pickerText: { pickerText: {