1 line
23 KiB
JavaScript
1 line
23 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[137],{9174:function(e,t,s){Promise.resolve().then(s.bind(s,3234))},3234:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return y}});var a=s(7437),l=s(553),n=s(4508),i=s(5675),r=s(8930);function o(e){let{card:t,onEdit:s,onDelete:l}=e,o=(0,n.w7)(t.currentBalance,t.creditLimit),d=(0,n.tk)(t.closingDay),c=(0,n.PW)(t.dueDay),m=(0,n.P8)(d),u=(0,n.P8)(c);return(0,a.jsxs)("div",{className:"relative overflow-hidden rounded-2xl p-6 text-white shadow-lg transition-transform hover:scale-[1.02]",style:{aspectRatio:"1.586",background:"linear-gradient(135deg, ".concat(t.color," 0%, ").concat(function(e,t){let s=e.replace("#",""),a=Math.max(0,Math.min(255,parseInt(s.substring(0,2),16)+-30)),l=Math.max(0,Math.min(255,parseInt(s.substring(2,4),16)+-30)),n=Math.max(0,Math.min(255,parseInt(s.substring(4,6),16)+t));return"#".concat(a.toString(16).padStart(2,"0")).concat(l.toString(16).padStart(2,"0")).concat(n.toString(16).padStart(2,"0"))}(t.color,-30)," 100%)")},children:[(0,a.jsx)("div",{className:"absolute -right-8 -top-8 h-32 w-32 rounded-full bg-white/10"}),(0,a.jsx)("div",{className:"absolute -bottom-12 -left-12 h-40 w-40 rounded-full bg-white/5"}),(0,a.jsxs)("div",{className:"relative flex items-start justify-between",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold tracking-wide",children:t.name}),(0,a.jsxs)("div",{className:"flex gap-1",children:[(0,a.jsx)("button",{onClick:s,className:"rounded-full p-1.5 transition-colors hover:bg-white/20","aria-label":"Editar tarjeta",children:(0,a.jsx)(i.Z,{className:"h-4 w-4"})}),(0,a.jsx)("button",{onClick:l,className:"rounded-full p-1.5 transition-colors hover:bg-white/20","aria-label":"Eliminar tarjeta",children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})]})]}),(0,a.jsx)("div",{className:"relative mt-8",children:(0,a.jsxs)("p",{className:"font-mono text-2xl tracking-widest",children:["**** **** **** ",t.lastFourDigits]})}),(0,a.jsxs)("div",{className:"relative mt-6",children:[(0,a.jsx)("p",{className:"text-sm text-white/70",children:"Balance actual"}),(0,a.jsx)("p",{className:"text-2xl font-bold",children:(0,n.xG)(t.currentBalance)})]}),(0,a.jsxs)("div",{className:"relative mt-4 flex items-center gap-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 rounded-full bg-black/30 px-3 py-1",children:[(0,a.jsx)("div",{className:"h-2 w-2 rounded-full ".concat(o<30?"bg-emerald-500":o<70?"bg-amber-500":"bg-rose-500")}),(0,a.jsxs)("span",{className:"text-sm font-medium ".concat(o<30?"text-emerald-400":o<70?"text-amber-400":"text-rose-400"),children:[o.toFixed(0),"% usado"]})]}),(0,a.jsxs)("span",{className:"text-sm text-white/60",children:["de ",(0,n.xG)(t.creditLimit)]})]}),(0,a.jsxs)("div",{className:"relative mt-4 flex justify-between text-xs text-white/70",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"block",children:"Cierre"}),(0,a.jsxs)("span",{className:"font-medium text-white",children:[t.closingDay," (",0===m?"hoy":m>0?"en ".concat(m," d\xedas"):"hace ".concat(Math.abs(m)," d\xedas"),")"]})]}),(0,a.jsxs)("div",{className:"text-right",children:[(0,a.jsx)("span",{className:"block",children:"Vencimiento"}),(0,a.jsxs)("span",{className:"font-medium text-white",children:[t.dueDay," (",0===u?"hoy":u>0?"en ".concat(u," d\xedas"):"hace ".concat(Math.abs(u)," d\xedas"),")"]})]})]})]})}var d=s(2265),c=s(2489),m=s(401);function u(e){var t,s,l,n,i,r,o;let{initialData:u,onSubmit:x,onCancel:h}=e,[g,b]=(0,d.useState)({name:null!==(t=null==u?void 0:u.name)&&void 0!==t?t:"",lastFourDigits:null!==(s=null==u?void 0:u.lastFourDigits)&&void 0!==s?s:"",closingDay:null!==(l=null==u?void 0:u.closingDay)&&void 0!==l?l:1,dueDay:null!==(n=null==u?void 0:u.dueDay)&&void 0!==n?n:10,currentBalance:null!==(i=null==u?void 0:u.currentBalance)&&void 0!==i?i:0,creditLimit:null!==(r=null==u?void 0:u.creditLimit)&&void 0!==r?r:0,color:null!==(o=null==u?void 0:u.color)&&void 0!==o?o:"#6366f1"}),[p,j]=(0,d.useState)({}),f=()=>{let e={};return g.name.trim()||(e.name="El nombre es requerido"),g.lastFourDigits.trim()?/^\d{4}$/.test(g.lastFourDigits)||(e.lastFourDigits="Debe ser exactamente 4 d\xedgitos num\xe9ricos"):e.lastFourDigits="Los \xfaltimos 4 d\xedgitos son requeridos",(g.closingDay<1||g.closingDay>31)&&(e.closingDay="El d\xeda debe estar entre 1 y 31"),(g.dueDay<1||g.dueDay>31)&&(e.dueDay="El d\xeda debe estar entre 1 y 31"),g.creditLimit<=0&&(e.creditLimit="El l\xedmite de cr\xe9dito debe ser mayor a 0"),g.currentBalance<0&&(e.currentBalance="El balance no puede ser negativo"),j(e),0===Object.keys(e).length},v=(e,t)=>{b(s=>({...s,[e]:t})),p[e]&&j(t=>{let s={...t};return delete s[e],s})},N=e=>{v("lastFourDigits",e.replace(/\D/g,"").slice(0,4))};return(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),f()&&x(g)},className:"space-y-4 rounded-xl bg-slate-800 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:u?"Editar Tarjeta":"Nueva Tarjeta"}),(0,a.jsx)("button",{type:"button",onClick:h,className:"rounded-full p-1 text-slate-400 transition-colors hover:bg-slate-700 hover:text-white",children:(0,a.jsx)(c.Z,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,a.jsxs)("div",{className:"sm:col-span-2",children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Nombre de la tarjeta"}),(0,a.jsx)("input",{type:"text",value:g.name,onChange:e=>v("name",e.target.value),placeholder:"Ej: Visa Banco Galicia",className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.name&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"\xdaltimos 4 d\xedgitos"}),(0,a.jsx)("input",{type:"text",inputMode:"numeric",value:g.lastFourDigits,onChange:e=>N(e.target.value),placeholder:"1234",maxLength:4,className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.lastFourDigits&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.lastFourDigits})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Color"}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("input",{type:"color",value:g.color,onChange:e=>v("color",e.target.value),className:"h-10 w-20 cursor-pointer rounded-lg border border-slate-600 bg-slate-700"}),(0,a.jsx)("span",{className:"text-sm text-slate-400",children:g.color})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"D\xeda de cierre"}),(0,a.jsx)("input",{type:"number",min:1,max:31,value:g.closingDay,onChange:e=>v("closingDay",parseInt(e.target.value)||1),className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.closingDay&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.closingDay})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"D\xeda de vencimiento"}),(0,a.jsx)("input",{type:"number",min:1,max:31,value:g.dueDay,onChange:e=>v("dueDay",parseInt(e.target.value)||1),className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.dueDay&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.dueDay})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"L\xedmite de cr\xe9dito"}),(0,a.jsx)("input",{type:"number",min:0,step:"0.01",value:g.creditLimit||"",onChange:e=>v("creditLimit",parseFloat(e.target.value)||0),placeholder:"0.00",className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.creditLimit&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.creditLimit})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Balance actual"}),(0,a.jsx)("input",{type:"number",min:0,step:"0.01",value:g.currentBalance||"",onChange:e=>v("currentBalance",parseFloat(e.target.value)||0),placeholder:"0.00",className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),p.currentBalance&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:p.currentBalance})]})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,a.jsx)("button",{type:"button",onClick:h,className:"rounded-lg border border-slate-600 px-4 py-2 text-sm font-medium text-slate-300 transition-colors hover:bg-slate-700",children:"Cancelar"}),(0,a.jsxs)("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-indigo-700",children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),u?"Guardar cambios":"Crear tarjeta"]})]})]})}function x(e){var t,s;let{cardId:l,onSubmit:n,onCancel:i}=e,r=new Date().toISOString().split("T")[0],[o,u]=(0,d.useState)({description:"",amount:0,date:r,installments:void 0}),[x,h]=(0,d.useState)(!1),[g,b]=(0,d.useState)({}),p=()=>{let e={};return o.description.trim()||(e.description="La descripci\xf3n es requerida"),o.amount<=0&&(e.amount="El monto debe ser mayor a 0"),o.date||(e.date="La fecha es requerida"),x&&o.installments&&(o.installments.current<1&&(e.installmentCurrent="La cuota actual debe ser al menos 1"),o.installments.total<2&&(e.installmentTotal="El total de cuotas debe ser al menos 2"),o.installments.current>o.installments.total&&(e.installments="La cuota actual no puede ser mayor al total")),b(e),0===Object.keys(e).length},j=(e,t)=>{u(s=>({...s,[e]:t})),g[e]&&b(t=>{let s={...t};return delete s[e],s})},f=(e,t)=>{u(s=>{var a,l,n,i;return{...s,installments:{current:"current"===e?t:null!==(n=null===(a=s.installments)||void 0===a?void 0:a.current)&&void 0!==n?n:1,total:"total"===e?t:null!==(i=null===(l=s.installments)||void 0===l?void 0:l.total)&&void 0!==i?i:1}}}),b(t=>{let s={...t};return delete s["installment".concat(e.charAt(0).toUpperCase()+e.slice(1))],delete s.installments,s})};return(0,a.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p()&&n({...o,installments:x?o.installments:void 0})},className:"space-y-4 rounded-xl bg-slate-800 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Registrar Pago"}),(0,a.jsx)("button",{type:"button",onClick:i,className:"rounded-full p-1 text-slate-400 transition-colors hover:bg-slate-700 hover:text-white",children:(0,a.jsx)(c.Z,{className:"h-5 w-5"})})]}),(0,a.jsxs)("div",{className:"grid gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Descripci\xf3n"}),(0,a.jsx)("input",{type:"text",value:o.description,onChange:e=>j("description",e.target.value),placeholder:"Ej: Supermercado Coto",className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),g.description&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:g.description})]}),(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Monto"}),(0,a.jsx)("input",{type:"number",min:0,step:"0.01",value:o.amount||"",onChange:e=>j("amount",parseFloat(e.target.value)||0),placeholder:"0.00",className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white placeholder-slate-400 focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),g.amount&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:g.amount})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Fecha"}),(0,a.jsx)("input",{type:"date",value:o.date,onChange:e=>j("date",e.target.value),className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),g.date&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:g.date})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-slate-700 bg-slate-700/50 p-3",children:[(0,a.jsx)("input",{type:"checkbox",id:"hasInstallments",checked:x,onChange:e=>{h(e.target.checked),e.target.checked?u(e=>({...e,installments:{current:1,total:1}})):u(e=>({...e,installments:void 0}))},className:"h-4 w-4 rounded border-slate-500 bg-slate-600 text-indigo-600 focus:ring-indigo-500"}),(0,a.jsx)("label",{htmlFor:"hasInstallments",className:"text-sm font-medium text-slate-300",children:"Este pago es en cuotas"})]}),x&&(0,a.jsxs)("div",{className:"grid gap-4 sm:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Cuota actual"}),(0,a.jsx)("input",{type:"number",min:1,value:(null===(t=o.installments)||void 0===t?void 0:t.current)||"",onChange:e=>f("current",parseInt(e.target.value)||1),className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),g.installmentCurrent&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:g.installmentCurrent})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1 block text-sm font-medium text-slate-300",children:"Total de cuotas"}),(0,a.jsx)("input",{type:"number",min:2,value:(null===(s=o.installments)||void 0===s?void 0:s.total)||"",onChange:e=>f("total",parseInt(e.target.value)||2),className:"w-full rounded-lg border border-slate-600 bg-slate-700 px-4 py-2 text-white focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/20"}),g.installmentTotal&&(0,a.jsx)("p",{className:"mt-1 text-sm text-rose-400",children:g.installmentTotal})]})]}),g.installments&&(0,a.jsx)("p",{className:"text-sm text-rose-400",children:g.installments})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-3 pt-4",children:[(0,a.jsx)("button",{type:"button",onClick:i,className:"rounded-lg border border-slate-600 px-4 py-2 text-sm font-medium text-slate-300 transition-colors hover:bg-slate-700",children:"Cancelar"}),(0,a.jsxs)("button",{type:"submit",className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-indigo-700",children:[(0,a.jsx)(m.Z,{className:"h-4 w-4"}),"Registrar pago"]})]})]})}function h(e){let{card:t,selected:s=!1,onClick:l}=e;return(0,a.jsxs)("button",{type:"button",onClick:l,className:"flex w-full items-center gap-3 rounded-lg border p-3 text-left transition-all ".concat(s?"border-indigo-500 bg-indigo-500/20 ring-2 ring-indigo-500/30":"border-slate-600 bg-slate-800 hover:border-slate-500 hover:bg-slate-700"),children:[(0,a.jsx)("div",{className:"h-10 w-10 shrink-0 rounded-lg shadow-inner",style:{backgroundColor:t.color}}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"truncate font-medium text-white",children:t.name}),(0,a.jsxs)("p",{className:"text-sm text-slate-400",children:["**** ",t.lastFourDigits]})]}),s&&(0,a.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-indigo-500",children:(0,a.jsx)(m.Z,{className:"h-4 w-4 text-white"})})]})}var g=s(4835),b=s(8226),p=s(9397);let j=(0,s(8755).Z)("receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);function f(){let{creditCards:e,cardPayments:t,currentMonth:s,currentYear:l,addCreditCard:i,updateCreditCard:c,deleteCreditCard:m,addCardPayment:f,deleteCardPayment:v}=(0,g.J)(),[N,y]=(0,d.useState)(!1),[w,k]=(0,d.useState)(null),[C,D]=(0,d.useState)(""),[S,E]=(0,d.useState)(!1),M=(0,d.useMemo)(()=>t.filter(e=>{let t=new Date(e.date);return t.getMonth()+1===s&&t.getFullYear()===l}),[t,s,l]),F=e=>{k(e),y(!0)},Z=e=>{window.confirm("\xbfEst\xe1s seguro de que deseas eliminar esta tarjeta?")&&(m(e),C===e&&(D(""),E(!1)))},L=e=>{window.confirm("\xbfEst\xe1s seguro de que deseas eliminar este pago?")&&v(e)},I=t=>e.find(e=>e.id===t),B=e=>M.filter(t=>t.cardId===e).reduce((e,t)=>e+t.amount,0);return(0,a.jsxs)("div",{className:"space-y-8",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-indigo-500/20",children:(0,a.jsx)(b.Z,{className:"h-5 w-5 text-indigo-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-xl font-semibold text-white",children:"Tarjetas de Cr\xe9dito"}),(0,a.jsxs)("p",{className:"text-sm text-slate-400",children:[(0,n.ZY)(s)," ",l]})]})]}),(0,a.jsxs)("button",{onClick:()=>{k(null),y(!0)},className:"flex items-center gap-2 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-indigo-700",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4"}),"Agregar tarjeta"]})]}),0===e.length?(0,a.jsxs)("div",{className:"rounded-xl border border-dashed border-slate-600 bg-slate-800/50 p-12 text-center",children:[(0,a.jsx)(b.Z,{className:"mx-auto h-12 w-12 text-slate-500"}),(0,a.jsx)("h3",{className:"mt-4 text-lg font-medium text-slate-300",children:"No tienes tarjetas registradas"}),(0,a.jsx)("p",{className:"mt-1 text-sm text-slate-400",children:"Agrega tu primera tarjeta para comenzar a gestionar tus pagos"}),(0,a.jsx)("button",{onClick:()=>{k(null),y(!0)},className:"mt-4 rounded-lg bg-indigo-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-indigo-700",children:"Agregar tarjeta"})]}):(0,a.jsx)("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,a.jsx)(o,{card:e,onEdit:()=>F(e),onDelete:()=>Z(e.id)},e.id))}),N&&(0,a.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",children:(0,a.jsx)("div",{className:"w-full max-w-lg",children:(0,a.jsx)(u,{initialData:null!=w?w:void 0,onSubmit:e=>{w?(c(w.id,e),k(null)):i(e),y(!1)},onCancel:()=>{y(!1),k(null)}})})}),e.length>0&&(0,a.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,a.jsxs)("div",{className:"rounded-xl bg-slate-800 p-6",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-emerald-500/20",children:(0,a.jsx)(j,{className:"h-4 w-4 text-emerald-400"})}),(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Registrar Pago"})]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"mb-2 block text-sm font-medium text-slate-300",children:"Seleccionar tarjeta"}),(0,a.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:e.map(e=>(0,a.jsx)(h,{card:e,selected:C===e.id,onClick:()=>{D(e.id),E(!0)}},e.id))})]}),S&&C&&(0,a.jsx)(x,{cardId:C,onSubmit:e=>{f({cardId:C,...e}),E(!1)},onCancel:()=>{E(!1),D("")}})]}),(0,a.jsxs)("div",{className:"rounded-xl bg-slate-800 p-6",children:[(0,a.jsxs)("div",{className:"mb-4 flex items-center gap-3",children:[(0,a.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-amber-500/20",children:(0,a.jsx)(j,{className:"h-4 w-4 text-amber-400"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-white",children:"Pagos del Mes"}),(0,a.jsxs)("p",{className:"text-sm text-slate-400",children:["Total: ",(0,n.xG)(M.reduce((e,t)=>e+t.amount,0))]})]})]}),0===M.length?(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-slate-600 p-8 text-center",children:(0,a.jsx)("p",{className:"text-sm text-slate-400",children:"No hay pagos registrados este mes"})}):(0,a.jsx)("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:M.sort((e,t)=>new Date(t.date).getTime()-new Date(e.date).getTime()).map(e=>{let t=I(e.cardId);return(0,a.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-slate-700 bg-slate-700/50 p-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t&&(0,a.jsx)("div",{className:"h-8 w-8 shrink-0 rounded-md",style:{backgroundColor:t.color}}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"truncate font-medium text-white",children:e.description}),(0,a.jsxs)("p",{className:"text-xs text-slate-400",children:[null==t?void 0:t.name," • ",(0,n.iS)(e.date),e.installments&&(0,a.jsxs)("span",{className:"ml-2 text-amber-400",children:["Cuota ",e.installments.current,"/",e.installments.total]})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"font-semibold text-white",children:(0,n.xG)(e.amount)}),(0,a.jsx)("button",{onClick:()=>L(e.id),className:"rounded p-1 text-slate-400 transition-colors hover:bg-rose-500/20 hover:text-rose-400","aria-label":"Eliminar pago",children:(0,a.jsx)(r.Z,{className:"h-4 w-4"})})]})]},e.id)})}),M.length>0&&(0,a.jsxs)("div",{className:"mt-6 border-t border-slate-700 pt-4",children:[(0,a.jsx)("h4",{className:"mb-3 text-sm font-medium text-slate-300",children:"Resumen por tarjeta"}),(0,a.jsx)("div",{className:"space-y-2",children:e.map(e=>{let t=B(e.id);return 0===t?null:(0,a.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:e.color}}),(0,a.jsx)("span",{className:"text-slate-300",children:e.name})]}),(0,a.jsx)("span",{className:"font-medium text-white",children:(0,n.xG)(t)})]},e.id)})})]})]})]})]})}var v=s(9294),N=s(3263);function y(){let{isOpen:e,toggle:t,close:s}=(0,v.A)(),{unreadCount:n}=(0,N.Z7)();return(0,a.jsxs)("div",{className:"min-h-screen bg-slate-950",children:[(0,a.jsx)(l.YE,{isOpen:e,onClose:s,unreadAlertsCount:n}),(0,a.jsxs)("div",{className:"lg:ml-64 min-h-screen flex flex-col",children:[(0,a.jsx)(l.h4,{onMenuClick:t,title:"Tarjetas de Cr\xe9dito"}),(0,a.jsx)("main",{className:"flex-1 p-4 md:p-6 lg:p-8 pb-20",children:(0,a.jsx)(f,{})})]}),(0,a.jsx)(l.zM,{unreadAlertsCount:n})]})}},5675:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(8755).Z)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},9397:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(8755).Z)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])}},function(e){e.O(0,[697,71,796,489,971,117,744],function(){return e(e.s=9174)}),_N_E=e.O()}]); |