adrema/resources/js/views/formtemplate/Index.vue

58 lines
2.1 KiB
Vue
Raw Normal View History

2023-12-25 19:45:34 +01:00
<template>
<page-layout>
<template #toolbar>
<page-toolbar-button color="primary" icon="plus" @click="create">Vorlage erstellen</page-toolbar-button>
2024-01-01 18:29:33 +01:00
<page-toolbar-button :href="meta.links.form_index" color="primary"
icon="event">Veranstaltungen</page-toolbar-button>
2023-12-25 19:45:34 +01:00
</template>
2023-12-27 23:38:13 +01:00
<ui-popup v-if="single !== null" :heading="`Vorlage ${single.id ? 'bearbeiten' : 'erstellen'}`" full
@close="cancel">
<form-builder v-model="single.config" :meta="meta">
<template #meta>
<f-text id="name" v-model="single.name" name="name" label="Name" required></f-text>
</template>
</form-builder>
<template #actions>
<a href="#" @click.prevent="submit">
<ui-sprite src="save" class="text-zinc-400 w-6 h-6"></ui-sprite>
</a>
</template>
</ui-popup>
2023-12-25 19:45:34 +01:00
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm">
<thead>
<th>Name</th>
<th></th>
</thead>
<tr v-for="(formtemplate, index) in data" :key="index">
<td>
<div v-text="formtemplate.name"></div>
</td>
<td>
2023-12-27 23:38:13 +01:00
<a v-tooltip="`Bearbeiten`" href="#" class="ml-2 inline-flex btn btn-warning btn-sm"
@click.prevent="edit(formtemplate)"><ui-sprite src="pencil"></ui-sprite></a>
2023-12-25 19:45:34 +01:00
</td>
</tr>
</table>
<div class="px-6">
<ui-pagination class="mt-4" :value="meta" @reload="reloadPage"></ui-pagination>
</div>
</page-layout>
</template>
<script setup>
2023-12-27 23:38:13 +01:00
import { indexProps, useIndex } from '../../composables/useInertiaApiIndex.js';
2023-12-25 19:45:34 +01:00
import FormBuilder from './FormBuilder.vue';
const props = defineProps(indexProps);
2023-12-27 23:38:13 +01:00
var { meta, data, reloadPage, create, single, edit, cancel, submit } = useIndex(props.data, 'invoice');
2023-12-25 22:46:06 +01:00
function innerSubmit(payload) {
single.value = payload;
submit();
}
2023-12-25 19:45:34 +01:00
</script>