2021-07-04 16:56:07 +02:00
|
|
|
<template>
|
2021-07-15 21:19:33 +02:00
|
|
|
<div class="sidebar flex flex-col">
|
2021-11-11 22:38:03 +01:00
|
|
|
<sidebar-header :links="indexLinks" @close="$emit('close')" @create="mode = 'create'; single = {}" title="Zahlungen"></sidebar-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>
|
|
|
|
<f-select id="subscription_id" :options="subscriptions" v-model="single.subscription_id" label="Beitrag" required></f-select>
|
|
|
|
<f-select id="status_id" :options="statuses" v-model="single.status_id" label="Status" required></f-select>
|
|
|
|
<button type="submit" class="btn btn-primary">Absenden</button>
|
|
|
|
</form>
|
|
|
|
|
2021-08-22 19:40:12 +02:00
|
|
|
<table v-else class="custom-table custom-table-light custom-table-sm text-sm flex-grow">
|
|
|
|
<thead>
|
|
|
|
<th>Nr</th>
|
|
|
|
<th>Status</th>
|
|
|
|
<th>Beitrag</th>
|
|
|
|
<th></th>
|
|
|
|
</thead>
|
2021-07-04 16:56:07 +02:00
|
|
|
|
2021-08-22 19:40:12 +02:00
|
|
|
<tr v-for="payment, index in value.payments">
|
|
|
|
<td v-text="payment.nr"></td>
|
|
|
|
<td v-text="payment.status_name"></td>
|
|
|
|
<td v-text="payment.subscription_name"></td>
|
|
|
|
<td class="flex">
|
2021-08-22 05:15:56 +02:00
|
|
|
<a href="#" @click.prevent="single = payment; mode = 'edit'" class="inline-flex btn btn-warning btn-sm"><sprite src="pencil"></sprite></a>
|
2022-01-02 12:50:25 +01:00
|
|
|
<Link v-show="!payment.is_accepted" href="#" @click.prevent="accept(payment)" class="inline-flex btn btn-success btn-sm"><sprite src="check"></sprite></Link>
|
|
|
|
<Link href="#" @click.prevent="remove(payment)" class="inline-flex btn btn-danger btn-sm"><sprite src="trash"></sprite></Link>
|
2021-08-22 19:40:12 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
2021-07-15 21:19:33 +02:00
|
|
|
<div class="flex flex-col pb-6 px-6">
|
2021-07-17 16:57:37 +02:00
|
|
|
<a href="#" @click.prevent="openLink(link)" :class="{'disabled': link.disabled}" target="_BLANK" v-for="link in value.payment_links" class="mt-1 text-center btn btn-primary" 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>
|
|
|
|
import SidebarHeader from '../../components/SidebarHeader.vue';
|
|
|
|
|
|
|
|
export default {
|
2021-08-22 05:15:56 +02:00
|
|
|
data: function() {
|
|
|
|
return {
|
|
|
|
mode: null,
|
|
|
|
single: null,
|
2021-11-11 22:38:03 +01:00
|
|
|
indexLinks: [
|
|
|
|
{event: 'create', label: 'Neue Zahlung'}
|
|
|
|
]
|
2021-08-22 05:15:56 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2021-07-04 16:56:07 +02:00
|
|
|
components: { SidebarHeader },
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
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) {
|
2021-08-22 05:15:56 +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;
|
|
|
|
|
|
|
|
this.mode === 'create'
|
2021-11-11 22:38:03 +01:00
|
|
|
? this.$inertia.post(`/member/${this.value.id}/payment`, this.single, {
|
|
|
|
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, {
|
|
|
|
onFinish() {
|
|
|
|
_self.single = null;
|
|
|
|
}
|
|
|
|
});
|
2021-07-04 16:56:07 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
2021-08-22 05:15:56 +02:00
|
|
|
value: {},
|
|
|
|
subscriptions: {},
|
|
|
|
statuses: {},
|
2021-07-04 16:56:07 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|