1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8031],{73695:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/locations",function(){return a(83741)}])},83741:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return g}});var l=a(85893),n=a(67294),s=a(41664),i=a.n(s),r=a(44389),d=a(49759),o=a(84858),c=a(32474);let x=[{value:"COUNTRY",label:"Ú©Ø´ÙØ±"},{value:"PROVINCE",label:"استاÙ"},{value:"CITY",label:"Ø´ÙØ±"},{value:"REGION",label:"Ù
ÙØ·ÙÙ"},{value:"VILLAGE",label:"Ø±ÙØ³ØªØ§"},{value:"NEIGHBORHOOD",label:"Ù
ØÙÙ"}],h=Object.fromEntries(x.map(e=>[e.value,e.label])),m={COUNTRY:"bg-[#EEF2FF] text-[#4338CA]",PROVINCE:"bg-[#ECFDF5] text-[#047857]",CITY:"bg-[#EFF6FF] text-[#1D4ED8]",REGION:"bg-[#FFF7ED] text-[#C2410C]",VILLAGE:"bg-[#F0FDF4] text-[#15803D]",NEIGHBORHOOD:"bg-[#FDF4FF] text-[#A21CAF]"},p="https://lidomatrip.com";function g(){let[e,t]=(0,n.useState)(""),[a,s]=(0,n.useState)(""),[p,g]=(0,n.useState)(null),[y,v]=(0,n.useState)(!1),{data:N,isLoading:b,mutate:f}=(0,r.u)("/api/admin/locations",e=>(0,o.SC)(e)),C=N??[],F=(0,n.useMemo)(()=>new Map(C.map(e=>[e.id,e])),[C]),E=(0,n.useMemo)(()=>{let t=e.trim();return C.filter(e=>(!a||e.type===a)&&(!t||e.name.includes(t)||(e.titleEn??"").toLowerCase().includes(t.toLowerCase())))},[C,e,a]),I=(0,n.useMemo)(()=>{let e={};
1return C.forEach(t=>e[t.type]=(e[t.type]??0)+1),e},[C]),w=(0,n.useMemo)(()=>{let e=new Map;return C.forEach(t=>{var a;let l=null===(a=t.titleEn)||void 0===a?void 0:a.trim().toLowerCase();l&&(e.has(l)||e.set(l,[]),e.get(l).push(t))}),[...e.entries()].filter(e=>{let[,t]=e;return t.length>1})},[C]),D=C.filter(e=>{var t;return!(null===(t=e.titleEn)||void 0===t?void 0:t.trim())}).length;return(0,l.jsxs)(d.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)(c.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)("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/tags",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/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)("div",{className:"grid grid-cols-2 md:grid-cols-6 gap-12",children:x.map(e=>(0,l.jsxs)("button",{onClick:()=>s(a===e.value?"":e.value),className:`rounded-12 px-16 py-14 text-right transition border ${a===e.value?"border-primary-main bg-primary-main/5":"border-gray-EFEFEF bg-white hover:border-gray-D9D9D9"}`,children:[(0,l.jsx)("div",{className:"text-12 leading-18 text-gray-6C6A7D",children:e.label}),(0,l.jsx)("div",{className:"text-20 leading-28 font-b text-gray-1E1D28",children:(0,c.N)(I[e.value]??0)})]},e.value))}),(w.length>0||D>0)&&(0,l.jsxs)(c.Zb,{className:"px-20 py-16 border-r-4 border-r-[#F59E0B]",children:[(0,l.jsx)("div",{className:"text-13 leading-22 font-m text-gray-1E1D28 mb-6",children:"ÙکتÙâÙØ§Û سئÙÛÛ"}),w.length>0&&(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:[(0,c.N)(w.length)," Ø§Ø³ÙØ§Ú¯ ØªÚ©Ø±Ø§Ø±Û Ø¯Ø± دادÙâÛ Ø§ÙØ¯Ù ÙØ¬Ùد دار٠(Ù
Ø«Ù"," ",(0,l.jsx)("span",{className:"font-m",children:w[0][0]})," Ú©Ù ÙÙ
براÛ"," ",w[0][1].map(e=>`${e.name} (${h[e.type]})`).join(" Ù ")," ثبت شدÙ). اÛÙâÙØ§ عÙ
دا٠دستâÙØ®Ùرد٠Ù
ÙÙØ¯Ù ÚÙ٠آدرسâÙØ§Û اÛÙØ¯Ú©Ø³âØ´Ø¯Ù Ø±ÙØ´ÙÙ Ø¨ÙØ§ شد٠â ÙÙÛ Ø§Ø³ÙØ§Ú¯ ØªÚ©Ø±Ø§Ø±Û Ø¬Ø¯ÛØ¯ Ù¾Ø°ÛØ±Ùت٠ÙÙ
ÛâØ´Ù."]}),D>0&&(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D mt-4",children:[(0,c.N)(D)," Ù
Ú©Ø§Ù Ø§Ø³ÙØ§Ú¯ اÙÚ¯ÙÛØ³Û ÙØ¯Ø§Ø±Ù Ù ØµÙØÙâÛ Ø³Ø±Ú Ø§Ø®ØªØµØ§ØµÛ ÙÙ
ÛâÚ¯ÛØ±Ù."]})]}),(0,l.jsxs)(c.Zb,{className:"p-0 overflow-hidden",children:[(0,l.jsxs)("div",{className:"px-20 py-16 flex flex-wrap items-center gap-12 border-b border-gray-EFEFEF",children:[(0,l.jsx)(c.II,{value:e,onChange:e=>t(e.target.value),placeholder:"جستجÙÛ ÙØ§Ù
ÙØ§Ø±Ø³Û ÛØ§ Ø§Ø³ÙØ§Ú¯â¦",className:"flex-1 min-w-[220px]"}),(0,l.jsxs)(c.Ph,{value:a,onChange:e=>s(e.target.value),className:"w-[160px]",children:[(0,l.jsx)("option",{value:"",children:"ÙÙ
ÙâÛ Ø§ÙÙØ§Ø¹"}),x.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,l.jsx)(c.zx,{onClick:()=>v(!0),children:"Ø§ÙØ²Ùد٠Ù
کاÙ"})]}),b?(0,l.jsx)("div",{className:"p-20 flex flex-col gap-8",children:Array.from({length:8}).map((e,t)=>(0,l.jsx)(c.Od,{className:"h-40"},t))}):0===E.length?(0,l.jsx)(c.ub,{text:"Ù
کاÙÛ Ø¨Ø§ اÛÙ ÙÛÙØªØ±Ùا Ù¾ÛØ¯Ø§ ÙØ´Ø¯."}):(0,l.jsxs)("div",{className:"overflow-x-auto",children:[(0,l.jsxs)("table",{className:"w-full text-13 leading-22",children:[(0,l.jsx)("thead",{className:"bg-gray-FAFAFA text-gray-6C6A7D",children:(0,l.jsxs)("tr",{children:[(0,l.jsx)("th",{className:"text-right font-m px-20 py-12 w-40",children:"ردÛÙ"}),(0,l.jsx)("th",{className:"text-right font-m px-20 py-12",children:"ÙØ§Ù
"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"ÙÙØ¹"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"Ø§Ø³ÙØ§Ú¯"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"ÙØ§Ùد"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"Ø§ÙØ§Ù
تگاÙ"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"Ø²ÛØ±Ù
جÙ
ÙØ¹Ù"}),(0,l.jsx)("th",{className:"text-right font-m px-12 py-12",children:"ÙØ¶Ø¹Ûت"}),(0,l.jsx)("th",{className:"px-20 py-12"})]})}),(0,l.jsx)("tbody",{children:E.slice(0,400).map((e,t)=>{var a;return(0,l.jsxs)("tr",{className:"border-t border-gray-F5F5F5 hover:bg-gray-FAFAFA",children:[(0,l.jsx)("td",{className:"px-20 py-12 text-gray-6C6A7D",children:(0,c.N)(t+1)}),(0,l.jsx)("td",{className:"px-20 py-12 font-m text-gray-1E1D28",children:e.name}),(0,l.jsx)("td",{className:"px-12 py-12",children:(0,l.jsx)("span",{className:`inline-block px-8 py-2 rounded-8 text-11 leading-18 ${m[e.type]??""}`,children:h[e.type]})}),(0,l.jsx)("td",{className:"px-12 py-12 text-gray-6C6A7D",dir:"ltr",children:e.titleEn||(0,l.jsx)("span",{className:"text-[#DC2626]",children:"â"})}),(0,l.jsx)("td",{className:"px-12 py-12 text-gray-6C6A7D",children:e.parentId?(null===(a=F.get(e.parentId))||void 0===a?void 0:a.name)??"â":"â"}),(0,l.jsxs)("td",{className:"px-12 py-12 text-gray-6C6A7D",children:[(0,c.N)(e.residenceCount),e.extraResidenceCount>0&&(0,l.jsxs)("span",{className:"text-11 text-gray-B0AFBC",children:[" +",(0,c.N)(e.extraResidenceCount)]})]}),(0,l.jsx)("td",{className:"px-12 py-12 text-gray-6C6A7D",children:(0,c.N)(e.childCount)}),(0,l.jsx)("td",{className:"px-12 py-12",children:e.isPublished?(0,l.jsx)(c.Ct,{tone:"green",children:"Ù
ÙØªØ´Ø±Ø´Ø¯Ù"}):(0,l.jsx)(c.Ct,{tone:"red",children:"Ù
ÙØªØ´Ø±ÙشدÙ"})}),(0,l.jsx)("td",{className:"px-20 py-12 text-left",children:(0,l.jsx)("button",{onClick:()=>g(e.id),className:"text-12 text-primary-main hover:underline",children:"Ù
Ø¯ÛØ±Ûت"})})]},e.id)})})]}),E.length>400&&(0,l.jsxs)("div",{className:"px-20 py-12 text-12 text-gray-6C6A7D",children:[(0,c.N)(E.length-400)," Ù
ÙØ±Ø¯ دÛÚ¯Ù ÙÙ
Ø§ÛØ´ Ø¯Ø§Ø¯Ù ÙØ´Ø¯ â Ø¬Ø³ØªØ¬Ù ر٠دÙÛÙâØªØ± Ú©Ù."]})]})]})]}),null!==p&&(0,l.jsx)(j,{id:p,allLocations:C,onClose:()=>g(null),onSaved:()=>f()}),y&&(0,l.jsx)(u,{allLocations:C,onClose:()=>v(!1),onSaved:()=>{v(!1),f()}})]})}function u(e){let{allLocations:t,onClose:a,onSaved:s}
1=e,[i,r]=(0,n.useState)({type:"CITY",name:"",titleEn:"",parentId:""}),[d,m]=(0,n.useState)(null),[p,g]=(0,n.useState)(!1),u=async()=>{g(!0),m(null);try{await (0,o.SC)("/api/admin/locations",{method:"POST",body:JSON.stringify({type:i.type,name:i.name.trim(),titleEn:i.titleEn.trim()||null,parentId:i.parentId?Number(i.parentId):null})}),s()}catch(e){m((null==e?void 0:e.message)??"Ø°Ø®ÛØ±Ù ÙØ´Ø¯.")}finally{g(!1)}};return(0,l.jsx)(c.u_,{open:!0,title:"Ø§ÙØ²Ùد٠Ù
کاÙ",onClose:a,children:(0,l.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,l.jsx)(c.gN,{label:"ÙÙØ¹",children:(0,l.jsx)(c.Ph,{value:i.type,onChange:e=>r({...i,type:e.target.value}),children:x.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,l.jsx)(c.gN,{label:"ÙØ§Ù
ÙØ§Ø±Ø³Û",children:(0,l.jsx)(c.II,{value:i.name,onChange:e=>r({...i,name:e.target.value})})}),(0,l.jsx)(c.gN,{label:"Ø§Ø³ÙØ§Ú¯ اÙÚ¯ÙÛØ³Û",hint:"آدرس ØµÙØÙâÛ Ø³Ø±Ú Ø§Ø² ÙÙ
Û٠ساخت٠Ù
ÛâØ´Ù: /search/<Ø§Ø³ÙØ§Ú¯>. خاÙÛ Ø¨Ø°Ø§Ø±Û ØµÙØÙâÛ Ø§Ø®ØªØµØ§ØµÛ ÙÙ
ÛâÚ¯ÛØ±Ù.",children:(0,l.jsx)(c.II,{dir:"ltr",value:i.titleEn,onChange:e=>r({...i,titleEn:e.target.value}),placeholder:"tehran"})}),(0,l.jsx)(c.gN,{label:"ÙØ§Ùد (Ø¨Ø±Ø§Û Ø¨Ø±Ø¯Ú©Ø±Ø§Ù
ب)",children:(0,l.jsxs)(c.Ph,{value:i.parentId,onChange:e=>r({...i,parentId:e.target.value}),children:[(0,l.jsx)("option",{value:"",children:"â Ø¨Ø¯ÙÙ ÙØ§Ùد â"}),t.filter(e=>"CITY"!==e.type||"NEIGHBORHOOD"===i.type).map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",h[e.type],")"]},e.id))]})}),d&&(0,l.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:d}),(0,l.jsxs)("div",{className:"flex gap-x-8 justify-end pt-4",children:[(0,l.jsx)(c.zx,{variant:"ghost",onClick:a,children:"Ø§ÙØµØ±Ø§Ù"}),(0,l.jsx)(c.zx,{onClick:u,disabled:p||!i.name.trim(),children:p?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù"})]})]})})}let y=[{key:null,label:"Ù¾ÛØ´âÙØ±Ø¶"},{key:"BOOMGARDI",label:"بÙÙ
âگردÛ"},{key:"HOTEL",label:"ÙØªÙ"}];function j(e){let{id:t,allLocations:a,onClose:s,onSaved:i}=e,{data:d,isLoading:x,mutate:m}=(0,r.u)(`/api/admin/locations/${t}`,e=>(0,o.SC)(e)),[g,u]=(0,n.useState)("info"),[y,j]=(0,n.useState)(null);return x||!d?(0,l.jsx)(c.u_,{open:!0,title:"در ØØ§Ù بارگذارÛâ¦",onClose:s,children:(0,l.jsx)(c.Od,{className:"h-200"})}):(0,l.jsx)(c.u_,{open:!0,title:`${d.name} â ${h[d.type]}`,onClose:s,width:"max-w-[860px]",children:(0,l.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,l.jsx)("div",{className:"text-12 leading-20 text-gray-6C6A7D",children:d.breadcrumb.map((e,t)=>(0,l.jsxs)("span",{children:[t>0&&(0,l.jsx)("span",{className:"mx-4",children:"âº"}),e.name]},e.id))}),d.titleEn&&(0,l.jsxs)("a",{href:`${p}/search/${d.titleEn}`,target:"_blank",rel:"noreferrer",dir:"ltr",className:"text-12 text-primary-main hover:underline self-start",children:[p,"/search/",d.titleEn]}),(0,l.jsx)("div",{className:"flex gap-x-4 border-b border-gray-EFEFEF",children:[{k:"info",l:"Ø§Ø·ÙØ§Ø¹Ø§Øª"},{k:"includes",l:`Ø´ÙØ±ÙØ§Û Ø²ÛØ±Ù
جÙ
ÙØ¹Ù (${(0,c.N)(d.includes.length)})`},{k:"seo",l:"Ù
ØØªÙØ§Û Ø³Ø¦Ù"}].map(e=>(0,l.jsx)("button",{onClick:()=>u(e.k),className:`px-14 py-10 text-13 leading-20 font-m transition border-b-2 -mb-px ${g===e.k?"border-primary-main text-primary-main":"border-transparent text-gray-6C6A7D hover:text-gray-1E1D28"}`,children:e.l},e.k))}),y&&(0,l.jsx)("p",{className:"text-12 leading-20 text-[#DC2626]",children:y}),"info"===g&&(0,l.jsx)(v,{location:d,allLocations:a,onError:j,onSaved:()=>{m(),i()}}),"includes"===g&&(0,l.jsx)(N,{location:d,allLocations:a,onError:j,onSaved:()=>{m(),i()}}),"seo"===g&&(0,l.jsx)(b,{location:d,onError:j,onSaved:()=>m()})]})})}function v(e){let{location:t,allLocations:a,onError:s,onSaved:i}=e,[r,d]=(0,n.useState)({name:t.name,titleEn:t.titleEn??"",type:t.type,parentId:t.parentId?String(t.parentId):"",canonicalId:t.canonicalId?String(t.canonicalId):"",keywords:t.keywords??"",isPublished:t.isPublished,isPrimary:t.isPrimary,sortOrder:t.sortOrder}),[m,p]=(0,n.useState)(!1),g=async()=>{p(!0),s(null);try{await (0,o.SC)(`/api/admin/locations/${t.id}`,{method:"PATCH",body:JSON.stringify({name:r.name.trim(),titleEn:r.titleEn.trim()||null,type:r.type,parentId:r.parentId?Number(r.parentId):null,canonicalId:r.canonicalId?Number(r.canonicalId):null,keywords:r.keywords.trim()||null,isPublished:r.isPublished,isPrimary:r.isPrimary,sortOrder:Number(r.sortOrder)||0})}),i()}catch(e){s((null==e?void 0:e.message)??"Ø°Ø®ÛØ±Ù ÙØ´Ø¯.")}finally{p(!1)}};return(0,l.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,l.jsxs)("div",{className:"grid md:grid-cols-2 gap-14",children:[(0,l.jsx)(c.gN,{label:"ÙØ§Ù
ÙØ§Ø±Ø³Û",children:(0,l.jsx)(c.II,{value:r.name,onChange:e=>d({...r,name:e.target.value})})}),(0,l.jsx)(c.gN,{label:"Ø§Ø³ÙØ§Ú¯ اÙÚ¯ÙÛØ³Û",hint:"تغÛÛØ±Ø´ آدرس اÛÙØ¯Ú©Ø³âØ´Ø¯Ù Ø±Ù Ø¹ÙØ¶ Ù
ÛâÚ©ÙÙ â Ø¨Ø§ Ø§ØØªÛاط.",children:(0,l.jsx)(c.II,{dir:"ltr",value:r.titleEn,onChange:e=>d({...r,titleEn:e.target.value})})}),(0,l.jsx)(c.gN,{label:"ÙÙØ¹",children:(0,l.jsx)(c.Ph,{value:r.type,onCh
1ange:e=>d({...r,type:e.target.value}),children:x.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,l.jsx)(c.gN,{label:"ÙØ§Ùد",hint:"ÙÙØ· بردکراÙ
ب. ÙÛØ³Øª Ø§ÙØ§Ù
تگاÙâÙØ§ ر٠تغÛÛØ± ÙÙ
ÛâØ¯Ù (Ù
گر استاÙ).",children:(0,l.jsxs)(c.Ph,{value:r.parentId,onChange:e=>d({...r,parentId:e.target.value}),children:[(0,l.jsx)("option",{value:"",children:"â Ø¨Ø¯ÙÙ ÙØ§Ùد â"}),a.filter(e=>e.id!==t.id).map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",h[e.type],")"]},e.id))]})}),(0,l.jsx)(c.gN,{label:"canonical",hint:"اگر اÛÙ ØµÙØÙ Ø¨Ø§ÛØ¯ اعتبار Ø³Ø¦ÙØ´ ب٠ÛÙ ØµÙØÙâÛ Ø¯ÛÚ¯Ù Ù
ÙØªÙ٠بشÙ.",children:(0,l.jsxs)(c.Ph,{value:r.canonicalId,onChange:e=>d({...r,canonicalId:e.target.value}),children:[(0,l.jsx)("option",{value:"",children:"â ÙØ¯Ø§Ø±Ø¯ â"}),a.filter(e=>e.id!==t.id&&e.titleEn).map(e=>(0,l.jsxs)("option",{value:e.id,children:[e.name," (",e.titleEn,")"]},e.id))]})}),(0,l.jsx)(c.gN,{label:"ØªØ±ØªÛØ¨ ÙÙ
Ø§ÛØ´",children:(0,l.jsx)(c.II,{type:"number",value:r.sortOrder,onChange:e=>d({...r,sortOrder:Number(e.target.value)})})})]}),(0,l.jsx)(c.gN,{label:"Ú©ÙÛØ¯ÙاÚÙâÙØ§",hint:"ÙÙØ±Ø³Øª Ø¢Ø²Ø§Ø¯Ø Ø¨Ø§ کاÙ
ا جدا Ù
ÛâØ´Ù (از x_tags Ø§ÙØ¯Ù).",children:(0,l.jsx)(c.II,{value:r.keywords,onChange:e=>d({...r,keywords:e.target.value})})}),(0,l.jsxs)("div",{className:"flex flex-wrap gap-x-24 gap-y-10",children:[(0,l.jsx)(c.ZD,{checked:r.isPublished,onChange:e=>d({...r,isPublished:e}),label:"Ù
ÙØªØ´Ø±Ø´Ø¯Ù"}),(0,l.jsx)(c.ZD,{checked:r.isPrimary,onChange:e=>d({...r,isPrimary:e}),label:"Ù
ÙØµØ¯ اصÙÛ"})]}),(0,l.jsxs)("div",{className:"rounded-10 bg-gray-FAFAFA px-16 py-12 text-12 leading-22 text-gray-6C6A7D",children:[(0,c.N)(t.residenceCount)," Ø§ÙØ§Ù
تگا٠اصÙÛ \xb7 ",(0,c.N)(t.extraResidenceCount)," Ø§ÙØ§Ù
ØªÚ¯Ø§Ù ÙØ±Ø¹Û \xb7"," ",(0,c.N)(t.children.length)," Ø²ÛØ±Ø´Ø§Ø®Ù",t.odooId?` \xb7 Ø´ÙØ§Ø³ÙâÛ Ø§ÙØ¯Ù ${(0,c.N)(t.odooId)}`:""]}),(0,l.jsx)("div",{className:"flex justify-end pt-4",children:(0,l.jsx)(c.zx,{onClick:g,disabled:m,children:m?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù تغÛÛØ±Ø§Øª"})})]})}function N(e){let{location:t,allLocations:a,onError:s,onSaved:i}=e,[r,d]=(0,n.useState)(t.includes.map(e=>
1e.child.id)),[x,m]=(0,n.useState)(""),[p,g]=(0,n.useState)(!1),u=(0,n.useMemo)(()=>{let e=x.trim();return e?a.filter(e=>e.id!==t.id).filter(t=>t.name.includes(e)||(t.titleEn??"").toLowerCase().includes(e.toLowerCase())).slice(0,40):a.filter(e=>r.includes(e.id))},[a,x,r,t.id]),y=a.filter(e=>r.includes(e.id)).reduce((e,t)=>e+t.residenceCount,0),j=async()=>{g(!0),s(null);try{await (0,o.SC)(`/api/admin/locations/${t.id}/includes`,{method:"PUT",body:JSON.stringify({childIds:r})}),i()}catch(e){s((null==e?void 0:e.message)??"Ø°Ø®ÛØ±Ù ÙØ´Ø¯.")}finally{g(!1)}};return(0,l.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:["Ø§ÙØ§Ù
تگاÙâÙØ§Û Ù
کاÙâÙØ§ÛÛ Ú©Ù Ø§ÛÙØ¬Ø§ Ø§ÙØªØ®Ø§Ø¨ Ù
ÛâÚ©ÙÛØ تÙÛ ØµÙØÙâÛ"," ",(0,l.jsx)("span",{className:"font-m text-gray-1E1D28",children:t.name})," ÙÙ
ÙØ´Ù٠داد٠Ù
ÛâØ´Ù. اگ٠ÛÙ Ø§Ø³ØªØ§Ù Ø§ÙØªØ®Ø§Ø¨ Ú©ÙÛØ ÙÙ
ÙâÛ Ø´ÙØ±Ùاش ÙÙ
Ù
ÛØ§Ù."]}),(0,l.jsx)(c.II,{value:x,onChange:e=>m(e.target.value),placeholder:"Ø¬Ø³ØªØ¬Ù Ø¨Ø±Ø§Û Ø§ÙØ²ÙدÙâ¦"}),(0,l.jsx)("div",{className:"max-h-[280px] overflow-y-auto rounded-10 border border-gray-EFEFEF divide-y divide-gray-F5F5F5",children:0===u.length?(0,l.jsx)("div",{className:"px-16 py-20 text-12 text-gray-6C6A7D text-center",children:x.trim()?"ÚÛØ²Û Ù¾ÛØ¯Ø§ ÙØ´Ø¯.":"ÙÙÙØ² Ø²ÛØ±Ù
جÙ
ÙØ¹ÙâØ§Û Ø§ÙØªØ®Ø§Ø¨ ÙØ´Ø¯Ù â Ø¨Ø±Ø§Û Ø§ÙØ²Ùد٠جستج٠کÙ."}):u.map(e=>{let t=r.includes(e.id);return(0,l.jsxs)("label",{className:"flex items-center gap-x-10 px-16 py-10 cursor-pointer hover:bg-gray-FAFAFA",children:[(0,l.jsx)("input",{type:"checkbox",checked:t,onChange:()=>d(t?r.filter(t=>t!==e.id):[...r,e.id])}),(0,l.jsx)("span",{className:"text-13 text-gray-1E1D28 font-m",children:e.name}),(0,l.jsx)("span",{className:"text-11 text-gray-B0AFBC",children:h[e.type]}),(0,l.jsxs)("span",{className:"text-11 text-gray-6C6A7D mr-auto",children:[(0,c.N)(e.residenceCount)," Ø§ÙØ§Ù
تگاÙ"]})]},e.id)})}),(0,l.jsxs)("div",{className:"rounded-10 bg-gray-FAFAFA px-16 py-12 text-12 leading-22 text-gray-6C6A7D",children:[(0,c.N)(r.length)," Ù
Ú©Ø§Ù Ø§ÙØªØ®Ø§Ø¨ Ø´Ø¯Ù â ØØ¯ÙØ¯ ",(0,c.N)(y)," Ø§ÙØ§Ù
تگا٠ب٠اÛÙ ØµÙØÙ Ø§Ø¶Ø§ÙÙ Ù
ÛâØ´Ù (بدÙÙ Ø§ØØªØ³Ø§Ø¨ Ø´ÙØ±ÙØ§Û Ø²ÛØ± استاÙâÙØ§)."]}),t.includedIn.length>0&&(0,l.jsxs)("div",{className:"text-12 leading-22 text-gray-6C6A7D",children:["اÛÙ Ù
Ú©Ø§Ù Ø®ÙØ¯Ø´ Ø²ÛØ±Ù
جÙ
ÙØ¹ÙâÛ"," ",(0,l.jsx)("span",{className:"font-m text-gray-1E1D28",children:t.includedIn.map(e=>e.parent.name).join("Ø ")})," ","ÙØ³Øª."]}),(0,l.jsx)("div",{className:"flex justify-end pt-4",children:(0,l.jsx)(c.zx,{onClick:j,disabled:p,children:p?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù Ø²ÛØ±Ù
جÙ
ÙØ¹ÙâÙØ§"})})]})}function b(e){let{location:t,onError:a,onSaved:s}=e,[i,r]=(0,n.useState)(""),d=t.seo.find(e=>(e.residenceType??"")===i),[x,h]=(0,n.useState)(()=>j(d)),[m,p]=(0,n.useState)(!1),[g,u]=(0,n.useState)("");function j(e){return{pageTitle:(null==e?void 0:e.pageTitle)??"",metaTitle:(null==e?void 0:e.metaTitle)??"",metaDescription:(null==e?void 0:e.metaDescription)??"",metaKeywords:(null==e?void 0:e.metaKeywords)??"",contentTitle:(null==e?void 0:e.contentTitle)??"",contentHtml:(null==e?void 0:e.contentHtml)??"",phone:(null==e?void 0:e.phone)??"",showPhone:(null==e?void 0:e.showPhone)??!1,showInHomepage:(null==e?void 0:e.showInHomepage)??!1}}g!==i&&(u(i),h(j(t.seo.find(e=>(e.residenceType??"")===i))));let v=async()=>{p(!0),a(null);try{await (0,o.SC)(`/api/admin/locations/${t.id}/seo`,{method:"PUT",body:JSON.stringify({residenceType:i||null,pageTitle:x.pageTitle.trim()||null,metaTitle:x.metaTitle.trim()||null,metaDescription:x.metaDescription.trim()||null,metaKeywords:x.metaKeywords.trim()||null,contentTitle:x.contentTitle.trim()||null,contentHtml:x.contentHtml.trim()||null,phone:x.phone.trim()||null,showPhone:x.showPhone,showInHomepage:x.showInHomepage})}),s()}catch(e){a((null==e?void 0:e.message)??"Ø°Ø®ÛØ±Ù ÙØ´Ø¯.")}finally{p(!1)}},N=x.metaTitle.trim().length,b=x.metaDescription.trim().length;return(0,l.jsxs)("div",{className:"flex flex-col gap-y-14",children:[(0,l.jsx)("div",{className:"flex gap-x-6",children:y.map(e=>{let a=e.key??"",n=t.seo.some(e=>(e.residenceType??"")===a);return(0,l.jsxs)("button",{onClick:()=>r(a),className:`px-12 py-6 rounded-8 text-12 leading-20 font-m transition ${i===a?"bg-primary-main text-white":"bg-gray-F5F5F5 text-gray-6C6A7D hover:bg-gray-EFEFEF"}`,children:[e.label,n&&(0,l.jsx)("span",{className:"mr-4 opacity-60",children:"â¢"})]},a)})}),(0,l.jsx)("p",{className:"text-11 leading-20 text-gray-B0AFBC",children:"ÙØ± ÙÙØ¹ Ø§ÙØ§Ù
تگا٠Ù
ت٠سئÙÛ Ø¬Ø¯Ø§ دارÙ. \xabÙ¾ÛØ´âÙØ±Ø¶\xbb رÙÛ ØµÙØÙâÛ Ù
عÙ
ÙÙÛ Ø´ÙØ± ÙØ´Ù٠داد٠Ù
ÛâØ´Ù."}),(0,l.jsx)(c.gN,{label:"عÙÙØ§Ù ØµÙØÙ (H1)",children:(0,l.jsx)(c.II,{value:x.pageTitle,onChange:e=>h({...x,pageTitle:e.target.value})})}),(0,l.jsx)(c.gN,{label:"meta title",hint:`${N} کاراکتر${N>60?" â Ø§Ø² Û¶Û° Ø¨ÛØ´ØªØ±ÙØ Ú¯ÙÚ¯Ù Ú©ÙØªØ§ÙØ´ Ù
ÛâÚ©ÙÙ.":""}`,children:(0,l.jsx)(c.II,{value:x.metaTitle,onChange:e=>h({...x,metaTitle:e.target.value})})}),(0,l.jsx)(c.gN,{label:"meta description",hint:`${b} کاراکتر${b>160?" â Ø§Ø² Û±Û¶Û° Ø¨ÛØ´ØªØ±Ù.":""}`,children:(0,l.jsx)("textarea",{value:x.metaDescription,onChange:e=>h({...x,metaDescription:e.target.value}),rows:3,className:"w-full rounded-10 border border-gray-EFEFEF px-14 py-10 text-13 leading-22 outline-none focus:border-primary-main"})}),(0,l.jsx)(c.gN,{label:"meta keywords",children:(0,l.jsx)(c.II,{value:x.metaKeywords,onChange:e=>h({...x,metaKeywords:e.target.value})})}),(0,l.jsx)(c.gN,{label:"عÙÙØ§Ù Ù
ت٠راÙÙÙ
ا",children:(0,l.jsx)(c.II,{value:x.contentTitle,onChange:e=>h({...x,contentTitle:e.target.value})})}),(0,l.jsx)(c.gN,{label:"Ù
ت٠راÙÙÙ
ا",hint:"HTML Ù
جاز٠â ÙÙ
Ù٠بÙÙÚ© \xabدربارÙ\xbb پاÛÛÙ ØµÙØÙâÛ Ø³Ø±Ú.",children:(0,l.jsx)("textarea",{value:x.contentHtml,onChange:e=>h({...x,contentHtml:e.target.value}),rows:8,dir:"rtl",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:"grid md:grid-cols-2 gap-14",children:[(0,l.jsx)(c.gN,{label:"Ø´Ù
ار٠تÙ
اس اختصاصÛ",children:(0,l.jsx)(c.II,{dir:"ltr",value:x.phone,onChange:e=>h({...x,phone:e.target.value})})}),(0,l.jsxs)("div",{className:"flex flex-col justify-end gap-y-10 pb-4",children:[(0,l.jsx)(c.ZD,{checked:x.showPhone,onChange:e=>h({...x,showPhone:e}),label:"ÙÙ
Ø§ÛØ´ Ø´Ù
ارÙ"}),(0,l.jsx)(c.ZD,{checked:x.showInHomepage,onChange:e=>h({...x,showInHomepage:e}),label:"ÙÙ
Ø§ÛØ´ در ØµÙØÙâÛ Ø§ØµÙÛ"})]})]}),(0,l.jsx)("div",{className:"flex justify-end pt-4",children:(0,l.jsx)(c.zx,{onClick:v,disabled:m,children:m?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù Ù
ØØªÙØ§Û Ø³Ø¦Ù"})})]})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=73695)}),_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.