PageSourceSearch

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

js sendunlimitedemail.com collected 2026-10-05 06:26:03 UTC 9,384 bytes, 1 lines download raw bytes

1import{r,e as u,j as e,t as d}from"./edge-BOITG1XR.js";import{L as y}from"./mod-DxqX0N6D.js";import{P as E}from"./mod-BHbsKpbp.js";import{G}from"./mod-CZLdCikm.js";import{D as L}from"./mod-ByZwUIgr.js";import{C as _}from"./mod-B33gStZf.js";import{C as T}from"./mod-E2spV6fa.js";import{S as q}from"./mod-CKg_ZYcm.js";import{T as I}from"./mod-BuHkwEt_.js";import{X as P}from"./mod-C3kaoPgB.js";const z={active:"bg-green-100 text-green-700",redeemed:"bg-gray-100 text-gray-600",expired:"bg-red-100 text-red-700"};function H(){const[j,g]=r.useState(!0),[i,o]=r.useState([]),[x,b]=r.useState(""),[N,c]=r.useState(!1),[h,f]=r.useState(!1),[a,n]=r.useState({amount:"",quantity:1,expires_at:"",note:""});r.useEffect(()=>{v()},[]);const v=async()=>{g(!0);try{const t=await u.get("/admin/gift-cards");o(Array.isArray(t.data?.data)?t.data.data:Array.isArray(t.data)?t.data:[])}catch{}finally{g(!1)}},w=async t=>{if(t.preventDefault(),!a.amount||isNaN(Number(a.amount))||Number(a.amount)<=0){d.error("Please enter a valid amount");return}f(!0);try{const s=await u.post("/admin/gift-cards",a),l=s.data?.data||s.data;Array.isArray(l)?o(m=>[...l,...m]):l&&o(m=>[l,...m]),d.success("Gift card(s) created successfully"),c(!1),n({amount:"",quantity:1,expires_at:"",note:""})}catch{d.error("Failed to create gift card")}finally{f(!1)}},C=async t=>{if(confirm("Delete this gift card?"))try{await u.delete(`/admin/gift-cards/${t}`),o(s=>s.filter(l=>l.id!==t)),d.success("Gift card deleted")}catch{d.error("Failed to delete gift card")}},S=i.length,A=i.reduce((t,s)=>t+(s.amount||0),0),k=i.filter(t=>t.status==="redeemed").length,D=i.filter(t=>t.status==="active").length,p=i.filter(t=>t.code.toLowerCase().includes(x.toLowerCase())||(t.issued_to||"").toLowerCase().includes(x.toLowerCase()));return j?e.jsx("div",{className:"flex items-center justify-center min-h-96",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-violet-600"})}):e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Gift Cards"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Issue and manage store gift cards"})]}),e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-2 px-4 py-2 bg-violet-600 hover:bg-violet-700 text-white rounded-lg text-sm font-medium transition-colors",children:[e.jsx(E,{className:"h-4 w-4"}),"Create Gift Card"]})]}),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 Issued"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:S})]})]})}),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(L,{className:"h-5 w-5 text-blue-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Total Value"}),e.jsxs("p",{className:"text-2xl font-bold text-gray-900",children:["AED ",A.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-gray-100 rounded-lg",children:e.jsx(_,{className:"h-5 w-5 text-gray-500"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Redeemed"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:k})]})]})}),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(T,{className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-gray-500",children:"Active"}),e.jsx("p",{className:"text-2xl font-bold text-gray-900",children:D})]})]})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-5 space-y-4",children:[e.jsxs("div",{className:"relative w-full sm:w-72",children:[e.jsx(q,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400"}),e.jsx("input",{value:x,onChange:t=>b(t.target.value),placeholder:"Search by code or email...",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"})]}),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:"Code"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Amount"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Balance"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Status"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Issued To"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Expires"}),e.jsx("th",{className:"text-left py-3 px-2 font-medium text-gray-600",children:"Created"}),e.jsx("th",{className:"py-3 px-2 w-10"})]})}),e.jsx("tbody",{children:p.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"text-center py-10 text-gray-400",children:"No gift cards foun
1d."})}):p.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-mono text-xs font-medium text-violet-700",children:t.code}),e.jsxs("td",{className:"py-3 px-2 font-medium text-gray-900",children:["AED ",t.amount]}),e.jsxs("td",{className:"py-3 px-2 text-gray-700",children:["AED ",t.balance]}),e.jsx("td",{className:"py-3 px-2",children:e.jsx("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium capitalize ${z[t.status]||"bg-gray-100 text-gray-600"}`,children:t.status})}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.issued_to||"—"}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.expires_at||"—"}),e.jsx("td",{className:"py-3 px-2 text-gray-500",children:t.created_at}),e.jsx("td",{className:"py-3 px-2",children:e.jsx("button",{onClick:()=>C(t.id),className:"text-red-400 hover:text-red-600 transition-colors",title:"Delete gift card",children:e.jsx(I,{className:"h-4 w-4"})})})]},t.id))})]})})]}),N&&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:"Create Gift Card"}),e.jsx("button",{onClick:()=>c(!1),className:"text-gray-400 hover:text-gray-600",children:e.jsx(P,{className:"h-5 w-5"})})]}),e.jsxs("form",{onSubmit:w,className:"space-y-4",children:[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:a.amount,onChange:t=>n(s=>({...s,amount:t.target.value})),placeholder:"e.g. 100",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",required:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Quantity"}),e.jsx("input",{type:"number",min:"1",max:"100",value:a.quantity,onChange:t=>n(s=>({...s,quantity:t.target.value})),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:"Expires At"}),e.jsx("input",{type:"date",value:a.expires_at,onChange:t=>n(s=>({...s,expires_at:t.target.value})),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:a.note,onChange:t=>n(s=>({...s,note:t.target.value})),rows:2,placeholder:"Internal note...",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:h,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:[h&&e.jsx(y,{className:"h-4 w-4 animate-spin"}),"Create"]})]})]})]})})]})}export{H 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.