Files
harheimertc/.output/server/chunks/build/termine-TZyY9Wk0.mjs
2025-10-21 16:00:53 +02:00

124 lines
9.1 KiB
JavaScript

import { ref, mergeProps, unref, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderComponent, ssrRenderList, ssrInterpolate, ssrRenderClass, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual } from 'vue/server-renderer';
import { Plus, Loader2, Trash2, AlertCircle } from 'lucide-vue-next';
import { u as useAuthStore } from './server.mjs';
import { u as useHead } from './composables-CK-Mp9jS.mjs';
import '../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'pinia';
import 'vue-router';
const _sfc_main = {
__name: "termine",
__ssrInlineRender: true,
setup(__props) {
useAuthStore();
const isLoading = ref(true);
const isSaving = ref(false);
const termine = ref([]);
const showModal = ref(false);
const errorMessage = ref("");
const formData = ref({
datum: "",
titel: "",
beschreibung: "",
kategorie: "Sonstiges"
});
const formatDate = (dateString) => {
if (!dateString) return "";
const date = new Date(dateString);
return date.toLocaleDateString("de-DE", {
year: "numeric",
month: "2-digit",
day: "2-digit"
});
};
useHead({
title: "Termine verwalten - Harheimer TC"
});
return (_ctx, _push, _parent, _attrs) => {
_push(`<div${ssrRenderAttrs(mergeProps({ class: "min-h-full py-16 bg-gray-50" }, _attrs))}><div class="max-w-6xl mx-auto px-4 sm:px-6 lg:px-8"><div class="flex justify-between items-center mb-6"><div><h1 class="text-4xl sm:text-5xl font-display font-bold text-gray-900 mb-2"> Termine verwalten </h1><div class="w-24 h-1 bg-primary-600 mb-4"></div></div><button class="flex items-center px-4 py-2 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors">`);
_push(ssrRenderComponent(unref(Plus), {
size: 20,
class: "mr-2"
}, null, _parent));
_push(` Termin hinzufügen </button></div>`);
if (isLoading.value) {
_push(`<div class="flex items-center justify-center py-12">`);
_push(ssrRenderComponent(unref(Loader2), {
size: 40,
class: "animate-spin text-primary-600"
}, null, _parent));
_push(`</div>`);
} else {
_push(`<div class="bg-white rounded-xl shadow-lg overflow-hidden"><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Datum</th><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Titel</th><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Beschreibung</th><th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Kategorie</th><th class="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Aktionen</th></tr></thead><tbody class="bg-white divide-y divide-gray-200"><!--[-->`);
ssrRenderList(termine.value, (termin) => {
_push(`<tr class="hover:bg-gray-50"><td class="px-4 py-3 whitespace-nowrap text-sm text-gray-900">${ssrInterpolate(formatDate(termin.datum))}</td><td class="px-4 py-3 text-sm font-medium text-gray-900">${ssrInterpolate(termin.titel)}</td><td class="px-4 py-3 text-sm text-gray-600">${ssrInterpolate(termin.beschreibung || "-")}</td><td class="px-4 py-3 whitespace-nowrap"><span class="${ssrRenderClass([{
"bg-blue-100 text-blue-800": termin.kategorie === "Training",
"bg-green-100 text-green-800": termin.kategorie === "Punktspiel",
"bg-purple-100 text-purple-800": termin.kategorie === "Turnier",
"bg-yellow-100 text-yellow-800": termin.kategorie === "Veranstaltung",
"bg-gray-100 text-gray-800": termin.kategorie === "Sonstiges"
}, "px-2 py-1 text-xs font-medium rounded-full"])}">${ssrInterpolate(termin.kategorie)}</span></td><td class="px-4 py-3 whitespace-nowrap text-right text-sm font-medium"><button class="text-red-600 hover:text-red-900" title="Löschen">`);
_push(ssrRenderComponent(unref(Trash2), { size: 18 }, null, _parent));
_push(`</button></td></tr>`);
});
_push(`<!--]--></tbody></table></div>`);
if (termine.value.length === 0) {
_push(`<div class="text-center py-12 text-gray-500"> Keine Termine vorhanden. </div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
}
if (showModal.value) {
_push(`<div class="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4"><div class="bg-white rounded-xl shadow-2xl max-w-2xl w-full p-8"><h2 class="text-2xl font-display font-bold text-gray-900 mb-6"> Termin hinzufügen </h2><form class="space-y-4"><div class="grid grid-cols-2 gap-4"><div><label class="block text-sm font-medium text-gray-700 mb-2">Datum *</label><input${ssrRenderAttr("value", formData.value.datum)} type="date" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Kategorie *</label><select required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}><option value="Training"${ssrIncludeBooleanAttr(Array.isArray(formData.value.kategorie) ? ssrLooseContain(formData.value.kategorie, "Training") : ssrLooseEqual(formData.value.kategorie, "Training")) ? " selected" : ""}>Training</option><option value="Punktspiel"${ssrIncludeBooleanAttr(Array.isArray(formData.value.kategorie) ? ssrLooseContain(formData.value.kategorie, "Punktspiel") : ssrLooseEqual(formData.value.kategorie, "Punktspiel")) ? " selected" : ""}>Punktspiel</option><option value="Turnier"${ssrIncludeBooleanAttr(Array.isArray(formData.value.kategorie) ? ssrLooseContain(formData.value.kategorie, "Turnier") : ssrLooseEqual(formData.value.kategorie, "Turnier")) ? " selected" : ""}>Turnier</option><option value="Veranstaltung"${ssrIncludeBooleanAttr(Array.isArray(formData.value.kategorie) ? ssrLooseContain(formData.value.kategorie, "Veranstaltung") : ssrLooseEqual(formData.value.kategorie, "Veranstaltung")) ? " selected" : ""}>Veranstaltung</option><option value="Sonstiges"${ssrIncludeBooleanAttr(Array.isArray(formData.value.kategorie) ? ssrLooseContain(formData.value.kategorie, "Sonstiges") : ssrLooseEqual(formData.value.kategorie, "Sonstiges")) ? " selected" : ""}>Sonstiges</option></select></div></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Titel *</label><input${ssrRenderAttr("value", formData.value.titel)} type="text" required class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}></div><div><label class="block text-sm font-medium text-gray-700 mb-2">Beschreibung</label><textarea rows="3" class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}>${ssrInterpolate(formData.value.beschreibung)}</textarea></div>`);
if (errorMessage.value) {
_push(`<div class="flex items-center p-3 rounded-md bg-red-50 text-red-700 text-sm">`);
_push(ssrRenderComponent(unref(AlertCircle), {
size: 20,
class: "mr-2"
}, null, _parent));
_push(` ${ssrInterpolate(errorMessage.value)}</div>`);
} else {
_push(`<!---->`);
}
_push(`<div class="flex justify-end space-x-4 pt-4"><button type="button" class="px-6 py-2 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}> Abbrechen </button><button type="submit" class="px-6 py-2 bg-primary-600 hover:bg-primary-700 text-white font-semibold rounded-lg transition-colors flex items-center"${ssrIncludeBooleanAttr(isSaving.value) ? " disabled" : ""}>`);
if (isSaving.value) {
_push(ssrRenderComponent(unref(Loader2), {
size: 20,
class: "animate-spin mr-2"
}, null, _parent));
} else {
_push(`<!---->`);
}
_push(`<span>${ssrInterpolate(isSaving.value ? "Speichert..." : "Speichern")}</span></button></div></form></div></div>`);
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
};
}
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/cms/termine.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=termine-TZyY9Wk0.mjs.map