import { _ as __nuxt_component_0 } from "./nuxt-link-1NBbHb-h.js";
import { defineComponent, useSSRContext, ref, computed, watch, createVNode, resolveDynamicComponent, withCtx, openBlock, createBlock, createTextVNode } from "vue";
import { ssrRenderAttrs, ssrRenderList, ssrInterpolate, ssrRenderComponent, ssrRenderClass, ssrRenderVNode, ssrRenderStyle, ssrRenderAttr, ssrIncludeBooleanAttr, 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$1 = /* @__PURE__ */ defineComponent({
__name: "RawDataViewer",
__ssrInlineRender: true,
props: {
data: {}
},
setup(__props) {
function isEmpty(obj) {
if (!obj || typeof obj !== "object") return true;
return Object.keys(obj).length === 0;
}
function objectKeys(obj) {
if (!obj || typeof obj !== "object") return "{ }";
const keys = Object.keys(obj);
if (keys.length === 0) return "{ üres }";
return `{ ${keys.length} kulcs }`;
}
return (_ctx, _push, _parent, _attrs) => {
const _component_RawDataViewer = _sfc_main$1;
_push(`
`);
if (!__props.data || isEmpty(__props.data)) {
_push(`
`);
} else {
_push(`
`);
ssrRenderList(__props.data, (value, key) => {
_push(`
${ssrInterpolate(key)}`);
if (value === null || value === void 0) {
_push(`
null`);
} else if (typeof value === "string") {
_push(`
"${ssrInterpolate(value)}" `);
} else if (typeof value === "number" || typeof value === "boolean") {
_push(`
${ssrInterpolate(value)}`);
} else if (Array.isArray(value)) {
_push(`
`);
if (value.length === 0) {
_push(`
[]`);
} else {
_push(`
Array [${ssrInterpolate(value.length)}]
`);
ssrRenderList(value, (item, idx) => {
_push(`
[${ssrInterpolate(idx)}]`);
if (typeof item === "object" && item !== null) {
_push(``);
_push(ssrRenderComponent(_component_RawDataViewer, { data: item }, null, _parent));
_push(``);
} else if (typeof item === "string") {
_push(`"${ssrInterpolate(item)}"`);
} else {
_push(`${ssrInterpolate(item)}`);
}
_push(`
`);
});
_push(`
`);
}
_push(`
`);
} else if (typeof value === "object") {
_push(`
Object ${ssrInterpolate(objectKeys(value))}
`);
_push(ssrRenderComponent(_component_RawDataViewer, { data: value }, null, _parent));
_push(`
`);
} else {
_push(`
${ssrInterpolate(String(value))}`);
}
_push(`
`);
});
_push(`
`);
}
_push(`
`);
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/RawDataViewer.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
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: "crawler", label: "Crawler / Nyers Adatok", 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 trustScoreBadgeClass = computed(() => {
const score = provider.value?.trust_score;
if (score === null || score === void 0) return "bg-slate-700 text-slate-400";
if (score > 80) return "bg-emerald-500/20 text-emerald-400 border border-emerald-500/30";
if (score > 50) return "bg-amber-500/20 text-amber-400 border border-amber-500/30";
return "bg-rose-500/20 text-rose-400 border border-rose-500/30";
});
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;
const _component_RawDataViewer = _sfc_main$1;
_push(`Szolgáltató részletek
Szolgáltató #${ssrInterpolate(_ctx.$route.params.id)}
`);
if (loading.value) {
_push(`
`);
} else if (error.value) {
_push(`
Hiba történt a szolgáltató betöltése közben.
`);
} else if (!provider.value) {
_push(`
A szolgáltató nem található.
`);
} 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év
- ${ssrInterpolate(provider.value.name)}
- Kategória
- ${ssrInterpolate(provider.value.category || "—")}
- Forrás
${ssrInterpolate(provider.value.source)}- Validációs pontszám
= 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-5941cb1d>
${ssrInterpolate(provider.value.validation_score)}- Létrehozva
- ${ssrInterpolate(formatDate(provider.value.created_at))}
- Beküldő user ID
- ${ssrInterpolate(provider.value.added_by_user_id || "—")}
Cím adatok
- Teljes cím
- ${ssrInterpolate(provider.value.address || "—")}
- Város
- ${ssrInterpolate(provider.value.city || "—")}
- Irányítószám
- ${ssrInterpolate(provider.value.address_zip || "—")}
- Utca
- ${ssrInterpolate(provider.value.address_street_name || "—")}
- Házszám
- ${ssrInterpolate(provider.value.address_house_number || "—")}
- Plus Code
- ${ssrInterpolate(provider.value.plus_code || "—")}
Elérhetőség
- Telefon
- ${ssrInterpolate(provider.value.contact_phone || "—")}
- Email
- ${ssrInterpolate(provider.value.contact_email || "—")}
Szolgáltatások
`);
if (provider.value.category_ids && provider.value.category_ids.length > 0) {
_push(`
`);
ssrRenderList(provider.value.category_ids, (catId) => {
_push(` #${ssrInterpolate(catId)}`);
});
_push(`
`);
} else {
_push(`
Nincsenek kategóriák beállítva
`);
}
_push(`
Járműosztályok
`);
if (provider.value.supported_vehicle_classes && provider.value.supported_vehicle_classes.length > 0) {
_push(`
`);
ssrRenderList(provider.value.supported_vehicle_classes, (vc) => {
_push(`${ssrInterpolate(vehicleClassLabel(vc))}`);
});
_push(`
`);
} else {
_push(`
Nincsenek járműosztályok beállítva
`);
}
_push(`
Specializációk
`);
if (hasSpecializations.value) {
_push(`
`);
if (provider.value.specializations?.brands?.length) {
_push(`
Márkák
`);
ssrRenderList(provider.value.specializations.brands, (brand) => {
_push(`${ssrInterpolate(brand)}`);
});
_push(`
`);
} else {
_push(``);
}
if (provider.value.specializations?.propulsion?.length) {
_push(`
Hajtáslánc
`);
ssrRenderList(provider.value.specializations.propulsion, (prop) => {
_push(`${ssrInterpolate(prop)}`);
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
} else {
_push(`
Nincsenek specializációk beállítva
`);
}
_push(`
Nyitvatartás
`);
if (hasOpeningHours.value) {
_push(`
| Nap | Nyitva |
`);
ssrRenderList(DAYS, (day) => {
_push(`| ${ssrInterpolate(day.label)} | `);
if (getDayHours(day.key)) {
_push(`${ssrInterpolate(getDayHours(day.key)?.open)}–${ssrInterpolate(getDayHours(day.key)?.close)}`);
} else {
_push(`Zárva`);
}
_push(` |
`);
});
_push(`
`);
} else {
_push(`
Nincs beállítva nyitvatartás
`);
}
_push(`
Moderációs műveletek
`);
if (provider.value.status === "pending") {
_push(`
`);
} 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é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));
_push(`
`);
} else {
_push(`
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(`
`);
}
_push(`
`);
if (provider.value.evidence_image_path) {
_push(`
Bizonyíték kép
![Evidence]()
`);
} else {
_push(``);
}
_push(`
`);
} else {
_push(``);
}
if (activeTab.value === "status") {
_push(`
Státusz kezelés
Módosítsd a szolgáltató státuszát és validációs pontszámát.
`);
} else {
_push(``);
}
if (activeTab.value === "validations") {
_push(`
Gamification Validációk
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.
`);
} else {
_push(`
`);
ssrRenderList(validations.value, (v) => {
_push(`
${ssrInterpolate(validationTypeLabel(v.validation_type))}súly: ${ssrInterpolate(v.weight)}
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(`
${ssrInterpolate(formatDate(v.created_at))}
`);
});
_push(`
`);
}
_push(`
`);
} else {
_push(``);
}
if (activeTab.value === "crawler") {
_push(`
Crawler / Nyers Adatok
A robot által begyűjtött nyers adatok és metaadatok.
Forrás:${ssrInterpolate(provider.value.source || "—")}
Trust Score:${ssrInterpolate(provider.value.trust_score ?? "—")}
`);
if (provider.value.rejection_reason) {
_push(`
Elutasítás indoklása
${ssrInterpolate(provider.value.rejection_reason)}
`);
} else {
_push(``);
}
_push(`
Nyers adatok (raw_data)
`);
_push(ssrRenderComponent(_component_RawDataViewer, {
data: provider.value.raw_data
}, null, _parent));
_push(`
`);
if (provider.value.audit_trail && Object.keys(provider.value.audit_trail).length > 0) {
_push(`
Audit Trail
`);
_push(ssrRenderComponent(_component_RawDataViewer, {
data: provider.value.audit_trail
}, null, _parent));
_push(`
`);
} else {
_push(``);
}
_push(`
`);
} else {
_push(``);
}
if (activeTab.value === "history") {
_push(`
Állapotváltoztatások előzményei
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.
`);
} else {
_push(`
`);
ssrRenderList(history.value, (entry, index2) => {
_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átusz:${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ás: ${ssrInterpolate(entry.new_data.reason)}
`);
} else {
_push(``);
}
if (entry.new_data.changes) {
_push(`
Részletes változások
`);
ssrRenderList(entry.new_data.changes, (value, key) => {
_push(`
${ssrInterpolate(key)}:${ssrInterpolate(value ?? "—")}
`);
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
} else {
_push(``);
}
if (entry.old_data) {
_push(`
Régi adatok
`);
ssrRenderList(entry.old_data, (value, key) => {
_push(`
${ssrInterpolate(key)}:${ssrInterpolate(value ?? "—")}
`);
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
});
_push(`
`);
}
_push(`
`);
} else {
_push(``);
}
_push(``);
}
if (showRejectModal.value) {
_push(`
Szolgáltató elutasítása
Biztosan elutasítod a(z) ${ssrInterpolate(provider.value?.name)} szolgáltatót?
`);
} else {
_push(``);
}
if (showFlagModal.value) {
_push(`
Szolgáltató megjelölése
Biztosan megjelölöd a(z) ${ssrInterpolate(provider.value?.name)} szolgáltatót?
`);
} 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]/index.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5941cb1d"]]);
export {
index as default
};
//# sourceMappingURL=index-DX46mH0u.js.map