Skip to content

[Invoices]: Add consecutive position numbering to invoice line items #370

Description

@xam-ps

SMART Plan — [Invoices] Consecutive position numbers on invoice line items

Specific

Add a company setting "Show position numbers on line items" (boolean toggle, default off). When enabled, each invoice line item displays an auto-incrementing position number in both the invoice edit form and on the printed/PDF invoice. The position is display-only — no stored column required.

Measurable

  • Company settings has a toggle: show_line_item_position_numbers.
  • When enabled, the invoice edit form's item repeater shows a read-only position indicator (1, 2, 3…).
  • The PDF template renders a position column when the setting is on, and omits it when off.
  • PHPUnit confirms the setting persists and the toggle renders on the settings form.

Achievable

  1. Add a boolean setting show_line_item_position_numbers to the company settings Filament schema.
  2. In the invoice items Repeater, conditionally prepend a read-only Placeholder component when the setting is enabled.
  3. In the PDF blade template, wrap the position column with @if($company->getSetting('show_line_item_position_numbers')).

Relevant

Position numbering is a legal requirement in Germany and other EU jurisdictions — each line item must have a consecutive reference number for bookkeeping and dispute resolution.

Time-bound

Sprint 5.


Arrange · Act · Assert

#[Test]
public function it_persists_the_show_position_numbers_setting(): void
{
    /* Arrange */
    // AbstractCompanyPanelTestCase provides $this->company and $this->user

    /* Act */
    $component = Livewire::actingAs($this->user)
        ->test(\Modules\Core\Filament\Company\Pages\Settings\CompanySettings::class, [
            'tenant' => Str::lower($this->company->search_code),
        ])
        ->fillForm(['show_line_item_position_numbers' => true])
        ->call('save');

    /* Assert */
    $component->assertSuccessful();
    $this->assertTrue(
        (bool) $this->company->fresh()->getSetting('show_line_item_position_numbers')
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    refinedRefined with SMART plan / test suggestions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions