(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1050],{97996:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/quotations/create",function(){return n(95435)}])},95435:function(e,t,n){"use strict";n.r(t);var s=n(85893),l=n(67294),i=n(9473),a=n(7112),r=n(39332),u=n(86886),o=n(21737),c=n(92401),d=n(68269),h=n(15861),x=n(69417),j=n(44267),v=n(50135),Z=n(5616),f=n(66242);t.default=function(e){let[t,n]=(0,l.useState)(!1),p=(0,i.I0)(),{push:g}=(0,r.useRouter)(),b=(0,i.v9)(a.V_),m=(0,i.v9)(a.R0),_=(0,i.v9)(a.Vp);(0,i.v9)(a.CJ);let[S,w]=(0,l.useState)(null),[C,P]=(0,l.useState)(""),[E,y]=(0,l.useState)(""),[k,A]=(0,l.useState)(""),[T,W]=(0,l.useState)(""),[N,D]=(0,l.useState)(""),[q,O]=(0,l.useState)(""),[Q,R]=(0,l.useState)(""),[V,X]=(0,l.useState)(1);return(0,l.useEffect)(()=>{w(null)},[]),(0,l.useEffect)(()=>{p((0,a.Fn)({page:V}))},[V]),(0,l.useEffect)(()=>{!b&&_&&t&&(w("Quotation added successfully!"),setTimeout(()=>{w(null)},500),setTimeout(()=>{g("/quotations")},500))},[_,b,t]),(0,s.jsxs)(u.ZP,{container:!0,spacing:6,children:[(0,s.jsx)(u.ZP,{item:!0,xs:12,children:(0,s.jsx)(h.Z,{variant:"h5",children:"Create Quotation"})}),(0,s.jsx)(u.ZP,{item:!0,xs:12,children:(0,s.jsx)(f.Z,{children:(0,s.jsxs)(j.Z,{children:[S?(0,s.jsxs)(o.Z,{severity:"success",sx:{mb:4},children:[(0,s.jsx)(c.Z,{children:"Success"}),(0,s.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:S})]}):null,m&&m.length>0?(0,s.jsxs)(o.Z,{severity:"error",sx:{mb:4},children:[(0,s.jsx)(c.Z,{children:"Errors"}),m.map((e,t)=>(0,s.jsx)(Z.Z,{component:"strong",sx:{display:"block"},children:e},t))]}):null,(0,s.jsx)("form",{onSubmit:e=>{e.preventDefault(),b||(p((0,a.bP)({title:C,title_ar:E,description:k,description_ar:T,author:N,author_ar:q,audio:Q})),n(!0))},children:(0,s.jsxs)(u.ZP,{row:!0,children:[(0,s.jsxs)(u.ZP,{item:!0,xs:12,children:[(0,s.jsxs)(d.Z,{direction:"row",gap:5,children:[(0,s.jsx)(v.Z,{fullWidth:!0,label:"Title",value:C,onChange:e=>P(e.target.value)}),(0,s.jsx)(v.Z,{fullWidth:!0,label:"Title Arabic",value:E,onChange:e=>y(e.target.value)})]}),(0,s.jsxs)(d.Z,{direction:"row",gap:5,children:[(0,s.jsx)(v.Z,{fullWidth:!0,label:"Description",value:k,onChange:e=>A(e.target.value)}),(0,s.jsx)(v.Z,{fullWidth:!0,label:"Description Arabic",value:T,onChange:e=>W(e.target.value)})]}),(0,s.jsxs)(d.Z,{direction:"row",gap:5,children:[(0,s.jsx)(v.Z,{fullWidth:!0,label:"Author",value:N,onChange:e=>D(e.target.value)}),(0,s.jsx)(v.Z,{fullWidth:!0,label:"Author Arabic",value:q,onChange:e=>O(e.target.value)})]})]}),(0,s.jsx)(u.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,s.jsx)(d.Z,{direction:"row",gap:2,children:(0,s.jsxs)(x.Z,{variant:"contained",component:"label",children:["Upload Audio",(0,s.jsx)("input",{type:"file",hidden:!0,onChange:e=>{var t,n;R(null!==(n=null===(t=e.target)||void 0===t?void 0:t.files[0])&&void 0!==n?n:null)}})]})})}),(0,s.jsx)(u.ZP,{item:!0,xs:12,sx:{mt:5},children:(0,s.jsx)(x.Z,{type:"submit",variant:"contained",disabled:b,children:b?"Saving":"Save"})})]})})]})})})]})}}},function(e){e.O(0,[2657,315,341,2763,9774,2888,179],function(){return e(e.s=97996)}),_N_E=e.O()}]);