2021-07-04 01:44:41 +02:00
|
|
|
<template>
|
2022-12-13 23:11:32 +01:00
|
|
|
<form id="subedit" class="p-3 grid gap-3" @submit.prevent="submit">
|
2022-12-04 23:40:35 +01:00
|
|
|
<save-button form="subedit"></save-button>
|
2022-12-13 23:11:32 +01:00
|
|
|
<box heading="Beitrag">
|
|
|
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
|
|
<f-text id="name" v-model="inner.name" label="Name" size="sm" required></f-text>
|
|
|
|
<f-select
|
|
|
|
id="fee_id"
|
|
|
|
name="fee_id"
|
|
|
|
:options="fees"
|
|
|
|
v-model="inner.fee_id"
|
|
|
|
label="Nami-Beitrag"
|
|
|
|
size="sm"
|
|
|
|
required
|
|
|
|
></f-select>
|
2022-12-14 00:23:03 +01:00
|
|
|
<f-switch id="split" label="Rechnung aufsplitten" v-model="inner.split" size="sm"></f-switch>
|
2022-12-14 23:20:05 +01:00
|
|
|
<f-switch
|
|
|
|
id="for_promise"
|
|
|
|
label="Für Versprechen benutzen"
|
|
|
|
v-model="inner.for_promise"
|
|
|
|
size="sm"
|
|
|
|
></f-switch>
|
2022-12-13 23:11:32 +01:00
|
|
|
</div>
|
|
|
|
</box>
|
|
|
|
<box heading="Positionen">
|
|
|
|
<div class="flex flex-col space-y-4">
|
|
|
|
<div v-for="(pos, index) in inner.children" :key="index" class="flex space-x-2 items-end">
|
|
|
|
<f-text :id="`name-${index}`" v-model="pos.name" label="Name" size="sm" required></f-text>
|
|
|
|
<f-text
|
|
|
|
:id="`amount-${index}`"
|
|
|
|
v-model="pos.amount"
|
|
|
|
label="Beitrag"
|
|
|
|
size="sm"
|
|
|
|
mode="area"
|
|
|
|
required
|
|
|
|
></f-text>
|
|
|
|
<a
|
|
|
|
href="#"
|
|
|
|
@click.prevent="inner.children.splice(index, 1)"
|
|
|
|
class="btn btn-sm btn-danger icon flex-none"
|
|
|
|
>
|
|
|
|
<svg-sprite src="trash" class="w-5 h-5"></svg-sprite>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<a
|
|
|
|
href="#"
|
|
|
|
@click.prevent="inner.children.push({name: '', amount: 0})"
|
|
|
|
class="btn btn-sm flex btn-primary flex self-start mt-4"
|
|
|
|
>
|
|
|
|
<svg-sprite src="plus" class="w-5 h-5"></svg-sprite>
|
|
|
|
Position hinzufügen
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</box>
|
2021-07-04 01:44:41 +02:00
|
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2022-08-23 23:49:19 +02:00
|
|
|
data: function () {
|
2021-07-04 01:44:41 +02:00
|
|
|
return {
|
|
|
|
inner: {},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
props: {
|
|
|
|
data: {},
|
|
|
|
fees: {},
|
|
|
|
mode: {},
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
submit() {
|
|
|
|
this.mode === 'create'
|
|
|
|
? this.$inertia.post(`/subscription`, this.inner)
|
|
|
|
: this.$inertia.patch(`/subscription/${this.inner.id}`, this.inner);
|
2022-08-23 23:49:19 +02:00
|
|
|
},
|
2021-07-04 01:44:41 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
created() {
|
|
|
|
this.inner = this.data;
|
2022-08-23 23:49:19 +02:00
|
|
|
},
|
2021-07-04 01:44:41 +02:00
|
|
|
};
|
|
|
|
</script>
|