Skip to content

fix: remove columns DataTable option causing sort/search errors on Invoices and Payments - #644

Open
tungleduyxyz wants to merge 4 commits into
masterfrom
fix-633
Open

fix: remove columns DataTable option causing sort/search errors on Invoices and Payments#644
tungleduyxyz wants to merge 4 commits into
masterfrom
fix-633

Conversation

@tungleduyxyz

@tungleduyxyz tungleduyxyz commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

- List uploaded invoice translations per tenant via Kaui::AdminTenant.get_invoice_translations
  (uses KillBillClient::Model::Tenant.search_tenant_config with the
  INVOICE_TRANSLATION_ prefix, since Kill Bill has no dedicated list endpoint)
- Fetch translations in AdminTenantsController#show alongside other tab data
- Render a table above the upload form matching the existing Overdue/Catalog
  tab styling, with a View Source toggle per locale
…voices and Payments

The 'columns' option defined 9 entries (7 visible + 2 hidden) but the HTML
<thead> only renders visible columns (7 <th> elements). With serverSide: true,
this mismatch breaks DataTables column index resolution when sorting or
applying advanced search filters.

Fixes #633

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses DataTables sort/search failures on the Invoices and Payments pages by removing a problematic DataTables columns option, and implements invoice translation listing support in the tenant admin UI (to complement invoice translation uploads).

Changes:

  • Removed the DataTables columns option from the Payments and Invoices listing initializations.
  • Added retrieval (Kaui::AdminTenant.get_invoice_translations) and controller wiring to load invoice translations for a tenant.
  • Added a new UI table (and styling) to display existing invoice translations with a “View Source” toggle.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/views/kaui/payments/index.html.erb Removes DataTables columns option from payments table init.
app/views/kaui/invoices/index.html.erb Removes DataTables columns option from invoices table init.
app/views/kaui/admin_tenants/_form_invoice_translation.erb Adds UI to list existing invoice translations and view their source.
app/views/kaui/admin_tenants/_form_invoice_template.erb Minor UI tweak (removes “Current Invoice Template” heading).
app/models/kaui/admin_tenant.rb Adds model helper to fetch invoice translations from tenant config.
app/controllers/kaui/admin_tenants_controller.rb Fetches invoice translations during tenant show page load.
app/assets/stylesheets/kaui/tenants.css Adds styling for the new invoice translations table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/views/kaui/invoices/index.html.erb Outdated
Comment thread app/views/kaui/admin_tenants/_form_invoice_translation.erb Outdated
Comment thread app/views/kaui/payments/index.html.erb Outdated
@tungleduyxyz tungleduyxyz mentioned this pull request Jul 28, 2026
tungleduyxyz added a commit that referenced this pull request Jul 28, 2026
* Add existing invoice translations table to Invoice Translation tab

- List uploaded invoice translations per tenant via Kaui::AdminTenant.get_invoice_translations
  (uses KillBillClient::Model::Tenant.search_tenant_config with the
  INVOICE_TRANSLATION_ prefix, since Kill Bill has no dedicated list endpoint)
- Fetch translations in AdminTenantsController#show alongside other tab data
- Render a table above the upload form matching the existing Overdue/Catalog
  tab styling, with a View Source toggle per locale

* fix: remove columns DataTable option causing sort/search errors on Invoices and Payments

The 'columns' option defined 9 entries (7 visible + 2 hidden) but the HTML
<thead> only renders visible columns (7 <th> elements). With serverSide: true,
this mismatch breaks DataTables column index resolution when sorting or
applying advanced search filters.

Fixes #633

* Refactor style

* fix: address Copilot review feedback on PR #644
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