Design doc: Submit via PDF for the Submit workspace (section: Detailed Implementation of the Solution)
- Add the "Submit via PDF" option to the existing Submit primary action (extend
SubmitPrimaryAction.tsx / its dropdown), gated for Submit-plan draft reports via src/libs/ReportPrimaryActionUtils.ts / src/hooks/useReportPrimaryAction.ts and the PolicyUtils Submit-WS helpers added by #87998.
- In
ReportWorkflow.ts, when submitting on a submit policy to the same user as the submitter, in the API.write(SUBMIT_REPORT, ...) call: add to its onyxData the PDF-filename NVP that exportReportToPDF sets: optimisticData: SET nvp_expensify_report_PDFFilename_{reportID} = null; failureData: MERGE … = 'error' (src/libs/actions/Report/index.ts:6102-6116). The backend writes the real filename back into that NVP, which the App receives via Onyx.
- Open the PDF download modal from the UI layer when Submit via PDF is chosen, the same way the existing
DOWNLOAD_PDF action does (useExportActions.ts calls onPDFModalOpen?.() before exporting). The Submit-via-PDF handler in SubmitPrimaryAction.tsx calls the MoneyReportHeaderModals context's modal-open callback, then runs the submit.
ReportPDFDownloadModal is reused unchanged: it watches nvp_expensify_report_PDFFilename_{reportID}, shows "Generating PDF…" while it's null, then auto-downloads via downloadReportPDF (OldDot secure.php, S3-backed) once the filename arrives and shows the error state if it's 'error'.
- Hide the Approve button for any report the user submitted on a Submit workspace, add a
CONST.POLICY.TYPE.SUBMIT branch to canApproveIOU. Keep Mark as paid.
- Sticky behavior: the report-view button reflects the last-used method (default "Submit" for new users); the Spend page keeps the static "Submit" label for layout, but invokes the stored
preferredReportSubmissionMethod on click. Bulk Submit-via-PDF is disabled (avoid queuing multiple downloads / complicating the "X selected" menu).
Design doc: Submit via PDF for the Submit workspace (section: Detailed Implementation of the Solution)
SubmitPrimaryAction.tsx/ its dropdown), gated for Submit-plan draft reports via src/libs/ReportPrimaryActionUtils.ts / src/hooks/useReportPrimaryAction.ts and the PolicyUtils Submit-WS helpers added by #87998.ReportWorkflow.ts, when submitting on a submit policy to the same user as the submitter, in theAPI.write(SUBMIT_REPORT, ...)call: add to its onyxData the PDF-filename NVP thatexportReportToPDFsets:optimisticData: SET nvp_expensify_report_PDFFilename_{reportID} = null;failureData: MERGE … = 'error'(src/libs/actions/Report/index.ts:6102-6116). The backend writes the real filename back into that NVP, which the App receives via Onyx.DOWNLOAD_PDFaction does (useExportActions.tscallsonPDFModalOpen?.()before exporting). The Submit-via-PDF handler inSubmitPrimaryAction.tsxcalls theMoneyReportHeaderModalscontext's modal-open callback, then runs the submit.ReportPDFDownloadModalis reused unchanged: it watchesnvp_expensify_report_PDFFilename_{reportID}, shows "Generating PDF…" while it's null, then auto-downloads viadownloadReportPDF(OldDot secure.php, S3-backed) once the filename arrives and shows the error state if it's 'error'.CONST.POLICY.TYPE.SUBMITbranch tocanApproveIOU. Keep Mark as paid.preferredReportSubmissionMethodon click. Bulk Submit-via-PDF is disabled (avoid queuing multiple downloads / complicating the "X selected" menu).