adrema/resources/js/views/subscription/SubscriptionForm.vue

45 lines
1.0 KiB
Vue
Raw Normal View History

2021-07-04 01:44:41 +02:00
<template>
<form class="p-6 grid gap-4 justify-start" @submit.prevent="submit">
<f-text id="name" v-model="inner.name" label="Name" required></f-text>
2022-08-23 23:49:19 +02:00
<f-select
id="fee_id"
name="fee_id"
:options="fees"
v-model="inner.fee_id"
label="Nami-Beitrag"
required
></f-select>
2022-11-17 20:56:52 +01:00
<f-text id="amount" v-model="inner.amount" label="Interner Beitrag" mode="area" required></f-text>
2021-07-04 01:44:41 +02:00
<button type="submit" class="btn btn-primary">Absenden</button>
</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>