feat(events): add tag selector to admin event form

This commit is contained in:
Jennie Robinson Faber 2026-04-09 22:38:20 +01:00
parent 3797ff7925
commit 337664790f
2 changed files with 37 additions and 6 deletions

View file

@ -232,6 +232,26 @@
</div>
</div>
<!-- Tags -->
<div class="form-section">
<h2 class="section-heading">Tags</h2>
<div class="field">
<label>Event Tags</label>
<USelectMenu
v-model="eventForm.tags"
:items="tagOptions"
value-key="value"
multiple
placeholder="Select tags..."
class="w-full"
/>
<p class="help-text">
Tag this event to help with discovery and recommendations
</p>
</div>
</div>
<!-- Ticketing -->
<div class="form-section">
<h2 class="section-heading">Ticketing</h2>
@ -584,6 +604,11 @@ const formErrors = ref([]);
const fieldErrors = ref({});
const selectedSeriesId = ref(null);
const availableSeries = ref([]);
const availableTags = ref([]);
const tagOptions = computed(() =>
availableTags.value.map((t) => ({ label: t.label, value: t.slug }))
);
const eventForm = reactive({
title: "",
@ -599,6 +624,7 @@ const eventForm = reactive({
isCancelled: false,
cancellationMessage: "",
targetCircles: [],
tags: [],
maxAttendees: "",
registrationRequired: false,
registrationDeadline: "",
@ -632,15 +658,17 @@ const removeAgendaItem = (index) => {
eventForm.agenda.splice(index, 1);
};
// Load available series
// Load available series and tags
onMounted(async () => {
try {
const response = await $fetch("/api/admin/series");
console.log("Loaded series:", response);
availableSeries.value = response;
console.log("availableSeries.value:", availableSeries.value);
const [seriesResponse, tagsResponse] = await Promise.all([
$fetch("/api/admin/series"),
$fetch("/api/tags"),
]);
availableSeries.value = seriesResponse;
availableTags.value = tagsResponse.tags || [];
} catch (error) {
console.error("Failed to load series:", error);
console.error("Failed to load form data:", error);
}
});
@ -692,6 +720,7 @@ if (route.query.edit) {
isCancelled: event.isCancelled || false,
cancellationMessage: event.cancellationMessage || "",
targetCircles: event.targetCircles || [],
tags: event.tags || [],
maxAttendees: event.maxAttendees || "",
registrationRequired: event.registrationRequired,
registrationDeadline: event.registrationDeadline
@ -912,6 +941,7 @@ const saveAndCreateAnother = async () => {
isCancelled: false,
cancellationMessage: "",
targetCircles: [],
tags: [],
maxAttendees: "",
registrationRequired: false,
registrationDeadline: "",

View file

@ -142,6 +142,7 @@ const eventSchema = new mongoose.Schema({
maxAttendees: Number,
registrationRequired: { type: Boolean, default: false },
registrationDeadline: Date,
tags: [String], // Tag slugs from Tag collection
agenda: [String],
speakers: [
{