git ssb

0+

punkmonk / double



Tree: 8a55ce7a0a9c8d857b3bf814582e7c20674d2f22

Files: 8a55ce7a0a9c8d857b3bf814582e7c20674d2f22 / views / transactions.js

1117 bytesRaw
1var h = require('hyperscript')
2const TITLE = 'double - transactions'
3const Nav = require('../components/nav')
4const Styles = require('../components/styles')
5
6function 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
40module.exports = transactionsView
41

Built with git-ssb-web