PageSourceSearch

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

js lidomatrip.com collected 2026-09-25 07:11:17 UTC 10,219 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5350],{23937:function(t,n,e){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/settings/discount-codes",function(){return e(16097)}])},99871:function(t,n,e){"use strict";e.d(n,{Cd:function(){return j},Ee:function(){return d},NK:function(){return S},Qi:function(){return C},Qz:function(){return u},Ri:function(){return g},ZB:function(){return p},bB:function(){return f},eQ:function(){return a},fL:function(){return i},hA:function(){return h},lN:function(){return N},nB:function(){return l},nX:function(){return E},o1:function(){return o},pz:function(){return x},rc:function(){return A},wH:function(){return m},y$:function(){return y}});var r=e(10253),s=e(84858),c="/api/admin/discount-codes",a=function(t){var n=new URLSearchParams;return t.search&&n.set("search",t.search),t.status&&n.set("status",t.status),t.page&&n.set("page",String(t.page)),(0,s.SC)("".concat(c,"?").concat(n.toString()))},i=function(t){return(0,s.SC)("".concat(c,"/").concat(t))},o=function(t){return(0,s.SC)(c,{method:"POST",body:JSON.stringify(t)})},u=function(t,n){return(0,s.SC)("".concat(c,"/").concat(t),{method:"PUT",body:JSON.stringify(n)})},l=function(t,n){return(0,s.SC)("".concat(c,"/").concat(t,"/status"),{method:"PATCH",body:JSON.stringify({status:n})})},d=function(t){return(0,s.SC)("".concat(c,"/").concat(t),{method:"DELETE"})},f=function(){return(0,s.SC)("".concat(c,"/generate"))},h=function(){return(0,s.SC)("".concat(c,"/options"))},x=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,s.SC)("".concat(c,"/search-users?q=").concat(encodeURIComponent(t)).concat(n?"&hostsOnly=true":""))},m=function(t){return(0,s.SC)("".concat(c,"/search-residences?q=").concat(encodeURIComponent(t)))},E=function(t){return(0,s.SC)("".concat(c,"/test"),{method:"POST",body:JSON.stringify(t)})},N=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=new URLSearchParams,a=!0,i=!1,o=void 0;try{for(var u,l=Object.entries(n)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var d=(0,r.Z)(u.value,2),f=d[0],h=d[1];void 0!==h&&""!==h&&null!==h&&e.set(f,String(h))}}catch(t){i=!0,o=t}finally{try{a||null==l.return||l.return()}finally{if(i)throw o}}var x=e.toString();return(0,s.SC)("".concat(c,"/").concat(t,"/stats").concat(x?"?".concat(x):""))},C=function(t){return(0,s.SC)("".concat(c,"/").concat(t,"/history"))},p={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:"اقامتگاه‌های انتخابی"},y={RENT:"مبلغ اقامت (پیشنهادی)",RENT_PLUS_GUEST_FEE:"اقامت + کارمزد مهمان",TOTAL_PAYABLE:"کل مبلغ قابل پرداخت"}},16097:function(t,n,e){"use strict";e.r(n),e.d(n,{default:function(){return m}});var r=e(47568),s=e(10253),c=e(70655),a=e(85893),i=e(67294),o=e(41664),u=e.n(o),l=e(44389),d=e(49759),f=e(32474),h=e(99871),x=[{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 m(){var t,n,e,o=(0,s.Z)((0,i.useState)(""),2),m=o[0],E=o[1],N=(0,s.Z)((0,i.useState)("ALL"),2),C=N[0],p=N[1],S=(0,s.Z)((0,i.useState)(null),2),g=S[0],A=S[1],j=(0,s.Z)((0,i.useState)(null),2),y=j[0],D=j[1],b=(0,l.u)(["discount-codes",m],function(){return(0,h.eQ)({search:m||void 0})}),v=b.data,T=b.isLoading,L=b.mutate,I=(null!==(t=null==v?void 0:v.items)&&void 0!==t?t:[]).filter(function(t){return"ALL"===C||t.effectiveStatus===C});function R(){return(R=(0,r.Z)(function(t){var n;return(0,c.__generator)(this,function(e){switch(e.label){case 0:A(t.i
1d),D(null),e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,(0,h.nB)(t.id,"ACTIVE"===t.status?"DISABLED":"ACTIVE")];case 2:return e.sent(),L(),[3,5];case 3:return D((n=e.sent())instanceof Error?n.message:"تغییر وضعیت انجام نشد"),[3,5];case 4:return A(null),[7];case 5:return[2]}})})).apply(this,arguments)}function w(){return(w=(0,r.Z)(function(t){var n,e;return(0,c.__generator)(this,function(r){switch(r.label){case 0:if(n=t.usedCount>0?"\xab".concat(t.name,"\xbb قبلاً ").concat((0,f.N)(t.usedCount)," بار استفاده شده و حذف نمی‌شود — آرشیو شود؟"):"\xab".concat(t.name,"\xbb حذف شود؟"),!window.confirm(n))return[2];A(t.id),D(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,(0,h.Ee)(t.id)];case 2:return r.sent(),L(),[3,5];case 3:return D((e=r.sent())instanceof Error?e.message:"حذف انجام نشد"),[3,5];case 4:return A(null),[7];case 5:return[2]}})})).apply(this,arguments)}return(0,a.jsx)(d.Z,{title:"کدهای تخفیف",breadcrumb:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u(),{href:"/admin",children:"داشبورد"})," / ",(0,a.jsx)(u(),{href:"/admin/settings",children:"تنظیمات"})]}),actions:(0,a.jsx)(u(),{href:"/admin/settings/discount-codes/new",children:(0,a.jsxs)(f.zx,{children:[(0,a.jsx)("i",{className:"icon-Plus text-14"})," کد تخفیف جدید"]})}),children:(0,a.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,a.jsx)(f.o8,{children:(0,a.jsx)(f.Hf,{value:m,onChange:E,placeholder:"جستجوی نام یا کد تخفیف"})}),(0,a.jsx)(f.Qm,{tabs:x,value:C,onChange:p,counts:Object.fromEntries(x.map(function(t){return[t.key,"ALL"===t.key?null!==(n=null==v?void 0:v.items.length)&&void 0!==n?n:0:null!==(e=null==v?void 0:v.items.filter(function(n){return n.effectiveStatus===t.key}).length)&&void 0!==e?e:0]}))}),y&&(0,a.jsx)("div",{className:"rounded-10 bg-[#FEE] px-14 py-10 text-13 text-[#C62828]",children:y}),T&&(0,a.jsx)(f.Od,{className:"h-[320px]"}),!T&&0===I.length&&(0,a.jsx)(f.Zb,{className:"p-20",children:(0,a.jsx)(f.ub,{text:(null==v?void 0:v.items.length)?"هیچ کدی در این وضعیت نیست":"هنوز کد تخفیفی ساخته نشده"})}),!T&&I.length>0&&(0,a.jsx)(f.Zb,{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"w-full min-w-[880px] text-right",children:[(0,a.jsx)("thead",{className:"bg-gray-F7F7F7 text-12 text-gray-6C6A7D",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-12 font-r w-40",children:"ردیف"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"نام و کد"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"تخفیف"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"برای چه کسی"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"روی چه اقامتگاهی"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"استفاده"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"بازه"}),(0,a.jsx)("th",{className:"p-12 font-r",children:"وضعیت"}),(0,a.jsx)("th",{className:"p-12 font-r"})]})}),(0,a.jsx)("tbody",{children:I.map(function(t,n){return(0,a.jsxs)("tr",{className:"border-t border-gray-F0F0F0 text-13 align-middle",children:[(0,a.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:(0,f.N)(n+1)}),(0,a.jsxs)("td",{className:"p-12",children:[(0,a.jsx)(u(),{href:"/admin/settings/discount-codes/".concat(t.id),className:"font-m text-black hover:text-primary-main",children:t.name}),(0,a.jsx)("div",{className:"mt-2 font-mono text-12 text-gray-6C6A7D",dir:"ltr",children:t.code})]}),(0,a.jsx)("td",{className:"p-12 whitespace-nowrap font-m",children:function(t){if("PERCENT"===t.kind){var n=t.maxDiscountAmount?" (تا ".concat((0,f.ND)(t.maxDiscountAmount),")"):"";return"".concat((0,f.N)(t.amount),"٪").concat(n)}return(0,f.ND)(t.amount)}(t)}),(0,a.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:h.rc[t.audience]}),(0,a.jsx)("td",{className:"p-12 text-gray-6C6A7D",children:h.Cd[t.scope]}),(0,a.jsx)("td",{className:"p-12 whitespace-nowrap text-gray-6C6A7D",children:null===t.totalUsageLimit?"".concat((0,f.N)(t.usedCount)," بار"):"".concat((0,f.N)(t.usedCount)," از ").concat((0,f.N)(t.totalUsageLimit))}),(0,a.jsx)("td",{className:"p-12 whitespace-nowrap text-12 text-gray-6C6A7D",children:t.startsAt||t.endsAt?(0,a.jsxs)(a.Fragment,{children:[t.startsAt?(0,f.IY)(t.startsAt):"—"," تا ",t.endsAt?(0,f.IY)(t.endsAt):"بدون پایان"]}):"بدون محدودیت زمانی"}),(0,a.jsx)("td",{className:"p-12",children:(0,a.jsx)(f.Ct,{tone:h.Ri[t.effectiveStatus],children:h.NK[t.effectiveStatus]})}),(0,a.jsx)("td",{className:"p-12",children:(0,a.jsxs)("div",{className:"flex items-center justify-end gap-x-6",children:[(0,a.jsx)(f.zx,{variant:"ghost",disabled:g===t.id||"ARCHIVED"===t.status,onClick:function(){return function(t){return R.apply(this,arguments)}(t)},title:"ACTIVE"===t.status?"غیرفعال‌سازی فوری":"فعال‌سازی",children:"ACTIVE"===t.status?"غیرفعال کن":"فعال کن"}),(0,a.jsx)(u(),{href:"/admin/settings/discount-codes/".concat(t.id),children:(0,a.jsx)(f.zx,{variant:"ghost",title:"ویرایش",children:(0,a.jsx)("i",{className:"icon-Edit text-14"})})}),(0,a.jsx)(f.zx,{variant:"ghost",disabled:g===t.id,onClick:function(){return function(t){return w.apply(this,arguments)}(t)},title:t.usedCount>0?"آرشیو":"حذف",children:(0,a.jsx)("i",{className:"icon-Delete text-14 text-[#E53935]"})})]})})]},t.id)})})]})})]})})}}},function(t){t.O(0,[9791,9759,9774,2888,179],function(){return t(t.s=23937)}),_N_E=t.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.