PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/faqs-1208c16e3f6326b7.js

js lidomatrip.com collected 2026-09-25 07:11:20 UTC 14,936 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7778],{16726:function(e,n,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/faqs",function(){return a(29305)}])},29305:function(e,n,a){"use strict";a.r(n),a.d(n,{default:function(){return N}});var t=a(47568),l=a(26042),s=a(69396),r=a(10253),i=a(70655),o=a(85893),c=a(67294),u=a(41664),d=a.n(u),h=a(44389),x=a(49759),p=a(84858),m=a(32474),v=[{value:"GLOBAL",label:"همه‌ی صفحات",hint:"روی هر صفحه‌ای که سوالات متداول داره"},{value:"SEARCH",label:"همه‌ی صفحات سرچ",hint:"صفحه‌ی هر شهر و هر تگ"},{value:"LOCATION",label:"یک شهر مشخص",hint:"صفحه‌ی اون شهر و تگ‌هاش"},{value:"TAG",label:"یک تگ مشخص",hint:"اون تگ روی همه‌ی شهرها"},{value:"TAG_LOCATION",label:"ترکیب تگ و شهر",hint:"فقط همون یک صفحه"},{value:"RESIDENCE",label:"صفحات اقامتگاه",hint:"صفحه‌ی جزئیات هر اقامتگاه"},{value:"PAGE",label:"یک صفحه‌ی مشخص",hint:"با مسیر، مثل /rules"}],g=Object.fromEntries(v.map(function(e){return[e.value,e.label]})),f=[{value:"/support/guest",label:"پشتیبانی — مهمان"},{value:"/support/host",label:"پشتیبانی — میزبان"},{value:"/reservations/host-approval/host",label:"تایید رزرو — صفحه میزبان"},{value:"/reservations/host-approval/guest",label:"تایید رزرو — صفحه مهمان"},{value:"/reservations/payment",label:"پرداخت رزرو — مهمان و میزبان"},{value:"/reservations/expired/guest",label:"منقضی‌شده — مهمان"},{value:"/reservations/expired/host",label:"منقضی‌شده — میزبان"},{value:"/reservations/done/guest",label:"قطعی‌شده — مهمان"},{value:"/reservations/done/host",label:"قطعی‌شده — میزبان"}],j=Object.fromEntries(f.map(function(e){return[e.value,e.label]})),b={GLOBAL:"purple",SEARCH:"blue",LOCATION:"green",TAG:"yellow",TAG_LOCATION:"yellow",RESIDENCE:"gray",PAGE:"gray"};function N(){var e,n,a=(0,r.Z)((0,c.useState)(""),2),l=a[0],s=a[1],u=(0,r.Z)((0,c.useState)(""),2),f=u[0],N=u[1],A=(0,r.Z)((0,c.useState)(null),2),w=A[0],E=A[1],Z=(0,r.Z)((0,c.useState)(!1),2),_=Z[0],I=Z[1],S=new URLSearchParams;l&&S.set("scope",l),f.trim()&&S.set("q",f.trim());var O=(0,h.u)("/api/admin/faqs?".concat(S.toString()),function(e){return(0,p.SC)(e)}),F=O.data,q=O.isLoading,T=O.mutate,D=(0,h.u)("/api/admin/locations",function(e){return(0,p.SC)(e)}).data,P=(0,h.u)("/api/admin/seo-tags",function(e){return(0,p.SC)(e)}).data,L=null!=F?F:[],k=L.reduce(function(e,n){var a;return e[n.scope]=(null!==(a=e[n.scope])&&void 0!==a?a:0)+1,e},{});return(0,o.jsxs)(x.Z,{title:"سوالات متداول",breadcrumb:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(d(),{href:"/admin",children:"داشبورد"}),(0,o.jsx)("span",{className:"mx-6 text-gray-B0AFBC",children:"/"}),(0,o.jsx)(d(),{href:"/admin/settings",children:"تنظیمات"})]}),toolbar:(0,o.jsxs)(m.Zb,{className:"px-8 py-6 flex items-center gap-x-4 overflow-x-auto",children:[[{href:"/admin/settings",label:"امکانات و قوانین"},{href:"/admin/settings/locations",label:"دسته‌بندی مکان‌ها"},{href:"/admin/settings/tags",label:"تگ‌های سئو"},{href:"/admin/settings/sitemap",label:"sitemap و robots"}].map(function(e){return(0,o.jsx)(d(),{href:e.href,className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:e.label},e.href)}),(0,o.jsx)("span",{className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap bg-primary-main text-white",children:"سوالات متداول"}),(0,o.jsx)(d(),{href:"/admin/settings/home",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"صفحه اصلی"})]}),children:[(0,o.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,o.jsx)(C,{locations:null!=D?D:[],tags:null!=P?P:[]}),(0,o.jsx)(m.Zb,{className:"px-20 py-16",children:(0,o.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:["هر سوال یک \xabمحدوده\xbb داره که تعیین می‌کنه کجا نشون داده بشه. محدوده‌ی خاص‌تر بالاتر از عام‌تر میاد — سوال مخصوص شیراز بالای سوال‌های عمومی صفحات سرچ می‌شینه. توی متن سوال و جواب می‌تونی از"," ",(0,o.jsx)("span",{dir:"ltr",className:"font-m",children:"{location}"}),"،"," ",(0,o.jsx)("span",{dir:"ltr",className:"font-m",children:"{tag}"})," ","و"," ",(0,o.jsx)("span",{dir:"ltr",className:"font-m",children:"{site}"})," ","استفاده کنی. اگه صفحه‌ای مقدارِ اون placeholder رو نداشته باشه، سوال روی اون صفحه اصلاً نشون داده نمی‌شه (به‌جای اینکه با جای خالی رندر بشه)."]})}),(0,o.jsxs)(m.Zb,{className:"p-0 overflow-hidden",children:[(0,o.jsxs)("div",{className:"px-20 py-16 flex flex-wrap items-center gap-12 border-b border-gray-EFEFEF",children:[(0,o.jsx)(m.II,{value:f,onChange:function(e){return N(e.target.value)},placeholder:"جستجو در متن سوال یا جواب…",className:"flex-1 min-w-[220px]"}
1),(0,o.jsxs)(m.Ph,{value:l,onChange:function(e){return s(e.target.value)},className:"w-[190px]",children:[(0,o.jsx)("option",{value:"",children:"همه‌ی محدوده‌ها"}),v.map(function(e){return(0,o.jsxs)("option",{value:e.value,children:[e.label,k[e.value]?" (".concat(k[e.value],")"):""]},e.value)})]}),(0,o.jsx)(m.zx,{onClick:function(){return I(!0)},children:"افزودن سوال"})]}),q?(0,o.jsx)("div",{className:"p-20 flex flex-col gap-8",children:Array.from({length:5}).map(function(e,n){return(0,o.jsx)(m.Od,{className:"h-48"},n)})}):0===L.length?(0,o.jsx)(m.ub,{text:"سوالی با این فیلترها نیست."}):(0,o.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:L.map(function(a){return(0,o.jsxs)("div",{className:"px-20 py-14",children:[(0,o.jsxs)("div",{className:"flex flex-wrap items-center gap-x-10 gap-y-6 mb-4",children:[(0,o.jsx)(m.Ct,{tone:null!==(e=b[a.scope])&&void 0!==e?e:"gray",children:g[a.scope]}),a.location&&(0,o.jsx)("span",{className:"text-11 text-gray-6C6A7D",children:a.location.name}),a.tag&&(0,o.jsx)("span",{className:"text-11 text-gray-6C6A7D",children:a.tag.name}),a.path&&(0,o.jsx)("span",{className:"text-11 text-gray-6C6A7D",children:null!==(n=j[a.path])&&void 0!==n?n:(0,o.jsx)("span",{dir:"ltr",className:"font-mono",children:a.path})}),!a.isActive&&(0,o.jsx)(m.Ct,{tone:"red",children:"غیرفعال"}),(0,o.jsxs)("div",{className:"mr-auto flex gap-x-10",children:[(0,o.jsx)("button",{onClick:function(){return E(a)},className:"text-12 text-primary-main hover:underline",children:"ویرایش"}),(0,o.jsx)("button",{onClick:(0,t.Z)(function(){return(0,i.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,p.SC)("/api/admin/faqs/".concat(a.id),{method:"DELETE"})];case 1:return e.sent(),T(),[2]}})}),className:"text-12 text-[#DC2626] hover:underline",children:"حذف"})]})]}),(0,o.jsx)("div",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:a.question}),(0,o.jsx)("div",{className:"text-12 leading-22 text-gray-6C6A7D mt-2 line-clamp-2",children:a.answer})]},a.id)})})]})]}),(w||_)&&(0,o.jsx)(y,{faq:w,locations:null!=D?D:[],tags:null!=P?P:[],onClose:function(){E(null),I(!1)},onSaved:function(){E(null),I(!1),T()}})]})}function C(e){var n=e.locations,a=e.tags,t=(0,r.Z)((0,c.useState)("shiraz"),2),l=t[0],s=t[1],i=(0,r.Z)((0,c.useState)(""),2),u=i[0],d=i[1],x=new URLSearchParams({kind:"search"});l&&x.set("slug",l),u&&x.set("tag",u);var v=(0,h.u)("/api/admin/faqs/preview?".concat(x.toString()),function(e){return(0,p.SC)(e)}),g=v.data,f=v.isLoading,j=n.filter(function(e){return e.titleEn});return(0,o.jsxs)(m.Zb,{className:"px-20 py-18",children:[(0,o.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28 mb-4",children:"این صفحه چی نشون می‌ده؟"}),(0,o.jsx)("p",{className:"text-12 leading-22 text-gray-6C6A7D mb-14",children:"یک صفحه رو انتخاب کن تا سوال‌هاش رو دقیقاً به همون ترتیبی که کاربر می‌بینه ببینی."}),(0,o.jsxs)("div",{className:"grid md:grid-cols-2 gap-14 mb-14",children:[(0,o.jsx)(m.gN,{label:"شهر",children:(0,o.jsxs)(m.Ph,{value:l,onChange:function(e){return s(e.target.value)},children:[(0,o.jsx)("option",{value:"",children:"— بدون شهر (صفحه‌ی سراسری) —"}),j.map(function(e){return(0,o.jsxs)("option",{value:e.titleEn,children:[e.name," (",e.titleEn,")"]},e.id)})]})}),(0,o.jsx)(m.gN,{label:"تگ",children:(0,o.jsxs)(m.Ph,{value:u,onChange:function(e){return d(e.target.value)},children:[(0,o.jsx)("option",{value:"",children:"— بدون تگ —"}),a.map(function(e){return(0,o.jsx)("option",{value:e.key,children:e.name},e.id)})]})})]}),(0,o.jsxs)("div",{className:"rounded-10 bg-gray-FAFAFA px-16 py-12",children:[(0,o.jsxs)("div",{dir:"ltr",className:"text-11 text-gray-B0AFBC mb-8 font-mono",children:["/search",l?"/".concat(l):"",u?"?".concat(u,"=1"):""]}),f?(0,o.jsx)(m.Od,{className:"h-60"}):(null==g?void 0:g.faqs.length)?(0,o.jsx)("ol",{className:"flex flex-col gap-y-8",children:g.faqs.map(function(e,n){return(0,o.jsxs)("li",{className:"text-12 leading-22",children:[(0,o.jsxs)("span",{className:"text-gray-B0AFBC",children:[(0,m.N)(n+1),"."]})," ",(0,o.jsx)("span",{className:"font-m text-gray-1E1D28",children:e.question})]},e.id)})}):(0,o.jsx)("div",{className:"text-12 text-gray-6C6A7D",children:"این صفحه هیچ سوالی نشون نمی‌ده."})]})]})}function y(e){var n,a,u,d,h,x,g,b,N=e.faq,C=e.locations,y=e.tags,A=e.onClose,w=e.onSaved,E=(0,r.Z)((0,c.useState)({scope:null!==(u=null==N?void 0:N.scope)&&void 0!==u?u:"SEARCH",locationId:(null==N?void 0:N.locationId)?String(N.locationId):"",tagId:(null==N?void 0:N.tagId)?String(N.tagId):"",path:null!==(d=null==N?void 0:N.path)&&void 0!==d?d:"",question:null!==(h=null==N?void 0:N.question)&&void 0!==h?h:"",answer:null!==(x=null==N?void 0:N.answer)&&void 0!==x?x:"",isActive:null===(g=null==N?void 0:N.isActive)||void 0===g||g,sortOrder:null!==(b=null==N?void 0:N.sortOrder)&&void 0!==b?b:0}),2),Z=E[0],_=E[1],I=!!(null==N?void 0:N.path)&&N.path in j,S=(0,r.Z)((0,c.useState)(I?"preset":"custom"),2),O=S[0],F=S[1],q=(0,r.Z)((0,c.useState)(!1),2),T=q[0],D=q[1],P=(0,r.Z)((0,c.useState)(null),2),L=P[0],k=P[1],G="LOCATION"===Z.scope||"TAG_LOCATION"===Z.scope,B="TAG"===Z.scope||"TAG_LOCATION"===Z.scope,R="PAGE"===Z.scope,z=null===(a=v.find(function(e){return e.value===Z.scope}))||void 0===a?void 0:a.hint,H=(n=(0,t.Z)(function(){var e,n;return(0,i.__generator)(this,function(a){switch(a.label){case 0:D(!0),k(null),a.label=1;case 1:return a.trys.push([1,3,4,5]),[4,(0,p.SC)(N?"/api/admin/faqs/".concat(N.id):"/api/admin/faqs",{method:N?"PATCH":"POST",body:JSON.stringify({scope:Z.scope,locationId:G&&Number(Z.locationId)||null,tagId:B&&Number(Z.tagId)||null,path:R?Z.path.trim():null,question:Z.question.trim(),answer:Z.answer.trim(),isActive:Z.isActive,sortOrder:Number(Z.sortOrder)||0})})];case 2:return a.sent(),w(),[3,5];case 3:return k(null!==(n=null==(e=a.sent())?void 0:e.message)&&void 0!==n?n:"ذخیره نشد."),[3,5];case 4:return D(!1),[7];case 5:return[2]}})}),function(){return n.apply(this,arguments)});return(0,o.jsx)(m.u_,{open:!0,title:N?"ویرایش سوال":"افزودن سوال",onClose:A,width:"max-w-[720px]",children:(0,o.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,o.jsx)(m.gN,{label:"محدوده‌ی نمایش",hint:z,children:(0,o.jsx)(m.Ph,{value:Z.scope,onCh
1ange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{scope:e.target.value}))},children:v.map(function(e){return(0,o.jsx)("option",{value:e.value,children:e.label},e.value)})})}),G&&(0,o.jsx)(m.gN,{label:"شهر",children:(0,o.jsxs)(m.Ph,{value:Z.locationId,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{locationId:e.target.value}))},children:[(0,o.jsx)("option",{value:"",children:"— انتخاب کن —"}),C.filter(function(e){return e.titleEn}).map(function(e){return(0,o.jsxs)("option",{value:e.id,children:[e.name," (",e.titleEn,")"]},e.id)})]})}),B&&(0,o.jsx)(m.gN,{label:"تگ",children:(0,o.jsxs)(m.Ph,{value:Z.tagId,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{tagId:e.target.value}))},children:[(0,o.jsx)("option",{value:"",children:"— انتخاب کن —"}),y.map(function(e){return(0,o.jsx)("option",{value:e.id,children:e.name},e.id)})]})}),R&&(0,o.jsxs)(m.gN,{label:"مسیر صفحه",children:[(0,o.jsxs)(m.Ph,{value:"preset"===O?Z.path:"__custom__",onChange:function(e){if("__custom__"===e.target.value){F("custom");return}F("preset"),_((0,s.Z)((0,l.Z)({},Z),{path:e.target.value}))},className:"mb-10",children:[(0,o.jsx)("option",{value:"",disabled:!0,children:"— یک صفحه انتخاب کن —"}),f.map(function(e){return(0,o.jsx)("option",{value:e.value,children:e.label},e.value)}),(0,o.jsx)("option",{value:"__custom__",children:"مسیر دیگر (دستی)…"})]}),"custom"===O&&(0,o.jsx)(m.II,{dir:"ltr",value:Z.path,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{path:e.target.value}))},placeholder:"/rules"})]}),(0,o.jsx)(m.gN,{label:"سوال",hint:"می‌تونی از {location} و {tag} استفاده کنی.",children:(0,o.jsx)(m.II,{value:Z.question,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{question:e.target.value}))}})}),(0,o.jsx)(m.gN,{label:"جواب",hint:"این متن به‌عنوان FAQPage در نتایج گوگل هم ممکنه نمایش داده بشه.",children:(0,o.jsx)("textarea",{rows:5,value:Z.answer,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{answer:e.target.value}))},className:"w-full rounded-10 border border-gray-EFEFEF px-14 py-10 text-13 leading-22 outline-none focus:border-primary-main"})}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-14 items-end",children:[(0,o.jsx)(m.gN,{label:"ترتیب",children:(0,o.jsx)(m.II,{type:"number",value:Z.sortOrder,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{sortOrder:Number(e.target.value)}))}})}),(0,o.jsx)("div",{className:"pb-8",children:(0,o.jsx)(m.ZD,{checked:Z.isActive,onChange:function(e){return _((0,s.Z)((0,l.Z)({},Z),{isActive:e}))},label:"فعال"})})]}),L&&(0,o.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:L}),(0,o.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,o.jsx)(m.zx,{variant:"ghost",onClick:A,children:"انصراف"}),(0,o.jsx)(m.zx,{onClick:H,disabled:T||!Z.question.trim()||!Z.answer.trim(),children:T?"در حال ذخیره…":"ذخیره"})]})]})})}}},function(e){e.O(0,[9791,9759,9774,2888,179],function(){return e(e.s=16726)}),_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.