import { defineComponent, ref, computed, 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 "../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: "index", __ssrInlineRender: true, setup(__props) { const loading = ref(true); const error = ref(null); const garages = ref([]); const availableTiers = ref([]); const searchQuery = ref(""); const filterTier = ref("all"); const showSubscriptionModal = ref(false); const selectedGarage = ref(null); const selectedTierId = ref(""); const customExpiresAt = ref(""); const saving = ref(false); const saveError = ref(null); const saveNotification = ref(null); const activeCount = computed(() => garages.value.filter((g) => g.is_active).length); const premiumCount = computed(() => { return garages.value.filter((g) => { const name = g.subscription_tier_name.toLowerCase(); return name.includes("premium") || name.includes("pro"); }).length; }); const enterpriseCount = computed(() => { return garages.value.filter((g) => { const name = g.subscription_tier_name.toLowerCase(); return name.includes("enterprise") || name.includes("vip") || name.includes("corp"); }).length; }); const filteredGarages = computed(() => { return garages.value.filter((g) => { if (searchQuery.value) { const q = searchQuery.value.toLowerCase(); const displayName = garageDisplayName(g).toLowerCase(); const matchesSearch = displayName.includes(q) || g.full_name.toLowerCase().includes(q) || g.name.toLowerCase().includes(q) || g.city && g.city.toLowerCase().includes(q); if (!matchesSearch) return false; } if (filterTier.value !== "all") { const name = g.subscription_tier_name.toLowerCase(); if (filterTier.value === "free" && !name.includes("free") && !name.includes("fallback")) return false; if (filterTier.value === "premium" && !name.includes("premium") && !name.includes("pro")) return false; if (filterTier.value === "enterprise" && !name.includes("enterprise") && !name.includes("vip") && !name.includes("corp")) return false; } return true; }); }); function garageDisplayName(garage) { return garage.display_name || garage.name || garage.full_name; } function getInitials(name) { return name.split(" ").map((w) => w.charAt(0)).join("").toUpperCase().slice(0, 2); } function getInitialsColor(name) { const colors = [ "bg-amber-600", "bg-purple-600", "bg-slate-600", "bg-indigo-600", "bg-emerald-600", "bg-rose-600", "bg-cyan-600", "bg-orange-600", "bg-teal-600" ]; let hash = 0; for (let i = 0; i < name.length; i++) { hash = name.charCodeAt(i) + ((hash << 5) - hash); } return colors[Math.abs(hash) % colors.length]; } function statusBadgeClass(status) { if (status === "active") return "bg-emerald-500/10 text-emerald-400"; if (status === "suspended") return "bg-red-500/10 text-red-400"; if (status === "pending_verification") return "bg-amber-500/10 text-amber-400"; return "bg-slate-500/10 text-slate-400"; } function statusDotClass(status) { if (status === "active") return "bg-emerald-400"; if (status === "suspended") return "bg-red-400"; if (status === "pending_verification") return "bg-amber-400"; return "bg-slate-400"; } function statusLabel(status) { if (status === "active") return "Aktív"; if (status === "suspended") return "Felfüggesztve"; if (status === "pending_verification") return "Függőben"; return "Inaktív"; } function tierBadgeClass(tierName) { const name = tierName.toLowerCase(); if (name.includes("enterprise") || name.includes("vip") || name.includes("corp")) return "bg-purple-500/20 text-purple-300"; if (name.includes("premium") || name.includes("pro")) return "bg-amber-500/20 text-amber-300"; return "bg-slate-500/20 text-slate-300"; } function formatDate(dateStr) { try { const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "short", day: "numeric" }); } catch { return dateStr; } } return (_ctx, _push, _parent, _attrs) => { _push(`

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

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

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

${ssrInterpolate(_ctx.$t("garages.loading"))}

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

${ssrInterpolate(error.value)}

`); } else { _push(`

${ssrInterpolate(_ctx.$t("garages.total_garages"))}

${ssrInterpolate(garages.value.length)}

${ssrInterpolate(_ctx.$t("garages.active_garages"))}

${ssrInterpolate(activeCount.value)}

${ssrInterpolate(_ctx.$t("garages.premium_garages"))}

${ssrInterpolate(premiumCount.value)}

${ssrInterpolate(_ctx.$t("garages.enterprise_garages"))}

${ssrInterpolate(enterpriseCount.value)}

`); ssrRenderList(filteredGarages.value, (garage) => { _push(``); }); _push(`
ID${ssrInterpolate(_ctx.$t("garages.company_name"))}${ssrInterpolate(_ctx.$t("garages.status"))}${ssrInterpolate(_ctx.$t("garages.current_package"))}${ssrInterpolate(_ctx.$t("garages.expiration_date"))}${ssrInterpolate(_ctx.$t("garages.actions"))}
${ssrInterpolate(garage.id)}
${ssrInterpolate(getInitials(garageDisplayName(garage)))}

${ssrInterpolate(garageDisplayName(garage))}

${ssrInterpolate(garage.city || "—")} · ${ssrInterpolate(garage.member_count)} ${ssrInterpolate(_ctx.$t("garages.members"))}

${ssrInterpolate(statusLabel(garage.status))}${ssrInterpolate(garage.subscription_tier_name)}`); if (garage.subscription_expires_at) { _push(`${ssrInterpolate(formatDate(garage.subscription_expires_at))}`); } else { _push(`${ssrInterpolate(_ctx.$t("garages.indefinite"))}`); } _push(`
`); if (filteredGarages.value.length === 0 && !loading.value) { _push(`

${ssrInterpolate(_ctx.$t("garages.no_results"))}

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

${ssrInterpolate(_ctx.$t("garages.manage_subscription"))}

${ssrInterpolate(selectedGarage.value ? garageDisplayName(selectedGarage.value) : "")}

${ssrInterpolate(_ctx.$t("garages.current_package"))}

${ssrInterpolate(selectedGarage.value?.subscription_tier_name || _ctx.$t("garages.free_fallback"))}

`); if (selectedGarage.value?.subscription_expires_at) { _push(`

${ssrInterpolate(_ctx.$t("garages.expires"))}: ${ssrInterpolate(formatDate(selectedGarage.value.subscription_expires_at))}

`); } else { _push(``); } _push(`

${ssrInterpolate(_ctx.$t("garages.custom_expiration_hint"))}

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

${ssrInterpolate(saveError.value)}

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