PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/home-28a4a334d2b7f984.js

js lidomatrip.com collected 2026-10-02 20:26:30 UTC 41,727 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1587],{36124:function(e,l,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/home",function(){return a(69281)}])},69281:function(e,l,a){"use strict";a.r(l),a.d(l,{default:function(){return u}});var t=a(85893),i=a(67294),s=a(41664),n=a.n(s),r=a(44389),d=a(49759),o=a(84858),c=a(32474);let x=[{key:"hero",label:"هدر و سئو"},{key:"rails",label:"اسلایدرها"},{key:"sections",label:"عنوان بخش‌ها"},{key:"blocks",label:"بنر، اسلایدر و باکس‌ها"},{key:"extras",label:"اپلیکیشن، ویدیو و سرچ"},{key:"faqs",label:"سوالات متداول"}];function u(){let[e,l]=(0,i.useState)("hero"),{data:a,isLoading:s,mutate:u}=(0,r.u)("/api/admin/home",e=>(0,o.SC)(e));return(0,t.jsx)(d.Z,{title:"صفحه اصلی",breadcrumb:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n(),{href:"/admin",children:"داشبورد"}),(0,t.jsx)("span",{className:"mx-6 text-gray-B0AFBC",children:"/"}),(0,t.jsx)(n(),{href:"/admin/settings",children:"تنظیمات"})]}),toolbar:(0,t.jsx)(c.Zb,{className:"px-8 py-6 flex items-center gap-x-4 overflow-x-auto",children:x.map(a=>(0,t.jsx)("button",{onClick:()=>l(a.key),"aria-pressed":e===a.key,className:`px-14 py-8 rounded-10 text-13 leading-20 font-m whitespace-nowrap transition ${e===a.key?"bg-primary-main text-white":"text-gray-6C6A7D hover:bg-gray-F0F0F0"}`,children:a.label},a.key))}),children:s||!a?(0,t.jsx)("div",{className:"flex flex-col gap-12",children:Array.from({length:4}).map((e,l)=>(0,t.jsx)(c.Od,{className:"h-64"},l))}):(0,t.jsxs)("div",{className:"flex flex-col gap-y-16",children:["hero"===e&&(0,t.jsx)(m,{settings:a.settings,onSaved:()=>u()}),"rails"===e&&(0,t.jsx)(f,{rails:a.rails??[],onSaved:()=>u()}),"sections"===e&&(0,t.jsx)(p,{sections:a.sections,onSaved:()=>u()}),"blocks"===e&&(0,t.jsx)(j,{data:a,onSaved:()=>u()}),"extras"===e&&(0,t.jsx)(C,{data:a,onSaved:()=>u()}),"faqs"===e&&(0,t.jsx)(T,{})]})})}function h(e){let{onSave:l,saving:a,error:i,hint:s}=e;return(0,t.jsx)("div",{className:"sticky bottom-0 z-10 -mx-4 px-4 pb-4 pt-2",children:(0,t.jsxs)(c.Zb,{className:"px-20 py-12 flex items-center gap-x-12 shadow-[0_-4px_16px_-6px_rgba(24,39,75,0.18)]",children:[(0,t.jsx)("div",{className:"min-w-0",children:i?(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:i}):(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC",children:s??"همه‌ی فیلدهای این تب با هم ذخیره می‌شن."})}),(0,t.jsx)(c.zx,{className:"mr-auto shrink-0",disabled:a,onClick:l,children:a?"در حال ذخیره…":"ذخیره تغییرات"})]})})}function g(e,l){let[a,t]=(0,i.useState)(!1),[s,n]=(0,i.useState)(null),r=async function(a){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"PATCH";t(!0),n(null);try{return await (0,o.SC)(e,{method:i,..."DELETE"===i?{}:{body:JSON.stringify(a)}}),l(),!0}catch(e){return n((null==e?void 0:e.message)??"ذخیره نشد."),!1}finally{t(!1)}};return{save:r,saving:a,error:s}}function m(e){let{settings:l,onSaved:a}=e,s=l??{},[n,r]=(0,i.useState)({heroTitle:s.heroTitle??"",heroSubtitle:s.heroSubtitle??"",heroTitleMobile:s.heroTitleMobile??"",heroSubtitleMobile:s.heroSubtitleMobile??"",h1:s.h1??"",metaTitle:s.metaTitle??"",metaDescription:s.metaDescription??"",metaKeywords:s.metaKeywords??"",pcTitleColor:s.pcTitleColor??"",pcSubtitleColor:s.pcSubtitleColor??"",pcTitleSize:s.pcTitleSize??"",pcSubtitleSize:s.pcSubtitleSize??"",mobileTitleColor:s.mobileTitleColor??"",mobileSubtitleColor:s.mobileSubtitleColor??"",mobileTitleSize:s.mobileTitleSize??"",mobileSubtitleSize:s.mobileSubtitleSize??"",searchBackground:s.searchBackground??"",searchBorderColor:s.searchBorderColor??"",heroImageUrl:s.heroImageUrl??"",heroImageMobileUrl:s.heroImageMobileUrl??""}),{save:d,saving:o,error:x}=g("/api/admin/home/settings",a),u=e=>""===e?null:Number(e),m=e=>e.trim()?e.trim():null,p=n.metaTitle.trim().length,b=n.metaDescription.trim().length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28 mb-14",children:"هدر صفحه"}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,t.jsx)(c.gN,{label:"عنوان دسکتاپ",children:(0,t.jsx)(c.II,{value:n.heroTitle,onChange:e=>r({...n,heroTitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"عنوان موبایل",hint:"اودو برای موبایل عنوان کوتاه‌تری نگه می‌داشت.",children:(0,t.jsx)(c.II,{value:n.heroTitleMobile,onChange:e=>r({...n,heroTitleMobile:e.target.value})})}),(0,t.jsx)(c.gN,{label:"زیرعنوان دسکتاپ",children:(0,t.jsx)(c.II,{value:n.heroSubtitle,onChange:e=>r({...n,heroSubtitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"زیرعنوان موبایل",children:(0,t.jsx)(c.II,{value:n.heroSubtitleMobile,onChange:e=>r({...n,heroSubtitleMobile:e.target.value})})}),(0,t.jsx)(c.gN,{label:"تصویر هدر دسکتاپ",hint:"آدرس تصویر",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.heroImageUrl,onChange:e=>r({...n,heroImageUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"تصویر هدر موبایل",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.heroImageMobileUrl,onChange:e=>r({...n,heroImageMobileUrl:e.target.value})})})]})]}),(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28 mb-4",children:"سئو"}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mb-14",children:"H1 از عنوان هدر جداست: متنی که کاربر می‌بینه و تنها H1 صفحه همیشه یک جمله نیستن، و H1 چیزیه که گوگل می‌خونه. خالی بذاری، عنوان هدر جاش می‌شینه."}),(0,t.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,t.jsx)(c.gN,{label:"H1 صفحه",children:(0,t.jsx)(c.II,{value:n.h1,onChange:e=>r({...n,h1:e.target.value})})}),(0,t.jsx)(c.gN,{label:"meta title",hint:`${(0,c.N)(p)} کاراکتر${p>60?" — از ۶۰ بیشتره، گوگل کوتاهش می‌کنه.":""}`,children:(0,t.jsx)(c.II,{value:n.metaTitle,onChange:e=>r({...n,metaTitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"meta description",hint:`${(0,c.N)(b)} کاراکتر${b>160?" — از ۱۶۰ بیشتره.":""}`,children:(0,t.jsx)("textarea",{rows:3,value:n.metaDescription,onChange:e=>r({...n,metaDescription: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,t.jsx)(c.gN,{label:"meta keywords",children:(0,t.jsx)(c.II,{value:n.metaKeywords,onChange:e=>r({...n,metaKeywords:e.target.value})})})]})]}),(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28 mb-14",children:"ظاهر هدر"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-14",children:[[["pcTitleColor","رنگ عنوان دسکتاپ"],["pcSubtitleColor","رنگ زیرعنوان دسکتاپ"],["mobileTitleColor","رنگ عنوان موبایل"],["mobileSubtitleColor","رنگ زیرعنوان موبایل"],["searchBackgroun
1d","پس‌زمینه سرچ‌باکس"],["searchBorderColor","حاشیه سرچ‌باکس"]].map(e=>{let[l,a]=e;return(0,t.jsx)(c.gN,{label:a,children:(0,t.jsx)(c.II,{dir:"ltr",value:n[l],onChange:e=>r({...n,[l]:e.target.value})})},l)}),[["pcTitleSize","سایز عنوان دسکتاپ"],["pcSubtitleSize","سایز زیرعنوان دسکتاپ"],["mobileTitleSize","سایز عنوان موبایل"],["mobileSubtitleSize","سایز زیرعنوان موبایل"]].map(e=>{let[l,a]=e;return(0,t.jsx)(c.gN,{label:a,children:(0,t.jsx)(c.II,{type:"number",value:n[l],onChange:e=>r({...n,[l]:e.target.value})})},l)})]})]}),(0,t.jsx)(h,{saving:o,error:x,onSave:()=>d({heroTitle:m(n.heroTitle),heroSubtitle:m(n.heroSubtitle),heroTitleMobile:m(n.heroTitleMobile),heroSubtitleMobile:m(n.heroSubtitleMobile),heroImageUrl:m(n.heroImageUrl),heroImageMobileUrl:m(n.heroImageMobileUrl),h1:m(n.h1),metaTitle:m(n.metaTitle),metaDescription:m(n.metaDescription),metaKeywords:m(n.metaKeywords),pcTitleColor:m(n.pcTitleColor),pcSubtitleColor:m(n.pcSubtitleColor),pcTitleSize:u(n.pcTitleSize),pcSubtitleSize:u(n.pcSubtitleSize),mobileTitleColor:m(n.mobileTitleColor),mobileSubtitleColor:m(n.mobileSubtitleColor),mobileTitleSize:u(n.mobileTitleSize),mobileSubtitleSize:u(n.mobileSubtitleSize),searchBackground:m(n.searchBackground),searchBorderColor:m(n.searchBorderColor)})})]})}function p(e){let{sections:l,onSaved:a}=e;return(0,t.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-20 py-16 border-b border-gray-EFEFEF",children:[(0,t.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28",children:"عنوان بخش‌ها"}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mt-4",children:"صفحه فقط یک H1 داره (هدر)، پس عنوان هر بخش H2 یا پایین‌تره. سطح رو فقط وقتی H3 کن که بخش واقعاً زیرمجموعه‌ی بخش بالاییشه."})]}),(0,t.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:l.map(e=>(0,t.jsx)(b,{section:e,onSaved:a},e.key))})]})}function b(e){let{section:l,onSaved:a}=e,[s,n]=(0,i.useState)({title:l.title??"",subtitle:l.subtitle??"",headingLevel:l.headingLevel,isEnabled:l.isEnabled}),[r,d]=(0,i.useState)(!1),{save:o,saving:x}=g(`/api/admin/home/sections/${l.key}`,a),u=e=>{n({...s,...e}),d(!0)};return(0,t.jsxs)("div",{className:"px-20 py-14",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-12 gap-y-8 mb-10",children:[(0,t.jsx)(c.ZD,{checked:s.isEnabled,onChange:e=>u({isEnabled:e})}),(0,t.jsx)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:l.label}),(0,t.jsx)("span",{dir:"ltr",className:"text-11 text-gray-B0AFBC",children:l.key}),r&&(0,t.jsx)(c.zx,{className:"mr-auto",disabled:x,onClick:async()=>{let e=await o({title:s.title.trim()||null,subtitle:s.subtitle.trim()||null,headingLevel:Number(s.headingLevel),isEnabled:s.isEnabled});e&&d(!1)},children:x?"…":"ذخیره"})]}),(0,t.jsxs)("div",{className:"grid md:grid-cols-3 gap-12",children:[(0,t.jsx)(c.gN,{label:"عنوان",children:(0,t.jsx)(c.II,{value:s.title,onChange:e=>u({title:e.target.value})})}),(0,t.jsx)(c.gN,{label:"زیرعنوان",children:(0,t.jsx)(c.II,{value:s.subtitle,onChange:e=>u({subtitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"سطح تیتر",children:(0,t.jsxs)(c.Ph,{value:String(s.headingLevel),onChange:e=>u({headingLevel:Number(e.target.value)}),children:[(0,t.jsx)("option",{value:"2",children:"H2"}),(0,t.jsx)("option",{value:"3",children:"H3"}),(0,t.jsx)("option",{value:"4",children:"H4"})]})})]})]})}let v=[{key:"banners",label:"بنرها",endpoint:"banners",img:"pcImageUrl"},{key:"sliders",label:"پیشنهادات فصل",endpoint:"sliders",img:"imageUrl"},{key:"types",label:"نوع اقامتگاه",endpoint:"types",img:"imageUrl"},{key:"trustBoxes",label:"چرا ما",endpoint:"trust-boxes",img:"iconUrl"},{key:"descSections",label:"ناحیه‌های متنی",endpoint:"desc-sections",img:"pcImageUrl"}];function j(e){let{data:l,onSaved:a}=e,[s,n]=(0,i.useState)(null);return(0,t.jsxs)(t.Fragment,{children:[v.map(e=>{let i=l[e.key];return(0,t.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-20 py-16 flex items-center justify-between border-b border-gray-EFEFEF",children:[(0,t.jsxs)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:[e.label," ",(0,t.jsxs)("span",{className:"text-gray-B0AFBC",children:["(",(0,c.N)(i.length),")"]})]}),(0,t.jsx)(c.zx,{onClick:()=>n({kind:e.key,endpoint:e.endpoint,row:null}),children:"افزودن"})]}),0===i.length?(0,t.jsx)(c.ub,{text:"موردی نیست."}):(0,t.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:i.map(l=>{let i=l[e.img];return(0,t.jsxs)("div",{className:"px-20 py-12 flex items-center gap-x-12",children:[i?(0,t.jsx)("img",{src:(0,c.vD)(i,96),alt:"",className:"w-48 h-32 object-cover rounded-8 bg-gray-F5F5F5 shrink-0"}):(0,t.jsx)("div",{className:"w-48 h-32 rounded-8 bg-gray-F5F5F5 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-13 leading-20 font-m text-gray-1E1D28 truncate",children:l.title||l.name||l.label||"—"}),(l.subtitle||l.link||l.href)&&(0,t.jsx)("div",{dir:"auto",className:"text-11 text-gray-B0AFBC truncate",children:l.subt
1itle||l.link||l.href})]}),!l.isActive&&(0,t.jsx)(c.Ct,{tone:"red",children:"غیرفعال"}),(0,t.jsxs)("div",{className:"mr-auto flex gap-x-10 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>n({kind:e.key,endpoint:e.endpoint,row:l}),className:"text-12 text-primary-main hover:underline",children:"ویرایش"}),(0,t.jsx)("button",{onClick:async()=>{await (0,o.SC)(`/api/admin/home/${e.endpoint}/${l.id}`,{method:"DELETE"}),a()},className:"text-12 text-[#DC2626] hover:underline",children:"حذف"})]})]},l.id)})})]},e.key)}),(0,t.jsx)(N,{settings:l.settings,onSaved:a}),s&&(0,t.jsx)(y,{kind:s.kind,endpoint:s.endpoint,row:s.row,onClose:()=>n(null),onSaved:()=>{n(null),a()}})]})}function N(e){let{settings:l,onSaved:a}=e,s=l??{},[n,d]=(0,i.useState)(s.blogCategorySlug??""),[x,u]=(0,i.useState)(s.blogPostSlugs??[]),[m,p]=(0,i.useState)(""),[b,v]=(0,i.useState)([]),[j,N]=(0,i.useState)(!1),{data:y}=(0,r.u)("/api/admin/blog/categories",e=>(0,o.SC)(e)),{save:C,saving:S,error:I}=g("/api/admin/home/settings",a),f=async()=>{N(!0);try{let{items:e}=await (0,o.Px)(`/api/admin/blog/posts?status=PUBLISHED&pageSize=8&q=${encodeURIComponent(m)}`);v(e??[])}finally{N(!1)}},k=(e,l)=>{let a=e+l;if(a<0||a>=x.length)return;let t=[...x];[t[e],t[a]]=[t[a],t[e]],u(t)};return(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsx)("div",{className:"text-14 leading-22 font-m text-gray-1E1D28 mb-4",children:"مقالات راهنمای سفر"}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mb-14",children:"اسلایدر انتهای صفحه اصلی، از مقاله‌های واقعی بلاگ. یا چند مقاله‌ی مشخص انتخاب کن، یا یک دسته‌بندی بذار تا تازه‌ترین‌های همون دسته نشون داده بشه. هیچ‌کدوم رو نذاری، تازه‌ترین مقاله‌های کل بلاگ نشون داده می‌شه."}),(0,t.jsx)(c.gN,{label:"دسته‌بندی",hint:x.length?"چون مقاله‌ی مشخص انتخاب شده، این نادیده گرفته می‌شه.":void 0,children:(0,t.jsxs)(c.Ph,{value:n,onChange:e=>d(e.target.value),children:[(0,t.jsx)("option",{value:"",children:"— آخرین مقاله‌های کل بلاگ —"}),(y??[]).map(e=>(0,t.jsx)("option",{value:e.slug,children:e.name},e.slug))]})}),(0,t.jsxs)("div",{className:"mt-14",children:[(0,t.jsx)(c.gN,{label:"یا مقاله‌های مشخص (اولویت با این‌هاست)",children:(0,t.jsxs)("div",{className:"flex gap-x-8",children:[(0,t.jsx)(c.II,{value:m,onChange:e=>p(e.target.value),onKeyDown:e=>"Enter"===e.key&&f(),placeholder:"جست‌وجوی عنوان مقاله…"}),(0,t.jsx)(c.zx,{type:"button",onClick:f,disabled:j,children:j?"…":"جست‌وجو"})]})}),b.length>0&&(0,t.jsx)("div",{className:"mt-8 flex flex-col gap-y-6",children:b.map(e=>{let l=x.includes(e.slug);return(0,t.jsxs)("div",{className:"flex items-center justify-between gap-x-8 text-13 px-10 py-6 rounded-8 bg-gray-F5F5F5",children:[(0,t.jsx)("span",{className:"truncate",children:e.title}),(0,t.jsx)("button",{type:"button",disabled:l||x.length>=12,onClick:()=>u([...x,e.slug]),className:"text-12 text-primary-main disabled:text-gray-B0AFBC shrink-0",children:l?"افزوده شد":"افزودن"})]},e.id)})}),x.length>0&&(0,t.jsx)("div",{className:"mt-14 flex flex-col gap-y-6",children:x.map((e,l)=>(0,t.jsxs)("div",{dir:"auto",className:"flex items-center gap-x-8 text-12 px-10 py-6 rounded-8 border border-gray-EFEFEF",children:[(0,t.jsx)("span",{className:"grow truncate",children:decodeURIComponent(e)}),(0,t.jsx)("button",{type:"button",onClick:()=>k(l,-1),disabled:0===l,className:"disabled:opacity-30",children:"▲"}),(0,t.jsx)("button",{type:"button",onClick:()=>k(l,1),disabled:l===x.length-1,className:"disabled:opacity-30",children:"▼"}),(0,t.jsx)("button",{type:"button",onClick:()=>u(x.filter((e,a)=>a!==l)),className:"text-[#DC2626]",children:"✕"})]},e))})]}),(0,t.jsx)(h,{saving:S,error:I,onSave:()=>C({blogCategorySlug:n||null,blogPostSlugs:x})})]})}function y(e){let{kind:l,endpoint:a,row:s,onClose:n,onSaved:r}=e,[d,o]=(0,i.useState)({name:(null==s?void 0:s.name)??"",title:(null==s?void 0:s.title)??"",subtitle:(null==s?void 0:s.subtitle)??"",link:(null==s?void 0:s.link)??"",contentHtml:(null==s?void 0:s.contentHtml)??"",pcImageUrl:(null==s?void 0:s.pcImageUrl)??"",mobileImageUrl:(null==s?void 0:s.mobileImageUrl)??"",imageUrl:(null==s?void 0:s.imageUrl)??"",iconUrl:(null==s?void 0:s.iconUrl)??"",authorName:(null==s?void 0:s.authorName)??"",alt:(null==s?void 0:s.alt)??"",showInMobile:(null==s?void 0:s.showInMobile)??
1!0,headingLevel:(null==s?void 0:s.headingLevel)??2,isActive:(null==s?void 0:s.isActive)??!0,sortOrder:(null==s?void 0:s.sortOrder)??0}),{save:x,saving:u,error:h}=g(s?`/api/admin/home/${a}/${s.id}`:`/api/admin/home/${a}`,r),m=e=>(null==e?void 0:e.trim())?e.trim():null,p=e=>(({banners:["name","link","pcImageUrl","mobileImageUrl","alt"],sliders:["title","link","imageUrl","alt"],types:["title","subtitle","link","imageUrl","alt","showInMobile"],trustBoxes:["title","subtitle","iconUrl","alt"],descSections:["title","contentHtml","pcImageUrl","mobileImageUrl","alt","headingLevel"]})[l]??[]).includes(e),b={isActive:d.isActive,sortOrder:Number(d.sortOrder)||0};for(let e of["name","title","subtitle","link","contentHtml","pcImageUrl","mobileImageUrl","imageUrl","iconUrl","authorName","alt"])p(e)&&(b[e]=m(d[e]));return p("showInMobile")&&(b.showInMobile=d.showInMobile),p("headingLevel")&&(b.headingLevel=Number(d.headingLevel)),(0,t.jsx)(c.u_,{open:!0,title:s?"ویرایش":"افزودن",onClose:n,width:"max-w-[680px]",children:(0,t.jsxs)("div",{className:"flex flex-col gap-y-14",children:[p("name")&&(0,t.jsx)(c.gN,{label:"نام",children:(0,t.jsx)(c.II,{value:d.name,onChange:e=>o({...d,name:e.target.value})})}),p("title")&&(0,t.jsx)(c.gN,{label:"عنوان",children:(0,t.jsx)(c.II,{value:d.title,onChange:e=>o({...d,title:e.target.value})})}),p("subtitle")&&(0,t.jsx)(c.gN,{label:"زیرعنوان",children:(0,t.jsx)(c.II,{value:d.subtitle,onChange:e=>o({...d,subtitle:e.target.value})})}),p("authorName")&&(0,t.jsx)(c.gN,{label:"نویسنده",children:(0,t.jsx)(c.II,{value:d.authorName,onChange:e=>o({...d,authorName:e.target.value})})}),p("contentHtml")&&(0,t.jsx)(c.gN,{label:"متن",hint:"HTML مجازه.",children:(0,t.jsx)("textarea",{rows:6,value:d.contentHtml,onChange:e=>o({...d,contentHtml: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 font-mono"})}),p("link")&&(0,t.jsx)(c.gN,{label:"لینک",hint:"لینک‌های قدیمی سرور-ساید به مقصد نهایی resolve می‌شن.",children:(0,t.jsx)(c.II,{dir:"ltr",value:d.link,onChange:e=>o({...d,link:e.target.value})})}),["pcImageUrl","mobileImageUrl","imageUrl","iconUrl"].map(e=>p(e)?(0,t.jsx)(c.gN,{label:{pcImageUrl:"تصویر دسکتاپ",mobileImageUrl:"تصویر موبایل",imageUrl:"تصویر",iconUrl:"آیکن"}[e],children:(0,t.jsx)(c.II,{dir:"ltr",value:d[e],onChange:l=>o({...d,[e]:l.target.value})})},e):null),p("alt")&&(0,t.jsx)(c.gN,{label:"متن جایگزین تصویر (alt)",hint:"برای دسترس‌پذیری و سئوی تصویر لازمه.",children:(0,t.jsx)(c.II,{value:d.alt,onChange:e=>o({...d,alt:e.target.value})})}),p("headingLevel")&&(0,t.jsx)(c.gN,{label:"سطح تیتر",children:(0,t.jsxs)(c.Ph,{value:String(d.headingLevel),onChange:e=>o({...d,headingLevel:e.target.value}),children:[(0,t.jsx)("option",{value:"2",children:"H2"}),(0,t.jsx)("option",{value:"3",children:"H3"})]})}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-14 items-end",children:[(0,t.jsx)(c.gN,{label:"ترتیب",children:(0,t.jsx)(c.II,{type:"number",value:d.sortOrder,onChange:e=>o({...d,sortOrder:e.target.value})})}),(0,t.jsxs)("div",{className:"pb-8 flex flex-col gap-y-8",children:[(0,t.jsx)(c.ZD,{checked:d.isActive,onChange:e=>o({...d,isActive:e}),label:"فعال"}),p("showInMobile")&&(0,t.jsx)(c.ZD,{checked:d.showInMobile,onChange:e=>o({...d,showInMobile:e}),label:"نمایش در موبایل"})]})]}),h&&(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:h}),(0,t.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,t.jsx)(c.zx,{variant:"ghost",onClick:n,children:"انصراف"}),(0,t.jsx)(c.zx,{disabled:u,onClick:()=>x(b,s?"PATCH":"POST"),children:u?"در حال ذخیره…":"ذخیره"})]})]})})}function C(e){let{data:l,onSaved:a}=e,s=l.settings??{},[n,r]=(0,i.useState)({appEnabled:s.appEnabled??!1,appTitle:s.appTitle??"",appSubtitle:s.appSubtitle??"",appImageUrl:s.appImageUrl??"",appBazaarUrl:s.appBazaarUrl??"",appMyketUrl:s.appMyketUrl??"",appSibappUrl:s.appSibappUrl??"",appDirectUrl:s.appDirectUrl??"",videoEnabled:s.videoEnabled??!1,videoTitle:s.videoTitle??"",videoDescription:s.videoDescription??"",videoUrl:s.videoUrl??"",videoPosterUrl:s.videoPosterUrl??""}),{save:d,saving:x,error:u}=g("/api/admin/home/settings",a),m=e=>e.trim()?e.trim():null,[p,b]=(0,i.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsxs)("div",{className:"flex items-center gap-x-12 mb-4",children:[(0,t.jsx)(c.ZD,{checked:n.appEnabled,onChange:e=>r({...n,appEnabled:e})}),(0,t.jsx)("span",{className:"text-14 leading-22 font-m text-gray-1E1D28",children:"بخش اپلیکیشن"})]}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mb-14",children:"این بخش توی اودو وجود نداشت — از صفر ساخته شده، پس محتواش رو باید خودت پر کنی. تا وقتی خاموشه، روی صفحه نمایش داده نمی‌شه."}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,t.jsx)(c.gN,{label:"عنوان",children:(0,t.jsx)(c.II,{value:n.appTitle,onChange:e=>r({...n,appTitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"زیرعنوان",children:(0,t.jsx)(c.II,{value:n.appSubtitle,onChange:e=>r({...n,appSubtitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"تصویر",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.appImageUrl,onChange:e=>r({...n,appImageUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"لینک دانلود مستقیم",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.appDirectUrl,onChange:e=>r({...n,appDirectUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"بازار",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.appBazaarUrl,onChange:e=>r({...n,appBazaarUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"مایکت",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.appMyketUrl,onChange:e=>r({...n,appMyketUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"سیب‌اپ",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.appSibappUrl,onChange:e=>r({...n,appSibappUrl:e.target.value})})})]})]}),(0,t.jsxs)(c.Zb,{className:"px-20 py-18",children:[(0,t.jsxs)("div",{className:"flex items-center gap-x-12 mb-4",children:[(0,t.jsx)(c.ZD,{checked:n.videoEnabled,onChange:e=>r({...n,videoEnabled:e})}),(0,t.jsx)("span",{className:"text-14 leading-22 font-m text-gray-1E1D28",children:"ویدیو معرفی"})]}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mb-14",children:"این هم توی اودو نبود. لینک آپارات یا فایل ویدیو رو بذار."}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,t.jsx)(c.gN,{label:"عنوان",children:(0,t.jsx)(c.II,{value:n.videoTitle,onChange:e=>r({...n,videoTitle:e.target.value})})}),(0,t.jsx)(c.gN,{label:"لینک ویدیو",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.videoUrl,onChange:e=>r({...n,videoUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"تصویر پوستر",hint:"تا قبل از پخش نشون داده می‌شه؛ برای LCP مهمه.",children:(0,t.jsx)(c.II,{dir:"ltr",value:n.videoPosterUrl,onChange:e=>r({...n,videoPosterUrl:e.target.value})})})]}),(0,t.jsx)(c.gN,{label:"توضیحات",className:"mt-14",children:(0,t.jsx)("textarea",{rows:3,value:n.videoDescription,onChange:e=>r({...n,videoDescription: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,t.jsx)(h,{saving:x,error:u,hint:"بخش اپلیکیشن و ویدیو با هم ذخیره می‌شن. پیشنهادهای سرچ جداگانه‌ن.",onSave:()=>d({appEnabled:n.appEnabled,appTitle:m(n.appTitle),appSubtitle:m(n.appSubtitle),appImageUrl:m(n.appImageUrl),appBazaarUrl:m(n.appBazaarUrl),appMyketUrl:m(n.appMyketUrl),appSibappUrl:m(n.appSibappUrl),appDirectUrl:m(n.app
1DirectUrl),videoEnabled:n.videoEnabled,videoTitle:m(n.videoTitle),videoDescription:m(n.videoDescription),videoUrl:m(n.videoUrl),videoPosterUrl:m(n.videoPosterUrl)})}),(0,t.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-20 py-16 flex items-center justify-between border-b border-gray-EFEFEF",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:"پیشنهادهای سرچ‌باکس"}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mt-2",children:"چیپس‌های زیر جعبه‌ی جستجو. توی اودو نبود."})]}),(0,t.jsx)(c.zx,{onClick:()=>b(!0),children:"افزودن"})]}),0===l.suggestions.length?(0,t.jsx)(c.ub,{text:"پیشنهادی تعریف نشده."}):(0,t.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:l.suggestions.map(e=>(0,t.jsxs)("div",{className:"px-20 py-12 flex items-center gap-x-12",children:[(0,t.jsx)("span",{className:"text-13 text-gray-1E1D28",children:e.label}),(0,t.jsx)("span",{dir:"ltr",className:"text-11 text-gray-B0AFBC",children:e.href}),!e.isActive&&(0,t.jsx)(c.Ct,{tone:"red",children:"غیرفعال"}),(0,t.jsx)("button",{onClick:async()=>{await (0,o.SC)(`/api/admin/home/suggestions/${e.id}`,{method:"DELETE"}),a()},className:"mr-auto text-12 text-[#DC2626] hover:underline",children:"حذف"})]},e.id))})]}),p&&(0,t.jsx)(S,{onClose:()=>b(!1),onSaved:()=>{b(!1),a()}})]})}function S(e){let{onClose:l,onSaved:a}=e,[s,n]=(0,i.useState)({label:"",href:"",sortOrder:0}),{save:r,saving:d,error:o}=g("/api/admin/home/suggestions",a);return(0,t.jsx)(c.u_,{open:!0,title:"افزودن پیشنهاد سرچ",onClose:l,children:(0,t.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,t.jsx)(c.gN,{label:"متن",children:(0,t.jsx)(c.II,{value:s.label,onChange:e=>n({...s,label:e.target.value})})}),(0,t.jsx)(c.gN,{label:"لینک",hint:"مثل /search/shiraz?pool=1",children:(0,t.jsx)(c.II,{dir:"ltr",value:s.href,onCh
1ange:e=>n({...s,href:e.target.value})})}),(0,t.jsx)(c.gN,{label:"ترتیب",children:(0,t.jsx)(c.II,{type:"number",value:s.sortOrder,onChange:e=>n({...s,sortOrder:Number(e.target.value)})})}),o&&(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:o}),(0,t.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,t.jsx)(c.zx,{variant:"ghost",onClick:l,children:"انصراف"}),(0,t.jsx)(c.zx,{disabled:d||!s.label.trim()||!s.href.trim(),onClick:()=>r({label:s.label.trim(),href:s.href.trim(),sortOrder:Number(s.sortOrder)||0},"POST"),children:d?"در حال ذخیره…":"ذخیره"})]})]})})}let I=[{value:"CITY",label:"شهر یا منطقه",needsSlug:!0},{value:"TAG",label:"تگ",needsSlug:!0},{value:"TYPE",label:"نوع اقامتگاه",needsSlug:!0},{value:"FAST",label:"رزرو آنی",needsSlug:!1},{value:"OFFER",label:"تخفیف‌دار",needsSlug:!1},{value:"TOP_RATED",label:"پرامتیازترین",needsSlug:!1},{value:"ALL",label:"همه (فقط بر اساس اولویت)",needsSlug:!1}];function f(e){let{rails:l,onSaved:a}=e,{data:s}=(0,r.u)("/api/admin/home/rail-sources",e=>(0,o.SC)(e)),[n,d]=(0,i.useState)(null),[x,u]=(0,i.useState)(!1);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-20 py-16 flex items-center justify-between border-b border-gray-EFEFEF",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:["اسلایدرهای صفحه اصلی ",(0,t.jsxs)("span",{className:"text-gray-B0AFBC",children:["(",(0,c.N)(l.length),")"]})]}),(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC mt-2",children:"ترتیب نمایش با \xabترتیب\xbb تعیین می‌شه. اسلایدر اقامتگاه خودش پر می‌شه؛ اقامتگاه‌ها به ترتیب \xabاولویت\xbb خودشون میان."})]}),(0,t.jsx)(c.zx,{onClick:()=>u(!0),children:"افزودن اسلایدر"})]}),0===l.length?(0,t.jsx)(c.ub,{text:"اسلایدری تعریف نشده."}):(0,t.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:l.map(e=>{var l;let i=I.find(l=>l.value===e.sourceType),s="RESIDENCE"===e.kind?[(null==i?void 0:i.label)??"—",e.sourceSlug||null,(0,c.N)(e.take)+" کارت"].filter(Boolean).join(" \xb7 "):(0,c.N)((null===(l=e.items)||void 0===l?void 0:l.length)??0)+" آیتم";return(0,t.jsxs)("div",{className:"px-20 py-12 flex items-center gap-x-12",children:[(0,t.jsx)(c.Ct,{tone:"RESIDENCE"===e.kind?"blue":"purple",children:"RESIDENCE"===e.kind?"اقامتگاه":"شهر و تگ"}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-13 leading-20 font-m text-gray-1E1D28 truncate",children:e.title||"بدون عنوان"}),(0,t.jsxs)("div",{dir:"auto",className:"text-11 text-gray-B0AFBC truncate",children:[s," \xb7 ترتیب ",(0,c.N)(e.sortOrder)," \xb7 H",(0,c.N)(e.headingLevel)]})]}),!e.isEnabled&&(0,t.jsx)(c.Ct,{tone:"red",children:"غیرفعال"}),(0,t.jsxs)("div",{className:"mr-auto flex gap-x-10 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>d(e),className:"text-12 text-primary-main hover:underline",children:"ویرایش"}),(0,t.jsx)("button",{onClick:async()=>{await (0,o.SC)("/api/admin/home/rails/"+e.id,{method:"DELETE"}),a()},className:"text-12 text-[#DC2626] hover:underline",children:"حذف"})]})]},e.id)})})]}),(x||n)&&(0,t.jsx)(k,{rail:n,sources:s,onClose:()=>{u(!1),d(null)},onSaved:()=>{u(!1),d(null),a()}})]})}function k(e){let{rail:l,sources:a,onClose:s,onSaved:n}=e,[r,d]=(0,i.useState)({kind:(null==l?void 0:l.kind)??"RESIDENCE",title:(null==l?void 0:l.title)??"",subtitle:(null==l?void 0:l.subt
1itle)??"",headingLevel:(null==l?void 0:l.headingLevel)??2,sourceType:(null==l?void 0:l.sourceType)??"CITY",sourceSlug:(null==l?void 0:l.sourceSlug)??"",take:(null==l?void 0:l.take)??15,linkTo:(null==l?void 0:l.linkTo)??"",isEnabled:(null==l?void 0:l.isEnabled)??!0,sortOrder:(null==l?void 0:l.sortOrder)??0}),{save:o,saving:x,error:u}=g(l?"/api/admin/home/rails/"+l.id:"/api/admin/home/rails",n),h=I.find(e=>e.value===r.sourceType),m="CITY"===r.sourceType?null==a?void 0:a.cities.map(e=>({slug:e.slug,name:e.name+" ("+(0,c.N)(e.count)+")"})):"TAG"===r.sourceType?null==a?void 0:a.tags:"TYPE"===r.sourceType?null==a?void 0:a.types:void 0,p=e=>e.trim()?e.trim():null;return(0,t.jsx)(c.u_,{open:!0,title:l?"ویرایش اسلایدر":"افزودن اسلایدر",onClose:s,children:(0,t.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,t.jsx)(c.gN,{label:"نوع اسلایدر",children:(0,t.jsxs)(c.Ph,{value:r.kind,onChange:e=>d({...r,kind:e.target.value}),children:[(0,t.jsx)("option",{value:"RESIDENCE",children:"اسلایدر اقامتگاه — خودکار پر می‌شه"}),(0,t.jsx)("option",{value:"DESTINATION",children:"اسلایدر شهر و تگ — آیتم‌ها رو خودت می‌سازی"})]})}),(0,t.jsx)(c.gN,{label:"عنوان",hint:"همون تیتری که بالای اسلایدر دیده می‌شه.",children:(0,t.jsx)(c.II,{value:r.title,onChange:e=>d({...r,title:e.target.value})})}),"RESIDENCE"===r.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(c.gN,{label:"منبع اقامتگاه‌ها",children:(0,t.jsx)(c.Ph,{value:r.sourceType,onChange:e=>d({...r,sourceType:e.target.value,sourceSlug:""}),children:I.map(e=>(0,t.jsx)("option",{value:e.value,children:e.label},e.value))})}),!!(null==h?void 0:h.needsSlug)&&(0,t.jsx)(c.gN,{label:"CITY"===r.sourceType?"شهر":"TAG"===r.sourceType?"تگ":"نوع",hint:"CITY"===r.sourceType?"شهرهای زیرمجموعه هم خودکار میان (مثل شمال).":void 0,children:(0,t.jsxs)(c.Ph,{value:r.sourceSlug,onChange:e=>d({...r,sourceSlug:e.target.value}),children:[(0,t.jsx)("option",{value:"",children:"— انتخاب کنید —"}),(m??[]).map(e=>(0,t.jsxs)("option",{value:e.slug,children:[e.name," — ",e.slug]},e.slug))]})}),(0,t.jsx)(c.gN,{label:"تعداد کارت",hint:"حداکثر ۳۰.",children:(0,t.jsx)(c.II,{type:"number",value:r.take,onChange:e=>d({...r,take:Number(e.target.value)})})})]}),(0,t.jsx)(c.gN,{label:"لینک \xabمشاهده همه\xbb",hint:"خالی بذاری، از روی منبع ساخته می‌شه.",children:(0,t.jsx)(c.II,{dir:"ltr",value:r.linkTo,onChange:e=>d({...r,linkTo:e.target.value})})}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-14",children:[(0,t.jsx)(c.gN,{label:"سطح تیتر",children:(0,t.jsxs)(c.Ph,{value:String(r.headingLevel),onChange:e=>d({...r,headingLevel:Number(e.target.value)}),children:[(0,t.jsx)("option",{value:"2",children:"H2"}),(0,t.jsx)("option",{value:"3",children:"H3"}),(0,t.jsx)("option",{value:"4",children:"H4"})]})}),(0,t.jsx)(c.gN,{label:"ترتیب",children:(0,t.jsx)(c.II,{type:"number",value:r.sortOrder,onChange:e=>d({...r,sortOrder:Number(e.target.value)})})})]}),(0,t.jsxs)("div",{className:"flex items-center gap-x-12",children:[(0,t.jsx)(c.ZD,{checked:r.isEnabled,onChange:e=>d({...r,isEnabled:e})}),(0,t.jsx)("span",{className:"text-13 leading-22 text-gray-1E1D28",children:"فعال"})]}),"DESTINATION"===r.kind&&!!l&&(0,t.jsx)(E,{rail:l,onSaved:n}),"DESTINATION"===r.kind&&!l&&(0,t.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC",children:"اول اسلایدر رو ذخیره کن، بعد آیتم‌هاش رو اضافه کن."}),u&&(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:u}),(0,t.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,t.jsx)(c.zx,{variant:"ghost",onClick:s,children:"انصراف"}),(0,t.jsx)(c.zx,{disabled:x,onClick:()=>o({kind:r.kind,title:p(r.title),subtitle:p(r.subtitle),headingLevel:Number(r.headingLevel),sourceType:"RESIDENCE"===r.kind?r.sourceType:null,sourceSlug:"RESIDENCE"===r.kind?p(r.sourceSlug):null,take:Number(r.take)||15,linkTo:p(r.linkTo),isEnabled:r.isEnabled,sortOrder:Number(r.sortOrder)||0},l?"PATCH":"POST"),children:x?"در حال ذخیره…":"ذخیره"})]})]})})}function E(e){var l,a;let{rail:s,onSaved:n}=e,[r,d]=(0,i.useState)({title:"",imageUrl:"",link:""}),{save:x,saving:u,error:h}=g("/api/admin/home/rail-items",n);return(0,t.jsxs)("div",{className:"rounded-12 border border-gray-EFEFEF p-14",children:[(0,t.jsxs)("div",{className:"text-13 leading-22 font-m text-gray-1E1D28 mb-10",children:["آیتم‌ها ",(0,t.jsxs)("span",{className:"text-gray-B0AFBC",children:["(",(0,c.N)((null===(l=s.items)||void 0===l?void 0:l.length)??0),")"]})]}),((null===(a=s.items)||void 0===a?void 0:a.length)??0)>0&&(0,t.jsx)("div",{className:"flex flex-col gap-y-8 mb-12",children:s.items.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-x-10",children:[e.imageUrl?(0,t.jsx)("img",{src:(0,c.vD)(e.imageUrl,96),alt:"",className:"w-40 h-28 object-cover rounded-6 bg-gray-F5F5F5 shrink-0"}):(0,t.jsx)("div",{className:"w-40 h-28 rounded-6 bg-gray-F5F5F5 shrink-0"}),(0,t.jsx)("span",{className:"text-12 text-gray-1E1D28 truncate",children:e.title}),(0,t.jsx)("span",{dir:"ltr",className:"text-11 text-gray-B0AFBC truncate",children:e.link}),(0,t.jsx)("button",{onClick:async()=>{await (0,o.SC)("/api/admin/home/rail-items/"+e.id,{method:"DELETE"}),n()},className:"mr-auto text-12 text-[#DC2626] hover:underline shrink-0",children:"حذف"})]},e.id))}),(0,t.jsxs)("div",{className:"grid md:grid-cols-3 gap-10",children:[(0,t.jsx)(c.gN,{label:"عنوان",children:(0,t.jsx)(c.II,{value:r.title,onChange:e=>d({...r,title:e.target.value})})}),(0,t.jsx)(c.gN,{label:"تصویر",children:(0,t.jsx)(c.II,{dir:"ltr",value:r.
1imageUrl,onChange:e=>d({...r,imageUrl:e.target.value})})}),(0,t.jsx)(c.gN,{label:"لینک",children:(0,t.jsx)(c.II,{dir:"ltr",value:r.link,onChange:e=>d({...r,link:e.target.value})})})]}),h&&(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626] mt-8",children:h}),(0,t.jsx)("div",{className:"flex justify-end mt-10",children:(0,t.jsx)(c.zx,{variant:"ghost",disabled:u||!r.title.trim(),onClick:async()=>{var e;let l=await x({railId:s.id,title:r.title.trim(),imageUrl:r.imageUrl.trim()||null,link:r.link.trim()||null,sortOrder:((null===(e=s.items)||void 0===e?void 0:e.length)??0)*10},"POST");l&&d({title:"",imageUrl:"",link:""})},children:u?"…":"افزودن آیتم"})})]})}function T(){let{data:e,isLoading:l,mutate:a}=(0,r.u)("/api/admin/faqs?scope=PAGE&path=%2F",e=>(0,o.SC)(e)),[s,d]=(0,i.useState)(null),[x,u]=(0,i.useState)(!1),h=e??[];return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,t.jsxs)("div",{className:"px-20 py-16 flex items-center justify-between border-b border-gray-EFEFEF",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"text-13 leading-22 font-m text-gray-1E1D28",children:["سوالات متداول صفحه اصلی"," ",(0,t.jsxs)("span",{className:"text-gray-B0AFBC",children:["(",(0,c.N)(h.length),")"]})]}),(0,t.jsxs)("p",{className:"text-11 leading-20 text-gray-B0AFBC mt-2",children:["این سوال‌ها فقط روی صفحه اصلی نمایش داده می‌شن و با schema.org/FAQPage به گوگل معرفی می‌شن. برای صفحات دیگه به"," ",(0,t.jsx)(n(),{href:"/admin/settings/faqs",className:"text-primary-main hover:underline",children:"تنظیمات سوالات متداول"})," ","برو."]})]}),(0,t.jsx)(c.zx,{onClick:()=>u(!0),children:"افزودن سوال"})]}),l?(0,t.jsx)("div",{className:"p-20",children:(0,t.jsx)(c.Od,{className:"h-48"})}):0===h.length?(0,t.jsx)(c.ub,{text:"هنوز سوالی برای صفحه اصلی نوشته نشده."}):(0,t.jsx)("div",{className:"divide-y divide-gray-F5F5F5",children:h.map(e=>(0,t.jsxs)("div",{className:"px-20 py-12 flex items-center gap-x-12",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("div",{className:"text-13 leading-20 font-m text-gray-1E1D28 truncate",children:e.question}),(0,t.jsx)("div",{className:"text-11 text-gray-B0AFBC truncate",children:e.answer})]}),!e.isActive&&(0,t.jsx)(c.Ct,{tone:"red",children:"غیرفعال"}),(0,t.jsxs)("div",{className:"mr-auto flex gap-x-10 shrink-0",children:[(0,t.jsx)("button",{onClick:()=>d(e),className:"text-12 text-primary-main hover:underline",children:"ویرایش"}),(0,t.jsx)("button",{onClick:async()=>{await (0,o.SC)("/api/admin/faqs/"+e.id,{method:"DELETE"}),a()},className:"text-12 text-[#DC2626] hover:underline",children:"حذف"})]})]},e.id))})]}),(x||s)&&(0,t.jsx)(F,{faq:s,onClose:()=>{u(!1),d(null)},onSaved:()=>{u(!1),d(null),a()}})]})}function F(e){let{faq:l,onClose:a,onSaved:s}=e,[n,r]=(0,i.useState)({question:(null==l?void 0:l.question)??"",answer:(null==l?void 0:l.answer)??"",isActive:(null==l?void 0:l.isActive)??!0,sortOrder:(null==l?void 0:l.sortOrder)??0}),{save:d,saving:o,error:x}=g(l?"/api/admin/faqs/"+l.id:"/api/admin/faqs",s);return(0,t.jsx)(c.u_,{open:!0,title:l?"ویرایش سوال":"افزودن سوال صفحه اصلی",onClose:a,children:(0,t.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,t.jsx)(c.gN,{label:"سوال",children:(0,t.jsx)(c.II,{value:n.question,onChange:e=>r({...n,question:e.target.value})})}),(0,t.jsx)(c.gN,{label:"پاسخ",hint:"می‌تونی HTML ساده بذاری.",children:(0,t.jsx)("textarea",{rows:5,value:n.answer,onChange:e=>r({...n,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,t.jsxs)("div",{className:"grid grid-cols-2 gap-14 items-end",children:[(0,t.jsx)(c.gN,{label:"ترتیب",children:(0,t.jsx)(c.II,{type:"number",value:n.sortOrder,onChange:e=>r({...n,sortOrder:Number(e.target.value)})})}),(0,t.jsxs)("div",{className:"flex items-center gap-x-12 pb-8",children:[(0,t.jsx)(c.ZD,{checked:n.isActive,onChange:e=>r({...n,isActive:e})}),(0,t.jsx)("span",{className:"text-13 leading-22 text-gray-1E1D28",children:"فعال"})]})]}),x&&(0,t.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:x}),(0,t.jsxs)("div",{className:"flex gap-x-8 justify-end",children:[(0,t.jsx)(c.zx,{variant:"ghost",onClick:a,children:"انصراف"}),(0,t.jsx)(c.zx,{disabled:o||!n.question.trim()||!n.answer.trim(),onClick:()=>d({scope:"PAGE",path:"/",locationId:null,tagId:null,question:n.question.trim(),answer:n.answer.trim(),isActive:n.isActive,sortOrder:Number(n.sortOrder)||0},l?"PATCH":"POST"),children:o?"در حال ذخیره…":"ذخیره"})]})]})})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=36124)}),_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.