web/penny/templates/tag.html
{% extends "navbar.html" %}
{% block content %}
<div class="container-fluid">
<h1 class="h3 mb-2 text-gray-800">Tag</h1>
<div class="card shadow mb-4">
<div class="card-body">
<div class="table-responsive">
{% include 'includes/display_flash_message.html' %}
{% if tag.id %}
<form action="{{ url_for('tags.tag', id=tag.id) }}" method="POST">
{% else %}
<form action="{{ url_for('tags.add') }}" method="POST">
{% endif %}
{{ form.hidden_tag()}}
{{ form.csrf_token }}
{% include 'includes/display_flash_message.html' %}
<table class="table table-bordered" width="100%" cellspacing="0" id="table">
<tbody>
<tr>
<td>Name</td>
<td>
{% if form.name.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.name.errors[0] }}</label>
{% endif -%}
{{ form.name(rows="1", class="form-control") }}
{% if form.name.errors -%}
</div>
{% endif -%}
</td>
</tr>
<tr>
<td>Description</td>
<td>
{% if form.desc.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.desc.errors[0] }}</label>
{% endif -%}
{{ form.desc(rows="1", class="form-control") }}
{% if form.desc.errors -%}
</div>
{% endif -%}
</td>
</tr>
<tr>
<td>Matches</td>
<td>
{% if form.regex.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.regex.errors[0] }}</label>
{% endif -%}
<p>{{ form.regex(rows="1", class="form-control") }}</p>
{% if form.regex.errors -%}
</div>
{% endif -%}
{% for regex in tag.regexes %}
{% set input_id = 'regex_' + regex.id|string %}
{% set input_name = 'regex_' + regex.id|string %}
<p><input class="form-control" id="{{ input_id }}" name="{{ input_name }}" rows="1" type="text" value="{{ regex.regex }}"></p>
{% endfor %}
</td>
</tr>
<tr>
<td>Transactions</td>
<td>{% if tag %}<a href="{{ url_for('transactions.tag', id=tag.id) }}">{{ transactions_amount }}</a>{% endif %}</td>
</tr>
<tr>
<td>Reports</td>
<td>
{% if tag %}<ul>
<li><a href="{{
url_for('reports.tag_monthly_breakdown',
tag_id=tag.id) }}">Tag Monthly
Breakdown</a></li>
</ul>
{% endif %}
</td>
</tr>
</tbody>
</table>
{% if request.path == "/tags/add" %}
{% set submit_name = 'add' %}
{% set submit_value = 'Add' %}
{% else %}
{% set submit_name = 'update' %}
{% set submit_value = 'Update' %}
{% endif %}
<div class="input-group btn-block" style="padding-top:10px;">
<div class="pull-left" style="padding-right:5px;">
<input type="submit" class="btn btn-primary" name="{{ submit_name }}" value="{{ submit_value }}">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
{% endblock %}