Add link to invoice PDF to frontend

This commit is contained in:
Philipp Lang 2023-12-17 23:27:55 +01:00
parent f4dc8b24bc
commit 19dea7a061
3 changed files with 5 additions and 1 deletions

View File

@ -36,6 +36,7 @@ class InvoiceResource extends JsonResource
'greeting' => $this->greeting,
'usage' => $this->usage,
'links' => [
'pdf' => route('invoice.pdf', ['invoice' => $this->getModel()]),
'update' => route('invoice.update', ['invoice' => $this->getModel()]),
'destroy' => route('invoice.destroy', ['invoice' => $this->getModel()]),
]

View File

@ -94,7 +94,9 @@
<div v-text="invoice.via"></div>
</td>
<td>
<a v-tooltip="`Bearbeiten`" href="#" class="inline-flex btn btn-warning btn-sm"
<a v-tooltip="`Anschauen`" :href="invoice.links.pdf" target="_BLANK"
class="inline-flex btn btn-info btn-sm"><ui-sprite src="eye"></ui-sprite></a>
<a v-tooltip="`Bearbeiten`" href="#" class="ml-2 inline-flex btn btn-warning btn-sm"
@click.prevent="edit(invoice)"><ui-sprite src="pencil"></ui-sprite></a>
<a v-tooltip="`Löschen`" href="#" class="ml-2 inline-flex btn btn-danger btn-sm"
@click.prevent="deleting = invoice"><ui-sprite src="trash"></ui-sprite></a>

View File

@ -41,6 +41,7 @@ class InvoiceIndexActionTest extends TestCase
->assertInertiaPath('data.data.0.positions.0.member_id', $member->id)
->assertInertiaPath('data.data.0.positions.0.description', 'lala')
->assertInertiaPath('data.data.0.positions.0.id', $invoice->positions->first()->id)
->assertInertiaPath('data.data.0.links.pdf', route('invoice.pdf', ['invoice' => $invoice]))
->assertInertiaPath('data.data.0.links.update', route('invoice.update', ['invoice' => $invoice]))
->assertInertiaPath('data.data.0.links.destroy', route('invoice.destroy', ['invoice' => $invoice]))
->assertInertiaPath('data.meta.links.mass-store', route('invoice.mass-store'))