diff --git a/app/Invoice/Actions/InvoiceIndexAction.php b/app/Invoice/Actions/InvoiceIndexAction.php
index c60b6134..d2796fe9 100644
--- a/app/Invoice/Actions/InvoiceIndexAction.php
+++ b/app/Invoice/Actions/InvoiceIndexAction.php
@@ -24,6 +24,9 @@ class InvoiceIndexAction
public function asController(): Response
{
+ session()->put('menu', 'invoice');
+ session()->put('title', 'Rechnungen');
+
return Inertia::render('invoice/Index', [
'data' => InvoiceResource::collection($this->handle()),
]);
diff --git a/app/Invoice/Resources/InvoiceResource.php b/app/Invoice/Resources/InvoiceResource.php
index 285fae43..967c1009 100644
--- a/app/Invoice/Resources/InvoiceResource.php
+++ b/app/Invoice/Resources/InvoiceResource.php
@@ -25,7 +25,7 @@ class InvoiceResource extends JsonResource
return [
'to_name' => $this->to['name'],
'sum_human' => number_format($this->positions->sum('price') / 100, 2, ',', '') . ' €',
- 'sent_at_human' => $this->sent_at->format('d.m.Y'),
+ 'sent_at_human' => $this->sent_at?->format('d.m.Y') ?: '',
'status' => $this->status->value,
'via' => $this->via->value,
];
diff --git a/database/factories/Invoice/Models/InvoiceFactory.php b/database/factories/Invoice/Models/InvoiceFactory.php
index b5b93592..553b630f 100644
--- a/database/factories/Invoice/Models/InvoiceFactory.php
+++ b/database/factories/Invoice/Models/InvoiceFactory.php
@@ -25,6 +25,9 @@ class InvoiceFactory extends Factory
{
return [
'greeting' => $this->faker->words(4, true),
+ 'to' => ReceiverRequestFactory::new()->create(),
+ 'status' => InvoiceStatus::NEW->value,
+ 'via' => BillKind::POST->value
];
}
diff --git a/resources/img/svg/moneypaper.svg b/resources/img/svg/moneypaper.svg
new file mode 100644
index 00000000..3b9d236b
--- /dev/null
+++ b/resources/img/svg/moneypaper.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/js/composables/useIndex.js b/resources/js/composables/useIndex.js
index 3d9e2528..cbd886fd 100644
--- a/resources/js/composables/useIndex.js
+++ b/resources/js/composables/useIndex.js
@@ -1,8 +1,9 @@
-import {ref, computed, onBeforeUnmount} from 'vue';
+import {ref, inject, computed, onBeforeUnmount} from 'vue';
import {router} from '@inertiajs/vue3';
import useQueueEvents from './useQueueEvents.js';
export function useIndex(props, siteName) {
+ const axios = inject('axios');
const {startListener, stopListener} = useQueueEvents(siteName, () => reload(false));
const rawProps = JSON.parse(JSON.stringify(props));
const inner = {
@@ -85,6 +86,7 @@ export function useIndex(props, siteName) {
router,
toFilterString,
reloadPage,
+ axios,
};
}
diff --git a/resources/js/layouts/AppLayout.vue b/resources/js/layouts/AppLayout.vue
index 381ae3f7..12d3308e 100644
--- a/resources/js/layouts/AppLayout.vue
+++ b/resources/js/layouts/AppLayout.vue
@@ -11,6 +11,7 @@
Dashboard
Mitglieder
Beiträge
+ Rechnungen
Zuschüsse
Tätigkeiten
Gruppen
diff --git a/resources/js/views/invoice/Index.vue b/resources/js/views/invoice/Index.vue
new file mode 100644
index 00000000..5f15bac8
--- /dev/null
+++ b/resources/js/views/invoice/Index.vue
@@ -0,0 +1,65 @@
+
+
+
+ Rechnung
+ anlegen
+ Massenrechnung
+ anlegen
+
+
+
+
+
+
+ Empfänger |
+ Gesamtbetrag |
+ Status |
+ Gesendet am |
+ Rechnungsweg |
+ |
+
+
+
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
diff --git a/tests/Feature/Invoice/InvoiceIndexActionTest.php b/tests/Feature/Invoice/InvoiceIndexActionTest.php
index 96cb541f..d0860bd4 100644
--- a/tests/Feature/Invoice/InvoiceIndexActionTest.php
+++ b/tests/Feature/Invoice/InvoiceIndexActionTest.php
@@ -34,4 +34,13 @@ class InvoiceIndexActionTest extends TestCase
->assertInertiaPath('data.data.0.via', 'Post')
->assertInertiaPath('data.meta.links.mass-store', route('invoice.mass-store'));
}
+
+ public function testValuesCanBeNull(): void
+ {
+ $this->login()->loginNami()->withoutExceptionHandling();
+ Invoice::factory()->create();
+
+ $this->get(route('invoice.index'))
+ ->assertInertiaPath('data.data.0.sent_at_human', '');
+ }
}