@accounter/client
Version:
Accounter client application
1 lines • 2.41 kB
JavaScript
import{s as e}from"./dist-ypP48_Ax.js";import{i as t,o as n}from"./utils-CbS-oR5I.js";import{Jt as r,Ot as i}from"./common-CXB0UgWw.js";import{el as a}from"./table-Dje35oxp.js";import{Xi as o,Zi as s}from"./graphql-BIob9ctl.js";import{t as c}from"./ledger-table-nIylNNvP.js";var l=e(n(),1),u=t(),d=({record:e})=>{let[t,n]=(0,l.useState)(!1);return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{children:e.financialEntity.name}),(0,u.jsx)(`td`,{children:e.amount.formatted}),(0,u.jsx)(`td`,{children:e.ledgerRecords?.length>0&&(0,u.jsx)(i,{toggleExpansion:n,isExpanded:t})})]}),t&&e.ledgerRecords&&(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:99,children:(0,u.jsx)(`div`,{className:`ml-8`,children:(0,u.jsx)(c,{ledgerRecordsData:e.ledgerRecords})})})})]})},f=({subCommentaryData:e,dataRow:t})=>{let[n,o]=(0,l.useState)(!1),c=e.map(e=>a(s,e));return(0,u.jsxs)(u.Fragment,{children:[t((0,u.jsx)(i,{toggleExpansion:o,isExpanded:n})),n&&(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:99,children:(0,u.jsxs)(r,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Entity`}),(0,u.jsx)(`th`,{children:`Amount`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsxs)(`tbody`,{children:[c?.sort((e,t)=>e.financialEntity.name.localeCompare(t.financialEntity.name)).map(e=>(0,u.jsx)(d,{record:e},e.financialEntity.id)),(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:8})})]})]})})})]})},p=({commentaryData:e,dataRow:t})=>{let[n,s]=(0,l.useState)(!1),{records:c}=a(o,e),d=c.length?(0,u.jsx)(i,{toggleExpansion:s,isExpanded:n}):null;return(0,u.jsxs)(u.Fragment,{children:[t(d),n&&(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:99,children:(0,u.jsxs)(r,{striped:!0,highlightOnHover:!0,className:`ml-8 w-full h-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`Sort Code`}),(0,u.jsx)(`th`,{children:`Amount`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsxs)(`tbody`,{children:[c?.sort((e,t)=>e.sortCode.key-t.sortCode.key).map(e=>(0,u.jsx)(f,{dataRow:t=>(0,u.jsxs)(`tr`,{children:[(0,u.jsxs)(`td`,{children:[e.sortCode.key,` - `,e.sortCode.name]}),(0,u.jsx)(`td`,{children:e.amount.formatted}),(0,u.jsx)(`td`,{children:t})]},e.sortCode.key),subCommentaryData:e.records},e.sortCode.key)),(0,u.jsx)(`tr`,{children:(0,u.jsx)(`td`,{colSpan:8})})]})]})})})]})};export{p as t};