import { defineComponent, ref, reactive, unref, useSSRContext } from "vue"; import { ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderClass } from "vue/server-renderer"; import "/app/node_modules/hookable/dist/index.mjs"; import "/app/node_modules/klona/dist/index.mjs"; import { a as useI18n } from "../server.mjs"; import "/app/node_modules/ofetch/dist/node.mjs"; import "#internal/nuxt/paths"; import "/app/node_modules/unctx/dist/index.mjs"; import "/app/node_modules/h3/dist/index.mjs"; import "pinia"; import "/app/node_modules/defu/dist/defu.mjs"; import "vue-router"; import "/app/node_modules/ufo/dist/index.mjs"; import "/app/node_modules/cookie-es/dist/index.mjs"; import "/app/node_modules/destr/dist/index.mjs"; import "/app/node_modules/ohash/dist/index.mjs"; import "/app/node_modules/@unhead/vue/dist/index.mjs"; import "@vue/devtools-api"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "competitions", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const loading = ref(true); const error = ref(false); const saving = ref(false); const showModal = ref(false); const seasons = ref([]); const competitions = ref([]); const editingCompetition = ref(null); const selectedSeasonId = ref(null); const formError = ref(""); const rulesParseError = ref(false); const form = reactive({ name: "", description: "", season_id: "", start_date: "", end_date: "", status: "draft", rulesJson: "" }); function formatDate(dateStr) { if (!dateStr) return ""; const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "long", day: "numeric" }); } function getStatusClass(status) { switch (status) { case "active": return "bg-emerald-500/10 text-emerald-400 border border-emerald-500/30"; case "draft": return "bg-slate-700 text-slate-400 border border-slate-600"; case "completed": return "bg-blue-500/10 text-blue-400 border border-blue-500/30"; case "cancelled": return "bg-rose-500/10 text-rose-400 border border-rose-500/30"; default: return "bg-slate-700 text-slate-400 border border-slate-600"; } } function getStatusLabel(status) { switch (status) { case "active": return t("gamification.competitions.status_active"); case "draft": return t("gamification.competitions.status_draft"); case "completed": return t("gamification.competitions.status_completed"); case "cancelled": return t("gamification.competitions.status_cancelled"); default: return status; } } return (_ctx, _push, _parent, _attrs) => { _push(`

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

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

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

${ssrInterpolate(unref(t)("gamification.competitions.error"))}

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

${ssrInterpolate(unref(t)("gamification.competitions.no_items"))}

`); } else { _push(`
`); ssrRenderList(unref(competitions), (comp) => { _push(`

${ssrInterpolate(comp.name)}

`); if (comp.description) { _push(`

${ssrInterpolate(comp.description)}

`); } else { _push(``); } _push(`
${ssrInterpolate(getStatusLabel(comp.status))}
${ssrInterpolate(formatDate(comp.start_date))} → ${ssrInterpolate(formatDate(comp.end_date))}
${ssrInterpolate(unref(t)("gamification.competitions.season_id_label"))} ${ssrInterpolate(comp.season_id)}
`); if (comp.rules && Object.keys(comp.rules).length > 0) { _push(`
${ssrInterpolate(unref(t)("gamification.competitions.view_rules"))}
${ssrInterpolate(JSON.stringify(comp.rules, null, 2))}
`); } else { _push(``); } _push(`
`); }); _push(`
`); } _push(``); } if (unref(showModal)) { _push(`

${ssrInterpolate(unref(editingCompetition) ? unref(t)("gamification.competitions.edit_title") : unref(t)("gamification.competitions.create_title"))}

`); if (unref(rulesParseError)) { _push(`

${ssrInterpolate(unref(t)("gamification.competitions.invalid_json"))}

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

${ssrInterpolate(unref(formError))}

`); } else { _push(``); } _push(`
`); } 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/competitions.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=competitions-1WDTeHdG.js.map