2021-07-04 16:56:07 +02:00
|
|
|
<template>
|
2023-10-13 15:48:29 +02:00
|
|
|
<page-header title="Zahlungen" @close="$emit('close')">
|
|
|
|
<template #toolbar>
|
|
|
|
<page-toolbar-button v-if="single === null" color="primary" icon="plus" @click.prevent="create">Neue
|
|
|
|
Zahlung</page-toolbar-button>
|
|
|
|
<page-toolbar-button v-if="single !== null" color="primary" icon="undo"
|
|
|
|
@click.prevent="cancel">Zurück</page-toolbar-button>
|
|
|
|
</template>
|
|
|
|
</page-header>
|
2021-07-04 16:56:07 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
<form v-if="single" class="p-6 grid gap-4 justify-start" @submit.prevent="submit">
|
|
|
|
<f-text id="nr" v-model="single.nr" label="Jahr" required></f-text>
|
|
|
|
<f-select id="subscription_id" v-model="single.subscription_id" name="subscription_id" :options="meta.subscriptions"
|
|
|
|
label="Beitrag" required></f-select>
|
|
|
|
<f-select id="status_id" v-model="single.status_id" name="status_id" :options="meta.statuses" label="Status"
|
|
|
|
required></f-select>
|
|
|
|
<button type="submit" class="btn btn-primary">Absenden</button>
|
|
|
|
</form>
|
2021-08-22 05:15:56 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
<div v-else class="grow">
|
|
|
|
<table class="custom-table custom-table-light custom-table-sm text-sm">
|
|
|
|
<thead>
|
|
|
|
<th>Nr</th>
|
|
|
|
<th>Status</th>
|
|
|
|
<th>Beitrag</th>
|
|
|
|
<th></th>
|
|
|
|
</thead>
|
2021-07-04 16:56:07 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
<tr v-for="(payment, index) in data" :key="index">
|
|
|
|
<td v-text="payment.nr"></td>
|
|
|
|
<td v-text="payment.status_name"></td>
|
|
|
|
<td v-text="payment.subscription.name"></td>
|
|
|
|
<td class="flex">
|
|
|
|
<a href="#" class="inline-flex btn btn-warning btn-sm" @click.prevent="edit(payment)"><ui-sprite
|
|
|
|
src="pencil"></ui-sprite></a>
|
|
|
|
<button v-show="!payment.is_accepted" href="#" class="inline-flex btn btn-success btn-sm"
|
|
|
|
@click.prevent="accept(payment)"><ui-sprite src="check"></ui-sprite></button>
|
|
|
|
<button class="inline-flex btn btn-danger btn-sm" @click.prevent="remove(payment)"><ui-sprite
|
|
|
|
src="trash"></ui-sprite></button>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2021-07-04 16:56:07 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
<script setup>
|
|
|
|
defineEmits(['close']);
|
|
|
|
import { useApiIndex } from '../../composables/useApiIndex.js';
|
2023-09-12 16:54:13 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
const props = defineProps({
|
|
|
|
url: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2023-09-12 16:54:13 +02:00
|
|
|
},
|
2023-10-13 15:48:29 +02:00
|
|
|
});
|
2021-07-04 17:03:56 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
const { axios, data, meta, reload, cancel, single, create, edit, submit, remove } = useApiIndex(props.url, 'payment');
|
2021-07-17 16:57:37 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
async function accept(payment) {
|
|
|
|
await axios.patch(payment.links.update, { ...payment, status_id: 3 });
|
2021-07-17 16:57:37 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
await reload();
|
|
|
|
}
|
2021-08-22 05:15:56 +02:00
|
|
|
|
2023-10-13 15:48:29 +02:00
|
|
|
await reload();
|
2021-07-04 16:56:07 +02:00
|
|
|
</script>
|