Update image upload , refresh and edit
This commit is contained in:
parent
afd00ac8a3
commit
ac1d11c7f5
|
@ -106,8 +106,12 @@ class DiaryCreate extends React.Component<any, any>{
|
|||
|
||||
if (this.props.fileInfo.hasOwnProperty('data')) {
|
||||
if (this.props.fileInfo.data?.url) {
|
||||
let image = this.props.fileInfo.data?.url;
|
||||
if (Array.isArray(image)) {
|
||||
image = image[0];
|
||||
}
|
||||
const imageURL: any = `${this.imageBaseUrl + this.props.fileInfo.data?.url[0]}`
|
||||
this.setState({ isImageUploaded: true, image: this.props.fileInfo.data?.url[0], imagePreviewURL: imageURL })
|
||||
this.setState({ isImageUploaded: true, image: image, imagePreviewURL: imageURL })
|
||||
if (this.state.image) {
|
||||
this.props.initDiaryImage()
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ class DiaryView extends React.PureComponent<any, any>{
|
|||
isVisible: false,
|
||||
images: [],
|
||||
reply: "",
|
||||
academicYear: ''
|
||||
academicYear: '',
|
||||
isFetching: false
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
|
@ -138,6 +139,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,})
|
||||
}
|
||||
|
||||
hasLoadMore = () => {
|
||||
|
@ -168,6 +170,9 @@ class DiaryView extends React.PureComponent<any, any>{
|
|||
}
|
||||
}
|
||||
|
||||
onRefresh() {
|
||||
this.setState({isFetching: true,},() => {this.fetchDiaryDetailList()});
|
||||
}
|
||||
|
||||
toDiaryCreate = () => {
|
||||
if(!this.props.loading) {
|
||||
|
@ -338,6 +343,8 @@ class DiaryView extends React.PureComponent<any, any>{
|
|||
onEndReachedThreshold={0.1}
|
||||
removeClippedSubviews
|
||||
initialNumToRender={2}
|
||||
onRefresh={() => this.onRefresh()}
|
||||
refreshing={this.state.isFetching}
|
||||
/>}
|
||||
{!this.props.loading && this.props.records.length === 0 &&
|
||||
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
|
||||
|
|
|
@ -31,7 +31,8 @@ class NoticeBoardView extends React.Component<any, any>{
|
|||
isVisible: false,
|
||||
images: [],
|
||||
webViewHeight: null,
|
||||
academicYear: ''
|
||||
academicYear: '',
|
||||
isFetching: false
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
|
@ -97,6 +98,7 @@ class NoticeBoardView extends React.Component<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,})
|
||||
}
|
||||
|
||||
setImageVisible = () => {
|
||||
|
@ -124,6 +126,10 @@ class NoticeBoardView extends React.Component<any, any>{
|
|||
}
|
||||
}
|
||||
|
||||
onRefresh() {
|
||||
this.setState({isFetching: true,},() => {this.fetchNoticeboardData()});
|
||||
}
|
||||
|
||||
renderRow = ({ item }: any) => {
|
||||
const renderers = {
|
||||
oembed: (attribs:any) => {
|
||||
|
@ -227,6 +233,8 @@ class NoticeBoardView extends React.Component<any, any>{
|
|||
keyExtractor={(item, index) => index.toString()}
|
||||
onEndReached={this.hasLoadMore}
|
||||
onEndReachedThreshold={0.1}
|
||||
onRefresh={() => this.onRefresh()}
|
||||
refreshing={this.state.isFetching}
|
||||
/>}
|
||||
{!this.props.loading && this.props.records.length === 0 &&
|
||||
<Text style={[BaseStyles.font500Medium, { flex: 1, justifyContent: 'center', alignSelf: 'center' }]}>{common.noDataFound}</Text>}
|
||||
|
|
|
@ -115,8 +115,12 @@ class StudentCreate extends React.Component<any, any>{
|
|||
|
||||
if (this.props.fileInfo.hasOwnProperty('data')) {
|
||||
if (this.props.fileInfo.data?.url) {
|
||||
let image = this.props.fileInfo.data?.url;
|
||||
if (Array.isArray(image)) {
|
||||
image = image[0];
|
||||
}
|
||||
const imageURL: any = `${this.imageBaseUrl + this.props.fileInfo.data?.url}`
|
||||
this.setState({ isImageUploaded: true, image: this.props.fileInfo.data?.url, imagePreviewURL: imageURL })
|
||||
this.setState({ isImageUploaded: true, image: image, imagePreviewURL: imageURL })
|
||||
if (this.state.image) {
|
||||
this.props.initStudentImage()
|
||||
}
|
||||
|
|
|
@ -117,8 +117,12 @@ class StudentUpdate extends React.Component<any, any>{
|
|||
|
||||
if (this.props.fileInfo.hasOwnProperty('data')) {
|
||||
if (this.props.fileInfo.data?.url) {
|
||||
let image = this.props.fileInfo.data?.url;
|
||||
if (Array.isArray(image)) {
|
||||
image = image[0];
|
||||
}
|
||||
const imageURL: any = `${this.imageBaseUrl + this.props.fileInfo.data?.url}`
|
||||
this.setState({ isImageUploaded: true, image: this.props.fileInfo.data?.url, imagePreviewURL: imageURL })
|
||||
this.setState({ isImageUploaded: true, image: image, imagePreviewURL: imageURL })
|
||||
if (this.state.image) {
|
||||
this.props.initStudentImage()
|
||||
}
|
||||
|
|
|
@ -205,9 +205,11 @@ class StudentView extends React.Component<any, any>{
|
|||
<View style={{ flexDirection: 'column', width: '28%' }}>
|
||||
{this.isLoggedinAs && ((this.isLoggedinAs === UserRoles.schoolAdmin)) &&
|
||||
this.props.route.params.info?.class_active && <View style={{ flex: 1, flexDirection: "row", justifyContent: 'center', alignItems: 'center' }}>
|
||||
{item?.studentclass_details?.is_active &&
|
||||
<TouchableOpacity style={[styles.btnRound, {}]} onPress={this.toStudentUpdate.bind(this, item)} activeOpacity={0.8}>
|
||||
<FontAwesome name="edit" size={18} style={[AppStyles.icon, { paddingLeft: 5, fontWeight: 'bold', color: '#5952d6' }]} />
|
||||
</TouchableOpacity>
|
||||
}
|
||||
|
||||
{/* <TouchableOpacity style={[styles.btnRound, { backgroundColor: '#white' }]} onPress={this.onDeleteStudent.bind(this, item)} activeOpacity={0.8} disabled>
|
||||
{item?.studentclass_details?.is_active && <FontAwesome name="toggle-on" size={22} style={[AppStyles.icon, { paddingLeft: 5, fontWeight: 'bold', color: 'green' }]} />}
|
||||
|
|
|
@ -136,10 +136,10 @@ class ClassView extends React.Component<any, any>{
|
|||
</View>
|
||||
<View style={[styles.item, { alignItems: 'flex-end', width: '50%' }]}>
|
||||
<View style={{ flex: 1, flexDirection: "row", justifyContent: 'center', alignItems: 'center' }}>
|
||||
<TouchableOpacity disabled={!item.is_active} style={item.is_active ? styles.btnRound : styles.disabledBtnRound}
|
||||
{/* <TouchableOpacity disabled={!item.is_active} style={item.is_active ? styles.btnRound : styles.disabledBtnRound}
|
||||
onPress={this.toClassUpdate.bind(this, item.id)} activeOpacity={0.8}>
|
||||
<FontAwesome name="edit" size={18} style={[AppStyles.icon, item.is_active ? styles.activeIcon : styles.disabledIcon]} />
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity> */}
|
||||
<TouchableOpacity style={[styles.btnRound, { backgroundColor: '#white' }]} onPress={this.onDeleteClass.bind(this, item)} activeOpacity={0.8}>
|
||||
{item.is_active && <FontAwesome name="toggle-on" size={22} style={[AppStyles.icon, { paddingLeft: 5, fontWeight: 'bold', color: 'green' }]} />}
|
||||
{!item.is_active && <FontAwesome name="toggle-off" size={22} style={[AppStyles.icon, { paddingLeft: 5, fontWeight: 'bold', color: 'red' }]} />}
|
||||
|
|
|
@ -230,9 +230,9 @@ class SchoolView extends React.Component<any, any>{
|
|||
|
||||
</View>}
|
||||
</ScrollView>
|
||||
<TouchableOpacity style={[AppStyles.btnRound, AppStyles.btnPositionBtmRight]} onPress={this.toSchoolUpdate} activeOpacity={0.8}>
|
||||
{/* <TouchableOpacity style={[AppStyles.btnRound, AppStyles.btnPositionBtmRight]} onPress={this.toSchoolUpdate} activeOpacity={0.8}>
|
||||
<FontAwesome name="pencil" size={24} style={[AppStyles.icon, { paddingLeft: 6, fontWeight: 'bold' }]} />
|
||||
</TouchableOpacity>
|
||||
</TouchableOpacity> */}
|
||||
|
||||
|
||||
</View>)
|
||||
|
|
Loading…
Reference in New Issue