Files
service-finder/frontend_admin/.nuxt/dist/server/_nuxt/index-JpXwtL-Z.js

183 lines
15 KiB
JavaScript

import { defineComponent, ref, computed, useSSRContext } from "vue";
import { ssrRenderAttrs, ssrInterpolate, ssrRenderClass, ssrRenderList } from "vue/server-renderer";
import { useRoute, useRouter } from "vue-router";
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 "/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) {
useRoute();
useRouter();
const loading = ref(true);
const error = ref(null);
const garage = ref(null);
const activeTab = ref("general");
const tabs = [
{ key: "general", label: "Általános" },
{ key: "employees", label: "Dolgozók" },
{ key: "fleet", label: "Flotta" },
{ key: "analytics", label: "Analitika" }
];
const formattedAddress = computed(() => {
if (!garage.value) return "—";
const parts = [];
if (garage.value.address_zip) parts.push(garage.value.address_zip);
if (garage.value.address_city) parts.push(garage.value.address_city);
const streetParts = [];
if (garage.value.address_street_name) streetParts.push(garage.value.address_street_name);
if (garage.value.address_street_type) streetParts.push(garage.value.address_street_type);
if (garage.value.address_house_number) streetParts.push(garage.value.address_house_number);
if (streetParts.length > 0) parts.push(streetParts.join(" "));
return parts.length > 0 ? parts.join(", ") : "—";
});
function garageDisplayName(g) {
return g.display_name || g.name || g.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 orgTypeLabel(type) {
const labels = {
individual: "Magánszemély",
service: "Szerviz",
service_provider: "Szolgáltató",
fleet_owner: "Flottatulajdonos",
club: "Klub",
business: "Vállalkozás"
};
return labels[type] || type;
}
function formatDate(dateStr) {
if (!dateStr) return "—";
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(`<div${ssrRenderAttrs(_attrs)}>`);
if (loading.value) {
_push(`<div class="flex items-center justify-center py-20"><div class="flex flex-col items-center gap-3"><svg class="w-8 h-8 text-indigo-400 animate-spin" 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><p class="text-slate-400 text-sm">${ssrInterpolate(_ctx.$t("garages.details.loading"))}</p></div></div>`);
} else if (error.value) {
_push(`<div class="flex flex-col items-center justify-center py-20 text-center"><svg class="w-12 h-12 text-red-500 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"></path></svg><p class="text-red-400 text-sm mb-2">${ssrInterpolate(error.value)}</p><button class="px-4 py-2 text-sm bg-indigo-600/20 text-indigo-300 hover:bg-indigo-600/30 rounded-lg transition">${ssrInterpolate(_ctx.$t("garages.details.retry"))}</button></div>`);
} else if (garage.value) {
_push(`<!--[--><div class="mb-8"><button class="inline-flex items-center gap-1.5 text-sm text-slate-400 hover:text-white transition mb-4"><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="M15 19l-7-7 7-7"></path></svg> ${ssrInterpolate(_ctx.$t("garages.details.back"))}</button><div class="flex items-center justify-between"><div class="flex items-center gap-4"><div class="${ssrRenderClass([getInitialsColor(garageDisplayName(garage.value)), "w-12 h-12 rounded-xl flex items-center justify-center text-lg font-bold text-white"])}">${ssrInterpolate(getInitials(garageDisplayName(garage.value)))}</div><div><h1 class="text-2xl font-bold text-white">${ssrInterpolate(garageDisplayName(garage.value))}</h1><p class="text-sm text-slate-400 mt-0.5">${ssrInterpolate(garage.value.full_name)} `);
if (garage.value.tax_number) {
_push(`<span class="ml-2 text-slate-500">· ${ssrInterpolate(_ctx.$t("garages.details.tax_number"))}: ${ssrInterpolate(garage.value.tax_number)}</span>`);
} else {
_push(`<!---->`);
}
_push(`</p></div></div><span class="${ssrRenderClass([statusBadgeClass(garage.value.status), "inline-flex items-center px-3 py-1 rounded-full text-xs font-medium"])}"><span class="${ssrRenderClass([statusDotClass(garage.value.status), "w-1.5 h-1.5 rounded-full mr-1.5"])}"></span> ${ssrInterpolate(statusLabel(garage.value.status))}</span></div></div><div class="border-b border-slate-700 mb-6"><nav class="flex gap-6"><!--[-->`);
ssrRenderList(tabs, (tab) => {
_push(`<button class="${ssrRenderClass([activeTab.value === tab.key ? "text-indigo-400 border-indigo-400" : "text-slate-400 border-transparent hover:text-slate-300", "pb-3 text-sm font-medium transition border-b-2 -mb-px"])}">${ssrInterpolate(tab.label)}</button>`);
});
_push(`<!--]--></nav></div>`);
if (activeTab.value === "general") {
_push(`<div class="space-y-6"><div class="bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden"><div class="px-6 py-4 border-b border-slate-700 flex items-center gap-3"><div class="p-2 rounded-lg bg-indigo-500/10 text-indigo-400"><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="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4"></path></svg></div><h3 class="text-base font-semibold text-white">${ssrInterpolate(_ctx.$t("garages.details.company_info"))}</h3></div><div class="px-6 py-5"><div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.company_name"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.full_name)}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.display_name"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.display_name || "—")}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.org_type"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(orgTypeLabel(garage.value.org_type))}</p></div></div><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.tax_number"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.tax_number || "—")}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.reg_number"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.reg_number || "—")}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.created_at"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(formatDate(garage.value.created_at))}</p></div></div></div><div class="mt-6 pt-6 border-t border-slate-700/50"><p class="text-xs text-slate-500 uppercase tracking-wider mb-3">${ssrInterpolate(_ctx.$t("garages.details.address"))}</p><p class="text-sm text-white">${ssrInterpolate(formattedAddress.value)}</p></div></div></div><div class="bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden"><div class="px-6 py-4 border-b border-slate-700 flex items-center gap-3"><div class="p-2 rounded-lg bg-amber-500/10 text-amber-400"><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="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"></path></svg></div><h3 class="text-base font-semibold text-white">${ssrInterpolate(_ctx.$t("garages.details.subscription_info"))}</h3></div><div class="px-6 py-5">`);
if (garage.value.subscription) {
_push(`<div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.tier_name"))}</p><span class="${ssrRenderClass([tierBadgeClass(garage.value.subscription.tier_name), "inline-flex mt-1 px-2.5 py-0.5 rounded-full text-xs font-medium"])}">${ssrInterpolate(garage.value.subscription.tier_name)}</span></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.tier_level"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(_ctx.$t("garages.details.level_n", { n: garage.value.subscription.tier_level }))}</p></div></div><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.expires_at"))}</p>`);
if (garage.value.subscription.expires_at) {
_push(`<p class="text-sm text-white mt-1">${ssrInterpolate(formatDate(garage.value.subscription.expires_at))}</p>`);
} else {
_push(`<p class="text-sm text-slate-400 mt-1 italic">${ssrInterpolate(_ctx.$t("garages.indefinite"))}</p>`);
}
_push(`</div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.asset_limit"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.subscription.asset_limit)} ${ssrInterpolate(_ctx.$t("garages.details.vehicles"))}</p></div></div></div>`);
} else {
_push(`<div class="text-center py-4"><p class="text-sm text-slate-400">${ssrInterpolate(_ctx.$t("garages.details.no_subscription"))}</p></div>`);
}
_push(`</div></div><div class="bg-slate-800/50 border border-slate-700 rounded-xl overflow-hidden"><div class="px-6 py-4 border-b border-slate-700 flex items-center gap-3"><div class="p-2 rounded-lg bg-emerald-500/10 text-emerald-400"><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="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"></path></svg></div><h3 class="text-base font-semibold text-white">${ssrInterpolate(_ctx.$t("garages.details.contact_info"))}</h3></div><div class="px-6 py-5">`);
if (garage.value.primary_contact) {
_push(`<div class="grid grid-cols-1 md:grid-cols-2 gap-6"><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.contact_name"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.primary_contact.full_name)}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.contact_role"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.primary_contact.role)}</p></div></div><div class="space-y-4"><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.contact_department"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.primary_contact.department || "—")}</p></div><div><p class="text-xs text-slate-500 uppercase tracking-wider">${ssrInterpolate(_ctx.$t("garages.details.contact_phone"))}</p><p class="text-sm text-white mt-1">${ssrInterpolate(garage.value.primary_contact.phone || "—")}</p></div></div></div>`);
} else {
_push(`<div class="text-center py-4"><p class="text-sm text-slate-400">${ssrInterpolate(_ctx.$t("garages.details.no_contact"))}</p></div>`);
}
_push(`</div></div></div>`);
} else {
_push(`<!---->`);
}
if (activeTab.value !== "general") {
_push(`<div class="flex items-center justify-center py-20"><p class="text-slate-500 text-sm">${ssrInterpolate(_ctx.$t("garages.details.coming_soon"))}</p></div>`);
} else {
_push(`<!---->`);
}
_push(`<!--]-->`);
} 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/garages/[id]/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export {
_sfc_main as default
};
//# sourceMappingURL=index-JpXwtL-Z.js.map