summaryrefslogtreecommitdiff
path: root/templates/transaction.html.tera
blob: b36b12a767cd6adebcf816d28596b8934294ff86 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> -->
  <link rel="stylesheet" href="/static/bootstrap.min.css">
  <link rel="stylesheet" href="/static/coustom.css">
	<title>Transaction Overview for account {{ account_name }}</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="#">Finz</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavDropdown">
    <ul class="navbar-nav">
      <li class="nav-item active">
      <li class="nav-item dropdown active">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		{{ account_name }} 
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
		<a class="dropdown-item" href="/transactions/{{ account_name }}">All Transactions</a>
		<a class="dropdown-item" href="/chart/{{ account_name }}">Spending chart</a>
		<a class="dropdown-item" href="/balance/{{account_name }}">Balance</a>
        </div>
      </li>
      <li class="nav-item dropdown active">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
		Asset 
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
          <a class="dropdown-item" href="/asset">Overview</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Investing</a>
      </li>
    </ul>
  </div>
</nav>
<!-- content -->
<div class="container">
<div class="md-form mt-0" style="padding-top: 20px;">
	<form name="filter" method="get" action="/transactions/{{ account_name }}">
		{% if filter == "" %}
		<input id="filter" name="filter" class="form-control" type="text" placeholder="Filter">
		{% else %}
		<input id="filter" name="filter" class="form-control" type="text" value="{{ filter }}">
		{% endif %}
	<input type="submit" style="visibility: hidden; display: none" />
	<h6 style="padding-top:5px; visibility: hidden;" id="help" class="text-success">Help: search single rows with: sender=value; logical || and && are also possible</h6>
</div>
<div style="text-align:center; margin: auto; width:100%; padding: 10px;">
	<input type="month" id="start" name="start" value="{{ date_start }}"> to <input type="month" id="end" name="end" value="{{ date_end }}">
	<input type="submit" value="Show" class="btn btn-light">
	</form>
</div>
<h1>Transactions <small class="text-muted">{{ account_name }}</small></h1>
  <div class="row">
  <div class="col-sm-12">
	<table class="table table-hover">
		<thead>
			<tr>
			<th>Sender</th>
			<th>Reference</th>
			<th>Date</th>
			<th>Amount</th>
			</tr>
		</thead>
		<tbody>
		  {% set amount_sum = 0 %}
		  {% for transaction in transactions %}
			  <tr>
				<td>{{ transaction.sender_name }}</td>
				<td>{{ transaction.reference | truncate(length=40) }}</td>
				<td>{{ transaction.date }}</td>
				{% if transaction.amount >= 0 %}
				<td class="text-success">{{ transaction.amount | round(method="common", precision=2) }}</td>
				{% else %}
				<td class="text-danger">{{ transaction.amount | round(method="common", precision=2) }}</td>
				{% endif %}
			</tr>
			{% set_global amount_sum = amount_sum + transaction.amount %}
		  {% endfor %}
		  <tr style="border-top:2px solid #000000;">
		  <td></td>
		  <td></td>
		  <td></td>
		{% if amount_sum >= 0 %}
		<td class="text-success">{{ amount_sum | round(method="common", precision=2) }}</td>
		{% else %}
		<td class="text-danger">{{ amount_sum | round(method="common", precision=2) }}</td>
		{% endif %}
		  </tr>
		</tbody>
	</table>
     </div>
  </div>
</div>
  <script src="/static/jquery.min.js"></script>
  <script src="/static/popper.min.js"></script>
  <script src="/static/bootstrap.min.js"></script>
	<script>
	$(document).ready(function() {
		$("#filter").focus(function() {
			$("#help").css("visibility", "visible");
		});
		$("#filter").focusout(function() {
			$("#help").css("visibility", "hidden");
		});
	});
	</script>
</body>
</html>