Add views for invoice index
This commit is contained in:
parent
a755d63197
commit
b738c5e6ca
|
@ -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()),
|
||||
]);
|
||||
|
|
|
@ -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,
|
||||
];
|
||||
|
|
|
@ -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
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 512.018 512.018"><path d="M6.98 256.673c-5.504 2.027-8.341 8.128-6.336 13.653l6.699 18.432L58.35 237.75zM55.257 420.513l30.72 84.48a10.57 10.57 0 0 0 5.525 6.016 10.73 10.73 0 0 0 4.501 1.003c1.259 0 2.496-.213 3.691-.661l33.899-12.501zM511.364 348.385l-35.157-96.661-84.373 84.373 41.813-15.403c5.483-2.091 11.669.768 13.696 6.315 2.048 5.525-.789 11.669-6.315 13.696l-53.12 19.584a10.617 10.617 0 0 1-3.691.661c-4.331 0-8.427-2.667-10.005-6.976-.021-.064 0-.128-.021-.192l-89.408 89.408 220.245-81.152c5.525-2.026 8.362-8.128 6.336-13.653M508.889 173.793 338.222 3.126c-4.16-4.16-10.923-4.16-15.083 0l-320 320c-4.16 4.16-4.16 10.923 0 15.083l170.667 170.667a10.56 10.56 0 0 0 7.531 3.136c2.731 0 5.461-1.045 7.552-3.115l320-320a10.7 10.7 0 0 0 0-15.104m-384 121.771L82.222 338.23a10.716 10.716 0 0 1-15.104 0c-4.16-4.16-4.16-10.923 0-15.083l42.667-42.667c4.16-4.16 10.923-4.16 15.083 0 4.16 4.161 4.181 10.902.021 15.084m184.213 13.546c-7.552 7.552-17.813 11.179-29.227 11.179-18.859 0-40.896-9.877-59.328-28.331-13.483-13.483-22.955-29.611-26.645-45.397-4.096-17.6-.725-32.917 9.493-43.157 10.219-10.24 25.536-13.611 43.157-9.493 15.787 3.691 31.915 13.141 45.397 26.645 29.633 29.61 37.185 68.522 17.153 88.554m135.787-120.213-42.667 42.667a10.716 10.716 0 0 1-15.104 0c-4.16-4.16-4.16-10.923 0-15.083l42.667-42.667c4.16-4.16 10.923-4.16 15.083 0s4.181 10.902.021 15.083"/></svg>
|
After Width: | Height: | Size: 1.4 KiB |
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<v-link href="/" menu="dashboard" icon="loss">Dashboard</v-link>
|
||||
<v-link href="/member" menu="member" icon="user">Mitglieder</v-link>
|
||||
<v-link v-show="hasModule('bill')" href="/subscription" menu="subscription" icon="money">Beiträge</v-link>
|
||||
<v-link v-show="hasModule('bill')" href="/invoice" menu="invoice" icon="moneypaper">Rechnungen</v-link>
|
||||
<v-link href="/contribution" menu="contribution" icon="contribution">Zuschüsse</v-link>
|
||||
<v-link href="/activity" menu="activity" icon="activity">Tätigkeiten</v-link>
|
||||
<v-link href="/group" menu="group" icon="group">Gruppen</v-link>
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
<template>
|
||||
<page-layout>
|
||||
<template #toolbar>
|
||||
<page-toolbar-button color="primary" icon="plus" @click="model = { ...props.meta.default }">Rechnung
|
||||
anlegen</page-toolbar-button>
|
||||
<page-toolbar-button color="primary" icon="plus" @click="massstore = { year: '' }">Massenrechnung
|
||||
anlegen</page-toolbar-button>
|
||||
</template>
|
||||
<ui-popup v-if="massstore !== null" heading="Massenrechnung anlegen" @close="massstore = null">
|
||||
<form @submit.prevent="sendMassstore">
|
||||
<section class="grid grid-cols-2 gap-3 mt-6">
|
||||
<f-text id="year" v-model="massstore.year" name="year" label="Jahr" required></f-text>
|
||||
</section>
|
||||
<section class="flex mt-4 space-x-2">
|
||||
<ui-button type="submit" class="btn-danger">Speichern</ui-button>
|
||||
<ui-button class="btn-primary" @click.prevent="massstore = null">Abbrechen</ui-button>
|
||||
</section>
|
||||
</form>
|
||||
</ui-popup>
|
||||
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
|
||||
<thead>
|
||||
<th>Empfänger</th>
|
||||
<th>Gesamtbetrag</th>
|
||||
<th>Status</th>
|
||||
<th>Gesendet am</th>
|
||||
<th>Rechnungsweg</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
<tr v-for="(invoice, index) in data" :key="index">
|
||||
<td>
|
||||
<div v-text="invoice.to_name"></div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-text="invoice.sum_human"></div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-text="invoice.status"></div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-text="invoice.sent_at_human"></div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-text="invoice.via"></div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="px-6">
|
||||
<ui-pagination class="mt-4" :value="meta" @reload="reloadPage"></ui-pagination>
|
||||
</div>
|
||||
</page-layout>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { indexProps, useIndex } from '../../composables/useIndex.js';
|
||||
const props = defineProps(indexProps);
|
||||
var { axios, meta, data, reloadPage } = useIndex(props.data, 'invoice');
|
||||
const massstore = ref(null);
|
||||
|
||||
function sendMassstore() {
|
||||
axios.post(meta.value.links['mass-store'], massstore.value);
|
||||
}
|
||||
</script>
|
|
@ -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', '');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue