@accounter/client
Version:
Accounter client application
1 lines • 1.82 kB
JavaScript
import{Cu as e,Id as t,Pn as n,Xn as r,dc as i,fc as a,jd as o,rr as s}from"./index-CSYTUOOk.js";var c=t(o(),1),l=e(),u=({subCommentaryData:e,dataRow:t})=>{let[i,o]=(0,c.useState)(!1),u=e.map(e=>r(a,e));return(0,l.jsxs)(l.Fragment,{children:[t((0,l.jsx)(n,{toggleExpansion:o,isExpanded:i})),i&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:99,children:(0,l.jsxs)(s,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`Entity`}),(0,l.jsx)(`th`,{children:`Amount`})]})}),(0,l.jsxs)(`tbody`,{children:[u?.sort((e,t)=>e.financialEntity.name.localeCompare(t.financialEntity.name)).map(e=>(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`td`,{children:e.financialEntity.name}),(0,l.jsx)(`td`,{children:e.amount.formatted})]},e.financialEntity.id)),(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8})})]})]})})})]})},d=({commentaryData:e,dataRow:t})=>{let[a,o]=(0,c.useState)(!1),{records:d}=r(i,e);return(0,l.jsxs)(l.Fragment,{children:[t(d.length?(0,l.jsx)(n,{toggleExpansion:o,isExpanded:a}):null),a&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:99,children:(0,l.jsxs)(s,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{children:`Sort Code`}),(0,l.jsx)(`th`,{children:`Amount`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[d?.sort((e,t)=>e.sortCode.key-t.sortCode.key).map(e=>(0,l.jsx)(u,{dataRow:t=>(0,l.jsxs)(`tr`,{children:[(0,l.jsxs)(`td`,{children:[e.sortCode.key,` - `,e.sortCode.name]}),(0,l.jsx)(`td`,{children:e.amount.formatted}),(0,l.jsx)(`td`,{children:t})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8})})]})]})})})]})};export{d as t};