diff --git a/src/CONST/index.ts b/src/CONST/index.ts
index 7945177a89cc..6fd8a6f57962 100644
--- a/src/CONST/index.ts
+++ b/src/CONST/index.ts
@@ -495,6 +495,7 @@ const CONST = {
TYPE: {
CSV: 'csv',
PDF: 'pdf',
+ RECEIPTS: 'receipts',
},
},
@@ -1464,6 +1465,7 @@ const CONST = {
CANCEL_PAYMENT: 'cancelPayment',
HOLD: 'hold',
DOWNLOAD_PDF: 'downloadPDF',
+ DOWNLOAD_RECEIPTS: 'downloadReceipts',
PRINT: 'print',
CHANGE_WORKSPACE: 'changeWorkspace',
CHANGE_APPROVER: 'changeApprover',
@@ -8550,6 +8552,7 @@ const CONST = {
EXPORT: 'MoreMenu-Export',
EXPORT_FILE: 'MoreMenu-ExportFile',
DOWNLOAD_PDF: 'MoreMenu-DownloadPDF',
+ DOWNLOAD_RECEIPTS: 'MoreMenu-DownloadReceipts',
PRINT: 'MoreMenu-Print',
CLOSE_PDF_MODAL: 'MoreMenu-ClosePDFModal',
SUBMIT: 'MoreMenu-Submit',
diff --git a/src/components/ExportDownloadStatusModal.tsx b/src/components/ExportDownloadStatusModal.tsx
index e5f636413ec2..74507d270a99 100644
--- a/src/components/ExportDownloadStatusModal.tsx
+++ b/src/components/ExportDownloadStatusModal.tsx
@@ -61,11 +61,13 @@ function ExportDownloadStatusModal({exportID, isVisible, onClose, failedBody}: E
const exportType = displayedExport?.exportType;
const failedReportCount = displayedExport?.failedReportCount ?? 0;
const reportCount = displayedExport?.reportCount ?? 0;
+ const receiptCount = displayedExport?.receiptCount;
+ const failedReceiptCount = displayedExport?.failedReceiptCount ?? 0;
const isPreparing = state === CONST.EXPORT_DOWNLOAD.STATE.PREPARING && !shouldSendFromConcierge;
const isConcierge = !!shouldSendFromConcierge;
const isReady = state === CONST.EXPORT_DOWNLOAD.STATE.READY;
const isFailed = state === CONST.EXPORT_DOWNLOAD.STATE.FAILED;
- const isPartialFailure = isReady && failedReportCount > 0;
+ const isEmptyReceipts = isReady && exportType === CONST.EXPORT_DOWNLOAD.TYPE.RECEIPTS && receiptCount === 0;
// Build the secure download URL the same way downloadReportPDF does, so the host always follows
// the app's current environment (instead of the env baked into a backend-built URL) and authenticates
@@ -82,12 +84,12 @@ function ExportDownloadStatusModal({exportID, isVisible, onClose, failedBody}: E
};
useEffect(() => {
- if (!isReady || !fileName || shouldSendFromConcierge) {
+ if (!isReady || !fileName || shouldSendFromConcierge || isEmptyReceipts) {
return;
}
downloadFile();
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [isReady, fileName, shouldSendFromConcierge]);
+ }, [isReady, fileName, shouldSendFromConcierge, isEmptyReceipts]);
const handleSendFromConcierge = () => {
sendExportFileFromConcierge(exportID, displayedExport ?? undefined);
@@ -149,11 +151,34 @@ function ExportDownloadStatusModal({exportID, isVisible, onClose, failedBody}: E
);
}
- if (isReady) {
+ if (isEmptyReceipts) {
return (
<>
- {translate('exportDownload.readyTitle')}
- {isPartialFailure ? (
+ {translate('exportDownload.noReceiptsTitle')}
+ {translate('exportDownload.noReceiptsBody')}
+
+ >
+ );
+ }
+
+ if (isReady) {
+ const renderPartialBody = () => {
+ if (exportType === CONST.EXPORT_DOWNLOAD.TYPE.RECEIPTS && failedReceiptCount > 0) {
+ return (
+
+ {translate('exportDownload.receiptsPartialBody', {
+ count: (receiptCount ?? 0) - failedReceiptCount,
+ total: receiptCount ?? 0,
+ })}
+
+ );
+ }
+ if (failedReportCount > 0) {
+ return (
- ) : (
- {translate('exportDownload.readyBody')}
- )}
+ );
+ }
+ return {translate('exportDownload.readyBody')};
+ };
+
+ return (
+ <>
+ {translate('exportDownload.readyTitle')}
+ {renderPartialBody()}