1import{G as I,j as e,S as D}from"./app-Ha4X7SlF.js";import{A as E}from"./AuthenticatedLayout-BZKUhDrh.js";import{I as n}from"./InputError-Do4kQPnM.js";import{I as c}from"./InputLabel-D410np7F.js";import{P as S}from"./PrimaryButton-Bjn3n3t2.js";import{T as m}from"./TextInput-YH4SiJD7.js";import{Q as x}from"./index-C9bVzuNG.js";/* empty css */import{D as f,T as j}from"./constants-gejEprHZ.js";import"./transition-DszwGdUG.js";import"./Sidebar-BmBFQuN7.js";import"./SvgSwitcher-DH9r9e5c.js";import"./ToastNotification-BhTNdAie.js";import"./_baseIsEqual-CXvocJ9U.js";function U({auth:N,categories:v,languages:A}){const{data:t,setData:a,post:b,processing:_,errors:o,setError:l,reset:y}=I({title:"",description:"",category_id:"",group:"",sort:"",language_id:"",status:"1",title_hi:"",description_hi:""}),g={toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],["link","image","video","formula"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"},{list:"check"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"]]},u=["header","font","size","bold","italic","underline","align","strike","script","blockquote","background","list","bullet","indent","link","image","color","code-block"],p=(s,i)=>{if((i!=0||i=="")&&(s!="sort"||s=="sort"&&i.length<=2)){const r=i&&!isNaN(i)?parseInt(i,10):"";a(s,r===""?"":r.toString()),l(s,r===""||isNaN(r)?`The ${s} must be a valid integer.`:"")}},T=(s,i)=>{if(i.trim()!=""){const r=s.slice(0,f);a("description",r),l("description","")}},w=(s,i)=>{if(i.trim()!=""){const r=s.slice(0,f);a("description_hi",r),l("description_hi","")}},C=()=>{let s=!0;return!t.title||t.title==""?(s=!1,l("title","Title is required.")):t.title.length<3&&(s=!1,l("title","The title must be at least 3 characters.")),!t.description||t.description==""?(s=!1,l("description","Description is required.")):t.description.length<3&&(s=!1,l("description","The description must be at least 3 characters.")),t.sort?isNaN(Number(t.sort))&&(s=!1,l("sort","The sort must be a valid integer.")):(s=!1,l("sort","Sort is required.")),!t.category_id||t.category_id===""?(s=!1,l("category_id","Category is required.")):isNaN(Number(t.category_id))&&(s=!1,l("category_id","The category must be selected.")),s},k=s=>{s.preventDefault(),C()&&b(route("faqs.store"),{onFinish:()=>y()})},q=s=>{if(s.length>0){const i=s.slice(0,j);a("title",i),l("title","")}else a("title",s),l("title","Title is required.")},F=s=>{if(s.length>0){const i=s.slice(0,j);a("title_hi",i),l("title_hi","")}else a("title_hi",s),l("title_hi","Title in hindi is required.")};return e.jsxs(E,{user:N.user,header:e.jsx("h2",{className:"font-semibold text-xl text-gray-800 leading-tight",children:"New FAQ"}),children:[e.jsx(D,{title:"Create FAQ"}),e.jsx("div",{className:"py-4",children:e.jsxs("div",{className:"max-w-8xl mx-auto px-6 lg:px-8 space-y-5",children:[e.jsx("div",{className:"py-2",children:e.jsx("div",{className:"flex justify-between items-center",children:e.jsx("h3",{className:"text-lg font-semibold",children:"New FAQ"})})}),e.jsx("form",{onSubmit:k,children:e.jsxs("div",{className:"flex items-start flex-col lg:flex-row",children:[e.jsxs("div",{className:"p-4 sm:p-8 bg-white shadow sm:rounded-lg w-full lg:w-2/3",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"w-1/2",children:[e.jsx(c,{htmlFor:"title",value:"Title",className:"req-star"}),e.jsx(m,{id:"title",name:"title",value:t.title,className:"mt-1 block w-full",onChange:s=>q(s.target.value)}),e.jsx(n,{message:o.title,className:"mt-2"})]}),e.jsxs("div",{className:"w-1/2",children:[e.jsx(c,{htmlFor:"title_hi",value:"Title in hindi",className:"req-star"}),e.jsx(m,{id:"title_hi",name:"title_hi",value:t.title_hi,className:"mt-1 block w-full",onChange:s=>F(s.target.value)}),e.jsx(n,{message:o.title_hi,className:"mt-2"})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mt-4",children:[e.jsx(c,{htmlFor:"description",value:"Description",className:"req-star"}),e.jsx(x,{value:t.description,onChange:(s,i,r,d)=>{const h=d.getText().trim();T(s,h)},theme:"snow",placeholder:"Compose your description here...",modules:g,formats:u,style:{minHeight:"200px"}})]}),e.jsx("div",{style:{marginTop:"40px"},children:e.jsx(n,{message:o.description,className:"mt-2"})}),e.jsxs("div",{className:"mt-14 max-sm:mt-48 lg:mt-4",children:[e.jsx(c,{htmlFor:"description_hi",className:"mt-4 req-star",value:"Description in hindi"}),e.jsx(x,{value:t.description_hi,onChange:(s,i,r,d)=>{const h=d.getText().trim();w(s,h)},theme:"snow",placeholder:"Compose your description here...",modules:g,formats:u,style:{minHeight:"200px"}})]}),e.jsx("div",{style:{marginTop:"30px"},children:e.jsx(n,{message:o.description_hi,className:"mt-2"})})]})]}),e.jsxs("div",{className:"p-4 sm:p-4 mt-5 lg:mt-0 lg:ml-5 bg-white shadow sm:rounded-lg w-full lg:w-1/3",children:[e.jsxs("div",{className:"mt-4",children:[e.jsx(c,{htmlFor:"group",value:"Group"}),e.jsx(m,{id:"group",name:"group",value:t.group,className:"mt-1 block w-full",onCh
1ange:s=>a("group",s.target.value)}),e.jsx(n,{message:o.group,className:"mt-2"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(c,{htmlFor:"sort",value:"Sort",className:"req-star"}),e.jsx(m,{id:"sort",name:"sort",value:t.sort,className:"mt-1 block w-full",onChange:s=>p("sort",s.target.value)}),e.jsx(n,{message:o.sort,className:"mt-2"})]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(c,{htmlFor:"category_id",value:"Category",className:"req-star"}),e.jsxs("select",{id:"category_id",name:"category_id",value:t.category_id,onChange:s=>p("category_id",s.target.value),className:"mt-1 block w-full border-gray-300 focus:border-indigo-500 focus:ring-indigo-500 rounded-md",children:[e.jsx("option",{value:"",children:"Select a category"}),v.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]}),e.jsx(n,{message:o.category_id,className:"mt-2"})]}),e.jsx("div",{className:"flex items-center justify-end mt-4",children:e.jsx(S,{className:"ms-4",disabled:_,children:"Create FAQ"})})]})]})})]})})]})}export{U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.