1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3670],{33670:(e,r,t)=>{t.d(r,{L:()=>u});var o=t(54568),a=t(7620),n=t(5530),s=t(88985),l=t(88919),i=t(93558),d=t(55336),c=t(79560),p=t(78036);function u(e){let{isOpen:r,onClose:t,sources:u,defaultDate:g,onSuccess:x}=e,[y,b]=(0,a.useState)(""),[v,h]=(0,a.useState)(""),[m,f]=(0,a.useState)(""),[w,S]=(0,a.useState)("paycheck"),[j,C]=(0,a.useState)(""),[k,T]=(0,a.useState)(""),[E,F]=(0,a.useState)(""),[L,R]=(0,a.useState)(!1),{symbol:B}=(0,p.H)(),I="other"===v;(0,a.useEffect)(()=>{r&&(b(""),h(u.length>0?u[0].id:""),f(""),S("paycheck"),C(g||(()=>{let e=new Date;return"".concat(e.getFullYear(),"-").concat(String(e.getMonth()+1).padStart(2,"0"),"-").concat(String(e.getDate()).padStart(2,"0"))})()),T(""),F(""))},[r,g,u]);let W=async()=>{if(!y||0>=parseFloat(y))return void i.oR.error("Please enter a valid amount");if(!v)return void i.oR.error("Please select an income source");if(I&&!m.trim())return void i.oR.error("Please describe this income");if("tips"===w&&(!E||0>=parseFloat(E)))return void i.oR.error("Please enter hours worked for tips");R(!0);try{let e=k?"".concat(w,": ").concat(k):"".concat(w,": Income logged");await l.W.createLog({source_id:I?null:v,other_source_description:I?m.trim():void 0,amount:parseFloat(y),date:j,notes:e,hours_worked:"tips"===w&&E?parseFloat(E):void 0}),i.oR.success("Income logged successfully"),(0,d.A)(),x()}catch(e){i.oR.error("Failed to save income log")}finally{R(!1)}};(0,a.useEffect)(()=>{let e=e=>{"Escape"===e.key&&r&&t()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[r,t]),(0,a.useEffect)(()=>(r?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[r]);let z="tips"===w&&y&&E&&parseFloat(E)>0?(parseFloat(y)/parseFloat(E)).toFixed(2):null,M={display:"block",fontSize:"0.75rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:"var(--muted-foreground)",marginBottom:"8px"},_={width:"100%",padding:"12px 16px",backgroundColor:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"12px",color:"var(--foreground)",fontSize:"1rem",outline:"none",transition:"border-color 0.15s ease, box-shadow 0.15s ease"},A={..._,appearance:"none",backgroundImage:"url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E\")",backgroundRepeat:"no-repeat",backgroundPosition:"right 12px center",backgroundSize:"20px",paddingRight:"44px"},D={backgroundColor:"var(--bg-card, var(--card))",color:"var(--foreground)",padding:"12px"},P=u.filter(e=>e.is_active);return(0,o.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:100,padding:"16px",transition:"opacity 0.2s ease",opacity:+!!r,pointerEvents:r?"auto":"none"},onClick:t,children:(0,o.jsxs)("div",{style:{backgroundColor:"var(--bg-card, var(--card))",borderRadius:"16px",border:"1px solid var(--border)",boxShadow:"0 24px 48px rgba(0, 0, 0, 0.3)",maxWidth:"480px",width:"100%",maxHeight:"90vh",overflow:"auto",transform:r?"scale(1)":"scale(0.95)",transition:"transform 0.25s cubic-bezier(0.16, 1, 0.3, 1)"},onClick:e=>e.stopPropagation(),children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:"1px solid var(--border)"},children:[(0,o.jsx)("h2",{style:{fontFamily:"var(--font-display), -apple-system, sans-serif",fontSize:"1.25rem",fontWeight:600,color:"var(--foreground)"},children:"Log Income"}),(0,o.jsx)("button",{onClick:t,style:{width:"36px",height:"36px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"10px",backgroundColor:"transparent",border:"1px solid var(--border)",cursor:"pointer",color:"var(--muted-foreground)",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--bg-elevated)",e.currentTarget.style.borderColor="var(--success)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.borderColor="var(--border)"},"aria-label":"Close modal",children:(0,o.jsx)(n.A,{style:{width:"20px",height:"20px"}})})]}),(0,o.jsxs)("div",{style:{padding:"24px"},children:[(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Type"}),(0,o.jsx)("div",{style:{display:"flex",gap:"8px"},children:["paycheck","tips","bonus","other"].map(e=>{let r;return(0,o.jsx)("button",{type:"button",onClick:()=>S(e),style:{flex:1,padding:"10px 12px",borderRadius:"10px",border:(r=w===e)?"none":"1px solid var(--border)",cursor:"pointer",fontSize:"0.875rem",fontWeight:500,transition:"all 0.15s ease",background:r?"var(--progress-gradient-success)":"var(--bg-elevated)",color:r?"var(--primary-foreground)":"var(--foreground)",boxShadow:r?"0 4px 12px -4px rgba(16, 185, 129, 0.4)":"none"},children:e.charAt(0).toUpperCase()+e.slice(1)},e)})})]}),(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Source"}
1),(0,o.jsxs)("select",{value:v,onChange:e=>h(e.target.value),style:A,children:[(0,o.jsx)("option",{value:"",style:D,children:"Select a source"}),P.map(e=>(0,o.jsx)("option",{value:e.id,style:D,children:e.name},e.id)),(0,o.jsx)("option",{disabled:!0,style:{...D,borderTop:"1px solid",color:"var(--text-tertiary)"},children:"ââââââââââ"}),(0,o.jsx)("option",{value:"other",style:D,children:"Other (one-time income)"})]})]}),I&&(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Describe This Income *"}),(0,o.jsx)("input",{type:"text",value:m,onChange:e=>f(e.target.value),placeholder:"e.g., Tax Refund, Birthday Gift, Sold Item",maxLength:100,style:_,onFocus:e=>{e.currentTarget.style.borderColor="var(--success)",e.currentTarget.style.boxShadow="0 0 0 3px rgba(16, 185, 129, 0.15)"},onBlur:e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"}})]}),(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Amount"}),(0,o.jsxs)("div",{style:{position:"relative"},children:[(0,o.jsx)("span",{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",fontSize:"1.125rem",fontWeight:500,color:"var(--text-tertiary)"},children:B}),(0,o.jsx)("input",{type:"number",value:y,onChange:e=>b(e.target.value),placeholder:"0.00",step:"0.01",min:"0",style:{..._,paddingLeft:"40px"},onFocus:e=>{e.currentTarget.style.borderColor="var(--success)",e.currentTarget.style.boxShadow="0 0 0 3px rgba(16, 185, 129, 0.15)"},onBlur:e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"}})]})]}),"tips"===w&&(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Hours Worked *"}),(0,o.jsxs)("div",{style:{position:"relative"},children:[(0,o.jsx)(s.A,{style:{position:"absolute",left:"12px",top:"50%",transform:"translateY(-50%)",width:"20px",height:"20px",color:"var(--text-tertiary)"}}),(0,o.jsx)("input",{type:"number",value:E,onChange:e=>F(e.target.value),placeholder:"0",step:"0.5",min:"0",style:{..._,paddingLeft:"40px"},onFocus:e=>{e.currentTarget.style.borderColor="var(--success)",e.currentTarget.style.boxShadow="0 0 0 3px rgba(16, 185, 129, 0.15)"},onBlur:e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"}})]}),z&&(0,o.jsxs)("div",{style:{backgroundColor:"var(--success-light)",border:"1px solid var(--success-border)",borderRadius:"12px",padding:"12px 16px",marginTop:"12px",display:"flex",alignItems:"center",gap:"8px"},children:[(0,o.jsxs)("span",{style:{color:"var(--success)",fontWeight:600},children:[B,z,"/hr"]}),(0,o.jsx)("span",{style:{color:"var(--muted-foreground)",fontSize:"0.875rem"},children:"average"})]})]}),(0,o.jsxs)("div",{style:{marginBottom:"20px"},children:[(0,o.jsx)("label",{style:M,children:"Date"}),(0,o.jsx)(c.M,{value:j,onChange:e=>C(e),inputStyle:_})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{style:M,children:"Notes (Optional)"}),(0,o.jsx)("input",{type:"text",value:k,onChange:e=>T(e.target.value),placeholder:"Add a note...",style:_,onFocus:e=>{e.currentTarget.style.borderColor="var(--success)",e.currentTarget.style.boxShadow="0 0 0 3px rgba(16, 185, 129, 0.15)"},onBlur:e=>{e.currentTarget.style.borderColor="var(--border)",e.currentTarget.style.boxShadow="none"}})]})]}),(0,o.jsxs)("div",{style:{padding:"16px 24px",borderTop:"1px solid var(--border)",display:"flex",gap:"12px"},children:[(0,o.jsx)("button",{onClick:t,style:{flex:1,padding:"12px 20px",backgroundColor:"var(--bg-elevated)",border:"1px solid var(--border)",borderRadius:"12px",color:"var(--muted-foreground)",fontWeight:500,fontSize:"0.9375rem",cursor:"pointer",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--bg-elevated)",e.currentTarget.style.borderColor="var(--input)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="var(--bg-elevated)",e.currentTarget.style.borderColor="var(--border)"},children:"Cancel"}),(0,o.jsx)("button",{onClick:W,disabled:L,style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",background:"var(--progress-gradient-success)",color:"var(--primary-foreground)",padding:"12px 20px",borderRadius:"12px",fontWeight:500,fontSize:"0.9375rem",border:"none",cursor:L?"not-allowed":"pointer",opacity:L?.7:1,boxShadow:"0 4px 12px -4px rgba(16, 185, 129, 0.4)",transition:"all 0.15s ease"},onMouseEnter:e=>{L||(e.currentTarget.style.transform="translateY(-1px)",e.currentTarget.style.boxShadow="0 6px 16px -4px rgba(16, 185, 129, 0.5)")},onMouseLeave:e=>{e.currentTarget.style.transform="translateY(0)",e.currentTarget.style.boxShadow="0 4px 12px -4px rgba(16, 185, 129, 0.4)"},children:L?"Saving...":"Log Income"})]})]})})}},88919:(e,r,t)=>{t.d(r,{W:()=>a});var o=t(81699);let a={getSources:async()=>(await o.uE.get("/income/sources")).data,getSourceById:async e=>(await o.uE.get("/income/sources/".concat(e))).data,createSource:async e=>(await o.uE.post("/income/sources",e)).data,updateSource:async(e,r)=>(await o.uE.put("/income/sources/".concat(e),r)).data,deleteSource:async e=>{await o.uE.delete("/income/sources/".concat(e))},getLogs:async(e,r,t,a)=>{let n=new URLSearchParams;return e&&n.append("source_id",e),r&&n.append("limit",r.toString()),t&&n.append("startDate",t),a&&n.append("endDate",a),(await o.uE.get("/income/logs?".concat(n.toString()))).data},createLog:async e=>(await o.uE.post("/income/logs",e)).data,updateLog:async(e,r)=>(await o.uE.put("/income/logs/".concat(e),r)).data,deleteLog:async e=>{await o.uE.delete("/income/logs/".concat(e))},getStats:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"month";return(await o.uE.get("/income/stats?period=".concat(e))).data},getTotalMonthlyIncome:async()=>(await o.uE.get("/income/total")).data.totalMonthlyIncome,quickAdd:async(e,r,t)=>(await o.uE.post("/income/sources/".concat(e,"/quick-add"),{amount:r,notes:t})).data,addDailyTips:async(e,r)=>(await o.uE.post("/income/tips",{amount:e,notes:r})).data}}}]);
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.