Skip to content

[Invoices]: Download the PDF for an invoice from the invoice list #200

Description

@nielsdrost7

Context

The invoices list has a "Download PDF" action stub but it currently does nothing. Users must navigate to the invoice edit view to obtain the PDF. Completing this action makes PDF retrieval a one-click operation.

Related: #190 covers the same action from within the EditInvoice page header. Both issues share the same underlying InvoiceService::generatePdf() implementation.


User story

As a user, I want to click Download PDF in the invoice row dropdown so I can download the invoice PDF without opening the edit form.


Acceptance criteria

  • The existing Download PDF stub action is implemented and triggers a file download.
  • The downloaded file is the rendered invoice PDF.
  • The action is visible for all invoice statuses.
  • If PDF generation fails, the user sees an error notification — no silent failure.

Arrange · Act · Assert

// Modules/Invoices/Tests/Feature/InvoicesTest.php

#[Test]
public function it_downloads_pdf_from_invoice_list(): void
{
    /* Arrange */
    $invoice = Invoice::factory()->for($this->company)->create([
        'invoice_number' => 'INV-2026-001',
    ]);

    /* Act */
    $component = Livewire::actingAs($this->user)
        ->test(ListInvoices::class, ['tenant' => Str::lower($this->company->search_code)])
        ->callTableAction('download-pdf', $invoice);

    /* Assert */
    $component->assertSuccessful();
    $component->assertFileDownloaded('INV-2026-001.pdf');
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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