2021-07-04 01:44:41 +02:00
|
|
|
<template>
|
2023-04-29 23:41:26 +02:00
|
|
|
<page-layout>
|
2023-05-20 02:38:38 +02:00
|
|
|
<template #toolbar>
|
2023-05-19 01:06:46 +02:00
|
|
|
<page-toolbar-button :href="meta.links.index" color="primary" icon="undo">zurück</page-toolbar-button>
|
2023-05-20 02:38:38 +02:00
|
|
|
</template>
|
2023-07-06 13:56:19 +02:00
|
|
|
<template #right>
|
2023-05-19 01:06:46 +02:00
|
|
|
<f-save-button form="subedit"></f-save-button>
|
2023-07-06 13:56:19 +02:00
|
|
|
</template>
|
|
|
|
<form id="subedit" class="p-3 grid gap-3" @submit.prevent="submit">
|
2023-05-19 01:06:46 +02:00
|
|
|
<ui-box heading="Beitrag">
|
2023-04-29 23:41:26 +02:00
|
|
|
<div class="grid gap-4 sm:grid-cols-2">
|
|
|
|
<f-text id="name" v-model="inner.name" label="Name" size="sm" required></f-text>
|
2023-12-20 22:11:07 +01:00
|
|
|
<f-select id="fee_id" v-model="inner.fee_id" name="fee_id" :options="fees" label="Nami-Beitrag"
|
|
|
|
size="sm" required></f-select>
|
2023-04-29 23:41:26 +02:00
|
|
|
</div>
|
2023-05-19 01:06:46 +02:00
|
|
|
</ui-box>
|
|
|
|
<ui-box heading="Positionen">
|
2023-04-29 23:41:26 +02:00
|
|
|
<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>
|
2023-12-20 22:11:07 +01:00
|
|
|
<f-text :id="`amount-${index}`" v-model="pos.amount" label="Beitrag" size="sm" mode="area"
|
|
|
|
required></f-text>
|
|
|
|
<a href="#" class="btn btn-sm btn-danger icon flex-none"
|
|
|
|
@click.prevent="inner.children.splice(index, 1)">
|
2023-07-06 13:56:19 +02:00
|
|
|
<ui-sprite src="trash" class="w-5 h-5"></ui-sprite>
|
2023-04-29 23:41:26 +02:00
|
|
|
</a>
|
|
|
|
</div>
|
2023-12-20 22:11:07 +01:00
|
|
|
<a href="#" class="btn btn-sm flex btn-primary flex self-start mt-4"
|
|
|
|
@click.prevent="inner.children.push({ name: '', amount: 0 })">
|
2023-07-06 13:56:19 +02:00
|
|
|
<ui-sprite src="plus" class="w-5 h-5"></ui-sprite>
|
2023-04-29 23:41:26 +02:00
|
|
|
Position hinzufügen
|
2022-12-13 23:11:32 +01:00
|
|
|
</a>
|
|
|
|
</div>
|
2023-05-19 01:06:46 +02:00
|
|
|
</ui-box>
|
2023-04-29 23:41:26 +02:00
|
|
|
</form>
|
|
|
|
</page-layout>
|
2021-07-04 01:44:41 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
|
|
|
|
props: {
|
|
|
|
data: {},
|
|
|
|
fees: {},
|
|
|
|
mode: {},
|
2023-05-02 23:13:00 +02:00
|
|
|
meta: {},
|
2021-07-04 01:44:41 +02:00
|
|
|
},
|
2023-12-20 22:11:07 +01:00
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
inner: { ...this.data },
|
|
|
|
};
|
|
|
|
},
|
2021-07-04 01:44:41 +02:00
|
|
|
|
|
|
|
methods: {
|
|
|
|
submit() {
|
2023-04-29 23:41:26 +02:00
|
|
|
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
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|