Löschen/Deaktivierung
This commit is contained in:
@@ -88,15 +88,21 @@ async function openTemplateManager(item, section) {
|
||||
let versions = [];
|
||||
let activeId = 0;
|
||||
|
||||
const isTemplateSection = () => {
|
||||
if (section?.is_template) return true;
|
||||
const slug = (section?.slug || '').toString().toLowerCase();
|
||||
return slug === 'emailtemplate';
|
||||
};
|
||||
|
||||
const fetchTemplateReferences = async () => {
|
||||
if (!section?.is_template) return null;
|
||||
if (!isTemplateSection()) return null;
|
||||
const res = await apiAction('templates.references', { method: 'GET', data: { template_id: item.id } }).catch(() => null);
|
||||
if (!res || res.ok === false) return null;
|
||||
return Array.isArray(res?.references) ? res.references : [];
|
||||
};
|
||||
|
||||
const confirmTemplateReferences = async (actionLabel) => {
|
||||
if (!section?.is_template) return true;
|
||||
if (!isTemplateSection()) return true;
|
||||
const refs = await fetchTemplateReferences();
|
||||
if (refs === null) {
|
||||
return confirm(`Referenzen konnten nicht geprüft werden. ${actionLabel} trotzdem?`);
|
||||
|
||||
Reference in New Issue
Block a user