import{C as _}from"./CoachLayout-DmiDPFPr.js";import{a as r,b as i,d,h as v,e as c,f as t,s as p,o as a,F as x,j as u,t as n,n as m,q as h,y as k,p as g}from"./app-DtilF0jd.js";import"./MobileNavigationDrawer-BV2kxNFx.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./DarkModeToggle-wIsj_tj1.js";import"./ImpersonationBanner-BXRKEhdr.js";import"./DropdownLink-Bsw03pEy.js";const C={class:"flex justify-between items-center"},F={class:"py-12"},N={class:"mx-auto max-w-4xl sm:px-6 lg:px-8"},V={class:"bg-white rounded-lg shadow overflow-hidden"},D={class:"min-w-full divide-y divide-gray-200"},L={class:"bg-white divide-y divide-gray-200"},S={class:"px-6 py-4 whitespace-nowrap"},j={class:"font-mono text-sm"},B={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},P={class:"px-6 py-4 whitespace-nowrap text-sm"},E={class:"px-6 py-4 whitespace-nowrap"},H={class:"px-6 py-4 whitespace-nowrap text-sm text-right font-medium"},M={class:"px-6 py-4 whitespace-nowrap text-sm text-right"},T=["href"],z={key:0,class:"p-12 text-center text-gray-500"},I={key:1,class:"px-6 py-4 border-t flex justify-center gap-2"},Q={__name:"Invoices",props:{invoices:Object},setup(o){const y=l=>new Intl.NumberFormat("es-ES",{style:"currency",currency:"USD"}).format(l),f={paid:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400",cancelled:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},b={paid:"Pagado",pending:"Pendiente",cancelled:"Cancelado"},w=l=>route("coach.subscription.invoice.download",l);return(l,s)=>(a(),r(x,null,[i(d(v),{title:"Mis Facturas"}),i(_,null,{header:c(()=>[t("div",C,[s[1]||(s[1]=t("h2",{class:"text-xl font-semibold leading-tight text-gray-800"}," Historial de Facturas ",-1)),i(d(g),{href:l.route("coach.subscription.index"),class:"text-blue-600 hover:text-blue-900"},{default:c(()=>[...s[0]||(s[0]=[h(" ← Volver a Suscripción ",-1)])]),_:1},8,["href"])])]),default:c(()=>[t("div",F,[t("div",N,[t("div",V,[t("table",D,[s[3]||(s[3]=t("thead",{class:"bg-gray-50"},[t("tr",null,[t("th",{class:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase"},"Número"),t("th",{class:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase"},"Fecha"),t("th",{class:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase"},"Plan"),t("th",{class:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase"},"Estado"),t("th",{class:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase"},"Total"),t("th",{class:"px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase"},"Acciones")])],-1)),t("tbody",L,[(a(!0),r(x,null,u(o.invoices.data,e=>(a(),r("tr",{key:e.id},[t("td",S,[t("span",j,n(e.invoice_number),1)]),t("td",B,n(new Date(e.created_at).toLocaleDateString("es-ES")),1),t("td",P,n(e.subscription?.plan?.name||"-"),1),t("td",E,[t("span",{class:m(["px-2 py-1 text-xs font-medium rounded",f[e.status]])},n(b[e.status]),3)]),t("td",H,n(y(e.total)),1),t("td",M,[t("a",{href:w(e.id),class:"inline-flex items-center gap-1 text-blue-600 hover:text-blue-900 dark:text-blue-400 dark:hover:text-blue-300",target:"_blank"},[...s[2]||(s[2]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})],-1),h(" PDF ",-1)])],8,T)])]))),128))])]),o.invoices.data?.length?p("",!0):(a(),r("div",z,[...s[4]||(s[4]=[t("div",{class:"text-6xl mb-4"},"📄",-1),t("p",null,"No tienes facturas registradas.",-1)])])),o.invoices.links&&o.invoices.data?.length?(a(),r("div",I,[(a(!0),r(x,null,u(o.invoices.links,e=>(a(),k(d(g),{key:e.label,href:e.url,class:m(["px-3 py-1 rounded text-sm",e.active?"bg-blue-600 text-white":"bg-gray-100 hover:bg-gray-200",!e.url&&"opacity-50 cursor-not-allowed"]),innerHTML:e.label},null,8,["href","class","innerHTML"]))),128))])):p("",!0)])])])]),_:1})],64))}};export{Q as default};
