Skip to content

Generating PDF, Sending Email With PDF, Saving PDF To DB #119

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

Open
6 of 15 tasks
theNatePi opened this issue Apr 7, 2025 · 0 comments
Open
6 of 15 tasks

Generating PDF, Sending Email With PDF, Saving PDF To DB #119

theNatePi opened this issue Apr 7, 2025 · 0 comments
Assignees

Comments

@theNatePi
Copy link
Collaborator

theNatePi commented Apr 7, 2025

For this task, you will complete the final parts of an invoice, allowing it to be saved, emailed, and backed up to our database.

Generating The Invoice Generate the invoice using: - Code found in `client/src/components/invoices/PDFButtonInvoice.jsx` to create the PDF - The invoice created in `client/src/components/invoices/EditInvoice.jsx`
  • Use the invoice component, gather all invoice data and generate a PDF of the invoice
  • Create a new file which contains a function to do this. Do NOT copy the code from the invoice, instead re-use it in a way which allows it to be saved as a PDF. This may need some figuring out, so please reach out early if you need help
Downloading the PDF
  • Update the outdated client/src/components/invoices/PDFButtonInvoice.jsx to use your new function for downloading the real-pdf when given the ID of the invoice
  • Use this button to replace the current download button on the /invoices page. Match the Hi-Fi styling
    • This button is the one on each row which should now download a PDF of the specific invoice
Sending Email With PDF
  • Update the send email functionality in localhost/invoices/id to send the new PDF as part of the invoice. You may need to trace the current flow for sending emails.
Save PDF to DB When an email is sent, the corresponding PDF should be saved in its current state to the `historic_invoices` table.
  • Use the /backupInvoice/id endpoint in server/routes/invoices.js where "id" is the ID of the invoice being backed up
  • Call this endpoint with the PDF in the body of the request in the field file when the email is sent to clients
  • You may also need to include a comment, which can be empty

Acceptance Criteria

  • Generating invoice works
    • A function has been created to generate an invoice which matches that of the edit invoice
    • The invoice contains all relevant information
    • The invoice reuses existing components, and does not create a new rendered view of the invoice
  • The download PDF button has been updated to use the new PDF, and has been used in the /invoices table
  • When an email is sent from an invoice dashboard, the new PDF is included as an attachment
  • When an email is sent with the PDF, the PDF is also backed up to the database using the described endpoint.

NOTE:

You will need to update your .env file. Use this updated env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants