import{L as y}from"./Layout-DIVdUaBZ.js";import{T as k}from"./TextInput-DDvOh0mT.js";import{S as h}from"./SelectInput-CJrVPIBV.js";import{T as x}from"./TextareaInput-CYfXtUDA.js";import{L as v}from"./LoadingButton-DQHYFAIm.js";import{i as T,Z as V,r as s,c as d,a as i,b as r,d as L,w as p,t as m,o as u,F as C,j as U,e as I}from"./app-CK3cEAAe.js";import{_ as B,C as E,B as S,E as H,I as A,M as D,P as F,U as M,H as N,a as P,L as R,b as j,T as Q,c as q,d as O,e as Z,f as z,g as b}from"./UploadAdapter-DaiRSwB-.js";import{_ as G}from"./FlashMessages-ByEdcHWZ.js";import"./moment-BywspGD9.js";import"./v4-SoommWqA.js";const J={components:{LoadingButton:v,SelectInput:h,TextareaInput:x,TextInput:k,Link:T,Head:V,Ckeditor:B},layout:y,props:{knowledge_base:Object,title:String,types:Array},remember:"form",data(){return{editor:E,editorConfig:{plugins:[S,H,A,D,F,M,N,P,R,j,Q,q,O,Z,z],toolbar:["heading","|","bold","italic","link","bulletedList","numberedList","|","outdent","indent","|","insertTable","blockQuote","|","imageUpload","mediaEmbed","|","undo","redo"],table:{toolbar:["tableColumn","tableRow","mergeTableCells"]},extraPlugins:[function(e){e.plugins.get("FileRepository").createUploadAdapter=a=>new b(a)}]},form:this.$inertia.form({title:this.knowledge_base.title,type_id:this.knowledge_base.type_id,details:this.knowledge_base.details})}},methods:{update(){this.form.post(this.route("knowledge_base.update",this.knowledge_base.id))},uploader(l){l.plugins.get("FileRepository").createUploadAdapter=e=>new b(e)},destroy(){confirm("Are you sure you want to delete this knowledge base?")&&this.$inertia.delete(this.route("knowledge_base.destroy",this.knowledge_base.id))}}},K={class:"bg-white rounded-md shadow overflow-hidden max-w-full"},W={class:"p-8 -mr-6 -mb-8 flex flex-wrap"},X={value:null},Y=["value"],$={class:"pr-6 pb-8 w-full"},ee={class:"form-label"},te={class:"px-8 py-4 bg-gray-50 border-t border-gray-100 flex items-center"};function oe(l,e,a,re,o,n){const f=s("Head"),g=s("text-input"),c=s("select-input"),_=s("ckeditor"),w=s("loading-button");return u(),d("div",null,[i(f,{title:a.title},null,8,["title"]),r("div",K,[r("form",{onSubmit:e[4]||(e[4]=L((...t)=>n.update&&n.update(...t),["prevent"]))},[r("div",W,[i(g,{modelValue:o.form.title,"onUpdate:modelValue":e[0]||(e[0]=t=>o.form.title=t),error:o.form.errors.title,class:"pr-6 pb-8 w-full lg:w-1/2",label:l.$t("Title")},null,8,["modelValue","error","label"]),i(c,{modelValue:o.form.type_id,"onUpdate:modelValue":e[1]||(e[1]=t=>o.form.type_id=t),error:o.form.errors.type_id,class:"pr-6 pb-8 w-full lg:w-1/3",label:l.$t("Ticket Type"),required:!0},{default:p(()=>[r("option",X,m(l.$t("Select type")),1),(u(!0),d(C,null,U(a.types,t=>(u(),d("option",{key:t.id,value:t.id},m(t.name),9,Y))),128))]),_:1},8,["modelValue","error","label"]),r("div",$,[r("label",ee,m(l.$t("Details"))+":",1),i(_,{id:"kbDetails",editor:o.editor,modelValue:o.form.details,"onUpdate:modelValue":e[2]||(e[2]=t=>o.form.details=t),error:o.form.errors.details,config:o.editorConfig},null,8,["editor","modelValue","error","config"])])]),r("div",te,[r("button",{class:"text-red-600 hover:underline",tabindex:"-1",type:"button",onClick:e[3]||(e[3]=(...t)=>n.destroy&&n.destroy(...t))},"Delete knowledge base"),i(w,{loading:o.form.processing,class:"btn-indigo ml-auto",type:"submit"},{default:p(()=>e[5]||(e[5]=[I("Update knowledge base")])),_:1},8,["loading"])])],32)])])}const fe=G(J,[["render",oe]]);export{fe as default};
