import { defineComponent, ref, computed, reactive, unref, useSSRContext } from "vue"; import { ssrRenderAttrs, ssrInterpolate, ssrRenderClass, ssrRenderList, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseEqual, ssrLooseContain } from "vue/server-renderer"; import { u as useRegionStore } from "./region-0mvXqaMM.js"; import { u as useFormatter } from "./useFormatter-hycy3urM.js"; import "/app/node_modules/hookable/dist/index.mjs"; import "/app/node_modules/klona/dist/index.mjs"; import "../server.mjs"; import "pinia"; 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 "/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: "index", __ssrInlineRender: true, setup(__props) { const regionStore = useRegionStore(); const { formatCurrency } = useFormatter(); const tabs = [ { key: "basic", label: "📋 Basic Info" }, { key: "pricing", label: "💰 Pricing" }, { key: "features", label: "⚡ Features" } ]; const activeTab = ref("basic"); const activeTabLabel = computed(() => { const tab = tabs.find((t) => t.key === activeTab.value); return tab ? tab.label : ""; }); const listTab = ref("base"); const basePackages = computed(() => packages.value.filter((p) => p.rules?.type !== "addon")); const addonPackages = computed(() => packages.value.filter((p) => p.rules?.type === "addon")); const packages = ref([]); const loading = ref(true); const error = ref(null); const showModal = ref(false); const showDeleteConfirm = ref(false); const editingPackage = ref(null); const deletingPackage = ref(null); const isCreating = ref(false); const saving = ref(false); const saveNotification = ref(null); const featureCapabilitiesError = ref(null); const selectedAddZoneCode = ref(""); const availableRegionsToAdd = computed(() => { return regionStore.regions.filter((r) => { return r.country_code !== "DEFAULT" && !form.pricing_zones[r.country_code]; }); }); const calcNetPrice = ref(0); const calcVatRate = ref(27); const calcCurrency = ref("EUR"); const defaultForm = { name: "", display_name: "", type: "private", tier_level: 0, monthly_price: 0, yearly_price: 0, currency: "EUR", max_vehicles: 1, max_garages: 1, max_users: 1, monthly_free_credits: 0, max_cost_category_depth: 3, advanced_reports: false, export_data: false, subtitle: "", badge: "", is_custom: false, is_default_fallback: false, trial_days_on_signup: 0, feature_capabilities_json: '{\n "ai_analysis": false,\n "priority_support": false,\n "api_access": false\n}', pricing_zones: {} }; const form = reactive({ ...defaultForm }); function getZonePrice(countryCode, period) { const zone = form.pricing_zones[countryCode]; if (!zone) return 0; return period === "monthly" ? zone.monthly_price : zone.yearly_price; } function getZoneCreditPrice(countryCode) { const zone = form.pricing_zones[countryCode]; if (!zone) return 0; return zone.credit_price ?? 0; } function getZoneCurrency(countryCode) { const zone = form.pricing_zones[countryCode]; if (!zone) return "EUR"; return zone.currency; } function getDisplayName(pkg) { return pkg.rules?.display_name || pkg.name; } function getDescription(pkg) { return pkg.rules?.marketing?.subtitle || pkg.rules?.marketing?.badge || ""; } function getFormattedPrice(pkg) { const zones = pkg.rules?.pricing_zones; const pricing = pkg.rules?.pricing; if (zones && zones["DEFAULT"]) { const p = zones["DEFAULT"]; const currency = p.currency === "HUF" ? "Ft" : "€"; return `${p.monthly_price} ${currency}`; } if (pricing) { const currency = pricing.currency === "HUF" ? "Ft" : "€"; return `${pricing.monthly_price} ${currency}`; } return "—"; } function getAllowance(pkg, key) { const allowances = pkg.rules?.allowances; if (!allowances) return "—"; return allowances[key] ?? "—"; } function getTierColorClass(level) { if (level >= 2) return "bg-purple-500/10 text-purple-400"; if (level >= 1) return "bg-amber-500/10 text-amber-400"; return "bg-slate-500/10 text-slate-400"; } function getTierIcon(level) { if (level >= 2) return "🏢"; if (level >= 1) return "⭐"; return "🔓"; } return (_ctx, _push, _parent, _attrs) => { _push(`

${ssrInterpolate(_ctx.$t("packages.title"))}

${ssrInterpolate(_ctx.$t("packages.subtitle"))}

`); if (loading.value) { _push(`
${ssrInterpolate(_ctx.$t("packages.loading"))}
`); } else if (error.value) { _push(`

${ssrInterpolate(error.value)}

`); } else if (packages.value.length === 0) { _push(`

${ssrInterpolate(_ctx.$t("packages.no_packages"))}

${ssrInterpolate(_ctx.$t("packages.no_packages_desc"))}

`); } else { _push(`
`); ssrRenderList(listTab.value === "base" ? basePackages.value : addonPackages.value, (pkg) => { _push(`
${getTierIcon(pkg.tier_level) ?? ""}

${ssrInterpolate(getDisplayName(pkg))}

${ssrInterpolate(pkg.name)}
`); if (pkg.tier_level >= 1) { _push(`${ssrInterpolate(_ctx.$t("packages.popular"))}`); } else { _push(``); } if (pkg.is_default_fallback) { _push(` 🔒 ${ssrInterpolate(_ctx.$t("packages.fallback_badge"))}`); } else { _push(``); } if (pkg.trial_days_on_signup > 0) { _push(` 🎯 ${ssrInterpolate(_ctx.$t("packages.trial_badge"))}: ${ssrInterpolate(pkg.trial_days_on_signup)}d `); } else { _push(``); } _push(`
${ssrInterpolate(getFormattedPrice(pkg))}/ ${ssrInterpolate(_ctx.$t("packages.month"))}

${ssrInterpolate(getDescription(pkg))}

${ssrInterpolate(_ctx.$t("packages.allowances"))}

${ssrInterpolate(_ctx.$t("packages.max_vehicles"))}${ssrInterpolate(getAllowance(pkg, "max_vehicles"))}
${ssrInterpolate(_ctx.$t("packages.max_garages"))}${ssrInterpolate(getAllowance(pkg, "max_garages"))}
${ssrInterpolate(_ctx.$t("packages.max_users"))}${ssrInterpolate(getAllowance(pkg, "max_users"))}
${ssrInterpolate(_ctx.$t("packages.monthly_credits"))}${ssrInterpolate(getAllowance(pkg, "monthly_free_credits"))}
${ssrInterpolate(_ctx.$t("packages.tier_level"))}: ${ssrInterpolate(pkg.tier_level)}
`); }); _push(`
`); } if (showModal.value) { _push(`

${ssrInterpolate(isCreating.value ? _ctx.$t("packages.create_title") : _ctx.$t("packages.edit_title") + ": " + getDisplayName(editingPackage.value))}

`); ssrRenderList(tabs, (tab) => { _push(``); }); _push(`
`); if (activeTab.value === "basic") { _push(`
`); if (form.type !== "addon") { _push(`

${ssrInterpolate(_ctx.$t("packages.form_tier_level_hint"))}

`); } else { _push(``); } if (form.type !== "addon") { _push(`
`); } else { _push(``); } _push(`
`); if (form.type !== "addon") { _push(`

${ssrInterpolate(_ctx.$t("packages.singleton_rules"))}

${ssrInterpolate(_ctx.$t("packages.form_trial_days_hint"))}

`); } else { _push(``); } _push(`
`); } else { _push(``); } if (activeTab.value === "pricing") { _push(`

${ssrInterpolate(_ctx.$t("packages.per_region_pricing"))}

`); ssrRenderList(unref(regionStore).regions, (region) => { _push(``); }); _push(`
Region${ssrInterpolate(_ctx.$t("packages.form_monthly_price"))}${ssrInterpolate(_ctx.$t("packages.form_yearly_price"))}Kredit Ár${ssrInterpolate(_ctx.$t("packages.form_currency"))}
${ssrInterpolate(region.country_code)}(${ssrInterpolate(region.currency)}, ${ssrInterpolate(region.default_vat_rate)}% VAT)
${ssrInterpolate(_ctx.$t("packages.add_zone"))}

🧮 ${ssrInterpolate(_ctx.$t("packages.smart_calculator"))}

${ssrInterpolate(_ctx.$t("packages.calc_net"))}

${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value, calcCurrency.value))}

${ssrInterpolate(_ctx.$t("packages.calc_vat"))} (${ssrInterpolate(calcVatRate.value)}%)

${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value * (calcVatRate.value / 100), calcCurrency.value))}

${ssrInterpolate(_ctx.$t("packages.calc_gross"))}

${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value * (1 + calcVatRate.value / 100), calcCurrency.value))}

`); } else { _push(``); } if (activeTab.value === "features") { _push(`

${ssrInterpolate(_ctx.$t("packages.allowances"))}

SaaS Allowances

${ssrInterpolate(_ctx.$t("packages.feature_capabilities"))}

${ssrInterpolate(_ctx.$t("packages.feature_capabilities_hint"))}

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

${ssrInterpolate(featureCapabilitiesError.value)}

`); } else { _push(``); } _push(`
`); } else { _push(``); } _push(`
${ssrInterpolate(activeTabLabel.value)}
`); if (saving.value) { _push(``); } else { _push(``); } _push(` ${ssrInterpolate(isCreating.value ? _ctx.$t("packages.create") : _ctx.$t("packages.save"))}
`); } else { _push(``); } if (showDeleteConfirm.value && deletingPackage.value) { _push(`

${ssrInterpolate(_ctx.$t("packages.delete_title"))}

${ssrInterpolate(_ctx.$t("packages.delete_confirm", { name: getDisplayName(deletingPackage.value) }))}

${ssrInterpolate(_ctx.$t("packages.delete_btn"))}
`); } else { _push(``); } if (saveNotification.value) { _push(`
${ssrInterpolate(saveNotification.value.message)}
`); } 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/packages/index.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=index-B9tmK_Km.js.map