import { defineComponent, ref, reactive, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain } from 'vue/server-renderer'; import { a as useI18n } from './server.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 'vue-router'; import 'node:url'; import 'pinia'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'unhead/plugins'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "seasons", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const loading = ref(true); const error = ref(false); const saving = ref(false); const showModal = ref(false); const showActivateModal = ref(false); const seasons = ref([]); const editingSeason = ref(null); const activatingSeason = ref(null); const formError = ref(""); const form = reactive({ name: "", start_date: "", end_date: "", is_active: false }); function formatDate(dateStr) { if (!dateStr) return ""; const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "long", day: "numeric" }); } function formatDateTime(dateStr) { if (!dateStr) return ""; const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }); } return (_ctx, _push, _parent, _attrs) => { var _a; _push(`

${ssrInterpolate(unref(t)("gamification.seasons.title"))}

${ssrInterpolate(unref(t)("gamification.seasons.subtitle"))}

`); if (unref(loading)) { _push(`
${ssrInterpolate(unref(t)("gamification.seasons.loading"))}
`); } else if (unref(error)) { _push(`

${ssrInterpolate(unref(t)("gamification.seasons.load_error"))}

`); } else { _push(``); if (unref(seasons).length === 0) { _push(`

${ssrInterpolate(unref(t)("gamification.seasons.empty"))}

`); } else { _push(`
`); ssrRenderList(unref(seasons), (season) => { _push(`

${ssrInterpolate(season.name)}

${ssrInterpolate(season.is_active ? unref(t)("gamification.seasons.active") : unref(t)("gamification.seasons.inactive"))}
${ssrInterpolate(formatDate(season.start_date))} \u2192 ${ssrInterpolate(formatDate(season.end_date))}
${ssrInterpolate(unref(t)("gamification.seasons.created_at"))} ${ssrInterpolate(formatDateTime(season.created_at))}
`); if (!season.is_active) { _push(``); } else { _push(``); } _push(`
`); }); _push(`
`); } _push(``); } if (unref(showModal)) { _push(`

${ssrInterpolate(unref(editingSeason) ? unref(t)("gamification.seasons.edit_title") : unref(t)("gamification.seasons.create_title"))}

`); if (!unref(editingSeason)) { _push(`
`); } else { _push(``); } if (unref(formError)) { _push(`

${ssrInterpolate(unref(formError))}

`); } else { _push(``); } _push(`
`); } else { _push(``); } if (unref(showActivateModal)) { _push(`

${ssrInterpolate(unref(t)("gamification.seasons.activate_title"))}

${ssrInterpolate(unref(t)("gamification.seasons.activate_confirm", { name: (_a = unref(activatingSeason)) == null ? void 0 : _a.name }))}

${ssrInterpolate(unref(saving) ? unref(t)("gamification.seasons.activating") : unref(t)("gamification.seasons.activate"))}
`); } else { _push(``); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/gamification/seasons.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=seasons-B_EJxQ8K.mjs.map