mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-12-29 08:00:28 +01:00
71 lines
2.1 KiB
Vue
71 lines
2.1 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: 2023 Andreas Palm
|
|
|
|
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
|
-->
|
|
|
|
<script setup>
|
|
import axios from "axios";
|
|
import {ref} from 'vue';
|
|
import {reloadDataTables} from "@res/js/jqueryBridge";
|
|
import AddGlobalToArticle from "./AddGlobalToArticle.vue";
|
|
import GroupEdit from "./GroupEdit.vue";
|
|
import OptionEdit from "./OptionEdit.vue";
|
|
import Variant from "./Variant.vue";
|
|
|
|
const model = ref(null);
|
|
|
|
document.getElementById('main').addEventListener('click', async (ev) => {
|
|
const target = ev.target;
|
|
if (!target || !target.classList.contains('vueAction'))
|
|
return;
|
|
const ds = target.dataset;
|
|
if (ds.action.endsWith('Delete')) {
|
|
const cnf = confirm('Wirklich löschen?');
|
|
if (!cnf)
|
|
return;
|
|
let url;
|
|
switch (ds.action) {
|
|
case 'groupDelete':
|
|
url = ds.articleId > 0
|
|
? 'index.php?module=matrixprodukt&action=artikel&cmd=groupdelete'
|
|
: 'index.php?module=matrixprodukt&action=list&cmd=delete';
|
|
await axios.post(url, {groupId: ds.groupId});
|
|
break;
|
|
case 'optionDelete':
|
|
url = ds.articleId > 0
|
|
? 'index.php?module=matrixprodukt&action=artikel&cmd=optiondelete'
|
|
: 'index.php?module=matrixprodukt&action=optionenlist&cmd=delete';
|
|
await axios.post(url, {optionId: ds.optionId});
|
|
break;
|
|
case 'variantDelete':
|
|
url = 'index.php?module=matrixprodukt&action=artikel&cmd=variantdelete';
|
|
await axios.post(url, {variantId: ds.variantId});
|
|
break;
|
|
}
|
|
onSave();
|
|
return;
|
|
}
|
|
|
|
model.value = ds;
|
|
});
|
|
|
|
function onSave() {
|
|
reloadDataTables();
|
|
onClose();
|
|
}
|
|
|
|
function onClose() {
|
|
model.value = null;
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<template v-if="model">
|
|
<AddGlobalToArticle v-if="model.action === 'addGlobalToArticle'" v-bind="model" @close="onClose" @save="onSave" />
|
|
<GroupEdit v-else-if="model.action === 'groupEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
|
<OptionEdit v-else-if="model.action === 'optionEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
|
<Variant v-else-if="model.action === 'variantEdit'" v-bind="model" @close="onClose" @save="onSave" />
|
|
</template>
|
|
</template>
|