2023-06-01 15:02:35 +02:00
|
|
|
<template>
|
|
|
|
<page-layout>
|
|
|
|
<template #toolbar>
|
2024-01-25 23:40:29 +01:00
|
|
|
<page-toolbar-button color="primary" icon="plus" @click.prevent="create">Neue Verbindung</page-toolbar-button>
|
2023-06-01 15:02:35 +02:00
|
|
|
</template>
|
2024-01-25 23:40:29 +01:00
|
|
|
<ui-popup v-if="single !== null" :heading="single.id ? 'Verbindung bearbeiten' : 'Neue Verbindung'" @close="cancel">
|
2023-06-07 22:52:02 +02:00
|
|
|
<form @submit.prevent="submit">
|
|
|
|
<section class="grid grid-cols-2 gap-3 mt-6">
|
2024-01-25 23:40:29 +01:00
|
|
|
<f-text id="name" v-model="single.name" name="name" label="Bezeichnung" required></f-text>
|
|
|
|
<f-text id="domain" v-model="single.domain" name="domain" label="Domain" required></f-text>
|
|
|
|
<f-select id="type" :model-value="single.type.cls" label="Typ" name="type" :options="meta.types"
|
2023-08-16 00:43:28 +02:00
|
|
|
:placeholder="''" required @update:model-value="
|
2024-01-25 23:40:29 +01:00
|
|
|
single.type = {
|
2023-06-01 16:50:50 +02:00
|
|
|
cls: $event,
|
2023-08-16 00:43:28 +02:00
|
|
|
params: { ...getType($event).defaults },
|
2023-06-01 16:50:50 +02:00
|
|
|
}
|
2023-08-16 00:43:28 +02:00
|
|
|
"></f-select>
|
2024-01-25 23:40:29 +01:00
|
|
|
<template v-for="(field, index) in getType(single.type.cls).fields">
|
2023-08-16 00:43:28 +02:00
|
|
|
<f-text v-if="field.type === 'text' || field.type === 'password' || field.type === 'email'"
|
2024-01-25 23:40:29 +01:00
|
|
|
:id="field.name" :key="index" v-model="single.type.params[field.name]" :label="field.label"
|
2023-08-16 00:43:28 +02:00
|
|
|
:type="field.type" :name="field.name" :required="field.is_required"></f-text>
|
2023-06-01 16:50:50 +02:00
|
|
|
</template>
|
2023-06-07 22:52:02 +02:00
|
|
|
</section>
|
|
|
|
<section class="flex mt-4 space-x-2">
|
|
|
|
<ui-button type="submit" class="btn-danger">Speichern</ui-button>
|
2024-01-25 23:40:29 +01:00
|
|
|
<ui-button class="btn-primary" @click.prevent="single = null">Abbrechen</ui-button>
|
2023-06-07 22:52:02 +02:00
|
|
|
</section>
|
|
|
|
</form>
|
2023-06-01 15:02:35 +02:00
|
|
|
</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>
|
2023-06-01 15:45:02 +02:00
|
|
|
<th>Bezeichnung</th>
|
2023-06-01 15:02:35 +02:00
|
|
|
<th>Domain</th>
|
|
|
|
<th>Typ</th>
|
|
|
|
<th>Prüfung</th>
|
|
|
|
<th>Aktion</th>
|
|
|
|
</thead>
|
|
|
|
|
2023-07-27 17:22:06 +02:00
|
|
|
<tr v-for="(gateway, index) in data" :key="index">
|
2023-06-01 15:02:35 +02:00
|
|
|
<td v-text="gateway.name"></td>
|
|
|
|
<td v-text="gateway.domain"></td>
|
|
|
|
<td v-text="gateway.type_human"></td>
|
|
|
|
<td>
|
2023-08-16 00:43:28 +02:00
|
|
|
<ui-boolean-display :value="gateway.works" long-label="Verbindungsstatus"
|
|
|
|
:label="gateway.works ? 'Verbindung erfolgreich' : 'Verbindung fehlgeschlagen'"></ui-boolean-display>
|
2023-06-01 15:02:35 +02:00
|
|
|
</td>
|
2023-06-07 21:40:58 +02:00
|
|
|
<td>
|
2023-08-16 00:43:28 +02:00
|
|
|
<a v-tooltip="`Bearbeiten`" href="#" class="inline-flex btn btn-warning btn-sm"
|
2024-01-25 23:40:29 +01:00
|
|
|
@click.prevent="edit(gateway)"><ui-sprite src="pencil"></ui-sprite></a>
|
2023-06-07 21:40:58 +02:00
|
|
|
</td>
|
2023-06-01 15:02:35 +02:00
|
|
|
</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-06-01 15:02:35 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</setting-layout>
|
|
|
|
</page-layout>
|
|
|
|
</template>
|
|
|
|
|
2023-07-27 17:22:06 +02:00
|
|
|
<script setup>
|
2024-01-25 23:40:29 +01:00
|
|
|
import { indexProps, useIndex } from '../../composables/useInertiaApiIndex.js';
|
2023-06-01 15:02:35 +02:00
|
|
|
import SettingLayout from '../setting/Layout.vue';
|
2023-06-01 15:45:02 +02:00
|
|
|
|
2023-07-27 17:22:06 +02:00
|
|
|
const props = defineProps(indexProps);
|
2024-01-25 23:40:29 +01:00
|
|
|
const { meta, data, create, edit, cancel, single, submit } = useIndex(props.data, 'mailgateway');
|
2023-06-01 15:45:02 +02:00
|
|
|
|
2023-07-27 17:22:06 +02:00
|
|
|
function getType(type) {
|
|
|
|
return meta.value.types.find((t) => t.id === type);
|
|
|
|
}
|
2023-06-01 15:02:35 +02:00
|
|
|
</script>
|