import { _ as __nuxt_component_0 } from './nuxt-link-1NBbHb-h.mjs'; 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.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import 'pinia'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'unhead/plugins'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "[id]", __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 showEditModal = ref(false); const editLoading = ref(false); const editForm = 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\xE1tusz", icon: "svg" }, { key: "validations", label: "Valid\xE1ci\xF3k", icon: "svg" }, { key: "history", label: "El\u0151zm\xE9nyek", icon: "svg" } ]; const statusBannerClass = computed(() => { var _a; switch ((_a = provider.value) == null ? void 0 : _a.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(() => { var _a; switch ((_a = provider.value) == null ? void 0 : _a.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(() => { var _a; switch ((_a = provider.value) == null ? void 0 : _a.status) { case "approved": return "text-emerald-400"; case "pending": return "text-amber-400"; default: return "text-rose-400"; } }); const statusSubtextClass = computed(() => { var _a; switch ((_a = provider.value) == null ? void 0 : _a.status) { case "approved": return "text-emerald-400/60"; case "pending": return "text-amber-400/60"; default: return "text-rose-400/60"; } }); function statusLabel(status) { switch (status) { case "approved": return "J\xF3v\xE1hagyva"; case "pending": return "F\xFCgg\u0151ben"; case "rejected": return "Elutas\xEDtva"; default: return "Ismeretlen"; } } function statusDescription(status) { switch (status) { case "approved": return "A szolg\xE1ltat\xF3 akt\xEDv \xE9s l\xE1that\xF3 a felhaszn\xE1l\xF3k sz\xE1m\xE1ra."; case "pending": return "A szolg\xE1ltat\xF3 m\xE9g nem lett j\xF3v\xE1hagyva, moder\xE1l\xE1sra v\xE1r."; case "rejected": return "A szolg\xE1ltat\xF3 elutas\xEDt\xE1sra ker\xFClt, nem l\xE1that\xF3 a felhaszn\xE1l\xF3k sz\xE1m\xE1ra."; default: return ""; } } function validationTypeLabel(type) { const labels = { phone_verified: "Telefon igazolt", email_verified: "Email igazolt", address_verified: "C\xEDm igazolt", website_verified: "Weboldal igazolt", manual_review: "K\xE9zi ellen\u0151rz\xE9s", community_vouch: "K\xF6z\xF6ss\xE9gi aj\xE1nl\xE1s", business_hours: "Nyitvatart\xE1s ellen\u0151rz\xF6tt", photo_evidence: "F\xE9nyk\xE9p bizony\xEDt\xE9k" }; 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\xF3v\xE1hagy\xE1s", reject: "Elutas\xEDt\xE1s", restore: "Vissza\xE1ll\xEDt\xE1s", flag: "Megjel\xF6l\xE9s", update: "M\xF3dos\xEDt\xE1s", delete: "T\xF6rl\xE9s", create: "L\xE9trehoz\xE1s" }; 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 "\u2014"; 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) => { var _a, _b, _c; const _component_NuxtLink = __nuxt_component_0; _push(`

Szolg\xE1ltat\xF3 r\xE9szletek

Szolg\xE1ltat\xF3 #${ssrInterpolate(_ctx.$route.params.id)}

`); if (loading.value) { _push(`
Szolg\xE1ltat\xF3 bet\xF6lt\xE9se...
`); } else if (error.value) { _push(`

Hiba t\xF6rt\xE9nt a szolg\xE1ltat\xF3 bet\xF6lt\xE9se k\xF6zben.

`); } else if (!provider.value) { _push(`

A szolg\xE1ltat\xF3 nem tal\xE1lhat\xF3.

`); } else { _push(`
`); if (provider.value.status === "approved") { _push(``); } else if (provider.value.status === "pending") { _push(``); } else { _push(``); } _push(`

${ssrInterpolate(statusLabel(provider.value.status))}

${ssrInterpolate(statusDescription(provider.value.status))}

`); if (activeTab.value === "data") { _push(`

Alapadatok

N\xE9v
${ssrInterpolate(provider.value.name)}
Kateg\xF3ria
${ssrInterpolate(provider.value.category || "\u2014")}
Forr\xE1s
${ssrInterpolate(provider.value.source)}
Valid\xE1ci\xF3s pontsz\xE1m
= 20 ? "bg-amber-500" : "bg-slate-500", "h-full rounded-full transition-all"])}" style="${ssrRenderStyle({ width: Math.min(provider.value.validation_score, 100) + "%" })}" data-v-cbc29188>
${ssrInterpolate(provider.value.validation_score)}
L\xE9trehozva
${ssrInterpolate(formatDate(provider.value.created_at))}
Bek\xFCld\u0151 user ID
${ssrInterpolate(provider.value.added_by_user_id || "\u2014")}

C\xEDm adatok

Teljes c\xEDm
${ssrInterpolate(provider.value.address || "\u2014")}
V\xE1ros
${ssrInterpolate(provider.value.city || "\u2014")}
Ir\xE1ny\xEDt\xF3sz\xE1m
${ssrInterpolate(provider.value.address_zip || "\u2014")}
Utca
${ssrInterpolate(provider.value.address_street_name || "\u2014")}
H\xE1zsz\xE1m
${ssrInterpolate(provider.value.address_house_number || "\u2014")}
Plus Code
${ssrInterpolate(provider.value.plus_code || "\u2014")}

El\xE9rhet\u0151s\xE9g

Telefon
${ssrInterpolate(provider.value.contact_phone || "\u2014")}
Email
${ssrInterpolate(provider.value.contact_email || "\u2014")}
Weboldal
`); if (provider.value.website) { _push(`${ssrInterpolate(provider.value.website)}`); } else { _push(`\u2014`); } _push(`

Moder\xE1ci\xF3s m\u0171veletek

`); if (provider.value.status === "pending") { _push(`
`); if (actionLoading.value) { _push(``); } else { _push(``); } _push(` J\xF3v\xE1hagy\xE1s Elutas\xEDt\xE1s
`); } else if (provider.value.status === "approved") { _push(`
`); _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\xE9s `); } 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\xE9s ") ]; } }), _: 1 }, _parent)); _push(` Megjel\xF6l\xE9s (Flag) T\xF6rl\xE9s (Soft Delete)
`); } else { _push(`

A szolg\xE1ltat\xF3 ${ssrInterpolate(provider.value.status === "rejected" ? "elutas\xEDt\xE1sra" : "megjel\xF6l\xE9sre")} ker\xFClt.

Szerkeszt\xE9s `); if (provider.value.status === "rejected") { _push(` Vissza\xE1ll\xEDt\xE1s `); } else { _push(``); } _push(` T\xF6rl\xE9s
`); } _push(`
`); if (provider.value.evidence_image_path) { _push(`

Bizony\xEDt\xE9k k\xE9p

`); } else { _push(``); } _push(`
`); } else { _push(``); } if (activeTab.value === "status") { _push(`

St\xE1tusz kezel\xE9s

M\xF3dos\xEDtsd a szolg\xE1ltat\xF3 st\xE1tusz\xE1t \xE9s valid\xE1ci\xF3s pontsz\xE1m\xE1t.

${ssrInterpolate(statusForm.value.validation_score)}
`); } else { _push(``); } if (activeTab.value === "validations") { _push(`

Gamification Valid\xE1ci\xF3k

A szolg\xE1ltat\xF3hoz tartoz\xF3 gamification valid\xE1ci\xF3s bejegyz\xE9sek list\xE1ja.

`); if (validationsLoading.value) { _push(`
`); } else if (validations.value.length === 0) { _push(`

Nincsenek valid\xE1ci\xF3s bejegyz\xE9sek ehhez a szolg\xE1ltat\xF3hoz.

`); } else { _push(`
`); ssrRenderList(validations.value, (v) => { var _a2; _push(`
${ssrInterpolate(validationTypeLabel(v.validation_type))}s\xFAly: ${ssrInterpolate(v.weight)}

Szavaz\xF3: ${ssrInterpolate(v.voter_name || `User #${v.voter_user_id}`)}

`); if ((_a2 = v.validation_metadata) == null ? void 0 : _a2.reason) { _push(`

Indokl\xE1s: ${ssrInterpolate(v.validation_metadata.reason)}

`); } else { _push(``); } _push(`
${ssrInterpolate(formatDate(v.created_at))}
`); }); _push(`
`); } _push(`
`); } else { _push(``); } if (activeTab.value === "history") { _push(`

\xC1llapotv\xE1ltoztat\xE1sok el\u0151zm\xE9nyei

Id\u0151vonal: ki, mikor \xE9s mit v\xE1ltoztatott a szolg\xE1ltat\xF3val kapcsolatban.

`); if (historyLoading.value) { _push(`
`); } else if (history.value.length === 0) { _push(`

Nincsenek el\u0151zm\xE9nyek ehhez a szolg\xE1ltat\xF3hoz.

`); } else { _push(`
`); ssrRenderList(history.value, (entry, index) => { _push(`
${ssrInterpolate(historyActionLabel(entry.action))} User #${ssrInterpolate(entry.user_id || "?")}
${ssrInterpolate(formatDate(entry.timestamp))}
`); if (entry.new_data) { _push(`
`); if (entry.new_data.old_status || entry.new_data.new_status) { _push(`
St\xE1tusz:${ssrInterpolate(entry.new_data.old_status || "?")}${ssrInterpolate(entry.new_data.new_status || "?")}
`); } else { _push(``); } if (entry.new_data.reason && entry.new_data.reason !== "Admin edit") { _push(`
Indokl\xE1s: ${ssrInterpolate(entry.new_data.reason)}
`); } else { _push(``); } if (entry.new_data.changes) { _push(`
R\xE9szletes v\xE1ltoz\xE1sok
`); ssrRenderList(entry.new_data.changes, (value, key) => { _push(`
${ssrInterpolate(key)}:${ssrInterpolate(value != null ? value : "\u2014")}
`); }); _push(`
`); } else { _push(``); } _push(`
`); } else { _push(``); } if (entry.old_data) { _push(`
R\xE9gi adatok
`); ssrRenderList(entry.old_data, (value, key) => { _push(`
${ssrInterpolate(key)}:${ssrInterpolate(value != null ? value : "\u2014")}
`); }); _push(`
`); } else { _push(``); } _push(`
`); }); _push(`
`); } _push(`
`); } else { _push(``); } _push(``); } if (showRejectModal.value) { _push(`

Szolg\xE1ltat\xF3 elutas\xEDt\xE1sa

Biztosan elutas\xEDtod a(z) ${ssrInterpolate((_a = provider.value) == null ? void 0 : _a.name)} szolg\xE1ltat\xF3t?

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

Szolg\xE1ltat\xF3 szerkeszt\xE9se

M\xF3dos\xEDtsd a(z) ${ssrInterpolate((_b = provider.value) == null ? void 0 : _b.name)} szolg\xE1ltat\xF3 adatait.

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

Szolg\xE1ltat\xF3 megjel\xF6l\xE9se

Biztosan megjel\xF6l\xF6d a(z) ${ssrInterpolate((_c = provider.value) == null ? void 0 : _c.name)} szolg\xE1ltat\xF3t?

`); } 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/providers/[id].vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const _id_ = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cbc29188"]]); export { _id_ as default }; //# sourceMappingURL=_id_-YGQP6BWl.mjs.map