web/penny/templates/account.html
{% extends "navbar.html" %}
{% block content %}
<div class="container-fluid">
<h1 class="h3 mb-2 text-gray-800">Account</h1>
<div class="card shadow mb-4">
<div class="card-body">
<div class="table-responsive">
{% if account.id %}
<form action="{{ url_for('accounts.account', id=account.id) }}" method="POST">
{% else %}
<form action="{{ url_for('accounts.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>Type</td>
<td>
{% if form.accounttype.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.accounttype.errors[0] }}</label>
{% endif -%}
<select id="accounttype" name="accounttype" class="form-control">
{% for choice in form.accounttype.choices %}
{% set key = choice.0 %}
{% set value = choice.1 %}
<option value="{{ key }}"{% if form.accounttype.default == key %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>
{% if form.accounttype.errors -%}
</div>
{% endif -%}
</td>
</tr>
<tr>
<td>Entity</td>
<td>
{% if form.entity.errors -%}
<div class="form-group has-error">
<label class="control-label" for="inputError">{{ form.entity.errors[0] }}</label>
{% endif -%}
<select id="entity" name="entity" class="form-control">
{% for choice in form.entity.choices %}
{% set key = choice.0 %}
{% set value = choice.1 %}
<option value="{{ key }}"{% if form.entity.default == key %} selected="selected"{% endif %}>{{ value }}</option>
{% endfor %}
</select>
{% if form.entity.errors -%}
</div>
{% endif -%}
</td>
</tr>
<tr>
<td>Transactions</td>
<td>{% if account %}<a href="{{ url_for('transactions.account', id=account.id) }}">{{ transactions_amount }}</a>{% endif %}</td>
</tr>
<tr>
<td>Reports</td>
<td>
{% if account %}<ul>
<li><a href="{{ url_for('reports.account_monthly_breakdown', account_id=account.id) }}">Account Monthly Breakdown</a></li>
</ul>{% endif %}
</td>
</tr>
</tbody>
</table>
{% if request.path == "/accounts/add" %}
{% set submit_name = 'add' %}
{% set submit_value = 'Add' %}
{% set display_filter_btn = False %}
{% else %}
{% set submit_name = 'update' %}
{% set submit_value = 'Update' %}
{% set display_filter_btn = True %}
{% 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 %}