adrema/resources/js/views/setting/User.vue

62 lines
2.3 KiB
Vue
Raw Normal View History

2024-08-01 18:25:25 +02:00
<template>
<page-layout>
<template #toolbar>
<page-toolbar-button color="primary" icon="plus" @click.prevent="create">Neuer Benutzer</page-toolbar-button>
</template>
<ui-popup v-if="single !== null" :heading="single.id ? 'Benutzer bearbeiten' : 'Neuer Benutzer'" @close="cancel">
<form @submit.prevent="submit">
<section class="flex mt-4 space-x-2">
<ui-button type="submit" class="btn-danger">Speichern</ui-button>
<ui-button class="btn-primary" @click.prevent="single = null">Abbrechen</ui-button>
</section>
</form>
</ui-popup>
<setting-layout>
<div class="w-full h-full pb-6">
<table cellspacing="0" cellpadding="0" border="0" class="custom-table custom-table-sm hidden md:table">
<thead>
<th>Nachname</th>
<th>Vorname</th>
<th>Aktion</th>
</thead>
<tr v-for="(user, index) in data" :key="index">
<td v-text="user.lastname"></td>
<td v-text="user.firstname"></td>
<td>
<a v-tooltip="`Bearbeiten`" href="#" class="inline-flex btn btn-warning btn-sm" @click.prevent="edit(user)"><ui-sprite src="pencil"></ui-sprite></a>
<a v-tooltip="`Löschen`" href="#" class="inline-flex btn btn-danger btn-sm" @click.prevent="remove(user)"><ui-sprite src="pencil"></ui-sprite></a>
</td>
</tr>
</table>
<div class="px-6">
<ui-pagination class="mt-4" :value="meta" :only="['data']"></ui-pagination>
</div>
</div>
</setting-layout>
</page-layout>
</template>
<script lang="js" setup>
import SettingLayout from '../setting/Layout.vue';
const props = defineProps({
data: {
type: Object,
required: true,
},
meta: {
type: Object,
required: false,
default: () => {
return {};
},
},
});
import {indexProps, useIndex} from '../../composables/useInertiaApiIndex.js';
const {data, meta, single, create} = useIndex(props);
</script>