diff --git a/controllers/contactPersonController.js b/controllers/contactPersonController.js
index 30ebb53..4502d08 100644
--- a/controllers/contactPersonController.js
+++ b/controllers/contactPersonController.js
@@ -1,4 +1,5 @@
-const { ContactPerson, Position } = require('../models');
+const { ContactPerson, Position, Event, EventType, EventPlace } = require('../models');
+const { Op } = require('sequelize');
const getAllContactPersons = async (req, res) => {
try {
@@ -70,9 +71,61 @@ const deleteContactPerson = async (req, res) => {
}
};
+const filterContactPersons = async (req, res) => {
+ try {
+ const { config: configString } = req.body;
+ console.log(configString, typeof configString);
+ const config = JSON.parse(configString);
+ const where = {};
+
+ console.log(config, typeof config);
+ console.log(config.selection);
+ if (config.selection.id && config.selection.id === 'all') {
+ } else if (config.selection.id) {
+ where.id = config.selection.id;
+ } else {
+ const filters = [];
+
+ if (config.selection.types && config.selection.types.length > 0) {
+ filters.push({ '$positions.id$': { [Op.in]: config.selection.types } });
+ }
+
+ if (config.selection.places && config.selection.places.length > 0) {
+ filters.push({ '$events.eventPlaceId$': { [Op.in]: config.selection.places } });
+ }
+
+ if (filters.length > 0) {
+ where[Op.and] = filters;
+ }
+ }
+
+ const contactPersons = await ContactPerson.findAll({
+ where,
+ include: [
+ {
+ model: Position,
+ as: 'positions',
+ through: { attributes: [] },
+ },
+ {
+ model: Event,
+ as: 'events',
+ through: { attributes: [] },
+ },
+ ],
+ });
+
+ res.json(contactPersons);
+ } catch (error) {
+ res.status(500).json({ error: 'Failed to fetch contact persons' });
+ console.error(error);
+ }
+};
+
module.exports = {
getAllContactPersons,
createContactPerson,
updateContactPerson,
- deleteContactPerson
+ deleteContactPerson,
+ filterContactPersons
};
diff --git a/controllers/eventController.js b/controllers/eventController.js
index 2298b8e..47a38f1 100644
--- a/controllers/eventController.js
+++ b/controllers/eventController.js
@@ -123,6 +123,7 @@ const filterEvents = async (req, res) => {
const createEvent = async (req, res) => {
try {
const { contactPersonIds, ...eventData } = req.body;
+ eventData.alsoOnHomepage = eventData.alsoOnHomepage ?? 0;
const event = await Event.create(eventData);
if (contactPersonIds) {
await event.setContactPersons(contactPersonIds);
diff --git a/routes/contactPerson.js b/routes/contactPerson.js
index 8f21554..3658390 100644
--- a/routes/contactPerson.js
+++ b/routes/contactPerson.js
@@ -1,11 +1,12 @@
const express = require('express');
const router = express.Router();
-const { getAllContactPersons, createContactPerson, updateContactPerson, deleteContactPerson } = require('../controllers/contactPersonController');
-const authMiddleware = require('../middleware/authMiddleware')
+const { getAllContactPersons, createContactPerson, updateContactPerson, deleteContactPerson, filterContactPersons } = require('../controllers/contactPersonController');
+const authMiddleware = require('../middleware/authMiddleware');
-router.get('/', authMiddleware, getAllContactPersons);
+router.get('/', getAllContactPersons);
router.post('/', authMiddleware, createContactPerson);
router.put('/:id', authMiddleware, updateContactPerson);
router.delete('/:id', authMiddleware, deleteContactPerson);
+router.post('/filter', filterContactPersons);
module.exports = router;
diff --git a/routes/eventPlaces.js b/routes/eventPlaces.js
index 99081d2..8fc37bc 100644
--- a/routes/eventPlaces.js
+++ b/routes/eventPlaces.js
@@ -3,7 +3,7 @@ const router = express.Router();
const { getAllEventPlaces, createEventPlace, updateEventPlace, deleteEventPlace } = require('../controllers/eventPlaceController.js');
const authMiddleware = require('../middleware/authMiddleware')
-router.get('/', authMiddleware, getAllEventPlaces);
+router.get('/', getAllEventPlaces);
router.post('/', authMiddleware, createEventPlace);
router.put('/:id', authMiddleware, updateEventPlace);
router.delete('/:id', authMiddleware, deleteEventPlace);
diff --git a/routes/eventtypes.js b/routes/eventtypes.js
index 64c1d6e..ccaa3aa 100644
--- a/routes/eventtypes.js
+++ b/routes/eventtypes.js
@@ -3,7 +3,7 @@ const router = express.Router();
const { getAllEventTypes, createEventType, updateEventType, deleteEventType } = require('../controllers/eventtypecontroller');
const authMiddleware = require('../middleware/authMiddleware')
-router.get('/', authMiddleware, getAllEventTypes);
+router.get('/', getAllEventTypes);
router.post('/', authMiddleware, createEventType);
router.put('/:id', authMiddleware, updateEventType);
router.delete('/:id', authMiddleware, deleteEventType);
diff --git a/src/components/AddContactDialog.vue b/src/components/AddContactDialog.vue
new file mode 100644
index 0000000..0f72a5c
--- /dev/null
+++ b/src/components/AddContactDialog.vue
@@ -0,0 +1,224 @@
+
+
+
+
+
Kontaktperson hinzufügen
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/ContactRender.vue b/src/components/ContactRender.vue
new file mode 100644
index 0000000..cad8d21
--- /dev/null
+++ b/src/components/ContactRender.vue
@@ -0,0 +1,70 @@
+
+
+
+
{{ contact.name }}
+
Telefon: {{ contact.phone }}
+
Straße: {{ contact.street }}
+
Postleitzahl: {{ contact.zipcode }}
+
Stadt: {{ contact.city }}
+
E-Mail: {{ contact.email }}
+
Positionen: {{ contact.positions.map(pos =>
+ pos.caption).join(', ') }}
+
+
+
+
+ {{ contact.name }}
+ , Telefon: {{ contact.phone }}
+ , Straße: {{ contact.street }}
+ , Postleitzahl: {{ contact.zipcode }}
+ , Stadt: {{ contact.city }}
+ , E-Mail: {{ contact.email }}
+ , Positionen: {{ contact.positions.map(pos =>
+ pos.caption).join(', ') }}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/components/EventForm.vue b/src/components/EventForm.vue
index 2391dfb..b8c695e 100644
--- a/src/components/EventForm.vue
+++ b/src/components/EventForm.vue
@@ -193,7 +193,7 @@ export default {
event_place_id: this.selectedEventPlace ? this.selectedEventPlace.id : null,
contactPersonIds: this.selectedContactPersons.map(person => person.id)
};
- payload.dayOfWeek = payload.dayOfWeek.value;
+ payload.dayOfWeek = payload.dayOfWeek ? payload.dayOfWeek.value ?? -1 : -1;
let response;
if (this.eventData.id) {
response = await axios.put(`/events/${this.eventData.id}`, payload);
diff --git a/src/components/RenderContentComponent.vue b/src/components/RenderContentComponent.vue
index 9ddf846..e581286 100644
--- a/src/components/RenderContentComponent.vue
+++ b/src/components/RenderContentComponent.vue
@@ -7,7 +7,7 @@ import { createApp, h, ref, watch } from 'vue';
import WorshipRender from './WorshipRender.vue';
import ImageRender from './ImageRender.vue';
import EventRender from './EventRender.vue';
-import DownloadLink from './DownloadLink.vue';
+import ContactRender from './ContactRender.vue'; // Neue Komponente importieren
export default {
name: 'RenderContentComponent',
@@ -24,7 +24,7 @@ export default {
let result = renderWorship(content);
result = renderImage(result);
result = renderEvent(result);
- result = renderDownload(result);
+ result = renderContact(result); // Neuer Filter
return result;
};
@@ -93,23 +93,25 @@ export default {
return result;
};
- const renderDownload = (content) => {
- const downloadPattern = /{{ download title="(.*?)" hash="(.*?)" extension="(.*?)" }}/g;
+ const renderContact = (content) => {
+ const contactPattern = /{{ contact:(.*?) }}/g;
let result = content;
- result = result.replace(downloadPattern, (match, title, hash, extension) => {
- const placeholderId = `download-render-placeholder-${Math.random().toString(36).substr(2, 9)}`;
+ result = result.replace(contactPattern, (match, config) => {
+ const props = JSON.parse(config);
+ const placeholderId = `contact-render-placeholder-${Math.random().toString(36).substr(2, 9)}`;
setTimeout(() => {
const placeholder = document.getElementById(placeholderId);
if (placeholder) {
const app = createApp({
render() {
- return h(DownloadLink, { title, hash, extension });
+ return h(ContactRender, { config: props });
},
});
app.mount(placeholder);
}
}, 0);
- return `
`;
+ const tag = props.style === 'box' ? 'div' : 'span'
+ return `<${tag} id="${placeholderId}">${tag}>`;
});
return result;
};
diff --git a/src/content/MiriamsWunderkisteContent.vue b/src/content/MiriamsWunderkisteContent.vue
new file mode 100644
index 0000000..30c76ae
--- /dev/null
+++ b/src/content/MiriamsWunderkisteContent.vue
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/content/admin/EditPagesComponent.vue b/src/content/admin/EditPagesComponent.vue
index 82c6e2b..52735f5 100644
--- a/src/content/admin/EditPagesComponent.vue
+++ b/src/content/admin/EditPagesComponent.vue
@@ -76,7 +76,7 @@
-
+
@@ -90,6 +90,7 @@
+
@@ -118,6 +119,7 @@ import AddImageDialog from '@/components/AddImageDialog.vue';
import AddEventDialog from '@/components/AddEventDialog.vue';
import AddLinkDialog from '@/components/AddLinkDialog.vue';
import AddDownloadDialog from '@/components/AddDownloadDialog.vue';
+import AddContactDialog from '@/components/AddContactDialog.vue';
import { BoldIcon, ItalicIcon, UnderlineIcon, StrikethroughIcon, ListIcon, NumberedListLeftIcon, TableIcon,
Table2ColumnsIcon, ArrowDownIcon, ArrowRightIcon, TableRowsIcon, AlignTopBoxIcon, AlignLeftBoxIcon, StatsReportIcon,
@@ -147,6 +149,7 @@ export default {
AddEventDialog,
AddLinkDialog,
AddDownloadDialog,
+ AddContactDialog,
OpenInWindowIcon,
DownloadIcon,
},
@@ -160,6 +163,7 @@ export default {
const addEventDialog = ref(null);
const addLinkDialog = ref(null);
const addDownloadDialog = ref(null);
+ const addContactDialog = ref(null);
const colorPicker = ref(null);
const editor = useEditor({
@@ -318,6 +322,16 @@ export default {
}
};
+ const openAddContactDialog = () => {
+ addContactDialog.value.openAddContactDialog();
+ };
+
+ const insertContact = (configString) => {
+ if (editor.value) {
+ editor.value.chain().focus().insertContent(configString).run();
+ }
+ };
+
const openColorPicker = () => {
colorPicker.value.click();
};
@@ -361,6 +375,38 @@ export default {
editor.value.chain().focus().toggleOrderedList().run();
};
+ const addColumnBefore = () => {
+ editor.value.chain().focus().addColumnBefore().run();
+ };
+
+ const addColumnAfter = () => {
+ editor.value.chain().focus().addColumnAfter().run();
+ };
+
+ const addRowBefore = () => {
+ editor.value.chain().focus().addRowBefore().run();
+ };
+
+ const addRowAfter = () => {
+ editor.value.chain().focus().addRowAfter().run();
+ };
+
+ const deleteColumn = () => {
+ editor.value.chain().focus().deleteColumn().run();
+ };
+
+ const deleteRow = () => {
+ editor.value.chain().focus().deleteRow().run();
+ };
+
+ const toggleHeaderColumn = () => {
+ editor.value.chain().focus().toggleHeaderColumn().run();
+ };
+
+ const toggleHeaderRow = () => {
+ editor.value.chain().focus().toggleHeaderRow().run();
+ };
+
return {
pages,
sortedPages,
@@ -384,6 +430,9 @@ export default {
addDownloadDialog,
openAddDownloadDialog,
insertDownload,
+ addContactDialog,
+ openAddContactDialog,
+ insertContact,
colorPicker,
openColorPicker,
setColor,
@@ -395,6 +444,14 @@ export default {
insertTable,
toggleBulletList,
toggleOrderedList,
+ addColumnBefore,
+ addColumnAfter,
+ addRowBefore,
+ addRowAfter,
+ deleteColumn,
+ deleteRow,
+ toggleHeaderColumn,
+ toggleHeaderRow,
};
},
};