Customer page lists: short paid badge, aligned icons, appointment link

* The invoice list's paid badge is short so each invoice stays on one
  line: "Paid", or "Paid +3d" when it was paid in full 3 days after
  its date, with the day on hover. The invoice page keeps the date.
* The estimate and invoice lists are laid out in columns (checkbox,
  number, date, status, actions), so the edit/view icons line up.
* Ticked estimates (and redmine_qbo_vehicles' vehicles) fill in
  redmine_qbo_calendar's Add appointment link (estimate_id,
  vehicle_id) as well as New issue. Estimate checkboxes are only on
  the customer page, where they're used.
* application.js is gone: it only carried the old Google Calendar
  link code, which threw an error when a box was ticked on a vehicle
  page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-17 19:39:08 -05:00
1 parent 40eb6205c4
commit 92f9eb1bc7
11 files changed
+117 -72

No files matched your search

@@ -16,7 +16,6 @@ module RedmineQbo
# Load the javascript to support the autocomplete forms
def view_layouts_base_html_head(context = {})
safe_join([
javascript_include_tag( 'application.js', plugin: :redmine_qbo),
javascript_include_tag( 'autocomplete.js', plugin: :redmine_qbo),
javascript_include_tag( 'checkbox_controller.js', plugin: :redmine_qbo),
stylesheet_link_tag( 'autocomplete', plugin: :redmine_qbo)
+20
View File
@@ -42,6 +42,26 @@ module RedmineQboBilling
I18n.t("label_invoice_status_#{status}")
end
# The invoice list's short badge: "Paid", or "Paid +3d" when it was paid in full 3 days after its date
def short_label(status, paid_on: nil, invoice_date: nil)
days = days_to_pay(invoice_date, paid_on) if status == :paid
return I18n.t(:label_invoice_status_paid_days, days: days) if days&.positive?
label(status)
end
# The badge's tooltip: "Paid in full 11/19/2025" (nil unless it's paid with a known day)
def title(status, paid_on: nil)
I18n.t(:text_invoice_paid_in_full, date: I18n.l(paid_on)) if status == :paid && paid_on
end
# Days from the invoice's date to the day it was paid in full
def days_to_pay(invoice_date, paid_on)
return nil unless invoice_date && paid_on
(paid_on.to_date - invoice_date.to_date).to_i
end
def to_d(value)
BigDecimal(value.to_s.presence || '0')
rescue ArgumentError