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.