import { defineComponent, ref, reactive, unref, useSSRContext } from "vue"; import { ssrRenderAttrs, ssrInterpolate, ssrRenderList, ssrRenderAttr, ssrRenderClass, ssrIncludeBooleanAttr, ssrLooseContain } 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 { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js"; 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: "point-rules", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const loading = ref(true); const error = ref(false); const rules = ref([]); const showModal = ref(false); const showDeleteModal = ref(false); const editingRule = ref(null); const deletingRule = ref(null); const saving = ref(false); const formError = ref(""); const toast = ref(""); const editingCell = ref(null); const editValue = ref(""); ref(null); ref(false); const form = reactive({ action_key: "", points: 0, description: "", is_active: true }); function isEditing(ruleId, field) { return editingCell.value?.id === ruleId && editingCell.value?.field === field; } return (_ctx, _push, _parent, _attrs) => { _push(`

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

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

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

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

`); } else { _push(`
`); ssrRenderList(rules.value, (rule) => { _push(``); }); _push(``); if (rules.value.length === 0) { _push(``); } else { _push(``); } _push(`
${ssrInterpolate(unref(t)("gamification.point_rules.id"))}${ssrInterpolate(unref(t)("gamification.point_rules.action_key"))}${ssrInterpolate(unref(t)("gamification.point_rules.points"))}${ssrInterpolate(unref(t)("gamification.point_rules.description"))}${ssrInterpolate(unref(t)("gamification.point_rules.status"))}${ssrInterpolate(unref(t)("gamification.point_rules.actions"))}
${ssrInterpolate(rule.id)}`); if (isEditing(rule.id, "action_key")) { _push(``); } else { _push(`${ssrInterpolate(rule.action_key)}`); } _push(``); if (isEditing(rule.id, "points")) { _push(``); } else { _push(`${ssrInterpolate(rule.points >= 0 ? "+" : "")}${ssrInterpolate(rule.points)}`); } _push(``); if (isEditing(rule.id, "description")) { _push(``); } else { _push(`${ssrInterpolate(rule.description || "—")}`); } _push(``); if (isEditing(rule.id, "is_active")) { _push(`
`); } else { _push(`${ssrInterpolate(rule.is_active ? unref(t)("gamification.point_rules.active") : unref(t)("gamification.point_rules.inactive"))}`); } _push(`
${ssrInterpolate(unref(t)("gamification.point_rules.no_items"))}
`); } if (showModal.value) { _push(`

${ssrInterpolate(editingRule.value ? unref(t)("gamification.point_rules.edit_title") : unref(t)("gamification.point_rules.create_title"))}

`); if (formError.value) { _push(`

${ssrInterpolate(formError.value)}

`); } else { _push(``); } _push(`
`); } else { _push(``); } if (showDeleteModal.value) { _push(`

${ssrInterpolate(unref(t)("gamification.point_rules.delete_title"))}

${ssrInterpolate(unref(t)("gamification.point_rules.delete_confirm", { name: deletingRule.value?.action_key }))}

${ssrInterpolate(saving.value ? unref(t)("gamification.point_rules.deleting") : unref(t)("gamification.point_rules.delete"))}
`); } else { _push(``); } if (toast.value) { _push(`
${ssrInterpolate(toast.value)}
`); } 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/point-rules.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const pointRules = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-f21993c6"]]); export { pointRules as default }; //# sourceMappingURL=point-rules-tyImSuJC.js.map