summary history files

web/penny/templates/bankaccount.html
{% extends "navbar.html" %}
{% block content %}
<div class="container-fluid">
    <h1 class="h3 mb-2 text-gray-800">Bank Account</h1>
    <div class="card shadow mb-4">
        <div class="card-body">
            <div class="table-responsive">
                {%- if bankaccount -%}
                <form action="{{ url_for('bankaccounts.bankaccount', id=bankaccount.id) }}" method="POST">
                {%- else -%}
                <form action="{{ url_for('bankaccounts.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>Bank Name</td>
                            <td>
                                {%- if form.bank.errors -%}
                                <div class="form-group has-error">
                                    <label class="control-label" for="inputError">{{ form.bank.errors[0] }}</label>
                                {%- endif -%}
                                {{ form.bank(class="form-control") }}
                                {%- if form.bank.errors -%}
                                </div>
                                {%- endif -%}
                            </td>
                        </tr>
                        <tr>
                            <td>Bank Account Number</td>
                            <td>
                                {%- if form.number.errors -%}
                                <div class="form-group has-error">
                                    <label class="control-label" for="inputError">{{ form.number.errors[0] }}</label>
                                {%- endif -%}
                                {{ form.number(class="form-control") }}
                                {%- if form.number.errors -%}
                                </div>
                                {%- endif -%}
                            </td>
                        </tr>
                        <tr>
                            <td>Bank Account 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(class="form-control") }}
                                {%- if form.desc.errors -%}
                                </div>
                                {%- endif -%}
                            </td>
                        </tr>
                        <tr>
                            <td>Bank Account Type</td>
                            <td>
                                {%- if form.bankaccounttype.errors -%}
                                <div class="form-group has-error">
                                    <label class="control-label" for="inputError">{{ form.bankaccounttype.errors[0] }}</label>
                                {%- endif -%}
                                <select id="bankaccounttype" name="bankaccounttype" class="form-control">
                                    {% for choice in form.bankaccounttype.choices %}
                                    <option value="{{ choice.0 }}"{% if form.bankaccounttype.default == choice.0 %} selected="selected"{% endif %}>{{choice.1}}</option>
                                    {% endfor %}
                                </select>
                                {%- if form.bankaccounttype.errors -%}
                                </div>
                                {%- endif -%}
                            </td>
                        </tr>
                        <tr>
                            <td>Bank Account Entity Owner</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 %}
                                    <option value="{{ choice.0 }}"{% if form.entity.default == choice.0 %} selected="selected"{% endif %}>{{choice.1}}</option>
                                    {% endfor %}
                                </select>
                                {%- if form.entity.errors -%}
                                </div>
                                {%- endif -%}
                            </td>
                        </tr>
                        {%- if bankaccount -%}
                        <tr>
                            <td>Total Balance</td>
                            <td>
                                <a href="{{ url_for('transactions.bankaccount', id=bankaccount.id) }}">{{ bankaccount.dump()['total_balance'] }}</a>
                            </td>
                        </tr>
                        {%- endif -%}
                  </tbody>
                </table>
                {%- if request.path == "/bankaccounts/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 %}