git ssb

0+

punkmonk / double



Tree: 2572fe0b931c25cc2eceb014c272f1a57a9157a9

Files: 2572fe0b931c25cc2eceb014c272f1a57a9157a9 / views / transactions.js

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

Built with git-ssb-web