import { defineComponent, ref, reactive, computed, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrRenderList, ssrRenderClass, ssrIncludeBooleanAttr } from 'vue/server-renderer'; import { a as useI18n } from './server.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.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: "ledger", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const loading = ref(true); const error = ref(false); const entries = ref([]); const total = ref(0); const offset = ref(0); const limit = ref(50); const toast = ref(""); const filters = reactive({ user_id: null, date_from: "", date_to: "", reason_search: "" }); const currentPage = computed(() => Math.floor(offset.value / limit.value) + 1); const totalPages = computed(() => Math.max(1, Math.ceil(total.value / limit.value))); function formatDate(dateStr) { if (!dateStr) return "\u2014"; const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); } return (_ctx, _push, _parent, _attrs) => { _push(`

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

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

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

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

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

${ssrInterpolate(unref(t)("gamification.ledger.no_results"))}

${ssrInterpolate(unref(t)("gamification.ledger.no_results_hint"))}

`); } else { _push(`
`); ssrRenderList(unref(entries), (entry) => { _push(``); }); _push(`
${ssrInterpolate(unref(t)("gamification.ledger.col_id"))}${ssrInterpolate(unref(t)("gamification.ledger.col_user"))}${ssrInterpolate(unref(t)("gamification.ledger.col_points"))}${ssrInterpolate(unref(t)("gamification.ledger.col_penalty"))}${ssrInterpolate(unref(t)("gamification.ledger.col_xp"))}${ssrInterpolate(unref(t)("gamification.ledger.col_reason"))}${ssrInterpolate(unref(t)("gamification.ledger.col_source"))}${ssrInterpolate(unref(t)("gamification.ledger.col_date"))}
${ssrInterpolate(entry.id)}
${ssrInterpolate(entry.user_name)}#${ssrInterpolate(entry.user_id)}
${ssrInterpolate(entry.points > 0 ? "+" : "")}${ssrInterpolate(entry.points)}`); if (entry.penalty_change) { _push(` +${ssrInterpolate(entry.penalty_change)}`); } else { _push(`\u2014`); } _push(``); if (entry.xp) { _push(`${ssrInterpolate(entry.xp)}`); } else { _push(`\u2014`); } _push(`

${ssrInterpolate(entry.reason)}

`); if (entry.source_type) { _push(`
${ssrInterpolate(entry.source_type)}`); if (entry.source_id) { _push(`#${ssrInterpolate(entry.source_id)}`); } else { _push(``); } _push(`
`); } else { _push(`\u2014`); } _push(`
${ssrInterpolate(formatDate(entry.created_at))}

${ssrInterpolate(unref(total))} ${ssrInterpolate(unref(t)("gamification.ledger.total_results"))} ${ssrInterpolate(unref(entries).length)} ${ssrInterpolate(unref(t)("gamification.ledger.shown"))} `); if (unref(filters).user_id || unref(filters).date_from || unref(filters).date_to || unref(filters).reason_search) { _push(` (${ssrInterpolate(unref(t)("gamification.ledger.filtered"))}) `); } else { _push(``); } _push(`

${ssrInterpolate(unref(t)("gamification.ledger.prev"))}${ssrInterpolate(unref(currentPage))} / ${ssrInterpolate(unref(totalPages))}= unref(total)) ? " disabled" : ""} class="${ssrRenderClass([unref(offset) + unref(limit) >= unref(total) ? "text-slate-600" : "text-slate-300 hover:bg-slate-700 hover:text-white", "px-3 py-1.5 rounded-lg text-sm font-medium transition disabled:opacity-30 disabled:cursor-not-allowed"])}" data-v-46ba4a43>${ssrInterpolate(unref(t)("gamification.ledger.next"))}
`); } _push(``); } if (unref(toast)) { _push(`
${ssrInterpolate(unref(toast))}
`); } 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/ledger.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const ledger = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-46ba4a43"]]); export { ledger as default }; //# sourceMappingURL=ledger-CkE6BXLf.mjs.map