|
|
|
@ -30,7 +30,7 @@ const tagsStyles = {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
class DiaryView extends React.PureComponent<any, any> {
|
|
|
|
|
// contentWidth:any = useWindowDimensions().width;
|
|
|
|
|
static propTypes = {};
|
|
|
|
|
isLoggedinAs: any;
|
|
|
|
@ -45,7 +45,7 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
reply: "",
|
|
|
|
|
academicYear: '',
|
|
|
|
|
isFetching: false,
|
|
|
|
|
records:[]
|
|
|
|
|
records: []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
constructor(props: any) {
|
|
|
|
@ -110,7 +110,7 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
this.fetchDiaryDetailList()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps:any) {
|
|
|
|
|
componentDidUpdate(prevProps: any) {
|
|
|
|
|
if (this.props.replyData.hasOwnProperty('status')) {
|
|
|
|
|
if (this.props.replyData.status) {
|
|
|
|
|
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 })
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -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,
|
|
|
|
|
sort_by: 'asc', order_by: 'created_at'
|
|
|
|
|
})
|
|
|
|
|
this.setState({isFetching: false,})
|
|
|
|
|
this.setState({ isFetching: false, })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hasLoadMore = () => {
|
|
|
|
@ -169,7 +169,7 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
reply: data,
|
|
|
|
|
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({
|
|
|
|
|
token: this.token, id: item?.id, data: diaryResponse
|
|
|
|
|
})
|
|
|
|
@ -177,35 +177,35 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRefresh() {
|
|
|
|
|
this.setState({isFetching: true,},() => {this.fetchDiaryDetailList()});
|
|
|
|
|
}
|
|
|
|
|
this.setState({ isFetching: true, }, () => { this.fetchDiaryDetailList() });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toDiaryCreate = () => {
|
|
|
|
|
if(!this.props.loading) {
|
|
|
|
|
toDiaryCreate = () => {
|
|
|
|
|
if (!this.props.loading) {
|
|
|
|
|
this.pageCountReset()
|
|
|
|
|
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 updatedData = this.state.records.map((item:any) =>
|
|
|
|
|
const updatedData = this.state.records.map((item: any) =>
|
|
|
|
|
item.id === id ? { ...item, is_completed } : item
|
|
|
|
|
);
|
|
|
|
|
this.setState({ records: updatedData})
|
|
|
|
|
|
|
|
|
|
this.setState({ records: updatedData })
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
renderRow = ({ item }: any) => {
|
|
|
|
|
const renderers = {
|
|
|
|
|
oembed: (attribs:any) => {
|
|
|
|
|
oembed: (attribs: any) => {
|
|
|
|
|
if (!attribs || !attribs.url) {
|
|
|
|
|
return null
|
|
|
|
|
}
|
|
|
|
|
const { url } = attribs
|
|
|
|
|
const videoIdIUrl = url.replace("watch?v=", "embed/")
|
|
|
|
|
const videoWidth = contentWidth - 20
|
|
|
|
|
const videoHeight = (videoWidth * 9) / 16
|
|
|
|
|
const { url } = attribs
|
|
|
|
|
const videoIdIUrl = url.replace("watch?v=", "embed/")
|
|
|
|
|
const videoWidth = contentWidth - 20
|
|
|
|
|
const videoHeight = (videoWidth * 9) / 16
|
|
|
|
|
return (
|
|
|
|
|
<WebView
|
|
|
|
|
style={{
|
|
|
|
@ -222,14 +222,14 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const tagsStyles = {
|
|
|
|
|
table: {
|
|
|
|
|
table: {
|
|
|
|
|
borderBottomWidth: 1,
|
|
|
|
|
borderRightWidth: 1,
|
|
|
|
|
borderRightWidth: 1,
|
|
|
|
|
borderColor: '#bfbfbf'
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
td: {
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
borderRightWidth: 0,
|
|
|
|
|
borderRightWidth: 0,
|
|
|
|
|
borderBottomWidth: 0,
|
|
|
|
|
borderColor: '#bfbfbf',
|
|
|
|
|
padding: 10,
|
|
|
|
@ -237,21 +237,21 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<View style={[AppStyles.diaryCard]}>
|
|
|
|
|
<View style={[AppStyles.diaryHeaderContainer, BaseStyles.padHorizontal10]}>
|
|
|
|
|
<Text style={[AppStyles.diaryLabel, { width: "75%" }]}>{item?.title}</Text>
|
|
|
|
|
<Text style={[AppStyles.diaryTypeLabel, AppStyles.diaryRemark]}>{item?.diary_type_name}</Text>
|
|
|
|
|
<View style={[AppStyles.diaryCard]}>
|
|
|
|
|
<View style={[AppStyles.diaryHeaderContainer, BaseStyles.padHorizontal10]}>
|
|
|
|
|
<Text style={[AppStyles.diaryLabel, { width: "75%" }]}>{item?.title}</Text>
|
|
|
|
|
<Text style={[AppStyles.diaryTypeLabel, AppStyles.diaryRemark]}>{item?.diary_type_name}</Text>
|
|
|
|
|
|
|
|
|
|
</View>
|
|
|
|
|
{item?.class_list && item?.class_list.map((classInfo: any, classIndex: any) => (
|
|
|
|
|
<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?.student_list && classInfo?.student_list.map((studentInfo: any, index: any) => (
|
|
|
|
|
<Text key={index} style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{studentInfo?.student_name}</Text>
|
|
|
|
|
))}
|
|
|
|
|
</View>))}
|
|
|
|
|
<View style={[BaseStyles.marBottom10, BaseStyles.padHorizontal10,]}>
|
|
|
|
|
{/* <AutoHeightWebView
|
|
|
|
|
</View>
|
|
|
|
|
{item?.class_list && item?.class_list.map((classInfo: any, classIndex: any) => (
|
|
|
|
|
<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?.student_list && classInfo?.student_list.map((studentInfo: any, index: any) => (
|
|
|
|
|
<Text key={index} style={[AppStyles.diaryNameLabel, BaseStyles.marRight10, BaseStyles.marBottom10]}>{studentInfo?.student_name}</Text>
|
|
|
|
|
))}
|
|
|
|
|
</View>))}
|
|
|
|
|
<View style={[BaseStyles.marBottom10, BaseStyles.padHorizontal10,]}>
|
|
|
|
|
{/* <AutoHeightWebView
|
|
|
|
|
style={{ width: '100%', marginVertical: 16 }}
|
|
|
|
|
customStyle={`
|
|
|
|
|
table, th, td {
|
|
|
|
@ -266,166 +266,166 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
source={{ html: item?.message }}
|
|
|
|
|
scrollEnabled={false}
|
|
|
|
|
/> */}
|
|
|
|
|
<RenderHtml
|
|
|
|
|
source={{ html: `<div class="html-format">${item?.message}</div>` }}
|
|
|
|
|
contentWidth={contentWidth-40}
|
|
|
|
|
tagsStyles={tagsStyles}
|
|
|
|
|
classesStyles={{
|
|
|
|
|
'html-format': {
|
|
|
|
|
fontFamily: "Quicksand_500Medium", color: BaseColors.black,
|
|
|
|
|
fontSize: 15
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
renderers={renderers}
|
|
|
|
|
/>
|
|
|
|
|
<RenderHtml
|
|
|
|
|
source={{ html: `<div class="html-format">${item?.message}</div>` }}
|
|
|
|
|
contentWidth={contentWidth - 40}
|
|
|
|
|
tagsStyles={tagsStyles}
|
|
|
|
|
classesStyles={{
|
|
|
|
|
'html-format': {
|
|
|
|
|
fontFamily: "Quicksand_500Medium", color: BaseColors.black,
|
|
|
|
|
fontSize: 15
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
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 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 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 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>
|
|
|
|
|
|
|
|
|
|
{! (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() {
|
|
|
|
|
|
|
|
|
@ -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) {
|
|
|
|
|
const findDiaryType: any = diaryCategoryList.find((item: any) => item.id === parseInt(diaryInfo.diary_type))
|
|
|
|
|
if (findDiaryType) {
|
|
|
|
@ -462,7 +462,7 @@ class DiaryView extends React.PureComponent<any, any>{
|
|
|
|
|
renderItem={this.renderRow}
|
|
|
|
|
keyExtractor={(item, index) => index.toString()}
|
|
|
|
|
onEndReached={this.hasLoadMore}
|
|
|
|
|
onEndReachedThreshold={0.1}
|
|
|
|
|
onEndReachedThreshold={0.1}
|
|
|
|
|
removeClippedSubviews={false}
|
|
|
|
|
initialNumToRender={2}
|
|
|
|
|
onRefresh={() => this.onRefresh()}
|
|
|
|
|