aboutsummaryrefslogtreecommitdiff
path: root/src/templates/ledger.html
blob: 9ffdeea4cc8eda51a29cb9d3a22e91f4f2cc897f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en">

<head>
    <title>{{name}}'s Budget</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="static/styles.css">
    <script src="/static/main.js"></script>
</head>

<body>
    <h1>{{name}}'s Budget</h1>
    <div>
        <a href="/ledger"><button class="bold">Ledger</button></a>
        <a href="/summary"><button>Summary</button></a>
        <a href="/goals"><button>Goals</button></a>
        <a href="/expected"><button>Expected</button></a>
        <a href="/about"><button>About</button></a>
    </div>
    <form method="post" action="/transaction">
        <input id="datePicker" name="when" placeholder="date" type="date"> 
        <input required name="where" placeholder="where" type="text"> 
        <input required name="amount" placeholder="amount" type="number" step="0.01"> 
        <input name="category" placeholder="category" type="text"> 
        <input name="subcategory" placeholder="tags (csv)" type="text"> 
        <input type="submit" value="Add">
    </form>
    <table>
        <tr>
            <th></th>
            <th>When</th>
            <th>Where</th>
            <th>Amount</th>
            <th>Category</th>
            <th>Tags</th>
            <th></th>
            <th></th>
        </tr>
        {{#each ledger}}
        <tr>
            <td>{{this.index}}</td>
            <td>{{this.when}}</td>
            <td>{{this.where}}</td>
            <td>{{this.amount}}</td>
            <td>{{this.category}}</td>
            <td>{{this.subcategory}}</td>
            <td><a href="/ledger/edit/{{this.id}}"><button>&#9881;</button></a></td>
            <td><button onclick="remove({{this.id}})">X</button></td>
        </tr>
        {{/each}}
    </table>
    <script>
        document.getElementById('datePicker').value = new Date().toLocaleDateString();
    </script>
</body>
</html>