import{b as c,j as e}from"./vendor-rThclpOQ.js";import{I as i}from"./input-error-Br4ngfdE.js";import{L as m}from"./loading-button-DKhpmf6V.js";import{I as h}from"./input-BeqyurrI.js";import{T as j}from"./textarea-DM_GyfeP.js";import{o as u}from"./inertia-SZXqLvQm.js";import"./utils-8KAaAB9H.js";import"./button-ZcsoqUQn.js";import"./index-DquVdLUg.js";const I=({faq:s})=>{const{data:t,setData:a,put:l,delete:d,errors:o,processing:n}=c({question:s?s.question:"",answer:s?s.answer:""}),x=r=>{r.preventDefault(),l(route("exam-faqs.update",{exam_faq:s.id}))},p=()=>{d(route("exam-faqs.destroy",{exam_faq:s.id}))};return e.jsxs("form",{onSubmit:x,className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx(h,{required:!0,type:"text",name:"question",value:t.question||"",placeholder:"Enter your question",onChange:r=>u(r,a)}),e.jsx(i,{message:o.question})]}),e.jsxs("div",{children:[e.jsx(j,{required:!0,name:"answer",value:t.answer||"",placeholder:"Enter your answer",onChange:r=>u(r,a)}),e.jsx(i,{message:o.answer})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(m,{type:"button",variant:"outline",loading:n,onClick:p,className:"h-7 w-full bg-red-50 text-xs hover:bg-red-100",children:"Remove"}),e.jsx(m,{variant:"secondary",className:"h-7 w-full text-xs",loading:n,children:"Save"})]})]})};export{I as default};
