adrema/resources/js/views/activity/VIndex.vue

60 lines
2.3 KiB
Vue
Raw Normal View History

2023-02-23 22:43:13 +01:00
<template>
2023-04-29 23:41:26 +02:00
<page-layout page-class="pb-6">
2023-05-20 02:38:38 +02:00
<template #toolbar>
<page-toolbar-button :href="meta.links.create" color="primary" icon="plus">Tätigkeit
erstellen</page-toolbar-button>
2023-05-20 02:38:38 +02:00
</template>
2023-07-27 17:22:06 +02:00
<ui-popup v-if="deleting !== null" heading="Bitte bestätigen" @close="deleting = null">
2023-02-25 19:12:07 +01:00
<div>
2023-04-29 23:41:26 +02:00
<p class="mt-4">Diese Aktivität löschen?</p>
2023-02-25 19:12:07 +01:00
<div class="grid grid-cols-2 gap-3 mt-6">
2023-07-27 17:22:06 +02:00
<a href="#" class="text-center btn btn-danger" @click.prevent="remove">Löschen</a>
<a href="#" class="text-center btn btn-primary" @click.prevent="deleting = null">Abbrechen</a>
2023-02-25 19:12:07 +01:00
</div>
</div>
2023-05-19 01:06:46 +02:00
</ui-popup>
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm table">
2023-02-23 22:43:13 +01:00
<thead>
2023-02-25 17:19:17 +01:00
<th>Name</th>
2023-02-23 22:43:13 +01:00
<th></th>
</thead>
2023-07-27 17:22:06 +02:00
<tr v-for="(activity, index) in data" :key="index">
2023-02-25 17:19:17 +01:00
<td v-text="activity.name"></td>
2023-02-23 22:43:13 +01:00
<td>
2023-02-25 17:19:17 +01:00
<div class="flex space-x-1">
<i-link v-tooltip="`bearbeiten`" :href="activity.links.edit"
class="inline-flex btn btn-warning btn-sm"><ui-sprite src="pencil"></ui-sprite></i-link>
<a v-tooltip="`Entfernen`" href="#" class="inline-flex btn btn-danger btn-sm"
@click.prevent="deleting = activity"><ui-sprite src="trash"></ui-sprite></a>
2023-02-25 17:19:17 +01:00
</div>
2023-02-23 22:43:13 +01:00
</td>
</tr>
</table>
<div class="px-6">
2023-07-27 17:22:06 +02:00
<ui-pagination class="mt-4" :value="meta" :only="['data']"></ui-pagination>
2023-02-23 22:43:13 +01:00
</div>
2023-04-29 23:41:26 +02:00
</page-layout>
2023-02-23 22:43:13 +01:00
</template>
2023-07-27 17:22:06 +02:00
<script setup>
import { ref, defineProps } from 'vue';
import { indexProps, useIndex } from '../../composables/useIndex.js';
2023-02-23 22:43:13 +01:00
2023-07-27 17:22:06 +02:00
const props = defineProps(indexProps);
const { router, data, meta } = useIndex(props.data, 'activity');
2023-07-27 17:22:06 +02:00
const deleting = ref(null);
2023-02-25 19:12:07 +01:00
2023-07-27 17:22:06 +02:00
function remove() {
router.delete(deleting.value.links.destroy, {
preserveState: true,
onSuccess: (page) => {
data.value = page.props.data.data;
meta.value = page.props.data.meta;
deleting.value = null;
2023-04-29 23:41:26 +02:00
},
2023-07-27 17:22:06 +02:00
});
}
2023-02-23 22:43:13 +01:00
</script>