2 lines
1.3 KiB
JavaScript
2 lines
1.3 KiB
JavaScript
import{u as f,b as v,j as e}from"./vendor-BKmmeuxg.js";import{I as l}from"./input-error-LaPr_4wd.js";import{L as d}from"./loading-button-BnTVAMJ7.js";import{I as q}from"./input-DM0goJrn.js";import{T as b}from"./textarea-CyndvowL.js";import{o as m}from"./inertia-SZXqLvQm.js";import"./utils-DxSsnXxD.js";import"./button-BpNwv2aE.js";import"./index-WW_1X1qx.js";const S=({faq:s})=>{const{props:p}=f(),{translate:c}=p,{input:r,button:o}=c,{data:a,setData:n,put:x,delete:h,errors:i,processing:u}=v({question:s?s.question:"",answer:s?s.answer:""}),g=t=>{t.preventDefault(),x(route("faqs.update",{faq:s.id}))},j=()=>{h(route("faqs.destroy",{faq:s.id}))};return e.jsxs("form",{onSubmit:g,className:"space-y-2",children:[e.jsxs("div",{children:[e.jsx(q,{required:!0,type:"text",name:"question",value:a.question||"",placeholder:r.question,onChange:t=>m(t,n)}),e.jsx(l,{message:i.question})]}),e.jsxs("div",{children:[e.jsx(b,{required:!0,name:"answer",value:a.answer||"",placeholder:r.answer,onChange:t=>m(t,n)}),e.jsx(l,{message:i.question})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(d,{type:"button",variant:"outline",loading:u,onClick:j,className:"h-7 w-full bg-red-50 text-xs hover:bg-red-100",children:o.remove}),e.jsx(d,{variant:"secondary",className:"h-7 w-full text-xs",loading:u,children:o.save})]})]})};export{S as default};
|