@accounter/client
Version:
Accounter client application
1 lines • 1.95 kB
JavaScript
import{s as e}from"./dist-C51EwTaa.js";import{i as t,o as n}from"./utils-DdVdMk8X.js";import{Ai as r,ji as i}from"./error-handling-Dpfd9svJ.js";import{W as a}from"./table--bF0wbxq.js";import{Wt as o,ln as s}from"./index-CL8-JoMZ.js";var c=e(n(),1),l=t(),u=({subCommentaryData:e,dataRow:t})=>{let[n,r]=(0,c.useState)(!1),u=e.map(e=>a(i,e));return(0,l.jsxs)(l.Fragment,{children:[t((0,l.jsx)(o,{toggleExpansion:r,isExpanded:n})),n&&(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[n,i]=(0,c.useState)(!1),{records:d}=a(r,e);return(0,l.jsxs)(l.Fragment,{children:[t(d.length?(0,l.jsx)(o,{toggleExpansion:i,isExpanded:n}):null),n&&(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};