PageSourceSearch

https://sendunlimitedemail.com/sue/mod-ttS3Q133.js

js sendunlimitedemail.com collected 2026-10-05 06:26:05 UTC 13,793 bytes, 1 lines download raw bytes

1import{r as a,e as p,j as e,U as G,t as d}from"./edge-BOITG1XR.js";import{L as f}from"./mod-DxqX0N6D.js";import{S as I}from"./mod-CnFQ395x.js";import{W as $}from"./mod-CWXjJFf0.js";import{A as O}from"./mod-DyTSIgOD.js";import{S as W}from"./mod-CKg_ZYcm.js";import{P as C}from"./mod-BHbsKpbp.js";import{X as S}from"./mod-C3kaoPgB.js";const A={Bronze:"bg-orange-100 text-orange-700",Silver:"bg-gray-100 text-gray-600",Gold:"bg-yellow-100 text-yellow-700"};function te(){const[P,b]=a.useState(!0),[j,L]=a.useState([]),[o,X]=a.useState([]),[k,E]=a.useState([]),[r,M]=a.useState("credits"),[n,N]=a.useState(""),[R,c]=a.useState(!1),[T,x]=a.useState(!1),[m,u]=a.useState(!1),[l,g]=a.useState({email:"",amount:"",note:""}),[i,h]=a.useState({email:"",points:"",note:""});a.useEffect(()=>{y()},[]);const y=async()=>{b(!0);try{const[t,s]=await Promise.all([p.get("/admin/store-credits"),p.get("/admin/rewards/tiers")]);L(Array.isArray(t.data?.data)?t.data.data:Array.isArray(t.data)?t.data:[]),E(Array.isArray(s.data?.data)?s.data.data:Array.isArray(s.data)?s.data:[])}catch{}finally{b(!1)}},F=async t=>{if(t.preventDefault(),!l.email||!l.amount){d.error("Email and amount are required");return}u(!0);try{await p.post("/admin/store-credits/add",l),d.success("Store credit added successfully"),c(!1),g({email:"",amount:"",note:""}),y()}catch{d.error("Failed to add store credit")}finally{u(!1)}},U=async t=>{if(t.preventDefault(),!i.email||!i.points){d.error("Email and points are required");return}u(!0);try{await p.post("/admin/rewards/add-points",i),d.success("Points added successfully"),x(!1),h({email:"",points:"",note:""}),y()}catch{d.error("Failed to add points")}finally{u(!1)}},q=o.length,D=o.reduce((t,s)=>t+(s.points||0),0),z=j.reduce((t,s)=>t+(s.credit_balance||0),0),_=o.filter(t=>t.tier==="Gold").length,v=j.filter(t=>t.user.toLowerCase().includes(n.toLowerCase())||t.email.toLowerCase().includes(n.toLowerCase())),w=o.filter(t=>t.user.toLowerCase().includes(n.toLowerCase())||t.email.toLowerCase().includes(n.toLowerCase()));return P?e.jsx("div",{className:"flex items-center justify-center min-h-96",children:e.jsx(f,{className:"h-8 w-8 animate-spin text-violet-600"})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Loyalty & Rewards"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Manage store credits, reward points, and membership tiers"})]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-violet-100 rounded-lg",children:e.jsx(G,{className:"h-5 w-5 text-violet-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Total Members"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:q})]})]})}),e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-blue-100 rounded-lg",children:e.jsx(I,{className:"h-5 w-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Total Points Issued"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:D.toLocaleString()})]})]})}),e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-green-100 rounded-lg",children:e.jsx($,{className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Total Credit Balance"}),e.jsxs("p",{className:"text-2xl font-bold text-gray-900",children:["AED ",z.toFixed(2)]})]})]})}),e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-5",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-yellow-100 rounded-lg",children:e.jsx(O,{className:"h-5 w-5 text-yellow-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Gold Members"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:_})]})]})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 space-y-4",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 items-start sm:items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:[["credits","Store Credit"],["points","Reward Points"],["tiers","Tiers"]].map(([t,s])=>e.jsx("button",{onClick:()=>{M(t),N("")},className:`px-4 py-1.5 rounded-full text-sm font-medium transition-colors ${r===t?"bg-violet-600 text-white":"bg-gray-100 text-gray-600 hover:bg-gray-200"}`,children:s},t))}),r!=="tiers"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-56",children:[e.jsx(W,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{value:n,onChange:t=>N(t.target.value),placeholder:"Search users...",className:"w-full pl-9 pr-3 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-violet-500"})]}
1),r==="credits"&&e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg text-sm font-medium transition-colors",children:[e.jsx(C,{className:"h-4 w-4"}),"Add Credit"]}),r==="points"&&e.jsxs("button",{onClick:()=>x(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg text-sm font-medium transition-colors",children:[e.jsx(C,{className:"h-4 w-4"}),"Add Points"]})]})]}),r==="credits"&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100",children:[e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"User"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Email"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Credit Balance"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Last Updated"})]})}),e.jsx("tbody",{children:v.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"text-center py-10 text-gray-400",children:"No users found."})}):v.map(t=>e.jsxs("tr",{className:"border-b border-gray-50 hover:bg-gray-50",children:[e.jsx("td",{className:"py-3 px-2 font-medium text-gray-900",children:t.user}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.email}),e.jsxs("td",{className:"py-3 px-2 font-semibold text-green-700",children:["AED ",t.credit_balance.toFixed(2)]}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.last_updated})]},t.id))})]})}),r==="points"&&e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-gray-100",children:[e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"User"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Email"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Points"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Tier"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Multiplier"})]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"text-center py-10 text-gray-400",children:"No users found."})}):w.map(t=>e.jsxs("tr",{className:"border-b border-gray-50 hover:bg-gray-50",children:[e.jsx("td",{className:"py-3 px-2 font-medium text-gray-900",children:t.user}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.email}),e.jsx("td",{className:"py-3 px-2 font-semibold text-violet-700",children:t.points.toLocaleString()}),e.jsx("td",{className:"py-3 px-2",children:e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${A[t.tier]||"bg-gray-100 text-gray-600"}`,children:t.tier})}),e.jsxs("td",{className:"py-3 px-2 text-gray-600",children:[t.multiplier,"x"]})]},t.id))})]})}),r==="tiers"&&e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:k.map(t=>e.jsxs("div",{className:"border border-gray-200 rounded-xl p-5 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-semibold ${A[t.name]||"bg-gray-100 text-gray-600"}`,children:t.name}),e.jsxs("span",{className:"text-sm text-gray-500",children:[t.multiplier,"x points"]})]}),e.jsxs("p",{className:"text-xs text-gray-500",children:["Min. ",t.min_points.toLocaleString()," points"]}),e.jsx("ul",{className:"space-y-1.5",children:t.benefits.map((s,B)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx("span",{className:"text-violet-500 mt-0.5",children:"✓"}),s]},B))})]},t.name))})]}),R&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Add Store Credit"}),e.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(S,{className:"h-5 w-5"})})]}),e.jsxs("form",{onSubmit:F,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"User Email *"}),e.jsx("input",{type:"email",value:l.email,onChange:t=>g(s=>({...s,email:t.target.value})),placeholder:"[email protected]",required:!0,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Amount (AED) *"}),e.jsx("input",{type:"number",min:"1",value:l.amount,onChange:t=>g(s=>({...s,amount:t.target.value})),placeholder:"e.g. 50",required:!0,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Note (optional)"}),e.jsx("textarea",{value:l.note,onChange:t=>g(s=>({...s,note:t.target.value})),rows:2,placeholder:"Reason for credit...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500 resize-none"})]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>c(!1),className:"flex-1 px-4 py-2 border border-gray-200 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:m,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50",children:[m&&e.jsx(f,{className:"h-4 w-4 animate-spin"})," Add Credit"]})]})]})]})}),T&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-xl w-full max-w-md p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Add Reward Points"}),e.jsx("button",{onClick:()=>x(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(S,{className:"h-5 w-5"})})]}),e.jsxs("form",{onSubmit:U,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"User Email *"}),e.jsx("input",{type:"email",value:i.email,onChange:t=>h(s=>({...s,email:t.target.value})),placeholder:"[email protected]",required:!0,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Points *"}),e.jsx("input",{type:"number",min:"1",value:i.points,onChange:t=>h(s=>({...s,points:t.target.value})),placeholder:"e.g. 200",required:!0,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Note (optional)"}),e.jsx("textarea",{value:i.note,onChange:t=>h(s=>({...s,note:t.target.value})),rows:2,placeholder:"Reason for points...",className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-violet-500 resize-none"})]}),e.jsxs("div",{className:"flex gap-3 pt-1",children:[e.jsx("button",{type:"button",onClick:()=>x(!1),className:"flex-1 px-4 py-2 border border-gray-200 rounded-lg text-sm font-medium text-gray-700 hover:bg-gray-50 transition-colors",children:"Cancel"}),e.jsxs("button",{type:"submit",disabled:m,className:"flex-1 flex items-center justify-center gap-2 px-4 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg text-sm font-medium transition-colors disabled:opacity-50",children:[m&&e.jsx(f,{className:"h-4 w-4 animate-spin"})," Add Points"]})]})]})]})})]})}export{te 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.