import { _ as __nuxt_component_0 } from "./nuxt-link-1NBbHb-h.js"; import { defineComponent, ref, computed, watch, createVNode, resolveDynamicComponent, withCtx, openBlock, createBlock, createTextVNode, useSSRContext } from "vue"; import { ssrRenderAttrs, ssrInterpolate, ssrRenderClass, ssrRenderList, ssrRenderVNode, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, ssrRenderComponent, ssrLooseContain, ssrLooseEqual } from "vue/server-renderer"; import { useRoute, useRouter } from "vue-router"; import { d as useCookie } from "../server.mjs"; import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js"; import "/app/node_modules/ufo/dist/index.mjs"; import "/app/node_modules/defu/dist/defu.mjs"; import "/app/node_modules/ofetch/dist/node.mjs"; import "#internal/nuxt/paths"; import "/app/node_modules/hookable/dist/index.mjs"; import "/app/node_modules/unctx/dist/index.mjs"; import "/app/node_modules/h3/dist/index.mjs"; import "pinia"; import "/app/node_modules/klona/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 route = useRoute(); useRouter(); const loading = ref(true); const error = ref(false); const provider = ref(null); const actionLoading = ref(false); ref(null); const showRejectModal = ref(false); const rejectReason = ref(""); const showFlagModal = ref(false); const flagReason = ref(""); const activeTab = ref("data"); const validations = ref([]); const validationsLoading = ref(false); const history = ref([]); const historyLoading = ref(false); const statusForm = ref({ status: "pending", validation_score: 0, reason: "" }); const statusLoading = ref(false); const tabs = [ { key: "data", label: "Adatok", icon: "svg" }, { key: "status", label: "Státusz", icon: "svg" }, { key: "validations", label: "Validációk", icon: "svg" }, { key: "history", label: "Előzmények", icon: "svg" } ]; const statusBannerClass = computed(() => { switch (provider.value?.status) { case "approved": return "bg-emerald-500/10 border-emerald-500/30"; case "pending": return "bg-amber-500/10 border-amber-500/30"; default: return "bg-rose-500/10 border-rose-500/30"; } }); const statusIconClass = computed(() => { switch (provider.value?.status) { case "approved": return "bg-emerald-500/20 text-emerald-400"; case "pending": return "bg-amber-500/20 text-amber-400"; default: return "bg-rose-500/20 text-rose-400"; } }); const statusTextClass = computed(() => { switch (provider.value?.status) { case "approved": return "text-emerald-400"; case "pending": return "text-amber-400"; default: return "text-rose-400"; } }); const statusSubtextClass = computed(() => { switch (provider.value?.status) { case "approved": return "text-emerald-400/60"; case "pending": return "text-amber-400/60"; default: return "text-rose-400/60"; } }); const hasOpeningHours = computed(() => { const hours = provider.value?.opening_hours; if (!hours || typeof hours !== "object") return false; return DAYS.some((day) => { const slot = hours[day.key]; return slot && typeof slot === "object" && slot.open && slot.close; }); }); const hasSpecializations = computed(() => { const spec = provider.value?.specializations; if (!spec || typeof spec !== "object") return false; return Array.isArray(spec.brands) && spec.brands.length > 0 || Array.isArray(spec.propulsion) && spec.propulsion.length > 0; }); const DAYS = [ { key: "monday", label: "Hétfő" }, { key: "tuesday", label: "Kedd" }, { key: "wednesday", label: "Szerda" }, { key: "thursday", label: "Csütörtök" }, { key: "friday", label: "Péntek" }, { key: "saturday", label: "Szombat" }, { key: "sunday", label: "Vasárnap" } ]; function getDayHours(dayKey) { const hours = provider.value?.opening_hours; if (!hours || typeof hours !== "object") return null; const slot = hours[dayKey]; if (slot && typeof slot === "object" && slot.open && slot.close) { return { open: slot.open, close: slot.close }; } return null; } function statusLabel(status) { switch (status) { case "approved": return "Jóváhagyva"; case "pending": return "Függőben"; case "rejected": return "Elutasítva"; default: return "Ismeretlen"; } } function statusDescription(status) { switch (status) { case "approved": return "A szolgáltató aktív és látható a felhasználók számára."; case "pending": return "A szolgáltató még nem lett jóváhagyva, moderálásra vár."; case "rejected": return "A szolgáltató elutasításra került, nem látható a felhasználók számára."; default: return ""; } } function vehicleClassLabel(key) { const labels = { car: "Személyautó", motorcycle: "Motorkerékpár", truck: "Teherautó", hgv: "Nehézgépjármű (HGV)", light_commercial: "Kishaszonjármű", personal: "Személyes", boat: "Csónak/Vízi", other: "Egyéb" }; return labels[key] || key; } function validationTypeLabel(type) { const labels = { phone_verified: "Telefon igazolt", email_verified: "Email igazolt", address_verified: "Cím igazolt", website_verified: "Weboldal igazolt", manual_review: "Kézi ellenőrzés", community_vouch: "Közösségi ajánlás", business_hours: "Nyitvatartás ellenőrzött", photo_evidence: "Fénykép bizonyíték" }; return labels[type] || type; } function validationTypeClass(type) { const classes = { phone_verified: "bg-emerald-500/20 text-emerald-400", email_verified: "bg-blue-500/20 text-blue-400", address_verified: "bg-amber-500/20 text-amber-400", website_verified: "bg-purple-500/20 text-purple-400", manual_review: "bg-indigo-500/20 text-indigo-400", community_vouch: "bg-pink-500/20 text-pink-400", business_hours: "bg-cyan-500/20 text-cyan-400", photo_evidence: "bg-orange-500/20 text-orange-400" }; return classes[type] || "bg-slate-500/20 text-slate-400"; } function historyActionLabel(action) { const labels = { approve: "Jóváhagyás", reject: "Elutasítás", restore: "Visszaállítás", flag: "Megjelölés", update: "Módosítás", delete: "Törlés", create: "Létrehozás" }; return labels[action] || action; } function historyActionClass(action) { const classes = { approve: "bg-emerald-500/20 text-emerald-400", reject: "bg-rose-500/20 text-rose-400", restore: "bg-blue-500/20 text-blue-400", flag: "bg-purple-500/20 text-purple-400", update: "bg-amber-500/20 text-amber-400", delete: "bg-red-500/20 text-red-400", create: "bg-green-500/20 text-green-400" }; return classes[action] || "bg-slate-500/20 text-slate-400"; } function historyDotClass(action) { const classes = { approve: "border-emerald-500 bg-emerald-500/30", reject: "border-rose-500 bg-rose-500/30", restore: "border-blue-500 bg-blue-500/30", flag: "border-purple-500 bg-purple-500/30", update: "border-amber-500 bg-amber-500/30", delete: "border-red-500 bg-red-500/30", create: "border-green-500 bg-green-500/30" }; return classes[action] || "border-slate-500 bg-slate-500/30"; } function formatDate(dateStr) { if (!dateStr) return "—"; try { const d = new Date(dateStr); return d.toLocaleDateString("hu-HU", { year: "numeric", month: "short", day: "numeric", hour: "2-digit", minute: "2-digit" }); } catch { return dateStr; } } function getHeaders() { const token = useCookie("access_token").value; const headers = { "Content-Type": "application/json" }; if (token) headers["Authorization"] = `Bearer ${token}`; return headers; } async function fetchValidations() { validationsLoading.value = true; try { const res = await $fetch(`/api/v1/admin/providers/${route.params.id}/validations`, { headers: getHeaders() }); validations.value = res || []; } catch (err) { console.error("Failed to fetch validations:", err); validations.value = []; } finally { validationsLoading.value = false; } } async function fetchHistory() { historyLoading.value = true; try { const res = await $fetch(`/api/v1/admin/providers/${route.params.id}/history`, { headers: getHeaders() }); history.value = res || []; } catch (err) { console.error("Failed to fetch history:", err); history.value = []; } finally { historyLoading.value = false; } } function onTabChange(tab) { if (tab === "validations" && validations.value.length === 0) { fetchValidations(); } if (tab === "history" && history.value.length === 0) { fetchHistory(); } } watch(activeTab, onTabChange); return (_ctx, _push, _parent, _attrs) => { const _component_NuxtLink = __nuxt_component_0; _push(`
Szolgáltató #${ssrInterpolate(_ctx.$route.params.id)}
Hiba történt a szolgáltató betöltése közben.
A szolgáltató nem található.
${ssrInterpolate(statusLabel(provider.value.status))}
${ssrInterpolate(statusDescription(provider.value.status))}
${ssrInterpolate(provider.value.source)}Nincsenek kategóriák beállítva
`); } _push(`Nincsenek járműosztályok beállítva
`); } _push(`Nincsenek specializációk beállítva
`); } _push(`| Nap | Nyitva |
|---|---|
| ${ssrInterpolate(day.label)} | `); if (getDayHours(day.key)) { _push(`${ssrInterpolate(getDayHours(day.key)?.open)}–${ssrInterpolate(getDayHours(day.key)?.close)}`); } else { _push(`Zárva`); } _push(` |
Nincs beállítva nyitvatartás
A szolgáltató ${ssrInterpolate(provider.value.status === "rejected" ? "elutasításra" : "megjelölésre")} került.
`); _push(ssrRenderComponent(_component_NuxtLink, { to: `/providers/${provider.value.id}/edit`, class: "w-full px-4 py-3 bg-indigo-600 hover:bg-indigo-500 text-white rounded-lg text-sm font-medium transition flex items-center justify-center gap-2" }, { default: withCtx((_, _push2, _parent2, _scopeId) => { if (_push2) { _push2(` Szerkesztés `); } else { return [ (openBlock(), createBlock("svg", { class: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24" }, [ createVNode("path", { "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", d: "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" }) ])), createTextVNode(" Szerkesztés ") ]; } }), _: 1 }, _parent)); if (provider.value.status === "rejected") { _push(``); } else { _push(``); } _push(`Módosítsd a szolgáltató státuszát és validációs pontszámát.
A szolgáltatóhoz tartozó gamification validációs bejegyzések listája.
`); if (validationsLoading.value) { _push(``); } else if (validations.value.length === 0) { _push(`Nincsenek validációs bejegyzések ehhez a szolgáltatóhoz.
Szavazó: ${ssrInterpolate(v.voter_name || `User #${v.voter_user_id}`)}
`); if (v.validation_metadata?.reason) { _push(`Indoklás: ${ssrInterpolate(v.validation_metadata.reason)}
`); } else { _push(``); } _push(`Idővonal: ki, mikor és mit változtatott a szolgáltatóval kapcsolatban.
`); if (historyLoading.value) { _push(``); } else if (history.value.length === 0) { _push(`Nincsenek előzmények ehhez a szolgáltatóhoz.
Biztosan elutasítod a(z) ${ssrInterpolate(provider.value?.name)} szolgáltatót?
Biztosan megjelölöd a(z) ${ssrInterpolate(provider.value?.name)} szolgáltatót?