import { defineComponent, ref, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrRenderAttr, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderList, ssrRenderClass } from 'vue/server-renderer'; 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\xEDv"; if (status === "suspended") return "Felf\xFCggesztve"; if (status === "pending_verification") return "F\xFCgg\u0151ben"; return "Inakt\xEDv"; } 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) => { var _a, _b; _push(`
${ssrInterpolate(_ctx.$t("garages.subtitle"))}
${ssrInterpolate(_ctx.$t("garages.loading"))}
${ssrInterpolate(error.value)}
${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)}
| 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 || "\u2014")} \xB7 ${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(` |
${ssrInterpolate(_ctx.$t("garages.no_results"))}
${ssrInterpolate(selectedGarage.value ? garageDisplayName(selectedGarage.value) : "")}
${ssrInterpolate(_ctx.$t("garages.current_package"))}
${ssrInterpolate(((_a = selectedGarage.value) == null ? void 0 : _a.subscription_tier_name) || _ctx.$t("garages.free_fallback"))}
`); if ((_b = selectedGarage.value) == null ? void 0 : _b.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"))}
${ssrInterpolate(saveError.value)}