PageSourceSearch

https://vizops360.ai/assets/finance.investments-DHgAB1sd.js

js vizops360.ai collected 2026-10-05 13:52:49 UTC 4,688 bytes, 1 lines download raw bytes

1import{d3 as g,j as t,eN as w,eO as j,r as a,b4 as I,b3 as N,bN as k,bO as C,L as c,ao as T,bP as A,bT as F,eb as M,bf as S,b9 as u,aI as m}from"./index-CpeGhXo5.js";import{s as V}from"./financeMappers-CUv1G2pV.js";import{u as D}from"./useCurrencyHelpers-D5hUvgaW.js";import{F as P}from"./FilterBar-B_jdgGzl.js";import{u as R}from"./useGlobalFilter-BkOUrZeG.js";import{C as B}from"./EntityPill-btGCy98_.js";import"./currency-CACMzR5Q.js";import"./filters-DQMtevU2.js";import"./mock-Ci00pIzy.js";function Y(){const r=g();return r||t.jsx(O,{})}function O(){const{fmtConvCompact:r}=D(),{data:i,isLoading:h,isFetching:p,refetch:x}=w({limit:500}),[o]=j(),[f,l]=a.useState([]),[b,d]=a.useState(!1),v=[{id:"inv-101",name:"HDFC Nifty 50 Index Mutual Fund (Growth)",type:"Mutual Fund",invested:3e5,currentValue:42e4,roi:40,status:"Active",date:"2023-02-10"},{id:"inv-102",name:"SBI 12-Month Corporate Fixed Deposit (7.25% p.a.)",type:"Fixed Deposit",invested:25e4,currentValue:268e3,roi:7.2,status:"Active",date:"2023-08-15"},{id:"inv-103",name:"RBI Sovereign Gold Bond 2024 Series I",type:"Bonds & Bullion",invested:15e4,currentValue:195e3,roi:30,status:"Active",date:"2023-05-01"}],y=a.useMemo(()=>{const e=(i?.items??[]).map(V);return e.length>0?e:v},[i]),n=R(y,"date");return n.reduce((e,s)=>e+s.invested,0),n.reduce((e,s)=>e+s.currentValue,0),n.length>0&&n.reduce((e,s)=>e+s.roi,0)/n.length,t.jsxs("div",{className:"flex flex-col flex-1 h-full min-h-0 overflow-hidden bg-slate-50/50",children:[t.jsx(I,{title:"Investments",subtitle:"Treasury & Investment Portfolio Management",accentVar:"--mod-finance",showMonthYearFilter:!1}),t.jsx("div",{className:"shrink-0 bg-surface/50 border-b border-border px-4 py-2 flex items-center justify-between flex-wrap gap-2",children:t.jsx(P,{showMonths:!0,actions:t.jsx(N,{delayDuration:150,children:t.jsxs(k,{children:[t.jsx(C,{asChild:!0,children:t.jsx(c,{to:"new",className:"h-8 w-8 p-0 rounded-lg bg-blue-600 hover:bg-blue-700 text-white inline-flex items-center justify-center shadow-2xs transition-colors shrink-0 cursor-pointer",children:t.jsx(T,{className:"w-4 h-4"})})}),t.jsx(A,{side:"bottom",align:"end",children:t.jsx("p",{children:"Add Investment"})})]})})})}),t.jsx("div",{className:"p-3 pb-3 flex-1 min-h-0 flex flex-col overflow-hidden",children:t.jsx(F,{selectable:!0,selectedIds:f,onSelectionChange:l,bulkActions:[{id:"delete",label:"Delete",icon:t.jsx(u,{className:"w-3.5 h-3.5"}),variant:"destructive",onAction:async e=>{if(confirm(`Delete ${e.length} selected investment(s)?`)){for(const s of e)try{await o(s.id).unwrap()}catch{}m.success(`Deleted ${e.length} investment(s)`),l([])}}}],rows:n,rowKey:e=>e.id,searchKeys:["name","type","status"],searchPlaceholder:"Search investments...",storageKey:"finance-investments",initialPageSize:10,fetching:p||h||b,onRefresh:async()=>{d(!0),await x(),setTimeout(()=>d(!1),500)},fillHeight:!0,columns:[{key:"id",label:"ID",width:"80px",sortable:!0},{key:"name",label:"Investment Name",sortable:!0},{key:"type",label:"Type",width:"140px",sortable:!0,render:e=>t.jsx(B,{name:e.type})},{key:"date",label:"Invested On",width:"100px",sortable:!0},{key:"invested",label:"Invested",align:"right",width:"120px",sortable:!0,sortValue:e=>e.invested,render:e=>t.jsx("span",{className:"font-data",children:r(e.invested)})},{key:"currentValue",label:"Current Value",align:"right",width:"130px",sortable:!0,sortValue:e=>e.currentValue,render:e=>t.jsx("span",{className:"font-data font-semibold",children:r(e.currentValue)})},{key:"roi",label:"ROI %",align:"right",width:"90px",sortable:!0,sortValue:e=>e.roi,render:e=>t.jsx("span",{className:"font-data text-success font-semibold",children:M(e.roi)})},{key:"status",label:"STATUS",width:"90px",sortable:!0,render:e=>t.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-success/12 text-success font-semibold",children:e.status})},{key:"actions",label:"ACTIONS",width:"80px",sortable:!1,fixed:"right",render:e=>t.jsxs("div",{className:"flex items-center gap-1 opacity-40 group-hover:opacity-100 transition-opacity justify-center",children:[t.jsx(c,{to:`new?editId=${encodeURIComponent(e.id)}`,className:"p-1 rounded hover:bg-primary/10 hover:text-primary transition-colors",children:t.jsx(S,{className:"w-3.5 h-3.5"})}),t.jsx("button",{type:"button",onClick:async()=>{confirm("Are you sure you want to delete this investment?")&&(await o(e.id).unwrap(),m.success("Investment record deleted successfully"))},className:"p-1 rounded hover:bg-danger/10 hover:text-danger transition-colors",children:t.jsx(u,{className:"w-3.5 h-3.5"})})]})}],onRowClick:e=>navigate(`new?editId=${encodeURIComponent(e.id)}`)})})]})}export{Y as InvestmentsLayout,Y 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.