import { defineComponent, useSSRContext, computed, ref, reactive, createVNode, resolveDynamicComponent } from "vue";
import { ssrRenderAttrs, ssrRenderClass, ssrIncludeBooleanAttr, ssrInterpolate, ssrRenderList, ssrRenderComponent, ssrRenderVNode, ssrRenderAttr } from "vue/server-renderer";
import { useRoute, useRouter } from "vue-router";
import "/app/node_modules/klona/dist/index.mjs";
import "/app/node_modules/hookable/dist/index.mjs";
import "../server.mjs";
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
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$1 = /* @__PURE__ */ defineComponent({
__name: "TreeNode",
__ssrInlineRender: true,
props: {
node: {},
selectedIds: {},
expandedIds: {}
},
emits: ["toggle", "toggle-expand"],
setup(__props) {
return (_ctx, _push, _parent, _attrs) => {
const _component_TreeNode = _sfc_main$1;
_push(`
`);
if (__props.expandedIds.has(__props.node.id) && __props.node.children?.length) {
_push(`
`);
ssrRenderList(__props.node.children, (child) => {
_push(`
`);
_push(ssrRenderComponent(_component_TreeNode, {
node: child,
"selected-ids": __props.selectedIds,
"expanded-ids": __props.expandedIds,
onToggle: (id) => _ctx.$emit("toggle", id),
onToggleExpand: (id) => _ctx.$emit("toggle-expand", id)
}, null, _parent));
_push(`
`);
});
_push(`
`);
} else {
_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/TreeNode.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "edit",
__ssrInlineRender: true,
setup(__props) {
const VEHICLE_CLASSES = [
{ key: "car", label: "Személyautó" },
{ key: "motorcycle", label: "Motorkerékpár" },
{ key: "truck", label: "Teherautó" },
{ key: "hgv", label: "Nehézgépjármű (HGV)" },
{ key: "light_commercial", label: "Kishaszonjármű" },
{ key: "personal", label: "Személyes" },
{ key: "boat", label: "Csónak/Vízi" },
{ key: "other", label: "Egyéb" }
];
const route = useRoute();
useRouter();
computed(() => Number(route.params.id));
const loading = ref(true);
const error = ref(false);
const provider = ref(null);
const saveLoading = ref(false);
const toast = ref(null);
const activeTab = ref("basic");
const tabs = [
{ key: "basic", label: "Alapadatok & Kapcsolat", icon: "svg" },
{ key: "matrix", label: "Szolgáltatások & Járművek", icon: "svg" },
{ key: "location", label: "Helyszín & Lokáció", icon: "svg" }
];
const categoryTree = ref([]);
const treeLoading = ref(false);
const expandedNodes = ref(/* @__PURE__ */ new Set());
const brandInput = ref("");
const propulsionInput = ref("");
const form = reactive({
name: "",
address: "",
city: "",
address_zip: "",
address_street_name: "",
address_street_type: "",
address_house_number: "",
plus_code: "",
contact_phone: "",
contact_email: "",
website: "",
category: "",
category_ids: [],
supported_vehicle_classes: [],
specializations: {
brands: [],
propulsion: []
}
});
const hasChanges = computed(() => {
if (!provider.value) return false;
const p = provider.value;
return form.name !== (p.name || "") || form.city !== (p.city || "") || form.address_zip !== (p.address_zip || "") || form.address_street_name !== (p.address_street_name || "") || form.address_house_number !== (p.address_house_number || "") || form.plus_code !== (p.plus_code || "") || form.contact_phone !== (p.contact_phone || "") || form.contact_email !== (p.contact_email || "") || form.website !== (p.website || "") || form.category !== (p.category || "") || JSON.stringify(form.category_ids.sort()) !== JSON.stringify((p.category_ids || []).sort()) || JSON.stringify(form.supported_vehicle_classes.sort()) !== JSON.stringify((p.supported_vehicle_classes || []).sort()) || JSON.stringify(form.specializations) !== JSON.stringify(p.specializations || { brands: [], propulsion: [] });
});
function findCategoryById(id, nodes) {
for (const node of nodes) {
if (node.id === id) return node;
if (node.children?.length) {
const found = findCategoryById(id, node.children);
if (found) return found;
}
}
return null;
}
function getCategoryName(id) {
const node = findCategoryById(id, categoryTree.value);
if (!node) return `#${id}`;
return node.name_hu || node.name_en || node.key;
}
function toggleCategory(id) {
const idx = form.category_ids.indexOf(id);
if (idx >= 0) {
form.category_ids.splice(idx, 1);
} else {
form.category_ids.push(id);
}
}
function toggleTreeNode(id) {
const newSet = new Set(expandedNodes.value);
if (newSet.has(id)) {
newSet.delete(id);
} else {
newSet.add(id);
}
expandedNodes.value = newSet;
}
function isCategorySelected(id) {
return form.category_ids.includes(id);
}
return (_ctx, _push, _parent, _attrs) => {
const _component_TreeNode = _sfc_main$1;
_push(`Szolgáltató szerkesztése
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 (activeTab.value === "basic") {
_push(`
`);
} else {
_push(``);
}
if (activeTab.value === "matrix") {
_push(`
3D Képesség Mátrix
Állítsd be, hogy a szolgáltató milyen járműosztályokhoz, szolgáltatási kategóriákhoz és specializációkhoz tartozik.
B Szolgáltatási Kategóriák (Expertise Tags)
Válaszd ki a szolgáltatóhoz tartozó kategóriákat a hierarchikus fából.
`);
if (treeLoading.value) {
_push(`
`);
} else {
_push(`
`);
ssrRenderList(categoryTree.value, (node) => {
_push(`
`);
if (expandedNodes.value.has(node.id) && node.children?.length) {
_push(`
`);
ssrRenderList(node.children, (child) => {
_push(`
`);
_push(ssrRenderComponent(_component_TreeNode, {
node: child,
"selected-ids": form.category_ids,
"expanded-ids": expandedNodes.value,
onToggle: toggleCategory,
onToggleExpand: toggleTreeNode
}, null, _parent));
_push(`
`);
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
});
_push(`
`);
}
if (form.category_ids.length > 0) {
_push(`
`);
ssrRenderList(form.category_ids, (id) => {
_push(`
${ssrInterpolate(getCategoryName(id))} `);
});
_push(`
`);
} else {
_push(``);
}
_push(`
C Specializációk
Adj meg speciális márkákat, hajtáslánc típusokat vagy egyéb címkéket.
`);
ssrRenderList(form.specializations.brands, (brand, idx) => {
_push(`
${ssrInterpolate(brand)} `);
});
_push(`
`);
ssrRenderList(form.specializations.propulsion, (prop, idx) => {
_push(`
${ssrInterpolate(prop)} `);
});
_push(`
`);
} else {
_push(``);
}
if (activeTab.value === "location") {
_push(`
`);
} else {
_push(``);
}
_push(`
`);
if (hasChanges.value) {
_push(`● Módosítások el nem mentve`);
} else {
_push(`Nincs változás`);
}
_push(`
`);
}
if (toast.value) {
_push(`
${ssrInterpolate(toast.value.message)}
`);
} 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]/edit.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const edit = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-03c94385"]]);
export {
edit as default
};
//# sourceMappingURL=edit-Db3uK3sd.js.map