(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9679],{7959:function(e,l,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/Manager/Files/Edit/[id]",function(){return t(6307)}])},9413:function(e,l,t){"use strict";var s=t(5893),r=t(1664),a=t.n(r),i=t(1163);let n=e=>{let{title:l,children:t,create:r}=e,n=(0,i.useRouter)();return(0,s.jsxs)("div",{className:"m-5 shadow rounded-3xl hover:shadow-2xl",children:[(0,s.jsxs)("div",{className:"border-b border-gray-200 py-3 px-4 flex justify-between",children:[(0,s.jsx)("h1",{className:"font-bold text-gray-900",children:l}),r&&(0,s.jsx)(a(),{href:n.route+"/Create",passHref:!0,legacyBehavior:!0,children:(0,s.jsx)("a",{className:"hover:text-green-600",children:(0,s.jsx)("span",{children:"افزودن"})})})]}),(0,s.jsx)("div",{className:"p-4 lg:h-[80vh] overflow-y-auto",children:t})]})};l.Z=n},5911:function(e,l,t){"use strict";var s=t(5893);let r=e=>{let{type:l,label:t,className:r,onClick:a,icon:i,id:n}=e;return(0,s.jsxs)("button",{className:"bg-theme-main text-white py-2 px-5 rounded-lg min-w-[80px] inline-flex items-center justify-center"+(r?" "+r:""),type:l,onClick:a,id:n,children:[i,t]})};l.Z=r},9821:function(e,l,t){"use strict";var s=t(5893);let r=e=>{let{label:l,type:t,placeholder:r,onChange:a,onClick:i,defaultValue:n,value:d,name:c,id:o,onFocus:u,disabled:h}=e,x={div:"flex flex-col mb-2",label:"mb-2",input:"border border-gray-500 rounded-lg px-3 py-2"},f=e=>{let l=e.target.value;e.target.value=l.replace(/[^-a-zA-Z0-9-آ-ی\s+]+/gi,"").replace(/\s+/gi,"-").toLowerCase()};return(0,s.jsxs)("div",{className:x.div,children:[(0,s.jsx)("label",{className:x.label,htmlFor:c,children:l}),(0,s.jsx)("input",{type:t,placeholder:r,className:x.input,onChange:a,onClick:i,onFocus:u,name:c,id:o,disabled:!!h&&h,readOnly:!!h&&h,autoComplete:"off",onKeyUp:"slug"===t?f:void 0,defaultValue:n||d||void 0})]})};l.Z=r},6307:function(e,l,t){"use strict";t.r(l),t.d(l,{__N_SSP:function(){return m}});var s=t(5893),r=t(4184),a=t(9413),i=t(9821),n=t(9552),d=t.n(n),c=t(2920),o=t(5911),u=t(5675),h=t.n(u),x=t(1664),f=t.n(x);let p=e=>{let{status:l,data:t}=e,n="http://localhost:8000/files/"+t.path,u=async e=>{e.preventDefault();let l={alt:e.target.alt.value},s=d().get("token");fetch("/api/file/edit/"+t.id,{body:JSON.stringify(l),method:"POST",headers:{Authorization:"bearer "+s}}).then(async e=>{200===e.status?c.Am.success("با موفقیت بروز رسانی شد."):c.Am.error("خطا!")})};return(0,s.jsx)(r.Z,{title:"پست ها - ویرایش: "+t.alt,children:(0,s.jsx)(a.Z,{title:"ویرایش",children:(0,s.jsxs)("form",{onSubmit:u,children:[(0,s.jsxs)("div",{className:"flex flex-row flex-wrap",children:[(0,s.jsx)("div",{className:"w-full lg:w-3/4",children:"image"===t.type?(0,s.jsx)(h(),{loader:()=>n,src:n,alt:t.alt,width:800,height:800,priority:!0},t.id):"video"===t.type?(0,s.jsx)("video",{width:800,height:"auto",controls:!0,children:(0,s.jsx)("source",{src:n+"?dl=0"})},t.id):(0,s.jsx)("div",{children:"file"},t.id)}),(0,s.jsx)("div",{className:"w-full lg:w-1/4",children:(0,s.jsx)(i.Z,{type:"text",label:"متن جایگزین",defaultValue:t.alt,id:"alt",name:"alt"})})]}),(0,s.jsxs)("div",{className:"text-left mt-3",children:[(0,s.jsx)(f(),{href:"/Files/Delete/"+t.id,children:(0,s.jsx)("span",{className:"ml-2",children:"حذف"})}),(0,s.jsx)(o.Z,{type:"submit",label:"بروزرسانی"})]})]})})})};var m=!0;l.default=p}},function(e){e.O(0,[4617,1057,3874,699,4184,9774,2888,179],function(){return e(e.s=7959)}),_N_E=e.O()}]);