diff options
Diffstat (limited to 'src/expense/templates/macros.html')
-rw-r--r-- | src/expense/templates/macros.html | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/expense/templates/macros.html b/src/expense/templates/macros.html new file mode 100644 index 0000000..2d83155 --- /dev/null +++ b/src/expense/templates/macros.html @@ -0,0 +1,36 @@ +{% macro label_field(label) -%} +{% for error in label.errors %} +<span>{{ error }}</span> +{% endfor %} +{{ label.label }} +{{ label() }} +{%- endmacro %} + +{% macro expense_table(data, total) -%} +<table> + <thead> + <tr> + <th></th> + <th>Date</th> + <th>Category</th> + <th>Description</th> + <th>Amount</th> + </tr> + </thead> + <tbody> + {% for row in data %} + <tr> + <td><a href="{{ url_for("tracker.trans", id=row.id ) }}">Edit</a></td> + <td><time datetime="{{ row.date.strftime("%Y-%m-%d") }}">{{ row.date.strftime("%d/%m/%Y") }}<time></td> + <td><a href="{{ url_for("tracker.cat", id=row.category.id ) }}">{{ row.category.name }}</a></td> + <td>{{ row.description }}</td> + <td>{{ "%.2f"|format(row.amount) }}</td> + </tr> + {% endfor %} + <tfoot> + <td colspan="4">Overall</td> + <td>{{ "%.2f"|format(total) }}</td> + </tfoot> + </tbody> +</table> +{%- endmacro %}
\ No newline at end of file |