-
-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New feature : Csv Export #2273
Closed
Closed
New feature : Csv Export #2273
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6ac0a76
csv feature
Ajeett01 5c02a42
added Zeus components
Ajeett01 9a95018
Formatted date and corrected errors
Ajeett01 73f7d14
button size
Ajeett01 ac187ee
Renamed File
Ajeett01 a45253a
Added string locales
Ajeett01 bcb02ae
adjusted style
Ajeett01 24369cc
Added iOS code
Ajeett01 47d40de
locked pakages
Ajeett01 1ea2ac2
Added 2 CSVs feature
Ajeett01 cc8fdd6
CorrectedCode
Ajeett01 5bd349a
Added Loading corrected CSV
Ajeett01 4b115b4
Merge branch 'master' into csv-export
Ajeett01 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module.exports = { | ||
presets: ["module:@react-native/babel-preset"], | ||
plugins: [ | ||
["@babel/plugin-proposal-decorators", { legacy: true }], | ||
'react-native-reanimated/plugin' | ||
] | ||
} | ||
presets: ['module:@react-native/babel-preset'], | ||
plugins: [ | ||
['@babel/plugin-proposal-decorators', { legacy: true }], | ||
'react-native-reanimated/plugin', | ||
['@babel/plugin-transform-export-namespace-from'] | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ import { | |
Text, | ||
TouchableOpacity, | ||
View, | ||
StyleSheet | ||
StyleSheet, | ||
Alert | ||
} from 'react-native'; | ||
import { Button, Icon, ListItem } from 'react-native-elements'; | ||
import { inject, observer } from 'mobx-react'; | ||
|
@@ -31,6 +32,7 @@ import { SATS_PER_BTC } from '../../stores/UnitsStore'; | |
|
||
import Filter from '../../assets/images/SVG/Filter On.svg'; | ||
import Invoice from '../../models/Invoice'; | ||
import JsonToCsv from './ActivityToCsv'; | ||
|
||
interface ActivityProps { | ||
navigation: StackNavigationProp<any, any>; | ||
|
@@ -55,7 +57,8 @@ export default class Activity extends React.PureComponent< | |
invoicesListener: any; | ||
|
||
state = { | ||
selectedPaymentForOrder: null | ||
selectedPaymentForOrder: null, | ||
isCsvModalVisible: false | ||
}; | ||
|
||
async UNSAFE_componentWillMount() { | ||
|
@@ -132,6 +135,21 @@ export default class Activity extends React.PureComponent< | |
return 'secondaryText'; | ||
}; | ||
|
||
handleDownloadPress = () => { | ||
const { ActivityStore } = this.props; | ||
const { startDate, endDate } = ActivityStore.filters; | ||
const { filteredActivity } = ActivityStore; | ||
|
||
if (!startDate || !endDate) { | ||
Alert.alert('Error', 'Please select Start and End date.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this needs localization |
||
} else { | ||
this.setState({ | ||
isCsvModalVisible: true, | ||
filteredData: filteredActivity | ||
}); | ||
} | ||
}; | ||
|
||
render() { | ||
const { | ||
navigation, | ||
|
@@ -141,7 +159,7 @@ export default class Activity extends React.PureComponent< | |
SettingsStore, | ||
route | ||
} = this.props; | ||
const { selectedPaymentForOrder } = this.state; | ||
const { selectedPaymentForOrder, isCsvModalVisible } = this.state; | ||
|
||
const { loading, filteredActivity, getActivityAndFilter } = | ||
ActivityStore; | ||
|
@@ -225,6 +243,21 @@ export default class Activity extends React.PureComponent< | |
</TouchableOpacity> | ||
); | ||
|
||
const DownloadButton = () => ( | ||
<TouchableOpacity | ||
onPress={this.handleDownloadPress} | ||
accessibilityLabel={localeString('views.ActivityToCsv.title')} | ||
> | ||
<Icon | ||
name="download" | ||
type="feather" | ||
color={themeColor('text')} | ||
underlayColor="transparent" | ||
size={33} | ||
/> | ||
</TouchableOpacity> | ||
); | ||
|
||
return ( | ||
<Screen> | ||
<Header | ||
|
@@ -237,16 +270,28 @@ export default class Activity extends React.PureComponent< | |
} | ||
}} | ||
rightComponent={ | ||
order ? ( | ||
selectedPaymentForOrder ? ( | ||
<MarkPaymentButton /> | ||
) : null | ||
) : ( | ||
<FilterButton /> | ||
) | ||
<View style={{ flexDirection: 'row' }}> | ||
{order ? ( | ||
selectedPaymentForOrder ? ( | ||
<MarkPaymentButton /> | ||
) : null | ||
) : ( | ||
<FilterButton /> | ||
)} | ||
<DownloadButton /> | ||
</View> | ||
} | ||
navigation={navigation} | ||
/> | ||
|
||
<JsonToCsv | ||
filteredActivity={filteredActivity} | ||
closeModal={() => | ||
this.setState({ isCsvModalVisible: false }) | ||
} | ||
isVisible={isCsvModalVisible} | ||
/> | ||
|
||
{loading ? ( | ||
<View style={{ padding: 50 }}> | ||
<LoadingIndicator /> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why have we added that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious about this too