PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/tags-aec7ef68b33f298c.js

js lidomatrip.com collected 2026-10-02 20:26:43 UTC 15,632 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7812],{40809:function(e,a,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/tags",function(){return n(20192)}])},20192:function(e,a,n){"use strict";n.r(a),n.d(a,{default:function(){return m}});var l=n(85893),t=n(67294),s=n(41664),i=n.n(s),r=n(44389),c=n(49759),d=n(84858),o=n(32474);let x=[{value:"",label:"همه‌ی انواع"},{value:"SUIT",label:"سوئیت / ویلا"},{value:"BOOMGARDI",label:"بوم‌گردی"},{value:"HOTEL",label:"هتل"}];function m(){let[e,a]=(0,t.useState)(null),[n,s]=(0,t.useState)(!1),{data:x,isLoading:m,mutate:u}=(0,r.u)("/api/admin/seo-tags",e=>(0,d.SC)(e)),{data:p}=(0,r.u)("/api/admin/seo-tags/options",e=>(0,d.SC)(e)),g=x??[],y=g.filter(e=>!e.isActive&&0===e.conditions.length);return(0,l.jsxs)(c.Z,{title:"تگ‌های سئو",breadcrumb:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i(),{href:"/admin",children:"داشبورد"}),(0,l.jsx)("span",{className:"mx-6 text-gray-B0AFBC",children:"/"}),(0,l.jsx)(i(),{href:"/admin/settings",children:"تنظیمات"})]}),toolbar:(0,l.jsxs)(o.Zb,{className:"px-8 py-6 flex items-center gap-x-4 overflow-x-auto",children:[(0,l.jsx)(i(),{href:"/admin/settings",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"امکانات و قوانین"}),(0,l.jsx)(i(),{href:"/admin/settings/locations",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"دسته‌بندی مکان‌ها"}),(0,l.jsx)("span",{className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap bg-primary-main text-white",children:"تگ‌های سئو"}),(0,l.jsx)(i(),{href:"/admin/settings/sitemap",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"sitemap و robots"}),(0,l.jsx)(i(),{href:"/admin/settings/faqs",className:"px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"سوالات متداول"}),(0,l.jsx)(i(),{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,l.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,l.jsx)(o.Zb,{className:"px-20 py-16",children:(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:["هر تگ یک یا چند ویژگی اقامتگاه رو با هم ترکیب می‌کنه و یک صفحه‌ی مستقل می‌سازه. تگ بدون شهر \xabتگ مادر\xbbه (",(0,l.jsx)("span",{dir:"ltr",className:"font-m",children:"/search?pool=1"}),") و با شهر ترکیب می‌شه تا صفحه‌ی همون شهر ساخته بشه (",(0,l.jsx)("span",{dir:"ltr",className:"font-m",children:"/search/shiraz?pool=1"}),")."]})}),y.length>0&&(0,l.jsxs)(o.Zb,{className:"px-20 py-16 border-r-4 border-r-[#F59E0B]",children:[(0,l.jsxs)("div",{className:"text-13 leading-22 font-m text-gray-1E1D28 mb-6",children:[(0,o.N)(y.length)," تگ غیرفعال و بدون شرط"]}),(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:[y.map(e=>e.name).join("، ")," — توی اودو به ویژگی‌هایی وصل بودن که بعداً حذف شدن، برای همین اون‌جا هم نتیجه‌ای نمی‌دادن. عمداً غیرفعال وارد شدن تا اشتباهاً همه‌ی اقامتگاه‌ها رو نشون ندن. برای زنده‌کردنشون شرط درست رو تعریف کن و فعالشون کن."]})]}),(0,l.jsxs)(o.Zb,{className:"p-0 overflow-hidden",children:[(0,l.jsxs)("div",{className:"px-20 py-16 flex items-center justify-between border-b border-gray-EFEFEF",children:[(0,l.jsxs)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:[(0,o.N)(g.length)," تگ"]}),(0,l.jsx)(o.zx,{onClick:()=>s(!0),children:"افزودن تگ"})]}),m?(0,l.jsx)("div",{className:"p-20 flex flex-col gap-8",children:Array.from({length:6}).map((e,a)=>(0,l.jsx)(o.Od,{className:"h-48"},a))}):0===g.length?(0,l.jsx)(o.ub,{text:"هنوز تگی تعریف نشده."}):(0,l.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:g.map(e=>(0,l.jsxs)("button",{onClick:()=>a(e),className:"w-full text-right px-20 py-14 hover:bg-gray-FAFAFA transition flex flex-wrap items-center gap-x-10 gap-y-6",children:[(0,l.jsx)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:e.name}),(0,l.jsxs)("span",{dir:"ltr",className:"text-11 text-gray-B0AFBC",children:["?",e.key,"=1"]}),e.isActive?(0,l.jsx)(o.Ct,{tone:"green",children:"فعال"}):(0,l.jsx)(o.Ct,{tone:"red",children:"غیرفعال"}),e.isSuggested&&(0,l.jsx)(o.Ct,{tone:"blue",children:"جستجوی مرتبط"}),(0,l.jsxs)("span",{className:"text-11 text-gray-6C6A7D mr-auto",children:[(0,o.N)(e.conditions.length)," شرط \xb7 ",(0,o.N)(e.pageCount)," صفحه"]})]},e.id))})]})]}),(e||n)&&p&&(0,l.jsx)(h,{tag:e,options:p,onClose:()=>{a(null),s(!1)},onSaved:()=>{a(null),s(!1),u()}})]})}function h(e){let{tag:a,options:n,onClose:s,onSaved:i}=e,[r,c]=(0,t.useState)({key:(null==a?void 0:a.key)??"",name:(null==a?void 0:a.name)??"",shortLabel:(null==a?void 0:a.shortL
1abel)??"",description:(null==a?void 0:a.description)??"",residenceType:(null==a?void 0:a.residenceType)??"",priceMin:(null==a?void 0:a.priceMin)??"",priceMax:(null==a?void 0:a.priceMax)??"",matchIsFast:(null==a?void 0:a.matchIsFast)??!1,contentTitle:(null==a?void 0:a.contentTitle)??"",contentHtml:(null==a?void 0:a.contentHtml)??"",isActive:(null==a?void 0:a.isActive)??!0,isSuggested:(null==a?void 0:a.isSuggested)??!1,showInHomepage:(null==a?void 0:a.showInHomepage)??!1,sortOrder:(null==a?void 0:a.sortOrder)??0}),[m,h]=(0,t.useState)((null==a?void 0:a.conditions)??[]),[p,g]=(0,t.useState)(null),[y,b]=(0,t.useState)(!1),[v,j]=(0,t.useState)(null),[N,f]=(0,t.useState)(!1),F=(0,t.useMemo)(()=>{let e=new Map;return m.forEach(a=>{e.has(a.groupIndex)||e.set(a.groupIndex,[]),e.get(a.groupIndex).push(a)}),[...e.entries()].sort((e,a)=>e[0]-a[0])},[m]);(0,t.useEffect)(()=>{let e=!1;f(!0);let a=setTimeout(async()=>{try{let a=await (0,d.SC)("/api/admin/seo-tags/preview",{method:"POST",body:JSON.stringify({conditions:m,residenceType:r.residenceType||null,priceMin:""===r.priceMin?null:Number(r.priceMin),priceMax:""===r.priceMax?null:Number(r.priceMax),matchIsFast:r.matchIsFast})});e||j(a)}catch{e||j(null)}finally{e||f(!1)}},400);return()=>{e=!0,clearTimeout(a)}}
1,[m,r.residenceType,r.priceMin,r.priceMax,r.matchIsFast]);let C=()=>h([...m,{groupIndex:F.length?Math.max(...F.map(e=>e[0]))+1:0,amenityKey:null,ruleKey:null,valueName:null}]),w=async()=>{b(!0),g(null);try{let e={key:r.key.trim(),name:r.name.trim(),shortLabel:r.shortLabel.trim()||null,description:r.description.trim()||null,residenceType:r.residenceType||null,priceMin:""===r.priceMin?null:Number(r.priceMin),priceMax:""===r.priceMax?null:Number(r.priceMax),matchIsFast:r.matchIsFast,contentTitle:r.contentTitle.trim()||null,contentHtml:r.contentHtml.trim()||null,isActive:r.isActive,isSuggested:r.isSuggested,showInHomepage:r.showInHomepage,sortOrder:Number(r.sortOrder)||0,conditions:m.filter(e=>e.amenityKey||e.ruleKey)};await (0,d.SC)(a?`/api/admin/seo-tags/${a.id}`:"/api/admin/seo-tags",{method:a?"PATCH":"POST",body:JSON.stringify(e)}),i()}catch(e){g((null==e?void 0:e.message)??"ذخیره نشد.")}finally{b(!1)}},I=0===m.filter(e=>e.amenityKey||e.ruleKey).length,A=I&&!r.residenceType&&!r.matchIsFast&&""===r.priceMin&&""===r.priceMax;return(0,l.jsx)(o.u_,{open:!0,title:a?`ویرایش تگ \xab${a.name}\xbb`:"افزودن تگ",onClose:s,width:"max-w-[880px]",children:(0,l.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,l.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,l.jsx)(o.gN,{label:"کلید (پارامتر آدرس)",hint:a?"تغییرش آدرس‌های ایندکس‌شده رو می‌شکنه — دست نزن مگر لازم باشه.":"توی آدرس این‌طوری میاد: /search/shiraz?<کلید>=1",children:(0,l.jsx)(o.II,{dir:"ltr",value:r.key,onChange:e=>c({...r,key:e.target.value}),placeholder:"pool"})}),(0,l.jsx)(o.gN,{label:"نام نمایشی",hint:"توی عنوان صفحه می‌شینه: \xab<نام> در شیراز\xbb",children:(0,l.jsx)(o.II,{value:r.name,onChange:e=>c({...r,name:e.target.value})})}),(0,l.jsx)(o.gN,{label:"برچسب کوتاه",hint:"برای چیپس فیلترها، مثل \xabاستخردار\xbb",children:(0,l.jsx)(o.II,{value:r.shortLabel,onChange:e=>c({...r,shortLabel:e.target.value})})}),(0,l.jsx)(o.gN,{label:"ترتیب نمایش",children:(0,l.jsx)(o.II,{type:"number",value:r.sortOrder,onChange:e=>c({...r,sortOrder:Number(e.target.value)})})})]}),(0,l.jsxs)("div",{className:"rounded-12 border border-gray-EFEFEF overflow-hidden",children:[(0,l.jsxs)("div",{className:"px-16 py-12 bg-gray-FAFAFA flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:"شرط‌های تگ"}),(0,l.jsx)("span",{className:"text-11 text-gray-6C6A7D",children:"داخل هر گروه \xabیا\xbb \xb7 بین گروه‌ها \xabو\xbb"})]}),(0,l.jsxs)("div",{className:"p-16 flex flex-col gap-y-12",children:[0===F.length&&(0,l.jsx)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:"هنوز شرطی نداره. بدون شرط، این تگ همه‌ی اقامتگاه‌ها رو نشون می‌ده."}),F.map((e,a)=>{let[t,s]=e;return(0,l.jsxs)("div",{children:[a>0&&(0,l.jsx)("div",{className:"text-11 font-m text-gray-B0AFBC my-6 text-center",children:"و"}),(0,l.jsxs)("div",{className:"rounded-10 border border-gray-EFEFEF p-12 flex flex-col gap-y-8",children:[s.map((e,a)=>(0,l.jsxs)("div",{children:[a>0&&(0,l.jsx)("div",{className:"text-11 text-gray-B0AFBC my-4",children:"یا"}),(0,l.jsx)(u,{condition:e,options:n,onChange:a=>h(m.map(n=>n===e?a:n)),onRemove:()=>h(m.filter(a=>a!==e))})]},a)),(0,l.jsx)("button",{onClick:()=>h([...m,{groupIndex:t,amenityKey:null,ruleKey:null,valueName:null}]),className:"text-11 text-primary-main hover:underline self-start",children:"+ افزودن گزینه‌ی \xabیا\xbb به این گروه"})]})]},t)}),(0,l.jsx)("button",{onClick:C,className:"text-12 text-primary-main hover:underline self-start",children:"+ افزودن گروه شرط جدید (\xabو\xbb)"})]})]}),(0,l.jsxs)("div",{className:"grid md:grid-cols-3 gap-14",children:[(0,l.jsx)(o.gN,{label:"نوع اقامتگاه",children:(0,l.jsx)(o.Ph,{value:r.residenceType,onChange:e=>c({...r,residenceType:e.target.value}),children:x.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,l.jsx)(o.gN,{label:"حداقل قیمت وسط هفته",hint:"خالی یعنی بدون کف قیمت",children:(0,l.jsx)(o.II,{type:"number",value:r.priceMin,onChange:e=>c({...r,priceMin:e.target.value})})}),(0,l.jsx)(o.gN,{label:"حداکثر قیمت وسط هفته",hint:"خالی یعنی بدون سقف قیمت",children:(0,l.jsx)(o.II,{type:"number",value:r.priceMax,onChange:e=>c({...r,priceMax:e.target.value})})})]}),(0,l.jsx)("div",{className:`rounded-10 px-16 py-12 text-12 leading-22 ${A?"bg-[#FEF3C7] text-[#92400E]":"bg-gray-FAFAFA text-gray-6C6A7D"}`,children:N?"در حال محاسبه…":A?(0,l.jsxs)(l.Fragment,{children:["این تعریف هیچ فیلتری نداره و ",(0,l.jsx)("span",{className:"font-m",children:"همه‌ی اقامتگاه‌ها"})," رو نشون می‌ده — که برای یک صفحه‌ی سئویی تقریباً همیشه اشتباهه."]}):v?(0,l.jsxs)(l.Fragment,{children:["با این تعریف ",(0,l.jsx)("span",{className:"font-m text-gray-1E1D28",children:(0,o.N)(v.total)})," ","اقامتگاه منتشرشده نمایش داده می‌شه.",0===v.total&&" — یعنی صفحه خالی می‌مونه."]}):"پیش‌نمایش در دسترس نیست."}),(0,l.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,l.jsx)(o.gN,{label:"عنوان متن صفحه",children:(0,l.jsx)(o.II,{value:r.contentTitle,onChange:e=>c({...r,contentTitle:e.target.value})})}),(0,l.jsx)(o.gN,{label:"یادداشت داخلی",hint:"فقط برای تیم، جایی نمایش داده نمی‌شه.",children:(0,l.jsx)(o.II,{value:r.description,onChange:e=>c({...r,description:e.target.value})})})]}),(0,l.jsx)(o.gN,{label:"متن صفحه",hint:"HTML مجازه.",children:(0,l.jsx)("textarea",{value:r.contentHtml,onChange:e=>c({...r,contentHtml:e.target.value}),rows:5,className:"w-full rounded-10 border border-gray-EFEFEF px-14 py-10 text-13 leading-22 outline-none focus:border-primary-main font-mono"})}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-x-24 gap-y-10",children:[(0,l.jsx)(o.ZD,{checked:r.isActive,onChange:e=>c({...r,isActive:e}),label:"فعال"}),(0,l.jsx)(o.ZD,{checked:r.isSuggested,onChange:e=>c({...r,isSuggested:e}),label:"نمایش در \xabجستجوهای مرتبط\xbb"}
1),(0,l.jsx)(o.ZD,{checked:r.matchIsFast,onChange:e=>c({...r,matchIsFast:e}),label:"فقط رزرو آنی"}),(0,l.jsx)(o.ZD,{checked:r.showInHomepage,onChange:e=>c({...r,showInHomepage:e}),label:"نمایش در صفحه‌ی اصلی"})]}),a&&a.pageCount>0&&(0,l.jsxs)("p",{className:"text-11 leading-20 text-gray-B0AFBC",children:[(0,o.N)(a.pageCount)," صفحه‌ی سئویی به این تگ وصله. غیرفعال‌کردن، اون‌ها رو از دسترس خارج می‌کنه ولی پاک نمی‌کنه."]}),p&&(0,l.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:p}),(0,l.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,l.jsx)(o.zx,{variant:"ghost",onClick:s,children:"انصراف"}),(0,l.jsx)(o.zx,{onClick:w,disabled:y||!r.key.trim()||!r.name.trim(),children:y?"در حال ذخیره…":"ذخیره تگ"})]})]})})}function u(e){let{condition:a,options:n,onChange:t,onRemove:s}=e,i=a.amenityKey??(a.ruleKey?`rule:${a.ruleKey}`:""),r=n.amenities.find(e=>e.key===a.amenityKey);return(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-8",children:[(0,l.jsxs)(o.Ph,{value:i,onChange:e=>{let n=e.target.value;n.startsWith("rule:")?t({...a,amenityKey:null,ruleKey:n.slice(5),valueName:null}):t({...a,amenityKey:n||null,ruleKey:null,valueName:null})},className:"min-w-[200px] flex-1",children:[(0,l.jsx)("option",{value:"",children:"— ویژگی را انتخاب کن —"}),(0,l.jsx)("optgroup",{label:"امکانات",children:n.amenities.map(e=>(0,l.jsx)("option",{value:e.key,children:e.name},e.key))}),(0,l.jsx)("optgroup",{label:"قوانین",children:n.rules.map(e=>(0,l.jsx)("option",{value:`rule:${e.key}`,children:e.name},e.key))})]}),r&&(r.options.length>0||a.valueName)?(0,l.jsxs)(o.Ph,{value:a.valueName??"",onChange:e=>t({...a,valueName:e.target.value||null}),className:"min-w-[180px] flex-1",children:[(0,l.jsx)("option",{value:"",children:"هر مقداری (فقط داشتن)"}),[...new Set([...a.valueName?[a.valueName]:[],...r.options])].map(e=>(0,l.jsx)("option",{value:e,children:e},e))]}):(0,l.jsx)("span",{className:"text-11 text-gray-B0AFBC flex-1",children:a.ruleKey?"باید \xabبله\xbb باشه":"فقط داشتن این امکان"}),(0,l.jsx)("button",{onClick:s,className:"text-11 text-[#DC2626] hover:underline shrink-0","aria-label":"حذف شرط",children:"حذف"})]})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=40809)}),_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.