Skip to content

[Dashboard]: Invoice & quote status overview widgets with configurable period (v1 parity) #681

Description

@nielsdrost7

The core of the v1 dashboard is missing from v2 and from every dashboard issue: per-status amount + count totals for invoices and quotes over a configurable overview period. #146 covers graphs/outstanding/overdue/conversion, #147/#148 cover projects/tasks, #250 only a show/hide toggle for the revenue chart. None cover status totals or the period settings.

Behavioral spec: v1 application/modules/dashboard/controllers/Dashboard.php:28-45; application/modules/invoices/models/Mdl_invoice_amounts.php:366- (get_status_totals) and the quote equivalent; settings UI application/modules/settings/views/partial_settings_general.php:259-290.


Specific

Two StatsOverviewWidgets on the company dashboard:

  • Invoice overview — one stat tile per invoice status (draft, sent, viewed, paid, overdue) showing count and money total for the selected period. v1 rule: the paid tile sums the paid amount; all other tiles sum the outstanding balance (Mdl_invoice_amounts.php CASE WHEN status=paid THEN SUM(invoice_paid) ELSE SUM(invoice_balance)).
  • Quote overview — same per quote status (draft, sent, viewed, approved, rejected).

Two company settings, invoice_overview_period and quote_overview_period, each one of: this-month (default), last-month, this-quarter, last-quarter, this-year, last-year (v1 option list), editable in the Dashboard tab of Company Settings (same page as #250).

Measurable

  • Both widgets render on the dashboard above the Recent lists.
  • Tile values match seeded fixtures for each period option.
  • Changing a period setting changes the widget query window on next load; each widget's heading names its period.
  • Clicking a tile opens the corresponding list filtered by that status.
  • All values company-scoped; zero-state renders tiles with 0 rather than hiding.

Achievable

Modules/Invoices/Filament/Company/Widgets/InvoiceOverviewWidget.php and Modules/Quotes/Filament/Company/Widgets/QuoteOverviewWidget.php extending StatsOverviewWidget; period boundaries via Carbon (startOfQuarter() etc.); settings via the existing Setting model + constants; register in CompanyPanelProvider alongside the Recent widgets (Modules/Core/Providers/CompanyPanelProvider.php:183-189).

Relevant

This is the v1 dashboard's primary information (the first thing every v1 user sees); part of epic #507 and required for v1 parity (#136).

Time-Bound

One sprint; no dependencies.


Arrange

  • Frozen clock. Company with: 2 sent invoices this month (balances 100+200), 1 paid invoice this month (paid 500), 1 sent invoice last month (balance 999), 1 approved quote this month (total 400).
  • invoice_overview_period = this-month, quote_overview_period = this-month.
  • Second company with its own invoices (leak check).

Act

  • Load the company dashboard; then set invoice_overview_period = last-month and reload.

Assert

  • Invoice overview (this-month): Sent = 2 / 300; Paid = 1 / 500; last month's invoice excluded.
  • Quote overview: Approved = 1 / 400.
  • After switching to last-month: Sent = 1 / 999.
  • Tiles link to status-filtered list pages.
  • Second company's records never counted.
  • Settings persist per company in the settings table (invoice_overview_period, quote_overview_period).
  • PHPUnit + Livewire tests cover both widgets, all six period options (boundary cases: quarter and year edges), scoping, and the settings form.

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinedRefined with SMART plan / test suggestions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions