rubyforgood / human-essentials

Human Essentials is an inventory management system for diaper, incontinence, and period-supply banks. It supports them in distributing to partners, tracking inventory, and reporting stats and analytics.
https://humanessentials.app
MIT License
436 stars 450 forks source link

Fix Distribution PDF overlap in footer #4479

Closed norrismei closed 2 days ago

norrismei commented 5 days ago

Resolves #4439

Description

In the distribution PDF, table line items are overlapping with the footer if the table reaches the bottom of the page and/or continues onto the next page. To make the PDF look nicer and more professional, this PR adds a bounding box for the non-footer elements that is the height of the page (not including margin) minus the height of the footer, which is 35. Now when the table line items reach the bottom of the bounding box, it will automatically continue onto the next page, no longer overlapping with the footer.

An alternative I explored was wrapping just the table in a bounding box because that's the element that is overlapping with the footer, but because the table bounding box would've been positioned about a third way down on the first page, when line items continued onto the second page, they were positioned a third way down on the page instead of from the top. Wrapping all non-footer elements in the bounding box makes the solution more flexible because it prevents anything, not just the table, from overlapping with the footer.

Type of change

How Has This Been Tested?

In staging, I signed in as a Bank User, clicked on Distributions in the left hand navigation, looked for a row with a high number of Total items (>16000), and clicked on the Print button to create the PDF and see if there was any overlap with the footer. I also went to edit My Organization to enable signature lines on the distribution printout to make sure that this recent functionality wasn't impacted by my changes.

Screenshots

Before, with overlap: download PDF Screen Shot 2024-06-23 at 10 22 01 PM


After, with no overlap: download PDF Screen Shot 2024-06-23 at 10 22 24 PM

dorner commented 2 days ago

Thanks!