PageSourceSearch

https://secure-static.fattureincloud.it/0214dc791091ff2a97b15f5961a56803/assets/AmortizationsPage-6itjuqrY.js

js fattureincloud.it collected 2026-09-24 15:34:55 UTC 2,285 bytes, 1 lines download raw bytes

1import{r as c,du as A,e as x,j as n,hC as y,dp as j,h as E,dk as M,fO as O,bO as h,m7 as f,bN as g,nj as z,hD as I}from"./index-D_dQ-BFB.js";const L=e=>{const s=A();return c.useMemo(()=>[{name:"Ammortamenti",color:s.palette.blue[500],points:Object.entries(e).map(([o,t])=>({x:o,y:t}))}],[s.palette.blue,e])},l=["year1","year2","year3","year4","year5","year6","year7","year8","year9"],R=()=>{const{fiscalYear:e}=x("localStorage",["fiscalYear"]);return c.useMemo(()=>{const s=l.map((o,t)=>({columnDefType:y.ACCESSOR,key:o,columnDef:{header:(t+e-4).toString(),enableSorting:!1,customCell:r=>n.jsx(n.Fragment,{children:r.original[o]?j(r.original[o]):""})}}));return[{columnDefType:y.ACCESSOR,key:"description",columnDef:{header:"Descrizione",enableSorting:!0,maxWidth:200}},...s]},[e])},V=(e,s)=>c.useMemo(()=>{const o=l.reduce((t,r,a)=>({...t,[r]:a+s-4}),{});return e.reduce((t,r)=>(l.forEach(a=>{t[o[a]]=(t[o[a]]||0)+r[a]}),t),{})},[e,s]),P=(e,s)=>{const o=[...Array(9).keys()].reduce((t,r)=>({...t,[r+s-4]:l[r]}),{});return e.map(t=>{const r={description:t.description,id:t.id,...l.reduce((a,u)=>({...a,[u]:0}),{})};return t.amortizationsList.forEach(a=>{a.year in o&&(r[o[a.year]]=a.cost)}),r})},Y=e=>[j(e),"Totale"],N=()=>{const{fiscalYear:e}=x("localStorage",["fiscalYear"]),[s,o]=c.useState([]),[t,r]=c.useState(!1),[a,u]=c.useState(),S=R(),C=V(s,e),D=L(C),d=c.useCallback(()=>{r(!0),E.get({request:"amortizations",queryData:{year:e}}).then(i=>{o(P(i.data.data,e))}).catch(i=>console.error(i)).finally(()=>r(!1))},[e]);c.useEffect(()=>d(),[d]);const T=c.useMemo(()=>{const i=M.cloneDeep(s);return i.sort((m,p)=>{const b=a?a.direction==="asc"?1:-1:1;return(a?m.description.localeCompare(p.description,"it"):m.id>p.id?1:-1)*b}),i},[a,s]);return n.jsxs(O,{background:"secondary",gap:24,children:[n.jsxs("div",{children:[n.jsxs(h,{style:{marginBottom:8},children:["AMMORTAMENTI ATTIVI NEL ",e]}),n.jsx(f,{style:{padding:0},children:t?n.jsx(g,{fullscreenCentered:!0}):n.jsx(z,{data:D,height:300,showTooltip:!0,formatTooltipValues:Y})})]}),n.jsxs("div",{children:[n.jsx(h,{style:{marginBottom:8},children:"RIEPILOGO"}),n.jsx(f,{children:t?n.jsx(g,{fullscreenCentered:!0}):n.jsx(I,{uniqueId:"id",data:T,columns:S,sortable:!0,onSort:i=>u(i),noPagination:!0})})]})]})};export{N 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.