import{d as $,s as u,h as f,o as d,g as t,u as a,i as V,w as l,j as s,l as r,F as p,p as k,a as w,k as _,W as y}from"./app-Cb9hmj6k.js";import{_ as C,a as B}from"./AppLayout.vue_vue_type_script_setup_true_lang-CteAxl0C.js";import{_ as h}from"./Input.vue_vue_type_script_setup_true_lang-t_rUv_4v.js";import{_ as c}from"./AppLogoIcon.vue_vue_type_script_setup_true_lang-DKWl2XLX.js";import{_ as F,a as N,b as j,c as E,d as v}from"./SelectValue.vue_vue_type_script_setup_true_lang-M4K1TtwN.js";import{t as b}from"./index-bRFR14ax.js";import"./index-hboZUdbT.js";import"./RovingFocusGroup-CP1IPgEn.js";import"./useNonce-BuzWsQ_M.js";import"./check-D0NY03TT.js";import"./ohash.D__AXeF1-DHF4M4F_.js";import"./useFormControl-C9xJ2-eV.js";const S={class:"p-4 max-w-xl mx-auto"},U={class:"space-y-4 bg-white p-6 rounded-xl border shadow-sm"},W={class:"space-y-2"},D={class:"space-y-2"},L={class:"flex justify-between pt-4"},R=$({__name:"Create",props:{categories:{}},setup(T){const i=u({name:"",parent_id:null}),n=u(!1),x=[{title:"Панель управления",href:"/dashboard"},{title:"Документация",href:"/documentation"},{title:"Категории",href:"/documentation/categories"},{title:"Создание",href:""}];function g(){n.value=!0,y.post("/documentation/categories",i.value,{onSuccess:()=>{b.success("Категория создана")},onError:()=>{b.error("Ошибка создания")},onFinish:()=>{n.value=!1}})}return(m,e)=>(d(),f(p,null,[t(a(V),{title:"Создание категории"}),t(B,{breadcrumbs:x},{default:l(()=>[t(a(C)),s("div",S,[e[7]||(e[7]=s("div",{class:"mb-6"},[s("h1",{class:"text-2xl font-bold"}," Новая категория "),s("p",{class:"text-sm text-muted-foreground"}," Создание категории для базы знаний ")],-1)),s("div",U,[s("div",W,[e[3]||(e[3]=s("label",{class:"text-sm font-medium"},"Название",-1)),t(a(h),{modelValue:i.value.name,"onUpdate:modelValue":e[0]||(e[0]=o=>i.value.name=o),placeholder:"Например: Монтаж"},null,8,["modelValue"])]),s("div",D,[e[5]||(e[5]=s("label",{class:"text-sm font-medium"},"Родительская категория",-1)),t(a(F),{modelValue:i.value.parent_id,"onUpdate:modelValue":e[1]||(e[1]=o=>i.value.parent_id=o)},{default:l(()=>[t(a(N),null,{default:l(()=>[t(a(j),{placeholder:"Без родителя"})]),_:1}),t(a(E),null,{default:l(()=>[t(a(v),{value:null},{default:l(()=>e[4]||(e[4]=[r("Без родителя")])),_:1,__:[4]}),(d(!0),f(p,null,k(m.categories,o=>(d(),w(a(v),{key:o.id,value:o.id},{default:l(()=>[r(_(o.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue"])]),s("div",L,[t(a(c),{variant:"outline",onClick:e[2]||(e[2]=o=>m.$inertia.visit("/documentation/categories"))},{default:l(()=>e[6]||(e[6]=[r(" Назад ")])),_:1,__:[6]}),t(a(c),{disabled:n.value,onClick:g},{default:l(()=>[r(_(n.value?"Создание...":"Создать"),1)]),_:1},8,["disabled"])])])])]),_:1})],64))}});export{R as default};
