PageSourceSearch

https://bbcc.ai/build/assets/CouponUsageList-Cd8gL-Qt.js

js bbcc.ai collected 2026-10-05 12:12:50 UTC 18,441 bytes, 21 lines download raw bytes

1import{r as o,j as e,H as Q,L as m,b as N}from"./app-DP13319Q.js";import{F as s,a8 as Z,a9 as ee,aa as te,a as se,f as ae,e as L,h as re,ab as h,ac as oe,a2 as le,ad as ne,ae as ie,af as ce,ag as de,b as T,k as I,R as xe}from"./index-CtyZ6W6U.js";import{D as pe}from"./DraggableMenu-Bk7Spryo.js";import{A as me}from"./app-logo-icon-B_rIw4ab.js";import{c as ue}from"./cjs-G0qneMx2.js";import{M as D}from"./react-tooltip.min-DW3XhwOj.js";/* empty css            */import"./index-DQkUn08L.js";import"./clsx-B-dksMZM.js";function ke({auth:v,usages:$,filters:z,pagination:R,coupons:B=[],template:ge,totalSaved:w}){const[i,f]=o.useState($),[a,_]=o.useState(R),[n,H]=o.useState(z),[c,u]=o.useState(!1),[S,d]=o.useState(""),[C,he]=o.useState(""),[O,fe]=o.useState(!0),[F,k]=o.useState(""),[W,A]=o.useState(!1),[l,G]=o.useState({total_usages:0,total_saved:0,usages_by_month:[],most_used_coupons:[]}),[ye,M]=o.useState(!1),[y,E]=o.useState(!1),U=o.useRef(null),b=async()=>{M(!0);try{const t=await N.get(route("my-coupons.statistics"));G(t.data),A(!0)}catch(t){console.error("Error fetching statistics:",t),d("Failed to load statistics"),setTimeout(()=>d(""),3e3)}finally{M(!1)}},x=async t=>{u(!0);try{const r=await N.get(route("my-coupons.list"),{params:{...t,page:t.page||1}});t.page&&t.page>1?f([...i,...r.data.usages]):f(r.data.usages),_(r.data.pagination),H(t)}catch(r){console.error("Error fetching coupon usages:",r),d("Failed to load coupon usage data. Please try again."),setTimeout(()=>d(""),3e3)}finally{u(!1)}},V=async()=>{if(!(c||a.current_page>=a.last_page)){u(!0);try{const t=await N.get(route("my-coupons.list"),{params:{...n,page:a.current_page+1}});f([...i,...t.data.usages]),_(t.data.pagination)}catch(t){console.error("Error loading more usages:",t),d("Failed to load more data. Please try again."),setTimeout(()=>d(""),3e3)}finally{u(!1)}}},P=()=>{const t={...n,search:F,page:1};x(t)},j=(t,r)=>{const p={...n,[t]:r,page:1};x(p)},Y=()=>{k(""),x({page:1}),E(!1)},K=t=>({percentage:"bg-purple-500/20 text-purple-400 border border-purple-500",fixed:"bg-blue-500/20 text-blue-400 border border-blue-500"})[t]||"bg-gray-500/20 text-gray-400 border border-gray-500",X=t=>t?new Date(t).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"Never",q=t=>{const[r,p]=t.split("-");return new Date(parseInt(r),parseInt(p)-1).toLocaleDateString("en-US",{month:"long",year:"numeric"})};return e.jsxs(e.Fragment,{children:[e.jsxs(Q,{children:[e.jsx("title",{children:"My Coupon Usage - Account Dashboard"}),e.jsx("meta",{name:"description",content:"View your coupon usage history and track your savings"}),e.jsx("style",{children:`
2                    .react-tooltip {
3                        z-index: 99999 !important;
4                        opacity: 1 !important;
5                        font-size: 12px;
6                        padding: 4px 8px;
7                    }
8                    .stats-modal {
9                        animation: slideUp 0.3s ease-out;
10                    }
11                    @keyframes slideUp {
12                        from {
13                            opacity: 0;
14                            transform: translateY(20px);
15                        }
16                        to {
17                            opacity: 1;
18                            transform: translateY(0);
19                        }
20                    }
21                `})]}),e.jsx(D,{id:"nav-tooltip"}),e.jsx(D,{id:"action-tooltip"}),v.user?e.jsx(pe,{auth:v}):e.jsx(ue,{nodeRef:U,bounds:"parent",cancel:".no-drag",defaultPosition:{x:window.innerWidth-650,y:0},children:e.jsx("div",{ref:U,className:"space-x-4 z-10 absolute mt-5 cursor-move touch-none",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(m,{href:route("home"),className:"flex items-center px-2 py-0 rounded-full bg-[#235A72] no-drag transition-colors duration-300 hover:bg-[#1C4A5E]","data-tooltip-id":"nav-tooltip","data-tooltip-content":"Go to Homepage",children:[e.jsx(me,{className:"size-8 fill-current text-[#8EF587]"}),e.jsx("span",{className:"ml-2 text-[#8EF587]",children:"ez.wiki"})]}),e.jsx(m,{href:route("demodesign"),className:"group no-drag","data-tooltip-id":"nav-tooltip","data-tooltip-content":"Rent and Own a Branded Staging Portal",children:e.jsxs("span",{className:"flex items-center gap-2 bg-orange-500 text-white font-medium py-2 px-4 roun
21ded-full transition-all duration-300 hover:bg-orange-600 cursor-pointer",children:[e.jsx(s,{icon:Z,className:"text-white"}),e.jsx("span",{className:"hidden group-hover:inline",children:"EXPRESS DOMAIN"})]})}),e.jsx(m,{href:route("login"),className:"group no-drag","data-tooltip-id":"nav-tooltip","data-tooltip-content":"Sign in to your account",children:e.jsxs("span",{className:"flex items-center gap-2 bg-[#235A72] text-[#8EF587] font-medium py-2 px-4 rounded-full transition-all duration-300 hover:bg-[#1C4A5E] cursor-pointer",children:[e.jsx(s,{icon:ee,className:"text-[#8EF587]"}),e.jsx("span",{className:"hidden group-hover:inline",children:"SIGN IN"})]})}),e.jsx(m,{href:route("register"),className:"group no-drag","data-tooltip-id":"nav-tooltip","data-tooltip-content":"Create a new account",children:e.jsxs("span",{className:"flex items-center gap-2 bg-[#235A72] text-[#8EF587] font-medium py-2 px-4 rounded-full transition-all duration-300 hover:bg-[#1C4A5E] cursor-pointer",children:[e.jsx(s,{icon:te,className:"text-[#8EF587]"}),e.jsx("span",{className:"hidden group-hover:inline",children:"SIGN UP"})]})})]})})}),e.jsxs("main",{className:"relative flex justify-end p-4 min-h-screen overflow-hidden",children:[S&&e.jsxs("div",{className:"fixed top-20 right-4 bg-red-600 text-white px-4 py-2 rounded-md shadow-lg z-50 flex items-center",children:[e.jsx(s,{icon:se,className:"mr-2"}),S]}),C&&e.jsxs("div",{className:"fixed top-20 right-4 bg-green-600 text-white px-4 py-2 rounded-md shadow-lg z-50 flex items-center",children:[e.jsx(s,{icon:ae,className:"mr-2"}),C]}),W&&e.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[100] p-4 overflow-y-auto",children:e.jsxs("div",{className:"bg-[#235A72] border border-[#3a7a94] text-white p-6 rounded-lg shadow-lg max-w-4xl w-full max-h-[85vh] overflow-y-auto stats-modal",children:[e.jsxs("div",{className:"flex justify-between items-start mb-6",children:[e.jsxs("h3",{className:"text-2xl font-bold text-yellow-400 flex items-center",children:[e.jsx(s,{icon:L,className:"mr-3"}),"My Coupon Statistics"]}),e.jsx("button",{onClick:()=>A(!1),className:"text-gray-400 hover:text-white transition-colors",children:e.jsx(s,{icon:re,className:"text-xl"})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[e.jsxs("div",{className:"bg-gradient-to-br from-purple-500/30 to-purple-600/20 rounded-xl p-6 border border-purple-500/50 text-center",children:[e.jsx(s,{icon:h,className:"text-4xl text-purple-400 mb-3"}),e.jsx("p",{className:"text-gray-300 text-sm",children:"Total Coupons Used"}),e.jsx("p",{className:"text-3xl font-bold text-white",children:l.total_usages})]}),e.jsxs("div",{className:"bg-gradient-to-br from-green-500/30 to-green-600/20 rounded-xl p-6 border border-green-500/50 text-center",children:[e.jsx(s,{icon:oe,className:"text-4xl text-green-400 mb-3"}),e.jsx("p",{className:"text-gray-300 text-sm",children:"Total Money Saved"}),e.jsxs("p",{className:"text-3xl font-bold text-green-400",children:["$",l.total_saved]})]}),e.jsxs("div",{className:"bg-gradient-to-br from-blue-500/30 to-blue-600/20 rounded-xl p-6 border border-blue-500/50 text-center",children:[e.jsx(s,{icon:le,className:"text-4xl text-blue-400 mb-3"}),e.jsx("p",{className:"text-gray-300 text-sm",children:"Average Savings per Coupon"}),e.jsxs("p",{className:"text-3xl font-bold text-blue-400",children:["$",l.total_usages>0?(l.total_saved/l.total_usages).toFixed(2):"0"]})]})]}),l.usages_by_month.length>0&&e.jsxs("div",{className:"bg-[#1a3a4a] rounded-xl p-6 mb-6",children:[e.jsxs("h4",{className:"text-lg font-semibold text-yellow-400 mb-4 flex items-center",children:[e.jsx(s,{icon:ne,className:"mr-2"}),"Monthly Usage (Last 12 Months)"]}),e.jsx("div",{className:"space-y-3",children:l.usages_by_month.map((t,r)=>{const p=Math.max(...l.usages_by_month.map(J=>J.count),1),g=t.count/p*100;return e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"w-32 text-sm text-gray-300",children:q(t.month)}),e.jsx("div",{className:"flex-1 bg-gray-700 rounded-full h-8 overflow-hidden",children:e.jsx("div",{className:"bg-gradient-to-r from-yellow-500 to-yellow-600 h-full rounded-full flex items-center justify-end px-3 text-sm font-semibold text-gray-900 transition-all duration-500",style:{width:`${g}%`},children:g>15&&`${t.count} uses`})}),g<=15&&e.jsxs("div",{className:"text-sm text-gray-400 w-16",children:[t.count," uses"]})]},r)})})]}),l.most_used_coupons.length>0&&e.jsxs("div",{className:"bg-[#1a3a4a] rounded-xl p-6",children:[e.jsxs("h4",{className:"text-lg font-semibold text-yellow-400 mb-4 flex items-center",children:[e.jsx(s,{icon:ie,className:"mr-2"}),"My Most Used Coupons"]}),e.jsx("div",{className:"space-y-3",children:l.most_used_coupons.map((t,r)=>e.jsxs("div",{className:"flex items-center justify-between p-3 bg-[#235A72]/50 rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-8 h-8 bg-yellow-500/20 rounded-full flex items-center justify-center",children:e.jsx("span",{className:"text-yellow-400 font-bold",children:r+1})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-yellow-400",children:t.coupon_code}),e.jsxs("p",{className:"text-xs text-gray-400",children:["Used ",t.usage_count," times"]})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-400",children:t.usage_count}),e.jsx("div",{className:"text-sm text-gray-400",children:"uses"})]})]},r))})]})]})}),O&&e.jsx("div",{className:"relative bg-gray-900 mx-auto bottom-4 z-50 backdrop-blur-sm p-4 rounded-xl border border-white-700 overflow-y-auto shadow-2xl w-full max-w-7xl mt-20",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsxs("h1",{className:"text-3xl font-bold text-white flex items-center justify-center gap-3",children:[e.jsx(s,{icon:h,className:"text-yellow-400"}),"My Coupon Usage History"]}),e.jsx("p",{className:"text-gray-400 mt-2",children:"Track all your coupon redemptions and see how much you've saved"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsx("div",{className:"bg-gradient-to-br from-purple-500/20 to-purple-600/10 rounded-xl p-4 border border-purple-500/30 cursor-pointer hover:scale-105 transition-transform",onClick:b,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"Total Usages"}),e.jsx("p",{className:"text-2xl font-bold text-white",children:a.total})]}),e.jsx(s,{icon:h,className:"text-3xl text-purple-400 opacity-50"})]})}),e.jsx("div",{className:"bg-gradient-to-br from-green-500/20 to-green-600/10 rounded-xl p-4 border border-green-500/30 cursor-pointer hover:scale-105 transition-transform",onClick:b,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"Total Saved"}),e.jsxs("p",{className:"text-2xl font-bold text-green-400",children:["$",w]})]}),e.jsx(s,{icon:ce,className:"text-3xl text-green-400 opacity-50"})]})}),e.jsx("div",{className:"bg-gradient-to-br from-yellow-500/20 to-yellow-600/10 rounded-xl p-4 border border-yellow-500/30 cursor-pointer hover:scale-105 transition-transform",onClick:b,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-gray-400 text-sm",children:"Avg Savings"}),e.jsxs("p",{className:"text-2xl font-bold text-yellow-400",children:["$",a.total>0?(w/a.total).toFixed(2):"0"]})]}),e.jsx(s,{icon:L,className:"text-3xl text-yellow-400 opacity-50"})]})})]}),e.jsxs("div",{className:"bg-[#235A72]/50 rounded-xl p-4 border border-[#3a7
21a94]",children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsxs("button",{onClick:()=>E(!y),className:"px-4 py-2 bg-[#1a3a4a] text-white rounded-lg hover:bg-[#2a4a5a] transition-colors flex items-center gap-2",children:[e.jsx(s,{icon:de}),y?"Hide Filters":"Show Filters"]}),(n.search||n.coupon_code||n.date_from||n.date_to)&&e.jsx("button",{onClick:Y,className:"px-4 py-2 bg-red-500/20 text-red-400 rounded-lg hover:bg-red-500/30 transition-colors",children:"Clear All Filters"})]}),y&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx(s,{icon:T,className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search by coupon code...",value:F,onChange:t=>k(t.target.value),onKeyPress:t=>t.key==="Enter"&&P(),className:"w-full pl-10 pr-4 py-2 bg-[#1a3a4a] text-white rounded-lg border border-[#3a7a94] focus:outline-none focus:ring-2 focus:ring-yellow-400"})]}),e.jsx("div",{children:e.jsx("input",{type:"date",placeholder:"Date From",onChange:t=>j("date_from",t.target.value),className:"w-full px-4 py-2 bg-[#1a3a4a] text-white rounded-lg border border-[#3a7a94] focus:outline-none focus:ring-2 focus:ring-yellow-400"})}),e.jsx("div",{children:e.jsx("input",{type:"date",placeholder:"Date To",onChange:t=>j("date_to",t.target.value),className:"w-full px-4 py-2 bg-[#1a3a4a] text-white rounded-lg border border-[#3a7a94] focus:outline-none focus:ring-2 focus:ring-yellow-400"})}),e.jsx("div",{children:e.jsxs("select",{onChange:t=>j("coupon_code",t.target.value),className:"w-full px-4 py-2 bg-[#1a3a4a] text-white rounded-lg border border-[#3a7a94] focus:outline-none focus:ring-2 focus:ring-yellow-400",children:[e.jsx("option",{value:"",children:"All Coupons"}),B.map(t=>e.jsxs("option",{value:t.coupon,children:[t.title," (",t.coupon,")"]},t.id))]})})]}),e.jsx("div",{className:"mt-3 flex justify-end",children:e.jsxs("button",{onClick:P,className:"px-6 py-2 bg-yellow-500 text-gray-900 rounded-lg hover:bg-yellow-400 transition-colors flex items-center gap-2",children:[e.jsx(s,{icon:T}),"Search"]})})]}),e.jsxs("div",{className:"bg-[#235A72]/30 rounded-xl border border-[#3a7a94] overflow-hidden",children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{className:"bg-[#1a3a4a] border-b border-[#3a7a94]",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider",children:"ID"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider",children:"Coupon Code"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider",children:"Used At"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider",children:"Type"}),e.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-300 uppercase tracking-wider",children:"Savings"})]})}),e.jsx("tbody",{className:"divide-y divide-[#3a7a94]/50",children:c&&i.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center",children:[e.jsx(s,{icon:I,className:"animate-spin text-2xl text-yellow-400"}),e.jsx("p",{className:"text-gray-400 mt-2",children:"Loading coupon usages..."})]})}):i.length===0?e.jsx("tr",{children:e.jsxs("td",{colSpan:5,className:"px-6 py-12 text-center",children:[e.jsx(s,{icon:h,className:"text-4xl mb-2 opacity-50"}),e.jsx("p",{className:"text-gray-400",children:"No coupon usage records found"}),e.jsx(m,{href:route("home"),className:"inline-block mt-4 px-6 py-2 bg-yellow-500 text-gray-900 rounded-lg hover:bg-yellow-400 transition-colors",children:"Browse Coupons"})]})}):i.map(t=>e.jsxs("tr",{className:"hover:bg-[#1a3a4a]/50 transition-colors",children:[e.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-300",children:["#",t.id]}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:e.jsx("span",{className:"px-2 py-1 bg-yellow-500/20 text-yellow-400 rounded-md text-sm font-mono",children:t.coupon_code})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-300",children:X(t.used_at)}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.coupon&&e.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${K(t.coupon.type)}`,children:t.coupon.type==="percentage"?"Percentage":"Fixed"})}),e.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:t.coupon&&e.jsx("span",{className:"text-green-400 font-semibold",children:t.coupon.type==="percentage"?`${t.coupon.offer}
21% OFF`:`$${t.coupon.offer} OFF`})})]},t.id))})]})}),a.last_page>1&&e.jsxs("div",{className:"px-6 py-4 border-t border-[#3a7a94] flex justify-between items-center",children:[e.jsxs("div",{className:"text-sm text-gray-400",children:["Showing ",i.length," of ",a.total," records"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{onClick:()=>{a.current_page>1&&x({...n,page:a.current_page-1})},disabled:a.current_page===1||c,className:"px-4 py-2 bg-[#1a3a4a] text-white rounded-lg hover:bg-[#2a4a5a] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Previous"}),e.jsxs("span",{className:"px-4 py-2 bg-yellow-500 text-gray-900 rounded-lg font-semibold",children:["Page ",a.current_page," of ",a.last_page]}),e.jsx("button",{onClick:()=>{a.current_page<a.last_page&&x({...n,page:a.current_page+1})},disabled:a.current_page===a.last_page||c,className:"px-4 py-2 bg-[#1a3a4a] text-white rounded-lg hover:bg-[#2a4a5a] disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:"Next"})]})]})]}),a.current_page<a.last_page&&e.jsx("div",{className:"text-center",children:e.jsx("button",{onClick:V,disabled:c,className:"px-6 py-3 bg-[#235A72] text-white rounded-lg hover:bg-[#2a6b87] transition-colors flex items-center gap-2 mx-auto disabled:opacity-50",children:c?e.jsxs(e.Fragment,{children:[e.jsx(s,{icon:I,className:"animate-spin"}),"Loading..."]}):e.jsxs(e.Fragment,{children:[e.jsx(s,{icon:xe}),"Load More Records"]})})})]})})]})]})}export{ke 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.