2021-07-04 16:56:07 +02:00
|
|
|
<template>
|
2023-05-20 01:45:43 +02:00
|
|
|
<div class="sidebar flex flex-col group is-bright">
|
2023-09-12 16:54:13 +02:00
|
|
|
<page-header title="Zahlungen" @close="$emit('close')">
|
2023-05-20 02:38:38 +02:00
|
|
|
<template #toolbar>
|
2023-09-12 16:54:13 +02:00
|
|
|
<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>
|
2023-05-20 02:38:38 +02:00
|
|
|
</template>
|
2023-05-20 01:45:43 +02:00
|
|
|
</page-header>
|
2021-07-04 16:56:07 +02:00
|
|
|
|
2021-08-22 05:15:56 +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>
|
2023-09-12 16:54:13 +02:00
|
|
|
<f-select id="subscription_id" v-model="single.subscription_id" name="subscription_id" :options="subscriptions" label="Beitrag" required></f-select>
|
|
|
|
<f-select id="status_id" v-model="single.status_id" name="status_id" :options="statuses" label="Status" required></f-select>
|
2021-08-22 05:15:56 +02:00
|
|
|
<button type="submit" class="btn btn-primary">Absenden</button>
|
|
|
|
</form>
|
|
|
|
|
2023-09-12 16:54:13 +02:00
|
|
|
<div v-else class="grow">
|
2022-02-10 02:18:57 +01:00
|
|
|
<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
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
<tr v-for="(payment, index) in value.payments" :key="index">
|
2022-02-10 02:18:57 +01:00
|
|
|
<td v-text="payment.nr"></td>
|
|
|
|
<td v-text="payment.status_name"></td>
|
2022-11-18 22:41:40 +01:00
|
|
|
<td v-text="payment.subscription.name"></td>
|
2022-02-10 02:18:57 +01:00
|
|
|
<td class="flex">
|
2022-08-23 23:49:19 +02:00
|
|
|
<a
|
|
|
|
href="#"
|
2023-09-12 16:54:13 +02:00
|
|
|
class="inline-flex btn btn-warning btn-sm"
|
2022-08-23 23:49:19 +02:00
|
|
|
@click.prevent="
|
|
|
|
single = payment;
|
|
|
|
mode = 'edit';
|
|
|
|
"
|
2023-07-06 13:56:19 +02:00
|
|
|
><ui-sprite src="pencil"></ui-sprite
|
2022-08-23 23:49:19 +02:00
|
|
|
></a>
|
2023-09-12 16:54:13 +02:00
|
|
|
<i-link v-show="!payment.is_accepted" href="#" class="inline-flex btn btn-success btn-sm" @click.prevent="accept(payment)"><ui-sprite src="check"></ui-sprite></i-link>
|
|
|
|
<i-link href="#" class="inline-flex btn btn-danger btn-sm" @click.prevent="remove(payment)"><ui-sprite src="trash"></ui-sprite></i-link>
|
2022-02-10 02:18:57 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
2021-07-15 21:19:33 +02:00
|
|
|
<div class="flex flex-col pb-6 px-6">
|
2022-08-23 23:49:19 +02:00
|
|
|
<a
|
2023-09-12 16:54:13 +02:00
|
|
|
v-for="(link, index) in value.payment_links"
|
|
|
|
:key="index"
|
2022-08-23 23:49:19 +02:00
|
|
|
href="#"
|
|
|
|
:class="{disabled: link.disabled}"
|
|
|
|
target="_BLANK"
|
|
|
|
class="mt-1 text-center btn btn-primary"
|
2023-09-12 16:54:13 +02:00
|
|
|
@click.prevent="openLink(link)"
|
2022-08-23 23:49:19 +02:00
|
|
|
v-text="link.label"
|
|
|
|
></a>
|
2021-07-15 21:19:33 +02:00
|
|
|
</div>
|
2021-07-04 16:56:07 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2023-09-12 16:54:13 +02:00
|
|
|
|
|
|
|
props: {
|
|
|
|
value: {},
|
|
|
|
subscriptions: {},
|
|
|
|
statuses: {},
|
|
|
|
},
|
2022-08-23 23:49:19 +02:00
|
|
|
data: function () {
|
2021-08-22 05:15:56 +02:00
|
|
|
return {
|
|
|
|
mode: null,
|
|
|
|
single: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2021-07-04 16:56:07 +02:00
|
|
|
methods: {
|
2023-05-20 01:12:53 +02:00
|
|
|
create() {
|
|
|
|
this.mode = 'create';
|
|
|
|
this.single = {};
|
|
|
|
},
|
|
|
|
cancel() {
|
|
|
|
this.mode = this.single = null;
|
|
|
|
},
|
2021-07-04 16:56:07 +02:00
|
|
|
remove(payment) {
|
2021-08-22 05:15:56 +02:00
|
|
|
this.$inertia.delete(`/member/${this.value.id}/payment/${payment.id}`);
|
2021-07-04 17:03:56 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
accept(payment) {
|
2022-08-23 23:49:19 +02:00
|
|
|
this.$inertia.patch(`/member/${this.value.id}/payment/${payment.id}`, {...payment, status_id: 3});
|
2021-07-17 16:57:37 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
openLink(link) {
|
|
|
|
if (link.disabled) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
window.open(link.href);
|
2021-08-22 05:15:56 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
submit() {
|
|
|
|
var _self = this;
|
|
|
|
|
2022-08-23 23:49:19 +02:00
|
|
|
this.mode === 'create'
|
2021-11-11 22:38:03 +01:00
|
|
|
? this.$inertia.post(`/member/${this.value.id}/payment`, this.single, {
|
2022-08-23 23:49:19 +02:00
|
|
|
onFinish() {
|
|
|
|
_self.single = null;
|
|
|
|
},
|
|
|
|
})
|
2021-08-22 05:15:56 +02:00
|
|
|
: this.$inertia.patch(`/member/${this.value.id}/payment/${this.single.id}`, this.single, {
|
2022-08-23 23:49:19 +02:00
|
|
|
onFinish() {
|
|
|
|
_self.single = null;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
2021-07-04 16:56:07 +02:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|