PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/settings/discount-codes-32dda5a146289a4d.js

js lidomatrip.com collected 2026-10-02 20:26:19 UTC 8,726 bytes, 1 lines download raw bytes

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.