PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/blog/taxonomy-3009e640bbbb295f.js

js lidomatrip.com collected 2026-09-25 07:10:50 UTC 18,073 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[455],{50833:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/blog/taxonomy",function(){return t(75425)}])},92161:function(e,n,t){"use strict";t.d(n,{Y:function(){return h},Z:function(){return x}});var r=t(47568),a=t(10253),l=t(70655),i=t(85893),s=t(67294),u=t(44389),o=t(84858),c=t(32474),d=function(e){return(0,o.Px)(e)};function h(e){var n,t,h,x,g,v=e.onPick,m=e.requireAlt,f=void 0===m||m,p=e.confirmLabel,b=e.active,j=(0,a.Z)((0,s.useState)(""),2),N=j[0],y=j[1],C=(0,a.Z)((0,s.useState)(null),2),I=C[0],w=C[1],E=(0,a.Z)((0,s.useState)(""),2),k=E[0],S=E[1],Z=(0,a.Z)((0,s.useState)(!1),2),_=Z[0],A=Z[1],D=(0,a.Z)((0,s.useState)(null),2),T=D[0],z=D[1],P=(0,s.useRef)(null),O=(0,u.u)(void 0===b||b?"/api/admin/blog/media?q=".concat(encodeURIComponent(N),"&pageSize=36"):null,d),R=O.data,q=O.isLoading,B=O.mutate,F=null!==(h=null==R?void 0:R.items)&&void 0!==h?h:[],M=function(e){var n;w(e),S(null!==(n=e.alt)&&void 0!==n?n:""),z(null)},L=(0,s.useCallback)((n=(0,r.Z)(function(e){var n,t,r,a,i,s,u,c,d,h,x;return(0,l.__generator)(this,function(l){switch(l.label){case 0:if(!(null==e?void 0:e.length))return[2];A(!0),z(null),l.label=1;case 1:l.trys.push([1,11,12,13]),n=null,t=!0,r=!1,a=void 0,l.label=2;case 2:l.trys.push([2,7,8,9]),i=Array.from(e)[Symbol.iterator](),l.label=3;case 3:if(t=(s=i.next()).done)return[3,6];return u=s.value,(c=new FormData).append("image",u),[4,(0,o.SC)("/api/admin/blog/media",{method:"POST",body:c})];case 4:n=l.sent(),l.label=5;case 5:return t=!0,[3,3];case 6:return[3,9];case 7:return d=l.sent(),r=!0,a=d,[3,9];case 8:try{t||null==i.return||i.return()}finally{if(r)throw a}return[7];case 9:return[4,B()];case 10:return l.sent(),n&&M(n),[3,13];case 11:return z(null!==(x=null==(h=l.sent())?void 0:h.message)&&void 0!==x?x:"آپلود نشد."),[3,13];case 12:return A(!1),P.current&&(P.current.value=""),[7];case 13:return[2]}})}),function(e){return n.apply(this,arguments)}),[B]);function H(){return(H=(0,r.Z)(function(){var e;return(0,l.__generator)(this,function(n){switch(n.label){case 0:if(!I)return[2];if(f&&!k.trim())return z("متن جایگزین لازم است — بدون آن انتشار رد می‌شود."),[2];if(!((null!==(e=I.alt)&&void 0!==e?e:"")!==k.trim()))return[3,4];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,(0,o.SC)("/api/admin/blog/media/".concat(I.id),{method:"PATCH",body:JSON.stringify({alt:k.trim()||null})})];case 2:return n.sent(),B(),[3,4];case 3:return n.sent(),[3,4];case 4:return v({url:I.url,alt:k.trim()}),[2]}})})).apply(this,arguments)}function U(){return(U=(0,r.Z)(function(e){return(0,l.__generator)(this,function(n){switch(n.label){case 0:if(!window.confirm("\xab".concat(e.title||e.url,"\xbb از کتابخانه برداشته شود؟ فایل پاک نمی‌شود.")))return[2];return[4,(0,o.SC)("/api/admin/blog/media/".concat(e.id),{method:"DELETE"})];case 1:return n.sent(),(null==I?void 0:I.id)===e.id&&w(null),B(),[2]}})})).apply(this,arguments)}return(0,i.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-8",children:[(0,i.jsx)(c.II,{value:N,onChange:function(e){return y(e.target.value)},placeholder:"جستجو در نام یا توضیح فایل",className:"min-w-0 flex-1"}),(0,i.jsx)("input",{ref:P,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:function(e){return L(e.target.files)}}),(0,i.jsx)(c.zx,{onClick:function(){var e;return null===(e=P.current)||void 0===e?void 0:e.click()},disabled:_,children:_?"در حال آپلود…":"آپلود تصویر"})]}),T&&(0,i.jsx)("div",{className:"rounded-10 border border-red-200 bg-red-50 px-12 py-8 text-12 leading-22 text-red-700",children:T}),(0,i.jsx)("div",{className:"max-h-[46vh] overflow-y-auto rounded-12 border border-gray-E5E5E6 p-8",onDragOver:function(e){return e.preventDefault()},onDrop:function(e){e.preventDefault(),L(e.dataTransfer.files)},children:q?(0,i.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:Array.from({length:12}).map(function(e,n){return(0,i.jsx)("div",{className:"aspect-square animate-pulse rounded-10 bg-gray-F0F0F0"},n)})}):0===F.length?(0,i.jsx)("p",{className:"py-40 text-center text-14 text-gray-9B9BAA",children:"چیزی در کتابخانه نیست. فایل را همین‌جا رها کنید یا \xabآپلود تصویر\xbb را بزنید."}):(0,i.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:F.map(function(e){return(0,i.jsxs)("button",{type:"button",onClick:function(){return M(e)},className:"group relative aspect-square overflow-hidden rounded-10 border-2 transition ".concat((null==I?void 0:I.id)===e.id?"border-primary-main":"border-transparent hover:border-gray-D2D2D7"),title:null!==(x=e.title)&&void 0!==x?x:e.url,children:[(0,i.jsx)("img",{src:(0,c.vD)(e.url,240),alt:null!==(g=e.alt)&&void 0!==g?g:"",loading:"lazy",className:"h-full w-full object-cover"}),!e.alt&&(0,i.jsx)("span",{className:"absolute bottom-0 right-0 left-0 bg-amber-400 py-2 text-10 text-amber-900",children:"بدون توضیح"})]},e.id)})})}),I&&(0,i.jsxs)("div",{className:"flex flex-col gap-12 rounded-12 border border-gray-E5E5E6 p-12 md:flex-row md:items-start",children:[(0,i.jsx)("img",{src:(0,c.vD)(I.url,320),alt:"",className:"h-96 w-128 shrink-0 rounded-10 object-cover"}),(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("p",{className:"truncate text-14 font-m",children:I.title||"بدون نام"}),(0,i.jsx)("p",{dir:"ltr",className:"truncate text-right text-11 text-gray-9B9BAA",children:I.url}),(0,i.jsx)("p",{className:"mt-2 text-11 text-gray-9B9BAA",children:(t=I.sizeBytes)?t>1048576?"".concat((0,c.N)(Math.round(t/1024/102.4)/10)," مگابایت"):"".concat((0,c.N)(Math.round(t/1024))," کیلوبایت"):""}),(0,i.jsx)("div",{className:"mt-8",children:(0,i.jsx)(c.II,{value:k,onChange:function(e){return S(e.target.value)},placeholder:"متن جایگزین — چه چیزی در تصویر است؟"})})]}),(0,i.jsxs)("div",{className:"flex shrink-0 gap-8",children:[(0,i.jsx)(c.zx,{onClick:function(){return H.apply(this,arguments)},children:void 0===p?"انتخاب":p}),(0,i.jsx)(c.zx,{variant:"ghost",onClick:function(){return function(e){return U.apply(this,arguments)}(I)},children:"حذف"})]})]})]})}function x(e){var n=e.open,t=e.onClose,r=e.onPick,a=e.requireAlt,l=e.title;return(0,i.jsx)(c.u_,{open:n,onClose:t,title:void 0===l?"کتابخانه‌ی رسانه":l,width:"max-w-[900px]",children:(0,i.jsx)(h,{active:n,requireAlt:void 0===a||a,onPick:function(e){r(e),t()}})})}},75425:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return b}});
1var r=t(47568),a=t(14924),l=t(26042),i=t(69396),s=t(10253),u=t(70655),o=t(85893),c=t(67294),d=t(44389),h=t(49759),x=t(84858),g=t(92161),v=t(32474);function m(e){var n=e.value,t=e.name,r=e.onChange,a=(0,s.Z)((0,c.useState)(!1),2),l=a[0],i=a[1];return(0,o.jsxs)("div",{className:"flex items-center gap-12",children:[n?(0,o.jsx)("img",{src:(0,v.vD)(n,160),alt:t||"آواتار",className:"h-64 w-64 flex-none rounded-16 border border-gray-E5E5E6 object-cover"}):(0,o.jsx)("span",{className:"flex h-64 w-64 flex-none items-center justify-center rounded-16 border border-dashed border-gray-E5E5E6 text-20 text-gray-9B9BAA",children:(t||"؟").trim().slice(0,1)}),(0,o.jsxs)("div",{className:"flex flex-wrap gap-8",children:[(0,o.jsx)(v.zx,{type:"button",variant:"secondary",onClick:function(){return i(!0)},children:n?"تغییر آواتار":"انتخاب از کتابخانه"}),n&&(0,o.jsx)(v.zx,{type:"button",variant:"ghost",onClick:function(){return r(null)},children:"حذف"})]}),(0,o.jsx)(g.Z,{open:l,onClose:function(){return i(!1)},title:"آواتار نویسنده — تصویر مربعی بهتر است",requireAlt:!1,onPick:function(e){r(e.url),i(!1)}})]})}var f={WRITER:"نویسنده",EDITOR:"ویراستار",MANAGER:"مدیر محتوا"},p=function(e){return(0,x.SC)(e)};function b(){var e,n,t,a,l,i=(0,s.Z)((0,c.useState)("authors"),2),g=i[0],m=i[1],b=(0,s.Z)((0,c.useState)(""),2),N=b[0],y=b[1],C=(0,d.u)("/api/admin/blog/authors?includeInactive=true",p),I=(0,d.u)("/api/admin/blog/categories",p),w=(0,d.u)("/api/admin/blog/tags",p),E="authors"===g?C:"categories"===g?I:w,k=(0,s.Z)((0,c.useState)(null),2),S=k[0],Z=k[1],_=(0,s.Z)((0,c.useState)(!1),2),A=_[0],D=_[1],T=(0,s.Z)((0,c.useState)(null),2),z=T[0],P=T[1],O=(0,s.Z)((0,c.useState)(!1),2),R=O[0],q=O[1],B={authors:null===(e=C.data)||void 0===e?void 0:e.length,categories:null===(n=I.data)||void 0===n?void 0:n.length,tags:null===(t=w.data)||void 0===t?void 0:t.length},F=(0,c.useMemo)(function(){var e,n=new Map((null!==(e=I.data)&&void 0!==e?e:[]).map(function(e){return[e.id,e]}));return function(e){for(var t=[e.name],r=e.parentId,a=0;r&&a++<5;){var l=n.get(r);if(!l)break;t.unshift(l.name),r=l.parentId}return t.join(" / ")}},[I.data]);function M(){return(M=(0,r.Z)(function(e){var n,t,r,a;return(0,u.__generator)(this,function(l){switch(l.label){case 0:q(!0),P(null),l.label=1;case 1:return l.trys.push([1,4,5,6]),n="/api/admin/blog/".concat(g),t=!(null==S?void 0:S.id),[4,(0,x.SC)(t?n:"".concat(n,"/").concat(S.id),{method:t?"POST":"PATCH",body:JSON.stringify(e)})];case 2:return l.sent(),[4,E.mutate()];case 3:return l.sent(),Z(null),D(!1),[3,6];case 4:return P(null!==(a=null==(r=l.sent())?void 0:r.message)&&void 0!==a?a:"ذخیره نشد."),[3,6];case 5:return q(!1),[7];case 6:return[2]}})})).apply(this,arguments)}function L(){return(L=(0,r.Z)(function(e){var n,t,r,a;return(0,u.__generator)(this,function(l){switch(l.label){case 0:if(n="authors"===g?e.displayName:e.name,!confirm("\xab".concat(n,"\xbb حذف شود؟")))return[2];q(!0),P(null),l.label=1;case 1:return l.trys.push([1,4,5,6]),[4,(0,x.SC)("/api/admin/blog/".concat(g,"/").concat(e.id),{method:"DELETE"})];case 2:return t=l.sent(),[4,E.mutate()];case 3:return l.sent(),(null==t?void 0:t.deactivated)&&P("\xab".concat(n,"\xbb ").concat((0,v.N)(t.posts)," مقاله دارد، پس غیرفعال شد نه حذف.")),[3,6];case 4:return P(null!==(a=null==(r=l.sent())?void 0:r.message)&&void 0!==a?a:"حذف نشد."),[3,6];case 5:return q(!1),[7];case 6:return[2]}})})).apply(this,arguments)}var H=(0,c.useMemo)(function(){var e,n=N.trim(),t=null!==(e=E.data)&&void 0!==e?e:[];return n?t.filter(function(e){return[e.name,e.displayName,e.slug].filter(Boolean).some(function(e){return e.includes(n)})}):t},[E.data,N]),U=A||!!S;return(0,o.jsxs)(h.Z,{title:"مجله",children:[(0,o.jsx)(v.Zb,{className:"p-4 md:p-5",children:(0,o.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,o.jsx)(v.Qm,{tabs:[{key:"authors",label:"نویسنده‌ها"},{key:"categories",label:"دسته‌بندی‌ها"},{key:"tags",label:"برچسب‌ها"}],value:g,counts:B,onChange:function(e){m(e),y(""),P(null)}}),(0,o.jsxs)(v.o8,{children:[(0,o.jsx)(v.Hf,{value:N,onChange:y,placeholder:"جستجو در نام یا اسلاگ"}),(0,o.jsx)(v.zx,{onClick:function(){Z({}),D(!0),P(null)},children:"افزودن"})]}),z&&(0,o.jsx)("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-14 text-red-700",children:z}),E.isLoading?(0,o.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,o.jsx)(v.Od,{className:"h-12"}),(0,o.jsx)(v.Od,{className:"h-12"}),(0,o.jsx)(v.Od,{className:"h-12"})]}):0===H.length?(0,o.jsx)(v.ub,{text:N?"چیزی پیدا نشد.":"هنوز چیزی ثبت نشده."}):(0,o.jsx)("div",{className:"flex flex-col divide-y divide-gray-100",children:H.map(function(e){var n;return(0,o.jsxs)("div",{className:"flex items-center gap-3 py-3",children:[(0,o.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,o.jsx)("span",{className:"font-medium",children:"authors"===g?e.displayName:"categories"===g?F(e):e.name}),"authors"===g&&(0,o.jsx)(v.Ct,{children:f[e.role]}),"authors"===g&&!e.isActive&&(0,o.jsx)(v.Ct,{children:"غیرفعال"})]}),(0,o.jsx)("div",{dir:"ltr",className:"truncate text-12 text-gray-500",children:e.slug})]}),(0,o.jsxs)("span",{className:"shrink-0 text-12 text-gray-500",children:[(0,v.N)("tags"===g?e.postCount:null!==(a=null===(n=e._count)||void 0===n?void 0:n.posts)&&void 0!==a?a:0)," ","مقاله"]}),(0,o.jsx)(v.zx,{variant:"ghost",onClick:function(){Z(e),D(!1),P(null)},children:"ویرایش"}),(0,o.jsx)(v.zx,{variant:"ghost",onClick:function(){return function(e){return L.apply(this,arguments)}(e)},children:"حذف"})]},e.id)})})]})}),(0,o.jsx)(v.u_,{open:U,onClose:function(){Z(null),D(!1)},title:(A?"افزودن ":"ویرایش ")+("authors"===g?"نویسنده":"categories"===g?"دسته‌بندی":"برچسب"),children:U&&(0,o.jsx)(j,{tab:g,value:null!=S?S:{},categories:null!==(l=I.data)&&void 0!==l?l:[],busy:R,onSubmit:function(e){return M.apply(this,arguments)}})})]})}function j(e){var n,t,r,u,d,h,x,g,f,p,b,j,N,y,C,I=e.tab,w=e.value,E=e.categories,k=e.busy,S=e.onSubmit,Z=(0,s.Z)((0,c.useState)((0,l.Z)({},w)),2),_=Z[0],A=Z[1],D=function(e,n){return A(function(t){return(0,i.Z)((0,l.Z)({},t),(0,a.Z)({},e,n))})};return(0,o.jsxs)("form",{className:"flex flex-col gap-3",onSubmit:function(e){e.preventDefault(),S(_)},children:["authors"===I?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,o.jsx)(v.gN,{label:"نام",children:(0,o.jsx)(v.II,{value:null!==(n=_.firstName)&&void 0!==n?n:"",onCh
1ange:function(e){return D("firstName",e.target.value)},required:!0})}),(0,o.jsx)(v.gN,{label:"نام خانوادگی",children:(0,o.jsx)(v.II,{value:null!==(t=_.lastName)&&void 0!==t?t:"",onChange:function(e){return D("lastName",e.target.value)},required:!0})})]}),(0,o.jsx)(v.gN,{label:"نام نمایشی",hint:"همین زیر مقاله دیده می‌شود.",children:(0,o.jsx)(v.II,{value:null!==(r=_.displayName)&&void 0!==r?r:"",onChange:function(e){return D("displayName",e.target.value)},required:!0})}),(0,o.jsx)(v.gN,{label:"نقش",children:(0,o.jsxs)(v.Ph,{value:null!==(u=_.role)&&void 0!==u?u:"WRITER",onChange:function(e){return D("role",e.target.value)},children:[(0,o.jsx)("option",{value:"WRITER",children:"نویسنده — می‌نویسد و پیش‌نویس می‌سازد"}),(0,o.jsx)("option",{value:"EDITOR",children:"ویراستار — پیش‌نویس دیگران را منتشر می‌کند"}),(0,o.jsx)("option",{value:"MANAGER",children:"مدیر محتوا — دسته‌بندی و تنظیمات مجله"})]})}),(0,o.jsx)(v.gN,{label:"آواتار",hint:"در باکس نویسنده‌ی پایان مقاله و صفحه‌ی نویسنده دیده می‌شود.",children:(0,o.jsx)(m,{value:_.avatarUrl,name:_.displayName,onChange:function(e){return D("avatarUrl",e)}})}),(0,o.jsx)(v.gN,{label:"درباره‌ی من",hint:"خط‌شکن‌ها روی صفحه حفظ می‌شوند. ".concat((0,v.N)((null!==(d=_.bio)&&void 0!==d?d:"").length)," از ۱٬۵۰۰ نویسه."),children:(0,o.jsx)("textarea",{value:null!==(h=_.bio)&&void 0!==h?h:"",maxLength:1500,rows:5,placeholder:"چند جمله درباره‌ی نویسنده: کجا سفر کرده، درباره‌ی چه می‌نویسد…",onChange:function(e){return D("bio",e.target.value)},className:"w-full resize-y rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"})}),(0,o.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,o.jsx)(v.gN,{label:"اینستاگرام",children:(0,o.jsx)(v.II,{dir:"ltr",value:null!==(x=_.instagram)&&void 0!==x?x:"",onChange:function(e){return D("instagram",e.target.value)}})}),(0,o.jsx)(v.gN,{label:"لینکدین",children:(0,o.jsx)(v.II,{dir:"ltr",value:null!==(g=_.linkedin)&&void 0!==g?g:"",onChange:function(e){return D("linkedin",e.target.value)}})}),(0,o.jsx)(v.gN,{label:"ایکس",children:(0,o.jsx)(v.II,{dir:"ltr",value:null!==(f=_.twitter)&&void 0!==f?f:"",onChange:function(e){return D("twitter",e.target.value)}})})]})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.gN,{label:"نام",children:(0,o.jsx)(v.II,{value:null!==(p=_.name)&&void 0!==p?p:"",onChange:function(e){return D("name",e.target.value)},required:!0})}),"categories"===I&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(v.gN,{label:"والد",hint:"آدرس دسته‌بندی مسیر است: /blog/category/شمال/مازندران/بابل — حداکثر سه سطح.",children:(0,o.jsxs)(v.Ph,{value:null!==(b=_.parentId)&&void 0!==b?b:"",onChange:function(e){return D("parentId",e.target.value?Number(e.target.value):null)},children:[(0,o.jsx)("option",{value:"",children:"— بدون والد —"}),E.filter(function(e){return e.id!==_.id}).map(function(e){return(0,o.jsx)("option",{value:e.id,children:e.name},e.id)})]})}),(0,o.jsx)(v.gN,{label:"توضیح",children:(0,o.jsx)(v.II,{value:null!==(j=_.description)&&void 0!==j?j:"",onChange:function(e){return D("description",e.target.value)}})})]}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,o.jsx)(v.gN,{label:"عنوان متا",hint:"خالی بماند از نام استفاده می‌شود.",children:(0,o.jsx)(v.II,{value:null!==(N=_.metaTitle)&&void 0!==N?N:"",onChange:function(e){return D("metaTitle",e.target.value)}})}),(0,o.jsx)(v.gN,{label:"توضیح متا",children:(0,o.jsx)(v.II,{value:null!==(y=_.metaDescription)&&void 0!==y?y:"",onChange:function(e){return D("metaDescription",e.target.value)}})})]})]}),(0,o.jsx)(v.gN,{label:"اسلاگ",hint:"خالی بگذارید تا از روی نام ساخته شود. فارسی بماند — آدرس‌های فعلی مجله فارسی‌اند.",children:(0,o.jsx)(v.II,{value:null!==(C=_.slug)&&void 0!==C?C:"",onCh
1ange:function(e){return D("slug",e.target.value)}})}),(0,o.jsx)("div",{className:"mt-2 flex justify-end gap-2",children:(0,o.jsx)(v.zx,{type:"submit",disabled:k,children:k?"در حال ذخیره…":"ذخیره"})})]})}}},function(e){e.O(0,[9791,9759,9774,2888,179],function(){return e(e.s=50833)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.