PageSourceSearch

https://techxpertindia.com/assets/ProfileWallet-DXWRyYbb.js

js techxpertindia.com collected 2026-10-10 02:34:58 UTC 8,217 bytes, 1 lines download raw bytes

1import{r as c,j as e,L as k}from"./vendor-react-uOgp_wa2.js";import{u as C,Q as L,R,C as S,o as I,g as T,S as W,H as $}from"./index-yU7OBVab.js";import{S as p}from"./bookingPolicies-BgHUSBC6.js";import{s as E}from"./helpers-BiphBjSD.js";import"./vendor-ui-BxQmMfpj.js";function i(s){return`₹${Number(s||0).toLocaleString("en-IN",{maximumFractionDigits:0})}`}function l(s){if(!s)return"—";try{return new Date(s).toLocaleDateString("en-IN",{day:"numeric",month:"short",year:"numeric"})}catch{return"—"}}const D=()=>{const s=C(),{data:a,isLoading:y,isError:f,refetch:j}=L(),[N,{isLoading:r}]=R(),[m,x]=c.useState(null),[n,d]=c.useState(null);c.useEffect(()=>{E()},[]);const u=Number(a?.balance)||0,b=a?.lots||[],g=a?.ledger||[],o=a?.refund_requests||[],h=new Set(o.filter(t=>t.status==="pending"&&t.lot_id!=null).map(t=>Number(t.lot_id))),w=t=>t==="pending"?"Under review":t==="refunded"?"Approved":t==="rejected"?"Not approved":t,v=t=>t==="pending"?"bg-amber-50 text-amber-800 border-amber-200":t==="refunded"?"bg-green-50 text-green-800 border-green-200":t==="rejected"?"bg-gray-100 text-gray-700 border-gray-200":"bg-gray-50 text-gray-600 border-gray-200",_=async()=>{if(n){x(n.lot_id);try{await N({lot_id:n.lot_id,amount:Number(n.amount_remaining),note:"Customer requested cash refund from Techxpert Wallet page"}).unwrap(),d(null),s.success("Cash refund request submitted for review"),j()}catch(t){s.error(t?.data?.message||t?.message||"Could not submit request")}finally{x(null)}}};return e.jsxs("div",{className:"min-h-screen bg-gray-50 py-8 pb-24",children:[e.jsx(S,{children:e.jsxs("div",{className:"max-w-lg mx-auto",children:[e.jsxs(k,{to:"/profile",className:"inline-flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-800 mb-4",children:[e.jsx(I,{size:12})," Back to profile"]}),e.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[e.jsx("div",{className:"w-11 h-11 rounded-xl bg-primary-50 border border-primary-100 flex items-center justify-center",children:e.jsx(T,{className:"text-primary-600",size:18})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-gray-900",children:"Techxpert Wallet"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Credits for your next service bill"})]})]}),e.jsx("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-6 mb-4",children:y?e.jsx("p",{className:"text-sm text-gray-400",children:"Loading balance…"}):f?e.jsx("p",{className:"text-sm text-red-600",children:"Could not load wallet. Pull to refresh."}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-gray-400 mb-1",children:"Available balance"}),e.jsx("p",{className:"text-3xl font-bold text-gray-900",children:i(u)}),a?.next_expiry&&u>0&&e.jsxs("p",{className:"text-sm text-gray-500 mt-2",children:["Next expiry ",l(a.next_expiry)]}),e.jsx("p",{className:"text-xs text-gray-400 mt-3 leading-relaxed",children:"Apply at checkout on the service bill only. Booking fee is always paid online and cannot use wallet credits."})]})}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Active credits"}),b.length?e.jsx("ul",{className:"space-y-3",children:b.map(t=>e.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-gray-50 last:border-0 pb-3 last:pb-0",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"font-semibold text-gray-900",children:[i(t.amount_remaining),e.jsxs("span",{className:"text-xs font-normal text-gray-400 ml-2",children:["of ",i(t.amount_original)]})]}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Expires ",l(t.expires_at),t.source_booking_id?` · booking #${t.source_booking_id}`:""]}),t.note&&e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:t.note})]}),e.jsx("button",{type:"button",disabled:r||m===t.lot_id||h.has(Number(t.lot_id)),onClick:()=>d(t),className:"text-xs font-medium text-gray-600 border border-gray-200 rounded-lg px-2.5 py-1.5 hover:bg-gray-50 disabled:opacity-50 shrink-0",children:h.has(Number(t.lot_id))?"Pending review":m===t.lot_id?"…":"Request cash"})]},t.lot_id))}):e.jsx("p",{className:"text-sm text-gray-400",children:"No active credits right now."})]}),o.length>0&&e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Cash refund requests"}),e.jsx("ul",{className:"space-y-3",children:o.slice(0,10).map(t=>e.jsxs("li",{className:"flex items-start justify-between gap-3 border-b border-gray-50 last:border-0 pb-3 last:pb-0",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900",children:i(t.amount)}),e.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:["Requested ",l(t.created_at),t.settled_at?` · updated ${l(t.settled_at)}`:""]}),t.status==="rejected"&&e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Credit stays in your wallet for future bookings.",t.admin_note?` ${t.admin_note}`:""]}),t.status==="refunded"&&e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Cash refund in progress to your original payment method (typically 5–7 business days)."}),t.status==="pending"&&e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Support will email you when this is reviewed."})]}),e.jsx("span",{className:`text-[11px] font-semibold px-2 py-1 rounded-full border shrink-0 ${v(t.status)}`,children:w(t.status)})]},t.request_id))})]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-5 mb-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Recent activity"}),g.length?e.jsx("ul",{className:"space-y-3",children:g.slice(0,20).map(t=>e.jsxs("li",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-800",children:t.reason}),e.jsxs("p",{className:"text-xs text-gray-400 mt-0.5",children:[l(t.created_at),t.booking_id?` · booking #${t.booking_id}`:""]})]}),e.jsxs("span",{className:`text-sm font-semibold shrink-0 ${t.direction==="credit"?"text-green-600":"text-gray-800"}`,children:[t.direction==="credit"?"+":"−",i(t.amount)]})]},t.entry_id))}):e.jsx("p",{className:"text-sm text-gray-400",children:"No wallet activity yet."})]}),e.jsx("div",{className:"rounded-2xl border border-amber-100 bg-amber-50/60 p-4",children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(W,{className:"text-amber-700 shrink-0 mt-0.5",size:18}),e.jsxs("div",{className:"text-sm text-amber-900/80 leading-relaxed",children:[e.jsx("p",{className:"font-medium text-amber-950 mb-1",children:"Cash refunds"}),e.jsxs("p",{children:["We do not auto-refund to bank/UPI. Eligible amounts are held temporarily in Techxpert Wallet (30 days). For an actual cash refund, request it here or email"," ",e.jsx("a",{href:`mailto:${p}?subject=Techxpert%20Wallet%20cash%20refund`,className:"underline font-medium",children:p})," ","with booking and payment details — it is processed after review."]})]})]})})]})}),e.jsx($,{isOpen:!!n,onClose:()=>!r&&d(null),size:"sm",animation:"scale",className:"overflow-visible",contentClassName:"px-6 pt-4 pb-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-bold text-gray-900 mb-2 pr-8",children:"Request cash refund?"}),e.jsx("p",{className:"text-sm text-gray-500 leading-relaxed mb-6",children:"This does not refund instantly. Support reviews your booking and payment details, then settles manually."}),e.jsxs("div",{className:"flex flex-col gap-3 w-full",children:[e.jsx("button",{type:"button",onClick:_,disabled:r,className:"w-full py-3 bg-green-600 hover:bg-green-700 disabled:opacity-60 text-white rounded-xl text-sm font-bold transition-all",children:r?"Submitting…":"Submit request"}),e.jsx("button",{type:"button",onClick:()=>d(null),disabled:r,className:"w-full py-3 bg-white border border-gray-200 text-gray-700 rounded-xl text-sm font-semibold hover:bg-gray-50 transition-all disabled:opacity-50",children:"Cancel"})]})]})})]})};export{D as default};

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.