Files
service-finder/frontend_admin/.nuxt/dist/server/_nuxt/index-CmqjFfry.js
2026-06-29 14:11:15 +00:00

363 lines
40 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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 "/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";
function useFormatter() {
const regionStore = useRegionStore();
function formatNumber(value, options) {
const locale = regionStore.activeLocale || "en-EU";
try {
return new Intl.NumberFormat(locale, options).format(value);
} catch {
return new Intl.NumberFormat("en-EU", options).format(value);
}
}
function formatCurrency(value, currency, options) {
const locale = regionStore.activeLocale || "en-EU";
const curr = currency || regionStore.activeCurrency || "EUR";
try {
return new Intl.NumberFormat(locale, {
style: "currency",
currency: curr,
minimumFractionDigits: 2,
maximumFractionDigits: 2,
...options
}).format(value);
} catch {
return `${value.toFixed(2)} ${curr}`;
}
}
function formatDate(date, options) {
const locale = regionStore.activeLocale || "en-EU";
const timezone = regionStore.activeTimezone || "Europe/Brussels";
const d = typeof date === "string" || typeof date === "number" ? new Date(date) : date;
try {
return new Intl.DateTimeFormat(locale, {
timezone,
year: "numeric",
month: "2-digit",
day: "2-digit",
...options
}).format(d);
} catch {
return d.toLocaleDateString("en-GB");
}
}
function formatDateTime(date, options) {
const locale = regionStore.activeLocale || "en-EU";
const timezone = regionStore.activeTimezone || "Europe/Brussels";
const d = typeof date === "string" || typeof date === "number" ? new Date(date) : date;
try {
return new Intl.DateTimeFormat(locale, {
timezone,
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
...options
}).format(d);
} catch {
return d.toLocaleString("en-GB");
}
}
function formatPercent(value, options) {
const locale = regionStore.activeLocale || "en-EU";
try {
return new Intl.NumberFormat(locale, {
style: "percent",
minimumFractionDigits: 0,
maximumFractionDigits: 1,
...options
}).format(value / 100);
} catch {
return `${value}%`;
}
}
function calculatePriceWithVat(netPrice, vatRate) {
const rate = vatRate ?? regionStore.activeVatRate ?? 0;
const vat = netPrice * (rate / 100);
const gross = netPrice + vat;
return { net: netPrice, vat, gross, vatRate: rate };
}
function formatPriceWithVat(netPrice, vatRate, currency) {
const { net, vat, gross, vatRate: rate } = calculatePriceWithVat(netPrice, vatRate);
const curr = currency || regionStore.activeCurrency || "EUR";
return `Net: ${formatCurrency(net, curr)} | VAT: ${formatCurrency(vat, curr)} (${rate}%) | Gross: ${formatCurrency(gross, curr)}`;
}
return {
formatNumber,
formatCurrency,
formatDate,
formatDateTime,
formatPercent,
calculatePriceWithVat,
formatPriceWithVat
};
}
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(`<div${ssrRenderAttrs(_attrs)}><div class="mb-8 flex items-center justify-between"><div><h1 class="text-2xl font-bold text-white">${ssrInterpolate(_ctx.$t("packages.title"))}</h1><p class="text-slate-400 mt-1">${ssrInterpolate(_ctx.$t("packages.subtitle"))}</p></div><button class="px-5 py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition text-sm flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg> ${ssrInterpolate(_ctx.$t("packages.create_new"))}</button></div>`);
if (loading.value) {
_push(`<div class="flex items-center justify-center py-20"><div class="flex flex-col items-center gap-3"><svg class="animate-spin h-8 w-8 text-indigo-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg><span class="text-slate-400 text-sm">${ssrInterpolate(_ctx.$t("packages.loading"))}</span></div></div>`);
} else if (error.value) {
_push(`<div class="bg-red-900/30 border border-red-700 rounded-xl p-6 text-center"><p class="text-red-300 mb-3">${ssrInterpolate(error.value)}</p><button class="px-4 py-2 bg-red-700 hover:bg-red-600 text-white rounded-lg transition text-sm">${ssrInterpolate(_ctx.$t("packages.retry"))}</button></div>`);
} else if (packages.value.length === 0) {
_push(`<div class="bg-slate-800/50 border border-slate-700 rounded-xl p-12 text-center"><svg class="w-16 h-16 mx-auto text-slate-600 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg><h3 class="text-lg font-medium text-slate-300 mb-2">${ssrInterpolate(_ctx.$t("packages.no_packages"))}</h3><p class="text-slate-500 mb-6">${ssrInterpolate(_ctx.$t("packages.no_packages_desc"))}</p><button class="px-5 py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition text-sm">${ssrInterpolate(_ctx.$t("packages.create_first"))}</button></div>`);
} else {
_push(`<div class="space-y-6 mb-8"><div class="mb-6"><div class="flex gap-2 border-b border-slate-700"><button class="${ssrRenderClass([listTab.value === "base" ? "border-indigo-500 text-indigo-300" : "border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-500", "px-5 py-3 text-sm font-medium border-b-2 transition"])}"><span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"></path></svg> Alapcsomagok </span></button><button class="${ssrRenderClass([listTab.value === "addon" ? "border-amber-500 text-amber-300" : "border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-500", "px-5 py-3 text-sm font-medium border-b-2 transition"])}"><span class="flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v3m0 0v3m0-3h3m-3 0H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> Kiegészítők </span></button></div></div><div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6"><!--[-->`);
ssrRenderList(listTab.value === "base" ? basePackages.value : addonPackages.value, (pkg) => {
_push(`<div class="bg-slate-800 rounded-xl border border-slate-700 p-6 flex flex-col transition-all hover:border-slate-600"><div class="flex items-center justify-between mb-4"><div class="flex items-center gap-3"><div class="${ssrRenderClass([getTierColorClass(pkg.tier_level), "p-2 rounded-lg"])}"><span class="w-5 h-5 text-lg">${getTierIcon(pkg.tier_level) ?? ""}</span></div><div><h2 class="text-lg font-semibold text-white">${ssrInterpolate(getDisplayName(pkg))}</h2><span class="text-xs text-slate-500 font-mono">${ssrInterpolate(pkg.name)}</span></div></div><div class="flex items-center gap-1.5 flex-wrap">`);
if (pkg.tier_level >= 1) {
_push(`<span class="px-2 py-0.5 text-xs font-semibold rounded-full bg-indigo-500/20 text-indigo-300">${ssrInterpolate(_ctx.$t("packages.popular"))}</span>`);
} else {
_push(`<!---->`);
}
if (pkg.is_default_fallback) {
_push(`<span class="px-2 py-0.5 text-xs font-semibold rounded-full bg-amber-500/20 text-amber-300" title="Default fallback package for expired subscriptions"> 🔒 ${ssrInterpolate(_ctx.$t("packages.fallback_badge"))}</span>`);
} else {
_push(`<!---->`);
}
if (pkg.trial_days_on_signup > 0) {
_push(`<span class="px-2 py-0.5 text-xs font-semibold rounded-full bg-emerald-500/20 text-emerald-300"${ssrRenderAttr("title", `${pkg.trial_days_on_signup} days trial on signup`)}> 🎯 ${ssrInterpolate(_ctx.$t("packages.trial_badge"))}: ${ssrInterpolate(pkg.trial_days_on_signup)}d </span>`);
} else {
_push(`<!---->`);
}
_push(`</div></div><div class="mb-4"><span class="text-3xl font-bold text-white">${ssrInterpolate(getFormattedPrice(pkg))}</span><span class="text-sm text-slate-400 ml-1">/ ${ssrInterpolate(_ctx.$t("packages.month"))}</span></div><p class="text-sm text-slate-400 mb-4 flex-1">${ssrInterpolate(getDescription(pkg))}</p><div class="border-t border-slate-700 pt-4 mb-4"><h3 class="text-xs font-semibold uppercase tracking-wider text-slate-500 mb-3">${ssrInterpolate(_ctx.$t("packages.allowances"))}</h3><div class="space-y-2"><div class="flex items-center justify-between text-sm"><span class="text-slate-400">${ssrInterpolate(_ctx.$t("packages.max_vehicles"))}</span><span class="text-slate-200 font-medium">${ssrInterpolate(getAllowance(pkg, "max_vehicles"))}</span></div><div class="flex items-center justify-between text-sm"><span class="text-slate-400">${ssrInterpolate(_ctx.$t("packages.max_garages"))}</span><span class="text-slate-200 font-medium">${ssrInterpolate(getAllowance(pkg, "max_garages"))}</span></div><div class="flex items-center justify-between text-sm"><span class="text-slate-400">${ssrInterpolate(_ctx.$t("packages.max_users"))}</span><span class="text-slate-200 font-medium">${ssrInterpolate(getAllowance(pkg, "max_users"))}</span></div><div class="flex items-center justify-between text-sm"><span class="text-slate-400">${ssrInterpolate(_ctx.$t("packages.monthly_credits"))}</span><span class="text-slate-200 font-medium">${ssrInterpolate(getAllowance(pkg, "monthly_free_credits"))}</span></div></div></div><div class="mb-4"><span class="text-xs text-slate-500">${ssrInterpolate(_ctx.$t("packages.tier_level"))}: </span><span class="text-xs font-mono text-slate-400">${ssrInterpolate(pkg.tier_level)}</span></div><div class="flex gap-2"><button class="flex-1 px-4 py-2.5 bg-indigo-600 hover:bg-indigo-500 text-white font-medium rounded-lg transition text-sm">${ssrInterpolate(_ctx.$t("packages.edit"))}</button><button class="px-3 py-2.5 bg-emerald-700 hover:bg-emerald-600 text-emerald-200 rounded-lg transition"${ssrRenderAttr("title", _ctx.$t("packages.duplicate"))}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"></path></svg></button><button class="px-3 py-2.5 bg-red-700 hover:bg-red-600 text-red-200 rounded-lg transition"${ssrRenderAttr("title", _ctx.$t("packages.delete"))}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg></button></div></div>`);
});
_push(`<!--]--></div></div>`);
}
if (showModal.value) {
_push(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60"><div class="bg-slate-800 border border-slate-700 rounded-xl w-full max-w-3xl mx-4 shadow-2xl max-h-[90vh] flex flex-col"><div class="flex items-center justify-between px-6 py-4 border-b border-slate-700"><h3 class="text-lg font-semibold text-white">${ssrInterpolate(isCreating.value ? _ctx.$t("packages.create_title") : _ctx.$t("packages.edit_title") + ": " + getDisplayName(editingPackage.value))}</h3><button class="p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg></button></div><div class="px-6 pt-4 pb-2 mb-6"><div class="bg-slate-700/40 border border-slate-600 rounded-xl p-4"><label class="block text-sm font-semibold text-slate-200 mb-3">${ssrInterpolate(_ctx.$t("packages.form_type"))}</label><div class="flex gap-4"><label class="${ssrRenderClass([form.type === "base" || form.type === "private" || form.type === "corporate" ? "border-indigo-500 bg-indigo-500/10" : "border-slate-600 bg-slate-700/50 hover:border-slate-500", "flex-1 flex items-center gap-3 px-4 py-3 rounded-lg border-2 cursor-pointer transition"])}"><input type="radio" name="packageType" value="private"${ssrIncludeBooleanAttr(ssrLooseEqual(form.type, "private")) ? " checked" : ""} class="sr-only"><div class="${ssrRenderClass([form.type === "private" || form.type === "corporate" || form.type === "base" ? "border-indigo-500" : "border-slate-500", "w-5 h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0"])}">`);
if (form.type === "private" || form.type === "corporate" || form.type === "base") {
_push(`<div class="w-2.5 h-2.5 rounded-full bg-indigo-500"></div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div><span class="text-sm font-medium text-white">📦 Alapcsomag (Base Tier)</span><p class="text-xs text-slate-400 mt-0.5">Teljes jogú csomag járművekkel, garázsokkal, felhasználókkal</p></div></label><label class="${ssrRenderClass([form.type === "addon" ? "border-amber-500 bg-amber-500/10" : "border-slate-600 bg-slate-700/50 hover:border-slate-500", "flex-1 flex items-center gap-3 px-4 py-3 rounded-lg border-2 cursor-pointer transition"])}"><input type="radio" name="packageType" value="addon"${ssrIncludeBooleanAttr(ssrLooseEqual(form.type, "addon")) ? " checked" : ""} class="sr-only"><div class="${ssrRenderClass([form.type === "addon" ? "border-amber-500" : "border-slate-500", "w-5 h-5 rounded-full border-2 flex items-center justify-center flex-shrink-0"])}">`);
if (form.type === "addon") {
_push(`<div class="w-2.5 h-2.5 rounded-full bg-amber-500"></div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div><span class="text-sm font-medium text-white"> Kiegészítő (Add-on)</span><p class="text-xs text-slate-400 mt-0.5">Kiegészítő modul meglévő csomaghoz, korlátozott opciókkal</p></div></label></div></div></div><div class="flex border-b border-slate-700 px-6"><!--[-->`);
ssrRenderList(tabs, (tab) => {
_push(`<button class="${ssrRenderClass([activeTab.value === tab.key ? "border-indigo-500 text-indigo-300" : "border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-500", "px-4 py-3 text-sm font-medium border-b-2 transition"])}">${ssrInterpolate(tab.label)}</button>`);
});
_push(`<!--]--></div><div class="flex-1 overflow-y-auto px-6 py-5">`);
if (activeTab.value === "basic") {
_push(`<div class="space-y-4"><div><label class="block text-sm font-medium text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_name"))}</label><input${ssrRenderAttr("value", form.name)} type="text" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"${ssrRenderAttr("placeholder", _ctx.$t("packages.form_name_placeholder"))}></div><div><label class="block text-sm font-medium text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_display_name"))}</label><input${ssrRenderAttr("value", form.display_name)} type="text" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"${ssrRenderAttr("placeholder", _ctx.$t("packages.form_display_name_placeholder"))}></div>`);
if (form.type !== "addon") {
_push(`<div><label class="block text-sm font-medium text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_tier_level"))}</label><input${ssrRenderAttr("value", form.tier_level)} type="number" min="0" max="10" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><p class="text-xs text-slate-500 mt-1">${ssrInterpolate(_ctx.$t("packages.form_tier_level_hint"))}</p></div>`);
} else {
_push(`<!---->`);
}
if (form.type !== "addon") {
_push(`<div class="grid grid-cols-2 gap-4"><div><label class="block text-sm font-medium text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_subtitle"))}</label><input${ssrRenderAttr("value", form.subtitle)} type="text" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"${ssrRenderAttr("placeholder", _ctx.$t("packages.form_subtitle_placeholder"))}></div><div><label class="block text-sm font-medium text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_badge"))}</label><input${ssrRenderAttr("value", form.badge)} type="text" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"${ssrRenderAttr("placeholder", _ctx.$t("packages.form_badge_placeholder"))}></div></div>`);
} else {
_push(`<!---->`);
}
_push(`<div class="flex items-center gap-3"><input${ssrIncludeBooleanAttr(Array.isArray(form.is_custom) ? ssrLooseContain(form.is_custom, null) : form.is_custom) ? " checked" : ""} type="checkbox" id="is_custom" class="rounded bg-slate-700 border-slate-600 text-indigo-600 focus:ring-indigo-500"><label for="is_custom" class="text-sm text-slate-300">${ssrInterpolate(_ctx.$t("packages.form_is_custom"))}</label></div>`);
if (form.type !== "addon") {
_push(`<div class="border-t border-slate-700 pt-4"><h4 class="text-sm font-semibold text-slate-300 mb-3">${ssrInterpolate(_ctx.$t("packages.singleton_rules"))}</h4><div class="space-y-4"><div class="flex items-center gap-3"><input${ssrIncludeBooleanAttr(Array.isArray(form.is_default_fallback) ? ssrLooseContain(form.is_default_fallback, null) : form.is_default_fallback) ? " checked" : ""} type="checkbox" id="is_default_fallback" class="rounded bg-slate-700 border-slate-600 text-amber-500 focus:ring-amber-500"><label for="is_default_fallback" class="text-sm text-slate-300">${ssrInterpolate(_ctx.$t("packages.form_is_default_fallback"))}</label></div><div><label class="block text-sm text-slate-300 mb-1">${ssrInterpolate(_ctx.$t("packages.form_trial_days"))}</label><input${ssrRenderAttr("value", form.trial_days_on_signup)} type="number" min="0" max="365" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"><p class="text-xs text-slate-500 mt-1">${ssrInterpolate(_ctx.$t("packages.form_trial_days_hint"))}</p></div></div></div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
} else {
_push(`<!---->`);
}
if (activeTab.value === "pricing") {
_push(`<div class="space-y-6"><div><h4 class="text-sm font-semibold text-slate-300 mb-3">${ssrInterpolate(_ctx.$t("packages.per_region_pricing"))}</h4><div class="overflow-x-auto"><table class="w-full text-sm"><thead><tr class="border-b border-slate-700"><th class="text-left py-2 px-3 text-slate-400 font-medium">Region</th><th class="text-left py-2 px-3 text-slate-400 font-medium">${ssrInterpolate(_ctx.$t("packages.form_monthly_price"))}</th><th class="text-left py-2 px-3 text-slate-400 font-medium">${ssrInterpolate(_ctx.$t("packages.form_yearly_price"))}</th><th class="text-left py-2 px-3 text-slate-400 font-medium">Kredit Ár</th><th class="text-left py-2 px-3 text-slate-400 font-medium">${ssrInterpolate(_ctx.$t("packages.form_currency"))}</th><th class="text-left py-2 px-3 text-slate-400 font-medium"></th></tr></thead><tbody><!--[-->`);
ssrRenderList(unref(regionStore).regions, (region) => {
_push(`<tr class="border-b border-slate-700/50"><td class="py-2 px-3 text-slate-200 font-medium"><span class="inline-flex items-center gap-1.5"><span>${ssrInterpolate(region.country_code)}</span><span class="text-xs text-slate-500">(${ssrInterpolate(region.currency)}, ${ssrInterpolate(region.default_vat_rate)}% VAT)</span></span></td><td class="py-2 px-3"><input${ssrRenderAttr("value", getZonePrice(region.country_code, "monthly"))} type="number" step="0.01" min="0" class="w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></td><td class="py-2 px-3"><input${ssrRenderAttr("value", getZonePrice(region.country_code, "yearly"))} type="number" step="0.01" min="0" class="w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></td><td class="py-2 px-3"><input${ssrRenderAttr("value", getZoneCreditPrice(region.country_code))} type="number" step="0.01" min="0" class="w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></td><td class="py-2 px-3"><input${ssrRenderAttr("value", getZoneCurrency(region.country_code))} type="text" maxlength="3" class="w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent uppercase"></td><td class="py-2 px-3 text-center"><div class="flex items-center gap-1"><button class="p-1.5 rounded-lg text-emerald-400 hover:text-emerald-300 hover:bg-emerald-500/10 transition"${ssrRenderAttr("title", "Apply DEFAULT pricing to " + region.country_code)}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path></svg></button><button class="p-1.5 rounded-lg text-red-400 hover:text-red-300 hover:bg-red-500/10 transition"${ssrRenderAttr("title", "Remove " + region.country_code)}><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"></path></svg></button></div></td></tr>`);
});
_push(`<!--]--></tbody></table></div><div class="flex items-center gap-3 mt-4"><select class="px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"><option value="" disabled${ssrIncludeBooleanAttr(Array.isArray(selectedAddZoneCode.value) ? ssrLooseContain(selectedAddZoneCode.value, "") : ssrLooseEqual(selectedAddZoneCode.value, "")) ? " selected" : ""}>${ssrInterpolate(_ctx.$t("packages.add_zone_select"))}</option><!--[-->`);
ssrRenderList(availableRegionsToAdd.value, (region) => {
_push(`<option${ssrRenderAttr("value", region.country_code)}${ssrIncludeBooleanAttr(Array.isArray(selectedAddZoneCode.value) ? ssrLooseContain(selectedAddZoneCode.value, region.country_code) : ssrLooseEqual(selectedAddZoneCode.value, region.country_code)) ? " selected" : ""}>${ssrInterpolate(region.country_code)}${ssrInterpolate(region.name)} (${ssrInterpolate(region.currency)}, ${ssrInterpolate(region.default_vat_rate)}% VAT) </option>`);
});
_push(`<!--]--></select><button${ssrIncludeBooleanAttr(!selectedAddZoneCode.value) ? " disabled" : ""} class="px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white text-sm font-medium rounded-lg transition flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path></svg> ${ssrInterpolate(_ctx.$t("packages.add_zone"))}</button></div></div><div class="border-t border-slate-700 pt-5"><h4 class="text-sm font-semibold text-slate-300 mb-3">🧮 ${ssrInterpolate(_ctx.$t("packages.smart_calculator"))}</h4><div class="bg-slate-700/30 rounded-xl p-4 space-y-4"><div class="grid grid-cols-3 gap-4"><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_net_price"))}</label><input${ssrRenderAttr("value", calcNetPrice.value)} type="number" step="0.01" min="0" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent" placeholder="0.00"></div><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_vat_rate"))}</label><select class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"><!--[-->`);
ssrRenderList(unref(regionStore).regions, (region) => {
_push(`<option${ssrRenderAttr("value", region.default_vat_rate)}${ssrIncludeBooleanAttr(Array.isArray(calcVatRate.value) ? ssrLooseContain(calcVatRate.value, region.default_vat_rate) : ssrLooseEqual(calcVatRate.value, region.default_vat_rate)) ? " selected" : ""}>${ssrInterpolate(region.country_code)}${ssrInterpolate(region.default_vat_rate)}% </option>`);
});
_push(`<!--]--></select></div><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_currency"))}</label><select class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"><!--[-->`);
ssrRenderList(unref(regionStore).regions, (region) => {
_push(`<option${ssrRenderAttr("value", region.currency)}${ssrIncludeBooleanAttr(Array.isArray(calcCurrency.value) ? ssrLooseContain(calcCurrency.value, region.currency) : ssrLooseEqual(calcCurrency.value, region.currency)) ? " selected" : ""}>${ssrInterpolate(region.currency)} (${ssrInterpolate(region.country_code)}) </option>`);
});
_push(`<!--]--></select></div></div><div class="grid grid-cols-3 gap-4 pt-2"><div class="bg-slate-800 rounded-lg p-3 text-center"><p class="text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_net"))}</p><p class="text-lg font-bold text-white">${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value, calcCurrency.value))}</p></div><div class="bg-slate-800 rounded-lg p-3 text-center"><p class="text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_vat"))} (${ssrInterpolate(calcVatRate.value)}%)</p><p class="text-lg font-bold text-amber-400">${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value * (calcVatRate.value / 100), calcCurrency.value))}</p></div><div class="bg-slate-800 rounded-lg p-3 text-center ring-2 ring-emerald-500/50"><p class="text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.calc_gross"))}</p><p class="text-lg font-bold text-emerald-400">${ssrInterpolate(unref(formatCurrency)(calcNetPrice.value * (1 + calcVatRate.value / 100), calcCurrency.value))}</p></div></div><div class="flex justify-end pt-1"><button class="px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path></svg> ${ssrInterpolate(_ctx.$t("packages.calc_apply"))}</button></div></div></div></div>`);
} else {
_push(`<!---->`);
}
if (activeTab.value === "features") {
_push(`<div class="space-y-5"><div><h4 class="text-sm font-semibold text-slate-300 mb-3">${ssrInterpolate(_ctx.$t("packages.allowances"))}</h4><div class="grid grid-cols-3 gap-4"><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.max_vehicles"))}</label><input${ssrRenderAttr("value", form.max_vehicles)} type="number" min="0" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.max_garages"))}</label><input${ssrRenderAttr("value", form.max_garages)} type="number" min="0" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.max_users"))}</label><input${ssrRenderAttr("value", form.max_users)} type="number" min="1" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div><div><label class="block text-xs text-slate-400 mb-1">${ssrInterpolate(_ctx.$t("packages.monthly_credits"))}</label><input${ssrRenderAttr("value", form.monthly_free_credits)} type="number" min="0" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div></div></div><div class="border-t border-slate-700 pt-4"><h4 class="text-sm font-semibold text-slate-300 mb-3">SaaS Allowances</h4><div class="grid grid-cols-3 gap-4"><div><label class="block text-xs text-slate-400 mb-1">Költségkategória mélység (max_cost_category_depth)</label><input${ssrRenderAttr("value", form.max_cost_category_depth)} type="number" min="0" max="10" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"></div><div><label class="block text-xs text-slate-400 mb-1">Statisztika (advanced_reports)</label><div class="flex items-center h-[38px]"><label class="relative inline-flex items-center cursor-pointer"><input${ssrIncludeBooleanAttr(Array.isArray(form.advanced_reports) ? ssrLooseContain(form.advanced_reports, null) : form.advanced_reports) ? " checked" : ""} type="checkbox" class="sr-only peer"><div class="w-11 h-6 bg-slate-600 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[&#39;&#39;] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div><span class="ms-3 text-sm text-slate-300">${ssrInterpolate(form.advanced_reports ? "Enabled" : "Disabled")}</span></label></div></div><div><label class="block text-xs text-slate-400 mb-1">PDF/CSV Export (export_data)</label><div class="flex items-center h-[38px]"><label class="relative inline-flex items-center cursor-pointer"><input${ssrIncludeBooleanAttr(Array.isArray(form.export_data) ? ssrLooseContain(form.export_data, null) : form.export_data) ? " checked" : ""} type="checkbox" class="sr-only peer"><div class="w-11 h-6 bg-slate-600 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[&#39;&#39;] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"></div><span class="ms-3 text-sm text-slate-300">${ssrInterpolate(form.export_data ? "Enabled" : "Disabled")}</span></label></div></div></div></div><div class="border-t border-slate-700 pt-4"><h4 class="text-sm font-semibold text-slate-300 mb-3">${ssrInterpolate(_ctx.$t("packages.feature_capabilities"))}</h4><textarea rows="8" class="w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm font-mono focus:ring-2 focus:ring-indigo-500 focus:border-transparent" placeholder="{\\n &quot;ai_analysis&quot;: true,\\n &quot;priority_support&quot;: false,\\n &quot;api_access&quot;: true\\n}">${ssrInterpolate(form.feature_capabilities_json)}</textarea><p class="text-xs text-slate-500 mt-1">${ssrInterpolate(_ctx.$t("packages.feature_capabilities_hint"))}</p>`);
if (featureCapabilitiesError.value) {
_push(`<p class="text-xs text-red-400 mt-1">${ssrInterpolate(featureCapabilitiesError.value)}</p>`);
} else {
_push(`<!---->`);
}
_push(`</div></div>`);
} else {
_push(`<!---->`);
}
_push(`</div><div class="flex items-center justify-between px-6 py-4 border-t border-slate-700"><div class="text-xs text-slate-500">${ssrInterpolate(activeTabLabel.value)}</div><div class="flex items-center gap-3"><button class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">${ssrInterpolate(_ctx.$t("packages.cancel"))}</button><button${ssrIncludeBooleanAttr(saving.value) ? " disabled" : ""} class="px-6 py-2 bg-emerald-600 hover:bg-emerald-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white font-medium rounded-lg transition text-sm flex items-center gap-2">`);
if (saving.value) {
_push(`<svg class="animate-spin h-4 w-4" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"></path></svg>`);
} else {
_push(`<!---->`);
}
_push(` ${ssrInterpolate(isCreating.value ? _ctx.$t("packages.create") : _ctx.$t("packages.save"))}</button></div></div></div></div>`);
} else {
_push(`<!---->`);
}
if (showDeleteConfirm.value && deletingPackage.value) {
_push(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60"><div class="bg-slate-800 border border-slate-700 rounded-xl w-full max-w-md mx-4 p-6 shadow-2xl"><h3 class="text-lg font-semibold text-white mb-2">${ssrInterpolate(_ctx.$t("packages.delete_title"))}</h3><p class="text-slate-400 text-sm mb-6">${ssrInterpolate(_ctx.$t("packages.delete_confirm", { name: getDisplayName(deletingPackage.value) }))}</p><div class="flex items-center justify-end gap-3"><button class="px-4 py-2 text-sm text-slate-400 hover:text-white transition">${ssrInterpolate(_ctx.$t("packages.cancel"))}</button><button${ssrIncludeBooleanAttr(saving.value) ? " disabled" : ""} class="px-6 py-2 bg-red-600 hover:bg-red-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white font-medium rounded-lg transition text-sm">${ssrInterpolate(_ctx.$t("packages.delete_btn"))}</button></div></div></div>`);
} else {
_push(`<!---->`);
}
if (saveNotification.value) {
_push(`<div class="${ssrRenderClass([saveNotification.value.type === "success" ? "bg-emerald-600 text-white" : "bg-red-600 text-white", "fixed bottom-6 right-6 px-5 py-3 rounded-xl shadow-xl text-sm font-medium z-50"])}">${ssrInterpolate(saveNotification.value.message)}</div>`);
} else {
_push(`<!---->`);
}
_push(`</div>`);
};
}
});
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-CmqjFfry.js.map