PageSourceSearch

https://lidomatrip.com/_next/static/chunks/pages/admin/wallet-a204410f54b88ff9.js

js lidomatrip.com collected 2026-10-02 20:26:50 UTC 17,463 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3101],{64542:function(e,s,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/wallet",function(){return a(63822)}])},63822:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return u}});var t=a(85893),l=a(67294),n=a(44389),r=a(49759),i=a(84858),d=a(32474);let c=[{key:"unpaid",label:"واریز نشده"},{key:"partial",label:"واریز ناقص"},{key:"settled",label:"تسویه شده"},{key:"all",label:"همه"}];function x(){let[e,s]=(0,l.useState)("unpaid"),[a,r]=(0,l.useState)(1),[x,h]=(0,l.useState)(""),[p,j]=(0,l.useState)(null),u=new URLSearchParams({page:String(a),pageSize:String(20),filter:e,...x?{q:x}:{}}),{data:N,isLoading:g,mutate:b}=(0,n.u)(`/api/admin/wallet/deposits/payables?${u.toString()}`,e=>(0,i.Px)(e)),{data:y,mutate:f}=(0,n.u)("/api/admin/wallet/deposits?take=10",e=>(0,i.SC)(e)),v=(null==N?void 0:N.items)??[],w=v.reduce((e,s)=>e+Math.max(s.remainder,0),0);return(0,t.jsxs)("div",{className:"flex flex-col gap-y-16",children:[(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(d.zx,{variant:"secondary",onClick:function(){(0,i.hn)(),window.open("/deposit","_blank","noopener")},children:"پنل واریزی قدیم (ویرایش مانده، کسر بدهی، اطلاعات بانکی)"})}),(0,t.jsx)(m,{}),(0,t.jsxs)(d.Zb,{className:"px-16 py-12 flex items-center justify-between gap-x-16 gap-y-12 flex-wrap",children:[(0,t.jsxs)("div",{className:"flex items-center gap-x-12 flex-wrap gap-y-8",children:[(0,t.jsx)(d.Qm,{tabs:c,value:e,onChange:e=>{s(e),r(1)}}),(0,t.jsx)(d.Hf,{value:x,onChange:e=>{h(e),r(1)},placeholder:"کد رزرو، نام یا موبایل میزبان"})]}),N&&(0,t.jsx)(d.p0,{page:a,pageSize:20,total:N.meta.total,pageCount:N.meta.pageCount,onPage:r})]}),v.length>0&&(0,t.jsxs)("p",{className:"text-13 leading-20 text-gray-6C6A7D",children:["مانده‌ی این صفحه: ",(0,t.jsx)("b",{className:"text-black",children:(0,d.ND)(w)})]}),g?(0,t.jsx)(d.Od,{className:"h-[320px]"}):0===v.length?(0,t.jsx)(d.Zb,{children:(0,t.jsx)(d.ub,{text:"رزروی در این وضعیت نیست"})}):(0,t.jsx)(d.Zb,{className:"overflow-x-auto",children:(0,t.jsxs)("table",{className:"w-full min-w-[1100px] text-right border-collapse",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"bg-gray-F5F5F7 text-12 leading-18 text-gray-6C6A7D",children:[(0,t.jsx)("th",{className:"px-12 py-12 font-m w-40",children:"ردیف"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"کد رزرو"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"میزبان"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"شروع اقامت"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"مبلغ کل اجاره"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"کارمزد سایت"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"ارزش افزوده"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"سهم میزبان"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"واریز شده"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m whitespace-nowrap",children:"مانده واریز"}),(0,t.jsx)("th",{className:"px-12 py-12 font-m"})]})}),(0,t.jsx)("tbody",{className:"divide-y divide-gray-F0F0F0",children:v.map((e,s)=>{var l,n,r;return(0,t.jsxs)("tr",{className:"hover:bg-gray-F5F5F7 transition",children:[(0,t.jsx)("td",{className:"px-12 py-12 text-13 text-gray-6C6A7D",children:(0,d.N)((a-1)*20+s+1)}),(0,t.jsxs)("td",{className:"px-12 py-12 whitespace-nowrap",children:[(0,t.jsx)("a",{href:`/admin/reservations/${e.id}`,className:"text-14 font-m text-primary-dark",title:null===(l=e.residence)||void 0===l?void 0:l.name,children:e.reference}),"CANCEL"===e.state&&(0,t.jsx)(d.Ct,{tone:"red",className:"mr-6",children:"کنسل‌شده"})]}),(0,t.jsxs)("td",{className:"px-12 py-12",children:[(0,t.jsx)("div",{className:"text-14 leading-20 text-black",children:(null===(n=e.host)||void 0===n?void 0:n.name)||"بدون نام"}),(0,t.jsx)("div",{className:"text-12 leading-18 text-gray-6C6A7D",dir:"ltr",children:null===(r=e.host)||void 0===r?void 0:r.phone})]}),(0,t.jsx)("td",{className:"px-12 py-12 text-13 whitespace-nowrap",children:(0,d.IY)(e.startDate)}),(0,t.jsx)("td",{className:"px-12 py-12 text-14 whitespace-nowrap",children:(0,d.N)(e.totalAmount)}),(0,t.jsxs)("td",{className:"px-12 py-12 text-13 whitespace-nowrap text-gray-6C6A7D",children:[(0,d.N)(e.websiteShare??0),null!=e.commissionPercent&&(0,t.jsxs)("span",{className:"text-11 text-gray-9B9BAA",children:[" (",(0,d.N)(e.commissionPercent),"٪)"]})]}),(0,t.jsx)("td",{className:"px-12 py-12 text-13 whitespace-nowrap text-gray-6C6A7D",children:(0,d.N)(e.vatAmount??0)}),(0,t.jsx)("td",{className:"px-12 py-12 text-14 font-m whitespace-nowrap",children:(0,d.N)(e.hostShare??0)}),(0,t.jsx)("td",{className:"px-12 py-12 text-13 whitespace-nowrap text-gray-6C6A7D",children:(0,d.N)(e.settledAmount)}),(0,t.jsx)("td",{className:"px-12 py-12 whitespace-nowrap",children:e.remainder>0?(0,t.jsx)("span",{className:"text-14 font-m text-[#C62828]",children:(0,d.N)(e.remainder)}
1):(0,t.jsx)(d.Ct,{tone:"green",children:"تسویه شده"})}),(0,t.jsx)("td",{className:"px-12 py-12 whitespace-nowrap",children:e.remainder>0&&(0,t.jsx)(d.zx,{onClick:()=>j(e),children:"ثبت واریز"})})]},e.id)})})]})}),!!(null==y?void 0:y.length)&&(0,t.jsxs)(d.Zb,{className:"p-20",children:[(0,t.jsx)("h3",{className:"text-15 leading-24 font-m text-black mb-10",children:"آخرین واریزها"}),(0,t.jsx)("div",{className:"flex flex-col gap-y-8",children:y.map(e=>{var s,a;return(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-x-12 flex-wrap text-13 leading-20 py-6 border-b border-gray-F0F0F0 last:border-0",children:[(0,t.jsxs)("span",{className:"text-black",children:[(0,d.ND)(e.amount),(0,t.jsxs)("span",{className:"text-gray-6C6A7D",children:[" به ",(null===(s=e.host)||void 0===s?void 0:s.name)||(null===(a=e.host)||void 0===a?void 0:a.phone)]}),e.reservation&&(0,t.jsxs)("span",{className:"text-gray-9B9BAA",children:[" \xb7 ",e.reservation.reference]})]}),(0,t.jsxs)("span",{className:"text-12 text-gray-6C6A7D",children:[(0,d.IY)(e.depositedAt),e.txnId&&(0,t.jsxs)(t.Fragment,{children:[" \xb7 پیگیری ",e.txnId]}),e.sender&&(0,t.jsxs)(t.Fragment,{children:[" \xb7 از ",e.sender]})]})]},e.id)})})]}),(0,t.jsx)(o,{payable:p,onClose:()=>j(null),onDone:()=>{j(null),b(),f()}})]})}function o(e){let{payable:s,onClose:a,onDone:n}=e,[r,c]=(0,l.useState)(""),[x,o]=(0,l.useState)(""),[h,m]=(0,l.useState)(""),[p,j]=(0,l.useState)(!1),[u,N]=(0,l.useState)(null),g=(null==s?void 0:s.id)??0,[b,y]=(0,l.useState)(0);s&&b!==g&&(y(g),c(String(s.remainder)),o(""),m(""),N(null));let f=(0,d.EU)(r),v=!!s&&f>s.remainder;async function w(){if(null==s?void 0:s.host){j(!0),N(null);try{await (0,i.SC)("/api/admin/wallet/deposits",{method:"POST",body:JSON.stringify({hostId:s.host.id,reservationId:s.id,amount:f,txnId:x.trim()||null,sender:h.trim()||null})}),n()}catch(e){N(e instanceof Error?e.message:"ثبت واریز انجام نشد")}finally{j(!1)}}}return(0,t.jsx)(d.u_,{open:!!s,onClose:a,title:s?`ثبت واریز — ${s.reference}`:"",children:s&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"mb-14 p-12 rounded-10 bg-gray-F5F5F7 text-12 leading-22 text-gray-6C6A7D",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"مبلغ کل اجاره"}),(0,t.jsx)("span",{className:"text-black",children:(0,d.N)(s.totalAmount)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"سهم لیدوما"}),(0,t.jsxs)("span",{children:["− ",(0,d.N)(s.websiteShare??0)]})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"ارزش افزوده"}),(0,t.jsxs)("span",{children:["− ",(0,d.N)(s.vatAmount??0)]})]}),(0,t.jsxs)("div",{className:"flex justify-between pt-6 mt-6 border-t border-dashed border-gray-E5E5E6",children:[(0,t.jsx)("span",{children:"مقدار اصلی سهم میزبان"}),(0,t.jsx)("span",{className:"text-black font-m",children:(0,d.N)(s.hostShare??0)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"واریز شده تا کنون"}),(0,t.jsx)("span",{children:(0,d.N)(s.settledAmount)})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsx)("span",{children:"مانده واریز"}),(0,t.jsx)("span",{className:"text-black font-m",children:(0,d.N)(s.remainder)})]})]}),(0,t.jsx)(d.gN,{label:"مبلغ واریز (تومان)",children:(0,t.jsx)(d.II,{inputMode:"numeric",value:f?f.toLocaleString("fa-IR"):"",onChange:e=>c(e.target.value)})}),(0,t.jsxs)("div",{className:"grid md:grid-cols-2 gap-12 mt-12",children:[(0,t.jsx)(d.gN,{label:"شماره پیگیری تراکنش",children:(0,t.jsx)(d.II,{value:x,onChange:e=>o(e.target.value),placeholder:"مثلاً ۱۴۰۵۰۶۰۸۱۲۳۴"})}),(0,t.jsx)(d.gN,{label:"حساب فرستنده",children:(0,t.jsx)(d.II,{value:h,onChange:e=>m(e.target.value),placeholder:"نام بانک یا شماره حساب"})})]}),(0,t.jsxs)("p",{className:"mt-12 text-12 leading-20 text-gray-9B9BAA",children:["این مبلغ از موجودی ",(0,t.jsx)("b",{children:"قابل برداشت"})," میزبان کم می‌شود. اگر اقامت هنوز شروع نشده، پول مسدود است و واریز رد می‌شود."]}),v&&(0,t.jsx)("p",{className:"mt-8 text-13 text-[#C62828]",children:"مبلغ از مانده‌ی این رزرو بیشتر است."}),!!u&&(0,t.jsx)("p",{className:"mt-8 text-13 text-[#C62828]",children:u}),(0,t.jsxs)("div",{className:"flex justify-end gap-x-10 mt-16",children:[(0,t.jsx)(d.zx,{variant:"secondary",onClick:a,children:"انصراف"}),(0,t.jsx)(d.zx,{disabled:p||f<=0||v,onClick:w,children:p?"در حال ثبت...":"ثبت واریز"})]})]})})}let h={"release-matured":"آزادسازی سهم میزبان"};function m(){let{data:e,mutate:s}=(0,n.u)("/api/admin/wallet/scheduler",e=>(0,i.SC)(e),{refreshInterval:6e4}),[a,r]=(0,l.useState)(!1),[c,x]=(0,l.useState)(null);if(!e)return null;let o=e.jobs.find(e=>"release-matured"===e.name),m=!e.enabled||!e.started;async function p(){r(!0),x(null);try{let e=await (0,i.SC)("/api/admin/wallet/release-matured",{method:"POST"});x((null==e?void 0:e.released)?`${(0,d.N)(e.released)} رزرو آزاد شد`:"رزروی برای آزادسازی نبود"),s()}catch(e){x(e instanceof Error?e.message:"اجرا نشد")}finally{r(!1)}}return(0,t.jsxs)(d.Zb,{className:"px-16 py-12 flex items-center justify-between gap-x-16 gap-y-10 flex-wrap",children:[(0,t.jsxs)("div",{className:"flex items-center gap-x-12 flex-wrap gap-y-6",children:[(0,t.jsx)(d.
1Ct,{tone:m?"red":"green",children:m?"زمان‌بند خاموش":"زمان‌بند فعال"}),(0,t.jsxs)("span",{className:"text-13 leading-20 text-gray-6C6A7D",children:[h[(null==o?void 0:o.name)??""]??(null==o?void 0:o.name),o&&(0,t.jsxs)(t.Fragment,{children:[" \xb7 هر ",(0,d.N)(o.everyMinutes)," دقیقه"]}),(null==o?void 0:o.lastOkAt)?(0,t.jsxs)(t.Fragment,{children:[" \xb7 آخرین اجرای موفق ",(0,d.IY)(o.lastOkAt)]}):(0,t.jsx)(t.Fragment,{children:" \xb7 هنوز اجرا نشده"})]}),(null==o?void 0:o.running)&&(0,t.jsx)(d.Ct,{tone:"blue",children:"در حال اجرا"}),!!(null==o?void 0:o.failures)&&(0,t.jsxs)(d.Ct,{tone:"red",children:[(0,d.N)(o.failures)," خطا"]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-x-10",children:[c&&(0,t.jsx)("span",{className:"text-12 text-gray-6C6A7D",children:c}),(0,t.jsx)(d.zx,{variant:"secondary",disabled:a,onClick:p,children:a?"در حال اجرا...":"اجرای دستی"})]})]})}let p={REQUESTED:"yellow",APPROVED:"blue",PAID:"green",REJECTED:"red"},j={REQUESTED:"در انتظار بررسی",APPROVED:"تأیید شده",PAID:"پرداخت شده",REJECTED:"رد شده"};function u(){let[e,s]=(0,l.useState)("settlements"),[a,c]=(0,l.useState)("REQUESTED"),[o,h]=(0,l.useState)(null),[m,p]=(0,l.useState)(""),[j,u]=(0,l.useState)(null),{data:g,error:b,isLoading:y,mutate:f}=(0,n.u)(`/api/admin/wallet/settlements?status=${a}&take=50`,i.SC),v=(null==g?void 0:g.items)??[],w=v.reduce((e,s)=>e+s.amount,0);async function C(e,s,a){u(e);try{await (0,i.SC)(`/api/admin/wallet/settlements/${e}/${s}`,{method:"POST",body:JSON.stringify(a??{})}),await f(),h(null),p("")}catch(e){alert((null==e?void 0:e.message)||"انجام نشد")}finally{u(null)}}return(0,t.jsxs)(r.Z,{title:"کیف پول و تسویه",children:[(0,t.jsx)("div",{className:"mb-16",children:(0,t.jsx)(d.Qm,{tabs:[{key:"settlements",label:"درخواست‌های تØ
1³ÙˆÛŒÙ‡"},{key:"deposits",label:"واریز به میزبان"}],value:e,onChange:e=>s(e)})}),"deposits"===e?(0,t.jsx)(x,{}):(0,t.jsx)(N,{tab:a,setTab:c,rows:v,pendingTotal:w,isLoading:y,error:b,busy:j,act:C,rejecting:o,setRejecting:h,reason:m,setReason:p})]})}function N(e){let{tab:s,setTab:a,rows:l,pendingTotal:n,isLoading:r,error:i,busy:c,act:x,rejecting:o,setRejecting:h,reason:m,setReason:u}=e;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"mb-16 grid grid-cols-1 gap-12 md:grid-cols-2",children:[(0,t.jsx)(d.bB,{label:`تعداد در \xab${j[s]}\xbb`,value:(0,d.N)(l.length)}),(0,t.jsx)(d.bB,{label:"مجموع مبلغ نمایش‌داده‌شده",value:(0,d.ND)(n)})]}),(0,t.jsx)(d.Qm,{tabs:Object.keys(j).map(e=>({key:e,label:j[e]})),value:s,onChange:e=>a(e)}),r?(0,t.jsx)(d.Od,{className:"mt-16 h-[320px]"}):i?(0,t.jsx)(d.ub,{text:"دریافت فهرست ممکن نشد"}):0===l.length?(0,t.jsx)(d.ub,{text:`درخواستی در وضعیت \xab${j[s]}\xbb نیست`}):(0,t.jsx)("div",{className:"mt-16 overflow-x-auto rounded-12 border-1 border-solid border-gray-200 bg-white",children:(0,t.jsxs)("table",{className:"w-full min-w-[860px] text-right",children:[(0,t.jsx)("thead",{className:"bg-gray-50 text-12 text-gray-500",children:(0,t.jsxs)("tr",{children:[(0,t.jsx)("th",{className:"p-12 font-r w-40",children:"ردیف"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"کاربر"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"مبلغ"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"مقصد"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"تاریخ درخواست"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"وضعیت"}),(0,t.jsx)("th",{className:"p-12 font-r",children:"اقدام"})]})}),(0,t.jsx)("tbody",{children:l.map((e,s)=>{var a,l;return(0,t.jsxs)("tr",{className:"border-t-1 border-solid border-gray-100 text-14",children:[(0,t.jsx)("td",{className:"p-12 text-gray-500",children:(0,d.N)(s+1)}),(0,t.jsxs)("td",{className:"p-12",children:[(0,t.jsx)("div",{className:"font-m text-black",children:(null===(a=e.user)||void 0===a?void 0:a.name)||"—"}),(0,t.jsx)("div",{className:"text-12 text-gray-500",children:null===(l=e.user)||void 0===l?void 0:l.phone})]}),(0,t.jsx)("td",{className:"p-12 font-m",children:(0,d.ND)(e.amount)}),(0,t.jsxs)("td",{className:"p-12 text-12 text-gray-600",children:[e.shaba_number?(0,t.jsxs)("div",{children:["شبا: ",e.shaba_number]}):e.card_last4?(0,t.jsxs)("div",{children:["کارت: •••• ",e.card_last4]}):"—",e.owner_name&&(0,t.jsx)("div",{className:"text-gray-500",children:e.owner_name})]}),(0,t.jsx)("td",{className:"p-12 text-12 text-gray-600",children:(0,d.IY)(e.created_at)}),(0,t.jsxs)("td",{className:"p-12",children:[(0,t.jsx)(d.Ct,{tone:p[e.status],children:j[e.status]}),e.admin_note&&(0,t.jsx)("div",{className:"mt-4 max-w-[220px] text-11 text-gray-500",children:e.admin_note})]}),(0,t.jsx)("td",{className:"p-12",children:(0,t.jsxs)("div",{className:"flex flex-wrap gap-8",children:["REQUESTED"===e.status&&(0,t.jsx)(d.zx,{disabled:c===e.id,onClick:()=>x(e.id,"approve"),children:"تأیید"}),"APPROVED"===e.status&&(0,t.jsx)(d.zx,{disabled:c===e.id,onClick:()=>x(e.id,"paid"),children:"پرداخت شد"}),("REQUESTED"===e.status||"APPROVED"===e.status)&&(0,t.jsx)(d.zx,{variant:"ghost",disabled:c===e.id,onClick:()=>{h(e),u("")},children:"رد"}),e.processed_by&&(0,t.jsxs)("span",{className:"self-center text-11 text-gray-500",children:["توسط ",e.processed_by]})]})})]},e.id)})})]})}),(0,t.jsxs)(d.u_,{open:!!o,onClose:()=>h(null),title:`رد درخواست تسویه${o?` — ${(0,d.ND)(o.amount)}`:""}`,children:[(0,t.jsx)("p",{className:"mb-12 text-13 leading-22 text-gray-600",children:"مبلغ به موجودی قابل برداشت کاربر برمی‌گردد و دلیل زیر به او نمایش داده می‌شود."}),(0,t.jsx)("textarea",{value:m,onChange:e=>u(e.target.value),rows:3,placeholder:"دلیل رد درخواست",className:"mb-12 w-full rounded-8 border-1 border-solid border-gray-200 p-12 text-14 outline-none focus:border-primary-main"}),(0,t.jsxs)("div",{className:"flex justify-end gap-8",children:[(0,t.jsx)(d.zx,{variant:"ghost",onClick:()=>h(null),children:"انصراف"}),(0,t.jsx)(d.zx,{disabled:m.trim().length<3||c===(null==o?void 0:o.id),onClick:()=>o&&x(o.id,"reject",{reason:m.trim()}),children:"رد و بازگشت مبلغ"})]})]})]})}}},function(e){e.O(0,[4389,9759,9774,2888,179],function(){return e(e.s=64542)}),_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.