-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[HOLD for payment 2024-10-29] [$250] Add the Download
option to the report details screen.
#49638
Comments
Current assignee @JmillsExpensify is eligible for the NewFeature assigner, not assigning anyone new. |
Edited by proposal-police: This proposal was edited at 2023-10-02T00:00:00Z. ProposalPlease re-state the problem that we are trying to solve in this issue.Add the Download option to the report details screen What is the root cause of that problem?New feature What changes do you think we should make in order to solve the problem?We can add new menu item inside report details page App/src/pages/ReportDetailsPage.tsx Lines 286 to 288 in accea60
// For handling error
const {isSmallScreenWidth} = useResponsiveLayout();
const [downloadErrorModalVisible, setDownloadErrorModalVisible] = useState(false);
if (isExpenseReport || isSingleTransactionView) {
items.push({
key: CONST.REPORT_DETAILS_MENU_ITEM.DOWNLOAD,
translationKey: 'common.download',
icon: Expensicons.Download,
action: () =>
Report.downloadReportCSV(report.reportID, () => {
setDownloadErrorModalVisible(true);
}),
isAnonymousAction: true,
});
}
return (
...
<DecisionModal
title={translate('common.downloadFailedTitle')}
prompt={translate('common.downloadFailedDescription')}
isSmallScreenWidth={isSmallScreenWidth}
onSecondOptionSubmit={() => setDownloadErrorModalVisible(false)}
secondOptionText={translate('common.buttonConfirm')}
isVisible={downloadErrorModalVisible}
onClose={() => setDownloadErrorModalVisible(false)}
/>
) And add download option inside Lines 2807 to 2819 in accea60
And create new function to download report as csv inside actions/Report.ts folder because almost all download as csv function are created under actions libs folder /** Download report details as CSV */
function downloadReportCSV(reportID: string, onDownloadFailed: () => void) {
const finalParameters = enhanceParameters(WRITE_COMMANDS.DOWNLOAD_REPORT_CSV, {
reportID,
});
const fileName = `report_${reportID}.csv`;
const formData = new FormData();
Object.entries(finalParameters).forEach(([key, value]) => {
formData.append(key, String(value));
});
fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.DOWNLOAD_REPORT_CSV}), fileName, '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
} We also need to create new endpoint inside the BE for download report as csv (because almost all download as csv function had endpoint to the BE like downloadCategoriesCSV, downloadTagsCSV, etc) And create new API params for DOWNLOAD_REPORT_CSV // DownloadReportCSVParams.ts
type DownloadReportCSVParams = {
reportID: string;
};
export default DownloadReportCSVParams;
// And export it inside parameters/index.ts
export type {default as DownloadReportCSVParams} from './DownloadReportCSVParams';
// API/types.ts
...
DOWNLOAD_REPORT_CSV: 'DownloadReportCSV',
...
[WRITE_COMMANDS.DOWNLOAD_REPORT_CSV]: Parameters.DownloadReportCSVParams; What alternative solutions did you explore? (Optional) |
Edited by proposal-police: This proposal was edited at 2024-09-24 14:02:47 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Add a "Download" option to the expense report details. What is the root cause of that problem?This is a request for a new feature. What changes do you think we should make in order to solve the problem?
if (isExpenseReport) {
items.push({
key: CONST.REPORT_DETAILS_MENU_ITEM.DOWNLOAD,
translationKey: 'common.download',
icon: Expensicons.Download,
action: () => ReportUtils.downloadReportAsCsv(report.reportID),
isAnonymousAction: false,
shouldCloseModalOnSelect: true // Optional, for consistent behavior with the search page
});
}
What alternative solutions did you explore? (Optional)Alternatively, the conversion from JSON to CSV could be handled on the backend. We can expose an endpoint in the backend .. then create a function similar to exportSearchItemsToCSV , where the URL is formulated, and data is requested from the database. |
@rlinoz I'm going to export this, but CC'ing you for vis for the internal proposal approval with context on this feature. |
Job added to Upwork: https://www.upwork.com/jobs/~021838716845402086708 |
Download
option to the report details screen. Download
option to the report details screen.
Triggered auto assignment to Contributor-plus team member for initial proposal review - @sobitneupane ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.Add the Download option to the report details screen What is the root cause of that problem?New feature What changes do you think we should make in order to solve the problem?
What alternative solutions did you explore? (Optional) |
@JmillsExpensify Just want to confirm if this report should have Download button
|
Edited by proposal-police: This proposal was edited at 2024-09-25 19:22:41 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.Add the Download option to the report details screen. What is the root cause of that problem?This is a new feature What changes do you think we should make in order to solve the problem?
App/src/pages/ReportDetailsPage.tsx Line 407 in f978bf9
What alternative solutions did you explore? (Optional)NA |
1 similar comment
Also, could you confirm the structure of the data in the CSV? |
Assigning myself as I think this will require minor backend changes |
Example CSV:
The way I am reading the issue, yes, per:
I will defer the other one to @JmillsExpensify as I don't really know if we should have the download option at the expense level. |
I think it's just the report level, yeah. So in the case of a "one-expense report" that can be exported to CSV in the same waya "multi-expense report" can. |
Yes, just the report level. |
Thanks. |
📣 @nkdengineer 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
It looks like this task was mistakenly assigned to nkdengineer according to @sobitneupane 's review here Could we please update the assignment so I can proceed? |
📣 @abzokhattab 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
Im sorry about that, fixed it. |
Looks like the PR is awaiting a reviewer. |
Download
option to the report details screen. Download
option to the report details screen.
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.51-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue: If no regressions arise, payment will be issued on 2024-10-29. 🎊 For reference, here are some details about the assignees on this issue:
|
BugZero Checklist: The PR adding this new feature has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:
|
Payment summary:
|
Contributor paid out and reviewer is paid via NewDot. Closing this out, though please make sure to complete the checklist, thanks! |
@JmillsExpensify @rlinoz Be sure to fill out the Contact List! |
Regression Test Proposal
Do we agree 👍 or 👎 |
$250 approved for @sobitneupane |
Problem
The original implementation for CSV downloads focused on bulk actions on the
Search
page. One small inconsistency this introduced is that it's still not possible to download individual reports. You could also argue that this inconsistency is now more glaring since it's possible to export reports to accounting systems, yet not CSV.Solution
Let's add the ability to download reports to CSV at the report level, in addition to bulk CSV exports on the
Search
page. The solution will work like so:expense
reports will contain aDownload
option in the details page for that report. This is the case no matter whether the report is a "one expense report" or whether it's a report that contains several "batched" expenses.Download
option will generate a CSV and download it to the member's local deviceAnd I think that's it? @trjExpensify do you think I'm missing anything else? Here's the relevant front-end example, for reference.
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @JmillsExpensifyThe text was updated successfully, but these errors were encountered: