2023-06-01 15:02:35 +02:00
|
|
|
<template>
|
|
|
|
<page-layout>
|
|
|
|
<template #toolbar>
|
2023-06-01 16:50:50 +02:00
|
|
|
<page-toolbar-button @click.prevent="model = {...data.meta.default}" color="primary" icon="plus">Neue Verbindung</page-toolbar-button>
|
2023-06-01 15:02:35 +02:00
|
|
|
</template>
|
2023-06-08 00:14:55 +02:00
|
|
|
<ui-popup :heading="model.id ? 'Verbindung bearbeiten' : 'Neue Verbindung'" v-if="model !== null" @close="model = null">
|
2023-06-07 22:52:02 +02:00
|
|
|
<form @submit.prevent="submit">
|
|
|
|
<section class="grid grid-cols-2 gap-3 mt-6">
|
2023-06-01 15:45:02 +02:00
|
|
|
<f-text v-model="model.name" name="name" id="name" label="Bezeichnung" required></f-text>
|
|
|
|
<f-text v-model="model.domain" name="domain" id="domain" label="Domain" required></f-text>
|
2023-06-01 16:50:50 +02:00
|
|
|
<f-select
|
2023-07-06 13:56:19 +02:00
|
|
|
:modelValue="model.type.cls"
|
|
|
|
@update:modelValue="
|
2023-06-01 16:50:50 +02:00
|
|
|
model.type = {
|
|
|
|
cls: $event,
|
|
|
|
params: {...getType($event).defaults},
|
|
|
|
}
|
|
|
|
"
|
|
|
|
label="Typ"
|
|
|
|
name="type"
|
|
|
|
id="type"
|
|
|
|
:options="data.meta.types"
|
|
|
|
:placeholder="''"
|
2023-06-07 22:52:02 +02:00
|
|
|
required
|
2023-06-01 16:50:50 +02:00
|
|
|
></f-select>
|
|
|
|
<template v-for="(field, index) in getType(model.type.cls).fields">
|
2023-06-07 22:52:02 +02:00
|
|
|
<f-text
|
|
|
|
:key="index"
|
2023-06-07 22:59:58 +02:00
|
|
|
v-if="field.type === 'text' || field.type === 'password'"
|
2023-06-07 22:52:02 +02:00
|
|
|
:label="field.label"
|
2023-06-07 22:59:58 +02:00
|
|
|
:type="field.type"
|
2023-06-07 22:52:02 +02:00
|
|
|
:name="field.name"
|
|
|
|
:id="field.name"
|
|
|
|
v-model="model.type.params[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>
|
|
|
|
<ui-button @click.prevent="model = null" class="btn-primary">Abbrechen</ui-button>
|
|
|
|
</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-06-01 15:45:02 +02:00
|
|
|
<tr v-for="(gateway, index) in inner.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>
|
|
|
|
<ui-boolean-display
|
|
|
|
:value="gateway.works"
|
|
|
|
long-label="Verbindungsstatus"
|
|
|
|
:label="gateway.works ? 'Verbindung erfolgreich' : 'Verbindung fehlgeschlagen'"
|
|
|
|
></ui-boolean-display>
|
|
|
|
</td>
|
2023-06-07 21:40:58 +02:00
|
|
|
<td>
|
2023-07-06 13:56:19 +02:00
|
|
|
<a href="#" v-tooltip="`Bearbeiten`" @click.prevent="model = {...gateway}" class="inline-flex btn btn-warning btn-sm"><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">
|
|
|
|
<ui-pagination class="mt-4" :value="data.meta" :only="['data']"></ui-pagination>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</setting-layout>
|
|
|
|
</page-layout>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import SettingLayout from '../setting/Layout.vue';
|
2023-06-01 15:45:02 +02:00
|
|
|
import indexHelpers from '../../mixins/indexHelpers.js';
|
2023-06-01 15:02:35 +02:00
|
|
|
|
|
|
|
export default {
|
2023-06-01 15:45:02 +02:00
|
|
|
mixins: [indexHelpers],
|
|
|
|
|
2023-06-01 15:02:35 +02:00
|
|
|
data: function () {
|
|
|
|
return {
|
2023-06-01 15:45:02 +02:00
|
|
|
model: null,
|
|
|
|
inner: {...this.data},
|
2023-06-01 15:02:35 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
data: {},
|
|
|
|
},
|
2023-06-01 15:45:02 +02:00
|
|
|
|
|
|
|
methods: {
|
2023-06-01 16:50:50 +02:00
|
|
|
getType(type) {
|
|
|
|
return this.data.meta.types.find((t) => t.id === type);
|
|
|
|
},
|
2023-06-01 15:45:02 +02:00
|
|
|
async submit() {
|
2023-07-06 13:56:19 +02:00
|
|
|
await this.axios[this.model.id ? 'patch' : 'post'](this.model.id ? this.model.links.update : this.data.meta.links.store, this.model);
|
2023-06-01 15:45:02 +02:00
|
|
|
|
2023-07-06 13:56:19 +02:00
|
|
|
this.reload();
|
|
|
|
this.model = null;
|
2023-06-01 15:45:02 +02:00
|
|
|
},
|
|
|
|
},
|
2023-06-01 15:02:35 +02:00
|
|
|
components: {
|
|
|
|
SettingLayout,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|