Files: 6f9ed10872eb05dbde900a885c8e412c20447599 / views / transactions.js
1117 bytesRaw
1 | var h = require('hyperscript') |
2 | const TITLE = 'double - transactions' |
3 | const Nav = require('../components/nav') |
4 | const Styles = require('../components/styles') |
5 | |
6 | function transactionsView (state, emit) { |
7 | const entries = h('div.tc.pb6', [ |
8 | h('table.center', [ |
9 | h('thead', h('tr', [ |
10 | h('td.pr2', 'account'), |
11 | h('td.pr2', 'debit'), |
12 | h('td.pr2', 'credit'), |
13 | h('td.pr2', 'description') |
14 | ])), |
15 | h('tbody', state.entries.map(entry => ['debit', 'credit'].map(i => { |
16 | return i === 'debit' |
17 | ? h('tr.bg-light-gray', [ |
18 | h('td', entry.msg.debit), |
19 | h('td', entry.msg.amount), |
20 | h('td', ''), |
21 | h('td', entry.msg.description) |
22 | ]) |
23 | : h('tr', [ |
24 | h('td', entry.msg.credit), |
25 | h('td', ''), |
26 | h('td.bg-washed-red', entry.msg.amount), |
27 | h('td', entry.msg.description) |
28 | ]) |
29 | }))) |
30 | ]) |
31 | ]) |
32 | |
33 | return h('body.code.ph3.lh-copy', [ |
34 | state.cache(Styles, 'styles').render(), |
35 | state.cache(Nav, 'nav').render(), |
36 | entries |
37 | ]) |
38 | } |
39 | |
40 | module.exports = transactionsView |
41 |
Built with git-ssb-web