1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5350],{23937:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/discount-codes",function(){return n(16097)}])},99871:function(e,t,n){"use strict";n.d(t,{Cd:function(){return j},Ee:function(){return d},NK:function(){return S},Qi:function(){return N},Qz:function(){return c},Ri:function(){return g},ZB:function(){return C},bB:function(){return u},eQ:function(){return i},fL:function(){return a},hA:function(){return h},lN:function(){return E},nB:function(){return o},nX:function(){return m},o1:function(){return l},pz:function(){return x},rc:function(){return A},wH:function(){return f},y$:function(){return p}});var s=n(84858);let r="/api/admin/discount-codes",i=e=>{let t=new URLSearchParams;return e.search&&t.set("search",e.search),e.status&&t.set("status",e.status),e.page&&t.set("page",String(e.page)),(0,s.SC)(`${r}?${t.toString()}`)},a=e=>(0,s.SC)(`${r}/${e}`),l=e=>(0,s.SC)(r,{method:"POST",body:JSON.stringify(e)}),c=(e,t)=>(0,s.SC)(`${r}/${e}`,{method:"PUT",body:JSON.stringify(t)}),o=(e,t)=>(0,s.SC)(`${r}/${e}/status`,{method:"PATCH",body:JSON.stringify({status:t})}),d=e=>(0,s.SC)(`${r}/${e}`,{method:"DELETE"}),u=()=>(0,s.SC)(`${r}/generate`),h=()=>(0,s.SC)(`${r}/options`),x=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,s.SC)(`${r}/search-users?q=${encodeURIComponent(e)}${t?"&hostsOnly=true":""}`)},f=e=>(0,s.SC)(`${r}/search-residences?q=${encodeURIComponent(e)}`),m=e=>(0,s.SC)(`${r}/test`,{method:"POST",body:JSON.stringify(e)}),E=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new URLSearchParams;for(let[e,s]of Object.entries(t))void 0!==s&&""!==s&&null!==s&&n.set(e,String(s));let i=n.toString();return(0,s.SC)(`${r}/${e}/stats${i?`?${i}`:""}`)},N=e=>(0,s.SC)(`${r}/${e}/history`),C={DRAFT:"در Ø§ÙØªØ¸Ø§Ø± ثبت",HOST_APPROVAL:"در Ø§ÙØªØ¸Ø§Ø± تاÛÛØ¯ Ù
ÛØ²Ø¨Ø§Ù",SECOND_PAYMENT:"در Ø§ÙØªØ¸Ø§Ø± پرداخت",DONE:"ÙØ·Ø¹Û",CANCEL:"ÙØºÙ شدÙ",EXPIRED:"Ù
ÙÙØ¶Û شدÙ"},S={DRAFT:"Ù¾ÛØ´âÙÙÛØ³",ACTIVE:"ÙØ¹Ø§Ù",DISABLED:"ØºÛØ±ÙعاÙ",ARCHIVED:"آرشÛÙØ´Ø¯Ù",SCHEDULED:"زÙ
اÙâØ¨ÙØ¯ÛâØ´Ø¯Ù",EXPIRED:"Ù
ÙÙØ¶ÛâØ´Ø¯Ù",EXHAUSTED:"تکÙ
Û٠ظرÙÛØª"},g={DRAFT:"gray",ACTIVE:"green",DISABLED:"red",ARCHIVED:"gray",SCHEDULED:"blue",EXPIRED:"gray",EXHAUSTED:"yellow"},A={ALL:"ÙÙ
٠کاربراÙ",LOGGED_IN:"Ú©Ø§Ø±Ø¨Ø±Ø§Ù ÙØ§Ø±Ø¯Ø´Ø¯Ù",NEW_USERS:"Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ø¬Ø¯ÛØ¯",RETURNING_USERS:"Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ø¯Ø§Ø±Ø§Û Ø±Ø²Ø±Ù ÙØ¨ÙÛ",SPECIFIC_USERS:"کاربر خاص",CITY:"Ú©Ø§Ø±Ø¨Ø±Ø§Ù Ø´ÙØ± خاص"},j={ALL:"ÙÙ
Ù Ø§ÙØ§Ù
تگاÙâÙØ§",LOCATION:"Ø´ÙØ± ÛØ§ استا٠خاص",TYPE:"ÙÙØ¹ Ø§ÙØ§Ù
تگاÙ",AMENITY:"اÙ
Ú©Ø§ÙØ§Øª خاص",HOST:"Ù
ÛØ²Ø¨Ø§Ù خاص",RESIDENCES:"Ø§ÙØ§Ù
تگاÙâÙØ§Û Ø§ÙØªØ®Ø§Ø¨Û"},p={RENT:"Ù
Ø¨ÙØº Ø§ÙØ§Ù
ت (Ù¾ÛØ´ÙÙØ§Ø¯Û)",RENT_PLUS_GUEST_FEE:"Ø§ÙØ§Ù
ت + کارÙ
زد Ù
ÙÙ
اÙ",TOTAL_PAYABLE:"Ú©Ù Ù
Ø¨ÙØº ÙØ§Ø¨Ù پرداخت"}},16097:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return h}});var s=n(85893),r=n(67294),i=n(41664),a=n.n(i),l=n(44389),c=n(49759),o=n(32474),d=n(99871);let u=[{key:"ALL",label:"ÙÙ
Ù"},{key:"ACTIVE",label:"ÙØ¹Ø§Ù"},{key:"SCHEDULED",label:"زÙ
اÙâØ¨ÙØ¯ÛâØ´Ø¯Ù"},{key:"DRAFT",label:"Ù¾ÛØ´âÙÙÛØ³"},{key:"EXPIRED",label:"Ù
ÙÙØ¶ÛâØ´Ø¯Ù"},{key:"EXHAUSTED",label:"تکÙ
Û٠ظرÙÛØª"},{key:"DISABLED",label:"ØºÛØ±ÙعاÙ"},{key:"ARCHIVED",label:"آرشÛÙØ´Ø¯Ù"}];function h(){let[e,t]=(0,r.useState)(""),[n,i]=(0,r.useState)("ALL"),[h,x]=(0,r.useState)(null),[f,m]=(0,r.useState)(null),{data:E,isLoading:N,mutate:C}=(0,l.u)(["discount-codes",e],()=>(0,d.eQ)({search:e||void 0})),S=((null==E?void 0:E.items)??[]).filter(e=>"ALL"===n||e.effectiveStatus===n);async function g(e){x(e.id),m(null);try{await (0,d.nB)(e.id,"ACTIVE"===e.status?"DISABLED":"ACTIVE"),C()}catch(e){m(e instanceof Error?e.message:"تغÛÛØ± ÙØ¶Ø¹Ûت Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯")}finally{x(null)}}async function A(e){let t=e.usedCount>0,n=t?`\xab${e.name}\xbb ÙØ¨Ùا٠${(0,o.N)(e.usedCount)} بار Ø§Ø³ØªÙØ§Ø¯Ù Ø´Ø¯Ù Ù ØØ°Ù ÙÙ
ÛâØ´ÙØ¯ â Ø¢Ø±Ø´ÛÙ Ø´ÙØ¯Ø`:`\xab${e.name}\xbb ØØ°Ù Ø´ÙØ¯Ø`;if(window.confirm(n)){x(e.id),m(null);try{await (0,d.Ee)(e.id),C()}catch(e){m(e instanceof Error?e.message:"ØØ°Ù Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯")}finally{x(null)}}}return(0,s.jsx)(c.Z,{title:"Ú©Ø¯ÙØ§Û تخÙÛÙ",breadcrumb:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(a(),{href:"/admin",children:"Ø¯Ø§Ø´Ø¨ÙØ±Ø¯"})," / ",(0,s.jsx)(a(),{href:"/admin/settings",children:"ØªÙØ¸ÛÙ
ات"})]}),actions:(0,s.jsx)(a(),{href:"/admin/settings/discount-codes/new",children:(0,s.jsxs)(o.zx,{children:[(0,s.jsx)("i",{className:"icon-Plus text-14"})," کد تخÙÛÙ Ø¬Ø¯ÛØ¯"]})}),children:(0,s.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,s.jsx)(o.o8,{children:(0,s.jsx)(o.Hf,{value:e,onCh
1ange:t,placeholder:"جستجÙÛ ÙØ§Ù
ÛØ§ کد تخÙÛÙ"})}),(0,s.jsx)(o.Qm,{tabs:u,value:n,onChange:i,counts:Object.fromEntries(u.map(e=>[e.key,"ALL"===e.key?(null==E?void 0:E.items.length)??0:(null==E?void 0:E.items.filter(t=>t.effectiveStatus===e.key).length)??0]))}),f&&(0,s.jsx)("div",{className:"rounded-10 bg-[#FEE] px-14 py-10 text-13 text-[#C62828]",children:f}),N&&(0,s.jsx)(o.Od,{className:"h-[320px]"}),!N&&0===S.length&&(0,s.jsx)(o.Zb,{className:"p-20",children:(0,s.jsx)(o.ub,{text:(null==E?void 0:E.items.length)?"ÙÛÚ Ú©Ø¯Û Ø¯Ø± اÛÙ ÙØ¶Ø¹Ûت ÙÛØ³Øª":"ÙÙÙØ² کد تخÙÛÙÛ Ø³Ø§Ø®ØªÙ ÙØ´Ø¯Ù"})}),!N&&S.length>0&&(0,s.jsx)(o.Zb,{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-[880px] text-right",children:[(0,s.jsx)("thead",{className:"bg-gray-F7F7F7 text-12 text-gray-6C6A7D",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"p-12 font-r w-40",children:"ردÛÙ"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"ÙØ§Ù
٠کد"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"تخÙÛÙ"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"Ø¨Ø±Ø§Û Ú٠کسÛ"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"رÙÛ ÚÙ Ø§ÙØ§Ù
تگاÙÛ"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"Ø§Ø³ØªÙØ§Ø¯Ù"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"بازÙ"}),(0,s.jsx)("th",{className:"p-12 font-r",children:"ÙØ¶Ø¹Ûت"}),(0,s.jsx)("th",{className:"p-12 font-r"})]})}),(0,s.jsx)("tbody",{children:S.map((e,t)=>(0,s.jsxs)("tr",{className:"border-t border-gray-F0F0F0 text-13 align-middle",children:[(0,s.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:(0,o.N)(t+1)}),(0,s.jsxs)("td",{className:"p-12",children:[(0,s.jsx)(a(),{href:`/admin/settings/discount-codes/${e.id}`,className:"font-m text-black hover:text-primary-main",children:e.name}),(0,s.jsx)("div",{className:"mt-2 font-mono text-12 text-gray-6C6A7D",dir:"ltr",children:e.code})]}),(0,s.jsx)("td",{className:"p-12 whitespace-nowrap font-m",children:function(e){if("PERCENT"===e.kind){let t=e.maxDiscountAmount?` (تا ${(0,o.ND)(e.maxDiscountAmount)})`:"";return`${(0,o.N)(e.amount)}Ùª${t}`}return(0,o.ND)(e.amount)}(e)}),(0,s.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:d.rc[e.audience]}),(0,s.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:d.Cd[e.scope]}),(0,s.jsx)("td",{className:"p-12 whitespace-nowrap text-gray-6C6A7D",children:null===e.totalUsageLimit?`${(0,o.N)(e.usedCount)} بار`:`${(0,o.N)(e.usedCount)} از ${(0,o.N)(e.totalUsageLimit)}`}),(0,s.jsx)("td",{className:"p-12 whitespace-nowrap text-12 text-gray-6C6A7D",children:e.startsAt||e.endsAt?(0,s.jsxs)(s.Fragment,{children:[e.startsAt?(0,o.IY)(e.startsAt):"â"," تا ",e.endsAt?(0,o.IY)(e.endsAt):"بدÙÙ Ù¾Ø§ÛØ§Ù"]}):"بدÙÙ Ù
ØØ¯ÙØ¯ÛØª زÙ
اÙÛ"}),(0,s.jsx)("td",{className:"p-12",children:(0,s.jsx)(o.Ct,{tone:d.Ri[e.effectiveStatus],children:d.NK[e.effectiveStatus]})}),(0,s.jsx)("td",{className:"p-12",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-x-6",children:[(0,s.jsx)(o.zx,{variant:"ghost",disabled:h===e.id||"ARCHIVED"===e.status,onClick:()=>g(e),title:"ACTIVE"===e.status?"ØºÛØ±ÙعاÙâØ³Ø§Ø²Û ÙÙØ±Û":"ÙØ¹Ø§ÙâØ³Ø§Ø²Û",children:"ACTIVE"===e.status?"ØºÛØ±Ùعا٠کÙ":"ÙØ¹Ø§Ù Ú©Ù"}),(0,s.jsx)(a(),{href:`/admin/settings/discount-codes/${e.id}`,children:(0,s.jsx)(o.zx,{variant:"ghost",title:"ÙÛØ±Ø§ÛØ´",children:(0,s.jsx)("i",{className:"icon-Edit text-14"})})}),(0,s.jsx)(o.zx,{variant:"ghost",disabled:h===e.id,onClick:()=>A(e),title:e.usedCount>0?"آرشÛÙ":"ØØ°Ù",children:(0,s.jsx)("i",{className:"icon-Delete text-14 text-[#E53935]"})})]})})]},e.id))})]})})]})})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=23937)}),_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.