(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2632],{31381:function(e,s,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/faqs/create",function(){return n(64638)}])},64638:function(e,s,n){"use strict";n.r(s);var t=n(85893),r=n(67294),l=n(9473),i=n(32128),a=n(39332),u=n(86886),c=n(21737),o=n(92401),d=n(68269),h=n(15861),x=n(69417),j=n(44267),f=n(50135),Z=n(5616),v=n(66242);s.default=function(e){let s=(0,l.I0)(),{push:n}=(0,a.useRouter)(),b=(0,l.v9)(i.V_),g=(0,l.v9)(i.R0),p=(0,l.v9)(i.Vp),[_,m]=(0,r.useState)(null),[w,S]=(0,r.useState)(""),[E,P]=(0,r.useState)(""),[C,k]=(0,r.useState)(""),[q,y]=(0,r.useState)("");return(0,r.useEffect)(()=>{s((0,i.xM)(!1))},[p]),(0,r.useEffect)(()=>{!b&&p&&(m("Faq added successfully!"),setTimeout(()=>{n("/faqs")},500))},[p,b]),(0,t.jsxs)(u.ZP,{container:!0,spacing:6,children:[(0,t.jsx)(u.ZP,{item:!0,xs:12,children:(0,t.jsx)(h.Z,{variant:"h5",children:"Create Faq"})}),(0,t.jsx)(u.ZP,{item:!0,xs:12,children:(0,t.jsx)(v.Z,{children:(0,t.jsxs)(j.Z,{children:[_?(0,t.jsxs)(c.Z,{severity:"success",sx:{mb:4},children:[(0,t.jsx)(o.Z,{children:"Success"}),(0,t.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:_})]}):null,g&&g.length>0?(0,t.jsxs)(c.Z,{severity:"error",sx:{mb:4},children:[(0,t.jsx)(o.Z,{children:"Errors"}),g.map((e,s)=>(0,t.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:e},s))]}):null,(0,t.jsx)("form",{onSubmit:e=>{e.preventDefault(),b||s((0,i.nj)({question:w,question_ar:E,answer:C,answer_ar:q}))},children:(0,t.jsxs)(u.ZP,{row:!0,children:[(0,t.jsxs)(u.ZP,{item:!0,xs:12,children:[(0,t.jsxs)(d.Z,{direction:"row",gap:5,children:[(0,t.jsx)(f.Z,{fullWidth:!0,label:"Question",value:w,onChange:e=>S(e.target.value)}),(0,t.jsx)(f.Z,{fullWidth:!0,label:"Question Arabic",value:E,onChange:e=>P(e.target.value)})]}),(0,t.jsxs)(d.Z,{direction:"row",gap:5,children:[(0,t.jsx)(f.Z,{fullWidth:!0,label:"Answer",value:C,onChange:e=>k(e.target.value)}),(0,t.jsx)(f.Z,{fullWidth:!0,label:"Answer Arabic",value:q,onChange:e=>y(e.target.value)})]})]}),(0,t.jsx)(u.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,t.jsx)(x.Z,{type:"submit",variant:"contained",disabled:b,children:b?"Saving":"Save"})})]})})]})})})]})}}},function(e){e.O(0,[2657,315,341,6056,9774,2888,179],function(){return e(e.s=31381)}),_N_E=e.O()}]);