<commit_before>{% extends 'KassnerFinancesBundle::layout.html.twig' %}

{% block body -%}
<div class="crud">
    <h1>{{ account.name }}</h1>

    <div class="control">
        <a class="btn btn-success" href="{{ path('transaction_new', { 'account': account.id }) }}">{{ "Add"|trans }}</a>
        <a class="btn btn-default pull-right" data-toggle="collapse" href="#search-panel">{{ "Search"|trans }}</a>
        <div class="clearfix"></div>
    </div>

    <div class="panel panel-default panel-collapse collapse {% if showSearch %}in{% else %}out{% endif %}" id="search-panel">
        <div class="panel-heading">
            <h3 class="panel-title">{{ "Search"|trans }}</h3>
        </div>
        <div class="panel-body">
            {{ form(search_form) }}
        </div>
    </div>

    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>{{ "Id"|trans }}</th>
                <th>{{ "Status"|trans }}</th>
                <th>{{ "Category"|trans }}</th>
                <th>{{ "Payee"|trans }}</th>
                <th>{{ "Amount"|trans }}</th>
                <th>{{ "Date"|trans }}</th>
                <th width="170">{{ "Actions"|trans }}</th>
            </tr>
        </thead>
        <tbody>
            {% for entity in entities %}
            <tr class="{% if not entity.isReconciled %}warning{% endif %}">
                <td>{{ entity.id }}</td>
                <td>{% if entity.isReconciled %}Reconciled{% else %}Unreconciled{% endif %}</td>
                <td>{{ entity.category }}</td>
                <td>{{ entity.payee }}</td>
                <td>
                    {% if entity.type == 'expense' or (entity.type == 'transfer' and account.id == entity.account.id) %}
                    {{ (entity.amount * -1)|price }}
                    {% else %}
                    {{ entity.amount|price }}
                    {% endif %}
                </td>
                <td>{% if entity.date %}{{ entity.date|date('d/m/Y') }}{% endif %}</td>
                <td>
                    <a class="btn btn-primary" href="{{ path('transaction_edit', { 'id': entity.id }) }}">{{ "Edit"|trans }}</a>
                    <a class="btn btn-danger" href="{{ path('transaction_delete', { 'id': entity.id }) }}" onclick="return confirm('{{ "Are you sure?"|trans }}');">{{ "Delete"|trans }}</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <div class="control">
        <a class="btn btn-success" href="{{ path('transaction_new', { 'account': account.id }) }}">{{ "Add"|trans }}</a>
    </div>
</div>
{% endblock %}<commit_msg>Added balance to transaction list<commit_after>{% extends 'KassnerFinancesBundle::layout.html.twig' %}

{% block body -%}
<div class="crud">
    <h1>{{ account.name }}</h1>

    <div class="control">
        <a class="btn btn-success" href="{{ path('transaction_new', { 'account': account.id }) }}">{{ "Add"|trans }}</a>
        <a class="btn btn-default pull-right" data-toggle="collapse" href="#search-panel">{{ "Search"|trans }}</a>
        <div class="clearfix"></div>
    </div>

    <div class="panel panel-default panel-collapse collapse {% if showSearch %}in{% else %}out{% endif %}" id="search-panel">
        <div class="panel-heading">
            <h3 class="panel-title">{{ "Search"|trans }}</h3>
        </div>
        <div class="panel-body">
            {{ form(search_form) }}
        </div>
    </div>

    <table class="table table-bordered table-hover">
        <thead>
            <tr>
                <th>{{ "Id"|trans }}</th>
                <th>{{ "Status"|trans }}</th>
                <th>{{ "Category"|trans }}</th>
                <th>{{ "Payee"|trans }}</th>
                <th>{{ "Date"|trans }}</th>
                <th>{{ "Amount"|trans }}</th>
                <th>{{ "Balance"|trans }}</th>
                <th width="170">{{ "Actions"|trans }}</th>
            </tr>
        </thead>
        <tbody>
            {% set balance = 0 %}
            {% for entity in entities %}
            <tr class="{% if not entity.isReconciled %}warning{% endif %}">
                <td>{{ entity.id }}</td>
                <td>{% if entity.isReconciled %}Reconciled{% else %}Unreconciled{% endif %}</td>
                <td>{{ entity.category }}</td>
                <td>{{ entity.payee }}</td>
                <td>{% if entity.date %}{{ entity.date|date('d/m/Y') }}{% endif %}</td>
                <td>
                    {% if entity.type == 'expense' or (entity.type == 'transfer' and account.id == entity.account.id) %}
                    {% set balance = balance + (entity.amount * -1) %}
                    {{ (entity.amount * -1)|price }}
                    {% else %}
                    {% set balance = balance + entity.amount %}
                    {{ entity.amount|price }}
                    {% endif %}
                </td>
                <td>{{ balance|price }}</td>
                <td>
                    <a class="btn btn-primary" href="{{ path('transaction_edit', { 'id': entity.id }) }}">{{ "Edit"|trans }}</a>
                    <a class="btn btn-danger" href="{{ path('transaction_delete', { 'id': entity.id }) }}" onclick="return confirm('{{ "Are you sure?"|trans }}');">{{ "Delete"|trans }}</a>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <div class="control">
        <a class="btn btn-success" href="{{ path('transaction_new', { 'account': account.id }) }}">{{ "Add"|trans }}</a>
    </div>
</div>
{% endblock %}
{'fraction_non_alphanumeric': 0.21445263347114865, 'fraction_numerical': 0.0032356642099586556, 'mean_word_length': 1.8186423505572442, 'pattern_counts': {'":': 0, '<': 139, '<?xml version=': 0, '>': 139, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628319', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1619, 'n_words': 382}