Skip to content

Conversation

@OlegPhenomenon
Copy link
Contributor

Implement independent pagination for all 5 invoice types using Pagy gem with Turbo frame integration for seamless navigation without page reloads.

Changes:

  • Add ITEMS_PER_PAGE constant (10 items per page) to InvoicesController
  • Implement Pagy pagination for all 5 invoice collections:
    • Issued invoices (issued_page param)
    • Cancelled payable invoices (cancelled_payable_page param)
    • Cancelled expired invoices (cancelled_expired_page param)
    • Paid invoices (paid_page param)
    • Deposit paid records (deposit_page param)
  • Wrap each tab content with unique Turbo frames for independent updates
  • Update Outstanding Invoices component:
    • Add pagy_issued, pagy_cancelled_payable, pagy_cancelled_expired attributes
    • Wrap 3 tabs with turbo_frame_tag: outstanding_issued_invoices, outstanding_cancelled_payable, outstanding_cancelled_expired
    • Add Pagy component at bottom of each frame
    • Update counters to use pagy.count instead of collection.count
  • Update Paid Invoices component:
    • Add pagy_paid, pagy_deposit attributes
    • Wrap 2 tabs with turbo_frame_tag: paid_invoices, paid_deposits
    • Add Pagy component at bottom of each frame
    • Update counters to use pagy.count
  • Uncomment Pagy::DEFAULT.freeze in initializer to allow runtime items customization
  • Add debug logging for pagination troubleshooting
  • Code formatting improvements in InvoicesController

Technical details:

  • Each invoice type uses unique page_param to prevent pagination conflicts
  • Turbo frames ensure only clicked tab updates (no full page reload)
  • Tab state persists after pagination via URL parameters
  • data-turbo-action="advance" enables browser history navigation

Implement independent pagination for all 5 invoice types using Pagy gem
with Turbo frame integration for seamless navigation without page reloads.

Changes:
- Add ITEMS_PER_PAGE constant (10 items per page) to InvoicesController
- Implement Pagy pagination for all 5 invoice collections:
  * Issued invoices (issued_page param)
  * Cancelled payable invoices (cancelled_payable_page param)
  * Cancelled expired invoices (cancelled_expired_page param)
  * Paid invoices (paid_page param)
  * Deposit paid records (deposit_page param)
- Wrap each tab content with unique Turbo frames for independent updates
- Update Outstanding Invoices component:
  * Add pagy_issued, pagy_cancelled_payable, pagy_cancelled_expired attributes
  * Wrap 3 tabs with turbo_frame_tag: outstanding_issued_invoices,
    outstanding_cancelled_payable, outstanding_cancelled_expired
  * Add Pagy component at bottom of each frame
  * Update counters to use pagy.count instead of collection.count
- Update Paid Invoices component:
  * Add pagy_paid, pagy_deposit attributes
  * Wrap 2 tabs with turbo_frame_tag: paid_invoices, paid_deposits
  * Add Pagy component at bottom of each frame
  * Update counters to use pagy.count
- Uncomment Pagy::DEFAULT.freeze in initializer to allow runtime items customization
- Add debug logging for pagination troubleshooting
- Code formatting improvements in InvoicesController

Technical details:
- Each invoice type uses unique page_param to prevent pagination conflicts
- Turbo frames ensure only clicked tab updates (no full page reload)
- Tab state persists after pagination via URL parameters
- data-turbo-action="advance" enables browser history navigation
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

Successfully merging this pull request may close these issues.

2 participants