import{b as c,j as e}from"./vendor-BKmmeuxg.js";import{I as i}from"./input-error-LaPr_4wd.js";import{L as m}from"./loading-button-BnTVAMJ7.js";import{I as h}from"./input-DM0goJrn.js";import{T as j}from"./textarea-CyndvowL.js";import{o as u}from"./inertia-SZXqLvQm.js";import"./utils-DxSsnXxD.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.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};
