import { defineComponent, useSSRContext, computed, ref, reactive, createVNode, resolveDynamicComponent } from "vue"; import { ssrRenderAttrs, ssrRenderClass, ssrIncludeBooleanAttr, ssrInterpolate, ssrRenderList, ssrRenderComponent, ssrRenderVNode, ssrRenderAttr, ssrLooseContain } 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" }, { key: "hours", label: "Nyitvatartás", 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: [] }, opening_hours: {}, is_always_open: false }); const hasChanges = computed(() => { if (!provider.value) return false; const p = provider.value; if (form.name !== (p.name || "")) return true; if (form.address !== (p.address || "")) return true; if (form.city !== (p.city || "")) return true; if (form.address_zip !== (p.address_zip || "")) return true; if (form.address_street_name !== (p.address_street_name || "")) return true; if (form.address_street_type !== (p.address_street_type || "")) return true; if (form.address_house_number !== (p.address_house_number || "")) return true; if (form.plus_code !== (p.plus_code || "")) return true; if (form.contact_phone !== (p.contact_phone || "")) return true; if (form.contact_email !== (p.contact_email || "")) return true; if (form.website !== (p.website || "")) return true; if (form.category !== (p.category || "")) return true; const sortedFormCategories = [...form.category_ids].sort(); const sortedOrigCategories = [...p.category_ids || []].sort(); if (JSON.stringify(sortedFormCategories) !== JSON.stringify(sortedOrigCategories)) return true; const sortedFormClasses = [...form.supported_vehicle_classes].sort(); const sortedOrigClasses = [...p.supported_vehicle_classes || []].sort(); if (JSON.stringify(sortedFormClasses) !== JSON.stringify(sortedOrigClasses)) return true; const normalizeSpec = (spec) => ({ brands: Array.isArray(spec?.brands) ? [...spec.brands].sort() : [], propulsion: Array.isArray(spec?.propulsion) ? [...spec.propulsion].sort() : [] }); if (JSON.stringify(normalizeSpec(form.specializations)) !== JSON.stringify(normalizeSpec(p.specializations))) return true; const DAYS2 = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]; const normalizeHours = (hours) => { const result = {}; const daysSource = hours?.days || hours; for (const day of DAYS2) { const slot = daysSource?.[day]; if (slot && typeof slot === "object" && slot.open && slot.close) { result[day] = { open: slot.open, close: slot.close }; } else { result[day] = null; } } return result; }; if (JSON.stringify(normalizeHours(form.opening_hours)) !== JSON.stringify(normalizeHours(p.opening_hours))) return true; if (form.is_always_open !== (p.opening_hours?.always_open === true)) return true; return false; }); 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); } 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" } ]; 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(`
Szolgáltató betöltése...
`); } 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(`

Alapadatok

${ssrInterpolate(provider.value.source)}

Elérhetőség

`); } 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.

A Járműosztályok (Vehicle Classes)

Mely járműtípusokat szervizeli a szolgáltató?

`); ssrRenderList(VEHICLE_CLASSES, (vc) => { _push(``); }); _push(`

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(`
Kategóriák betöltése...
`); } 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(`
Hozzáad
`); ssrRenderList(form.specializations.propulsion, (prop, idx) => { _push(`${ssrInterpolate(prop)} `); }); _push(`
Hozzáad
`); } else { _push(``); } if (activeTab.value === "location") { _push(`

Cím adatok

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

Nyitvatartás

Állítsd be a szolgáltató nyitvatartási idejét napokra bontva.

`); ssrRenderList(DAYS, (day) => { _push(`
`); if (form.opening_hours[day.key]) { _push(`
`); } else { _push(`Zárva`); } _push(`
`); }); _push(`
`); } else { _push(``); } _push(`
`); if (hasChanges.value) { _push(`● Módosítások el nem mentve`); } else { _push(`Nincs változás`); } _push(`
`); if (saveLoading.value) { _push(``); } else { _push(``); } _push(` Mentés
`); } 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-4a0954df"]]); export { edit as default }; //# sourceMappingURL=edit-DQMBygGu.js.map