(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9929],{2361:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/Profile",function(){return a(2861)}])},9413:function(e,t,a){"use strict";var l=a(5893),n=a(1664),s=a.n(n),r=a(1163);let i=e=>{let{title:t,children:a,create:n}=e,i=(0,r.useRouter)();return(0,l.jsxs)("div",{className:"m-5 shadow rounded-3xl hover:shadow-2xl",children:[(0,l.jsxs)("div",{className:"border-b border-gray-200 py-3 px-4 flex justify-between",children:[(0,l.jsx)("h1",{className:"font-bold text-gray-900",children:t}),n&&(0,l.jsx)(s(),{href:i.route+"/Create",passHref:!0,legacyBehavior:!0,children:(0,l.jsx)("a",{className:"hover:text-green-600",children:(0,l.jsx)("span",{children:"افزودن"})})})]}),(0,l.jsx)("div",{className:"p-4 lg:h-[80vh] overflow-y-auto",children:a})]})};t.Z=i},5911:function(e,t,a){"use strict";var l=a(5893);let n=e=>{let{type:t,label:a,className:n,onClick:s,icon:r,id:i}=e;return(0,l.jsxs)("button",{className:"bg-theme-main text-white py-2 px-5 rounded-lg min-w-[80px] inline-flex items-center justify-center"+(n?" "+n:""),type:t,onClick:s,id:i,children:[r,a]})};t.Z=n},9821:function(e,t,a){"use strict";var l=a(5893);let n=e=>{let{label:t,type:a,placeholder:n,onChange:s,onClick:r,defaultValue:i,value:u,name:o,id:d,onFocus:c,disabled:m}=e,h={div:"flex flex-col mb-2",label:"mb-2",input:"border border-gray-500 rounded-lg px-3 py-2"},f=e=>{let t=e.target.value;e.target.value=t.replace(/[^-a-zA-Z0-9-آ-ی\s+]+/gi,"").replace(/\s+/gi,"-").toLowerCase()};return(0,l.jsxs)("div",{className:h.div,children:[(0,l.jsx)("label",{className:h.label,htmlFor:o,children:t}),(0,l.jsx)("input",{type:a,placeholder:n,className:h.input,onChange:s,onClick:r,onFocus:c,name:o,id:d,disabled:!!m&&m,readOnly:!!m&&m,autoComplete:"off",onKeyUp:"slug"===a?f:void 0,defaultValue:i||u||void 0})]})};t.Z=n},2861:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return h}});var l=a(5893),n=a(4184),s=a(9821),r=a(9413),i=a(9552),u=a.n(i),o=a(2920),d=a(5911),c=a(3401);let m=e=>{let{status:t,data:a}=e,{refetch:i}=(0,c.aF)(),m=async e=>{e.preventDefault();let t={email:e.target.email.value,first_name:e.target.first_name.value,last_name:e.target.last_name.value,phone:e.target.phone.value},l=u().get("token");fetch("/api/user/edit/"+a.id,{body:JSON.stringify(t),method:"POST",headers:{Authorization:"bearer "+l}}).then(async e=>{200===e.status?(o.Am.success("با موفقیت بروز رسانی شد."),i()):o.Am.error("خظا!")})};return(0,l.jsx)(n.Z,{title:"پروفایل",description:"",children:(0,l.jsx)(r.Z,{title:"ویرایش",children:(0,l.jsxs)("form",{onSubmit:m,children:[(0,l.jsx)(s.Z,{type:"text",label:"ایمیل",defaultValue:a.email,id:"email",name:"email"}),(0,l.jsx)(s.Z,{type:"text",label:"نام",defaultValue:a.userDetail.first_name,id:"first_name",name:"first_name"}),(0,l.jsx)(s.Z,{type:"text",label:"نام خانوادگی",defaultValue:a.userDetail.last_name,id:"last_name",name:"last_name"}),(0,l.jsx)(s.Z,{type:"text",label:"تلفن همراه",defaultValue:a.phone,id:"phone",name:"phone"}),(0,l.jsx)("div",{className:"text-left mt-3",children:(0,l.jsx)(d.Z,{type:"submit",label:"بروزرسانی"})})]})})})};var h=!0;t.default=m}},function(e){e.O(0,[4617,1057,3874,699,4184,9774,2888,179],function(){return e(e.s=2361)}),_N_E=e.O()}]);