Skip to content

Vamsidhar - Fix PDF generation button on Weekly Project Summary page#4552

Merged
one-community merged 6 commits intodevelopmentfrom
vamsidhar-fix-pdf-button-weekly-project-summary
Apr 10, 2026
Merged

Vamsidhar - Fix PDF generation button on Weekly Project Summary page#4552
one-community merged 6 commits intodevelopmentfrom
vamsidhar-fix-pdf-button-weekly-project-summary

Conversation

@vamsidharpanithi
Copy link
Copy Markdown
Contributor

Description

Fixed the Share PDF button on the Weekly Project Summary page that was not generating or downloading PDFs. The button was clickable but provided no feedback, error messages, or functionality. This PR implements full PDF generation functionality with proper loading states, error handling, and user feedback.

Fixes # (Priority: Medium) Share PDF Button Not Generating or Downloading PDF on Weekly Project Summary Page
Or Implements # (WBS)

Related PRS (if any):

Previous PR - 3728

Main changes explained:

Updated Files:

  • src/components/BMDashboard/WeeklyProjectSummary/WeeklyProjectSummary.jsx

    • Added isGeneratingPDF state to manage loading state during PDF generation
    • Added containerRef using useRef to reliably find the container element (fixes CSS module class name resolution issue)
    • Added projectFilter and dateRangeFilter selectors from Redux store
    • Replaced toast.loading() with toast.info() for compatibility with current react-toastify version
    • Improved error handling with specific error messages
    • Added dynamic PDF filename generation including project filter and date range
    • Implemented proper cleanup of PDF container elements
  • src/components/BMDashboard/WeeklyProjectSummary/WeeklyProjectSummaryHeader.jsx

    • Added isGeneratingPDF prop to control button disabled state
    • Added loading spinner and "Generating PDF..." text when PDF is being generated
    • Button is disabled during PDF generation to prevent multiple simultaneous requests
  • src/components/BMDashboard/WeeklyProjectSummary/WeeklyProjectSummary.module.css

    • Added CSS styles for loading spinner (.spinner)
    • Added styles for disabled state of the share button

How to test:

  1. Check out the branch
  2. Run npm install to ensure all dependencies are installed
  3. Start the development server: npm run start
  4. Clear browser cache and site data
  5. Log in as an admin user
  6. Navigate to: http://localhost:5173/bmdashboard/totalconstructionsummary
    1. Verify PDF Generation:
    • Click the "Share PDF" button
    • Verify that:
      • Button shows a loading spinner and "Generating PDF..." text
      • Button is disabled during generation
      • A toast notification appears showing "Generating PDF..."
      • After completion, a success toast appears: "PDF generated and downloaded successfully!"
      • PDF file is downloaded with filename format: weekly-project-summary-{projectName}-{dateRange}.pdf
      • PDF contains all sections of the Weekly Project Summary
  7. Verify in Dark Mode:

Screenshots or videos of changes:

image image image image image image

@netlify
Copy link
Copy Markdown

netlify bot commented Dec 13, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit 52e4c8d
🔍 Latest deploy log https://app.netlify.com/projects/highestgoodnetwork-dev/deploys/69d876fdd99f3c0008dcb220
😎 Deploy Preview https://deploy-preview-4552--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Jan 9, 2026

@vamsidharpanithi vamsidharpanithi added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Jan 9, 2026
@vamsidharpanithi vamsidharpanithi changed the title Fix PDF generation button on Weekly Project Summary page Vamsidhar - Fix PDF generation button on Weekly Project Summary page Jan 9, 2026
rohanrastogi311
rohanrastogi311 previously approved these changes Jan 9, 2026
Copy link
Copy Markdown

@rohanrastogi311 rohanrastogi311 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vamsidhar,

Well done with this, the implementation works and dark mode is good.

PR 4552 Screenshot

Anusha-Gali
Anusha-Gali previously approved these changes Jan 9, 2026
Copy link
Copy Markdown

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vamsidhar,

I have reviewed your PR locally and it works as per the requirements mentioned.
Screenshot 2026-01-09 at 6 41 48 PM
Screenshot 2026-01-09 at 6 41 58 PM
Screenshot 2026-01-09 at 6 42 13 PM
Screenshot 2026-01-09 at 6 42 16 PM
Screenshot 2026-01-09 at 6 42 41 PM
Screenshot 2026-01-09 at 6 42 48 PM

Ganesh112001
Ganesh112001 previously approved these changes Jan 24, 2026
Copy link
Copy Markdown

@Ganesh112001 Ganesh112001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested PR #4552 and verified that the PDF generation button on the Weekly Project Summary page works perfectly. After navigating to /bmdashboard/totalconstructionsummary, I clicked the "Share PDF" button which correctly shows a loading state with spinner and "Generating PDF..." text. The button is properly disabled during generation to prevent multiple simultaneous requests. PDF generates and downloads successfully with a dynamic filename including project filter and date range. The downloaded PDF contains correct Weekly Project Summary data. The button is visible and functional in dark mode with proper styling. Everything works as intended and is ready for merge!
Screenshot 2026-01-24 at 1 59 25 PM

Screenshot 2026-01-24 at 1 59 48 PM

@beblicarl
Copy link
Copy Markdown
Contributor

This feature works as intended and the code is great

https://www.loom.com/share/5387c10322b648ca8ef8d31fb8f69d55

@beblicarl beblicarl self-requested a review January 29, 2026 15:14
beblicarl
beblicarl previously approved these changes Jan 29, 2026
Copy link
Copy Markdown
Contributor

@shashank-madan shashank-madan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation works as expected when all dropdowns are previously opened. Generating pdf occurs before loading has completed and might miss some data.
See attached video.

Total.Construction.Summary.-.Google.Chrome.2026-01-31.18-33-21.mp4

…ct-summary

Resolve merge conflicts (package.json, vitest, PurchaseForm, WeeklyProjectSummary,
UserTableData tests, yarn.lock). Align Weekly Project Summary header controls and
fix Share PDF button flex-shrink overlap with filters.

Made-with: Cursor
@sonarqubecloud
Copy link
Copy Markdown

@one-community
Copy link
Copy Markdown
Member

Thank you all, merging!

@one-community one-community merged commit 7440b01 into development Apr 10, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants